Merge "Bug 1333: Regression Test suite."
authorEd Warnicke <eaw@cisco.com>
Fri, 1 Aug 2014 10:25:31 +0000 (10:25 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 1 Aug 2014 10:25:31 +0000 (10:25 +0000)
597 files changed:
features/config-netty/pom.xml [new file with mode: 0644]
features/config-netty/src/main/resources/features.xml [new file with mode: 0644]
features/config-persister/pom.xml [new file with mode: 0644]
features/config-persister/src/main/resources/features.xml [new file with mode: 0644]
features/config/pom.xml
features/config/src/main/resources/features.xml
features/netconf/pom.xml
features/nsf/pom.xml [new file with mode: 0644]
features/nsf/src/main/resources/features.xml [new file with mode: 0644]
features/pom.xml
features/protocol-framework/pom.xml
opendaylight/commons/opendaylight/pom.xml
opendaylight/commons/protocol-framework/pom.xml
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/controller/config/yang/protocol/framework/ReconnectImmediatelyStrategyFactoryModule.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/controller/config/yang/protocol/framework/TimedReconnectStrategyFactoryModule.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/AbstractDispatcher.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ProtocolSessionPromise.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ReconnectPromise.java
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/SessionListener.java
opendaylight/commons/protocol-framework/src/main/yang/odl-protocol-framework-cfg.yang
opendaylight/commons/protocol-framework/src/test/java/org/opendaylight/controller/config/yang/protocol/framework/ReconnectImmediatelyStrategyModuleTest.java
opendaylight/commons/protocol-framework/src/test/java/org/opendaylight/controller/config/yang/protocol/framework/TimedReconnectStrategyModuleTest.java
opendaylight/commons/protocol-framework/src/test/java/org/opendaylight/protocol/framework/ServerTest.java
opendaylight/commons/protocol-framework/src/test/java/org/opendaylight/protocol/framework/SimpleDispatcher.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/ExtensibleBundleTracker.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/osgi/mapping/CodecRegistryProvider.java
opendaylight/config/yang-jmx-generator-plugin/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/JMXGeneratorTest.java
opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/ModuleMXBeanEntryBuilder.java
opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/RuntimeBeanEntry.java
opendaylight/config/yang-jmx-generator/src/test/resources/test-config-threads-java.yang
opendaylight/distribution/opendaylight-karaf/pom.xml
opendaylight/distribution/opendaylight-karaf/src/main/resources/karaf/instance [new file with mode: 0755]
opendaylight/distribution/opendaylight-karaf/src/main/resources/karaf/instance.bat [new file with mode: 0644]
opendaylight/distribution/opendaylight-karaf/src/main/resources/karaf/karaf [new file with mode: 0755]
opendaylight/distribution/opendaylight-karaf/src/main/resources/karaf/karaf.bat [new file with mode: 0644]
opendaylight/distribution/opendaylight/pom.xml
opendaylight/distribution/opendaylight/src/assemble/bin.xml
opendaylight/distribution/opendaylight/src/main/resources/configuration/initial/01-md-sal.xml
opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowConfig.java
opendaylight/forwardingrulesmanager/api/src/test/java/org/opendaylight/controller/forwardingrulesmanager/frmTest.java
opendaylight/md-sal/compatibility/flow-management-compatibility/src/main/java/org/opendaylight/controller/md/frm/compatibility/FRMRuntimeDataProvider.java
opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/TestFromSalConversionsUtils.java
opendaylight/md-sal/forwardingrules-manager/pom.xml
opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/FlowCapableInventoryProvider.java
opendaylight/md-sal/model/model-flow-statistics/src/main/yang/opendaylight-flow-statistics.yang
opendaylight/md-sal/pom.xml
opendaylight/md-sal/sal-akka-raft/README-FIRST [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/pom.xml [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/run.sh [new file with mode: 0755]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/ClientActor.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/ExampleActor.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/LogGenerator.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/Main.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/TestDriver.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/messages/KeyValue.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/messages/KeyValueSaved.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/messages/PrintRole.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/messages/PrintState.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/protobuff/messages/KeyValueMessages.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ClientRequestTracker.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ClientRequestTrackerImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ElectionTerm.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformation.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformationImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContext.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContextImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftState.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLog.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogEntry.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImplEntry.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SerializationUtils.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ApplySnapshot.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ApplyState.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/CommitEntry.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ElectionTimeout.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/PersistEntry.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/Replicate.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/SaveSnapshot.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/SendHeartBeat.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/SendInstallSnapshot.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractRaftActorBehavior.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Candidate.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Follower.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Leader.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/RaftActorBehavior.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/AddRaftPeer.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/FindLeader.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/FindLeaderReply.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/RemoveRaftPeer.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AbstractRaftRPC.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AppendEntries.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AppendEntriesReply.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshot.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshotReply.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/RaftRPC.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/RequestVote.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/RequestVoteReply.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/client/messages/Payload.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/messages/AppendEntriesMessages.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/messages/VotingMessages.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/resources/AppendEntriesMessages.proto [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/resources/KeyValueMessages.proto [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/resources/VotingMessages.proto [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/main/resources/application.conf [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/AbstractActorTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MockRaftActorContext.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractRaftActorBehaviorTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/CandidateTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/FollowerTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/LeaderTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/protobuff/messages/MockPayloadMessages.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/utils/DoNothingActor.java [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/test/resources/MockPayload.proto [new file with mode: 0644]
opendaylight/md-sal/sal-akka-raft/src/test/resources/application.conf [new file with mode: 0644]
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/BindingTransactionChain.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/DataBroker.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/MountPoint.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/MountPointService.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/TransactionFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/WriteTransaction.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/BindingAwareBroker.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataProviderService.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModule.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractForwardedDataBroker.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractForwardedTransaction.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractReadWriteTransaction.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractWriteTransaction.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDataWriteTransactionImpl.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingToNormalizedNodeCodec.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/ForwardedBackwardsCompatibleDataBroker.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/RpcIsNotRoutedException.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/RuntimeCodeGenerator.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/AbstractRuntimeCodeGenerator.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/DataBrokerImpl.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/MountPointManagerImpl.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcProviderRegistryImpl.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingIndependentConnector.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/BindingToDomCommitHandler.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/DomToBindingCommitHandler.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/DomToBindingRpcForwarder.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/DomToBindingTransaction.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/forward/DomForwardedBindingBrokerImpl.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/BindingNormalizedCodecTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/RpcProviderRegistryTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/WriteTransactionTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/DataBrokerTestCustomizer.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/compat/MultipleAugmentationPutsTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/MockSchemaService.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/ListProcessingAndOrderingTest.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug01Test.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug03Test.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DeleteNestedAugmentationListenParentTest.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/PutAugmentationTest.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/ChangeOriginatedInDomBrokerTest.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerMountPointTest.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerRpcTest.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/DOMRpcServiceTestBugfix560.java
opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/NotificationTest.java
opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalProviderInstance.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/RegistrationListener.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncWriteTransaction.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataCommitHandlerRegistration.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataProvisionService.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/notify/NotificationSubscriptionService.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RoutedRegistration.java
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/routing/AbstractDataReadRouter.java
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/AbstractDataBroker.java
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizationOperation.java
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizer.java
opendaylight/md-sal/sal-common-impl/src/test/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizerTest.java
opendaylight/md-sal/sal-connector-api/src/main/java/org/opendaylight/controller/sal/connector/api/Connector.java
opendaylight/md-sal/sal-connector-api/src/main/java/org/opendaylight/controller/sal/connector/api/ConnectorListener.java
opendaylight/md-sal/sal-distributed-datastore/pom.xml
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractUntypedActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ClusterWrapper.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ClusterWrapperImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/CompositeModificationPayload.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Configuration.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ConfigurationImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListener.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistration.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/NoOpCohort.java [new file with mode: 0644]
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/ShardManager.java
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/ThreePhaseCommitCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionChainProxy.java
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/exceptions/PrimaryNotFoundException.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/exceptions/TimeoutException.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/AbstractBaseMBean.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardMBeanFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStats.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStatsMBean.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/AbortTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/AbortTransactionReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CanCommitTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CanCommitTransactionReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseDataChangeListenerRegistration.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseDataChangeListenerRegistrationReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionChain.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionChainReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CommitTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CommitTransactionReply.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/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionChain.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionChainReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChanged.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChangedReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DeleteData.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DeleteDataReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/FindPrimary.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/MergeData.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/MergeDataReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ModifyData.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PeerAddressResolved.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PreCommitTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PreCommitTransactionReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryFound.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryNotFound.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadData.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadDataReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadyTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadyTransactionReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterChangeListener.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterChangeListenerReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/SerializableMessage.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/WriteData.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/WriteDataReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModification.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModification.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/ImmutableCompositeModification.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MergeModification.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/Modification.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MutableCompositeModification.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/WriteModification.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/DefaultShardStrategy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ModuleShardStrategy.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ActorContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/InstanceIdentifierUtils.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/resources/application.conf
opendaylight/md-sal/sal-distributed-datastore/src/main/resources/module-shards.conf [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/resources/modules.conf [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractActorTest.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/ConfigurationImplTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.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-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStatsTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/MergeDataTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModificationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModificationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MergeModificationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MutableCompositeModificationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/WriteModificationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ModuleShardStrategyTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactoryTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockActorContext.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockClusterWrapper.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockConfiguration.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/TestUtils.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CarsModel.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CompositeModel.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/PeopleModel.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/SampleModelsTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/SchemaContextHelper.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/TestModel.java
opendaylight/md-sal/sal-distributed-datastore/src/test/resources/application.conf
opendaylight/md-sal/sal-distributed-datastore/src/test/resources/cars.yang [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/resources/module-shards.conf [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/resources/modules.conf [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-augmentation.yang [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-test-notification.yang [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/resources/people.yang [new file with mode: 0644]
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMDataBroker.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMDataChangeListener.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMDataReadOnlyTransaction.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMDataReadTransaction.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMDataReadWriteTransaction.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMDataWriteTransaction.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMMountPoint.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMMountPointService.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMService.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMTransactionChain.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/Broker.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/Consumer.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/Provider.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RoutedRpcDefaultImplementation.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/RpcProvisionRegistry.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataBrokerService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataChangeListener.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataModificationTransaction.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataProviderService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataStore.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/model/SchemaService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountInstance.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountProvisionInstance.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountProvisionListener.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountProvisionService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/notify/NotificationPublishService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/notify/NotificationService.java
opendaylight/md-sal/sal-dom-broker/pom.xml
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/DomBrokerImplModule.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/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/SchemaServiceImplSingletonModule.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/AbstractDOMForwardedCompositeTransaction.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataBrokerImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMForwardedReadOnlyTransaction.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMForwardedReadWriteTransaction.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMForwardedWriteTransaction.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/compat/BackwardsCompatibleDataBroker.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/compat/BackwardsCompatibleTransaction.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/compat/TranslatingDataChangeEvent.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/compat/TranslatingListenerInvoker.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/mount/DOMMountPointServiceImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPoint.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPointManager.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/BrokerImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/DataBrokerImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/DataTransactionImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/GlobalBundleScanningSchemaServiceImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/MountPointImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/MountPointManagerImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/DataReaderRouter.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/DataStoreStatsWrapper.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/HashMapDataStore.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/HashMapDataStoreTransaction.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/NotificationRouterImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/RoutedRpcRegImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/RoutedRpcSelector.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaAwareDataStoreAdapter.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaAwareRpcBroker.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/AbstractBrokerServiceProxy.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DOMDataBrokerProxy.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DOMMountPointServiceProxy.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DataBrokerServiceProxy.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DataProviderServiceProxy.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/MountProviderServiceProxy.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/NotificationPublishServiceProxy.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/NotificationServiceProxy.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/ProxyFactory.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/RpcProvisionRegistryProxy.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/SchemaServiceProxy.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/NotificationRouter.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/RoutedRpcProcessor.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/ProxySchemaContext.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/YangSchemaUtils.java
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMBrokerPerformanceTest.java
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/MountPointServiceTest.java [new file with mode: 0644]
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/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPointManagerTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPointTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/broker/spi/mount/SimpleDOMMountPoint.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/DOMStore.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/DOMStoreReadTransaction.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/DOMStoreWriteTransaction.java
opendaylight/md-sal/sal-dom-xsql/.checkstyle [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/.gitignore [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/pom.xml [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/TablesResultSet.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLAdapter.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrint.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintNode.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintRelation.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLColumn.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLCriteria.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLODLUtils.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLThreadPool.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCCommand.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCConnection.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCDriver.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCResultSet.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCServer.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCStatement.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/xsql/XSQLProvider.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/yang/gen/v1/http/netconfcentral/org/ns/xsql/rev140626/XSQLModule.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/yang/gen/v1/http/netconfcentral/org/ns/xsql/rev140626/XSQLModuleFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/resources/04-xsql.xml [new file with mode: 0644]
opendaylight/md-sal/sal-dom-xsql/src/main/yang/XSQL.yang [new file with mode: 0644]
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/config/yang/inmemory_datastore_provider/InMemoryConfigDataStoreProviderModule.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/config/yang/inmemory_datastore_provider/InMemoryOperationalDataStoreProviderModule.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/ChangeListenerNotifyTask.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/DOMImmutableDataChangeEvent.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/DataChangeListenerRegistration.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStore.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/ResolveDataChangeEventsTask.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/SnapshotBackedReadTransaction.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/SnapshotBackedReadWriteTransaction.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/SnapshotBackedWriteTransaction.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/ListenerTree.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/yang/opendaylight-inmemory-datastore-provider.yang
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/AbstractDataChangeListenerTest.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DatastoreTestTask.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/RootScopeSubtreeTest.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/SchemaUpdateForTransactionTest.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/TestModel.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeBaseTest.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeOneTest.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeSubtreeTest.java
opendaylight/md-sal/sal-netconf-connector/pom.xml
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/connector/netconf/NetconfConnectorModule.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/listener/NetconfDeviceCommunicator.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/listener/NetconfSessionCapabilities.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceCommitHandler.java [deleted file]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceDataBroker.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceDataReader.java [deleted file]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceDatastoreAdapter.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceRpc.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceSalFacade.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceSalProvider.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceTwoPhaseCommitTransaction.java [deleted file]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/NetconfDeviceReadOnlyTx.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/NetconfDeviceReadWriteTx.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/NetconfDeviceWriteOnlyTx.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/NetconfMessageTransformUtil.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/NodeContainerProxy.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/util/RemoteDeviceId.java
opendaylight/md-sal/sal-netconf-connector/src/main/yang/odl-sal-netconf-connector-cfg.yang
opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceTest.java
opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/listener/NetconfDeviceCommunicatorTest.java
opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/listener/NetconfSessionCapabilitiesTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/NetconfDeviceWriteOnlyTxTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/pom.xml
opendaylight/md-sal/sal-protocolbuffer-encoding/run.sh
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NodeToNormalizedNodeBuilder.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NodeValueCodec.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodec.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToProtocolBufferNode.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/AugmentationIdentifierGenerator.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierGenerator.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithPredicatesGenerator.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithValueGenerator.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodeGetter.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodeNavigator.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodePrinter.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodeVisitor.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtils.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/QNameFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/util/EncoderDecoderUtil.java
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtils.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/mdsal/CompositeModificationPayload.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/cohort3pc/ThreePhaseCommitCohortMessages.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/common/NormalizedNodeMessages.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/common/SimpleNormalizedNodeMessage.java
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/datachange/notification/DataChangeListenerMessages.java
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/persistent/PersistentMessages.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/registration/ListenerRegistrationMessages.java
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/shard/ShardManagerMessages.java
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionChainMessages.java
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessages.java
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Cohort.proto [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Common.proto [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/CompositeModificationPayload.proto [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/DataChangeListener.proto
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ListenerRegistration.proto
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Persistent.proto [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardManager.proto
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardTransaction.proto
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactoryTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/NormalizedNodeXmlConverterTest.java
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/TestModel.java
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessagesTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/application.conf [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-augmentation.yang [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-test-notification.yang [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-test.yang
opendaylight/md-sal/sal-remoterpc-connector/pom.xml [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/config/yang/config/remote_rpc_connector/RemoteRPCBrokerModule.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/config/yang/config/remote_rpc_connector/RemoteRPCBrokerModuleFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/AbstractUntypedActor.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/ActorSystemFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcImplementation.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcProvider.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcProviderFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RouteIdentifierImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RoutedRpcListener.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RpcBroker.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RpcListener.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RpcManager.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/TerminationMonitor.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/AddRoutedRpc.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/AddRpc.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/ErrorResponse.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/ExecuteRpc.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/GetRoutedRpc.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/GetRoutedRpcReply.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/GetRpc.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/GetRpcReply.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/InvokeRoutedRpc.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/InvokeRpc.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/Monitor.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/RemoveRoutedRpc.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/RemoveRpc.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/RoutingTableData.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/RpcResponse.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/UpdateSchemaContext.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/ClusterWrapper.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/ClusterWrapperImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RoutingTable.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistry.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/ActorUtil.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/InstanceIdentifierForXmlCodec.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/RandomPrefix.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/XmlDocumentUtils.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/XmlStreamUtils.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/XmlUtils.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/resources/application.conf [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/main/yang/remote-rpc-connector.yang [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RpcBrokerTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/RoutingTableTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistryTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/utils/XmlUtilsTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/src/test/resources/org/opendaylight/controller/remote/rpc/utils/rpcTest.yang [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector-config/pom.xml [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector-config/src/main/resources/initial/10-rest-connector.xml [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/pom.xml
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/rest/connector/RestConnectorModule.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/rest/connector/RestConnectorModuleFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestConnector.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfProvider.java [deleted file]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfProviderImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/BrokerFacade.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/InstanceIdWithSchemaNode.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestCodec.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/rpc/impl/AbstractRpcExecutor.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/ListenerAdapter.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/Notificator.java
opendaylight/md-sal/sal-rest-connector/src/main/yang/opendaylight-rest-connector.yang [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/input/to/cnsn/test/RestPutListDataTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/BrokerFacadeTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/CnSnToXmlAndJsonInstanceIdentifierTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/InvokeRpcMethodTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestDeleteOperationTest.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/RestPostOperationTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPutOperationTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/TestUtils.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/URITest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/XmlAndJsonToCnSnInstanceIdentifierTest.java
opendaylight/md-sal/sal-rest-connector/src/test/resources/invoke-rpc/invoke-rpc-module.yang
opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/DocProvider.java
opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/BaseYangSwaggerGenerator.java
opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/ModelGenerator.java
opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/mountpoints/MountPointSwagger.java
opendaylight/md-sal/sal-rest-docgen/src/test/java/org/opendaylight/controller/sal/rest/doc/impl/MountPointSwaggerTest.java
opendaylight/md-sal/samples/l2switch/implementation/src/main/java/org/opendaylight/controller/sample/l2switch/md/L2SwitchProvider.java
opendaylight/md-sal/samples/toaster-consumer/src/main/java/org/opendaylight/controller/config/yang/config/kitchen_service/impl/KitchenServiceModule.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/FlowStatsTracker.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsProvider.java
opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryProvider.java
opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyProvider.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/toxml/SimpleIdentityRefAttributeWritingStrategy.java
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/output/OutputDefinition.java
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/LeafListEntryReader.java
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/ChoiceNodeCliSerializer.java
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/CliOutputFromNormalizedNodeSerializerFactory.java
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NodeCliSerializerDispatcher.java
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NormalizedNodeWriter.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlElement.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlUtil.java
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java
opendaylight/northbound/commons/pom.xml
opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronRoutersNorthbound.java
pom.xml

diff --git a/features/config-netty/pom.xml b/features/config-netty/pom.xml
new file mode 100644 (file)
index 0000000..98b97d1
--- /dev/null
@@ -0,0 +1,80 @@
+<?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>config-subsystem</artifactId>
+    <version>0.2.5-SNAPSHOT</version>
+    <relativePath>../../opendaylight/config/</relativePath>
+  </parent>
+  <artifactId>config-netty-features</artifactId>
+
+  <packaging>pom</packaging>
+
+  <properties>
+    <features.file>features.xml</features.file>
+  </properties>
+
+  <dependencies>
+    <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>
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <filtering>true</filtering>
+        <directory>src/main/resources</directory>
+      </resource>
+    </resources>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>filter</id>
+            <goals>
+              <goal>resources</goal>
+            </goals>
+            <phase>generate-resources</phase>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-artifacts</id>
+            <goals>
+              <goal>attach-artifact</goal>
+            </goals>
+            <phase>package</phase>
+            <configuration>
+              <artifacts>
+                <artifact>
+                  <file>${project.build.directory}/classes/${features.file}</file>
+                  <type>xml</type>
+                  <classifier>features</classifier>
+                </artifact>
+              </artifacts>
+            </configuration>
+          </execution>
+        </executions>
+      </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/features/config-netty/src/main/resources/features.xml b/features/config-netty/src/main/resources/features.xml
new file mode 100644 (file)
index 0000000..3121ca0
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<features name="odl-config-persister-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+  <repository>mvn:org.opendaylight.controller/config-persister-features/${config.version}/xml/features</repository>
+  <feature name='odl-config-netty' version='${project.version}'>
+    <feature version='${project.version}'>odl-config-netty-config-api</feature>
+    <bundle>mvn:org.opendaylight.controller/netty-event-executor-config/${project.version}</bundle>
+    <bundle>mvn:org.opendaylight.controller/netty-threadgroup-config/${project.version}</bundle>
+    <bundle>mvn:org.opendaylight.controller/netty-timer-config/${project.version}</bundle>
+    <bundle>mvn:org.opendaylight.controller/threadpool-config-api/${project.version}</bundle>
+    <bundle>mvn:org.opendaylight.controller/threadpool-config-impl/${project.version}</bundle>
+    <feature version='${project.version}'>odl-config-startup</feature>
+  </feature>
+</features>
\ No newline at end of file
diff --git a/features/config-persister/pom.xml b/features/config-persister/pom.xml
new file mode 100644 (file)
index 0000000..969d0c8
--- /dev/null
@@ -0,0 +1,96 @@
+<?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>config-subsystem</artifactId>
+    <version>0.2.5-SNAPSHOT</version>
+    <relativePath>../../opendaylight/config/</relativePath>
+  </parent>
+  <artifactId>config-persister-features</artifactId>
+
+  <packaging>pom</packaging>
+
+  <properties>
+    <features.file>features.xml</features.file>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>features-yangtools</artifactId>
+      <version>${yangtools.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-features</artifactId>
+      <version>${config.version}</version>
+      <classifier>features</classifier>
+      <type>xml</type>
+      <scope>runtime</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <filtering>true</filtering>
+        <directory>src/main/resources</directory>
+      </resource>
+    </resources>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>filter</id>
+            <goals>
+              <goal>resources</goal>
+            </goals>
+            <phase>generate-resources</phase>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-artifacts</id>
+            <goals>
+              <goal>attach-artifact</goal>
+            </goals>
+            <phase>package</phase>
+            <configuration>
+              <artifacts>
+                <artifact>
+                  <file>${project.build.directory}/classes/${features.file}</file>
+                  <type>xml</type>
+                  <classifier>features</classifier>
+                </artifact>
+              </artifacts>
+            </configuration>
+          </execution>
+        </executions>
+      </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/features/config-persister/src/main/resources/features.xml b/features/config-persister/src/main/resources/features.xml
new file mode 100644 (file)
index 0000000..2273a4a
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<features name="odl-config-persister-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+  <repository>mvn:org.opendaylight.yangtools/features-yangtools/${yangtools.version}/xml/features</repository>
+  <repository>mvn:org.opendaylight.controller/netconf-features/${netconf.version}/xml/features</repository>
+  <repository>mvn:org.opendaylight.controller/config-features/${config.version}/xml/features</repository>
+  <feature name='odl-config-startup' version='${project.version}'>
+    <feature version='${project.version}'>odl-config-netconf-connector</feature>
+    <feature version='${project.version}'>odl-config-persister</feature>
+    <feature version='${project.version}'>odl-netconf-impl</feature>
+  </feature>
+  <feature name='odl-config-persister' version='${project.version}'>
+    <feature version='${netconf.version}'>odl-netconf-api</feature>
+    <feature version='${project.version}'>odl-config-api</feature>
+    <feature version='${yangtools.version}'>yangtools-binding-generator</feature>
+    <bundle>mvn:org.opendaylight.controller/config-persister-api/${project.version}</bundle>
+    <bundle>mvn:org.opendaylight.controller/config-persister-file-xml-adapter/${project.version}</bundle>
+    <bundle>mvn:org.opendaylight.controller/config-persister-directory-xml-adapter/${project.version}</bundle>
+    <bundle>mvn:org.opendaylight.controller/config-persister-impl/${project.version}</bundle>
+
+    <bundle>mvn:org.opendaylight.controller/netconf-util/${netconf.version}</bundle>
+    <bundle>mvn:org.opendaylight.controller/netconf-mapping-api/${netconf.version}</bundle>
+
+    <bundle>mvn:com.google.guava/guava/${guava.version}</bundle>
+    <bundle>mvn:commons-io/commons-io/${commons.io.version}</bundle>
+    <bundle>mvn:org.apache.commons/commons-lang3/${commons.lang3.version}</bundle>
+    <bundle>mvn:org.eclipse.persistence/org.eclipse.persistence.core/${eclipse.persistence.version}</bundle>
+    <bundle>mvn:org.eclipse.persistence/org.eclipse.persistence.moxy/${eclipse.persistence.version}</bundle>
+  </feature>
+</features>
\ No newline at end of file
index 01a4ea74a264afcf722d10b6515b5b26313e869c..7e5dd6472bc7320a6b7c20953c811fb41982cb26 100644 (file)
     <features.file>features.xml</features.file>
   </properties>
 
-  <dependencies></dependencies>
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>features-yangtools</artifactId>
+      <version>${yangtools.version}</version>
+      <classifier>features</classifier>
+      <type>xml</type>
+      <scope>runtime</scope>
+    </dependency>
+  </dependencies>
 
   <build>
     <resources>
index 7c11b5b18bace780aaa59c93c56a14e45bafc400..de5b198173f6c88da2c5983c2b2daae9c989ea6d 100644 (file)
@@ -4,13 +4,6 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
   <repository>mvn:org.opendaylight.yangtools/features-yangtools/${yangtools.version}/xml/features</repository>
-  <repository>mvn:org.opendaylight.controller/netconf-features/${netconf.version}/xml/features</repository>
-
-  <feature name='odl-config-startup' version='${project.version}'>
-    <feature version='${project.version}'>odl-config-netconf-connector</feature>
-    <feature version='${project.version}'>odl-config-persister</feature>
-    <feature version='${project.version}'>odl-netconf-impl</feature>
-  </feature>
 
   <feature name='odl-config-core' version='${project.version}'>
     <feature version='${yangtools.version}'>yangtools-concepts</feature>
     <bundle>mvn:org.opendaylight.controller/shutdown-api/${project.version}</bundle>
     <bundle>mvn:org.opendaylight.controller/shutdown-impl/${project.version}</bundle>
     <bundle>mvn:org.osgi/org.osgi.core/${osgi.core.version}</bundle>
-    <bundle>wrap:mvn:com.google.guava/guava/${guava.version}</bundle>
+    <bundle>mvn:com.google.guava/guava/${guava.version}</bundle>
     <bundle>mvn:org.javassist/javassist/${javassist.version}</bundle>
   </feature>
   <feature name='odl-config-manager' version='${project.version}'>
     <feature version='${project.version}'>odl-config-core</feature>
     <bundle>mvn:org.opendaylight.controller/config-manager/${project.version}</bundle>
   </feature>
-  <feature name='odl-config-persister' version='${project.version}'>
-    <feature version='${netconf.version}'>odl-netconf-api</feature>
-    <feature version='${project.version}'>odl-config-api</feature>
-    <feature version='${yangtools.version}'>yangtools-binding-generator</feature>
-    <bundle>mvn:org.opendaylight.controller/config-persister-api/${project.version}</bundle>
-    <bundle>mvn:org.opendaylight.controller/config-persister-file-xml-adapter/${project.version}</bundle>
-    <bundle>mvn:org.opendaylight.controller/config-persister-directory-xml-adapter/${project.version}</bundle>
-    <bundle>mvn:org.opendaylight.controller/config-persister-impl/${project.version}</bundle>
 
-    <bundle>mvn:org.opendaylight.controller/netconf-util/${netconf.version}</bundle>
-    <bundle>mvn:org.opendaylight.controller/netconf-mapping-api/${netconf.version}</bundle>
-
-    <bundle>mvn:com.google.guava/guava/${guava.version}</bundle>
-    <bundle>mvn:commons-io/commons-io/${commons.io.version}</bundle>
-    <bundle>mvn:org.apache.commons/commons-lang3/${commons.lang3.version}</bundle>
-    <bundle>mvn:org.eclipse.persistence/org.eclipse.persistence.core/${eclipse.persistence.version}</bundle>
-    <bundle>mvn:org.eclipse.persistence/org.eclipse.persistence.moxy/${eclipse.persistence.version}</bundle>
-  </feature>
   <feature name='odl-config-api' version='${project.version}'>
     <bundle>mvn:org.opendaylight.controller/config-api/${project.version}</bundle>
 
 
     <feature version='${project.version}'>odl-config-api</feature>
   </feature>
-  <feature name='odl-config-netty' version='${project.version}'>
-    <feature version='${project.version}'>odl-config-netty-config-api</feature>
-    <bundle>mvn:org.opendaylight.controller/netty-event-executor-config/${project.version}</bundle>
-    <bundle>mvn:org.opendaylight.controller/netty-threadgroup-config/${project.version}</bundle>
-    <bundle>mvn:org.opendaylight.controller/netty-timer-config/${project.version}</bundle>
-    <bundle>mvn:org.opendaylight.controller/threadpool-config-api/${project.version}</bundle>
-    <bundle>mvn:org.opendaylight.controller/threadpool-config-impl/${project.version}</bundle>
-    <feature version='${project.version}'>odl-config-startup</feature>
-  </feature>
   <feature name='odl-config-dispatcher' version='${project.version}'>
       <bundle>mvn:org.opendaylight.controller/netconf-config-dispatcher/${project.version}</bundle>
   </feature>
index 457fc64eddcd0be11a5ff9c469b603fbdf60c088..90c088eaba2aab2911bdc65fbbba281af094ecb4 100644 (file)
     <features.file>features.xml</features.file>
   </properties>
 
-  <dependencies></dependencies>
+  <dependencies>
+    <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>
+  </dependencies>
 
   <build>
     <resources>
diff --git a/features/nsf/pom.xml b/features/nsf/pom.xml
new file mode 100644 (file)
index 0000000..224aef1
--- /dev/null
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>commons.opendaylight</artifactId>
+    <version>1.4.2-SNAPSHOT</version>
+    <relativePath>../../opendaylight/commons/opendaylight</relativePath>
+  </parent>
+  <artifactId>features-nsf</artifactId>
+  <packaging>pom</packaging>
+  <name>OpenDaylight :: Features :: Network Service Functions</name>
+  <description>Feature for Network Service Functions</description>
+  <properties>
+    <features.file>features.xml</features.file>
+  </properties>
+  <build>
+    <resources>
+      <resource>
+        <filtering>true</filtering>
+        <directory>src/main/resources</directory>
+      </resource>
+    </resources>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>filter</id>
+            <goals>
+              <goal>resources</goal>
+            </goals>
+            <phase>generate-resources</phase>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-artifacts</id>
+            <goals>
+              <goal>attach-artifact</goal>
+            </goals>
+            <phase>package</phase>
+            <configuration>
+              <artifacts>
+                <artifact>
+                  <file>${project.build.directory}/classes/${features.file}</file>
+                  <type>xml</type>
+                  <classifier>features</classifier>
+                </artifact>
+              </artifacts>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/features/nsf/src/main/resources/features.xml b/features/nsf/src/main/resources/features.xml
new file mode 100644 (file)
index 0000000..fb61f33
--- /dev/null
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<features name="nsf-${project.version}"  xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+    <feature name="odl-nsf-all" description="OpenDaylight :: NSF :: All Network Service Functions" version="${project.version}">
+        <feature version="${sal.version}">odl-adsal-all</feature>
+        <feature version="${project.version}">odl-nsf-managers</feature>
+        <feature version="${project.version}">odl-adsal-northbound</feature>
+        <!--
+         TODO : Resolve this in a follow-up commit
+            <feature>odl-controller-web</feature>
+        -->
+    </feature>
+
+    <feature name="odl-nsf-managers" description="OpenDaylight :: AD-SAL :: Network Service Functions" version="${project.version}">
+        <feature version="${project.version}">base-all</feature>
+        <feature version="${sal.version}">odl-adsal-all</feature>
+        <bundle>mvn:org.opendaylight.controller/usermanager/${usermanager.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/usermanager.implementation/${usermanager.version}</bundle>
+
+        <bundle>mvn:org.opendaylight.controller/appauth/${appauth.version}</bundle>
+
+        <bundle>mvn:org.opendaylight.controller/connectionmanager/${connectionmanager.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/connectionmanager.implementation/${connectionmanager.version}</bundle>
+
+        <bundle>mvn:org.opendaylight.controller/containermanager/${containermanager.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/containermanager.implementation/${containermanager.version}</bundle>
+
+        <bundle>mvn:org.opendaylight.controller/statisticsmanager/${statisticsmanager.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/statisticsmanager.implementation/${statisticsmanager.implementation.version}</bundle>
+
+        <bundle>mvn:org.opendaylight.controller/switchmanager/${switchmanager.api.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/switchmanager.implementation/${switchmanager.implementation.version}</bundle>
+
+        <bundle>mvn:org.opendaylight.controller/forwardingrulesmanager/${forwardingrulesmanager.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/forwardingrulesmanager.implementation/${forwardingrulesmanager.implementation.version}</bundle>
+
+        <bundle>mvn:org.opendaylight.controller/topologymanager/${topologymanager.version}</bundle>
+
+        <bundle>mvn:org.opendaylight.controller/networkconfig.neutron/${networkconfig.neutron.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/networkconfig.neutron.implementation/${networkconfig.neutron.implementation.version}</bundle>
+
+        <bundle>mvn:org.opendaylight.controller/hosttracker/${hosttracker.api.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/hosttracker.implementation/${hosttracker.implementation.version}</bundle>
+
+        <bundle>mvn:org.opendaylight.controller/forwarding.staticrouting</bundle>
+
+        <bundle>mvn:org.opendaylight.controller.thirdparty/net.sf.jung2/2.0.1</bundle>
+        <bundle>mvn:org.opendaylight.controller/routing.dijkstra_implementation</bundle>
+    </feature>
+
+    <feature name="odl-adsal-northbound" description="OpenDaylight :: AD-SAL :: Northbound APIs" version="${project.version}">
+        <feature version="${project.version}">base-all</feature>
+        <feature version="${project.version}">odl-nsf-managers</feature>
+        <bundle start-level="35">mvn:org.ow2.asm/asm-all/${asm.version}</bundle>
+        <!--
+            TODO : Resolve these in a follow-up commit
+            <bundle>mvn:org.opendaylight.controller/httpservice-bridge/${httpservice-bridge.northbound.version}</bundle>
+            <bundle>mvn:org.opendaylight.controller/jolokia-bridge/${jolokia-bridge.version}</bundle>
+        -->
+        <bundle>mvn:org.opendaylight.controller/bundlescanner/${bundlescanner.api.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/bundlescanner.implementation/${bundlescanner.implementation.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/commons.northbound/${northbound.commons.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/flowprogrammer.northbound/${flowprogrammer.northbound.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/hosttracker.northbound/${hosttracker.northbound.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/networkconfig.bridgedomain.northbound/${networkconfig.bridgedomain.northbound.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/networkconfig.neutron.northbound/${networkconfig.neutron.northbound.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/forwarding.staticrouting.northbound/${forwarding.staticrouting.northbound.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/statistics.northbound/${statistics.northbound.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/subnets.northbound/${subnets.northbound.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/switchmanager.northbound/${switchmanager.northbound.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/topology.northbound/${topology.northbound.version}</bundle>
+        <bundle>mvn:org.opendaylight.controller/usermanager.northbound/${usermanager.northbound.version}</bundle>
+    </feature>
+</features>
\ No newline at end of file
index dce47faea665aa4d857c235103fbf84768382e9b..f69190cebd4e5bd45fc0d11fc674305f65a0589c 100644 (file)
     <maven>3.0</maven>
   </prerequisites>
   <modules>
+    <module>base</module>
+    <module>controller</module>
+    <module>adsal</module>
+    <module>nsf</module>
+    <module>extras</module>
     <module>config</module>
+    <module>config-persister</module>
+    <module>config-netty</module>
     <module>mdsal</module>
     <module>netconf</module>
     <module>protocol-framework</module>
index f0208d64521cc7e740ef644105957d49d7f9004a..045ac2dffec10871437ab784f53d7c97cbfe98cd 100644 (file)
     <features.file>features.xml</features.file>
   </properties>
 
-  <dependencies></dependencies>
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>config-features</artifactId>
+      <version>${config.version}</version>
+      <classifier>features</classifier>
+      <type>xml</type>
+      <scope>runtime</scope>
+    </dependency>
+  </dependencies>
 
   <build>
     <resources>
index 163c64ed520bb1782bf0d1778f087913f0a4b86a..be88e4a5059c335147a2ebacdb4f09851bbbc0e9 100644 (file)
         <artifactId>sal-rest-connector</artifactId>
         <version>${mdsal.version}</version>
       </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>sal-rest-connector-config</artifactId>
+        <version>${mdsal.version}</version>
+      </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>sal-rest-docgen</artifactId>
           <includeTestSourceDirectory>true</includeTestSourceDirectory>
           <sourceDirectory>${project.basedir}</sourceDirectory>
           <includes>**\/*.java,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat</includes>
-          <excludes>**\/target\/,**\/bin\/,**\/target-ide\/,**\/${jmxGeneratorPath}\/,**\/${salGeneratorPath}\/,**\/xtend-gen\/</excludes>
+          <excludes>**\/target\/,**\/bin\/,**\/target-ide\/,**\/${jmxGeneratorPath}\/,**\/${salGeneratorPath}\/,**\/xtend-gen\/,**\/protobuff\/</excludes>
         </configuration>
         <dependencies>
           <dependency>
index f70698731aa0aea9e1cc6f1cff86d4ded144b454..774bc7c23f178b30f26b94d65212a595d5941b4a 100644 (file)
       <artifactId>netty-event-executor-config</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
index 580a53be94c57ad08ce7b69352994eb028486311..12b771df808ccf49b2a57ab1b4411f17f298fb65 100644 (file)
@@ -32,14 +32,14 @@ public final class ReconnectImmediatelyStrategyFactoryModule extends org.openday
 
     @Override
     protected void customValidation(){
-        JmxAttributeValidationException.checkNotNull(getTimeout(), "value is not set.", timeoutJmxAttribute);
-        JmxAttributeValidationException.checkCondition(getTimeout() >= 0, "value " + getTimeout() + " is less than 0",
-                timeoutJmxAttribute);
+        JmxAttributeValidationException.checkNotNull(getReconnectTimeout(), "value is not set.", reconnectTimeoutJmxAttribute);
+        JmxAttributeValidationException.checkCondition(getReconnectTimeout() >= 0, "value " + getReconnectTimeout() + " is less than 0",
+                reconnectTimeoutJmxAttribute);
     }
 
     @Override
     public java.lang.AutoCloseable createInstance() {
-        return new ReconnectImmediatelyStrategyFactoryCloseable(getExecutorDependency(), getTimeout());
+        return new ReconnectImmediatelyStrategyFactoryCloseable(getReconnectExecutorDependency(), getReconnectTimeout());
     }
 
     private static final class ReconnectImmediatelyStrategyFactoryCloseable implements ReconnectStrategyFactory, AutoCloseable {
index b8849c7a1d7c8b42db885274f3f8311b2c6626e3..0b4a7baf6fb43737b3d673723d5a3da7ad29a08c 100644 (file)
@@ -49,7 +49,7 @@ public final class TimedReconnectStrategyFactoryModule extends org.opendaylight.
 
     @Override
     public java.lang.AutoCloseable createInstance() {
-        return new TimedReconnectStrategyFactoryCloseable(getExecutorDependency(),
+        return new TimedReconnectStrategyFactoryCloseable(getTimedReconnectExecutorDependency(),
                 getConnectTime(), getMinSleep(), getSleepFactor().doubleValue(), getMaxSleep(), getMaxAttempts(),
                 getDeadline());
     }
index a62bd7da06501b355c41f36230dbf30a982d61fa..a05d02cd09ad4e1b447a61da687768bc58e3dd94 100644 (file)
@@ -7,12 +7,19 @@
  */
 package org.opendaylight.protocol.framework;
 
+import java.io.Closeable;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import com.google.common.base.Preconditions;
 
 import io.netty.bootstrap.Bootstrap;
 import io.netty.bootstrap.ServerBootstrap;
-import io.netty.channel.Channel;
 import io.netty.buffer.PooledByteBufAllocator;
+import io.netty.channel.Channel;
 import io.netty.channel.ChannelFuture;
 import io.netty.channel.ChannelInitializer;
 import io.netty.channel.ChannelOption;
@@ -28,13 +35,6 @@ import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.GlobalEventExecutor;
 import io.netty.util.concurrent.Promise;
 
-import java.io.Closeable;
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 /**
  * Dispatcher class for creating servers and clients. The idea is to first create servers and clients and the run the
  * start method that will handle sockets in different thread.
@@ -155,7 +155,7 @@ public abstract class AbstractDispatcher<S extends ProtocolSession<?>, L extends
      */
     protected Future<S> createClient(final InetSocketAddress address, final ReconnectStrategy strategy, final PipelineInitializer<S> initializer) {
         final Bootstrap b = new Bootstrap();
-        final ProtocolSessionPromise<S> p = new ProtocolSessionPromise<S>(executor, address, strategy, b);
+        final ProtocolSessionPromise<S> p = new ProtocolSessionPromise<>(executor, address, strategy, b);
         b.option(ChannelOption.SO_KEEPALIVE, true).handler(
                 new ChannelInitializer<SocketChannel>() {
                     @Override
@@ -165,18 +165,36 @@ public abstract class AbstractDispatcher<S extends ProtocolSession<?>, L extends
                 });
 
         customizeBootstrap(b);
+        setWorkerGroup(b);
+        setChannelFactory(b);
+
+        p.connect();
+        LOG.debug("Client created.");
+        return p;
+    }
 
+    private void setWorkerGroup(final Bootstrap b) {
         if (b.group() == null) {
             b.group(workerGroup);
         }
+    }
 
-        // There is no way to detect if this was already set by
-        // customizeBootstrap()
-        try {
-            b.channel(NioSocketChannel.class);
-        } catch (IllegalStateException e) {
-            LOG.trace("Not overriding channelFactory on bootstrap {}", b, e);
-        }
+    /**
+     * Create a client but use a pre-configured bootstrap.
+     * This method however replaces the ChannelInitializer in the bootstrap. All other configuration is preserved.
+     *
+     * @param address remote address
+     */
+    protected Future<S> createClient(final InetSocketAddress address, final ReconnectStrategy strategy, final Bootstrap bootstrap, final PipelineInitializer<S> initializer) {
+        final ProtocolSessionPromise<S> p = new ProtocolSessionPromise<>(executor, address, strategy, bootstrap);
+
+        bootstrap.handler(
+                new ChannelInitializer<SocketChannel>() {
+                    @Override
+                    protected void initChannel(final SocketChannel ch) {
+                        initializer.initializeChannel(ch, p);
+                    }
+                });
 
         p.connect();
         LOG.debug("Client created.");
@@ -195,6 +213,9 @@ public abstract class AbstractDispatcher<S extends ProtocolSession<?>, L extends
     }
 
     /**
+     *
+     * @deprecated use {@link org.opendaylight.protocol.framework.AbstractDispatcher#createReconnectingClient(java.net.InetSocketAddress, ReconnectStrategyFactory, org.opendaylight.protocol.framework.AbstractDispatcher.PipelineInitializer)} with only one reconnectStrategyFactory instead.
+     *
      * Creates a client.
      *
      * @param address remote address
@@ -204,15 +225,47 @@ public abstract class AbstractDispatcher<S extends ProtocolSession<?>, L extends
      * @return Future representing the reconnection task. It will report completion based on reestablishStrategy, e.g.
      *         success if it indicates no further attempts should be made and failure if it reports an error
      */
+    @Deprecated
     protected Future<Void> createReconnectingClient(final InetSocketAddress address, final ReconnectStrategyFactory connectStrategyFactory,
             final ReconnectStrategy reestablishStrategy, final PipelineInitializer<S> initializer) {
+        return createReconnectingClient(address, connectStrategyFactory, initializer);
+    }
 
-        final ReconnectPromise<S, L> p = new ReconnectPromise<S, L>(GlobalEventExecutor.INSTANCE, this, address, connectStrategyFactory, reestablishStrategy, initializer);
-        p.connect();
+    /**
+     * Creates a reconnecting client.
+     *
+     * @param address remote address
+     * @param connectStrategyFactory Factory for creating reconnection strategy for every reconnect attempt
+     *
+     * @return Future representing the reconnection task. It will report completion based on reestablishStrategy, e.g.
+     *         success if it indicates no further attempts should be made and failure if it reports an error
+     */
+    protected Future<Void> createReconnectingClient(final InetSocketAddress address, final ReconnectStrategyFactory connectStrategyFactory,
+            final PipelineInitializer<S> initializer) {
+        final Bootstrap b = new Bootstrap();
+
+        final ReconnectPromise<S, L> p = new ReconnectPromise<>(GlobalEventExecutor.INSTANCE, this, address, connectStrategyFactory, b, initializer);
+
+        b.option(ChannelOption.SO_KEEPALIVE, true);
 
+        customizeBootstrap(b);
+        setWorkerGroup(b);
+        setChannelFactory(b);
+
+        p.connect();
         return p;
     }
 
+    private void setChannelFactory(final Bootstrap b) {
+        // There is no way to detect if this was already set by
+        // customizeBootstrap()
+        try {
+            b.channel(NioSocketChannel.class);
+        } catch (final IllegalStateException e) {
+            LOG.trace("Not overriding channelFactory on bootstrap {}", b, e);
+        }
+    }
+
     /**
      * @deprecated Should only be used with {@link AbstractDispatcher#AbstractDispatcher()}
      */
@@ -225,5 +278,4 @@ public abstract class AbstractDispatcher<S extends ProtocolSession<?>, L extends
             this.bossGroup.shutdownGracefully();
         }
     }
-
 }
index a78274cca0ca4f49e3c14ce69e6e6815b7a7e395..a38db61eaddcdb4ebd2daa79f03790fc6bde2007 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.protocol.framework;
 
+import com.google.common.base.Preconditions;
 import io.netty.bootstrap.Bootstrap;
 import io.netty.channel.ChannelFuture;
 import io.netty.channel.ChannelFutureListener;
@@ -16,17 +17,12 @@ import io.netty.util.concurrent.EventExecutor;
 import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.FutureListener;
 import io.netty.util.concurrent.Promise;
-
 import java.net.InetSocketAddress;
-
 import javax.annotation.concurrent.GuardedBy;
 import javax.annotation.concurrent.ThreadSafe;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Preconditions;
-
 @ThreadSafe
 final class ProtocolSessionPromise<S extends ProtocolSession<?>> extends DefaultPromise<S> {
     private static final Logger LOG = LoggerFactory.getLogger(ProtocolSessionPromise.class);
@@ -54,72 +50,12 @@ final class ProtocolSessionPromise<S extends ProtocolSession<?>> extends Default
             LOG.debug("Promise {} attempting connect for {}ms", lock, timeout);
 
             this.b.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, timeout);
-            this.pending = this.b.connect(this.address).addListener(new ChannelFutureListener() {
-                @Override
-                public void operationComplete(final ChannelFuture cf) throws Exception {
-                    synchronized (lock) {
-
-                        LOG.debug("Promise {} connection resolved", lock);
-
-                        // Triggered when a connection attempt is resolved.
-                        Preconditions.checkState(ProtocolSessionPromise.this.pending.equals(cf));
-
-                        /*
-                         * The promise we gave out could have been cancelled,
-                         * which cascades to the connect getting cancelled,
-                         * but there is a slight race window, where the connect
-                         * is already resolved, but the listener has not yet
-                         * been notified -- cancellation at that point won't
-                         * stop the notification arriving, so we have to close
-                         * the race here.
-                         */
-                        if (isCancelled()) {
-                            if (cf.isSuccess()) {
-                                LOG.debug("Closing channel for cancelled promise {}", lock);
-                                cf.channel().close();
-                            }
-                            return;
-                        }
-
-                        if (!cf.isSuccess()) {
-                            LOG.debug("Attempt to connect to {} failed", ProtocolSessionPromise.this.address, cf.cause());
-
-                            final Future<Void> rf = ProtocolSessionPromise.this.strategy.scheduleReconnect(cf.cause());
-                            rf.addListener(new FutureListener<Void>() {
-                                @Override
-                                public void operationComplete(final Future<Void> sf) {
-                                    synchronized (lock) {
-                                        // Triggered when a connection attempt is to be made.
-                                        Preconditions.checkState(ProtocolSessionPromise.this.pending.equals(sf));
-
-                                        /*
-                                         * The promise we gave out could have been cancelled,
-                                         * which cascades to the reconnect attempt getting
-                                         * cancelled, but there is a slight race window, where
-                                         * the reconnect attempt is already enqueued, but the
-                                         * listener has not yet been notified -- if cancellation
-                                         * happens at that point, we need to catch it here.
-                                         */
-                                        if (!isCancelled()) {
-                                            if (sf.isSuccess()) {
-                                                connect();
-                                            } else {
-                                                setFailure(sf.cause());
-                                            }
-                                        }
-                                    }
-                                }
-                            });
-
-                            ProtocolSessionPromise.this.pending = rf;
-                        } else {
-                            LOG.debug("Promise {} connection successful", lock);
-                        }
-                    }
-                }
-            });
+            final ChannelFuture connectFuture = this.b.connect(this.address);
+            // Add listener that attempts reconnect by invoking this method again.
+            connectFuture.addListener(new BootstrapConnectListener(lock));
+            this.pending = connectFuture;
         } catch (final Exception e) {
-            LOG.info("Failed to connect to {}", e);
+            LOG.info("Failed to connect to {}", address, e);
             setFailure(e);
         }
     }
@@ -140,4 +76,79 @@ final class ProtocolSessionPromise<S extends ProtocolSession<?>> extends Default
         this.strategy.reconnectSuccessful();
         return super.setSuccess(result);
     }
+
+    private class BootstrapConnectListener implements ChannelFutureListener {
+        private final Object lock;
+
+        public BootstrapConnectListener(final Object lock) {
+            this.lock = lock;
+        }
+
+        @Override
+        public void operationComplete(final ChannelFuture cf) throws Exception {
+            synchronized (lock) {
+
+                LOG.debug("Promise {} connection resolved", lock);
+
+                // Triggered when a connection attempt is resolved.
+                Preconditions.checkState(ProtocolSessionPromise.this.pending.equals(cf));
+
+                /*
+                 * The promise we gave out could have been cancelled,
+                 * which cascades to the connect getting cancelled,
+                 * but there is a slight race window, where the connect
+                 * is already resolved, but the listener has not yet
+                 * been notified -- cancellation at that point won't
+                 * stop the notification arriving, so we have to close
+                 * the race here.
+                 */
+                if (isCancelled()) {
+                    if (cf.isSuccess()) {
+                        LOG.debug("Closing channel for cancelled promise {}", lock);
+                        cf.channel().close();
+                    }
+                    return;
+                }
+
+                if(cf.isSuccess()) {
+                    LOG.debug("Promise {} connection successful", lock);
+                    return;
+                }
+
+                LOG.debug("Attempt to connect to {} failed", ProtocolSessionPromise.this.address, cf.cause());
+
+                final Future<Void> rf = ProtocolSessionPromise.this.strategy.scheduleReconnect(cf.cause());
+                rf.addListener(new ReconnectingStrategyListener());
+                ProtocolSessionPromise.this.pending = rf;
+            }
+        }
+
+        private class ReconnectingStrategyListener implements FutureListener<Void> {
+            @Override
+            public void operationComplete(final Future<Void> sf) {
+                synchronized (lock) {
+                    // Triggered when a connection attempt is to be made.
+                    Preconditions.checkState(ProtocolSessionPromise.this.pending.equals(sf));
+
+                    /*
+                     * The promise we gave out could have been cancelled,
+                     * which cascades to the reconnect attempt getting
+                     * cancelled, but there is a slight race window, where
+                     * the reconnect attempt is already enqueued, but the
+                     * listener has not yet been notified -- if cancellation
+                     * happens at that point, we need to catch it here.
+                     */
+                    if (!isCancelled()) {
+                        if (sf.isSuccess()) {
+                            connect();
+                        } else {
+                            setFailure(sf.cause());
+                        }
+                    }
+                }
+            }
+        }
+
+    }
+
 }
index 1fa6a8175352617aa8f87a56e90f6d391bdef029..fe1012f443fc7824b1e2b8b3d3c4ed15ecbfb30d 100644 (file)
  */
 package org.opendaylight.protocol.framework;
 
-import io.netty.channel.ChannelFuture;
+import com.google.common.base.Preconditions;
+import io.netty.bootstrap.Bootstrap;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInboundHandlerAdapter;
 import io.netty.channel.socket.SocketChannel;
 import io.netty.util.concurrent.DefaultPromise;
 import io.netty.util.concurrent.EventExecutor;
 import io.netty.util.concurrent.Future;
-import io.netty.util.concurrent.FutureListener;
 import io.netty.util.concurrent.Promise;
-
-import java.io.Closeable;
 import java.net.InetSocketAddress;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.opendaylight.protocol.framework.AbstractDispatcher.PipelineInitializer;
-
-import com.google.common.base.Preconditions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 final class ReconnectPromise<S extends ProtocolSession<?>, L extends SessionListener<?, ?, ?>> extends DefaultPromise<Void> {
+    private static final Logger LOG = LoggerFactory.getLogger(ReconnectPromise.class);
+
     private final AbstractDispatcher<S, L> dispatcher;
     private final InetSocketAddress address;
     private final ReconnectStrategyFactory strategyFactory;
-    private final ReconnectStrategy strategy;
-    private final PipelineInitializer<S> initializer;
+    private final Bootstrap b;
+    private final AbstractDispatcher.PipelineInitializer<S> initializer;
     private Future<?> pending;
 
-    private final AtomicBoolean negotiationFinished = new AtomicBoolean(false);
-
     public ReconnectPromise(final EventExecutor executor, final AbstractDispatcher<S, L> dispatcher, final InetSocketAddress address,
-            final ReconnectStrategyFactory connectStrategyFactory, final ReconnectStrategy reestablishStrategy,
-            final PipelineInitializer<S> initializer) {
+                            final ReconnectStrategyFactory connectStrategyFactory, final Bootstrap b, final AbstractDispatcher.PipelineInitializer<S> initializer) {
         super(executor);
+        this.b = b;
+        this.initializer = Preconditions.checkNotNull(initializer);
         this.dispatcher = Preconditions.checkNotNull(dispatcher);
         this.address = Preconditions.checkNotNull(address);
         this.strategyFactory = Preconditions.checkNotNull(connectStrategyFactory);
-        this.strategy = Preconditions.checkNotNull(reestablishStrategy);
-        this.initializer = Preconditions.checkNotNull(initializer);
     }
 
-    // FIXME: BUG-190: refactor
-
     synchronized void connect() {
-        negotiationFinished.set(false);
-
         final ReconnectStrategy cs = this.strategyFactory.createReconnectStrategy();
-        final ReconnectStrategy rs = new ReconnectStrategy() {
-            @Override
-            public Future<Void> scheduleReconnect(final Throwable cause) {
-                return cs.scheduleReconnect(cause);
-            }
 
-            @Override
-            public void reconnectSuccessful() {
-                cs.reconnectSuccessful();
-            }
-
-            @Override
-            public int getConnectTimeout() throws Exception {
-                final int cst = cs.getConnectTimeout();
-                final int rst = ReconnectPromise.this.strategy.getConnectTimeout();
-
-                if (cst == 0) {
-                    return rst;
-                }
-                if (rst == 0) {
-                    return cst;
-                }
-                return Math.min(cst, rst);
-            }
-        };
-
-        final Future<S> cf = this.dispatcher.createClient(this.address, rs, new PipelineInitializer<S>() {
+        // Set up a client with pre-configured bootstrap, but add a closed channel handler into the pipeline to support reconnect attempts
+        pending = this.dispatcher.createClient(this.address, cs, b, new AbstractDispatcher.PipelineInitializer<S>() {
             @Override
             public void initializeChannel(final SocketChannel channel, final Promise<S> promise) {
-                addChannelClosedListener(channel.closeFuture());
                 initializer.initializeChannel(channel, promise);
+
+                // add closed channel handler
+                channel.pipeline().addFirst(new ClosedChannelHandler(ReconnectPromise.this));
             }
         });
+    }
 
-        final Object lock = this;
-        this.pending = cf;
+    /**
+     *
+     * @return true if initial connection was established successfully, false if initial connection failed due to e.g. Connection refused, Negotiation failed
+     */
+    private boolean isInitialConnectFinished() {
+        Preconditions.checkNotNull(pending);
+        return pending.isDone() && pending.isSuccess();
+    }
 
-        cf.addListener(new FutureListener<S>() {
+    @Override
+    public synchronized boolean cancel(final boolean mayInterruptIfRunning) {
+        if (super.cancel(mayInterruptIfRunning)) {
+            Preconditions.checkNotNull(pending);
+            this.pending.cancel(mayInterruptIfRunning);
+            return true;
+        }
 
-            @Override
-            public void operationComplete(final Future<S> future) {
-                synchronized (lock) {
-                    if (!future.isSuccess()) {
-                        final Future<Void> rf = ReconnectPromise.this.strategy.scheduleReconnect(cf.cause());
-
-                        if(rf == null) {
-                            // This should reflect: no more reconnecting strategies, enough
-                            // Currently all reconnect strategies fail with exception, should return null
-                            return;
-                        }
-
-                        ReconnectPromise.this.pending = rf;
-
-                        rf.addListener(new FutureListener<Void>() {
-                            @Override
-                            public void operationComplete(final Future<Void> sf) {
-                                synchronized (lock) {
-                                    /*
-                                     * The promise we gave out could have been cancelled,
-                                     * which cascades to the reconnect attempt getting
-                                     * cancelled, but there is a slight race window, where
-                                     * the reconnect attempt is already enqueued, but the
-                                     * listener has not yet been notified -- if cancellation
-                                     * happens at that point, we need to catch it here.
-                                     */
-                                    if (!isCancelled()) {
-                                        if (sf.isSuccess()) {
-                                            connect();
-                                        } else {
-                                            setFailure(sf.cause());
-                                        }
-                                    }
-                                }
-                            }
-                        });
-                    } else {
-                        /*
-                         *  FIXME: BUG-190: we have a slight race window with cancellation
-                         *         here. Analyze and define its semantics.
-                         */
-                        ReconnectPromise.this.strategy.reconnectSuccessful();
-                        negotiationFinished.set(true);
-                    }
-                }
-            }
-        });
+        return false;
     }
 
-    private final ClosedChannelListener closedChannelListener = new ClosedChannelListener();
-
-    class ClosedChannelListener implements Closeable, FutureListener<Void> {
+    /**
+     * Channel handler that responds to channelInactive event and reconnects the session.
+     * Only if the initial connection was successfully established and promise was not canceled.
+     */
+    private static final class ClosedChannelHandler extends ChannelInboundHandlerAdapter {
+        private final ReconnectPromise<?, ?> promise;
 
-        private final AtomicBoolean stop = new AtomicBoolean(false);
+        public ClosedChannelHandler(final ReconnectPromise<?, ?> promise) {
+            this.promise = promise;
+        }
 
         @Override
-        public void operationComplete(final Future<Void> future) throws Exception {
-            if (stop.get()) {
+        public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
+            if (promise.isCancelled()) {
                 return;
             }
 
-            // Start reconnecting crashed session after negotiation was successful
-            if (!negotiationFinished.get()) {
+            // Check if initial connection was fully finished. If the session was dropped during negotiation, reconnect will not happen.
+            // Session can be dropped during negotiation on purpose by the client side and would make no sense to initiate reconnect
+            if (promise.isInitialConnectFinished() == false) {
                 return;
             }
 
-            connect();
-        }
-
-        @Override
-        public void close() {
-            this.stop.set(true);
+            LOG.debug("Reconnecting after connection to {} was dropped", promise.address);
+            promise.connect();
         }
     }
 
-    private void addChannelClosedListener(final ChannelFuture channelFuture) {
-        channelFuture.addListener(closedChannelListener);
-    }
-
-    @Override
-    public synchronized boolean cancel(final boolean mayInterruptIfRunning) {
-        closedChannelListener.close();
-
-        if (super.cancel(mayInterruptIfRunning)) {
-            this.pending.cancel(mayInterruptIfRunning);
-            return true;
-        }
-
-        return false;
-    }
 }
index 3c429fc7749be6b4ac37cf5e5800f5978861fa2c..a756a0da7e780e84510d8e329b475b9342e0c9e7 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.protocol.framework;
 import java.util.EventListener;
 
 /**
- * Listener that receives session state informations. This interface should be
+ * Listener that receives session state information. This interface should be
  * implemented by a protocol specific abstract class, that is extended by
  * a final class that implements the methods.
  */
index 1856369178c0c2230db2eca3e24288ce5ca2f0b3..cd84d4a95e24156453d9d56b0b02ee072f2d036a 100644 (file)
@@ -77,12 +77,12 @@ module protocol-framework {
         case reconnect-immediately-strategy-factory {
             when "/config:modules/config:module/config:type = 'reconnect-immediately-strategy-factory'";
 
-            leaf timeout {
+            leaf reconnect-timeout {
                 mandatory true;
                 type int32;
             }
 
-            container executor {
+            container reconnect-executor {
                 uses config:service-ref {
                     refine type {
                         mandatory true;
@@ -138,7 +138,7 @@ module protocol-framework {
                 units "milliseconds";
             }
 
-            container executor {
+            container timed-reconnect-executor {
                 uses config:service-ref {
                     refine type {
                         mandatory true;
index 9beadc4dbb2b7f8aa34a0390e9aa65614168d666..cfdf3bff28729e5f80a4c9811316eb04e2b1bcc6 100644 (file)
@@ -78,7 +78,7 @@ public class ReconnectImmediatelyStrategyModuleTest extends AbstractConfigTest {
         final ReconnectImmediatelyStrategyFactoryModuleMXBean mxBean = transaction.newMBeanProxy(
                 transaction.lookupConfigBean(FACTORY_NAME, INSTANCE_NAME),
                 ReconnectImmediatelyStrategyFactoryModuleMXBean.class);
-        mxBean.setTimeout(200);
+        mxBean.setReconnectTimeout(200);
         final CommitStatus status = transaction.commit();
         assertBeanCount(1, FACTORY_NAME);
         assertStatus(status, 0, 1, 1);
@@ -99,8 +99,8 @@ public class ReconnectImmediatelyStrategyModuleTest extends AbstractConfigTest {
         final ObjectName nameCreated = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
         final ReconnectImmediatelyStrategyFactoryModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated,
                 ReconnectImmediatelyStrategyFactoryModuleMXBean.class);
-        mxBean.setTimeout(timeout);
-        mxBean.setExecutor(GlobalEventExecutorUtil.create(transaction));
+        mxBean.setReconnectTimeout(timeout);
+        mxBean.setReconnectExecutor(GlobalEventExecutorUtil.create(transaction));
         return nameCreated;
     }
 
index a8cdff711905ead55193384baed9362d1f7df909..1c068a98e748e76e0404fc5b71c87d97e839f75d 100644 (file)
@@ -7,6 +7,13 @@
  */
 package org.opendaylight.controller.config.yang.protocol.framework;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.math.BigDecimal;
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.ObjectName;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.config.api.ConflictingVersionException;
@@ -17,14 +24,6 @@ import org.opendaylight.controller.config.manager.impl.factoriesresolver.Hardcod
 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
 import org.opendaylight.controller.config.yang.netty.eventexecutor.GlobalEventExecutorModuleFactory;
 
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.ObjectName;
-import java.math.BigDecimal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 public class TimedReconnectStrategyModuleTest extends AbstractConfigTest {
 
     private static final String INSTANCE_NAME = "timed-reconect-stategy-facotry-impl";
@@ -158,7 +157,7 @@ public class TimedReconnectStrategyModuleTest extends AbstractConfigTest {
         mxBean.setMaxSleep(maxSleep);
         mxBean.setMinSleep(minSleep);
         mxBean.setSleepFactor(sleepFactor);
-        mxBean.setExecutor(GlobalEventExecutorUtil.create(transaction));
+        mxBean.setTimedReconnectExecutor(GlobalEventExecutorUtil.create(transaction));
         return nameCreated;
     }
 
index bead1ee49e64bd1b708ecc6d23c51321f4cc72bd..63026e384c498ce12dca810c94886f9a562215d8 100644 (file)
@@ -9,6 +9,14 @@ package org.opendaylight.protocol.framework;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.timeout;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelFuture;
 import io.netty.channel.nio.NioEventLoopGroup;
@@ -16,50 +24,139 @@ import io.netty.util.concurrent.DefaultPromise;
 import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.GlobalEventExecutor;
 import io.netty.util.concurrent.Promise;
-
+import io.netty.util.concurrent.SucceededFuture;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.mockito.Mockito;
 
 public class ServerTest {
     SimpleDispatcher clientDispatcher, dispatcher;
 
-    final SimpleSessionListener pce = new SimpleSessionListener();
-
     SimpleSession session = null;
 
     ChannelFuture server = null;
 
     InetSocketAddress serverAddress;
     private NioEventLoopGroup eventLoopGroup;
-
+    // Dedicated loop group for server, needed for testing reconnection client
+    // With dedicated server group we can simulate session drop by shutting only the server group down
+    private NioEventLoopGroup serverLoopGroup;
 
     @Before
     public void setUp() {
         final int port = 10000 + (int)(10000 * Math.random());
         serverAddress = new InetSocketAddress("127.0.0.1", port);
         eventLoopGroup = new NioEventLoopGroup();
+        serverLoopGroup = new NioEventLoopGroup();
+    }
+
+    @After
+    public void tearDown() throws IOException, InterruptedException, ExecutionException {
+        if(server != null) {
+            this.server.channel().close();
+        }
+        this.eventLoopGroup.shutdownGracefully().get();
+        this.serverLoopGroup.shutdownGracefully().get();
+        try {
+            Thread.sleep(500);
+        } catch (final InterruptedException e) {
+            throw new RuntimeException(e);
+        }
     }
 
     @Test
-    public void testConnectionEstablished() throws Exception {
+    public void testConnectionRefused() throws Exception {
+        this.clientDispatcher = getClientDispatcher();
+
+        final ReconnectStrategy mockReconnectStrategy = getMockedReconnectStrategy();
+
+        this.clientDispatcher.createClient(this.serverAddress,
+                mockReconnectStrategy, new SessionListenerFactory<SimpleSessionListener>() {
+                    @Override
+                    public SimpleSessionListener getSessionListener() {
+                        return new SimpleSessionListener();
+                    }
+                });
+
+        Mockito.verify(mockReconnectStrategy, timeout(5000).atLeast(2)).scheduleReconnect(any(Throwable.class));
+    }
+
+    @Test
+    public void testConnectionReestablishInitial() throws Exception {
+        this.clientDispatcher = getClientDispatcher();
+
+        final ReconnectStrategy mockReconnectStrategy = getMockedReconnectStrategy();
+
+        this.clientDispatcher.createClient(this.serverAddress,
+                mockReconnectStrategy, new SessionListenerFactory<SimpleSessionListener>() {
+                    @Override
+                    public SimpleSessionListener getSessionListener() {
+                        return new SimpleSessionListener();
+                    }
+                });
+
+        Mockito.verify(mockReconnectStrategy, timeout(5000).atLeast(2)).scheduleReconnect(any(Throwable.class));
+
+        final Promise<Boolean> p = new DefaultPromise<>(GlobalEventExecutor.INSTANCE);
+        this.dispatcher = getServerDispatcher(p);
+
+        this.server = this.dispatcher.createServer(this.serverAddress, new SessionListenerFactory<SimpleSessionListener>() {
+            @Override
+            public SimpleSessionListener getSessionListener() {
+                return new SimpleSessionListener();
+            }
+        });
+
+        this.server.get();
+
+        assertEquals(true, p.get(3, TimeUnit.SECONDS));
+    }
+
+    @Test
+    public void testConnectionDrop() throws Exception {
         final Promise<Boolean> p = new DefaultPromise<>(GlobalEventExecutor.INSTANCE);
 
-        this.dispatcher = new SimpleDispatcher(new SessionNegotiatorFactory<SimpleMessage, SimpleSession, SimpleSessionListener>() {
+        this.dispatcher = getServerDispatcher(p);
 
+        this.server = this.dispatcher.createServer(this.serverAddress, new SessionListenerFactory<SimpleSessionListener>() {
             @Override
-            public SessionNegotiator<SimpleSession> getSessionNegotiator(final SessionListenerFactory<SimpleSessionListener> factory,
-                    final Channel channel, final Promise<SimpleSession> promise) {
-                p.setSuccess(true);
-                return new SimpleSessionNegotiator(promise, channel);
+            public SimpleSessionListener getSessionListener() {
+                return new SimpleSessionListener();
             }
-        }, new DefaultPromise<SimpleSession>(GlobalEventExecutor.INSTANCE), eventLoopGroup);
+        });
+
+        this.server.get();
+
+        this.clientDispatcher = getClientDispatcher();
+
+        final ReconnectStrategy reconnectStrategy = getMockedReconnectStrategy();
+        this.session = this.clientDispatcher.createClient(this.serverAddress,
+                reconnectStrategy, new SessionListenerFactory<SimpleSessionListener>() {
+                    @Override
+                    public SimpleSessionListener getSessionListener() {
+                        return new SimpleSessionListener();
+                    }
+                }).get(6, TimeUnit.SECONDS);
+
+        assertEquals(true, p.get(3, TimeUnit.SECONDS));
+
+        shutdownServer();
+
+        // No reconnect should be scheduled after server drops connection with not-reconnecting client
+        verify(reconnectStrategy, times(0)).scheduleReconnect(any(Throwable.class));
+    }
+
+    @Test
+    public void testConnectionReestablishAfterDrop() throws Exception {
+        final Promise<Boolean> p = new DefaultPromise<>(GlobalEventExecutor.INSTANCE);
+
+        this.dispatcher = getServerDispatcher(p);
 
         this.server = this.dispatcher.createServer(this.serverAddress, new SessionListenerFactory<SimpleSessionListener>() {
             @Override
@@ -70,13 +167,42 @@ public class ServerTest {
 
         this.server.get();
 
-        this.clientDispatcher = new SimpleDispatcher(new SessionNegotiatorFactory<SimpleMessage, SimpleSession, SimpleSessionListener>() {
+        this.clientDispatcher = getClientDispatcher();
+
+        final ReconnectStrategyFactory reconnectStrategyFactory = mock(ReconnectStrategyFactory.class);
+        final ReconnectStrategy reconnectStrategy = getMockedReconnectStrategy();
+        doReturn(reconnectStrategy).when(reconnectStrategyFactory).createReconnectStrategy();
+
+        this.clientDispatcher.createReconnectingClient(this.serverAddress,
+                reconnectStrategyFactory, new SessionListenerFactory<SimpleSessionListener>() {
+                    @Override
+                    public SimpleSessionListener getSessionListener() {
+                        return new SimpleSessionListener();
+                    }
+                });
+
+        assertEquals(true, p.get(3, TimeUnit.SECONDS));
+        shutdownServer();
+
+        verify(reconnectStrategyFactory, timeout(20000).atLeast(2)).createReconnectStrategy();
+    }
+
+    @Test
+    public void testConnectionEstablished() throws Exception {
+        final Promise<Boolean> p = new DefaultPromise<>(GlobalEventExecutor.INSTANCE);
+
+        this.dispatcher = getServerDispatcher(p);
+
+        this.server = this.dispatcher.createServer(this.serverAddress, new SessionListenerFactory<SimpleSessionListener>() {
             @Override
-            public SessionNegotiator<SimpleSession> getSessionNegotiator(final SessionListenerFactory<SimpleSessionListener> factory,
-                    final Channel channel, final Promise<SimpleSession> promise) {
-                return new SimpleSessionNegotiator(promise, channel);
+            public SimpleSessionListener getSessionListener() {
+                return new SimpleSessionListener();
             }
-        }, new DefaultPromise<SimpleSession>(GlobalEventExecutor.INSTANCE), eventLoopGroup);
+        });
+
+        this.server.get();
+
+        this.clientDispatcher = getClientDispatcher();
 
         this.session = this.clientDispatcher.createClient(this.serverAddress,
                 new NeverReconnectStrategy(GlobalEventExecutor.INSTANCE, 5000), new SessionListenerFactory<SimpleSessionListener>() {
@@ -93,15 +219,7 @@ public class ServerTest {
     public void testConnectionFailed() throws IOException, InterruptedException, ExecutionException, TimeoutException {
         final Promise<Boolean> p = new DefaultPromise<>(GlobalEventExecutor.INSTANCE);
 
-        this.dispatcher = new SimpleDispatcher(new SessionNegotiatorFactory<SimpleMessage, SimpleSession, SimpleSessionListener>() {
-
-            @Override
-            public SessionNegotiator<SimpleSession> getSessionNegotiator(final SessionListenerFactory<SimpleSessionListener> factory,
-                    final Channel channel, final Promise<SimpleSession> promise) {
-                p.setSuccess(true);
-                return new SimpleSessionNegotiator(promise, channel);
-            }
-        }, new DefaultPromise<SimpleSession>(GlobalEventExecutor.INSTANCE), eventLoopGroup);
+        this.dispatcher = getServerDispatcher(p);
 
         this.server = this.dispatcher.createServer(this.serverAddress, new SessionListenerFactory<SimpleSessionListener>() {
             @Override
@@ -112,13 +230,7 @@ public class ServerTest {
 
         this.server.get();
 
-        this.clientDispatcher = new SimpleDispatcher(new SessionNegotiatorFactory<SimpleMessage, SimpleSession, SimpleSessionListener>() {
-            @Override
-            public SessionNegotiator<SimpleSession> getSessionNegotiator(final SessionListenerFactory<SimpleSessionListener> factory,
-                    final Channel channel, final Promise<SimpleSession> promise) {
-                return new SimpleSessionNegotiator(promise, channel);
-            }
-        }, new DefaultPromise<SimpleSession>(GlobalEventExecutor.INSTANCE), eventLoopGroup);
+        this.clientDispatcher = getClientDispatcher();
 
         this.session = this.clientDispatcher.createClient(this.serverAddress,
                 new NeverReconnectStrategy(GlobalEventExecutor.INSTANCE, 5000), new SessionListenerFactory<SimpleSessionListener>() {
@@ -138,14 +250,89 @@ public class ServerTest {
         assertFalse(session.isSuccess());
     }
 
-    @After
-    public void tearDown() throws IOException, InterruptedException {
-        this.server.channel().close();
-        this.eventLoopGroup.shutdownGracefully();
-        try {
-            Thread.sleep(500);
-        } catch (final InterruptedException e) {
-            throw new RuntimeException(e);
-        }
+    @Test
+    public void testNegotiationFailedNoReconnect() throws Exception {
+        final Promise<Boolean> p = new DefaultPromise<>(GlobalEventExecutor.INSTANCE);
+
+        this.dispatcher = getServerDispatcher(p);
+
+        this.server = this.dispatcher.createServer(this.serverAddress, new SessionListenerFactory<SimpleSessionListener>() {
+            @Override
+            public SimpleSessionListener getSessionListener() {
+                return new SimpleSessionListener();
+            }
+        });
+
+        this.server.get();
+
+        this.clientDispatcher = new SimpleDispatcher(new SessionNegotiatorFactory<SimpleMessage, SimpleSession, SimpleSessionListener>() {
+            @Override
+            public SessionNegotiator<SimpleSession> getSessionNegotiator(final SessionListenerFactory<SimpleSessionListener> factory,
+                                                                         final Channel channel, final Promise<SimpleSession> promise) {
+
+                return new SimpleSessionNegotiator(promise, channel) {
+                    @Override
+                    protected void startNegotiation() throws Exception {
+                        negotiationFailed(new IllegalStateException("Negotiation failed"));
+                    }
+                };
+            }
+        }, new DefaultPromise<SimpleSession>(GlobalEventExecutor.INSTANCE), eventLoopGroup);
+
+        final ReconnectStrategyFactory reconnectStrategyFactory = mock(ReconnectStrategyFactory.class);
+        final ReconnectStrategy reconnectStrategy = getMockedReconnectStrategy();
+        doReturn(reconnectStrategy).when(reconnectStrategyFactory).createReconnectStrategy();
+
+        this.clientDispatcher.createReconnectingClient(this.serverAddress,
+                reconnectStrategyFactory, new SessionListenerFactory<SimpleSessionListener>() {
+                    @Override
+                    public SimpleSessionListener getSessionListener() {
+                        return new SimpleSessionListener();
+                    }
+                });
+
+
+        // Only one strategy should be created for initial connect, no more = no reconnects
+        verify(reconnectStrategyFactory, times(1)).createReconnectStrategy();
     }
+
+    private SimpleDispatcher getClientDispatcher() {
+        return new SimpleDispatcher(new SessionNegotiatorFactory<SimpleMessage, SimpleSession, SimpleSessionListener>() {
+            @Override
+            public SessionNegotiator<SimpleSession> getSessionNegotiator(final SessionListenerFactory<SimpleSessionListener> factory,
+                                                                         final Channel channel, final Promise<SimpleSession> promise) {
+                return new SimpleSessionNegotiator(promise, channel);
+            }
+        }, new DefaultPromise<SimpleSession>(GlobalEventExecutor.INSTANCE), eventLoopGroup);
+    }
+
+    private ReconnectStrategy getMockedReconnectStrategy() throws Exception {
+        final ReconnectStrategy mockReconnectStrategy = mock(ReconnectStrategy.class);
+        final Future<Void> future = new SucceededFuture<>(GlobalEventExecutor.INSTANCE, null);
+        doReturn(future).when(mockReconnectStrategy).scheduleReconnect(any(Throwable.class));
+        doReturn(5000).when(mockReconnectStrategy).getConnectTimeout();
+        doNothing().when(mockReconnectStrategy).reconnectSuccessful();
+        return mockReconnectStrategy;
+    }
+
+
+    private void shutdownServer() throws InterruptedException, ExecutionException {
+        // Shutdown server
+        server.channel().close().get();
+        // Closing server channel does not close established connections, eventLoop has to be closed as well to simulate dropped session
+        serverLoopGroup.shutdownGracefully().get();
+    }
+
+    private SimpleDispatcher getServerDispatcher(final Promise<Boolean> p) {
+        return new SimpleDispatcher(new SessionNegotiatorFactory<SimpleMessage, SimpleSession, SimpleSessionListener>() {
+
+            @Override
+            public SessionNegotiator<SimpleSession> getSessionNegotiator(final SessionListenerFactory<SimpleSessionListener> factory,
+                                                                         final Channel channel, final Promise<SimpleSession> promise) {
+                p.setSuccess(true);
+                return new SimpleSessionNegotiator(promise, channel);
+            }
+        }, null, serverLoopGroup);
+    }
+
 }
index 12aac9ecc5257432ee282159f24dbb1fd2c319a5..d83738520cccc1e7bc24b4f97cb31c30ff6e51ad 100644 (file)
@@ -54,6 +54,10 @@ public class SimpleDispatcher extends AbstractDispatcher<SimpleSession, SimpleSe
         return super.createClient(address, strategy, new SimplePipelineInitializer(listenerFactory));
     }
 
+    public Future<Void> createReconnectingClient(final InetSocketAddress address, final ReconnectStrategyFactory strategy, final SessionListenerFactory<SimpleSessionListener> listenerFactory) {
+        return super.createReconnectingClient(address, strategy, new SimplePipelineInitializer(listenerFactory));
+    }
+
     public ChannelFuture createServer(final InetSocketAddress address, final SessionListenerFactory<SimpleSessionListener> listenerFactory) {
         return super.createServer(address, new SimplePipelineInitializer(listenerFactory));
     }
index c1ebba78817fb36c1a34f256ee81bdcb8c86d85f..eff267ad1319c90c1ce9e06de2ff7bcaddc86c67 100644 (file)
@@ -7,6 +7,13 @@
  */
 package org.opendaylight.controller.config.manager.impl.osgi;
 
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.ThreadFactory;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
@@ -15,74 +22,114 @@ import org.osgi.util.tracker.BundleTrackerCustomizer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+
 /**
  *
- * Extensible bundle tracker. Takes several BundleTrackerCustomizers and propagates bundle events to all of them.
- * Primary customizer
+ * Extensible bundle tracker. Takes several BundleTrackerCustomizers and
+ * propagates bundle events to all of them.
+ *
+ * Primary customizer may return tracking object,
+ * which will be passed to it during invocation of
+ * {@link BundleTrackerCustomizer#removedBundle(Bundle, BundleEvent, Future)}
+ *
+ *
+ * This extender modifies behaviour to not leak platform thread
+ * in {@link BundleTrackerCustomizer#addingBundle(Bundle, BundleEvent)}
+ * but deliver this event from its own single threaded executor.
+ *
+ * If bundle is removed before event for adding bundle was executed,
+ * that event is cancelled. If addingBundle event is currently in progress
+ * or was already executed, platform thread is block untill addingBundle
+ * finishes so bundle could be removed correctly in platform thread.
+ *
+ *
+ * Method {@link BundleTrackerCustomizer#removedBundle(Bundle, BundleEvent, Object)}
+ * is never invoked on registered trackers.
  *
  * @param <T>
  */
-public final class ExtensibleBundleTracker<T> extends BundleTracker<T> {
+public final class ExtensibleBundleTracker<T> extends BundleTracker<Future<T>> {
 
+    private static final ThreadFactory THREAD_FACTORY = new ThreadFactoryBuilder()
+        .setNameFormat("config-bundle-tracker-%d")
+        .build();
+    private final ExecutorService eventExecutor;
     private final BundleTrackerCustomizer<T> primaryTracker;
     private final BundleTrackerCustomizer<?>[] additionalTrackers;
 
-    private static final Logger logger = LoggerFactory.getLogger(ExtensibleBundleTracker.class);
+    private static final Logger LOG = LoggerFactory.getLogger(ExtensibleBundleTracker.class);
 
-    public ExtensibleBundleTracker(BundleContext context, BundleTrackerCustomizer<T> primaryBundleTrackerCustomizer,
-                                   BundleTrackerCustomizer<?>... additionalBundleTrackerCustomizers) {
+    public ExtensibleBundleTracker(final BundleContext context, final BundleTrackerCustomizer<T> primaryBundleTrackerCustomizer,
+                                   final BundleTrackerCustomizer<?>... additionalBundleTrackerCustomizers) {
         this(context, Bundle.ACTIVE, primaryBundleTrackerCustomizer, additionalBundleTrackerCustomizers);
     }
 
-    public ExtensibleBundleTracker(BundleContext context, int bundleState,
-                                   BundleTrackerCustomizer<T> primaryBundleTrackerCustomizer,
-                                   BundleTrackerCustomizer<?>... additionalBundleTrackerCustomizers) {
+    public ExtensibleBundleTracker(final BundleContext context, final int bundleState,
+                                   final BundleTrackerCustomizer<T> primaryBundleTrackerCustomizer,
+                                   final BundleTrackerCustomizer<?>... additionalBundleTrackerCustomizers) {
         super(context, bundleState, null);
         this.primaryTracker = primaryBundleTrackerCustomizer;
         this.additionalTrackers = additionalBundleTrackerCustomizers;
-        logger.trace("Registered as extender with context {} and bundle state {}", context, bundleState);
+        eventExecutor = Executors.newSingleThreadExecutor(THREAD_FACTORY);
+        LOG.trace("Registered as extender with context {} and bundle state {}", context, bundleState);
     }
 
     @Override
-    public T addingBundle(final Bundle bundle, final BundleEvent event) {
-        T primaryTrackerRetVal = primaryTracker.addingBundle(bundle, event);
-
-        forEachAdditionalBundle(new BundleStrategy() {
+    public Future<T> addingBundle(final Bundle bundle, final BundleEvent event) {
+        LOG.trace("Submiting AddingBundle for bundle {} and event {} to be processed asynchronously",bundle,event);
+        Future<T> future = eventExecutor.submit(new Callable<T>() {
             @Override
-            public void execute(BundleTrackerCustomizer<?> tracker) {
-                tracker.addingBundle(bundle, event);
+            public T call() throws Exception {
+                try {
+                    T primaryTrackerRetVal = primaryTracker.addingBundle(bundle, event);
+
+                    forEachAdditionalBundle(new BundleStrategy() {
+                        @Override
+                        public void execute(final BundleTrackerCustomizer<?> tracker) {
+                            tracker.addingBundle(bundle, event);
+                        }
+                    });
+                    LOG.trace("AddingBundle for {} and event {} finished successfully",bundle,event);
+                    return primaryTrackerRetVal;
+                } catch (Exception e) {
+                    LOG.error("Failed to add bundle {}",e);
+                    throw e;
+                }
             }
         });
-
-        return primaryTrackerRetVal;
+        return future;
     }
 
     @Override
-    public void modifiedBundle(final Bundle bundle, final BundleEvent event, final T object) {
-        primaryTracker.modifiedBundle(bundle, event, object);
-
-        forEachAdditionalBundle(new BundleStrategy() {
-            @Override
-            public void execute(BundleTrackerCustomizer<?> tracker) {
-                tracker.modifiedBundle(bundle, event, null);
-            }
-        });
+    public void modifiedBundle(final Bundle bundle, final BundleEvent event, final Future<T> object) {
+        // Intentionally NOOP
 
     }
 
     @Override
-    public void removedBundle(final Bundle bundle, final BundleEvent event, final T object) {
-        primaryTracker.removedBundle(bundle, event, object);
-
-        forEachAdditionalBundle(new BundleStrategy() {
-            @Override
-            public void execute(BundleTrackerCustomizer<?> tracker) {
-                tracker.removedBundle(bundle, event, null);
-            }
-        });
+    public void removedBundle(final Bundle bundle, final BundleEvent event, final Future<T> object) {
+        if(!object.isDone() && object.cancel(false)) {
+            // We canceled adding event before it was processed
+            // so it is safe to return
+            LOG.trace("Adding Bundle event for {} was cancelled. No additional work required.",bundle);
+            return;
+        }
+        try {
+            LOG.trace("Invoking removedBundle event for {}",bundle);
+            primaryTracker.removedBundle(bundle, event, object.get());
+            forEachAdditionalBundle(new BundleStrategy() {
+                @Override
+                public void execute(final BundleTrackerCustomizer<?> tracker) {
+                    tracker.removedBundle(bundle, event, null);
+                }
+            });
+            LOG.trace("Removed bundle event for {} finished successfully.",bundle);
+        } catch (InterruptedException | ExecutionException e) {
+            LOG.error("Addition of bundle failed, ", e);
+        }
     }
 
-    private void forEachAdditionalBundle(BundleStrategy lambda) {
+    private void forEachAdditionalBundle(final BundleStrategy lambda) {
         for (BundleTrackerCustomizer<?> trac : additionalTrackers) {
             lambda.execute(trac);
         }
index ec46219aaf8469e3d8ecadcc9988bb4a47188e3f..6050f7c07073061fe4233e99d915308489bc5a7f 100644 (file)
@@ -14,7 +14,7 @@ import org.opendaylight.yangtools.sal.binding.generator.api.ClassLoadingStrategy
 import org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl;
 import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
 import org.opendaylight.yangtools.yang.data.impl.codec.CodecRegistry;
-import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 import org.osgi.framework.BundleContext;
 
 /**
@@ -31,7 +31,7 @@ public class CodecRegistryProvider implements AutoCloseable {
     public CodecRegistryProvider(final ClassLoadingStrategy classLoadingStrategy, final BundleContext context) {
         service = new RuntimeGeneratedMappingServiceImpl(CLASS_POOL, classLoadingStrategy);
         registration = OsgiRegistrationUtil.registerService(context, service,
-                SchemaServiceListener.class, BindingIndependentMappingService.class);
+                SchemaContextListener.class, BindingIndependentMappingService.class);
     }
 
     public CodecRegistry getCodecRegistry() {
index 0fd9720f79be60b0abab01dd60c651e1ed865ba6..864ebdf95468173f79070e9fa8c4c3165a8a2bec 100644 (file)
@@ -7,12 +7,40 @@
  */
 package org.opendaylight.controller.config.yangjmxgenerator.plugin;
 
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.matchers.JUnitMatchers.containsString;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+
 import com.google.common.base.Predicate;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 import com.google.common.io.Files;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
@@ -46,35 +74,6 @@ import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.fail;
-import static org.junit.matchers.JUnitMatchers.containsString;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-
 //TODO: refactor
 public class JMXGeneratorTest extends AbstractGeneratorTest {
 
@@ -85,7 +84,7 @@ public class JMXGeneratorTest extends AbstractGeneratorTest {
     File generatedResourcesDir;
 
     private static final List<String> expectedModuleFileNames = ServiceInterfaceEntryTest
-            .toFileNames("[AbstractAsyncEventBusModule.java, AbstractAsyncEventBusModuleFactory.java, AbstractDynamicThreadPoolModule.java, AbstractDynamicThreadPoolModuleFactory.java, AbstractEventBusModule.java, AbstractEventBusModuleFactory.java, AbstractNamingThreadFactoryModule.java, AbstractNamingThreadFactoryModuleFactory.java, AbstractThreadPoolRegistryImplModule.java, AbstractThreadPoolRegistryImplModuleFactory.java, AsyncEventBusModule.java, AsyncEventBusModuleFactory.java, AsyncEventBusModuleMXBean.java, AsyncEventBusRuntimeMXBean.java, AsyncEventBusRuntimeRegistration.java, AsyncEventBusRuntimeRegistrator.java, DynamicThreadPoolModule.java, DynamicThreadPoolModuleFactory.java, DynamicThreadPoolModuleMXBean.java, DynamicThreadPoolRuntimeMXBean.java, DynamicThreadPoolRuntimeRegistration.java, DynamicThreadPoolRuntimeRegistrator.java, EventBusModule.java, EventBusModuleFactory.java, EventBusModuleMXBean.java, EventRuntimeMXBean.java, EventRuntimeRegistration.java, InnerStreamList.java, NamingThreadFactoryModule.java, NamingThreadFactoryModuleFactory.java, NamingThreadFactoryModuleMXBean.java, NamingThreadFactoryRuntimeMXBean.java, NamingThreadFactoryRuntimeRegistration.java, NamingThreadFactoryRuntimeRegistrator.java, Peer.java, StreamRuntimeMXBean.java, StreamRuntimeRegistration.java, ThreadPoolRegistryImplModule.java, ThreadPoolRegistryImplModuleFactory.java, ThreadPoolRegistryImplModuleMXBean.java, ThreadRuntimeMXBean.java, ThreadRuntimeRegistration.java, ThreadStreamRuntimeMXBean.java, ThreadStreamRuntimeRegistration.java]");
+            .toFileNames("[AbstractAsyncEventBusModule.java, AbstractAsyncEventBusModuleFactory.java, AbstractDynamicThreadPoolModule.java, AbstractDynamicThreadPoolModuleFactory.java, AbstractEventBusModule.java, AbstractEventBusModuleFactory.java, AbstractNamingThreadFactoryModule.java, AbstractNamingThreadFactoryModuleFactory.java, AbstractThreadPoolRegistryImplModule.java, AbstractThreadPoolRegistryImplModuleFactory.java, AsyncEventBusModule.java, AsyncEventBusModuleFactory.java, AsyncEventBusModuleMXBean.java, AsyncEventBusRuntimeMXBean.java, AsyncEventBusRuntimeRegistration.java, AsyncEventBusRuntimeRegistrator.java, DynamicThreadPoolModule.java, DynamicThreadPoolModuleFactory.java, DynamicThreadPoolModuleMXBean.java, DynamicThreadPoolRuntimeMXBean.java, DynamicThreadPoolRuntimeRegistration.java, DynamicThreadPoolRuntimeRegistrator.java, EventBusModule.java, EventBusModuleFactory.java, EventBusModuleMXBean.java, EventRuntimeMXBean.java, EventRuntimeRegistration.java, FromGrouping.java, InnerStreamList.java, NamingThreadFactoryModule.java, NamingThreadFactoryModuleFactory.java, NamingThreadFactoryModuleMXBean.java, NamingThreadFactoryRuntimeMXBean.java, NamingThreadFactoryRuntimeRegistration.java, NamingThreadFactoryRuntimeRegistrator.java, Peer.java, StreamRuntimeMXBean.java, StreamRuntimeRegistration.java, ThreadPoolRegistryImplModule.java, ThreadPoolRegistryImplModuleFactory.java, ThreadPoolRegistryImplModuleMXBean.java, ThreadRuntimeMXBean.java, ThreadRuntimeRegistration.java, ThreadStreamRuntimeMXBean.java, ThreadStreamRuntimeRegistration.java]");
 
     private static final List<String> expectedBGPNames = ServiceInterfaceEntryTest
             .toFileNames("[AbstractBgpListenerImplModule.java, " + "AbstractBgpListenerImplModuleFactory.java, " +
@@ -108,7 +107,7 @@ public class JMXGeneratorTest extends AbstractGeneratorTest {
                     "NetconfTestFiles1ImplModuleMXBean.java, NetconfTestFiles1ImplRuntimeMXBean.java, " +
                     "NetconfTestFiles1ImplRuntimeRegistration.java, NetconfTestFiles1ImplRuntimeRegistrator.java, TestFileImplModule.java, TestFileImplModuleFactory.java, TestFileImplModuleMXBean.java, TestFileImplRuntimeMXBean.java, TestFileImplRuntimeRegistration.java, TestFileImplRuntimeRegistrator.java, TestFiles1ImplModule.java, TestFiles1ImplModuleFactory.java, TestFiles1ImplModuleMXBean.java, TestFiles1ImplRuntimeMXBean.java, TestFiles1ImplRuntimeRegistration.java, TestFiles1ImplRuntimeRegistrator.java]");
     private static final List<String> expectedAllFileNames = ServiceInterfaceEntryTest
-            .toFileNames("[AbstractAsyncEventBusModule.java, AbstractAsyncEventBusModuleFactory.java, AbstractBgpListenerImplModule.java, AbstractBgpListenerImplModuleFactory.java, AbstractDynamicThreadPoolModule.java, AbstractDynamicThreadPoolModuleFactory.java, AbstractEventBusModule.java, AbstractEventBusModuleFactory.java, AbstractNamingThreadFactoryModule.java, AbstractNamingThreadFactoryModuleFactory.java, AbstractNetconfTestFileImplModule.java, AbstractNetconfTestFileImplModuleFactory.java, AbstractNetconfTestFiles1ImplModule.java, AbstractNetconfTestFiles1ImplModuleFactory.java, AbstractNetconfTestImplModule.java, AbstractNetconfTestImplModuleFactory.java, AbstractTestFileImplModule.java, AbstractTestFileImplModuleFactory.java, AbstractTestFiles1ImplModule.java, AbstractTestFiles1ImplModuleFactory.java, AbstractTestImplModule.java, AbstractTestImplModuleFactory.java, AbstractThreadPoolRegistryImplModule.java, AbstractThreadPoolRegistryImplModuleFactory.java, AsyncEventBusModule.java, AsyncEventBusModuleFactory.java, AsyncEventBusModuleMXBean.java, AsyncEventBusRuntimeMXBean.java, AsyncEventBusRuntimeRegistration.java, AsyncEventBusRuntimeRegistrator.java, AutoCloseableServiceInterface.java, BgpListenerImplModule.java, BgpListenerImplModuleFactory.java, BgpListenerImplModuleMXBean.java, BgpListenerImplRuntimeMXBean.java, BgpListenerImplRuntimeRegistration.java, BgpListenerImplRuntimeRegistrator.java, ComplexDtoBInner.java, ComplexList.java, Deep.java, DtoA.java, DtoA.java, DtoA.java, DtoA1.java, DtoAInner.java, DtoAInnerInner.java, DtoB.java, DtoC.java, DynamicThreadPoolModule.java, DynamicThreadPoolModuleFactory.java, DynamicThreadPoolModuleMXBean.java, DynamicThreadPoolRuntimeMXBean.java, DynamicThreadPoolRuntimeRegistration.java, DynamicThreadPoolRuntimeRegistrator.java, EventBusModule.java, EventBusModuleFactory.java, EventBusModuleMXBean.java, EventBusServiceInterface.java, EventRuntimeMXBean.java, EventRuntimeRegistration.java, InnerStreamList.java, NamingThreadFactoryModule.java, NamingThreadFactoryModuleFactory.java, NamingThreadFactoryModuleMXBean.java, NamingThreadFactoryRuntimeMXBean.java, NamingThreadFactoryRuntimeRegistration.java, NamingThreadFactoryRuntimeRegistrator.java, NetconfTestFileImplModule.java, NetconfTestFileImplModuleFactory.java, NetconfTestFileImplModuleMXBean.java, NetconfTestFileImplRuntimeMXBean.java, NetconfTestFileImplRuntimeRegistration.java, NetconfTestFileImplRuntimeRegistrator.java, NetconfTestFiles1ImplModule.java, NetconfTestFiles1ImplModuleFactory.java, NetconfTestFiles1ImplModuleMXBean.java, NetconfTestFiles1ImplRuntimeMXBean.java, NetconfTestFiles1ImplRuntimeRegistration.java, NetconfTestFiles1ImplRuntimeRegistrator.java, NetconfTestImplModule.java, NetconfTestImplModuleFactory.java, NetconfTestImplModuleMXBean.java, NetconfTestImplRuntimeMXBean.java, NetconfTestImplRuntimeRegistration.java, NetconfTestImplRuntimeRegistrator.java, Peer.java, Peer.java, PeersRuntimeMXBean.java, PeersRuntimeRegistration.java, ScheduledThreadPoolServiceInterface.java, SimpleList.java, StreamRuntimeMXBean.java, StreamRuntimeRegistration.java, TestFileImplModule.java, TestFileImplModuleFactory.java, TestFileImplModuleMXBean.java, TestFileImplRuntimeMXBean.java, TestFileImplRuntimeRegistration.java, TestFileImplRuntimeRegistrator.java, TestFiles1ImplModule.java, TestFiles1ImplModuleFactory.java, TestFiles1ImplModuleMXBean.java, TestFiles1ImplRuntimeMXBean.java, TestFiles1ImplRuntimeRegistration.java, TestFiles1ImplRuntimeRegistrator.java, TestImplModule.java, TestImplModuleFactory.java, TestImplModuleMXBean.java, TestImplRuntimeMXBean.java, TestImplRuntimeRegistration.java, TestImplRuntimeRegistrator.java, ThreadFactoryServiceInterface.java, ThreadPoolRegistryImplModule.java, ThreadPoolRegistryImplModuleFactory.java, ThreadPoolRegistryImplModuleMXBean.java, ThreadPoolServiceInterface.java, ThreadRuntimeMXBean.java, ThreadRuntimeRegistration.java, ThreadStreamRuntimeMXBean.java, ThreadStreamRuntimeRegistration.java]");
+            .toFileNames("[AbstractAsyncEventBusModule.java, AbstractAsyncEventBusModuleFactory.java, AbstractBgpListenerImplModule.java, AbstractBgpListenerImplModuleFactory.java, AbstractDynamicThreadPoolModule.java, AbstractDynamicThreadPoolModuleFactory.java, AbstractEventBusModule.java, AbstractEventBusModuleFactory.java, AbstractNamingThreadFactoryModule.java, AbstractNamingThreadFactoryModuleFactory.java, AbstractNetconfTestFileImplModule.java, AbstractNetconfTestFileImplModuleFactory.java, AbstractNetconfTestFiles1ImplModule.java, AbstractNetconfTestFiles1ImplModuleFactory.java, AbstractNetconfTestImplModule.java, AbstractNetconfTestImplModuleFactory.java, AbstractTestFileImplModule.java, AbstractTestFileImplModuleFactory.java, AbstractTestFiles1ImplModule.java, AbstractTestFiles1ImplModuleFactory.java, AbstractTestImplModule.java, AbstractTestImplModuleFactory.java, AbstractThreadPoolRegistryImplModule.java, AbstractThreadPoolRegistryImplModuleFactory.java, AsyncEventBusModule.java, AsyncEventBusModuleFactory.java, AsyncEventBusModuleMXBean.java, AsyncEventBusRuntimeMXBean.java, AsyncEventBusRuntimeRegistration.java, AsyncEventBusRuntimeRegistrator.java, AutoCloseableServiceInterface.java, BgpListenerImplModule.java, BgpListenerImplModuleFactory.java, BgpListenerImplModuleMXBean.java, BgpListenerImplRuntimeMXBean.java, BgpListenerImplRuntimeRegistration.java, BgpListenerImplRuntimeRegistrator.java, ComplexDtoBInner.java, ComplexList.java, Deep.java, DtoA.java, DtoA.java, DtoA.java, DtoA1.java, DtoAInner.java, DtoAInnerInner.java, DtoB.java, DtoC.java, DynamicThreadPoolModule.java, DynamicThreadPoolModuleFactory.java, DynamicThreadPoolModuleMXBean.java, DynamicThreadPoolRuntimeMXBean.java, DynamicThreadPoolRuntimeRegistration.java, DynamicThreadPoolRuntimeRegistrator.java, EventBusModule.java, EventBusModuleFactory.java, EventBusModuleMXBean.java, EventBusServiceInterface.java, EventRuntimeMXBean.java, EventRuntimeRegistration.java, FromGrouping.java, InnerStreamList.java, NamingThreadFactoryModule.java, NamingThreadFactoryModuleFactory.java, NamingThreadFactoryModuleMXBean.java, NamingThreadFactoryRuntimeMXBean.java, NamingThreadFactoryRuntimeRegistration.java, NamingThreadFactoryRuntimeRegistrator.java, NetconfTestFileImplModule.java, NetconfTestFileImplModuleFactory.java, NetconfTestFileImplModuleMXBean.java, NetconfTestFileImplRuntimeMXBean.java, NetconfTestFileImplRuntimeRegistration.java, NetconfTestFileImplRuntimeRegistrator.java, NetconfTestFiles1ImplModule.java, NetconfTestFiles1ImplModuleFactory.java, NetconfTestFiles1ImplModuleMXBean.java, NetconfTestFiles1ImplRuntimeMXBean.java, NetconfTestFiles1ImplRuntimeRegistration.java, NetconfTestFiles1ImplRuntimeRegistrator.java, NetconfTestImplModule.java, NetconfTestImplModuleFactory.java, NetconfTestImplModuleMXBean.java, NetconfTestImplRuntimeMXBean.java, NetconfTestImplRuntimeRegistration.java, NetconfTestImplRuntimeRegistrator.java, Peer.java, Peer.java, PeersRuntimeMXBean.java, PeersRuntimeRegistration.java, ScheduledThreadPoolServiceInterface.java, SimpleList.java, StreamRuntimeMXBean.java, StreamRuntimeRegistration.java, TestFileImplModule.java, TestFileImplModuleFactory.java, TestFileImplModuleMXBean.java, TestFileImplRuntimeMXBean.java, TestFileImplRuntimeRegistration.java, TestFileImplRuntimeRegistrator.java, TestFiles1ImplModule.java, TestFiles1ImplModuleFactory.java, TestFiles1ImplModuleMXBean.java, TestFiles1ImplRuntimeMXBean.java, TestFiles1ImplRuntimeRegistration.java, TestFiles1ImplRuntimeRegistrator.java, TestImplModule.java, TestImplModuleFactory.java, TestImplModuleMXBean.java, TestImplRuntimeMXBean.java, TestImplRuntimeRegistration.java, TestImplRuntimeRegistrator.java, ThreadFactoryServiceInterface.java, ThreadPoolRegistryImplModule.java, ThreadPoolRegistryImplModuleFactory.java, ThreadPoolRegistryImplModuleMXBean.java, ThreadPoolServiceInterface.java, ThreadRuntimeMXBean.java, ThreadRuntimeRegistration.java, ThreadStreamRuntimeMXBean.java, ThreadStreamRuntimeRegistration.java]");
     private static final List<String> expectedGenerateMBEsListNames = ServiceInterfaceEntryTest
             .toFileNames("[AbstractBgpListenerImplModule.java, AbstractBgpListenerImplModuleFactory.java, BgpListenerImplModule.java, BgpListenerImplModuleFactory.java, BgpListenerImplModuleMXBean.java, BgpListenerImplRuntimeMXBean.java, BgpListenerImplRuntimeRegistration.java, BgpListenerImplRuntimeRegistrator.java, PeersRuntimeMXBean.java, PeersRuntimeRegistration.java]");
 
@@ -506,8 +505,9 @@ public class JMXGeneratorTest extends AbstractGeneratorTest {
                 + ".threads.java", visitor.packageName);
         assertEquals("AsyncEventBusModuleMXBean", visitor.type);
 
-        assertEquals("Incorrenct number of generated methods", 2,
+        assertEquals("Incorrenct number of generated methods", 4,
                 visitor.methods.size());
+
     }
 
     private void assertAbstractDynamicThreadPoolModule(MbeASTVisitor visitor) {
index d8c5a56fb7a7561de457894180ad1a1b418b7f57..e9f0ac817675d90a9c9257456d0f9c03c7106719 100644 (file)
@@ -38,6 +38,7 @@ import org.opendaylight.controller.config.yangjmxgenerator.attribute.ListAttribu
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.ListDependenciesAttribute;
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.TOAttribute;
 import org.opendaylight.controller.config.yangjmxgenerator.plugin.util.NameConflictException;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.ServiceRef;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
 import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
@@ -130,7 +131,7 @@ final class ModuleMXBeanEntryBuilder {
         Map<String, ModuleMXBeanEntry> result = new HashMap<>();
 
         for (AugmentationSchema augmentation : currentModule.getAugmentations()) {
-            Set<DataSchemaNode> childNodes = augmentation.getChildNodes();
+            Collection<DataSchemaNode> childNodes = augmentation.getChildNodes();
             if (areAllChildrenChoiceCaseNodes(childNodes)) {
                 for (ChoiceCaseNode childCase : castChildNodesToChoiceCases(childNodes)) {
                     // TODO refactor, extract to standalone builder class
@@ -215,7 +216,7 @@ final class ModuleMXBeanEntryBuilder {
         return moduleIdentities;
     }
 
-    private Collection<ChoiceCaseNode> castChildNodesToChoiceCases(final Set<DataSchemaNode> childNodes) {
+    private Collection<ChoiceCaseNode> castChildNodesToChoiceCases(final Collection<DataSchemaNode> childNodes) {
         return Collections2.transform(childNodes, new Function<DataSchemaNode, ChoiceCaseNode>() {
             @Nullable
             @Override
@@ -225,7 +226,7 @@ final class ModuleMXBeanEntryBuilder {
         });
     }
 
-    private boolean areAllChildrenChoiceCaseNodes(final Set<DataSchemaNode> childNodes) {
+    private boolean areAllChildrenChoiceCaseNodes(final Iterable<DataSchemaNode> childNodes) {
         for (DataSchemaNode childNode : childNodes) {
             if (childNode instanceof ChoiceCaseNode == false) {
                 return false;
@@ -388,7 +389,7 @@ final class ModuleMXBeanEntryBuilder {
      * @return either choiceCaseNode or its only child container
      */
     private <HAS_CHILDREN_AND_QNAME extends DataNodeContainer & SchemaNode> HAS_CHILDREN_AND_QNAME getDataNodeContainer(final ChoiceCaseNode choiceCaseNode) {
-        Set<DataSchemaNode> childNodes = choiceCaseNode.getChildNodes();
+        Collection<DataSchemaNode> childNodes = choiceCaseNode.getChildNodes();
         if (childNodes.size() == 1) {
             DataSchemaNode onlyChild = childNodes.iterator().next();
             if (onlyChild instanceof ContainerSchemaNode) {
@@ -406,8 +407,7 @@ final class ModuleMXBeanEntryBuilder {
             final TypeProviderWrapper typeProviderWrapper, final Map<QName, ServiceInterfaceEntry> qNamesToSIEs,
             final SchemaContext schemaContext, final String packageName) {
         Map<String, AttributeIfc> yangToAttributes = new HashMap<>();
-        Set<DataSchemaNode> childNodes = dataNodeContainer.getChildNodes();
-        for (DataSchemaNode attrNode : childNodes) {
+        for (DataSchemaNode attrNode : dataNodeContainer.getChildNodes()) {
             AttributeIfc attributeValue = getAttributeValue(attrNode, currentModule, qNamesToSIEs, typeProviderWrapper,
                     schemaContext, packageName);
             yangToAttributes.put(attributeValue.getAttributeYangName(), attributeValue);
@@ -467,7 +467,7 @@ final class ModuleMXBeanEntryBuilder {
     private Optional<? extends AbstractDependencyAttribute> extractDependency(final DataNodeContainer dataNodeContainer,
             final DataSchemaNode attrNode, final Module currentModule, final Map<QName, ServiceInterfaceEntry> qNamesToSIEs,
             final SchemaContext schemaContext) {
-        if (dataNodeContainer.getUses().size() == 1 && getChildNodeSizeWithoutUses(dataNodeContainer) == 0) {
+        if (isDependencyContainer(dataNodeContainer)) {
             // reference
             UsesNode usesNode = dataNodeContainer.getUses().iterator().next();
             checkState(usesNode.getRefines().size() == 1, "Unexpected 'refine' child node size of " + dataNodeContainer);
@@ -494,6 +494,18 @@ final class ModuleMXBeanEntryBuilder {
         return Optional.absent();
     }
 
+    private boolean isDependencyContainer(final DataNodeContainer dataNodeContainer) {
+        if(dataNodeContainer.getUses().size() != 1) {
+            return false;
+        }
+        UsesNode onlyUses = dataNodeContainer.getUses().iterator().next();
+        if(onlyUses.getGroupingPath().getLastComponent().equals(ServiceRef.QNAME) == false) {
+            return false;
+        }
+
+        return getChildNodeSizeWithoutUses(dataNodeContainer) == 0;
+    }
+
     private int getChildNodeSizeWithoutUses(final DataNodeContainer csn) {
         int result = 0;
         for (DataSchemaNode dsn : csn.getChildNodes()) {
index 23b071c817022ac0103f7cc01c4cc5f5482ba995..67f624175b00aacff88369aa8fce5fe00ce5a961 100644 (file)
@@ -332,7 +332,7 @@ public class RuntimeBeanEntry {
         }
     }
 
-    private static Collection<DataSchemaNode> sortAttributes(final Set<DataSchemaNode> childNodes) {
+    private static Collection<DataSchemaNode> sortAttributes(final Collection<DataSchemaNode> childNodes) {
         final TreeSet<DataSchemaNode> dataSchemaNodes = new TreeSet<>(new Comparator<DataSchemaNode>() {
             @Override
             public int compare(final DataSchemaNode o1, final DataSchemaNode o2) {
index e189ef7d66c65b8bdfe9f905889797d84dbb5e36..a6d2feaf044bb2f9865ec322612eb624b4594ea1 100644 (file)
@@ -56,6 +56,12 @@ module config-threads-java {
         }
     }
 
+    grouping async-eventbus-config-attrs {
+        leaf cfg-attr {
+            type string;
+        }
+    }
+
     augment "/config:modules/config:module/config:configuration" {
         case async-eventbus {
             when "/config:modules/config:module/config:type = 'async-eventbus'";
@@ -66,6 +72,10 @@ module config-threads-java {
                     }
                 }
             }
+
+            container from-grouping {
+                uses async-eventbus-config-attrs;
+            }
         }
     }
     augment "/config:modules/config:module/config:state" {
index 4ef0b8e86bf926062ff0e7071775efd79d0f531a..977fab1334ae48791f9901aedbc1420eabb1e2e7 100644 (file)
     </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>
+      <artifactId>config-netty-features</artifactId>
+      <version>${config.version}</version>
       <classifier>features</classifier>
       <type>xml</type>
       <scope>runtime</scope>
     </dependency>
+
+    <!-- AD-SAL Related Features -->
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
-      <artifactId>config-features</artifactId>
-      <version>${config.version}</version>
+      <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>features-adsal</artifactId>
-      <version>${sal.version}</version>
+      <artifactId>features-nsf</artifactId>
+      <version>${project.version}</version>
       <classifier>features</classifier>
       <type>xml</type>
       <scope>runtime</scope>
     </dependency>
+
+    <!-- MD-SAL Related Features -->
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>mdsal-features</artifactId>
           </execution>
         </executions>
       </plugin>
+        <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-antrun-plugin</artifactId>
+            <executions>
+                <execution>
+                    <phase>prepare-package</phase>
+                    <goals>
+                        <goal>run</goal>
+                    </goals>
+                    <configuration>
+                        <tasks>
+                            <copy todir="${project.build.directory}/assembly/bin" overwrite="true">
+                                <fileset dir="${basedir}/src/main/resources/karaf/" includes="karaf,karaf.bat,instance,instance.bat"/>
+                            </copy>
+                        </tasks>
+                    </configuration>
+                </execution>
+            </executions>
+        </plugin>
     </plugins>
   </build>
   <scm>
diff --git a/opendaylight/distribution/opendaylight-karaf/src/main/resources/karaf/instance b/opendaylight/distribution/opendaylight-karaf/src/main/resources/karaf/instance
new file mode 100755 (executable)
index 0000000..7288042
--- /dev/null
@@ -0,0 +1,349 @@
+#!/bin/sh
+#
+#    Licensed to the Apache Software Foundation (ASF) under one or more
+#    contributor license agreements.  See the NOTICE file distributed with
+#    this work for additional information regarding copyright ownership.
+#    The ASF licenses this file to You under the Apache License, Version 2.0
+#    (the "License"); you may not use this file except in compliance with
+#    the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+#
+
+DIRNAME=`dirname "$0"`
+PROGNAME=`basename "$0"`
+
+#
+# Sourcing environment settings for karaf similar to tomcats setenv
+#
+KARAF_SCRIPT="instance"
+export KARAF_SCRIPT
+if [ -f "$DIRNAME/setenv" ]; then
+  . "$DIRNAME/setenv"
+fi
+
+#
+# Check/Set up some easily accessible MIN/MAX params for JVM mem usage
+#
+if [ "x$JAVA_MIN_MEM" = "x" ]; then
+    JAVA_MIN_MEM=128M
+    export JAVA_MIN_MEM
+fi
+if [ "x$JAVA_MAX_MEM" = "x" ]; then
+    JAVA_MAX_MEM=512M
+    export JAVA_MAX_MEM
+fi
+
+warn() {
+    echo "${PROGNAME}: $*"
+}
+
+die() {
+    warn "$*"
+    exit 1
+}
+
+detectOS() {
+    # OS specific support (must be 'true' or 'false').
+    cygwin=false;
+    darwin=false;
+    aix=false;
+    os400=false;
+    case "`uname`" in
+        CYGWIN*)
+            cygwin=true
+            ;;
+        Darwin*)
+            darwin=true
+            ;;
+        AIX*)
+            aix=true
+            ;;
+        OS400*)
+            os400=true
+            ;;
+    esac
+    # For AIX, set an environment variable
+    if $aix; then
+         export LDR_CNTRL=MAXDATA=0xB0000000@DSA
+         echo $LDR_CNTRL
+    fi
+}
+
+unlimitFD() {
+    # Use the maximum available, or set MAX_FD != -1 to use that
+    if [ "x$MAX_FD" = "x" ]; then
+        MAX_FD="maximum"
+    fi
+
+    # Increase the maximum file descriptors if we can
+    if [ "$os400" = "false" ] && [ "$cygwin" = "false" ]; then
+        MAX_FD_LIMIT=`ulimit -H -n`
+        if [ "$MAX_FD_LIMIT" != 'unlimited' ]; then 
+            if [ $? -eq 0 ]; then
+                if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
+                    # use the system max
+                    MAX_FD="$MAX_FD_LIMIT"
+                fi
+
+                ulimit -n $MAX_FD > /dev/null
+                # echo "ulimit -n" `ulimit -n`
+                if [ $? -ne 0 ]; then
+                    warn "Could not set maximum file descriptor limit: $MAX_FD"
+                fi
+            else
+                warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
+            fi
+        fi
+    fi
+}
+
+locateHome() {
+    if [ "x$KARAF_HOME" != "x" ]; then
+        warn "Ignoring predefined value for KARAF_HOME"
+    fi
+
+    # In POSIX shells, CDPATH may cause cd to write to stdout
+    (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+    KARAF_HOME=`cd "$DIRNAME/.."; pwd`
+    if [ ! -d "$KARAF_HOME" ]; then
+        die "KARAF_HOME is not valid: $KARAF_HOME"
+    fi
+}
+
+locateBase() {
+    if [ "x$KARAF_BASE" != "x" ]; then
+        if [ ! -d "$KARAF_BASE" ]; then
+            die "KARAF_BASE is not valid: $KARAF_BASE"
+        fi
+    else
+        KARAF_BASE=$KARAF_HOME
+    fi
+}
+
+locateData() {
+    if [ "x$KARAF_DATA" != "x" ]; then
+        if [ ! -d "$KARAF_DATA" ]; then
+            die "KARAF_DATA is not valid: $KARAF_DATA"
+        fi
+    else
+        KARAF_DATA=$KARAF_BASE/data
+    fi
+}
+
+locateEtc() {
+    if [ "x$KARAF_ETC" != "x" ]; then
+        if [ ! -d "$KARAF_ETC" ]; then
+            die "KARAF_ETC is not valid: $KARAF_ETC"
+        fi
+    else
+        KARAF_ETC=$KARAF_BASE/etc
+    fi
+}
+
+setupNativePath() {
+    # Support for loading native libraries
+    LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:$KARAF_BASE/lib:$KARAF_HOME/lib"
+
+    # For Cygwin, set PATH from LD_LIBRARY_PATH
+    if $cygwin; then
+        LD_LIBRARY_PATH=`cygpath --path --windows "$LD_LIBRARY_PATH"`
+        PATH="$PATH;$LD_LIBRARY_PATH"
+        export PATH
+    fi
+    export LD_LIBRARY_PATH
+}
+
+pathCanonical() {
+    local dst="${1}"
+    while [ -h "${dst}" ] ; do
+        ls=`ls -ld "${dst}"`
+        link=`expr "$ls" : '.*-> \(.*\)$'`
+        if expr "$link" : '/.*' > /dev/null; then
+            dst="$link"
+        else
+            dst="`dirname "${dst}"`/$link"
+        fi
+    done
+    local bas=`basename "${dst}"`
+    local dir=`dirname "${dst}"`
+    if [ "$bas" != "$dir" ]; then
+        dst="`pathCanonical "$dir"`/$bas"
+    fi
+    echo "${dst}" | sed -e 's#//#/#g' -e 's#/./#/#g' -e 's#/[^/]*/../#/#g'
+}
+
+locateJava() {
+    # Setup the Java Virtual Machine
+    if $cygwin ; then
+        [ -n "$JAVA" ] && JAVA=`cygpath --unix "$JAVA"`
+        [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+    fi
+
+    if [ "x$JAVA_HOME" = "x" ] && [ "$darwin" = "true" ]; then
+        JAVA_HOME="$(/usr/libexec/java_home)"
+    fi
+    if [ "x$JAVA" = "x" ] && [ -r /etc/gentoo-release ] ; then
+        JAVA_HOME=`java-config --jre-home`
+    fi
+    if [ "x$JAVA" = "x" ]; then
+        if [ "x$JAVA_HOME" != "x" ]; then
+            if [ ! -d "$JAVA_HOME" ]; then
+                die "JAVA_HOME is not valid: $JAVA_HOME"
+            fi
+            JAVA="$JAVA_HOME/bin/java"
+        else
+            warn "JAVA_HOME not set; results may vary"
+            JAVA=`type java`
+            JAVA=`expr "$JAVA" : '.*is \(.*\)$'`
+            if [ "x$JAVA" = "x" ]; then
+                die "java command not found"
+            fi
+        fi
+    fi
+    if [ "x$JAVA_HOME" = "x" ]; then
+        JAVA_HOME="$(dirname $(dirname $(pathCanonical "$JAVA")))"
+    fi
+}
+
+detectJVM() {
+   #echo "`$JAVA -version`"
+   # This service should call `java -version`,
+   # read stdout, and look for hints
+   if $JAVA -version 2>&1 | grep "^IBM" ; then
+       JVM_VENDOR="IBM"
+   # on OS/400, java -version does not contain IBM explicitly
+   elif $os400; then
+       JVM_VENDOR="IBM"
+   else
+       JVM_VENDOR="SUN"
+   fi
+   # echo "JVM vendor is $JVM_VENDOR"
+}
+
+setupDebugOptions() {
+    if [ "x$JAVA_OPTS" = "x" ]; then
+        JAVA_OPTS="$DEFAULT_JAVA_OPTS"
+    fi
+    export JAVA_OPTS
+
+    # Set Debug options if enabled
+    if [ "x$KARAF_DEBUG" != "x" ]; then
+        # Use the defaults if JAVA_DEBUG_OPTS was not set
+        if [ "x$JAVA_DEBUG_OPTS" = "x" ]; then
+            JAVA_DEBUG_OPTS="$DEFAULT_JAVA_DEBUG_OPTS"
+        fi
+
+        JAVA_OPTS="$JAVA_DEBUG_OPTS $JAVA_OPTS"
+        warn "Enabling Java debug options: $JAVA_DEBUG_OPTS"
+    fi
+}
+
+setupDefaults() {
+    DEFAULT_JAVA_OPTS="-Xms$JAVA_MIN_MEM -Xmx$JAVA_MAX_MEM "
+
+    #Set the JVM_VENDOR specific JVM flags
+    if [ "$JVM_VENDOR" = "SUN" ]; then
+        #
+        # Check some easily accessible MIN/MAX params for JVM mem usage
+        #
+        if [ "x$JAVA_PERM_MEM" != "x" ]; then
+            DEFAULT_JAVA_OPTS="$DEFAULT_JAVA_OPTS -XX:PermSize=$JAVA_PERM_MEM"
+        fi
+        if [ "x$JAVA_MAX_PERM_MEM" != "x" ]; then
+            DEFAULT_JAVA_OPTS="$DEFAULT_JAVA_OPTS -XX:MaxPermSize=$JAVA_MAX_PERM_MEM"
+        fi
+        DEFAULT_JAVA_OPTS="-server $DEFAULT_JAVA_OPTS -Dcom.sun.management.jmxremote"
+    elif [ "$JVM_VENDOR" = "IBM" ]; then
+        if $os400; then
+            DEFAULT_JAVA_OPTS="$DEFAULT_JAVA_OPTS"
+        elif $aix; then
+            DEFAULT_JAVA_OPTS="-Xverify:none -Xdump:heap -Xlp $DEFAULT_JAVA_OPTS"
+        else
+            DEFAULT_JAVA_OPTS="-Xverify:none $DEFAULT_JAVA_OPTS"
+        fi
+    fi
+
+    # Add the jars in the lib dir
+    for file in "$KARAF_HOME"/lib/*.jar
+    do
+        if [ -z "$CLASSPATH" ]; then
+            CLASSPATH="$file"
+        else
+            CLASSPATH="$CLASSPATH:$file"
+        fi
+    done
+    DEFAULT_JAVA_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
+
+    ##
+    ## TODO: Move to conf/profiler/yourkit.{sh|cmd}
+    ##
+    # Uncomment to enable YourKit profiling
+    #DEFAULT_JAVA_DEBUG_OPTS="-Xrunyjpagent"
+}
+
+init() {
+    # Determine if there is special OS handling we must perform
+    detectOS
+
+    # Unlimit the number of file descriptors if possible
+    unlimitFD
+
+    # Locate the Karaf home directory
+    locateHome
+
+    # Locate the Karaf base directory
+    locateBase
+
+    # Locate the Karaf data directory
+    locateData
+
+    # Locate the Karaf etc directory
+    locateEtc
+
+    # Setup the native library path
+    setupNativePath
+
+    # Locate the Java VM to execute
+    locateJava
+
+    # Determine the JVM vendor
+    detectJVM
+
+    # Setup default options
+    setupDefaults
+
+    # Install debug options
+    setupDebugOptions
+
+}
+
+run() {
+
+    CLASSPATH="${KARAF_HOME}/system/org/apache/karaf/instance/org.apache.karaf.instance.command/3.0.1/org.apache.karaf.instance.command-3.0.1.jar:${KARAF_HOME}/system/org/apache/karaf/instance/org.apache.karaf.instance.core/3.0.1/org.apache.karaf.instance.core-3.0.1.jar:${KARAF_HOME}/system/org/apache/karaf/shell/org.apache.karaf.shell.console/3.0.1/org.apache.karaf.shell.console-3.0.1.jar:${KARAF_HOME}/system/org/apache/karaf/shell/org.apache.karaf.shell.table/3.0.1/org.apache.karaf.shell.table-3.0.1.jar:${KARAF_HOME}/system/org/apache/aries/blueprint/org.apache.aries.blueprint.api/1.0.0/org.apache.aries.blueprint.api-1.0.0.jar:${KARAF_HOME}/system/org/apache/aries/blueprint/org.apache.aries.blueprint.core/1.4.0/org.apache.aries.blueprint.core-1.4.0.jar:${KARAF_HOME}/system/org/apache/aries/blueprint/org.apache.aries.blueprint.cm/1.0.3/org.apache.aries.blueprint.cm-1.0.3.jar:${KARAF_HOME}/system/org/ops4j/pax/logging/pax-logging-api/1.7.2/pax-logging-api-1.7.2.jar:${KARAF_HOME}/system/org/apache/felix/org.apache.felix.framework/4.2.1/org.apache.felix.framework-4.2.1.jar:${KARAF_HOME}/system/jline/jline/2.11/jline-2.11.jar:$CLASSPATH"
+
+    if $cygwin; then
+        KARAF_HOME=`cygpath --path --windows "$KARAF_HOME"`
+        KARAF_BASE=`cygpath --path --windows "$KARAF_BASE"`
+        KARAF_DATA=`cygpath --path --windows "$KARAF_DATA"`
+        KARAF_ETC=`cygpath --path --windows "$KARAF_ETC"`
+        CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+    fi
+
+    exec "$JAVA" $JAVA_OPTS -Dkaraf.instances="${KARAF_HOME}/instances" -Dkaraf.home="$KARAF_HOME" -Dkaraf.base="$KARAF_BASE" -Dkaraf.etc="$KARAF_ETC" -Djava.io.tmpdir="$KARAF_DATA/tmp" -Djava.util.logging.config.file="$KARAF_BASE/etc/java.util.logging.properties" $KARAF_OPTS $OPTS -classpath "$CLASSPATH" org.apache.karaf.instance.main.Execute "$@"
+}
+
+main() {
+    init
+    run "$@"
+}
+
+main "$@"
+
diff --git a/opendaylight/distribution/opendaylight-karaf/src/main/resources/karaf/instance.bat b/opendaylight/distribution/opendaylight-karaf/src/main/resources/karaf/instance.bat
new file mode 100644 (file)
index 0000000..49c2c0f
--- /dev/null
@@ -0,0 +1,151 @@
+@echo off\r
+rem\r
+rem\r
+rem    Licensed to the Apache Software Foundation (ASF) under one or more\r
+rem    contributor license agreements.  See the NOTICE file distributed with\r
+rem    this work for additional information regarding copyright ownership.\r
+rem    The ASF licenses this file to You under the Apache License, Version 2.0\r
+rem    (the "License"); you may not use this file except in compliance with\r
+rem    the License.  You may obtain a copy of the License at\r
+rem\r
+rem       http://www.apache.org/licenses/LICENSE-2.0\r
+rem\r
+rem    Unless required by applicable law or agreed to in writing, software\r
+rem    distributed under the License is distributed on an "AS IS" BASIS,\r
+rem    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+rem    See the License for the specific language governing permissions and\r
+rem    limitations under the License.\r
+rem\r
+\r
+if not "%ECHO%" == "" echo %ECHO%\r
+\r
+setlocal\r
+set DIRNAME=%~dp0%\r
+set PROGNAME=%~nx0%\r
+set ARGS=%*\r
+\r
+rem Sourcing environment settings for karaf similar to tomcats setenv\r
+SET KARAF_SCRIPT="instance.bat"\r
+if exist "%DIRNAME%setenv.bat" (\r
+  call "%DIRNAME%setenv.bat"\r
+)\r
+\r
+rem Check console window title. Set to Karaf by default\r
+if not "%KARAF_TITLE%" == "" (\r
+    title %KARAF_TITLE%\r
+) else (\r
+    title Karaf\r
+)\r
+\r
+rem Check/Set up some easily accessible MIN/MAX params for JVM mem usage\r
+if "%JAVA_MIN_MEM%" == "" (\r
+    set JAVA_MIN_MEM=128M\r
+)\r
+if "%JAVA_MAX_MEM%" == "" (\r
+    set JAVA_MAX_MEM=512M\r
+)\r
+\r
+goto BEGIN\r
+\r
+:warn\r
+    echo %PROGNAME%: %*\r
+goto :EOF\r
+\r
+:BEGIN\r
+\r
+rem # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\r
+\r
+if not "%KARAF_HOME%" == "" (\r
+    call :warn Ignoring predefined value for KARAF_HOME\r
+)\r
+set KARAF_HOME=%DIRNAME%..\r
+if not exist "%KARAF_HOME%" (\r
+    call :warn KARAF_HOME is not valid: "%KARAF_HOME%"\r
+    goto END\r
+)\r
+\r
+if not "%KARAF_BASE%" == "" (\r
+    if not exist "%KARAF_BASE%" (\r
+       call :warn KARAF_BASE is not valid: "%KARAF_BASE%"\r
+       goto END\r
+    )\r
+)\r
+if "%KARAF_BASE%" == "" (\r
+  set "KARAF_BASE=%KARAF_HOME%"\r
+)\r
+\r
+if not "%KARAF_DATA%" == "" (\r
+    if not exist "%KARAF_DATA%" (\r
+        call :warn KARAF_DATA is not valid: "%KARAF_DATA%"\r
+        goto END\r
+    )\r
+)\r
+if "%KARAF_DATA%" == "" (\r
+    set "KARAF_DATA=%KARAF_BASE%\data"\r
+)\r
+\r
+if not "%KARAF_ETC%" == "" (\r
+    if not exist "%KARAF_ETC%" (\r
+        call :warn KARAF_ETC is not valid: "%KARAF_ETC%"\r
+        goto END\r
+    )\r
+)\r
+if "%KARAF_ETC%" == "" (\r
+    set "KARAF_ETC=%KARAF_BASE%\etc"\r
+)\r
+\r
+set DEFAULT_JAVA_OPTS=\r
+set DEFAULT_JAVA_DEBUG_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005\r
+\r
+rem Support for loading native libraries\r
+set PATH=%PATH%;%KARAF_BASE%\lib;%KARAF_HOME%\lib\r
+\r
+rem Setup the Java Virtual Machine\r
+if not "%JAVA%" == "" goto :Check_JAVA_END\r
+    set JAVA=java\r
+    if "%JAVA_HOME%" == "" call :warn JAVA_HOME not set; results may vary\r
+    if not "%JAVA_HOME%" == "" set JAVA=%JAVA_HOME%\bin\java\r
+    if not exist "%JAVA_HOME%" (\r
+        call :warn JAVA_HOME is not valid: "%JAVA_HOME%"\r
+        goto END\r
+    )\r
+:Check_JAVA_END\r
+\r
+if "%JAVA_OPTS%" == "" set JAVA_OPTS=%DEFAULT_JAVA_OPTS%\r
+\r
+if "%KARAF_DEBUG%" == "" goto :KARAF_DEBUG_END\r
+    rem Use the defaults if JAVA_DEBUG_OPTS was not set\r
+    if "%JAVA_DEBUG_OPTS%" == "" set JAVA_DEBUG_OPTS=%DEFAULT_JAVA_DEBUG_OPTS%\r
+\r
+    set "JAVA_OPTS=%JAVA_DEBUG_OPTS% %JAVA_OPTS%"\r
+    call :warn Enabling Java debug options: %JAVA_DEBUG_OPTS%\r
+:KARAF_DEBUG_END\r
+\r
+rem Setup the classpath\r
+pushd "%KARAF_HOME%\lib"\r
+for %%G in (karaf*.jar) do call:APPEND_TO_CLASSPATH %%G\r
+popd\r
+goto CLASSPATH_END\r
+\r
+: APPEND_TO_CLASSPATH\r
+set filename=%~1\r
+set suffix=%filename:~-4%\r
+if %suffix% equ .jar set CLASSPATH=%CLASSPATH%;%KARAF_HOME%\lib\%filename%\r
+goto :EOF\r
+\r
+:CLASSPATH_END\r
+\r
+set CLASSPATH=%KARAF_HOME%\system\org\apache\karaf\instance\org.apache.karaf.instance.command\3.0.1\org.apache.karaf.instance.command-3.0.1.jar;%KARAF_HOME%\system\org\apache\karaf\instance\org.apache.karaf.instance.core\3.0.1\org.apache.karaf.instance.core-3.0.1.jar;%KARAF_HOME%\system\org\apache\karaf\shell\org.apache.karaf.shell.console\3.0.1\org.apache.karaf.shell.console-3.0.1.jar;%KARAF_HOME%\system\org\apache\karaf\shell\org.apache.karaf.shell.table\3.0.1\org.apache.karaf.shell.table-3.0.1.jar;%KARAF_HOME%\system\org\apache\aries\blueprint\org.apache.aries.blueprint.api\1.0.0\org.apache.aries.blueprint.api-1.0.0.jar;%KARAF_HOME%\system\org\apache\aries\blueprint\org.apache.aries.blueprint.core\1.4.0\org.apache.aries.blueprint.core-1.4.0.jar;%KARAF_HOME%\system\org\apache\aries\blueprint\org.apache.aries.blueprint.cm\1.0.3\org.apache.aries.blueprint.cm-1.0.3.jar;%KARAF_HOME%\system\org\ops4j\pax\logging\pax-logging-api\1.7.2\pax-logging-api-1.7.2.jar;%KARAF_HOME%\system\org\apache\felix\org.apache.felix.framework\4.2.1\org.apache.felix.framework-4.2.1.jar;%KARAF_HOME%\system\jline\jline\2.11\jline-2.11.jar;%CLASSPATH%\r
+\r
+:EXECUTE\r
+    if "%SHIFT%" == "true" SET ARGS=%2 %3 %4 %5 %6 %7 %8\r
+    if not "%SHIFT%" == "true" SET ARGS=%1 %2 %3 %4 %5 %6 %7 %8\r
+    rem Execute the Java Virtual Machine\r
+    "%JAVA%" %JAVA_OPTS% %OPTS% -classpath "%CLASSPATH%" -Dkaraf.instances="%KARAF_HOME%\instances" -Dkaraf.home="%KARAF_HOME%" -Dkaraf.base="%KARAF_BASE%" -Dkaraf.etc="%KARAF_ETC%" -Djava.io.tmpdir="%KARAF_DATA%\tmp" -Djava.util.logging.config.file="%KARAF_BASE%\etc\java.util.logging.properties" %KARAF_OPTS% org.apache.karaf.instance.main.Execute %ARGS%\r
+\r
+rem # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\r
+\r
+:END\r
+\r
+endlocal\r
+\r
diff --git a/opendaylight/distribution/opendaylight-karaf/src/main/resources/karaf/karaf b/opendaylight/distribution/opendaylight-karaf/src/main/resources/karaf/karaf
new file mode 100755 (executable)
index 0000000..cad052a
--- /dev/null
@@ -0,0 +1,418 @@
+#!/bin/sh
+#
+#    Licensed to the Apache Software Foundation (ASF) under one or more
+#    contributor license agreements.  See the NOTICE file distributed with
+#    this work for additional information regarding copyright ownership.
+#    The ASF licenses this file to You under the Apache License, Version 2.0
+#    (the "License"); you may not use this file except in compliance with
+#    the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+#
+
+DIRNAME=`dirname $0`
+PROGNAME=`basename $0`
+
+#
+# Sourcing environment settings for karaf similar to tomcats setenv
+#
+KARAF_SCRIPT="karaf"
+export KARAF_SCRIPT
+if [ -f "$DIRNAME/setenv" ]; then
+  . "$DIRNAME/setenv"
+fi
+
+#
+# Set up some easily accessible MIN/MAX params for JVM mem usage
+#
+if [ "x$JAVA_MIN_MEM" = "x" ]; then
+    JAVA_MIN_MEM=128M
+    export JAVA_MIN_MEM
+fi
+if [ "x$JAVA_MAX_MEM" = "x" ]; then
+    JAVA_MAX_MEM=512M
+    export JAVA_MAX_MEM
+fi
+
+#
+# Check the mode that initiated the script
+#
+if [ "x$1" != "x" ]; then
+    MODE=$1
+fi
+
+warn() {
+    echo "${PROGNAME}: $*"
+}
+
+die() {
+    warn "$*"
+    exit 1
+}
+
+detectOS() {
+    # OS specific support (must be 'true' or 'false').
+    cygwin=false;
+    darwin=false;
+    aix=false;
+    os400=false;
+    case "`uname`" in
+        CYGWIN*)
+            cygwin=true
+            ;;
+        Darwin*)
+            darwin=true
+            ;;
+        AIX*)
+            aix=true
+            ;;
+        OS400*)
+            os400=true
+            ;;
+    esac
+    # For AIX, set an environment variable
+    if $aix; then
+         export LDR_CNTRL=MAXDATA=0xB0000000@DSA
+         echo $LDR_CNTRL
+    fi
+}
+
+unlimitFD() {
+    # Use the maximum available, or set MAX_FD != -1 to use that
+    if [ "x$MAX_FD" = "x" ]; then
+        MAX_FD="maximum"
+    fi
+
+    # Increase the maximum file descriptors if we can
+    if [ "$os400" = "false" ] && [ "$cygwin" = "false" ]; then
+        MAX_FD_LIMIT=`ulimit -H -n`
+        if [ "$MAX_FD_LIMIT" != 'unlimited' ]; then 
+            if [ $? -eq 0 ]; then
+                if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
+                    # use the system max
+                    MAX_FD="$MAX_FD_LIMIT"
+                fi
+
+                ulimit -n $MAX_FD > /dev/null
+                # echo "ulimit -n" `ulimit -n`
+                if [ $? -ne 0 ]; then
+                    warn "Could not set maximum file descriptor limit: $MAX_FD"
+                fi
+            else
+                warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
+            fi
+        fi
+    fi
+}
+
+locateHome() {
+    if [ "x$KARAF_HOME" != "x" ]; then
+        warn "Ignoring predefined value for KARAF_HOME"
+    fi
+
+    # In POSIX shells, CDPATH may cause cd to write to stdout
+    (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+    KARAF_HOME=`cd "$DIRNAME/.."; pwd`
+    if [ ! -d "$KARAF_HOME" ]; then
+        die "KARAF_HOME is not valid: $KARAF_HOME"
+    fi
+}
+
+locateBase() {
+    if [ "x$KARAF_BASE" != "x" ]; then
+        if [ ! -d "$KARAF_BASE" ]; then
+            die "KARAF_BASE is not valid: $KARAF_BASE"
+        fi
+    else
+        KARAF_BASE=$KARAF_HOME
+    fi
+}
+
+locateData() {
+    if [ "x$KARAF_DATA" != "x" ]; then
+        if [ ! -d "$KARAF_DATA" ]; then
+            die "KARAF_DATA is not valid: $KARAF_DATA"
+        fi
+    else
+        KARAF_DATA=$KARAF_BASE/data
+    fi
+}
+
+locateEtc() {
+    if [ "x$KARAF_ETC" != "x" ]; then
+        if [ ! -d "$KARAF_ETC" ]; then
+            die "KARAF_ETC is not valid: $KARAF_ETC"
+        fi
+    else
+        KARAF_ETC=$KARAF_BASE/etc
+    fi
+}
+
+setupNativePath() {
+    # Support for loading native libraries
+    LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:$KARAF_BASE/lib:$KARAF_HOME/lib"
+
+    # For Cygwin, set PATH from LD_LIBRARY_PATH
+    if $cygwin; then
+        LD_LIBRARY_PATH=`cygpath --path --windows "$LD_LIBRARY_PATH"`
+        PATH="$PATH;$LD_LIBRARY_PATH"
+        export PATH
+    fi
+    export LD_LIBRARY_PATH
+}
+
+pathCanonical() {
+    local dst="${1}"
+    while [ -h "${dst}" ] ; do
+        ls=`ls -ld "${dst}"`
+        link=`expr "$ls" : '.*-> \(.*\)$'`
+        if expr "$link" : '/.*' > /dev/null; then
+            dst="$link"
+        else
+            dst="`dirname "${dst}"`/$link"
+        fi
+    done
+    local bas=`basename "${dst}"`
+    local dir=`dirname "${dst}"`
+    if [ "$bas" != "$dir" ]; then
+      dst="`pathCanonical "$dir"`/$bas"
+    fi
+    echo "${dst}" | sed -e 's#//#/#g' -e 's#/./#/#g' -e 's#/[^/]*/../#/#g'
+}
+
+locateJava() {
+    # Setup the Java Virtual Machine
+    if $cygwin ; then
+        [ -n "$JAVA" ] && JAVA=`cygpath --unix "$JAVA"`
+        [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+    fi
+
+       if [ "x$JAVA_HOME" = "x" ] && [ "$darwin" = "true" ]; then
+               JAVA_HOME="$(/usr/libexec/java_home)"
+       fi
+    if [ "x$JAVA" = "x" ] && [ -r /etc/gentoo-release ] ; then
+        JAVA_HOME=`java-config --jre-home`
+    fi
+    if [ "x$JAVA" = "x" ]; then
+        if [ "x$JAVA_HOME" != "x" ]; then
+            if [ ! -d "$JAVA_HOME" ]; then
+                die "JAVA_HOME is not valid: $JAVA_HOME"
+            fi
+            JAVA="$JAVA_HOME/bin/java"
+        else
+            warn "JAVA_HOME not set; results may vary"
+            JAVA=`type java`
+            JAVA=`expr "$JAVA" : '.*is \(.*\)$'`
+            if [ "x$JAVA" = "x" ]; then
+                die "java command not found"
+            fi
+        fi
+    fi
+    if [ "x$JAVA_HOME" = "x" ]; then
+        JAVA_HOME="$(dirname $(dirname $(pathCanonical "$JAVA")))"
+    fi
+}
+
+detectJVM() {
+   #echo "`$JAVA -version`"
+   # This service should call `java -version`,
+   # read stdout, and look for hints
+   if $JAVA -version 2>&1 | grep "^IBM" ; then
+       JVM_VENDOR="IBM"
+   # on OS/400, java -version does not contain IBM explicitly
+   elif $os400; then
+       JVM_VENDOR="IBM"
+   else
+       JVM_VENDOR="SUN"
+   fi
+   # echo "JVM vendor is $JVM_VENDOR"
+}
+
+checkJvmVersion() {
+   # echo "`$JAVA -version`"
+   VERSION=`$JAVA -version 2>&1 | egrep '"([0-9].[0-9]\..*[0-9])"' | awk '{print substr($3,2,length($3)-2)}' | awk '{print substr($1, 3, 3)}' | sed -e 's;\.;;g'`
+   # echo $VERSION
+   if [ "$VERSION" -lt "60" ]; then
+       echo "JVM must be greater than 1.6"
+       exit 1;
+   fi
+}
+
+setupDebugOptions() {
+    if [ "x$JAVA_OPTS" = "x" ]; then
+        JAVA_OPTS="$DEFAULT_JAVA_OPTS"
+    fi
+    export JAVA_OPTS
+
+    # Set Debug options if enabled
+    if [ "x$KARAF_DEBUG" != "x" ]; then
+        # Ignore DEBUG in case of stop or client mode
+        if [ "x$MODE" = "xstop" ]; then
+            return
+        fi
+        if [ "x$MODE" = "xclient" ]; then
+            return
+        fi
+        # Use the defaults if JAVA_DEBUG_OPTS was not set
+        if [ "x$JAVA_DEBUG_OPTS" = "x" ]; then
+            JAVA_DEBUG_OPTS="$DEFAULT_JAVA_DEBUG_OPTS"
+        fi
+
+        JAVA_OPTS="$JAVA_DEBUG_OPTS $JAVA_OPTS"
+        warn "Enabling Java debug options: $JAVA_DEBUG_OPTS"
+    fi
+}
+
+setupDefaults() {
+    DEFAULT_JAVA_OPTS="-Xms$JAVA_MIN_MEM -Xmx$JAVA_MAX_MEM -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass "
+
+    #Set the JVM_VENDOR specific JVM flags
+    if [ "$JVM_VENDOR" = "SUN" ]; then
+        #
+        # Check some easily accessible MIN/MAX params for JVM mem usage
+        #
+        if [ "x$JAVA_PERM_MEM" != "x" ]; then
+            DEFAULT_JAVA_OPTS="$DEFAULT_JAVA_OPTS -XX:PermSize=$JAVA_PERM_MEM"
+        fi
+        if [ "x$JAVA_MAX_PERM_MEM" != "x" ]; then
+            DEFAULT_JAVA_OPTS="$DEFAULT_JAVA_OPTS -XX:MaxPermSize=$JAVA_MAX_PERM_MEM"
+        fi
+        DEFAULT_JAVA_OPTS="-server $DEFAULT_JAVA_OPTS -Dcom.sun.management.jmxremote"
+    elif [ "$JVM_VENDOR" = "IBM" ]; then
+        if $os400; then
+            DEFAULT_JAVA_OPTS="$DEFAULT_JAVA_OPTS"
+        elif $aix; then
+            DEFAULT_JAVA_OPTS="-Xverify:none -Xdump:heap -Xlp $DEFAULT_JAVA_OPTS"
+        else
+            DEFAULT_JAVA_OPTS="-Xverify:none $DEFAULT_JAVA_OPTS"
+        fi
+    fi
+
+    # Add the jars in the lib dir
+    for file in "$KARAF_HOME"/lib/karaf*.jar
+    do
+        if [ -z "$CLASSPATH" ]; then
+            CLASSPATH="$file"
+        else
+            CLASSPATH="$CLASSPATH:$file"
+        fi
+    done
+    DEFAULT_JAVA_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
+
+    ##
+    ## TODO: Move to conf/profiler/yourkit.{sh|cmd}
+    ##
+    # Uncomment to enable YourKit profiling
+    #DEFAULT_JAVA_DEBUG_OPTS="-Xrunyjpagent"
+}
+
+init() {
+    # Determine if there is special OS handling we must perform
+    detectOS
+
+    # Unlimit the number of file descriptors if possible
+    unlimitFD
+
+    # Locate the Karaf home directory
+    locateHome
+
+    # Locate the Karaf base directory
+    locateBase
+
+    # Locate the Karaf data directory
+    locateData
+
+    # Locate the Karaf etc directory
+    locateEtc
+
+    # Setup the native library path
+    setupNativePath
+
+    # Locate the Java VM to execute
+    locateJava
+
+    # Determine the JVM vendor
+    detectJVM
+    
+    # Determine the JVM version >= 1.6
+    checkJvmVersion
+
+    # Setup default options
+    setupDefaults
+
+    # Install debug options
+    setupDebugOptions
+
+}
+
+run() {
+    OPTS="-Dkaraf.startLocalConsole=true -Dkaraf.startRemoteShell=true"
+    MAIN=org.apache.karaf.main.Main
+    while [ "$1" != "" ]; do
+        case $1 in
+            'clean')
+                rm -Rf "$KARAF_DATA"
+                shift
+                ;;
+            'debug')
+                if [ "x$JAVA_DEBUG_OPTS" = "x" ]; then
+                    JAVA_DEBUG_OPTS="$DEFAULT_JAVA_DEBUG_OPTS"
+                fi
+                JAVA_OPTS="$JAVA_DEBUG_OPTS $JAVA_OPTS"
+                shift
+                ;;
+            'status')
+                MAIN=org.apache.karaf.main.Status
+                shift
+                ;;
+            'stop')
+                MAIN=org.apache.karaf.main.Stop
+                shift
+                ;;
+            'console')
+                shift
+                ;;
+            'server')
+                OPTS="-Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true"
+                shift
+                ;;
+            'client')
+                OPTS="-Dkaraf.startLocalConsole=true -Dkaraf.startRemoteShell=false"
+                shift
+                ;;
+            *)
+                break
+                ;;
+        esac
+    done
+
+    JAVA_ENDORSED_DIRS="${JAVA_HOME}/jre/lib/endorsed:${JAVA_HOME}/lib/endorsed:${KARAF_HOME}/lib/endorsed"
+    JAVA_EXT_DIRS="${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/ext:${KARAF_HOME}/lib/ext"
+    if $cygwin; then
+        KARAF_HOME=`cygpath --path --windows "$KARAF_HOME"`
+        KARAF_BASE=`cygpath --path --windows "$KARAF_BASE"`
+        KARAF_DATA=`cygpath --path --windows "$KARAF_DATA"`
+        KARAF_ETC=`cygpath --path --windows "$KARAF_ETC"`
+        CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+        JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+        JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`
+        JAVA_EXT_DIRS=`cygpath --path --windows "$JAVA_EXT_DIRS"`
+    fi
+    cd "$KARAF_BASE"
+
+    exec "$JAVA" $JAVA_OPTS -Djava.endorsed.dirs="${JAVA_ENDORSED_DIRS}" -Djava.ext.dirs="${JAVA_EXT_DIRS}" -Dkaraf.instances="${KARAF_HOME}/instances" -Dkaraf.home="$KARAF_HOME" -Dkaraf.base="$KARAF_BASE" -Dkaraf.data="$KARAF_DATA" -Dkaraf.etc="$KARAF_ETC" -Djava.io.tmpdir="$KARAF_DATA/tmp" -Djava.util.logging.config.file="$KARAF_BASE/etc/java.util.logging.properties" $KARAF_OPTS $OPTS -classpath "$CLASSPATH" $MAIN "$@"
+}
+
+main() {
+    init
+    run "$@"
+}
+
+main "$@"
diff --git a/opendaylight/distribution/opendaylight-karaf/src/main/resources/karaf/karaf.bat b/opendaylight/distribution/opendaylight-karaf/src/main/resources/karaf/karaf.bat
new file mode 100644 (file)
index 0000000..a450877
--- /dev/null
@@ -0,0 +1,336 @@
+@echo off\r
+rem\r
+rem\r
+rem    Licensed to the Apache Software Foundation (ASF) under one or more\r
+rem    contributor license agreements.  See the NOTICE file distributed with\r
+rem    this work for additional information regarding copyright ownership.\r
+rem    The ASF licenses this file to You under the Apache License, Version 2.0\r
+rem    (the "License"); you may not use this file except in compliance with\r
+rem    the License.  You may obtain a copy of the License at\r
+rem\r
+rem       http://www.apache.org/licenses/LICENSE-2.0\r
+rem\r
+rem    Unless required by applicable law or agreed to in writing, software\r
+rem    distributed under the License is distributed on an "AS IS" BASIS,\r
+rem    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+rem    See the License for the specific language governing permissions and\r
+rem    limitations under the License.\r
+rem\r
+\r
+if not "%ECHO%" == "" echo %ECHO%\r
+\r
+setlocal\r
+set DIRNAME=%~dp0%\r
+set PROGNAME=%~nx0%\r
+set ARGS=%*\r
+\r
+rem Sourcing environment settings for karaf similar to tomcats setenv\r
+SET KARAF_SCRIPT="karaf.bat"\r
+if exist "%DIRNAME%setenv.bat" (\r
+  call "%DIRNAME%setenv.bat"\r
+)\r
+\r
+rem Check console window title. Set to Karaf by default\r
+if not "%KARAF_TITLE%" == "" (\r
+    title %KARAF_TITLE%\r
+) else (\r
+    title Karaf\r
+)\r
+\r
+rem Check/Set up some easily accessible MIN/MAX params for JVM mem usage\r
+if "%JAVA_MIN_MEM%" == "" (\r
+    set JAVA_MIN_MEM=128M\r
+)\r
+if "%JAVA_MAX_MEM%" == "" (\r
+    set JAVA_MAX_MEM=512M\r
+)\r
+\r
+goto BEGIN\r
+\r
+:warn\r
+    echo %PROGNAME%: %*\r
+goto :EOF\r
+\r
+:BEGIN\r
+\r
+rem # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\r
+\r
+if not "%KARAF_HOME%" == "" (\r
+    call :warn Ignoring predefined value for KARAF_HOME\r
+)\r
+set KARAF_HOME=%DIRNAME%..\r
+if not exist "%KARAF_HOME%" (\r
+    call :warn KARAF_HOME is not valid: "%KARAF_HOME%"\r
+    goto END\r
+)\r
+\r
+if not "%KARAF_BASE%" == "" (\r
+    if not exist "%KARAF_BASE%" (\r
+       call :warn KARAF_BASE is not valid: "%KARAF_BASE%"\r
+       goto END\r
+    )\r
+)\r
+if "%KARAF_BASE%" == "" (\r
+  set "KARAF_BASE=%KARAF_HOME%"\r
+)\r
+\r
+if not "%KARAF_DATA%" == "" (\r
+    if not exist "%KARAF_DATA%" (\r
+        call :warn KARAF_DATA is not valid: "%KARAF_DATA%"\r
+        goto END\r
+    )\r
+)\r
+if "%KARAF_DATA%" == "" (\r
+    set "KARAF_DATA=%KARAF_BASE%\data"\r
+)\r
+\r
+if not "%KARAF_ETC%" == "" (\r
+    if not exist "%KARAF_ETC%" (\r
+        call :warn KARAF_ETC is not valid: "%KARAF_ETC%"\r
+        goto END\r
+    )\r
+)\r
+if "%KARAF_ETC%" == "" (\r
+    set "KARAF_ETC=%KARAF_BASE%\etc"\r
+)\r
+\r
+set LOCAL_CLASSPATH=%CLASSPATH%\r
+set JAVA_MODE=-server\r
+if not exist "%JAVA_HOME%\bin\server\jvm.dll" (\r
+    if not exist "%JAVA_HOME%\jre\bin\server\jvm.dll" (\r
+        echo WARNING: Running karaf on a Java HotSpot Client VM because server-mode is not available.\r
+        echo Install Java Developer Kit to fix this.\r
+        echo For more details see http://java.sun.com/products/hotspot/whitepaper.html#client\r
+        set JAVA_MODE=-client\r
+    )\r
+)\r
+set DEFAULT_JAVA_OPTS=%JAVA_MODE% -Xms%JAVA_MIN_MEM% -Xmx%JAVA_MAX_MEM% -Dderby.system.home="%KARAF_DATA%\derby" -Dderby.storage.fileSyncTransactionLog=true -Dcom.sun.management.jmxremote  -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass\r
+\r
+rem Check some easily accessible MIN/MAX params for JVM mem usage\r
+if not "%JAVA_PERM_MEM%" == "" (\r
+    set DEFAULT_JAVA_OPTS=%DEFAULT_JAVA_OPTS% -XX:PermSize=%JAVA_PERM_MEM%\r
+)\r
+if not "%JAVA_MAX_PERM_MEM%" == "" (\r
+    set DEFAULT_JAVA_OPTS=%DEFAULT_JAVA_OPTS% -XX:MaxPermSize=%JAVA_MAX_PERM_MEM%\r
+)\r
+\r
+set CLASSPATH=%LOCAL_CLASSPATH%;%KARAF_BASE%\conf\r
+set DEFAULT_JAVA_DEBUG_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005\r
+\r
+if "%LOCAL_CLASSPATH%" == "" goto :KARAF_CLASSPATH_EMPTY\r
+    set CLASSPATH=%LOCAL_CLASSPATH%;%KARAF_BASE%\conf\r
+    goto :KARAF_CLASSPATH_END\r
+:KARAF_CLASSPATH_EMPTY\r
+    set CLASSPATH=%KARAF_BASE%\conf\r
+:KARAF_CLASSPATH_END\r
+\r
+rem Setup Karaf Home\r
+if exist "%KARAF_HOME%\conf\karaf-rc.cmd" call %KARAF_HOME%\conf\karaf-rc.cmd\r
+if exist "%HOME%\karaf-rc.cmd" call %HOME%\karaf-rc.cmd\r
+\r
+rem Support for loading native libraries\r
+set PATH=%PATH%;%KARAF_BASE%\lib;%KARAF_HOME%\lib\r
+\r
+rem Setup the Java Virtual Machine\r
+if not "%JAVA%" == "" goto :Check_JAVA_END\r
+    if not "%JAVA_HOME%" == "" goto :TryJDKEnd\r
+        call :warn JAVA_HOME not set; results may vary\r
+:TryJRE\r
+    start /w regedit /e __reg1.txt "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment"\r
+    if not exist __reg1.txt goto :TryJDK\r
+    type __reg1.txt | find "CurrentVersion" > __reg2.txt\r
+    if errorlevel 1 goto :TryJDK\r
+    for /f "tokens=2 delims==" %%x in (__reg2.txt) do set JavaTemp=%%~x\r
+    if errorlevel 1 goto :TryJDK\r
+    set JavaTemp=%JavaTemp%##\r
+    set JavaTemp=%JavaTemp:                ##=##%\r
+    set JavaTemp=%JavaTemp:        ##=##%\r
+    set JavaTemp=%JavaTemp:    ##=##%\r
+    set JavaTemp=%JavaTemp:  ##=##%\r
+    set JavaTemp=%JavaTemp: ##=##%\r
+    set JavaTemp=%JavaTemp:##=%\r
+    del __reg1.txt\r
+    del __reg2.txt\r
+    start /w regedit /e __reg1.txt "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\%JavaTemp%"\r
+    if not exist __reg1.txt goto :TryJDK\r
+    type __reg1.txt | find "JavaHome" > __reg2.txt\r
+    if errorlevel 1 goto :TryJDK\r
+    for /f "tokens=2 delims==" %%x in (__reg2.txt) do set JAVA_HOME=%%~x\r
+    if errorlevel 1 goto :TryJDK\r
+    del __reg1.txt\r
+    del __reg2.txt\r
+    goto TryJDKEnd\r
+:TryJDK\r
+    start /w regedit /e __reg1.txt "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit"\r
+    if not exist __reg1.txt (\r
+        goto TryRegJRE\r
+    )\r
+    type __reg1.txt | find "CurrentVersion" > __reg2.txt\r
+    if errorlevel 1 (\r
+        goto TryRegJRE\r
+    )\r
+    for /f "tokens=2 delims==" %%x in (__reg2.txt) do set JavaTemp=%%~x\r
+    if errorlevel 1 (\r
+        goto TryRegJRE\r
+    )\r
+    set JavaTemp=%JavaTemp%##\r
+    set JavaTemp=%JavaTemp:                ##=##%\r
+    set JavaTemp=%JavaTemp:        ##=##%\r
+    set JavaTemp=%JavaTemp:    ##=##%\r
+    set JavaTemp=%JavaTemp:  ##=##%\r
+    set JavaTemp=%JavaTemp: ##=##%\r
+    set JavaTemp=%JavaTemp:##=%\r
+    del __reg1.txt\r
+    del __reg2.txt\r
+    start /w regedit /e __reg1.txt "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\%JavaTemp%"\r
+    if not exist __reg1.txt (\r
+        goto TryRegJRE\r
+    )\r
+    type __reg1.txt | find "JavaHome" > __reg2.txt\r
+    if errorlevel 1 (\r
+        goto TryRegJRE\r
+    )\r
+    for /f "tokens=2 delims==" %%x in (__reg2.txt) do set JAVA_HOME=%%~x\r
+    if errorlevel 1 (\r
+        goto TryRegJRE\r
+    )\r
+    del __reg1.txt\r
+    del __reg2.txt\r
+:TryRegJRE\r
+    rem try getting the JAVA_HOME from registry\r
+    FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKLM\Software\JavaSoft\Java Runtime Environment" /v CurrentVersion`) DO (\r
+       set JAVA_VERSION=%%A\r
+    )\r
+    FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKLM\Software\JavaSoft\Java Runtime Environment\%JAVA_VERSION%" /v JavaHome`) DO (\r
+       set JAVA_HOME=%%A %%B\r
+    )\r
+    if not exist "%JAVA_HOME%" (\r
+       goto TryRegJDK\r
+    )\r
+       goto TryJDKEnd\r
+:TryRegJDK\r
+    rem try getting the JAVA_HOME from registry\r
+    FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKLM\Software\JavaSoft\Java Development Kit" /v CurrentVersion`) DO (\r
+       set JAVA_VERSION=%%A\r
+    )\r
+    FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKLM\Software\JavaSoft\Java Development Kit\%JAVA_VERSION%" /v JavaHome`) DO (\r
+       set JAVA_HOME=%%A %%B\r
+    )\r
+    if not exist "%JAVA_HOME%" (\r
+       call :warn Unable to retrieve JAVA_HOME from Registry\r
+    )\r
+        goto TryJDKEnd\r
+:TryJDKEnd\r
+    if not exist "%JAVA_HOME%" (\r
+        call :warn JAVA_HOME is not valid: "%JAVA_HOME%"\r
+        goto END\r
+    )\r
+    set JAVA=%JAVA_HOME%\bin\java\r
+:Check_JAVA_END\r
+\r
+if "%JAVA_OPTS%" == "" set JAVA_OPTS=%DEFAULT_JAVA_OPTS%\r
+\r
+if "%KARAF_DEBUG%" == "" goto :KARAF_DEBUG_END\r
+    if "%1" == "stop" goto :KARAF_DEBUG_END\r
+    if "%1" == "client" goto :KARAF_DEBUG_END\r
+    rem Use the defaults if JAVA_DEBUG_OPTS was not set\r
+    if "%JAVA_DEBUG_OPTS%" == "" set JAVA_DEBUG_OPTS=%DEFAULT_JAVA_DEBUG_OPTS%\r
+\r
+    set "JAVA_OPTS=%JAVA_DEBUG_OPTS% %JAVA_OPTS%"\r
+    call :warn Enabling Java debug options: %JAVA_DEBUG_OPTS%\r
+:KARAF_DEBUG_END\r
+\r
+if "%KARAF_PROFILER%" == "" goto :KARAF_PROFILER_END\r
+    set KARAF_PROFILER_SCRIPT=%KARAF_HOME%\conf\profiler\%KARAF_PROFILER%.cmd\r
+\r
+    if exist "%KARAF_PROFILER_SCRIPT%" goto :KARAF_PROFILER_END\r
+    call :warn Missing configuration for profiler '%KARAF_PROFILER%': %KARAF_PROFILER_SCRIPT%\r
+    goto END\r
+:KARAF_PROFILER_END\r
+\r
+rem Setup the classpath\r
+pushd "%KARAF_HOME%\lib"\r
+for %%G in (karaf*.jar) do call:APPEND_TO_CLASSPATH %%G\r
+popd\r
+goto CLASSPATH_END\r
+\r
+: APPEND_TO_CLASSPATH\r
+set filename=%~1\r
+set suffix=%filename:~-4%\r
+if %suffix% equ .jar set CLASSPATH=%CLASSPATH%;%KARAF_HOME%\lib\%filename%\r
+goto :EOF\r
+\r
+:CLASSPATH_END\r
+\r
+rem Execute the JVM or the load the profiler\r
+if "%KARAF_PROFILER%" == "" goto :RUN\r
+    rem Execute the profiler if it has been configured\r
+    call :warn Loading profiler script: %KARAF_PROFILER_SCRIPT%\r
+    call %KARAF_PROFILER_SCRIPT%\r
+\r
+:RUN\r
+    SET OPTS=-Dkaraf.startLocalConsole=true -Dkaraf.startRemoteShell=true\r
+    SET MAIN=org.apache.karaf.main.Main\r
+    SET SHIFT=false\r
+\r
+:RUN_LOOP\r
+    if "%1" == "stop" goto :EXECUTE_STOP\r
+    if "%1" == "status" goto :EXECUTE_STATUS\r
+    if "%1" == "console" goto :EXECUTE_CONSOLE\r
+    if "%1" == "server" goto :EXECUTE_SERVER\r
+    if "%1" == "client" goto :EXECUTE_CLIENT\r
+    if "%1" == "clean" goto :EXECUTE_CLEAN\r
+    if "%1" == "debug" goto :EXECUTE_DEBUG\r
+    goto :EXECUTE\r
+\r
+:EXECUTE_STOP\r
+    SET MAIN=org.apache.karaf.main.Stop\r
+    shift\r
+    goto :RUN_LOOP\r
+\r
+:EXECUTE_STATUS\r
+    SET MAIN=org.apache.karaf.main.Status\r
+    shift\r
+    goto :RUN_LOOP\r
+\r
+:EXECUTE_CONSOLE\r
+    shift\r
+    goto :RUN_LOOP\r
+\r
+:EXECUTE_SERVER\r
+    SET OPTS=-Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true\r
+    shift\r
+    goto :RUN_LOOP\r
+\r
+:EXECUTE_CLIENT\r
+    SET OPTS=-Dkaraf.startLocalConsole=true -Dkaraf.startRemoteShell=false\r
+    shift\r
+    goto :RUN_LOOP\r
+\r
+:EXECUTE_CLEAN\r
+    rmdir /S /Q "%KARAF_DATA%"\r
+    shift\r
+    goto :RUN_LOOP\r
+\r
+:EXECUTE_DEBUG\r
+    if "%JAVA_DEBUG_OPTS%" == "" set JAVA_DEBUG_OPTS=%DEFAULT_JAVA_DEBUG_OPTS%\r
+    set "JAVA_OPTS=%JAVA_DEBUG_OPTS% %JAVA_OPTS%"\r
+    shift\r
+    goto :RUN_LOOP\r
+\r
+:EXECUTE\r
+    SET ARGS=%1 %2 %3 %4 %5 %6 %7 %8\r
+    rem Execute the Java Virtual Machine\r
+    cd "%KARAF_BASE%"\r
+    "%JAVA%" %JAVA_OPTS% %OPTS% -classpath "%CLASSPATH%" -Djava.endorsed.dirs="%JAVA_HOME%\jre\lib\endorsed;%JAVA_HOME%\lib\endorsed;%KARAF_HOME%\lib\endorsed" -Djava.ext.dirs="%JAVA_HOME%\jre\lib\ext;%JAVA_HOME%\lib\ext;%KARAF_HOME%\lib\ext" -Dkaraf.instances="%KARAF_HOME%\instances" -Dkaraf.home="%KARAF_HOME%" -Dkaraf.base="%KARAF_BASE%" -Dkaraf.etc="%KARAF_ETC%" -Djava.io.tmpdir="%KARAF_DATA%\tmp" -Dkaraf.data="%KARAF_DATA%" -Djava.util.logging.config.file="%KARAF_BASE%\etc\java.util.logging.properties" %KARAF_OPTS% %MAIN% %ARGS%\r
+\r
+rem # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\r
+\r
+:END\r
+\r
+endlocal\r
+\r
+if not "%PAUSE%" == "" pause\r
+\r
+:END_NO_PAUSE\r
+\r
index d238ee75cc1f0bd8df7bb52931c4499917f56db9..541c1300f35da009dc0ca2aa4434fe3e51b3dee9 100644 (file)
 
   <build>
     <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <version>2.8</version>
+        <executions>
+          <execution>
+            <id>unpack-provided-configs</id>
+            <goals>
+              <goal>unpack-dependencies</goal>
+            </goals>
+            <phase>generate-resources</phase>
+            <configuration>
+               <outputDirectory>${project.build.directory}/configuration</outputDirectory>
+               <includeArtifactIds>sal-rest-connector-config</includeArtifactIds>
+               <includes>**\/*.xml</includes>
+               <excludeTransitive>true</excludeTransitive>
+               <ignorePermissions>false</ignorePermissions>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
       <plugin>
         <artifactId>maven-assembly-plugin</artifactId>
         <version>2.3</version>
           <groupId>org.opendaylight.controller</groupId>
           <artifactId>sal-rest-connector</artifactId>
         </dependency>
+        <dependency>
+          <groupId>org.opendaylight.controller</groupId>
+          <artifactId>sal-rest-connector-config</artifactId>
+        </dependency>
         <dependency>
           <groupId>org.opendaylight.controller</groupId>
           <artifactId>sal-rest-docgen</artifactId>
                 </goals>
                 <phase>package</phase>
               </execution>
+              <execution>
+                <id>unpack-provided-configs</id>
+                <goals>
+                  <goal>unpack-dependencies</goal>
+                </goals>
+                <phase>generate-resources</phase>
+                <configuration>
+                   <outputDirectory>${project.build.directory}/configuration</outputDirectory>
+                   <includeArtifactIds>sal-rest-connector-config</includeArtifactIds>
+                   <includes>**\/*.xml</includes>
+                   <excludeTransitive>true</excludeTransitive>
+                   <ignorePermissions>false</ignorePermissions>
+                </configuration>
+              </execution>
             </executions>
           </plugin>
           <plugin>
index 0ff4c9a83c37a4182c9d26061b80d3d8b0e9a636..e5fc98a8639b88ceacb0c134631c32010c904ded 100644 (file)
         opendaylight/
       </outputDirectory>
     </fileSet>
+    <fileSet>
+      <directory>${project.build.directory}/configuration/initial</directory>
+      <outputDirectory>/opendaylight/configuration/initial</outputDirectory>
+      <excludes>
+        <exclude>**/META-INF/**</exclude>
+      </excludes>
+    </fileSet>
   </fileSets>
   <files>
     <file>
index 38df344f858641d60d4913e0dc251efc6427d64d..f25b7d91bdb38b2f357ec5faa91283d2929e3128 100644 (file)
                 <module>
                     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider">prefix:inmemory-operational-datastore-provider</type>
                     <name>operational-store-service</name>
-                    <schema-service>
+                    <operational-schema-service>
                         <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
                         <name>yang-schema-service</name>
-                    </schema-service>
+                    </operational-schema-service>
                 </module>
                 <!--
                      Tree-based in-memory data store. This is the data store which is currently
                         </binding-mapping-service>
                     </binding-forwarded-data-broker>
                 </module>
+                <!-- Cluster RPC -->
+                <!-- Enable the following module if you want to use remote rpc connector
+                <module>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:remote-rpc-connector">prefix:remote-rpc-connector</type>
+                    <name>remote-rpc-connector</name>
+                    <dom-broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:remote-rpc-connector">
+                        <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-broker-osgi-registry</type>
+                        <name>dom-broker</name>
+                    </dom-broker>
+                </module>
+                -->
             </modules>
             <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                     <service>
index c89cfc1b9e8914148bc58fc6f3a375baca026e53..e2b6642501edf8acefb9f47743c5166455c8e8db 100644 (file)
@@ -867,6 +867,7 @@ public class FlowConfig extends ConfigurationObject implements Serializable {
                     }
                     continue;
                 }
+
                 sstr = Pattern.compile(ActionType.SET_NEXT_HOP.toString() + "=(.*)").matcher(actiongrp);
                 if (sstr.matches()) {
                     if (!NetUtils.isIPAddressValid(sstr.group(1))) {
@@ -875,7 +876,57 @@ public class FlowConfig extends ConfigurationObject implements Serializable {
                     }
                     continue;
                 }
-            }
+
+                sstr = Pattern.compile(ActionType.OUTPUT + "=(.*)").matcher(actiongrp);
+                if (sstr.matches()) {
+                    continue;
+                }
+
+                sstr = Pattern.compile(ActionType.DROP.toString()).matcher(actiongrp);
+                if (sstr.matches()) {
+                    continue;
+                }
+
+                sstr = Pattern.compile(ActionType.LOOPBACK.toString()).matcher(actiongrp);
+                if (sstr.matches()) {
+                    continue;
+                }
+
+                sstr = Pattern.compile(ActionType.FLOOD.toString()).matcher(actiongrp);
+                if (sstr.matches()) {
+                    continue;
+                }
+
+                sstr = Pattern.compile(ActionType.FLOOD_ALL.toString()).matcher(actiongrp);
+                if (sstr.matches()) {
+                    continue;
+                }
+
+                sstr = Pattern.compile(ActionType.SW_PATH.toString()).matcher(actiongrp);
+                if (sstr.matches()) {
+                    continue;
+                }
+
+                sstr = Pattern.compile(ActionType.HW_PATH.toString()).matcher(actiongrp);
+                if (sstr.matches()) {
+                    continue;
+                }
+
+                sstr = Pattern.compile(ActionType.CONTROLLER.toString()).matcher(actiongrp);
+                if (sstr.matches()) {
+                    continue;
+                }
+
+                sstr = Pattern.compile(ActionType.POP_VLAN.toString()).matcher(actiongrp);
+                if (sstr.matches()) {
+                    continue;
+                }
+
+                // If execution reached here, it means there is an Action
+                // which is not recognized by the controller. Return error
+
+                return new Status(StatusCode.BADREQUEST, String.format("%s is an UnSupported Action", actiongrp));
+           }
         } catch (NumberFormatException e) {
             return new Status(StatusCode.BADREQUEST, String.format("Invalid number format %s", e.getMessage()));
         }
index 685ccdb7c44ea78931de795bb21547c1bd116b36..3c367b9af45d267816bca893c257b35d8c42c8f8 100644 (file)
@@ -760,9 +760,9 @@ public class frmTest {
         actions.add(ActionType.SET_NW_SRC.toString() + "=1.1.1.1");
         actions.add(ActionType.SET_NW_DST.toString() + "=2.2.2.2");
         actions.add(ActionType.CONTROLLER.toString());
-        actions.add(ActionType.SET_NW_TOS.toString() + "1");
-        actions.add(ActionType.SET_TP_SRC.toString() + "60");
-        actions.add(ActionType.SET_TP_DST.toString() + "8080");
+        actions.add(ActionType.SET_NW_TOS.toString() + "=1");
+        actions.add(ActionType.SET_TP_SRC.toString() + "=60");
+        actions.add(ActionType.SET_TP_DST.toString() + "=8080");
         actions.add(ActionType.SET_NEXT_HOP.toString() + "=1.1.1.1");
 
         return actions;
index ff68176f1fed36f3b8c606421cee8790a73ec582..0653eeb2a63810d5b89e291facbb4c4f7e822e2f 100644 (file)
@@ -38,7 +38,7 @@ public class FRMRuntimeDataProvider implements RuntimeDataProvider, DataCommitHa
     private DataProviderService dataService;
     private IForwardingRulesManager manager;
 
-    public Registration<DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject>> init() {
+    public Registration init() {
         return this.dataService.registerCommitHandler(FRMRuntimeDataProvider.FLOWS_PATH, this);
     }
 
index b6e611bf1155087e4faf965e148443e34692308b..e9f56f6a0301798b963fe9fb567c34076a640a44 100644 (file)
@@ -242,30 +242,29 @@ public class TestFromSalConversionsUtils {
 
     private void checkOdActions(
             List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actions) {
-        checkOdAction(actions, FloodActionCase.class, false);
-        checkOdAction(actions, FloodAllActionCase.class, false);
-        checkOdAction(actions, HwPathActionCase.class, false);
-        checkOdAction(actions, LoopbackActionCase.class, false);
-        checkOdAction(actions, PopVlanActionCase.class, false);
-        checkOdAction(actions, PushVlanActionCase.class, true);
-        checkOdAction(actions, SetDlDstActionCase.class, true);
-        checkOdAction(actions, SetDlSrcActionCase.class, true);
-        checkOdAction(actions, SetDlTypeActionCase.class, true);
-        checkOdAction(actions, SetNwTosActionCase.class, true);
-        checkOdAction(actions, SetNwDstActionCase.class, true);
-        checkOdAction(actions, SetNwSrcActionCase.class, true);
-        checkOdAction(actions, SetNextHopActionCase.class, true);
-        checkOdAction(actions, SetTpDstActionCase.class, true);
-        checkOdAction(actions, SetTpSrcActionCase.class, true);
-        checkOdAction(actions, SetVlanCfiActionCase.class, true);
-        checkOdAction(actions, SetVlanIdActionCase.class, true);
-        checkOdAction(actions, SetVlanPcpActionCase.class, true);
-        checkOdAction(actions, SwPathActionCase.class, false);
+        checkOdAction(actions, FloodActionCase.class);
+        checkOdAction(actions, FloodAllActionCase.class);
+        checkOdAction(actions, HwPathActionCase.class);
+        checkOdAction(actions, LoopbackActionCase.class);
+        checkOdAction(actions, PopVlanActionCase.class);
+        checkOdAction(actions, PushVlanActionCase.class);
+        checkOdAction(actions, SetDlDstActionCase.class);
+        checkOdAction(actions, SetDlSrcActionCase.class);
+        checkOdAction(actions, SetDlTypeActionCase.class);
+        checkOdAction(actions, SetNwTosActionCase.class);
+        checkOdAction(actions, SetNwDstActionCase.class);
+        checkOdAction(actions, SetNwSrcActionCase.class);
+        checkOdAction(actions, SetNextHopActionCase.class);
+        checkOdAction(actions, SetTpDstActionCase.class);
+        checkOdAction(actions, SetTpSrcActionCase.class);
+        checkOdAction(actions, SetVlanCfiActionCase.class);
+        checkOdAction(actions, SetVlanIdActionCase.class);
+        checkOdAction(actions, SetVlanPcpActionCase.class);
+        checkOdAction(actions, SwPathActionCase.class);
     }
 
     private void checkOdAction(
-            List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actions, Class<?> cl,
-            boolean b) {
+            List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actions, Class<?> cl) {
         int numOfFoundActions = 0;
         for (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action action : actions) {
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action innerAction = action
index b3096e6478857aa1ca0286efda6c7a78912b4813..ed5e19219353e3265a5b7f55ef58dccd5f6b7ad7 100644 (file)
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>flow-management-compatibility</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal-binding-api</artifactId>
index 6ed61e3024b9522dbc89d99a979f93fbcb147c7f..9724d31f9ae6cd3ab8eaef0c23212bf626cfca84 100644 (file)
@@ -15,7 +15,7 @@ import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
-import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -30,7 +30,7 @@ class FlowCapableInventoryProvider implements AutoCloseable, Runnable {
     private final BlockingQueue<InventoryOperation> queue = new LinkedBlockingDeque<>(QUEUE_DEPTH);
     private final NotificationProviderService notificationService;
     private final DataProviderService dataService;
-    private Registration<?> listenerRegistration;
+    private ListenerRegistration<?> listenerRegistration;
     private Thread thread;
 
     FlowCapableInventoryProvider(final DataProviderService dataService, final NotificationProviderService notificationService) {
index e0df924a0ea5434f81a804efec6447169c22448b..f7a0652e45f042bf891c58a1a7fcdb017e811a2c 100644 (file)
@@ -25,7 +25,6 @@ module opendaylight-flow-statistics {
     grouping flow-statistics {
         container flow-statistics {
             //config "false";
-            uses flow-types:flow;
             uses stat-types:generic-statistics;
         }
     }
index 1cfd5a66399eb4991fedb3cb59098aa62e1d8249..37da4d2b880b73689d0fae3df5c9d21e08156aec 100644 (file)
@@ -43,6 +43,7 @@
     <!-- Connectors -->
     <module>sal-connector-api</module>
     <module>sal-rest-connector</module>
+    <module>sal-rest-connector-config</module>
     <module>sal-netconf-connector</module>
 
     <module>inventory-manager</module>
     <!-- Documentation -->
     <module>sal-rest-docgen</module>
 
+    <module>sal-akka-raft</module>
+
     <!--InMemory DOM DataStore-->
     <module>sal-inmemory-datastore</module>
 
     <!--sal-protocolbuffer-encoding-->
     <module>sal-protocolbuffer-encoding</module>
 
+    <!-- sal-distributed-datastore -->
+    <module>sal-distributed-datastore</module>
+
+    <!-- XSQL -->
+    <module>sal-dom-xsql</module>
+
     <!-- Yang Test Models for MD-SAL -->
     <module>sal-test-model</module>
+
+    <!-- Clustering -->
+    <module>sal-remoterpc-connector</module>
   </modules>
 
   <build>
diff --git a/opendaylight/md-sal/sal-akka-raft/README-FIRST b/opendaylight/md-sal/sal-akka-raft/README-FIRST
new file mode 100644 (file)
index 0000000..d0be2cb
--- /dev/null
@@ -0,0 +1,28 @@
+Instructions on generating the protocol buffer Java source files
+
+These instructions are developers who are planning to generate the protocolbuffer java source files.
+
+1. We are using protocol buffer version 2.5.0 - you need to install the exact same version on your box.
+The download link is https://code.google.com/p/protobuf/downloads/list. Download .tar/zip based on
+your OS.
+
+2. Once downloaded the tar/zip and extracted follow the README instructions to compile protoc on your
+machine
+
+3. Create your .proto (IDL) file in resources folder. Give appropriate package name so that the source
+   get generation in proper packages. For more information  check
+   https://developers.google.com/protocol-buffers/docs/javatutorial
+
+   For detailed information https://developers.google.com/protocol-buffers/docs/reference/java-generated
+
+4. To generate the java source files execute in sal-protocolbuffer-encoding directory
+   just run.sh in sal-protocolbuffer-encoding or execute the following command
+
+ protoc --proto_path=src/main/resources --java_out=src/main/java src/main/resources/*.proto
+
+5. Run mvn clean install  & build the .jar
+
+6. !!!WARNING!!! - never edit the generated sources files of protocol buffer
+
+7. !!!NOTE!!! if you are planning to add new .proto file  option java_package should begin with
+   org.opendaylight.controller.protobuff.messages to properly exclude from sonar.
diff --git a/opendaylight/md-sal/sal-akka-raft/pom.xml b/opendaylight/md-sal/sal-akka-raft/pom.xml
new file mode 100644 (file)
index 0000000..3dcc546
--- /dev/null
@@ -0,0 +1,150 @@
+<?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>sal-parent</artifactId>
+    <version>1.1-SNAPSHOT</version>
+  </parent>
+  <artifactId>sal-akka-raft</artifactId>
+  <packaging>bundle</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>com.google.protobuf</groupId>
+      <artifactId>protobuf-java</artifactId>
+      <version>2.5.0</version>
+    </dependency>
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>com.typesafe.akka</groupId>
+      <artifactId>akka-actor_${scala.version}</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>com.typesafe.akka</groupId>
+      <artifactId>akka-cluster_${scala.version}</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>com.typesafe.akka</groupId>
+      <artifactId>akka-persistence-experimental_${scala.version}</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>com.typesafe.akka</groupId>
+      <artifactId>akka-remote_${scala.version}</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>com.typesafe.akka</groupId>
+      <artifactId>akka-testkit_${scala.version}</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.scala-lang</groupId>
+      <artifactId>scala-library</artifactId>
+    </dependency>
+
+    <!-- Test Dependencies -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-all</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>${slf4j.version}</version>
+      <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>${project.groupId}.${project.artifactId}</Bundle-Name>
+            <Export-package></Export-package>
+            <Private-Package></Private-Package>
+            <Import-Package></Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.jacoco</groupId>
+        <artifactId>jacoco-maven-plugin</artifactId>
+        <configuration>
+          <includes>
+            <include>org.opendaylight.controller.*</include>
+          </includes>
+          <check>false</check>
+        </configuration>
+        <executions>
+          <execution>
+            <id>pre-test</id>
+            <goals>
+              <goal>prepare-agent</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>post-test</id>
+            <goals>
+              <goal>report</goal>
+            </goals>
+            <phase>test</phase>
+          </execution>
+        </executions>
+      </plugin>
+
+     <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+            <excludes>**/protobuff/**/*</excludes>
+        </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:Architecture:Clustering</url>
+  </scm>
+</project>
diff --git a/opendaylight/md-sal/sal-akka-raft/run.sh b/opendaylight/md-sal/sal-akka-raft/run.sh
new file mode 100755 (executable)
index 0000000..7c588f0
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+#####################################################################################################
+#Instructions on generating the protocol buffer Java source files
+#
+#These instructions are developers who are planning to generate the protocolbuffer java source files.
+#
+#1. We are using protocol buffer version 2.5.0 - you need to install the exact same version on your box.
+#The download link is https://code.google.com/p/protobuf/downloads/list. Download .tar/zip based on
+#your OS.
+#
+#2. Once downloaded the tar/zip and extracted follow the README instructions to compile protoc on your
+#machine
+#
+#3. Create your .proto (IDL) file in resources folder. Give appropriate package name so that the source
+#   get generation in proper packages. For more information  check
+#   https://developers.google.com/protocol-buffers/docs/javatutorial
+#
+#   For detailed information https://developers.google.com/protocol-buffers/docs/reference/java-generated
+#
+#4. To generate the java source files execute in sal-protocolbuffer-encoding execute ./run.sh i.e. this script
+# or run command
+#       protoc --proto_path=src/main/resources --java_out=src/main/java src/main/resources/*.proto
+#
+#5. Run mvn clean install & build the .jar
+#
+#6  !!!WARNING!!!! never edit the source files generated
+#
+#7. !!!NOTE!!! if you are planning to add new .proto file  option java_package should begin with
+#   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=src/test/resources --java_out=src/test/java src/test/resources/*.proto
+
+echo "Done generating Java source files."
+
+#to remove trailing spaces in the code files
+find src/main/java -type f -name '*.java' -exec sed --in-place 's/[[:space:]]\+$//' {} \+
+
+find src/test/java -type f -name '*.java' -exec sed --in-place 's/[[:space:]]\+$//' {} \+
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/ClientActor.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/ClientActor.java
new file mode 100644 (file)
index 0000000..2560f16
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * 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.example;
+
+import akka.actor.ActorRef;
+import akka.actor.Props;
+import akka.actor.UntypedActor;
+import akka.event.Logging;
+import akka.event.LoggingAdapter;
+import akka.japi.Creator;
+import org.opendaylight.controller.cluster.example.messages.KeyValue;
+import org.opendaylight.controller.cluster.example.messages.KeyValueSaved;
+
+public class ClientActor extends UntypedActor {
+    protected final LoggingAdapter LOG =
+        Logging.getLogger(getContext().system(), this);
+
+    private final ActorRef target;
+
+    public ClientActor(ActorRef target){
+        this.target = target;
+    }
+
+    public static Props props(final ActorRef target){
+        return Props.create(new Creator<ClientActor>(){
+
+            @Override public ClientActor create() throws Exception {
+                return new ClientActor(target);
+            }
+        });
+    }
+
+    @Override public void onReceive(Object message) throws Exception {
+        if(message instanceof KeyValue) {
+            target.tell(message, getSelf());
+        } else if(message instanceof KeyValueSaved){
+            LOG.info("KeyValue saved");
+        }
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/ExampleActor.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/ExampleActor.java
new file mode 100644 (file)
index 0000000..641ec05
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * 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.example;
+
+import akka.actor.ActorRef;
+import akka.actor.Props;
+import akka.japi.Creator;
+import org.opendaylight.controller.cluster.example.messages.KeyValue;
+import org.opendaylight.controller.cluster.example.messages.KeyValueSaved;
+import org.opendaylight.controller.cluster.example.messages.PrintRole;
+import org.opendaylight.controller.cluster.example.messages.PrintState;
+import org.opendaylight.controller.cluster.raft.RaftActor;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A sample actor showing how the RaftActor is to be extended
+ */
+public class ExampleActor extends RaftActor {
+
+    private final Map<String, String> state = new HashMap();
+
+    private long persistIdentifier = 1;
+
+
+    public ExampleActor(String id, Map<String, String> peerAddresses) {
+        super(id, peerAddresses);
+    }
+
+    public static Props props(final String id, final Map<String, String> peerAddresses){
+        return Props.create(new Creator<ExampleActor>(){
+
+            @Override public ExampleActor create() throws Exception {
+                return new ExampleActor(id, peerAddresses);
+            }
+        });
+    }
+
+    @Override public void onReceiveCommand(Object message){
+        if(message instanceof KeyValue){
+            if(isLeader()) {
+                String persistId = Long.toString(persistIdentifier++);
+                persistData(getSender(), persistId, (Payload) message);
+            } else {
+                if(getLeader() != null) {
+                    getLeader().forward(message, getContext());
+                }
+            }
+
+        } else if (message instanceof PrintState) {
+            LOG.debug("State of the node:"+getId() + " has = "+state.size() + " entries");
+
+        } else if (message instanceof PrintRole) {
+            LOG.debug(getId() + " = " + getRaftState());
+        } else {
+            super.onReceiveCommand(message);
+        }
+    }
+
+    @Override protected void applyState(ActorRef clientActor, String identifier,
+        Object data) {
+        if(data instanceof KeyValue){
+            KeyValue kv = (KeyValue) data;
+            state.put(kv.getKey(), kv.getValue());
+            if(clientActor != null) {
+                clientActor.tell(new KeyValueSaved(), getSelf());
+            }
+        }
+    }
+
+    @Override protected Object createSnapshot() {
+        return state;
+    }
+
+    @Override protected void applySnapshot(Object snapshot) {
+        state.clear();
+        state.putAll((HashMap) snapshot);
+    }
+
+    @Override public void onReceiveRecover(Object message) {
+        super.onReceiveRecover(message);
+    }
+
+    @Override public String persistenceId() {
+        return getId();
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/LogGenerator.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/LogGenerator.java
new file mode 100644 (file)
index 0000000..fbe1447
--- /dev/null
@@ -0,0 +1,67 @@
+package org.opendaylight.controller.cluster.example;
+
+import akka.actor.ActorRef;
+import org.opendaylight.controller.cluster.example.messages.KeyValue;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+
+/**
+ * Created by kramesha on 7/16/14.
+ */
+public class LogGenerator {
+    private Map<ActorRef, LoggingThread> clientToLoggingThread = new HashMap<ActorRef, LoggingThread>();
+
+    public void startLoggingForClient(ActorRef client) {
+        LoggingThread lt = new LoggingThread(client);
+        clientToLoggingThread.put(client, lt);
+        Thread t = new Thread(lt);
+        t.start();
+    }
+
+    public void stopLoggingForClient(ActorRef client) {
+        clientToLoggingThread.get(client).stopLogging();
+        clientToLoggingThread.remove(client);
+    }
+
+    public class LoggingThread implements Runnable {
+
+        private ActorRef clientActor;
+        private volatile boolean stopLogging = false;
+
+        public LoggingThread(ActorRef clientActor) {
+            this.clientActor = clientActor;
+        }
+
+        public void run() {
+            Random r = new Random();
+            while (true) {
+                if (stopLogging) {
+                    System.out.println("Logging stopped for client:" + clientActor.path());
+                    break;
+                }
+                String key = clientActor.path().name();
+                int random = r.nextInt(100);
+                clientActor.tell(new KeyValue(key+"-key-" + random, "value-" + random), null);
+                try {
+                    Thread.sleep((random%10) * 1000);
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+
+        public void stopLogging() {
+            stopLogging = true;
+        }
+
+        public void startLogging() {
+            stopLogging = false;
+        }
+
+
+    }
+
+
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/Main.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/Main.java
new file mode 100644 (file)
index 0000000..a148ed4
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * 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.example;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSystem;
+import akka.actor.PoisonPill;
+import org.opendaylight.controller.cluster.example.messages.KeyValue;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Main {
+    private static final ActorSystem actorSystem = ActorSystem.create();
+    // Create three example actors
+    private static Map<String, String> allPeers = new HashMap<>();
+
+    static {
+        allPeers.put("example-1", "akka://default/user/example-1");
+        allPeers.put("example-2", "akka://default/user/example-2");
+        allPeers.put("example-3", "akka://default/user/example-3");
+    }
+
+    public static void main(String[] args) throws Exception{
+        ActorRef example1Actor =
+            actorSystem.actorOf(ExampleActor.props("example-1",
+                withoutPeer("example-1")), "example-1");
+
+        ActorRef example2Actor =
+            actorSystem.actorOf(ExampleActor.props("example-2",
+                withoutPeer("example-2")), "example-2");
+
+        ActorRef example3Actor =
+            actorSystem.actorOf(ExampleActor.props("example-3",
+                withoutPeer("example-3")), "example-3");
+
+
+        List<ActorRef> examples = Arrays.asList(example1Actor, example2Actor, example3Actor);
+
+        ActorRef clientActor = actorSystem.actorOf(ClientActor.props(example1Actor));
+        BufferedReader br =
+            new BufferedReader(new InputStreamReader(System.in));
+
+        System.out.println("Usage :");
+        System.out.println("s <1-3> to start a peer");
+        System.out.println("k <1-3> to kill a peer");
+
+        while(true) {
+            System.out.print("Enter command (0 to exit):");
+            try {
+                String s = br.readLine();
+                String[] split = s.split(" ");
+                if(split.length > 1) {
+                    String command = split[0];
+                    String actor = split[1];
+
+                    if ("k".equals(command)) {
+                        int i = Integer.parseInt(actor);
+                        examples.get(i - 1)
+                            .tell(PoisonPill.getInstance(), null);
+                        continue;
+                    } else if ("s".equals(command)) {
+                        int i = Integer.parseInt(actor);
+                        String actorName = "example-" + i;
+                        examples.add(i - 1,
+                            actorSystem.actorOf(ExampleActor.props(actorName,
+                                withoutPeer(actorName)), actorName));
+                        System.out.println("Created actor : " + actorName);
+                        continue;
+                    }
+                }
+
+                int i = Integer.parseInt(s);
+                if(i == 0){
+                    System.exit(0);
+                }
+                clientActor.tell(new KeyValue("key " + i, "value " + i), null);
+            } catch (NumberFormatException nfe) {
+                System.err.println("Invalid Format!");
+            }
+        }
+    }
+
+    private static Map<String, String> withoutPeer(String peerId) {
+        Map<String, String> without = new HashMap<>(allPeers);
+        without.remove(peerId);
+        return without;
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/TestDriver.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/TestDriver.java
new file mode 100644 (file)
index 0000000..c2d0b3a
--- /dev/null
@@ -0,0 +1,251 @@
+package org.opendaylight.controller.cluster.example;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSystem;
+import org.opendaylight.controller.cluster.example.messages.PrintRole;
+import org.opendaylight.controller.cluster.example.messages.PrintState;
+import org.opendaylight.controller.cluster.raft.client.messages.AddRaftPeer;
+import org.opendaylight.controller.cluster.raft.client.messages.RemoveRaftPeer;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * This is a test driver for testing akka-raft implementation
+ * Its uses ExampleActors and threads to push content(key-vals) to these actors
+ * Each ExampleActor can have one or more ClientActors. Each ClientActor spawns
+ * a thread and starts push logs to the actor its assignged to.
+ */
+public class TestDriver {
+
+    private static final ActorSystem actorSystem = ActorSystem.create();
+    private static Map<String, String> allPeers = new HashMap<>();
+    private static Map<String, ActorRef> clientActorRefs  = new HashMap<String, ActorRef>();
+    private static Map<String, ActorRef> actorRefs = new HashMap<String, ActorRef>();
+    private static LogGenerator logGenerator = new LogGenerator();;
+
+    /**
+     * Create nodes, add clients and start logging.
+     * Commands
+     *  bye
+     *  createNodes:{num}
+     *  addNodes:{num}
+     *  stopNode:{nodeName}
+     *  addClients:{num}
+     *  addClientsToNode:{nodeName, num}
+     *  startLogging
+     *  stopLogging
+     *  startLoggingForClient:{nodeName}
+     *  stopLoggingForClient:{nodeName}
+     *  printNodes
+     *  printState
+     * @param args
+     * @throws Exception
+     */
+    public static void main(String[] args) throws Exception {
+        TestDriver td = new TestDriver();
+
+        System.out.println("Enter command (type bye to exit):");
+
+
+        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+        while(true) {
+            String command = br.readLine();
+            if (command.startsWith("bye")) {
+                System.exit(0);
+
+            } else if (command.startsWith("createNodes")) {
+                String[] arr = command.split(":");
+                int n = Integer.parseInt(arr[1]);
+                td.createNodes(n);
+
+            } else if (command.startsWith("addNodes")) {
+                String[] arr = command.split(":");
+                int n = Integer.parseInt(arr[1]);
+                td.addNodes(n);
+
+            } else if (command.startsWith("addClients")) {
+                String[] arr = command.split(":");
+                int n = Integer.parseInt(arr[1]);
+                td.addClients(n);
+
+            } else if (command.startsWith("addClientsToNode")) {
+                String[] arr = command.split(":");
+                String nodeName = arr[1];
+                int n = Integer.parseInt(arr[1]);
+                td.addClientsToNode(nodeName, n);
+
+            } else if (command.startsWith("stopNode")) {
+                String[] arr = command.split(":");
+                td.stopNode(arr[1]);
+
+            } else if (command.startsWith("startLogging")) {
+                td.startAllLogging();
+
+            } else if (command.startsWith("startLoggingForClient")) {
+                String[] arr = command.split(":");
+                td.startLoggingForClient(clientActorRefs.get(arr[1]));
+
+            } else if (command.startsWith("stopLogging")) {
+                td.stopAllLogging();
+
+            } else if (command.startsWith("stopLoggingForClient")) {
+                String[] arr = command.split(":");
+                td.stopLoggingForClient(clientActorRefs.get(arr[1]));
+
+            } else if (command.startsWith("printState")) {
+                td.printState();
+            } else if (command.startsWith("printNodes")) {
+                td.printNodes();
+            }
+
+        }
+    }
+
+    public void createNodes(int num) {
+        for (int i=0; i < num; i++)  {
+            int rand = getUnusedRandom(num);
+            allPeers.put("example-"+rand, "akka://default/user/example-"+rand);
+        }
+
+        for (String s : allPeers.keySet())  {
+            ActorRef exampleActor = actorSystem.actorOf(
+                ExampleActor.props(s, withoutPeer(s)), s);
+            actorRefs.put(s, exampleActor);
+            System.out.println("Created node:"+s);
+
+        }
+    }
+
+    // add new nodes , pass in the count
+    public void addNodes(int num) {
+        Map<String, String> newPeers = new HashMap<>();
+        for (int i=0; i < num; i++)  {
+            int rand = getUnusedRandom(num);
+            newPeers.put("example-"+rand, "akka://default/user/example-"+rand);
+            allPeers.put("example-"+rand, "akka://default/user/example-"+rand);
+
+        }
+        Map<String, ActorRef> newActorRefs = new HashMap<String, ActorRef>(num);
+        for (Map.Entry<String, String> entry : newPeers.entrySet())  {
+            ActorRef exampleActor = actorSystem.actorOf(
+                ExampleActor.props(entry.getKey(), withoutPeer(entry.getKey())), entry.getKey());
+            newActorRefs.put(entry.getKey(), exampleActor);
+
+            //now also add these new nodes as peers from the previous nodes
+            for (ActorRef actor : actorRefs.values()) {
+                actor.tell(new AddRaftPeer(entry.getKey(), entry.getValue()), null);
+            }
+
+            System.out.println("Added node:" + entry);
+        }
+
+        actorRefs.putAll(newActorRefs);
+    }
+
+
+    // add num clients to all nodes in the system
+    public void addClients(int num) {
+        for(Map.Entry<String,ActorRef> actorRefEntry : actorRefs.entrySet()) {
+            for (int i=0; i < num; i++) {
+                String clientName = "client-" + i + "-" + actorRefEntry.getKey();
+                ActorRef clientActor = actorSystem.actorOf(
+                    ClientActor.props(actorRefEntry.getValue()), clientName);
+                clientActorRefs.put(clientName, clientActor);
+                System.out.println("Created client-node:" + clientName);
+            }
+        }
+    }
+
+    // add num clients to a node
+    public void addClientsToNode(String actorName, int num) {
+        ActorRef actorRef = actorRefs.get(actorName);
+        for (int i=0; i < num; i++) {
+            String clientName = "client-" + i + "-" + actorRef;
+            clientActorRefs.put(clientName,
+                actorSystem.actorOf(ClientActor.props(actorRef), clientName));
+            System.out.println("Added client-node:" + clientName);
+        }
+    }
+
+    public void stopNode(String actorName) {
+        ActorRef actorRef = actorRefs.get(actorName);
+        String clientName = "client-"+actorName;
+        if(clientActorRefs.containsKey(clientName)) {
+            actorSystem.stop(clientActorRefs.get(clientName));
+            clientActorRefs.remove(clientName);
+        }
+        actorSystem.stop(actorRef);
+        actorRefs.remove(actorName);
+
+        for (ActorRef actor : actorRefs.values()) {
+            actor.tell(new RemoveRaftPeer(actorName), null);
+        }
+
+        allPeers.remove(actorName);
+
+    }
+
+    public void startAllLogging() {
+        if(!clientActorRefs.isEmpty()) {
+            for(Map.Entry<String,ActorRef> client : clientActorRefs.entrySet()) {
+                logGenerator.startLoggingForClient(client.getValue());
+                System.out.println("Started logging for client:"+client.getKey());
+            }
+        } else {
+            System.out.println("There are no clients for any nodes. First create clients using commands- addClients:<num> or addClientsToNode:<nodename>:<num>");
+        }
+
+    }
+
+    public void startLoggingForClient(ActorRef client) {
+        logGenerator.startLoggingForClient(client);
+    }
+
+    public void stopAllLogging() {
+        for(Map.Entry<String,ActorRef> client : clientActorRefs.entrySet()) {
+            logGenerator.stopLoggingForClient(client.getValue());
+        }
+    }
+
+    public void stopLoggingForClient(ActorRef client) {
+        logGenerator.stopLoggingForClient(client);
+    }
+
+    public void printState() {
+        for (ActorRef ref : actorRefs.values()) {
+            ref.tell(new PrintState(), null);
+        }
+    }
+
+    public void printNodes() {
+        for (ActorRef ref : actorRefs.values()) {
+            ref.tell(new PrintRole(), null);
+        }
+    }
+
+    public ActorRef getLeader() {
+        return null;
+    }
+
+    private int getUnusedRandom(int num) {
+        int rand = -1;
+        do {
+            rand = (new Random()).nextInt(num * num);
+        } while (allPeers.keySet().contains("example-"+rand));
+
+        return rand;
+    }
+
+    private static Map<String, String> withoutPeer(String peerId) {
+        Map<String, String> without = new ConcurrentHashMap<>(allPeers);
+        without.remove(peerId);
+
+        return without;
+    }
+}
+
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/messages/KeyValue.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/messages/KeyValue.java
new file mode 100644 (file)
index 0000000..560d5fc
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * 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.example.messages;
+
+import com.google.protobuf.GeneratedMessage;
+import org.opendaylight.controller.cluster.example.protobuff.messages.KeyValueMessages;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+public class KeyValue extends Payload implements Serializable {
+    private String key;
+    private String value;
+
+    public KeyValue() {
+    }
+
+    public KeyValue(String key, String value){
+        this.key = key;
+        this.value = value;
+    }
+
+    public String getKey() {
+        return key;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    @Override public String toString() {
+        return "KeyValue{" +
+            "key='" + key + '\'' +
+            ", value='" + value + '\'' +
+            '}';
+    }
+
+    // override this method to return  the protobuff related extension fields and their values
+    @Override public Map<GeneratedMessage.GeneratedExtension, String> encode() {
+        Map<GeneratedMessage.GeneratedExtension, String> map = new HashMap<>();
+        map.put(KeyValueMessages.key, getKey());
+        map.put(KeyValueMessages.value, getValue());
+        return map;
+    }
+
+    // override this method to assign the values from protobuff
+    @Override public Payload decode(
+        AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload payloadProtoBuff) {
+        String key = payloadProtoBuff.getExtension(KeyValueMessages.key);
+        String value = payloadProtoBuff.getExtension(KeyValueMessages.value);
+        this.setKey(key);
+        this.setValue(value);
+        return this;
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/messages/KeyValueSaved.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/messages/KeyValueSaved.java
new file mode 100644 (file)
index 0000000..9b2a2e9
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * 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.example.messages;
+
+import java.io.Serializable;
+
+public class KeyValueSaved implements Serializable {
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/messages/PrintRole.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/messages/PrintRole.java
new file mode 100644 (file)
index 0000000..a5105f0
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * 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.example.messages;
+
+import java.io.Serializable;
+
+public class PrintRole implements Serializable {
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/messages/PrintState.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/messages/PrintState.java
new file mode 100644 (file)
index 0000000..20ed142
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * 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.example.messages;
+
+import java.io.Serializable;
+
+public class PrintState implements Serializable {
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/protobuff/messages/KeyValueMessages.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/protobuff/messages/KeyValueMessages.java
new file mode 100644 (file)
index 0000000..c3d4bbf
--- /dev/null
@@ -0,0 +1,73 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: KeyValueMessages.proto
+
+package org.opendaylight.controller.cluster.example.protobuff.messages;
+
+public final class KeyValueMessages {
+  private KeyValueMessages() {}
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistry registry) {
+    registry.add(org.opendaylight.controller.cluster.example.protobuff.messages.KeyValueMessages.key);
+    registry.add(org.opendaylight.controller.cluster.example.protobuff.messages.KeyValueMessages.value);
+  }
+  public static final int KEY_FIELD_NUMBER = 2;
+  /**
+   * <code>extend .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload { ... }</code>
+   */
+  public static final
+    com.google.protobuf.GeneratedMessage.GeneratedExtension<
+      org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
+      java.lang.String> key = com.google.protobuf.GeneratedMessage
+          .newFileScopedGeneratedExtension(
+        java.lang.String.class,
+        null);
+  public static final int VALUE_FIELD_NUMBER = 3;
+  /**
+   * <code>extend .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload { ... }</code>
+   */
+  public static final
+    com.google.protobuf.GeneratedMessage.GeneratedExtension<
+      org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
+      java.lang.String> value = com.google.protobuf.GeneratedMessage
+          .newFileScopedGeneratedExtension(
+        java.lang.String.class,
+        null);
+
+  public static com.google.protobuf.Descriptors.FileDescriptor
+      getDescriptor() {
+    return descriptor;
+  }
+  private static com.google.protobuf.Descriptors.FileDescriptor
+      descriptor;
+  static {
+    java.lang.String[] descriptorData = {
+      "\n\026KeyValueMessages.proto\022(org.opendaylig" +
+      "ht.controller.cluster.raft\032\033AppendEntrie" +
+      "sMessages.proto:_\n\003key\022R.org.opendayligh" +
+      "t.controller.cluster.raft.AppendEntries." +
+      "ReplicatedLogEntry.Payload\030\002 \001(\t:a\n\005valu" +
+      "e\022R.org.opendaylight.controller.cluster." +
+      "raft.AppendEntries.ReplicatedLogEntry.Pa" +
+      "yload\030\003 \001(\tBT\n>org.opendaylight.controll" +
+      "er.cluster.example.protobuff.messagesB\020K" +
+      "eyValueMessagesH\001"
+    };
+    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+        public com.google.protobuf.ExtensionRegistry assignDescriptors(
+            com.google.protobuf.Descriptors.FileDescriptor root) {
+          descriptor = root;
+          key.internalInit(descriptor.getExtensions().get(0));
+          value.internalInit(descriptor.getExtensions().get(1));
+          return null;
+        }
+      };
+    com.google.protobuf.Descriptors.FileDescriptor
+      .internalBuildGeneratedFileFrom(descriptorData,
+        new com.google.protobuf.Descriptors.FileDescriptor[] {
+          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.getDescriptor(),
+        }, assigner);
+  }
+
+  // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ClientRequestTracker.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ClientRequestTracker.java
new file mode 100644 (file)
index 0000000..4972b34
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * 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.raft;
+
+import akka.actor.ActorRef;
+
+public interface ClientRequestTracker {
+    /**
+     * The client actor who is waiting for a response
+     *
+     * @return
+     */
+    ActorRef getClientActor();
+
+    /**
+     *
+     * @return
+     */
+    String getIdentifier();
+
+    /**
+     * The index of the log entry which needs to be replicated
+     *
+     * @return
+     */
+    long getIndex();
+
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ClientRequestTrackerImpl.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ClientRequestTrackerImpl.java
new file mode 100644 (file)
index 0000000..15de6d0
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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.raft;
+
+import akka.actor.ActorRef;
+
+public class ClientRequestTrackerImpl implements ClientRequestTracker {
+
+    private final ActorRef clientActor;
+    private final String identifier;
+    private final long logIndex;
+
+    public ClientRequestTrackerImpl(ActorRef clientActor, String identifier,
+        long logIndex) {
+
+        this.clientActor = clientActor;
+
+        this.identifier = identifier;
+
+        this.logIndex = logIndex;
+    }
+
+    @Override public ActorRef getClientActor() {
+        return clientActor;
+    }
+
+    @Override public long getIndex() {
+        return logIndex;
+    }
+
+    public String getIdentifier() {
+        return identifier;
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ElectionTerm.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ElectionTerm.java
new file mode 100644 (file)
index 0000000..9f0d02e
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.raft;
+
+/**
+ * ElectionTerm contains information about a RaftActors election term.
+ * <p>
+ * This information includes the last known current term of the RaftActor
+ * and which peer was voted for by the RaftActor in that term
+ * <p>
+ * This class ensures that election term information is persisted
+ */
+public interface ElectionTerm {
+    /**
+     * latest term server has seen (initialized to 0
+     * on first boot, increases monotonically)
+     */
+    long getCurrentTerm();
+
+    /**
+     * candidateId that received vote in current
+     * term (or null if none)
+     */
+    String getVotedFor();
+
+    /**
+     * To be called mainly when we are recovering in-memory election state from
+     * persistent storage
+     *
+     * @param currentTerm
+     * @param votedFor
+     */
+    void update(long currentTerm, String votedFor);
+
+    /**
+     * To be called when we need to update the current term either because we
+     * received a message from someone with a more up-to-date term or because we
+     * just voted for someone
+     * <p>
+     * This information needs to be persisted so that on recovery the replica
+     * can start itself in the right term and know if it has already voted in
+     * that term or not
+     *
+     * @param currentTerm
+     * @param votedFor
+     */
+    void updateAndPersist(long currentTerm, String votedFor);
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformation.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformation.java
new file mode 100644 (file)
index 0000000..f3de983
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * 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.raft;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * The state of the followers log as known by the Leader
+ */
+public interface FollowerLogInformation {
+
+    /**
+     * Increment the value of the nextIndex
+     * @return
+     */
+    public long incrNextIndex();
+
+    /**
+     * Decrement the value of the nextIndex
+     * @return
+     */
+    public long decrNextIndex();
+
+    /**
+     *
+     * @param nextIndex
+     */
+    void setNextIndex(long nextIndex);
+
+    /**
+     * Increment the value of the matchIndex
+     * @return
+     */
+    public long incrMatchIndex();
+
+    public void setMatchIndex(long matchIndex);
+
+    /**
+     * The identifier of the follower
+     * This could simply be the url of the remote actor
+     */
+    public String getId();
+
+    /**
+     * for each server, index of the next log entry
+     * to send to that server (initialized to leader
+     *    last log index + 1)
+     */
+    public AtomicLong getNextIndex();
+
+    /**
+     * for each server, index of highest log entry
+     * known to be replicated on server
+     *    (initialized to 0, increases monotonically)
+     */
+    public AtomicLong getMatchIndex();
+
+
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformationImpl.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformationImpl.java
new file mode 100644 (file)
index 0000000..94f9a53
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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.raft;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+public class FollowerLogInformationImpl implements FollowerLogInformation{
+
+    private final String id;
+
+    private final AtomicLong nextIndex;
+
+    private final AtomicLong matchIndex;
+
+    public FollowerLogInformationImpl(String id, AtomicLong nextIndex,
+        AtomicLong matchIndex) {
+        this.id = id;
+        this.nextIndex = nextIndex;
+        this.matchIndex = matchIndex;
+    }
+
+    public long incrNextIndex(){
+        return nextIndex.incrementAndGet();
+    }
+
+    @Override public long decrNextIndex() {
+        return nextIndex.decrementAndGet();
+    }
+
+    @Override public void setNextIndex(long nextIndex) {
+        this.nextIndex.set(nextIndex);
+    }
+
+    public long incrMatchIndex(){
+        return matchIndex.incrementAndGet();
+    }
+
+    @Override public void setMatchIndex(long matchIndex) {
+        this.matchIndex.set(matchIndex);
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public AtomicLong getNextIndex() {
+        return nextIndex;
+    }
+
+    public AtomicLong getMatchIndex() {
+        return matchIndex;
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java
new file mode 100644 (file)
index 0000000..b8e9653
--- /dev/null
@@ -0,0 +1,668 @@
+/*
+ * 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.raft;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSelection;
+import akka.event.Logging;
+import akka.event.LoggingAdapter;
+import akka.japi.Procedure;
+import akka.persistence.RecoveryCompleted;
+import akka.persistence.SaveSnapshotFailure;
+import akka.persistence.SaveSnapshotSuccess;
+import akka.persistence.SnapshotOffer;
+import akka.persistence.SnapshotSelectionCriteria;
+import akka.persistence.UntypedPersistentActor;
+import org.opendaylight.controller.cluster.raft.base.messages.ApplySnapshot;
+import org.opendaylight.controller.cluster.raft.base.messages.ApplyState;
+import org.opendaylight.controller.cluster.raft.base.messages.Replicate;
+import org.opendaylight.controller.cluster.raft.behaviors.Candidate;
+import org.opendaylight.controller.cluster.raft.behaviors.Follower;
+import org.opendaylight.controller.cluster.raft.behaviors.Leader;
+import org.opendaylight.controller.cluster.raft.behaviors.RaftActorBehavior;
+import org.opendaylight.controller.cluster.raft.client.messages.AddRaftPeer;
+import org.opendaylight.controller.cluster.raft.client.messages.FindLeader;
+import org.opendaylight.controller.cluster.raft.client.messages.FindLeaderReply;
+import org.opendaylight.controller.cluster.raft.client.messages.RemoveRaftPeer;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * RaftActor encapsulates a state machine that needs to be kept synchronized
+ * in a cluster. It implements the RAFT algorithm as described in the paper
+ * <a href='https://ramcloud.stanford.edu/wiki/download/attachments/11370504/raft.pdf'>
+ * In Search of an Understandable Consensus Algorithm</a>
+ * <p/>
+ * RaftActor has 3 states and each state has a certain behavior associated
+ * with it. A Raft actor can behave as,
+ * <ul>
+ * <li> A Leader </li>
+ * <li> A Follower (or) </li>
+ * <li> A Candidate </li>
+ * </ul>
+ * <p/>
+ * <p/>
+ * A RaftActor MUST be a Leader in order to accept requests from clients to
+ * change the state of it's encapsulated state machine. Once a RaftActor becomes
+ * a Leader it is also responsible for ensuring that all followers ultimately
+ * have the same log and therefore the same state machine as itself.
+ * <p/>
+ * <p/>
+ * The current behavior of a RaftActor determines how election for leadership
+ * is initiated and how peer RaftActors react to request for votes.
+ * <p/>
+ * <p/>
+ * Each RaftActor also needs to know the current election term. It uses this
+ * information for a couple of things. One is to simply figure out who it
+ * voted for in the last election. Another is to figure out if the message
+ * it received to update it's state is stale.
+ * <p/>
+ * <p/>
+ * The RaftActor uses akka-persistence to store it's replicated log.
+ * Furthermore through it's behaviors a Raft Actor determines
+ * <p/>
+ * <ul>
+ * <li> when a log entry should be persisted </li>
+ * <li> when a log entry should be applied to the state machine (and) </li>
+ * <li> when a snapshot should be saved </li>
+ * </ul>
+ */
+public abstract class RaftActor extends UntypedPersistentActor {
+    protected final LoggingAdapter LOG =
+        Logging.getLogger(getContext().system(), this);
+
+    /**
+     * The current state determines the current behavior of a RaftActor
+     * A Raft Actor always starts off in the Follower State
+     */
+    private RaftActorBehavior currentBehavior;
+
+    /**
+     * This context should NOT be passed directly to any other actor it is
+     * only to be consumed by the RaftActorBehaviors
+     */
+    private RaftActorContext context;
+
+    /**
+     * The in-memory journal
+     */
+    private ReplicatedLogImpl replicatedLog = new ReplicatedLogImpl();
+
+
+    public RaftActor(String id, Map<String, String> peerAddresses) {
+        context = new RaftActorContextImpl(this.getSelf(),
+            this.getContext(),
+            id, new ElectionTermImpl(),
+            -1, -1, replicatedLog, peerAddresses, LOG);
+    }
+
+    @Override public void onReceiveRecover(Object message) {
+        if (message instanceof SnapshotOffer) {
+            SnapshotOffer offer = (SnapshotOffer) message;
+            Snapshot snapshot = (Snapshot) offer.snapshot();
+
+            // Create a replicated log with the snapshot information
+            // The replicated log can be used later on to retrieve this snapshot
+            // when we need to install it on a peer
+            replicatedLog = new ReplicatedLogImpl(snapshot);
+
+            // Apply the snapshot to the actors state
+            applySnapshot(snapshot.getState());
+
+        } else if (message instanceof ReplicatedLogEntry) {
+            replicatedLog.append((ReplicatedLogEntry) message);
+        } else if (message instanceof DeleteEntries) {
+            replicatedLog.removeFrom(((DeleteEntries) message).getFromIndex());
+        } else if (message instanceof UpdateElectionTerm) {
+            context.getTermInformation().update(((UpdateElectionTerm) message).getCurrentTerm(), ((UpdateElectionTerm) message).getVotedFor());
+        } else if (message instanceof RecoveryCompleted) {
+            LOG.debug(
+                "Last index in log : " + replicatedLog.lastIndex());
+            currentBehavior = switchBehavior(RaftState.Follower);
+        }
+    }
+
+    @Override public void onReceiveCommand(Object message) {
+        if (message instanceof ApplyState){
+            ApplyState applyState = (ApplyState) message;
+
+            LOG.debug("Applying state for log index {} data {}",
+                applyState.getReplicatedLogEntry().getIndex(),
+                applyState.getReplicatedLogEntry().getData());
+
+            applyState(applyState.getClientActor(), applyState.getIdentifier(),
+                applyState.getReplicatedLogEntry().getData());
+
+        } else if(message instanceof ApplySnapshot ) {
+            applySnapshot(((ApplySnapshot) message).getSnapshot());
+
+        } else if (message instanceof FindLeader) {
+            getSender().tell(
+                new FindLeaderReply(
+                    context.getPeerAddress(currentBehavior.getLeaderId())),
+                getSelf()
+            );
+
+        } else if (message instanceof SaveSnapshotSuccess) {
+            SaveSnapshotSuccess success = (SaveSnapshotSuccess) message;
+
+            // TODO: Not sure if we want to be this aggressive with trimming stuff
+            trimPersistentData(success.metadata().sequenceNr());
+
+        } else if (message instanceof SaveSnapshotFailure) {
+
+            // TODO: Handle failure in saving the snapshot
+
+        } else if (message instanceof FindLeader){
+
+            getSender().tell(new FindLeaderReply(
+                context.getPeerAddress(currentBehavior.getLeaderId())),
+                getSelf());
+
+        } else if (message instanceof AddRaftPeer){
+
+            // FIXME : Do not add raft peers like this.
+            // When adding a new Peer we have to ensure that the a majority of
+            // the peers know about the new Peer. Doing it this way may cause
+            // a situation where multiple Leaders may emerge
+            AddRaftPeer arp = (AddRaftPeer)message;
+           context.addToPeers(arp.getName(), arp.getAddress());
+
+        } else if (message instanceof RemoveRaftPeer){
+
+            RemoveRaftPeer rrp = (RemoveRaftPeer)message;
+            context.removePeer(rrp.getName());
+
+        } else {
+
+            RaftState state =
+                currentBehavior.handleMessage(getSender(), message);
+            currentBehavior = switchBehavior(state);
+        }
+    }
+
+
+
+    /**
+     * When a derived RaftActor needs to persist something it must call
+     * persistData.
+     *
+     * @param clientActor
+     * @param identifier
+     * @param data
+     */
+    protected void persistData(ActorRef clientActor, String identifier,
+        Payload data) {
+
+        ReplicatedLogEntry replicatedLogEntry = new ReplicatedLogImplEntry(
+            context.getReplicatedLog().lastIndex() + 1,
+            context.getTermInformation().getCurrentTerm(), data);
+
+        LOG.debug("Persist data {}", replicatedLogEntry);
+
+        replicatedLog
+            .appendAndPersist(clientActor, identifier, replicatedLogEntry);
+    }
+
+    protected String getId() {
+        return context.getId();
+    }
+
+    /**
+     * Derived actors can call the isLeader method to check if the current
+     * RaftActor is the Leader or not
+     *
+     * @return true it this RaftActor is a Leader false otherwise
+     */
+    protected boolean isLeader() {
+        return context.getId().equals(currentBehavior.getLeaderId());
+    }
+
+    /**
+     * Derived actor can call getLeader if they need a reference to the Leader.
+     * This would be useful for example in forwarding a request to an actor
+     * which is the leader
+     *
+     * @return A reference to the leader if known, null otherwise
+     */
+    protected ActorSelection getLeader(){
+        String leaderId = currentBehavior.getLeaderId();
+        if (leaderId == null) {
+            return null;
+        }
+        String peerAddress = context.getPeerAddress(leaderId);
+        LOG.debug("getLeader leaderId = " + leaderId + " peerAddress = "
+            + peerAddress);
+        return context.actorSelection(peerAddress);
+    }
+
+    protected RaftState getRaftState() {
+        return currentBehavior.state();
+    }
+
+    /**
+     * setPeerAddress sets the address of a known peer at a later time.
+     * <p>
+     * This is to account for situations where a we know that a peer
+     * exists but we do not know an address up-front. This may also be used in
+     * situations where a known peer starts off in a different location and we
+     * need to change it's address
+     * <p>
+     * Note that if the peerId does not match the list of peers passed to
+     * this actor during construction an IllegalStateException will be thrown.
+     *
+     * @param peerId
+     * @param peerAddress
+     */
+    protected void setPeerAddress(String peerId, String peerAddress){
+        context.setPeerAddress(peerId, peerAddress);
+    }
+
+
+
+    /**
+     * The applyState method will be called by the RaftActor when some data
+     * needs to be applied to the actor's state
+     *
+     * @param clientActor A reference to the client who sent this message. This
+     *                    is the same reference that was passed to persistData
+     *                    by the derived actor. clientActor may be null when
+     *                    the RaftActor is behaving as a follower or during
+     *                    recovery.
+     * @param identifier  The identifier of the persisted data. This is also
+     *                    the same identifier that was passed to persistData by
+     *                    the derived actor. identifier may be null when
+     *                    the RaftActor is behaving as a follower or during
+     *                    recovery
+     * @param data        A piece of data that was persisted by the persistData call.
+     *                    This should NEVER be null.
+     */
+    protected abstract void applyState(ActorRef clientActor, String identifier,
+        Object data);
+
+    /**
+     * This method will be called by the RaftActor when a snapshot needs to be
+     * created. The derived actor should respond with its current state.
+     * <p/>
+     * During recovery the state that is returned by the derived actor will
+     * be passed back to it by calling the applySnapshot  method
+     *
+     * @return The current state of the actor
+     */
+    protected abstract Object createSnapshot();
+
+    /**
+     * This method will be called by the RaftActor during recovery to
+     * reconstruct the state of the actor.
+     * <p/>
+     * This method may also be called at any other point during normal
+     * operations when the derived actor is out of sync with it's peers
+     * and the only way to bring it in sync is by applying a snapshot
+     *
+     * @param snapshot A snapshot of the state of the actor
+     */
+    protected abstract void applySnapshot(Object snapshot);
+
+    private RaftActorBehavior switchBehavior(RaftState state) {
+        if (currentBehavior != null) {
+            if (currentBehavior.state() == state) {
+                return currentBehavior;
+            }
+            LOG.info("Switching from state " + currentBehavior.state() + " to "
+                + state);
+
+            try {
+                currentBehavior.close();
+            } catch (Exception e) {
+                LOG.error(e,
+                    "Failed to close behavior : " + currentBehavior.state());
+            }
+
+        } else {
+            LOG.info("Switching behavior to " + state);
+        }
+        RaftActorBehavior behavior = null;
+        if (state == RaftState.Candidate) {
+            behavior = new Candidate(context);
+        } else if (state == RaftState.Follower) {
+            behavior = new Follower(context);
+        } else {
+            behavior = new Leader(context);
+        }
+        return behavior;
+    }
+
+    private void trimPersistentData(long sequenceNumber) {
+        // Trim snapshots
+        // FIXME : Not sure how exactly the SnapshotSelectionCriteria is applied
+        // For now guessing that it is ANDed.
+        deleteSnapshots(new SnapshotSelectionCriteria(
+            sequenceNumber - 100000, 43200000));
+
+        // Trim journal
+        deleteMessages(sequenceNumber);
+    }
+
+
+    private class ReplicatedLogImpl implements ReplicatedLog {
+        private final List<ReplicatedLogEntry> journal;
+        private final Object snapshot;
+        private long snapshotIndex = -1;
+        private long snapshotTerm = -1;
+
+        public ReplicatedLogImpl(Snapshot snapshot) {
+            this.snapshot = snapshot.getState();
+            this.snapshotIndex = snapshot.getLastAppliedIndex();
+            this.snapshotTerm = snapshot.getLastAppliedTerm();
+
+            this.journal = new ArrayList<>(snapshot.getUnAppliedEntries());
+        }
+
+        public ReplicatedLogImpl() {
+            this.snapshot = null;
+            this.journal = new ArrayList<>();
+        }
+
+        @Override public ReplicatedLogEntry get(long index) {
+            int adjustedIndex = adjustedIndex(index);
+
+            if (adjustedIndex < 0 || adjustedIndex >= journal.size()) {
+                return null;
+            }
+
+            return journal.get(adjustedIndex);
+        }
+
+        @Override public ReplicatedLogEntry last() {
+            if (journal.size() == 0) {
+                return null;
+            }
+            return get(journal.size() - 1);
+        }
+
+        @Override public long lastIndex() {
+            if (journal.size() == 0) {
+                return -1;
+            }
+
+            return last().getIndex();
+        }
+
+        @Override public long lastTerm() {
+            if (journal.size() == 0) {
+                return -1;
+            }
+
+            return last().getTerm();
+        }
+
+
+        @Override public void removeFrom(long index) {
+            int adjustedIndex = adjustedIndex(index);
+
+            if (adjustedIndex < 0 || adjustedIndex >= journal.size()) {
+                return;
+            }
+
+            journal.subList(adjustedIndex , journal.size()).clear();
+        }
+
+
+        @Override public void removeFromAndPersist(long index) {
+            int adjustedIndex = adjustedIndex(index);
+
+            if (adjustedIndex < 0 || adjustedIndex >= journal.size()) {
+                return;
+            }
+
+            // FIXME: Maybe this should be done after the command is saved
+            journal.subList(adjustedIndex , journal.size()).clear();
+
+            persist(new DeleteEntries(adjustedIndex), new Procedure<DeleteEntries>(){
+
+                @Override public void apply(DeleteEntries param)
+                    throws Exception {
+                    //FIXME : Doing nothing for now
+                }
+            });
+
+
+        }
+
+        @Override public void append(
+            final ReplicatedLogEntry replicatedLogEntry) {
+            journal.add(replicatedLogEntry);
+        }
+
+        @Override public List<ReplicatedLogEntry> getFrom(long index) {
+            int adjustedIndex = adjustedIndex(index);
+
+            List<ReplicatedLogEntry> entries = new ArrayList<>(100);
+            if (adjustedIndex < 0 || adjustedIndex >= journal.size()) {
+                return entries;
+            }
+
+
+            for (int i = adjustedIndex;
+                 i < journal.size(); i++) {
+                entries.add(journal.get(i));
+            }
+            return entries;
+        }
+
+        @Override public void appendAndPersist(
+            final ReplicatedLogEntry replicatedLogEntry) {
+            appendAndPersist(null, null, replicatedLogEntry);
+        }
+
+        public void appendAndPersist(final ActorRef clientActor,
+            final String identifier,
+            final ReplicatedLogEntry replicatedLogEntry) {
+            context.getLogger().debug(
+                "Append log entry and persist {} ", replicatedLogEntry);
+            // FIXME : By adding the replicated log entry to the in-memory journal we are not truly ensuring durability of the logs
+            journal.add(replicatedLogEntry);
+
+            // When persisting events with persist it is guaranteed that the
+            // persistent actor will not receive further commands between the
+            // persist call and the execution(s) of the associated event
+            // handler. This also holds for multiple persist calls in context
+            // of a single command.
+            persist(replicatedLogEntry,
+                new Procedure<ReplicatedLogEntry>() {
+                    public void apply(ReplicatedLogEntry evt) throws Exception {
+                        // FIXME : Tentatively create a snapshot every hundred thousand entries. To be tuned.
+                        if (size() > 100000) {
+                            ReplicatedLogEntry lastAppliedEntry =
+                                get(context.getLastApplied());
+                            long lastAppliedIndex = -1;
+                            long lastAppliedTerm = -1;
+                            if (lastAppliedEntry != null) {
+                                lastAppliedIndex = lastAppliedEntry.getIndex();
+                                lastAppliedTerm = lastAppliedEntry.getTerm();
+                            }
+
+                            saveSnapshot(Snapshot.create(createSnapshot(),
+                                getFrom(context.getLastApplied() + 1),
+                                lastIndex(), lastTerm(), lastAppliedIndex,
+                                lastAppliedTerm));
+                        }
+                        // Send message for replication
+                        if (clientActor != null) {
+                            currentBehavior.handleMessage(getSelf(),
+                                new Replicate(clientActor, identifier,
+                                    replicatedLogEntry)
+                            );
+                        }
+                    }
+                }
+            );
+        }
+
+        @Override public long size() {
+            return journal.size() + snapshotIndex + 1;
+        }
+
+        @Override public boolean isPresent(long index) {
+            int adjustedIndex = adjustedIndex(index);
+
+            if (adjustedIndex < 0 || adjustedIndex >= journal.size()) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override public boolean isInSnapshot(long index) {
+            return index <= snapshotIndex;
+        }
+
+        @Override public Object getSnapshot() {
+            return snapshot;
+        }
+
+        @Override public long getSnapshotIndex() {
+            return snapshotIndex;
+        }
+
+        @Override public long getSnapshotTerm() {
+            return snapshotTerm;
+        }
+
+        private int adjustedIndex(long index) {
+            if(snapshotIndex < 0){
+                return (int) index;
+            }
+            return (int) (index - snapshotIndex);
+        }
+    }
+
+
+
+
+    private static class DeleteEntries implements Serializable {
+        private final int fromIndex;
+
+
+        public DeleteEntries(int fromIndex) {
+            this.fromIndex = fromIndex;
+        }
+
+        public int getFromIndex() {
+            return fromIndex;
+        }
+    }
+
+
+    private static class Snapshot implements Serializable {
+        private final Object state;
+        private final List<ReplicatedLogEntry> unAppliedEntries;
+        private final long lastIndex;
+        private final long lastTerm;
+        private final long lastAppliedIndex;
+        private final long lastAppliedTerm;
+
+        private Snapshot(Object state,
+            List<ReplicatedLogEntry> unAppliedEntries, long lastIndex,
+            long lastTerm, long lastAppliedIndex, long lastAppliedTerm) {
+            this.state = state;
+            this.unAppliedEntries = unAppliedEntries;
+            this.lastIndex = lastIndex;
+            this.lastTerm = lastTerm;
+            this.lastAppliedIndex = lastAppliedIndex;
+            this.lastAppliedTerm = lastAppliedTerm;
+        }
+
+
+        public static Snapshot create(Object state,
+            List<ReplicatedLogEntry> entries, long lastIndex, long lastTerm,
+            long lastAppliedIndex, long lastAppliedTerm) {
+            return new Snapshot(state, entries, lastIndex, lastTerm,
+                lastAppliedIndex, lastAppliedTerm);
+        }
+
+        public Object getState() {
+            return state;
+        }
+
+        public List<ReplicatedLogEntry> getUnAppliedEntries() {
+            return unAppliedEntries;
+        }
+
+        public long getLastTerm() {
+            return lastTerm;
+        }
+
+        public long getLastAppliedIndex() {
+            return lastAppliedIndex;
+        }
+
+        public long getLastAppliedTerm() {
+            return lastAppliedTerm;
+        }
+    }
+
+    private class ElectionTermImpl implements ElectionTerm {
+        /**
+         * Identifier of the actor whose election term information this is
+         */
+        private long currentTerm = 0;
+        private String votedFor = null;
+
+        public long getCurrentTerm() {
+            return currentTerm;
+        }
+
+        public String getVotedFor() {
+            return votedFor;
+        }
+
+        @Override public void update(long currentTerm, String votedFor) {
+            LOG.info("Set currentTerm={}, votedFor={}", currentTerm, votedFor);
+
+            this.currentTerm = currentTerm;
+            this.votedFor = votedFor;
+        }
+
+        @Override
+        public void updateAndPersist(long currentTerm, String votedFor){
+            update(currentTerm, votedFor);
+            // FIXME : Maybe first persist then update the state
+            persist(new UpdateElectionTerm(this.currentTerm, this.votedFor), new Procedure<UpdateElectionTerm>(){
+
+                @Override public void apply(UpdateElectionTerm param)
+                    throws Exception {
+
+                }
+            });
+        }
+    }
+
+    private static class UpdateElectionTerm implements Serializable {
+        private final long currentTerm;
+        private final String votedFor;
+
+        public UpdateElectionTerm(long currentTerm, String votedFor) {
+            this.currentTerm = currentTerm;
+            this.votedFor = votedFor;
+        }
+
+        public long getCurrentTerm() {
+            return currentTerm;
+        }
+
+        public String getVotedFor() {
+            return votedFor;
+        }
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContext.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContext.java
new file mode 100644 (file)
index 0000000..ae9431a
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ * 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.raft;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSelection;
+import akka.actor.ActorSystem;
+import akka.actor.Props;
+import akka.event.LoggingAdapter;
+
+import java.util.Map;
+
+/**
+ * The RaftActorContext contains that portion of the RaftActors state that
+ * needs to be shared with it's behaviors. A RaftActorContext should NEVER be
+ * used in any actor context outside the RaftActor that constructed it.
+ */
+public interface RaftActorContext {
+    /**
+     * Create a new local actor
+      * @param props
+     * @return
+     */
+    ActorRef actorOf(Props props);
+
+    /**
+     * Create a actor selection
+     * @param path
+     * @return
+     */
+    ActorSelection actorSelection(String path);
+
+    /**
+     * Get the identifier for the RaftActor. This identifier represents the
+     * name of the actor whose common state is being shared. For example the
+     * id could be 'inventory'
+     * @return the identifier
+     */
+    String getId();
+
+    /**
+     * A reference to the RaftActor itself. This could be used to send messages
+     * to the RaftActor
+     * @return
+     */
+    ActorRef getActor();
+
+    /**
+     * Get the ElectionTerm information
+     * @return
+     */
+    ElectionTerm getTermInformation();
+
+    /**
+     * index of highest log entry known to be
+     * committed (initialized to 0, increases
+     *    monotonically)
+     * @return
+     */
+    long getCommitIndex();
+
+
+    /**
+     *
+     */
+    void setCommitIndex(long commitIndex);
+
+    /**
+     * index of highest log entry applied to state
+     * machine (initialized to 0, increases
+     *    monotonically)
+     * @return
+     */
+    long getLastApplied();
+
+
+    /**
+     *
+     */
+    void setLastApplied(long lastApplied);
+
+    /**
+     * @return A representation of the log
+     */
+    ReplicatedLog getReplicatedLog();
+
+    /**
+     * @return The ActorSystem associated with this context
+     */
+    ActorSystem getActorSystem();
+
+    /**
+     * Get the logger to be used for logging messages
+     *
+     * @return
+     */
+    LoggingAdapter getLogger();
+
+    /**
+     * Get a mapping of peerId's to their addresses
+     *
+     * @return
+     *
+     */
+    Map<String, String> getPeerAddresses();
+
+    /**
+     * Get the address of the peer as a String. This is the same format in
+     * which a consumer would provide the address
+     *
+     * @param peerId
+     * @return The address of the peer or null if the address has not yet been
+     *         resolved
+     */
+    String getPeerAddress(String peerId);
+
+    /**
+     * Add to actor peers
+     * @param name
+     * @param address
+     */
+    void addToPeers(String name, String address);
+
+    /**
+     *
+     * @param name
+     */
+    public void removePeer(String name);
+
+    /**
+     * Given a peerId return the corresponding actor
+     * <p>
+     *
+     *
+     * @param peerId
+     * @return The actorSelection corresponding to the peer or null if the
+     *         address has not yet been resolved
+     */
+    ActorSelection getPeerActorSelection(String peerId);
+
+    /**
+     * Set Peer Address can be called at a later time to change the address of
+     * a known peer.
+     *
+     * <p>
+     * Throws an IllegalStateException if the peer is unknown
+     *
+     * @param peerId
+     * @param peerAddress
+     */
+    void setPeerAddress(String peerId, String peerAddress);
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContextImpl.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContextImpl.java
new file mode 100644 (file)
index 0000000..833c8a9
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * 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.raft;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSelection;
+import akka.actor.ActorSystem;
+import akka.actor.Props;
+import akka.actor.UntypedActorContext;
+import akka.event.LoggingAdapter;
+
+import java.util.Map;
+
+import static com.google.common.base.Preconditions.checkState;
+
+public class RaftActorContextImpl implements RaftActorContext{
+
+    private final ActorRef actor;
+
+    private final UntypedActorContext context;
+
+    private final String id;
+
+    private final ElectionTerm termInformation;
+
+    private long commitIndex;
+
+    private long lastApplied;
+
+    private final ReplicatedLog replicatedLog;
+
+    private final Map<String, String> peerAddresses;
+
+    private final LoggingAdapter LOG;
+
+    public RaftActorContextImpl(ActorRef actor, UntypedActorContext context,
+        String id,
+        ElectionTerm termInformation, long commitIndex,
+        long lastApplied, ReplicatedLog replicatedLog, Map<String, String> peerAddresses, LoggingAdapter logger) {
+        this.actor = actor;
+        this.context = context;
+        this.id = id;
+        this.termInformation = termInformation;
+        this.commitIndex = commitIndex;
+        this.lastApplied = lastApplied;
+        this.replicatedLog = replicatedLog;
+        this.peerAddresses = peerAddresses;
+        this.LOG = logger;
+    }
+
+    public ActorRef actorOf(Props props){
+        return context.actorOf(props);
+    }
+
+    public ActorSelection actorSelection(String path){
+        return context.actorSelection(path);
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public ActorRef getActor() {
+        return actor;
+    }
+
+    public ElectionTerm getTermInformation() {
+        return termInformation;
+    }
+
+    public long getCommitIndex() {
+        return commitIndex;
+    }
+
+    @Override public void setCommitIndex(long commitIndex) {
+        this.commitIndex = commitIndex;
+    }
+
+    public long getLastApplied() {
+        return lastApplied;
+    }
+
+    @Override public void setLastApplied(long lastApplied) {
+        this.lastApplied = lastApplied;
+    }
+
+    @Override public ReplicatedLog getReplicatedLog() {
+        return replicatedLog;
+    }
+
+    @Override public ActorSystem getActorSystem() {
+        return context.system();
+    }
+
+    @Override public LoggingAdapter getLogger() {
+        return this.LOG;
+    }
+
+    @Override public Map<String, String> getPeerAddresses() {
+        return peerAddresses;
+    }
+
+    @Override public String getPeerAddress(String peerId) {
+        return peerAddresses.get(peerId);
+    }
+
+    @Override public void addToPeers(String name, String address) {
+        peerAddresses.put(name, address);
+    }
+
+    @Override public void removePeer(String name) {
+        peerAddresses.remove(name);
+    }
+
+    @Override public ActorSelection getPeerActorSelection(String peerId) {
+        String peerAddress = getPeerAddress(peerId);
+        if(peerAddress != null){
+            return actorSelection(peerAddress);
+        }
+        return null;
+    }
+
+    @Override public void setPeerAddress(String peerId, String peerAddress) {
+        LOG.info("Peer address for peer {} set to {}", peerId, peerAddress);
+        checkState(peerAddresses.containsKey(peerId), peerId + " is unknown");
+
+        peerAddresses.put(peerId, peerAddress);
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftState.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftState.java
new file mode 100644 (file)
index 0000000..65114eb
--- /dev/null
@@ -0,0 +1,7 @@
+package org.opendaylight.controller.cluster.raft;
+
+public enum RaftState {
+    Candidate,
+    Follower,
+    Leader
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLog.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLog.java
new file mode 100644 (file)
index 0000000..b7c8955
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ * 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.raft;
+
+import java.util.List;
+
+/**
+ * Represents the ReplicatedLog that needs to be kept in sync by the RaftActor
+ */
+public interface ReplicatedLog {
+    /**
+     * Get a replicated log entry at the specified index
+     *
+     * @param index the index of the log entry
+     * @return the ReplicatedLogEntry at index. null if index less than 0 or
+     * greater than the size of the in-memory journal.
+     */
+    ReplicatedLogEntry get(long index);
+
+
+    /**
+     * Get the last replicated log entry
+     *
+     * @return
+     */
+    ReplicatedLogEntry last();
+
+    /**
+     *
+     * @return
+     */
+    long lastIndex();
+
+    /**
+     *
+     * @return
+     */
+    long lastTerm();
+
+    /**
+     * To be called when we need to remove entries from the in-memory log.
+     * This method will remove all entries >= index. This method should be used
+     * during recovery to appropriately trim the log based on persisted
+     * information
+     *
+     * @param index the index of the log entry
+     */
+    void removeFrom(long index);
+
+
+    /**
+     * To be called when we need to remove entries from the in-memory log and we
+     * need that information persisted to disk. This method will remove all
+     * entries >= index.
+     * <p>
+     * The persisted information would then be used during recovery to properly
+     * reconstruct the state of the in-memory replicated log
+     *
+     * @param index the index of the log entry
+     */
+    void removeFromAndPersist(long index);
+
+    /**
+     * Append an entry to the log
+     * @param replicatedLogEntry
+     */
+    void append(ReplicatedLogEntry replicatedLogEntry);
+
+    /**
+     *
+     * @param replicatedLogEntry
+     */
+    void appendAndPersist(final ReplicatedLogEntry replicatedLogEntry);
+
+    /**
+     *
+     * @param index the index of the log entry
+     */
+    List<ReplicatedLogEntry> getFrom(long index);
+
+
+    /**
+     *
+     * @return
+     */
+    long size();
+
+    /**
+     * Checks if the entry at the specified index is present or not
+     *
+     * @param index the index of the log entry
+     * @return true if the entry is present in the in-memory journal
+     */
+    boolean isPresent(long index);
+
+    /**
+     * Checks if the entry is present in a snapshot
+     *
+     * @param index the index of the log entry
+     * @return true if the entry is in the snapshot. false if the entry is not
+     * in the snapshot even if the entry may be present in the replicated log
+     */
+    boolean isInSnapshot(long index);
+
+    /**
+     * Get the snapshot
+     *
+     * @return an object representing the snapshot if it exists. null otherwise
+     */
+    Object getSnapshot();
+
+    /**
+     * Get the index of the snapshot
+     *
+     * @return the index from which the snapshot was created. -1 otherwise.
+     */
+    long getSnapshotIndex();
+
+    /**
+     * Get the term of the snapshot
+     *
+     * @return the term of the index from which the snapshot was created. -1
+     * otherwise
+     */
+    long getSnapshotTerm();
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogEntry.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogEntry.java
new file mode 100644 (file)
index 0000000..f501c4d
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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.raft;
+
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+
+/**
+ * Represents one entry in the replicated log
+ */
+public interface ReplicatedLogEntry {
+    /**
+     * The data stored in that entry
+     *
+     * @return
+     */
+    Payload getData();
+
+    /**
+     * The term stored in that entry
+     *
+     * @return
+     */
+    long getTerm();
+
+    /**
+     * The index of the entry
+     *
+     * @return
+     */
+    long getIndex();
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImplEntry.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImplEntry.java
new file mode 100644 (file)
index 0000000..fc2ec5c
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * 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.raft;
+
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+
+import java.io.Serializable;
+
+public class ReplicatedLogImplEntry implements ReplicatedLogEntry,
+    Serializable {
+
+    private final long index;
+    private final long term;
+    private final Payload payload;
+
+    public ReplicatedLogImplEntry(long index, long term, Payload payload) {
+
+        this.index = index;
+        this.term = term;
+        this.payload = payload;
+    }
+
+    @Override public Payload getData() {
+        return payload;
+    }
+
+    @Override public long getTerm() {
+        return term;
+    }
+
+    @Override public long getIndex() {
+        return index;
+    }
+
+    @Override public String toString() {
+        return "Entry{" +
+            "index=" + index +
+            ", term=" + term +
+            '}';
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SerializationUtils.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SerializationUtils.java
new file mode 100644 (file)
index 0000000..374e0fa
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * 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.raft;
+
+import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
+
+public class SerializationUtils {
+
+    public static Object fromSerializable(Object serializable){
+        if(serializable.getClass().equals(AppendEntries.SERIALIZABLE_CLASS)){
+            return AppendEntries.fromSerializable(serializable);
+        }
+        return serializable;
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ApplySnapshot.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ApplySnapshot.java
new file mode 100644 (file)
index 0000000..9739fb2
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * 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.raft.base.messages;
+
+import java.io.Serializable;
+
+public class ApplySnapshot implements Serializable {
+    private final Object snapshot;
+
+    public ApplySnapshot(Object snapshot) {
+        this.snapshot = snapshot;
+    }
+
+    public Object getSnapshot() {
+        return snapshot;
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ApplyState.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ApplyState.java
new file mode 100644 (file)
index 0000000..b904335
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * 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.raft.base.messages;
+
+import akka.actor.ActorRef;
+import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
+
+import java.io.Serializable;
+
+public class ApplyState implements Serializable {
+    private final ActorRef clientActor;
+    private final String identifier;
+    private final ReplicatedLogEntry replicatedLogEntry;
+
+    public ApplyState(ActorRef clientActor, String identifier,
+        ReplicatedLogEntry replicatedLogEntry) {
+        this.clientActor = clientActor;
+        this.identifier = identifier;
+        this.replicatedLogEntry = replicatedLogEntry;
+    }
+
+    public ActorRef getClientActor() {
+        return clientActor;
+    }
+
+    public String getIdentifier() {
+        return identifier;
+    }
+
+    public ReplicatedLogEntry getReplicatedLogEntry() {
+        return replicatedLogEntry;
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/CommitEntry.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/CommitEntry.java
new file mode 100644 (file)
index 0000000..07e376f
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * 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.raft.base.messages;
+
+import java.io.Serializable;
+
+/**
+ * Message sent to commit an entry to the log
+ */
+public class CommitEntry implements Serializable {
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ElectionTimeout.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ElectionTimeout.java
new file mode 100644 (file)
index 0000000..a844849
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * 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.raft.base.messages;
+
+import java.io.Serializable;
+
+public class ElectionTimeout implements Serializable {
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/PersistEntry.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/PersistEntry.java
new file mode 100644 (file)
index 0000000..6a62817
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * 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.raft.base.messages;
+
+import java.io.Serializable;
+
+/**
+ * Message sent to Persist an entry into the transaction journal
+ */
+public class PersistEntry implements Serializable {
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/Replicate.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/Replicate.java
new file mode 100644 (file)
index 0000000..9bc737a
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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.raft.base.messages;
+
+import akka.actor.ActorRef;
+import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
+
+import java.io.Serializable;
+
+public class Replicate implements Serializable {
+    private final ActorRef clientActor;
+    private final String identifier;
+    private final ReplicatedLogEntry replicatedLogEntry;
+
+    public Replicate(ActorRef clientActor, String identifier,
+        ReplicatedLogEntry replicatedLogEntry) {
+
+        this.clientActor = clientActor;
+        this.identifier = identifier;
+        this.replicatedLogEntry = replicatedLogEntry;
+    }
+
+    public ActorRef getClientActor() {
+        return clientActor;
+    }
+
+    public String getIdentifier() {
+        return identifier;
+    }
+
+    public ReplicatedLogEntry getReplicatedLogEntry() {
+        return replicatedLogEntry;
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/SaveSnapshot.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/SaveSnapshot.java
new file mode 100644 (file)
index 0000000..861f5ee
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * 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.raft.base.messages;
+
+import java.io.Serializable;
+
+/**
+ * This message is sent by a RaftActor to itself so that a subclass can process
+ * it and use it to save it's state
+ */
+public class SaveSnapshot implements Serializable {
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/SendHeartBeat.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/SendHeartBeat.java
new file mode 100644 (file)
index 0000000..3c8c845
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * 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.raft.base.messages;
+
+import java.io.Serializable;
+
+/**
+ * This messages is sent to the Leader to prompt it to send a heartbeat
+ * to it's followers.
+ *
+ * Typically the Leader to itself on a schedule
+ */
+public class SendHeartBeat implements Serializable {
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/SendInstallSnapshot.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/SendInstallSnapshot.java
new file mode 100644 (file)
index 0000000..6c3313f
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * 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.raft.base.messages;
+
+import java.io.Serializable;
+
+public class SendInstallSnapshot implements Serializable {
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractRaftActorBehavior.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractRaftActorBehavior.java
new file mode 100644 (file)
index 0000000..f7281bb
--- /dev/null
@@ -0,0 +1,374 @@
+/*
+ * 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.raft.behaviors;
+
+import akka.actor.ActorRef;
+import akka.actor.Cancellable;
+import org.opendaylight.controller.cluster.raft.ClientRequestTracker;
+import org.opendaylight.controller.cluster.raft.RaftActorContext;
+import org.opendaylight.controller.cluster.raft.RaftState;
+import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
+import org.opendaylight.controller.cluster.raft.SerializationUtils;
+import org.opendaylight.controller.cluster.raft.base.messages.ApplyState;
+import org.opendaylight.controller.cluster.raft.base.messages.ElectionTimeout;
+import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
+import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
+import org.opendaylight.controller.cluster.raft.messages.RequestVote;
+import org.opendaylight.controller.cluster.raft.messages.RequestVoteReply;
+import scala.concurrent.duration.FiniteDuration;
+
+import java.util.Random;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Abstract class that represents the behavior of a RaftActor
+ * <p/>
+ * All Servers:
+ * <ul>
+ * <li> If commitIndex > lastApplied: increment lastApplied, apply
+ * log[lastApplied] to state machine (§5.3)
+ * <li> If RPC request or response contains term T > currentTerm:
+ * set currentTerm = T, convert to follower (§5.1)
+ */
+public abstract class AbstractRaftActorBehavior implements RaftActorBehavior {
+
+    /**
+     * Information about the RaftActor whose behavior this class represents
+     */
+    protected final RaftActorContext context;
+
+    /**
+     * The maximum election time variance
+     */
+    private static final int ELECTION_TIME_MAX_VARIANCE = 100;
+
+    /**
+     * The interval at which a heart beat message will be sent to the remote
+     * RaftActor
+     * <p/>
+     * Since this is set to 100 milliseconds the Election timeout should be
+     * at least 200 milliseconds
+     */
+    protected static final FiniteDuration HEART_BEAT_INTERVAL =
+        new FiniteDuration(100, TimeUnit.MILLISECONDS);
+
+    /**
+     * The interval in which a new election would get triggered if no leader is found
+     */
+    private static final long ELECTION_TIME_INTERVAL =
+        HEART_BEAT_INTERVAL.toMillis() * 2;
+
+    /**
+     *
+     */
+    private Cancellable electionCancel = null;
+
+    /**
+     *
+     */
+    protected String leaderId = null;
+
+
+    protected AbstractRaftActorBehavior(RaftActorContext context) {
+        this.context = context;
+    }
+
+    /**
+     * Derived classes should not directly handle AppendEntries messages it
+     * should let the base class handle it first. Once the base class handles
+     * the AppendEntries message and does the common actions that are applicable
+     * in all RaftState's it will delegate the handling of the AppendEntries
+     * message to the derived class to do more state specific handling by calling
+     * this method
+     *
+     * @param sender         The actor that sent this message
+     * @param appendEntries  The AppendEntries message
+     * @return
+     */
+    protected abstract RaftState handleAppendEntries(ActorRef sender,
+        AppendEntries appendEntries);
+
+
+    /**
+     * appendEntries first processes the AppendEntries message and then
+     * delegates handling to a specific behavior
+     *
+     * @param sender
+     * @param appendEntries
+     * @return
+     */
+    protected RaftState appendEntries(ActorRef sender,
+        AppendEntries appendEntries) {
+
+        // 1. Reply false if term < currentTerm (§5.1)
+        if (appendEntries.getTerm() < currentTerm()) {
+            context.getLogger().debug(
+                "Cannot append entries because sender term " + appendEntries
+                    .getTerm() + " is less than " + currentTerm());
+            sender.tell(
+                new AppendEntriesReply(context.getId(), currentTerm(), false,
+                    lastIndex(), lastTerm()), actor()
+            );
+            return state();
+        }
+
+
+        return handleAppendEntries(sender, appendEntries);
+    }
+
+    /**
+     * Derived classes should not directly handle AppendEntriesReply messages it
+     * should let the base class handle it first. Once the base class handles
+     * the AppendEntriesReply message and does the common actions that are
+     * applicable in all RaftState's it will delegate the handling of the
+     * AppendEntriesReply message to the derived class to do more state specific
+     * handling by calling this method
+     *
+     * @param sender             The actor that sent this message
+     * @param appendEntriesReply The AppendEntriesReply message
+     * @return
+     */
+    protected abstract RaftState handleAppendEntriesReply(ActorRef sender,
+        AppendEntriesReply appendEntriesReply);
+
+    /**
+     * requestVote handles the RequestVote message. This logic is common
+     * for all behaviors
+     *
+     * @param sender
+     * @param requestVote
+     * @return
+     */
+    protected RaftState requestVote(ActorRef sender,
+        RequestVote requestVote) {
+
+        boolean grantVote = false;
+
+        //  Reply false if term < currentTerm (§5.1)
+        if (requestVote.getTerm() < currentTerm()) {
+            grantVote = false;
+
+            // If votedFor is null or candidateId, and candidate’s log is at
+            // least as up-to-date as receiver’s log, grant vote (§5.2, Â§5.4)
+        } else if (votedFor() == null || votedFor()
+            .equals(requestVote.getCandidateId())) {
+
+            boolean candidateLatest = false;
+
+            // From Â§5.4.1
+            // Raft determines which of two logs is more up-to-date
+            // by comparing the index and term of the last entries in the
+            // logs. If the logs have last entries with different terms, then
+            // the log with the later term is more up-to-date. If the logs
+            // end with the same term, then whichever log is longer is
+            // more up-to-date.
+            if (requestVote.getLastLogTerm() > lastTerm()) {
+                candidateLatest = true;
+            } else if ((requestVote.getLastLogTerm() == lastTerm())
+                && requestVote.getLastLogIndex() >= lastIndex()) {
+                candidateLatest = true;
+            }
+
+            if (candidateLatest) {
+                grantVote = true;
+                context.getTermInformation().updateAndPersist(requestVote.getTerm(),
+                    requestVote.getCandidateId());
+            }
+        }
+
+        sender.tell(new RequestVoteReply(currentTerm(), grantVote), actor());
+
+        return state();
+    }
+
+    /**
+     * Derived classes should not directly handle RequestVoteReply messages it
+     * should let the base class handle it first. Once the base class handles
+     * the RequestVoteReply message and does the common actions that are
+     * applicable in all RaftState's it will delegate the handling of the
+     * RequestVoteReply message to the derived class to do more state specific
+     * handling by calling this method
+     *
+     * @param sender           The actor that sent this message
+     * @param requestVoteReply The RequestVoteReply message
+     * @return
+     */
+    protected abstract RaftState handleRequestVoteReply(ActorRef sender,
+        RequestVoteReply requestVoteReply);
+
+    /**
+     * Creates a random election duration
+     *
+     * @return
+     */
+    protected FiniteDuration electionDuration() {
+        long variance = new Random().nextInt(ELECTION_TIME_MAX_VARIANCE);
+        return new FiniteDuration(ELECTION_TIME_INTERVAL + variance,
+            TimeUnit.MILLISECONDS);
+    }
+
+    /**
+     * stop the scheduled election
+     */
+    protected void stopElection() {
+        if (electionCancel != null && !electionCancel.isCancelled()) {
+            electionCancel.cancel();
+        }
+    }
+
+    /**
+     * schedule a new election
+     *
+     * @param interval
+     */
+    protected void scheduleElection(FiniteDuration interval) {
+        stopElection();
+
+        // Schedule an election. When the scheduler triggers an ElectionTimeout
+        // message is sent to itself
+        electionCancel =
+            context.getActorSystem().scheduler().scheduleOnce(interval,
+                context.getActor(), new ElectionTimeout(),
+                context.getActorSystem().dispatcher(), context.getActor());
+    }
+
+    /**
+     * Get the current term
+     * @return
+     */
+    protected long currentTerm() {
+        return context.getTermInformation().getCurrentTerm();
+    }
+
+    /**
+     * Get the candidate for whom we voted in the current term
+     * @return
+     */
+    protected String votedFor() {
+        return context.getTermInformation().getVotedFor();
+    }
+
+    /**
+     * Get the actor associated with this behavior
+     * @return
+     */
+    protected ActorRef actor() {
+        return context.getActor();
+    }
+
+    /**
+     * Get the term from the last entry in the log
+     *
+     * @return
+     */
+    protected long lastTerm() {
+        return context.getReplicatedLog().lastTerm();
+    }
+
+    /**
+     * Get the index from the last entry in the log
+     *
+     * @return
+     */
+    protected long lastIndex() {
+        return context.getReplicatedLog().lastIndex();
+    }
+
+    /**
+     * Find the client request tracker for a specific logIndex
+     *
+     * @param logIndex
+     * @return
+     */
+    protected ClientRequestTracker findClientRequestTracker(long logIndex) {
+        return null;
+    }
+
+    /**
+     * Find the log index from the previous to last entry in the log
+     *
+     * @return
+     */
+    protected long prevLogIndex(long index){
+        ReplicatedLogEntry prevEntry =
+            context.getReplicatedLog().get(index - 1);
+        if (prevEntry != null) {
+            return prevEntry.getIndex();
+        }
+        return -1;
+    }
+
+    /**
+     * Find the log term from the previous to last entry in the log
+     * @return
+     */
+    protected long prevLogTerm(long index){
+        ReplicatedLogEntry prevEntry =
+            context.getReplicatedLog().get(index - 1);
+        if (prevEntry != null) {
+            return prevEntry.getTerm();
+        }
+        return -1;
+    }
+
+    /**
+     * Apply the provided index to the state machine
+     *
+     * @param index a log index that is known to be committed
+     */
+    protected void applyLogToStateMachine(long index) {
+        // Now maybe we apply to the state machine
+        for (long i = context.getLastApplied() + 1;
+             i < index + 1; i++) {
+            ActorRef clientActor = null;
+            String identifier = null;
+            ClientRequestTracker tracker = findClientRequestTracker(i);
+
+            if (tracker != null) {
+                clientActor = tracker.getClientActor();
+                identifier = tracker.getIdentifier();
+            }
+            ReplicatedLogEntry replicatedLogEntry =
+                context.getReplicatedLog().get(i);
+
+            if (replicatedLogEntry != null) {
+                actor().tell(new ApplyState(clientActor, identifier,
+                    replicatedLogEntry), actor());
+            } else {
+                context.getLogger().error(
+                    "Missing index " + i + " from log. Cannot apply state.");
+            }
+        }
+        // Send a local message to the local RaftActor (it's derived class to be
+        // specific to apply the log to it's index)
+        context.setLastApplied(index);
+    }
+
+    protected Object fromSerializableMessage(Object serializable){
+        return SerializationUtils.fromSerializable(serializable);
+    }
+
+    @Override
+    public RaftState handleMessage(ActorRef sender, Object message) {
+        if (message instanceof AppendEntries) {
+            return appendEntries(sender, (AppendEntries) message);
+        } else if (message instanceof AppendEntriesReply) {
+            return handleAppendEntriesReply(sender, (AppendEntriesReply) message);
+        } else if (message instanceof RequestVote) {
+            return requestVote(sender, (RequestVote) message);
+        } else if (message instanceof RequestVoteReply) {
+            return handleRequestVoteReply(sender, (RequestVoteReply) message);
+        }
+        return state();
+    }
+
+    @Override public String getLeaderId() {
+        return leaderId;
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Candidate.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Candidate.java
new file mode 100644 (file)
index 0000000..c125bd3
--- /dev/null
@@ -0,0 +1,186 @@
+/*
+ * 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.raft.behaviors;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSelection;
+import org.opendaylight.controller.cluster.raft.RaftActorContext;
+import org.opendaylight.controller.cluster.raft.RaftState;
+import org.opendaylight.controller.cluster.raft.base.messages.ElectionTimeout;
+import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
+import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
+import org.opendaylight.controller.cluster.raft.messages.RaftRPC;
+import org.opendaylight.controller.cluster.raft.messages.RequestVote;
+import org.opendaylight.controller.cluster.raft.messages.RequestVoteReply;
+
+import java.util.Set;
+
+/**
+ * The behavior of a RaftActor when it is in the CandidateState
+ * <p/>
+ * Candidates (§5.2):
+ * <ul>
+ * <li> On conversion to candidate, start election:
+ * <ul>
+ * <li> Increment currentTerm
+ * <li> Vote for self
+ * <li> Reset election timer
+ * <li> Send RequestVote RPCs to all other servers
+ * </ul>
+ * <li> If votes received from majority of servers: become leader
+ * <li> If AppendEntries RPC received from new leader: convert to
+ * follower
+ * <li> If election timeout elapses: start new election
+ * </ul>
+ */
+public class Candidate extends AbstractRaftActorBehavior {
+
+    private int voteCount;
+
+    private final int votesRequired;
+
+    private final Set<String> peers;
+
+    public Candidate(RaftActorContext context) {
+        super(context);
+
+        peers = context.getPeerAddresses().keySet();
+
+        context.getLogger().debug("Election:Candidate has following peers:"+ peers);
+
+        if(peers.size() > 0) {
+            // Votes are required from a majority of the peers including self.
+            // The votesRequired field therefore stores a calculated value
+            // of the number of votes required for this candidate to win an
+            // election based on it's known peers.
+            // If a peer was added during normal operation and raft replicas
+            // came to know about them then the new peer would also need to be
+            // taken into consideration when calculating this value.
+            // Here are some examples for what the votesRequired would be for n
+            // peers
+            // 0 peers = 1 votesRequired (0 + 1) / 2 + 1 = 1
+            // 2 peers = 2 votesRequired (2 + 1) / 2 + 1 = 2
+            // 4 peers = 3 votesRequired (4 + 1) / 2 + 1 = 3
+            int noOfPeers = peers.size();
+            int self = 1;
+            votesRequired = (noOfPeers + self) / 2 + 1;
+        } else {
+            votesRequired = 0;
+        }
+
+        startNewTerm();
+        scheduleElection(electionDuration());
+    }
+
+    @Override protected RaftState handleAppendEntries(ActorRef sender,
+        AppendEntries appendEntries) {
+
+        context.getLogger().info("Candidate: Received {}", appendEntries.toString());
+
+        return state();
+    }
+
+    @Override protected RaftState handleAppendEntriesReply(ActorRef sender,
+        AppendEntriesReply appendEntriesReply) {
+
+        return state();
+    }
+
+    @Override protected RaftState handleRequestVoteReply(ActorRef sender,
+        RequestVoteReply requestVoteReply) {
+
+        if (requestVoteReply.isVoteGranted()) {
+            voteCount++;
+        }
+
+        if (voteCount >= votesRequired) {
+            return RaftState.Leader;
+        }
+
+        return state();
+    }
+
+    @Override public RaftState state() {
+        return RaftState.Candidate;
+    }
+
+    @Override
+    public RaftState handleMessage(ActorRef sender, Object originalMessage) {
+
+        Object message = fromSerializableMessage(originalMessage);
+
+        if (message instanceof RaftRPC) {
+
+            RaftRPC rpc = (RaftRPC) message;
+
+            context.getLogger().debug("RaftRPC message received {} my term is {}", rpc.toString(), context.getTermInformation().getCurrentTerm());
+
+            // If RPC request or response contains term T > currentTerm:
+            // set currentTerm = T, convert to follower (§5.1)
+            // This applies to all RPC messages and responses
+            if (rpc.getTerm() > context.getTermInformation().getCurrentTerm()) {
+                context.getTermInformation().updateAndPersist(rpc.getTerm(), null);
+                return RaftState.Follower;
+            }
+        }
+
+        if (message instanceof ElectionTimeout) {
+            if (votesRequired == 0) {
+                // If there are no peers then we should be a Leader
+                // We wait for the election timeout to occur before declare
+                // ourselves the leader. This gives enough time for a leader
+                // who we do not know about (as a peer)
+                // to send a message to the candidate
+                return RaftState.Leader;
+            }
+            startNewTerm();
+            scheduleElection(electionDuration());
+            return state();
+        }
+
+        return super.handleMessage(sender, message);
+    }
+
+
+    private void startNewTerm() {
+
+
+        // set voteCount back to 1 (that is voting for self)
+        voteCount = 1;
+
+        // Increment the election term and vote for self
+        long currentTerm = context.getTermInformation().getCurrentTerm();
+        context.getTermInformation().updateAndPersist(currentTerm + 1,
+            context.getId());
+
+        context.getLogger().debug("Starting new term " + (currentTerm + 1));
+
+        // Request for a vote
+        // TODO: Retry request for vote if replies do not arrive in a reasonable
+        // amount of time TBD
+        for (String peerId : peers) {
+            ActorSelection peerActor = context.getPeerActorSelection(peerId);
+            if(peerActor != null) {
+                peerActor.tell(new RequestVote(
+                        context.getTermInformation().getCurrentTerm(),
+                        context.getId(),
+                        context.getReplicatedLog().lastIndex(),
+                        context.getReplicatedLog().lastTerm()),
+                    context.getActor()
+                );
+            }
+        }
+
+
+    }
+
+    @Override public void close() throws Exception {
+        stopElection();
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Follower.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Follower.java
new file mode 100644 (file)
index 0000000..db62dfc
--- /dev/null
@@ -0,0 +1,253 @@
+/*
+ * 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.raft.behaviors;
+
+import akka.actor.ActorRef;
+import org.opendaylight.controller.cluster.raft.RaftActorContext;
+import org.opendaylight.controller.cluster.raft.RaftState;
+import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
+import org.opendaylight.controller.cluster.raft.base.messages.ApplySnapshot;
+import org.opendaylight.controller.cluster.raft.base.messages.ElectionTimeout;
+import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
+import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
+import org.opendaylight.controller.cluster.raft.messages.InstallSnapshot;
+import org.opendaylight.controller.cluster.raft.messages.RaftRPC;
+import org.opendaylight.controller.cluster.raft.messages.RequestVoteReply;
+
+/**
+ * The behavior of a RaftActor in the Follower state
+ * <p/>
+ * <ul>
+ * <li> Respond to RPCs from candidates and leaders
+ * <li> If election timeout elapses without receiving AppendEntries
+ * RPC from current leader or granting vote to candidate:
+ * convert to candidate
+ * </ul>
+ */
+public class Follower extends AbstractRaftActorBehavior {
+    public Follower(RaftActorContext context) {
+        super(context);
+
+        scheduleElection(electionDuration());
+    }
+
+    @Override protected RaftState handleAppendEntries(ActorRef sender,
+        AppendEntries appendEntries) {
+
+        if(appendEntries.getEntries() != null && appendEntries.getEntries().size() > 0) {
+            context.getLogger()
+                .info("Follower: Received {}", appendEntries.toString());
+        }
+
+        // TODO : Refactor this method into a bunch of smaller methods
+        // to make it easier to read. Before refactoring ensure tests
+        // cover the code properly
+
+        // 1. Reply false if term < currentTerm (§5.1)
+        // This is handled in the appendEntries method of the base class
+
+        // If we got here then we do appear to be talking to the leader
+        leaderId = appendEntries.getLeaderId();
+
+        // 2. Reply false if log doesn’t contain an entry at prevLogIndex
+        // whose term matches prevLogTerm (§5.3)
+
+        ReplicatedLogEntry previousEntry = context.getReplicatedLog()
+            .get(appendEntries.getPrevLogIndex());
+
+
+        boolean outOfSync = true;
+
+        // First check if the logs are in sync or not
+        if (lastIndex() == -1
+            && appendEntries.getPrevLogIndex() != -1) {
+
+            // The follower's log is out of sync because the leader does have
+            // an entry at prevLogIndex and this follower has no entries in
+            // it's log.
+
+            context.getLogger().debug(
+                "The followers log is empty and the senders prevLogIndex is {}",
+                appendEntries.getPrevLogIndex());
+
+        } else if (lastIndex() > -1
+            && appendEntries.getPrevLogIndex() != -1
+            && previousEntry == null) {
+
+            // The follower's log is out of sync because the Leader's
+            // prevLogIndex entry was not found in it's log
+
+            context.getLogger().debug(
+                "The log is not empty but the prevLogIndex {} was not found in it",
+                appendEntries.getPrevLogIndex());
+
+        } else if (lastIndex() > -1
+            && previousEntry != null
+            && previousEntry.getTerm()!= appendEntries.getPrevLogTerm()) {
+
+            // The follower's log is out of sync because the Leader's
+            // prevLogIndex entry does exist in the follower's log but it has
+            // a different term in it
+
+            context.getLogger().debug(
+                "Cannot append entries because previous entry term {}  is not equal to append entries prevLogTerm {}"
+                , previousEntry.getTerm()
+                , appendEntries.getPrevLogTerm());
+        } else {
+            outOfSync = false;
+        }
+
+        if (outOfSync) {
+            // We found that the log was out of sync so just send a negative
+            // reply and return
+            sender.tell(
+                new AppendEntriesReply(context.getId(), currentTerm(), false,
+                    lastIndex(), lastTerm()), actor()
+            );
+            return state();
+        }
+
+        if (appendEntries.getEntries() != null
+            && appendEntries.getEntries().size() > 0) {
+            context.getLogger().debug(
+                "Number of entries to be appended = " + appendEntries
+                    .getEntries().size()
+            );
+
+            // 3. If an existing entry conflicts with a new one (same index
+            // but different terms), delete the existing entry and all that
+            // follow it (§5.3)
+            int addEntriesFrom = 0;
+            if (context.getReplicatedLog().size() > 0) {
+
+                // Find the entry up until which the one that is not in the
+                // follower's log
+                for (int i = 0;
+                     i < appendEntries.getEntries()
+                         .size(); i++, addEntriesFrom++) {
+                    ReplicatedLogEntry matchEntry =
+                        appendEntries.getEntries().get(i);
+                    ReplicatedLogEntry newEntry = context.getReplicatedLog()
+                        .get(matchEntry.getIndex());
+
+                    if (newEntry == null) {
+                        //newEntry not found in the log
+                        break;
+                    }
+
+                    if (newEntry.getTerm() == matchEntry
+                        .getTerm()) {
+                        continue;
+                    }
+
+                    context.getLogger().debug(
+                        "Removing entries from log starting at "
+                            + matchEntry.getIndex()
+                    );
+
+                    // Entries do not match so remove all subsequent entries
+                    context.getReplicatedLog()
+                        .removeFromAndPersist(matchEntry.getIndex());
+                    break;
+                }
+            }
+
+            context.getLogger().debug(
+                "After cleanup entries to be added from = " + (addEntriesFrom
+                    + lastIndex())
+            );
+
+            // 4. Append any new entries not already in the log
+            for (int i = addEntriesFrom;
+                 i < appendEntries.getEntries().size(); i++) {
+
+                context.getLogger().info(
+                    "Append entry to log " + appendEntries.getEntries().get(
+                        i).getData()
+                        .toString()
+                );
+                context.getReplicatedLog()
+                    .appendAndPersist(appendEntries.getEntries().get(i));
+            }
+
+            context.getLogger().debug(
+                "Log size is now " + context.getReplicatedLog().size());
+        }
+
+
+        // 5. If leaderCommit > commitIndex, set commitIndex =
+        // min(leaderCommit, index of last new entry)
+
+        long prevCommitIndex = context.getCommitIndex();
+
+        context.setCommitIndex(Math.min(appendEntries.getLeaderCommit(),
+            context.getReplicatedLog().lastIndex()));
+
+        if (prevCommitIndex != context.getCommitIndex()) {
+            context.getLogger()
+                .debug("Commit index set to " + context.getCommitIndex());
+        }
+
+        // If commitIndex > lastApplied: increment lastApplied, apply
+        // log[lastApplied] to state machine (§5.3)
+        if (appendEntries.getLeaderCommit() > context.getLastApplied()) {
+            applyLogToStateMachine(appendEntries.getLeaderCommit());
+        }
+
+        sender.tell(new AppendEntriesReply(context.getId(), currentTerm(), true,
+            lastIndex(), lastTerm()), actor());
+
+        return state();
+    }
+
+    @Override protected RaftState handleAppendEntriesReply(ActorRef sender,
+        AppendEntriesReply appendEntriesReply) {
+        return state();
+    }
+
+    @Override protected RaftState handleRequestVoteReply(ActorRef sender,
+        RequestVoteReply requestVoteReply) {
+        return state();
+    }
+
+    @Override public RaftState state() {
+        return RaftState.Follower;
+    }
+
+    @Override public RaftState handleMessage(ActorRef sender, Object originalMessage) {
+
+        Object message = fromSerializableMessage(originalMessage);
+
+        if (message instanceof RaftRPC) {
+            RaftRPC rpc = (RaftRPC) message;
+            // If RPC request or response contains term T > currentTerm:
+            // set currentTerm = T, convert to follower (§5.1)
+            // This applies to all RPC messages and responses
+            if (rpc.getTerm() > context.getTermInformation().getCurrentTerm()) {
+                context.getTermInformation().updateAndPersist(rpc.getTerm(), null);
+            }
+        }
+
+        if (message instanceof ElectionTimeout) {
+            return RaftState.Candidate;
+
+        } else if (message instanceof InstallSnapshot) {
+            InstallSnapshot installSnapshot = (InstallSnapshot) message;
+            actor().tell(new ApplySnapshot(installSnapshot.getData()), actor());
+        }
+
+        scheduleElection(electionDuration());
+
+        return super.handleMessage(sender, message);
+    }
+
+    @Override public void close() throws Exception {
+        stopElection();
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Leader.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Leader.java
new file mode 100644 (file)
index 0000000..53e47c2
--- /dev/null
@@ -0,0 +1,427 @@
+/*
+ * 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.raft.behaviors;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSelection;
+import akka.actor.Cancellable;
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.cluster.raft.ClientRequestTracker;
+import org.opendaylight.controller.cluster.raft.ClientRequestTrackerImpl;
+import org.opendaylight.controller.cluster.raft.FollowerLogInformation;
+import org.opendaylight.controller.cluster.raft.FollowerLogInformationImpl;
+import org.opendaylight.controller.cluster.raft.RaftActorContext;
+import org.opendaylight.controller.cluster.raft.RaftState;
+import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
+import org.opendaylight.controller.cluster.raft.base.messages.ApplyState;
+import org.opendaylight.controller.cluster.raft.base.messages.Replicate;
+import org.opendaylight.controller.cluster.raft.base.messages.SendHeartBeat;
+import org.opendaylight.controller.cluster.raft.base.messages.SendInstallSnapshot;
+import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
+import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
+import org.opendaylight.controller.cluster.raft.messages.InstallSnapshot;
+import org.opendaylight.controller.cluster.raft.messages.InstallSnapshotReply;
+import org.opendaylight.controller.cluster.raft.messages.RaftRPC;
+import org.opendaylight.controller.cluster.raft.messages.RequestVoteReply;
+import scala.concurrent.duration.FiniteDuration;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * The behavior of a RaftActor when it is in the Leader state
+ * <p/>
+ * Leaders:
+ * <ul>
+ * <li> Upon election: send initial empty AppendEntries RPCs
+ * (heartbeat) to each server; repeat during idle periods to
+ * prevent election timeouts (§5.2)
+ * <li> If command received from client: append entry to local log,
+ * respond after entry applied to state machine (§5.3)
+ * <li> If last log index â‰¥ nextIndex for a follower: send
+ * AppendEntries RPC with log entries starting at nextIndex
+ * <ul>
+ * <li> If successful: update nextIndex and matchIndex for
+ * follower (§5.3)
+ * <li> If AppendEntries fails because of log inconsistency:
+ * decrement nextIndex and retry (§5.3)
+ * </ul>
+ * <li> If there exists an N such that N > commitIndex, a majority
+ * of matchIndex[i] â‰¥ N, and log[N].term == currentTerm:
+ * set commitIndex = N (§5.3, Â§5.4).
+ */
+public class Leader extends AbstractRaftActorBehavior {
+
+
+    private final Map<String, FollowerLogInformation> followerToLog =
+        new HashMap();
+
+    private final Set<String> followers;
+
+    private Cancellable heartbeatSchedule = null;
+    private Cancellable appendEntriesSchedule = null;
+    private Cancellable installSnapshotSchedule = null;
+
+    private List<ClientRequestTracker> trackerList = new ArrayList<>();
+
+    private final int minReplicationCount;
+
+    public Leader(RaftActorContext context) {
+        super(context);
+
+        if (lastIndex() >= 0) {
+            context.setCommitIndex(lastIndex());
+        }
+
+        followers = context.getPeerAddresses().keySet();
+
+        for (String followerId : followers) {
+            FollowerLogInformation followerLogInformation =
+                new FollowerLogInformationImpl(followerId,
+                    new AtomicLong(lastIndex()),
+                    new AtomicLong(-1));
+
+            followerToLog.put(followerId, followerLogInformation);
+        }
+
+        context.getLogger().debug("Election:Leader has following peers:"+ followers);
+
+        if (followers.size() > 0) {
+            minReplicationCount = (followers.size() + 1) / 2 + 1;
+        } else {
+            minReplicationCount = 0;
+        }
+
+
+        // Immediately schedule a heartbeat
+        // Upon election: send initial empty AppendEntries RPCs
+        // (heartbeat) to each server; repeat during idle periods to
+        // prevent election timeouts (§5.2)
+        scheduleHeartBeat(new FiniteDuration(0, TimeUnit.SECONDS));
+
+        scheduleInstallSnapshotCheck(
+            new FiniteDuration(HEART_BEAT_INTERVAL.length() * 1000,
+                HEART_BEAT_INTERVAL.unit())
+        );
+
+    }
+
+    @Override protected RaftState handleAppendEntries(ActorRef sender,
+        AppendEntries appendEntries) {
+
+        context.getLogger().info("Leader: Received {}", appendEntries.toString());
+
+        return state();
+    }
+
+    @Override protected RaftState handleAppendEntriesReply(ActorRef sender,
+        AppendEntriesReply appendEntriesReply) {
+
+        if(! appendEntriesReply.isSuccess()) {
+            context.getLogger()
+                .info("Leader: Received {}", appendEntriesReply.toString());
+        }
+
+        // Update the FollowerLogInformation
+        String followerId = appendEntriesReply.getFollowerId();
+        FollowerLogInformation followerLogInformation =
+            followerToLog.get(followerId);
+
+        if(followerLogInformation == null){
+            context.getLogger().error("Unknown follower {}", followerId);
+            return state();
+        }
+
+        if (appendEntriesReply.isSuccess()) {
+            followerLogInformation
+                .setMatchIndex(appendEntriesReply.getLogLastIndex());
+            followerLogInformation
+                .setNextIndex(appendEntriesReply.getLogLastIndex() + 1);
+        } else {
+
+            // TODO: When we find that the follower is out of sync with the
+            // Leader we simply decrement that followers next index by 1.
+            // Would it be possible to do better than this? The RAFT spec
+            // does not explicitly deal with it but may be something for us to
+            // think about
+
+            followerLogInformation.decrNextIndex();
+        }
+
+        // Now figure out if this reply warrants a change in the commitIndex
+        // If there exists an N such that N > commitIndex, a majority
+        // of matchIndex[i] â‰¥ N, and log[N].term == currentTerm:
+        // set commitIndex = N (§5.3, Â§5.4).
+        for (long N = context.getCommitIndex() + 1; ; N++) {
+            int replicatedCount = 1;
+
+            for (FollowerLogInformation info : followerToLog.values()) {
+                if (info.getMatchIndex().get() >= N) {
+                    replicatedCount++;
+                }
+            }
+
+            if (replicatedCount >= minReplicationCount) {
+                ReplicatedLogEntry replicatedLogEntry =
+                    context.getReplicatedLog().get(N);
+                if (replicatedLogEntry != null
+                    && replicatedLogEntry.getTerm()
+                    == currentTerm()) {
+                    context.setCommitIndex(N);
+                }
+            } else {
+                break;
+            }
+        }
+
+        // Apply the change to the state machine
+        if (context.getCommitIndex() > context.getLastApplied()) {
+            applyLogToStateMachine(context.getCommitIndex());
+        }
+
+        return state();
+    }
+
+    protected ClientRequestTracker findClientRequestTracker(long logIndex) {
+        for (ClientRequestTracker tracker : trackerList) {
+            if (tracker.getIndex() == logIndex) {
+                return tracker;
+            }
+        }
+
+        return null;
+    }
+
+    @Override protected RaftState handleRequestVoteReply(ActorRef sender,
+        RequestVoteReply requestVoteReply) {
+        return state();
+    }
+
+    @Override public RaftState state() {
+        return RaftState.Leader;
+    }
+
+    @Override public RaftState handleMessage(ActorRef sender, Object originalMessage) {
+        Preconditions.checkNotNull(sender, "sender should not be null");
+
+        Object message = fromSerializableMessage(originalMessage);
+
+        if (message instanceof RaftRPC) {
+            RaftRPC rpc = (RaftRPC) message;
+            // If RPC request or response contains term T > currentTerm:
+            // set currentTerm = T, convert to follower (§5.1)
+            // This applies to all RPC messages and responses
+            if (rpc.getTerm() > context.getTermInformation().getCurrentTerm()) {
+                context.getTermInformation().updateAndPersist(rpc.getTerm(), null);
+                return RaftState.Follower;
+            }
+        }
+
+        try {
+            if (message instanceof SendHeartBeat) {
+                return sendHeartBeat();
+            } else if(message instanceof SendInstallSnapshot) {
+                installSnapshotIfNeeded();
+            } else if (message instanceof Replicate) {
+                replicate((Replicate) message);
+            } else if (message instanceof InstallSnapshotReply){
+                handleInstallSnapshotReply(
+                    (InstallSnapshotReply) message);
+            }
+        } finally {
+            scheduleHeartBeat(HEART_BEAT_INTERVAL);
+        }
+
+        return super.handleMessage(sender, message);
+    }
+
+    private void handleInstallSnapshotReply(InstallSnapshotReply message) {
+        InstallSnapshotReply reply = message;
+        String followerId = reply.getFollowerId();
+        FollowerLogInformation followerLogInformation =
+            followerToLog.get(followerId);
+
+        followerLogInformation
+            .setMatchIndex(context.getReplicatedLog().getSnapshotIndex());
+        followerLogInformation
+            .setNextIndex(context.getReplicatedLog().getSnapshotIndex() + 1);
+    }
+
+    private void replicate(Replicate replicate) {
+        long logIndex = replicate.getReplicatedLogEntry().getIndex();
+
+        context.getLogger().debug("Replicate message " + logIndex);
+
+        if (followers.size() == 0) {
+            context.setCommitIndex(
+                replicate.getReplicatedLogEntry().getIndex());
+
+            context.getActor()
+                .tell(new ApplyState(replicate.getClientActor(),
+                        replicate.getIdentifier(),
+                        replicate.getReplicatedLogEntry()),
+                    context.getActor()
+                );
+        } else {
+
+            // Create a tracker entry we will use this later to notify the
+            // client actor
+            trackerList.add(
+                new ClientRequestTrackerImpl(replicate.getClientActor(),
+                    replicate.getIdentifier(),
+                    logIndex)
+            );
+
+            sendAppendEntries();
+        }
+    }
+
+    private void sendAppendEntries() {
+        // Send an AppendEntries to all followers
+        for (String followerId : followers) {
+            ActorSelection followerActor =
+                context.getPeerActorSelection(followerId);
+
+            if (followerActor != null) {
+                FollowerLogInformation followerLogInformation =
+                    followerToLog.get(followerId);
+
+                long nextIndex = followerLogInformation.getNextIndex().get();
+
+                List<ReplicatedLogEntry> entries = Collections.emptyList();
+
+                if (context.getReplicatedLog().isPresent(nextIndex)) {
+                    // TODO: Instead of sending all entries from nextIndex
+                    // only send a fixed number of entries to each follower
+                    // This is to avoid the situation where there are a lot of
+                    // entries to install for a fresh follower or to a follower
+                    // that has fallen too far behind with the log but yet is not
+                    // eligible to receive a snapshot
+                    entries =
+                        context.getReplicatedLog().getFrom(nextIndex);
+                }
+
+                followerActor.tell(
+                    new AppendEntries(currentTerm(), context.getId(),
+                        prevLogIndex(nextIndex),
+                        prevLogTerm(nextIndex), entries,
+                        context.getCommitIndex()).toSerializable(),
+                    actor()
+                );
+            }
+        }
+    }
+
+    /**
+     * An installSnapshot is scheduled at a interval that is a multiple of
+     * a HEARTBEAT_INTERVAL. This is to avoid the need to check for installing
+     * snapshots at every heartbeat.
+     */
+    private void installSnapshotIfNeeded(){
+        for (String followerId : followers) {
+            ActorSelection followerActor =
+                context.getPeerActorSelection(followerId);
+
+            if(followerActor != null) {
+                FollowerLogInformation followerLogInformation =
+                    followerToLog.get(followerId);
+
+                long nextIndex = followerLogInformation.getNextIndex().get();
+
+                if (!context.getReplicatedLog().isPresent(nextIndex) && context
+                    .getReplicatedLog().isInSnapshot(nextIndex)) {
+                    followerActor.tell(
+                        new InstallSnapshot(currentTerm(), context.getId(),
+                            context.getReplicatedLog().getSnapshotIndex(),
+                            context.getReplicatedLog().getSnapshotTerm(),
+                            context.getReplicatedLog().getSnapshot()
+                        ),
+                        actor()
+                    );
+                }
+            }
+        }
+    }
+
+    private RaftState sendHeartBeat() {
+        if (followers.size() > 0) {
+            sendAppendEntries();
+        }
+        return state();
+    }
+
+    private void stopHeartBeat() {
+        if (heartbeatSchedule != null && !heartbeatSchedule.isCancelled()) {
+            heartbeatSchedule.cancel();
+        }
+    }
+
+    private void stopInstallSnapshotSchedule() {
+        if (installSnapshotSchedule != null && !installSnapshotSchedule.isCancelled()) {
+            installSnapshotSchedule.cancel();
+        }
+    }
+
+    private void scheduleHeartBeat(FiniteDuration interval) {
+        if(followers.size() == 0){
+            // Optimization - do not bother scheduling a heartbeat as there are
+            // no followers
+            return;
+        }
+
+        stopHeartBeat();
+
+        // Schedule a heartbeat. When the scheduler triggers a SendHeartbeat
+        // message is sent to itself.
+        // Scheduling the heartbeat only once here because heartbeats do not
+        // need to be sent if there are other messages being sent to the remote
+        // actor.
+        heartbeatSchedule =
+            context.getActorSystem().scheduler().scheduleOnce(
+                interval,
+                context.getActor(), new SendHeartBeat(),
+                context.getActorSystem().dispatcher(), context.getActor());
+    }
+
+
+    private void scheduleInstallSnapshotCheck(FiniteDuration interval) {
+        if(followers.size() == 0){
+            // Optimization - do not bother scheduling a heartbeat as there are
+            // no followers
+            return;
+        }
+
+        stopInstallSnapshotSchedule();
+
+        // Schedule a message to send append entries to followers that can
+        // accept an append entries with some data in it
+        installSnapshotSchedule =
+            context.getActorSystem().scheduler().scheduleOnce(
+                interval,
+                context.getActor(), new SendInstallSnapshot(),
+                context.getActorSystem().dispatcher(), context.getActor());
+    }
+
+
+
+    @Override public void close() throws Exception {
+        stopHeartBeat();
+    }
+
+    @Override public String getLeaderId() {
+        return context.getId();
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/RaftActorBehavior.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/RaftActorBehavior.java
new file mode 100644 (file)
index 0000000..ca2d916
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * 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.raft.behaviors;
+
+import akka.actor.ActorRef;
+import org.opendaylight.controller.cluster.raft.RaftState;
+
+/**
+ * A RaftActorBehavior represents the specific behavior of a RaftActor
+ * <p>
+ * A RaftActor can behave as one of the following,
+ * <ul>
+ *     <li> Follower </li>
+ *     <li> Candidate </li>
+ *     <li> Leader </li>
+ * </ul>
+ * <p>
+ * In each of these behaviors the Raft Actor handles the same Raft messages
+ * differently.
+ */
+public interface RaftActorBehavior extends AutoCloseable{
+    /**
+     * Handle a message. If the processing of the message warrants a state
+     * change then a new state should be returned otherwise this method should
+     * return the state for the current behavior.
+     *
+     * @param sender The sender of the message
+     * @param message A message that needs to be processed
+     *
+     * @return The new state or self (this)
+     */
+    RaftState handleMessage(ActorRef sender, Object message);
+
+    /**
+     * The state associated with a given behavior
+     *
+     * @return
+     */
+    RaftState state();
+
+    /**
+     *
+     * @return
+     */
+    String getLeaderId();
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/AddRaftPeer.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/AddRaftPeer.java
new file mode 100644 (file)
index 0000000..d1f4c43
--- /dev/null
@@ -0,0 +1,23 @@
+package org.opendaylight.controller.cluster.raft.client.messages;
+
+/**
+ * Created by kramesha on 7/17/14.
+ */
+public class AddRaftPeer {
+
+    private String name;
+    private String address;
+
+    public AddRaftPeer(String name, String address) {
+        this.name = name;
+        this.address = address;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/FindLeader.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/FindLeader.java
new file mode 100644 (file)
index 0000000..a60aea4
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * 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.raft.client.messages;
+
+public class FindLeader {
+
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/FindLeaderReply.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/FindLeaderReply.java
new file mode 100644 (file)
index 0000000..b36ef11
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * 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.raft.client.messages;
+
+public class FindLeaderReply {
+    private final String leaderActor;
+
+    public FindLeaderReply(String leaderActor) {
+        this.leaderActor = leaderActor;
+    }
+
+    public String getLeaderActor() {
+        return leaderActor;
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/RemoveRaftPeer.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/RemoveRaftPeer.java
new file mode 100644 (file)
index 0000000..4b766e0
--- /dev/null
@@ -0,0 +1,16 @@
+package org.opendaylight.controller.cluster.raft.client.messages;
+
+/**
+ * Created by kramesha on 7/17/14.
+ */
+public class RemoveRaftPeer {
+    private String name;
+
+    public RemoveRaftPeer(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AbstractRaftRPC.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AbstractRaftRPC.java
new file mode 100644 (file)
index 0000000..33d8a68
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * 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.raft.messages;
+
+public class AbstractRaftRPC implements RaftRPC {
+    // term
+    protected long term;
+
+    protected AbstractRaftRPC(long term){
+        this.term = term;
+    }
+
+    // added for testing while serialize-messages=on
+    public AbstractRaftRPC() {
+    }
+
+    public long getTerm() {
+        return term;
+    }
+
+    public void setTerm(long term) {
+        this.term = term;
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AppendEntries.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AppendEntries.java
new file mode 100644 (file)
index 0000000..94366ef
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+ * 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.raft.messages;
+
+import com.google.protobuf.GeneratedMessage;
+import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
+import org.opendaylight.controller.cluster.raft.ReplicatedLogImplEntry;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Invoked by leader to replicate log entries (§5.3); also used as
+ * heartbeat (§5.2).
+ */
+public class AppendEntries extends AbstractRaftRPC {
+
+    public static final Class SERIALIZABLE_CLASS = AppendEntriesMessages.AppendEntries.class;
+
+    private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(AppendEntries.class);
+
+    // So that follower can redirect clients
+    private final String leaderId;
+
+    // Index of log entry immediately preceding new ones
+    private final long prevLogIndex;
+
+    // term of prevLogIndex entry
+    private final long prevLogTerm;
+
+    // log entries to store (empty for heartbeat;
+    // may send more than one for efficiency)
+    private final List<ReplicatedLogEntry> entries;
+
+    // leader's commitIndex
+    private final long leaderCommit;
+
+    public AppendEntries(long term, String leaderId, long prevLogIndex,
+        long prevLogTerm, List<ReplicatedLogEntry> entries, long leaderCommit) {
+        super(term);
+        this.leaderId = leaderId;
+        this.prevLogIndex = prevLogIndex;
+        this.prevLogTerm = prevLogTerm;
+        this.entries = entries;
+        this.leaderCommit = leaderCommit;
+    }
+
+    public String getLeaderId() {
+        return leaderId;
+    }
+
+    public long getPrevLogIndex() {
+        return prevLogIndex;
+    }
+
+    public long getPrevLogTerm() {
+        return prevLogTerm;
+    }
+
+    public List<ReplicatedLogEntry> getEntries() {
+        return entries;
+    }
+
+    public long getLeaderCommit() {
+        return leaderCommit;
+    }
+
+    @Override public String toString() {
+        final StringBuilder sb =
+            new StringBuilder("AppendEntries{");
+        sb.append("term=").append(getTerm());
+        sb.append("leaderId='").append(leaderId).append('\'');
+        sb.append(", prevLogIndex=").append(prevLogIndex);
+        sb.append(", prevLogTerm=").append(prevLogTerm);
+        sb.append(", entries=").append(entries);
+        sb.append(", leaderCommit=").append(leaderCommit);
+        sb.append('}');
+        return sb.toString();
+    }
+
+    public <T extends Object> Object toSerializable(){
+        AppendEntriesMessages.AppendEntries.Builder to = AppendEntriesMessages.AppendEntries.newBuilder();
+        to.setTerm(this.getTerm())
+            .setLeaderId(this.getLeaderId())
+            .setPrevLogTerm(this.getPrevLogTerm())
+            .setPrevLogIndex(this.getPrevLogIndex())
+            .setLeaderCommit(this.getLeaderCommit());
+
+        for (ReplicatedLogEntry logEntry : this.getEntries()) {
+
+            AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder arBuilder =
+                AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.newBuilder();
+
+            AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder arpBuilder =
+                AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.newBuilder();
+
+            //get the client specific payload extensions and add them to the payload builder
+            Map<GeneratedMessage.GeneratedExtension, T> map = logEntry.getData().encode();
+            Iterator<Map.Entry<GeneratedMessage.GeneratedExtension, T>> iter = map.entrySet().iterator();
+
+            while (iter.hasNext()) {
+                Map.Entry<GeneratedMessage.GeneratedExtension, T> entry = iter.next();
+                arpBuilder.setExtension(entry.getKey(), entry.getValue());
+            }
+
+            arpBuilder.setClientPayloadClassName(logEntry.getData().getClientPayloadClassName());
+
+            arBuilder.setData(arpBuilder).setIndex(logEntry.getIndex()).setTerm(logEntry.getTerm());
+            to.addLogEntries(arBuilder);
+        }
+
+        return to.build();
+    }
+
+    public static AppendEntries fromSerializable(Object o){
+        AppendEntriesMessages.AppendEntries from = (AppendEntriesMessages.AppendEntries) o;
+
+        List<ReplicatedLogEntry> logEntryList = new ArrayList<>();
+        for (AppendEntriesMessages.AppendEntries.ReplicatedLogEntry leProtoBuff : from.getLogEntriesList()) {
+
+            Payload payload = null ;
+            try {
+                if(leProtoBuff.getData() != null && leProtoBuff.getData().getClientPayloadClassName() != null) {
+                    String clientPayloadClassName = leProtoBuff.getData().getClientPayloadClassName();
+                    payload = (Payload)Class.forName(clientPayloadClassName).newInstance();
+                    payload = payload.decode(leProtoBuff.getData());
+                    payload.setClientPayloadClassName(clientPayloadClassName);
+                } else {
+                    LOG.error("Payload is null or payload does not have client payload class name");
+                }
+
+            } catch (InstantiationException e) {
+                LOG.error("InstantiationException when instantiating "+leProtoBuff.getData().getClientPayloadClassName(), e);
+            } catch (IllegalAccessException e) {
+                LOG.error("IllegalAccessException when accessing "+leProtoBuff.getData().getClientPayloadClassName(), e);
+            } catch (ClassNotFoundException e) {
+                LOG.error("ClassNotFoundException when loading "+leProtoBuff.getData().getClientPayloadClassName(), e);
+            }
+            ReplicatedLogEntry logEntry = new ReplicatedLogImplEntry(
+                leProtoBuff.getIndex(), leProtoBuff.getTerm(), payload);
+            logEntryList.add(logEntry);
+        }
+
+        AppendEntries to = new AppendEntries(from.getTerm(),
+            from.getLeaderId(),
+            from.getPrevLogIndex(),
+            from.getPrevLogTerm(),
+            logEntryList,
+            from.getLeaderCommit());
+
+        return to;
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AppendEntriesReply.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AppendEntriesReply.java
new file mode 100644 (file)
index 0000000..b923baa
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * 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.raft.messages;
+
+/**
+ * Reply for the AppendEntriesRpc message
+ */
+public class AppendEntriesReply extends AbstractRaftRPC {
+
+    // true if follower contained entry matching
+    // prevLogIndex and prevLogTerm
+    private final boolean success;
+
+    // The index of the last entry in the followers log
+    // This will be used to set the matchIndex for the follower on the
+    // Leader
+    private final long logLastIndex;
+
+    private final long logLastTerm;
+
+    // The followerId - this will be used to figure out which follower is
+    // responding
+    private final String followerId;
+
+    public AppendEntriesReply(String followerId, long term, boolean success, long logLastIndex, long logLastTerm) {
+        super(term);
+
+        this.followerId = followerId;
+        this.success = success;
+        this.logLastIndex = logLastIndex;
+        this.logLastTerm = logLastTerm;
+    }
+
+    public long getTerm() {
+        return term;
+    }
+
+    public boolean isSuccess() {
+        return success;
+    }
+
+    public long getLogLastIndex() {
+        return logLastIndex;
+    }
+
+    public long getLogLastTerm() {
+        return logLastTerm;
+    }
+
+    public String getFollowerId() {
+        return followerId;
+    }
+
+    @Override public String toString() {
+        final StringBuilder sb =
+            new StringBuilder("AppendEntriesReply{");
+        sb.append("term=").append(term);
+        sb.append(", success=").append(success);
+        sb.append(", logLastIndex=").append(logLastIndex);
+        sb.append(", logLastTerm=").append(logLastTerm);
+        sb.append(", followerId='").append(followerId).append('\'');
+        sb.append('}');
+        return sb.toString();
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshot.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshot.java
new file mode 100644 (file)
index 0000000..888854f
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * 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.raft.messages;
+
+public class InstallSnapshot extends AbstractRaftRPC {
+
+    private final String leaderId;
+    private final long lastIncludedIndex;
+    private final long lastIncludedTerm;
+    private final Object data;
+
+    public InstallSnapshot(long term, String leaderId, long lastIncludedIndex, long lastIncludedTerm, Object data) {
+        super(term);
+        this.leaderId = leaderId;
+        this.lastIncludedIndex = lastIncludedIndex;
+        this.lastIncludedTerm = lastIncludedTerm;
+        this.data = data;
+    }
+
+    public String getLeaderId() {
+        return leaderId;
+    }
+
+    public long getLastIncludedIndex() {
+        return lastIncludedIndex;
+    }
+
+    public long getLastIncludedTerm() {
+        return lastIncludedTerm;
+    }
+
+    public Object getData() {
+        return data;
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshotReply.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/InstallSnapshotReply.java
new file mode 100644 (file)
index 0000000..85b89b7
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * 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.raft.messages;
+
+public class InstallSnapshotReply extends AbstractRaftRPC {
+
+    // The followerId - this will be used to figure out which follower is
+    // responding
+    private final String followerId;
+
+    protected InstallSnapshotReply(long term, String followerId) {
+        super(term);
+        this.followerId = followerId;
+    }
+
+    public String getFollowerId() {
+        return followerId;
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/RaftRPC.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/RaftRPC.java
new file mode 100644 (file)
index 0000000..10d9998
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * 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.raft.messages;
+
+import java.io.Serializable;
+
+public interface RaftRPC extends Serializable {
+    public long getTerm();
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/RequestVote.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/RequestVote.java
new file mode 100644 (file)
index 0000000..6ef2a06
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * 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.raft.messages;
+
+/**
+ * Invoked by candidates to gather votes (§5.2).
+ */
+public class RequestVote extends AbstractRaftRPC {
+
+    // candidate requesting vote
+    private String candidateId;
+
+    // index of candidate’s last log entry (§5.4)
+    private long lastLogIndex;
+
+    // term of candidate’s last log entry (§5.4)
+    private long lastLogTerm;
+
+    public RequestVote(long term, String candidateId, long lastLogIndex,
+        long lastLogTerm) {
+        super(term);
+        this.candidateId = candidateId;
+        this.lastLogIndex = lastLogIndex;
+        this.lastLogTerm = lastLogTerm;
+    }
+
+    // added for testing while serialize-messages=on
+    public RequestVote() {
+    }
+
+    public long getTerm() {
+        return term;
+    }
+
+    public String getCandidateId() {
+        return candidateId;
+    }
+
+    public long getLastLogIndex() {
+        return lastLogIndex;
+    }
+
+    public long getLastLogTerm() {
+        return lastLogTerm;
+    }
+
+    public void setCandidateId(String candidateId) {
+        this.candidateId = candidateId;
+    }
+
+    public void setLastLogIndex(long lastLogIndex) {
+        this.lastLogIndex = lastLogIndex;
+    }
+
+    public void setLastLogTerm(long lastLogTerm) {
+        this.lastLogTerm = lastLogTerm;
+    }
+
+    @Override public String toString() {
+        final StringBuilder sb =
+            new StringBuilder("RequestVote{");
+        sb.append("term='").append(getTerm()).append('\'');
+        sb.append("candidateId='").append(candidateId).append('\'');
+        sb.append(", lastLogIndex=").append(lastLogIndex);
+        sb.append(", lastLogTerm=").append(lastLogTerm);
+        sb.append('}');
+        return sb.toString();
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/RequestVoteReply.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/RequestVoteReply.java
new file mode 100644 (file)
index 0000000..df80b4e
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * 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.raft.messages;
+
+public class RequestVoteReply extends AbstractRaftRPC {
+
+    // true means candidate received vot
+    private final boolean voteGranted;
+
+    public RequestVoteReply(long term, boolean voteGranted) {
+        super(term);
+        this.voteGranted = voteGranted;
+    }
+
+    public long getTerm() {
+        return term;
+    }
+
+    public boolean isVoteGranted() {
+        return voteGranted;
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/client/messages/Payload.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/client/messages/Payload.java
new file mode 100644 (file)
index 0000000..9a251cd
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * 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.raft.protobuff.client.messages;
+
+
+import com.google.protobuf.GeneratedMessage;
+import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
+
+import java.util.Map;
+
+/**
+ * An instance of a Payload class is meant to be used as the Payload for
+ * AppendEntries.
+ * <p>
+ *
+ * When an actor which is derived from RaftActor attempts to persistData it
+ * must pass an instance of the Payload class. Similarly when state needs to
+ * be applied to the derived RaftActor it will be passed an instance of the
+ * Payload class.
+ * <p>
+ *
+ * To define your own payload do the following,
+ * <ol>
+ *     <li>Create your own protocol buffer message which extends the AppendEntries Payload</li>
+ *     <li>Extend this Payload class</li>
+ *     <li>Implement encode</li>
+ *     <li>Implement decode</li>
+ * </ol>
+ *
+ * Your own protocol buffer message can be create like so, <br/>
+ * <pre>
+ * {@code
+ *
+ * import "AppendEntriesMessages.proto";
+ *
+ * package org.opendaylight.controller.cluster.raft;
+ *
+ * option java_package = "org.opendaylight.controller.cluster.raft.protobuff.messages";
+ * option java_outer_classname = "MockPayloadMessages";
+ *
+ * extend AppendEntries.ReplicatedLogEntry.Payload {
+ *      optional string value = 2;
+ * }
+ * }
+ * </pre>
+ *
+ */
+public abstract class Payload {
+    private String clientPayloadClassName;
+
+    public String getClientPayloadClassName() {
+        return this.getClass().getName();
+    }
+
+    public void setClientPayloadClassName(String clientPayloadClassName) {
+        this.clientPayloadClassName = clientPayloadClassName;
+    }
+
+    /**
+     * Encode the payload data as a protocol buffer extension.
+     * <p>
+     * TODO: Add more meat in here
+     * @param <T>
+     * @return Map of <GeneratedMessage.GeneratedExtension, T>
+     */
+    public abstract <T extends Object> Map<GeneratedMessage.GeneratedExtension, T> encode();
+
+    /**
+     * Decode the protocol buffer payload into a specific Payload as defined
+     * by the class extending RaftActor
+     *
+     * @param payload The payload in protocol buffer format
+     * @return
+     */
+    public abstract Payload decode(
+        AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload payload);
+
+
+
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/messages/AppendEntriesMessages.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/messages/AppendEntriesMessages.java
new file mode 100644 (file)
index 0000000..00aeaf2
--- /dev/null
@@ -0,0 +1,2420 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: AppendEntriesMessages.proto
+
+package org.opendaylight.controller.cluster.raft.protobuff.messages;
+
+public final class AppendEntriesMessages {
+  private AppendEntriesMessages() {}
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistry registry) {
+  }
+  public interface AppendEntriesOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // optional int64 term = 1;
+    /**
+     * <code>optional int64 term = 1;</code>
+     */
+    boolean hasTerm();
+    /**
+     * <code>optional int64 term = 1;</code>
+     */
+    long getTerm();
+
+    // optional string leaderId = 2;
+    /**
+     * <code>optional string leaderId = 2;</code>
+     */
+    boolean hasLeaderId();
+    /**
+     * <code>optional string leaderId = 2;</code>
+     */
+    java.lang.String getLeaderId();
+    /**
+     * <code>optional string leaderId = 2;</code>
+     */
+    com.google.protobuf.ByteString
+        getLeaderIdBytes();
+
+    // optional int64 prevLogIndex = 3;
+    /**
+     * <code>optional int64 prevLogIndex = 3;</code>
+     */
+    boolean hasPrevLogIndex();
+    /**
+     * <code>optional int64 prevLogIndex = 3;</code>
+     */
+    long getPrevLogIndex();
+
+    // optional int64 prevLogTerm = 4;
+    /**
+     * <code>optional int64 prevLogTerm = 4;</code>
+     */
+    boolean hasPrevLogTerm();
+    /**
+     * <code>optional int64 prevLogTerm = 4;</code>
+     */
+    long getPrevLogTerm();
+
+    // repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> 
+        getLogEntriesList();
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getLogEntries(int index);
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    int getLogEntriesCount();
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    java.util.List<? extends org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder> 
+        getLogEntriesOrBuilderList();
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder getLogEntriesOrBuilder(
+        int index);
+
+    // optional int64 leaderCommit = 6;
+    /**
+     * <code>optional int64 leaderCommit = 6;</code>
+     */
+    boolean hasLeaderCommit();
+    /**
+     * <code>optional int64 leaderCommit = 6;</code>
+     */
+    long getLeaderCommit();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries}
+   */
+  public static final class AppendEntries extends
+      com.google.protobuf.GeneratedMessage
+      implements AppendEntriesOrBuilder {
+    // Use AppendEntries.newBuilder() to construct.
+    private AppendEntries(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private AppendEntries(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final AppendEntries defaultInstance;
+    public static AppendEntries getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public AppendEntries getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private AppendEntries(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 8: {
+              bitField0_ |= 0x00000001;
+              term_ = input.readInt64();
+              break;
+            }
+            case 18: {
+              bitField0_ |= 0x00000002;
+              leaderId_ = input.readBytes();
+              break;
+            }
+            case 24: {
+              bitField0_ |= 0x00000004;
+              prevLogIndex_ = input.readInt64();
+              break;
+            }
+            case 32: {
+              bitField0_ |= 0x00000008;
+              prevLogTerm_ = input.readInt64();
+              break;
+            }
+            case 42: {
+              if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
+                logEntries_ = new java.util.ArrayList<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry>();
+                mutable_bitField0_ |= 0x00000010;
+              }
+              logEntries_.add(input.readMessage(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PARSER, extensionRegistry));
+              break;
+            }
+            case 48: {
+              bitField0_ |= 0x00000010;
+              leaderCommit_ = input.readInt64();
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
+          logEntries_ = java.util.Collections.unmodifiableList(logEntries_);
+        }
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<AppendEntries> PARSER =
+        new com.google.protobuf.AbstractParser<AppendEntries>() {
+      public AppendEntries parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new AppendEntries(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<AppendEntries> getParserForType() {
+      return PARSER;
+    }
+
+    public interface ReplicatedLogEntryOrBuilder
+        extends com.google.protobuf.MessageOrBuilder {
+
+      // optional int64 term = 1;
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      boolean hasTerm();
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      long getTerm();
+
+      // optional int64 index = 2;
+      /**
+       * <code>optional int64 index = 2;</code>
+       */
+      boolean hasIndex();
+      /**
+       * <code>optional int64 index = 2;</code>
+       */
+      long getIndex();
+
+      // optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;
+      /**
+       * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+       */
+      boolean hasData();
+      /**
+       * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+       */
+      org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getData();
+      /**
+       * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+       */
+      org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder getDataOrBuilder();
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry}
+     */
+    public static final class ReplicatedLogEntry extends
+        com.google.protobuf.GeneratedMessage
+        implements ReplicatedLogEntryOrBuilder {
+      // Use ReplicatedLogEntry.newBuilder() to construct.
+      private ReplicatedLogEntry(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+        super(builder);
+        this.unknownFields = builder.getUnknownFields();
+      }
+      private ReplicatedLogEntry(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+      private static final ReplicatedLogEntry defaultInstance;
+      public static ReplicatedLogEntry getDefaultInstance() {
+        return defaultInstance;
+      }
+
+      public ReplicatedLogEntry getDefaultInstanceForType() {
+        return defaultInstance;
+      }
+
+      private final com.google.protobuf.UnknownFieldSet unknownFields;
+      @java.lang.Override
+      public final com.google.protobuf.UnknownFieldSet
+          getUnknownFields() {
+        return this.unknownFields;
+      }
+      private ReplicatedLogEntry(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        initFields();
+        int mutable_bitField0_ = 0;
+        com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+            com.google.protobuf.UnknownFieldSet.newBuilder();
+        try {
+          boolean done = false;
+          while (!done) {
+            int tag = input.readTag();
+            switch (tag) {
+              case 0:
+                done = true;
+                break;
+              default: {
+                if (!parseUnknownField(input, unknownFields,
+                                       extensionRegistry, tag)) {
+                  done = true;
+                }
+                break;
+              }
+              case 8: {
+                bitField0_ |= 0x00000001;
+                term_ = input.readInt64();
+                break;
+              }
+              case 16: {
+                bitField0_ |= 0x00000002;
+                index_ = input.readInt64();
+                break;
+              }
+              case 26: {
+                org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder subBuilder = null;
+                if (((bitField0_ & 0x00000004) == 0x00000004)) {
+                  subBuilder = data_.toBuilder();
+                }
+                data_ = input.readMessage(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.PARSER, extensionRegistry);
+                if (subBuilder != null) {
+                  subBuilder.mergeFrom(data_);
+                  data_ = subBuilder.buildPartial();
+                }
+                bitField0_ |= 0x00000004;
+                break;
+              }
+            }
+          }
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          throw e.setUnfinishedMessage(this);
+        } catch (java.io.IOException e) {
+          throw new com.google.protobuf.InvalidProtocolBufferException(
+              e.getMessage()).setUnfinishedMessage(this);
+        } finally {
+          this.unknownFields = unknownFields.build();
+          makeExtensionsImmutable();
+        }
+      }
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder.class);
+      }
+
+      public static com.google.protobuf.Parser<ReplicatedLogEntry> PARSER =
+          new com.google.protobuf.AbstractParser<ReplicatedLogEntry>() {
+        public ReplicatedLogEntry parsePartialFrom(
+            com.google.protobuf.CodedInputStream input,
+            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+            throws com.google.protobuf.InvalidProtocolBufferException {
+          return new ReplicatedLogEntry(input, extensionRegistry);
+        }
+      };
+
+      @java.lang.Override
+      public com.google.protobuf.Parser<ReplicatedLogEntry> getParserForType() {
+        return PARSER;
+      }
+
+      public interface PayloadOrBuilder extends
+          com.google.protobuf.GeneratedMessage.
+              ExtendableMessageOrBuilder<Payload> {
+
+        // optional string clientPayloadClassName = 1;
+        /**
+         * <code>optional string clientPayloadClassName = 1;</code>
+         */
+        boolean hasClientPayloadClassName();
+        /**
+         * <code>optional string clientPayloadClassName = 1;</code>
+         */
+        java.lang.String getClientPayloadClassName();
+        /**
+         * <code>optional string clientPayloadClassName = 1;</code>
+         */
+        com.google.protobuf.ByteString
+            getClientPayloadClassNameBytes();
+      }
+      /**
+       * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload}
+       */
+      public static final class Payload extends
+          com.google.protobuf.GeneratedMessage.ExtendableMessage<
+            Payload> implements PayloadOrBuilder {
+        // Use Payload.newBuilder() to construct.
+        private Payload(com.google.protobuf.GeneratedMessage.ExtendableBuilder<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, ?> builder) {
+          super(builder);
+          this.unknownFields = builder.getUnknownFields();
+        }
+        private Payload(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+        private static final Payload defaultInstance;
+        public static Payload getDefaultInstance() {
+          return defaultInstance;
+        }
+
+        public Payload getDefaultInstanceForType() {
+          return defaultInstance;
+        }
+
+        private final com.google.protobuf.UnknownFieldSet unknownFields;
+        @java.lang.Override
+        public final com.google.protobuf.UnknownFieldSet
+            getUnknownFields() {
+          return this.unknownFields;
+        }
+        private Payload(
+            com.google.protobuf.CodedInputStream input,
+            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+            throws com.google.protobuf.InvalidProtocolBufferException {
+          initFields();
+          int mutable_bitField0_ = 0;
+          com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+              com.google.protobuf.UnknownFieldSet.newBuilder();
+          try {
+            boolean done = false;
+            while (!done) {
+              int tag = input.readTag();
+              switch (tag) {
+                case 0:
+                  done = true;
+                  break;
+                default: {
+                  if (!parseUnknownField(input, unknownFields,
+                                         extensionRegistry, tag)) {
+                    done = true;
+                  }
+                  break;
+                }
+                case 10: {
+                  bitField0_ |= 0x00000001;
+                  clientPayloadClassName_ = input.readBytes();
+                  break;
+                }
+              }
+            }
+          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+            throw e.setUnfinishedMessage(this);
+          } catch (java.io.IOException e) {
+            throw new com.google.protobuf.InvalidProtocolBufferException(
+                e.getMessage()).setUnfinishedMessage(this);
+          } finally {
+            this.unknownFields = unknownFields.build();
+            makeExtensionsImmutable();
+          }
+        }
+        public static final com.google.protobuf.Descriptors.Descriptor
+            getDescriptor() {
+          return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor;
+        }
+
+        protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+            internalGetFieldAccessorTable() {
+          return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_fieldAccessorTable
+              .ensureFieldAccessorsInitialized(
+                  org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder.class);
+        }
+
+        public static com.google.protobuf.Parser<Payload> PARSER =
+            new com.google.protobuf.AbstractParser<Payload>() {
+          public Payload parsePartialFrom(
+              com.google.protobuf.CodedInputStream input,
+              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+              throws com.google.protobuf.InvalidProtocolBufferException {
+            return new Payload(input, extensionRegistry);
+          }
+        };
+
+        @java.lang.Override
+        public com.google.protobuf.Parser<Payload> getParserForType() {
+          return PARSER;
+        }
+
+        private int bitField0_;
+        // optional string clientPayloadClassName = 1;
+        public static final int CLIENTPAYLOADCLASSNAME_FIELD_NUMBER = 1;
+        private java.lang.Object clientPayloadClassName_;
+        /**
+         * <code>optional string clientPayloadClassName = 1;</code>
+         */
+        public boolean hasClientPayloadClassName() {
+          return ((bitField0_ & 0x00000001) == 0x00000001);
+        }
+        /**
+         * <code>optional string clientPayloadClassName = 1;</code>
+         */
+        public java.lang.String getClientPayloadClassName() {
+          java.lang.Object ref = clientPayloadClassName_;
+          if (ref instanceof java.lang.String) {
+            return (java.lang.String) ref;
+          } else {
+            com.google.protobuf.ByteString bs = 
+                (com.google.protobuf.ByteString) ref;
+            java.lang.String s = bs.toStringUtf8();
+            if (bs.isValidUtf8()) {
+              clientPayloadClassName_ = s;
+            }
+            return s;
+          }
+        }
+        /**
+         * <code>optional string clientPayloadClassName = 1;</code>
+         */
+        public com.google.protobuf.ByteString
+            getClientPayloadClassNameBytes() {
+          java.lang.Object ref = clientPayloadClassName_;
+          if (ref instanceof java.lang.String) {
+            com.google.protobuf.ByteString b = 
+                com.google.protobuf.ByteString.copyFromUtf8(
+                    (java.lang.String) ref);
+            clientPayloadClassName_ = b;
+            return b;
+          } else {
+            return (com.google.protobuf.ByteString) ref;
+          }
+        }
+
+        private void initFields() {
+          clientPayloadClassName_ = "";
+        }
+        private byte memoizedIsInitialized = -1;
+        public final boolean isInitialized() {
+          byte isInitialized = memoizedIsInitialized;
+          if (isInitialized != -1) return isInitialized == 1;
+
+          if (!extensionsAreInitialized()) {
+            memoizedIsInitialized = 0;
+            return false;
+          }
+          memoizedIsInitialized = 1;
+          return true;
+        }
+
+        public void writeTo(com.google.protobuf.CodedOutputStream output)
+                            throws java.io.IOException {
+          getSerializedSize();
+          com.google.protobuf.GeneratedMessage
+            .ExtendableMessage<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload>.ExtensionWriter extensionWriter =
+              newExtensionWriter();
+          if (((bitField0_ & 0x00000001) == 0x00000001)) {
+            output.writeBytes(1, getClientPayloadClassNameBytes());
+          }
+          extensionWriter.writeUntil(101, output);
+          getUnknownFields().writeTo(output);
+        }
+
+        private int memoizedSerializedSize = -1;
+        public int getSerializedSize() {
+          int size = memoizedSerializedSize;
+          if (size != -1) return size;
+
+          size = 0;
+          if (((bitField0_ & 0x00000001) == 0x00000001)) {
+            size += com.google.protobuf.CodedOutputStream
+              .computeBytesSize(1, getClientPayloadClassNameBytes());
+          }
+          size += extensionsSerializedSize();
+          size += getUnknownFields().getSerializedSize();
+          memoizedSerializedSize = size;
+          return size;
+        }
+
+        private static final long serialVersionUID = 0L;
+        @java.lang.Override
+        protected java.lang.Object writeReplace()
+            throws java.io.ObjectStreamException {
+          return super.writeReplace();
+        }
+
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+            com.google.protobuf.ByteString data)
+            throws com.google.protobuf.InvalidProtocolBufferException {
+          return PARSER.parseFrom(data);
+        }
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+            com.google.protobuf.ByteString data,
+            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+            throws com.google.protobuf.InvalidProtocolBufferException {
+          return PARSER.parseFrom(data, extensionRegistry);
+        }
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(byte[] data)
+            throws com.google.protobuf.InvalidProtocolBufferException {
+          return PARSER.parseFrom(data);
+        }
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+            byte[] data,
+            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+            throws com.google.protobuf.InvalidProtocolBufferException {
+          return PARSER.parseFrom(data, extensionRegistry);
+        }
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(java.io.InputStream input)
+            throws java.io.IOException {
+          return PARSER.parseFrom(input);
+        }
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+            java.io.InputStream input,
+            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+            throws java.io.IOException {
+          return PARSER.parseFrom(input, extensionRegistry);
+        }
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseDelimitedFrom(java.io.InputStream input)
+            throws java.io.IOException {
+          return PARSER.parseDelimitedFrom(input);
+        }
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseDelimitedFrom(
+            java.io.InputStream input,
+            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+            throws java.io.IOException {
+          return PARSER.parseDelimitedFrom(input, extensionRegistry);
+        }
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+            com.google.protobuf.CodedInputStream input)
+            throws java.io.IOException {
+          return PARSER.parseFrom(input);
+        }
+        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+            com.google.protobuf.CodedInputStream input,
+            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+            throws java.io.IOException {
+          return PARSER.parseFrom(input, extensionRegistry);
+        }
+
+        public static Builder newBuilder() { return Builder.create(); }
+        public Builder newBuilderForType() { return newBuilder(); }
+        public static Builder newBuilder(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload prototype) {
+          return newBuilder().mergeFrom(prototype);
+        }
+        public Builder toBuilder() { return newBuilder(this); }
+
+        @java.lang.Override
+        protected Builder newBuilderForType(
+            com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+          Builder builder = new Builder(parent);
+          return builder;
+        }
+        /**
+         * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload}
+         */
+        public static final class Builder extends
+            com.google.protobuf.GeneratedMessage.ExtendableBuilder<
+              org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, Builder> implements org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder {
+          public static final com.google.protobuf.Descriptors.Descriptor
+              getDescriptor() {
+            return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor;
+          }
+
+          protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+              internalGetFieldAccessorTable() {
+            return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_fieldAccessorTable
+                .ensureFieldAccessorsInitialized(
+                    org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder.class);
+          }
+
+          // Construct using org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.newBuilder()
+          private Builder() {
+            maybeForceBuilderInitialization();
+          }
+
+          private Builder(
+              com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+            super(parent);
+            maybeForceBuilderInitialization();
+          }
+          private void maybeForceBuilderInitialization() {
+            if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+            }
+          }
+          private static Builder create() {
+            return new Builder();
+          }
+
+          public Builder clear() {
+            super.clear();
+            clientPayloadClassName_ = "";
+            bitField0_ = (bitField0_ & ~0x00000001);
+            return this;
+          }
+
+          public Builder clone() {
+            return create().mergeFrom(buildPartial());
+          }
+
+          public com.google.protobuf.Descriptors.Descriptor
+              getDescriptorForType() {
+            return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor;
+          }
+
+          public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getDefaultInstanceForType() {
+            return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+          }
+
+          public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload build() {
+            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload result = buildPartial();
+            if (!result.isInitialized()) {
+              throw newUninitializedMessageException(result);
+            }
+            return result;
+          }
+
+          public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload buildPartial() {
+            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload result = new org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload(this);
+            int from_bitField0_ = bitField0_;
+            int to_bitField0_ = 0;
+            if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+              to_bitField0_ |= 0x00000001;
+            }
+            result.clientPayloadClassName_ = clientPayloadClassName_;
+            result.bitField0_ = to_bitField0_;
+            onBuilt();
+            return result;
+          }
+
+          public Builder mergeFrom(com.google.protobuf.Message other) {
+            if (other instanceof org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload) {
+              return mergeFrom((org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload)other);
+            } else {
+              super.mergeFrom(other);
+              return this;
+            }
+          }
+
+          public Builder mergeFrom(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload other) {
+            if (other == org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance()) return this;
+            if (other.hasClientPayloadClassName()) {
+              bitField0_ |= 0x00000001;
+              clientPayloadClassName_ = other.clientPayloadClassName_;
+              onChanged();
+            }
+            this.mergeExtensionFields(other);
+            this.mergeUnknownFields(other.getUnknownFields());
+            return this;
+          }
+
+          public final boolean isInitialized() {
+            if (!extensionsAreInitialized()) {
+              
+              return false;
+            }
+            return true;
+          }
+
+          public Builder mergeFrom(
+              com.google.protobuf.CodedInputStream input,
+              com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+              throws java.io.IOException {
+            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parsedMessage = null;
+            try {
+              parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+            } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+              parsedMessage = (org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload) e.getUnfinishedMessage();
+              throw e;
+            } finally {
+              if (parsedMessage != null) {
+                mergeFrom(parsedMessage);
+              }
+            }
+            return this;
+          }
+          private int bitField0_;
+
+          // optional string clientPayloadClassName = 1;
+          private java.lang.Object clientPayloadClassName_ = "";
+          /**
+           * <code>optional string clientPayloadClassName = 1;</code>
+           */
+          public boolean hasClientPayloadClassName() {
+            return ((bitField0_ & 0x00000001) == 0x00000001);
+          }
+          /**
+           * <code>optional string clientPayloadClassName = 1;</code>
+           */
+          public java.lang.String getClientPayloadClassName() {
+            java.lang.Object ref = clientPayloadClassName_;
+            if (!(ref instanceof java.lang.String)) {
+              java.lang.String s = ((com.google.protobuf.ByteString) ref)
+                  .toStringUtf8();
+              clientPayloadClassName_ = s;
+              return s;
+            } else {
+              return (java.lang.String) ref;
+            }
+          }
+          /**
+           * <code>optional string clientPayloadClassName = 1;</code>
+           */
+          public com.google.protobuf.ByteString
+              getClientPayloadClassNameBytes() {
+            java.lang.Object ref = clientPayloadClassName_;
+            if (ref instanceof String) {
+              com.google.protobuf.ByteString b = 
+                  com.google.protobuf.ByteString.copyFromUtf8(
+                      (java.lang.String) ref);
+              clientPayloadClassName_ = b;
+              return b;
+            } else {
+              return (com.google.protobuf.ByteString) ref;
+            }
+          }
+          /**
+           * <code>optional string clientPayloadClassName = 1;</code>
+           */
+          public Builder setClientPayloadClassName(
+              java.lang.String value) {
+            if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+            clientPayloadClassName_ = value;
+            onChanged();
+            return this;
+          }
+          /**
+           * <code>optional string clientPayloadClassName = 1;</code>
+           */
+          public Builder clearClientPayloadClassName() {
+            bitField0_ = (bitField0_ & ~0x00000001);
+            clientPayloadClassName_ = getDefaultInstance().getClientPayloadClassName();
+            onChanged();
+            return this;
+          }
+          /**
+           * <code>optional string clientPayloadClassName = 1;</code>
+           */
+          public Builder setClientPayloadClassNameBytes(
+              com.google.protobuf.ByteString value) {
+            if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+            clientPayloadClassName_ = value;
+            onChanged();
+            return this;
+          }
+
+          // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload)
+        }
+
+        static {
+          defaultInstance = new Payload(true);
+          defaultInstance.initFields();
+        }
+
+        // @@protoc_insertion_point(class_scope:org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload)
+      }
+
+      private int bitField0_;
+      // optional int64 term = 1;
+      public static final int TERM_FIELD_NUMBER = 1;
+      private long term_;
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public boolean hasTerm() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public long getTerm() {
+        return term_;
+      }
+
+      // optional int64 index = 2;
+      public static final int INDEX_FIELD_NUMBER = 2;
+      private long index_;
+      /**
+       * <code>optional int64 index = 2;</code>
+       */
+      public boolean hasIndex() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>optional int64 index = 2;</code>
+       */
+      public long getIndex() {
+        return index_;
+      }
+
+      // optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;
+      public static final int DATA_FIELD_NUMBER = 3;
+      private org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload data_;
+      /**
+       * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+       */
+      public boolean hasData() {
+        return ((bitField0_ & 0x00000004) == 0x00000004);
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+       */
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getData() {
+        return data_;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+       */
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder getDataOrBuilder() {
+        return data_;
+      }
+
+      private void initFields() {
+        term_ = 0L;
+        index_ = 0L;
+        data_ = org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+      }
+      private byte memoizedIsInitialized = -1;
+      public final boolean isInitialized() {
+        byte isInitialized = memoizedIsInitialized;
+        if (isInitialized != -1) return isInitialized == 1;
+
+        if (hasData()) {
+          if (!getData().isInitialized()) {
+            memoizedIsInitialized = 0;
+            return false;
+          }
+        }
+        memoizedIsInitialized = 1;
+        return true;
+      }
+
+      public void writeTo(com.google.protobuf.CodedOutputStream output)
+                          throws java.io.IOException {
+        getSerializedSize();
+        if (((bitField0_ & 0x00000001) == 0x00000001)) {
+          output.writeInt64(1, term_);
+        }
+        if (((bitField0_ & 0x00000002) == 0x00000002)) {
+          output.writeInt64(2, index_);
+        }
+        if (((bitField0_ & 0x00000004) == 0x00000004)) {
+          output.writeMessage(3, data_);
+        }
+        getUnknownFields().writeTo(output);
+      }
+
+      private int memoizedSerializedSize = -1;
+      public int getSerializedSize() {
+        int size = memoizedSerializedSize;
+        if (size != -1) return size;
+
+        size = 0;
+        if (((bitField0_ & 0x00000001) == 0x00000001)) {
+          size += com.google.protobuf.CodedOutputStream
+            .computeInt64Size(1, term_);
+        }
+        if (((bitField0_ & 0x00000002) == 0x00000002)) {
+          size += com.google.protobuf.CodedOutputStream
+            .computeInt64Size(2, index_);
+        }
+        if (((bitField0_ & 0x00000004) == 0x00000004)) {
+          size += com.google.protobuf.CodedOutputStream
+            .computeMessageSize(3, data_);
+        }
+        size += getUnknownFields().getSerializedSize();
+        memoizedSerializedSize = size;
+        return size;
+      }
+
+      private static final long serialVersionUID = 0L;
+      @java.lang.Override
+      protected java.lang.Object writeReplace()
+          throws java.io.ObjectStreamException {
+        return super.writeReplace();
+      }
+
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+          com.google.protobuf.ByteString data)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return PARSER.parseFrom(data);
+      }
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+          com.google.protobuf.ByteString data,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return PARSER.parseFrom(data, extensionRegistry);
+      }
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(byte[] data)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return PARSER.parseFrom(data);
+      }
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+          byte[] data,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return PARSER.parseFrom(data, extensionRegistry);
+      }
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(java.io.InputStream input)
+          throws java.io.IOException {
+        return PARSER.parseFrom(input);
+      }
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+          java.io.InputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        return PARSER.parseFrom(input, extensionRegistry);
+      }
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseDelimitedFrom(java.io.InputStream input)
+          throws java.io.IOException {
+        return PARSER.parseDelimitedFrom(input);
+      }
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseDelimitedFrom(
+          java.io.InputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        return PARSER.parseDelimitedFrom(input, extensionRegistry);
+      }
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+          com.google.protobuf.CodedInputStream input)
+          throws java.io.IOException {
+        return PARSER.parseFrom(input);
+      }
+      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        return PARSER.parseFrom(input, extensionRegistry);
+      }
+
+      public static Builder newBuilder() { return Builder.create(); }
+      public Builder newBuilderForType() { return newBuilder(); }
+      public static Builder newBuilder(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry prototype) {
+        return newBuilder().mergeFrom(prototype);
+      }
+      public Builder toBuilder() { return newBuilder(this); }
+
+      @java.lang.Override
+      protected Builder newBuilderForType(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        Builder builder = new Builder(parent);
+        return builder;
+      }
+      /**
+       * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry}
+       */
+      public static final class Builder extends
+          com.google.protobuf.GeneratedMessage.Builder<Builder>
+         implements org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder {
+        public static final com.google.protobuf.Descriptors.Descriptor
+            getDescriptor() {
+          return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor;
+        }
+
+        protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+            internalGetFieldAccessorTable() {
+          return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_fieldAccessorTable
+              .ensureFieldAccessorsInitialized(
+                  org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder.class);
+        }
+
+        // Construct using org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.newBuilder()
+        private Builder() {
+          maybeForceBuilderInitialization();
+        }
+
+        private Builder(
+            com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+          super(parent);
+          maybeForceBuilderInitialization();
+        }
+        private void maybeForceBuilderInitialization() {
+          if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+            getDataFieldBuilder();
+          }
+        }
+        private static Builder create() {
+          return new Builder();
+        }
+
+        public Builder clear() {
+          super.clear();
+          term_ = 0L;
+          bitField0_ = (bitField0_ & ~0x00000001);
+          index_ = 0L;
+          bitField0_ = (bitField0_ & ~0x00000002);
+          if (dataBuilder_ == null) {
+            data_ = org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+          } else {
+            dataBuilder_.clear();
+          }
+          bitField0_ = (bitField0_ & ~0x00000004);
+          return this;
+        }
+
+        public Builder clone() {
+          return create().mergeFrom(buildPartial());
+        }
+
+        public com.google.protobuf.Descriptors.Descriptor
+            getDescriptorForType() {
+          return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor;
+        }
+
+        public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getDefaultInstanceForType() {
+          return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance();
+        }
+
+        public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry build() {
+          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry result = buildPartial();
+          if (!result.isInitialized()) {
+            throw newUninitializedMessageException(result);
+          }
+          return result;
+        }
+
+        public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry buildPartial() {
+          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry result = new org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry(this);
+          int from_bitField0_ = bitField0_;
+          int to_bitField0_ = 0;
+          if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+            to_bitField0_ |= 0x00000001;
+          }
+          result.term_ = term_;
+          if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+            to_bitField0_ |= 0x00000002;
+          }
+          result.index_ = index_;
+          if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+            to_bitField0_ |= 0x00000004;
+          }
+          if (dataBuilder_ == null) {
+            result.data_ = data_;
+          } else {
+            result.data_ = dataBuilder_.build();
+          }
+          result.bitField0_ = to_bitField0_;
+          onBuilt();
+          return result;
+        }
+
+        public Builder mergeFrom(com.google.protobuf.Message other) {
+          if (other instanceof org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry) {
+            return mergeFrom((org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry)other);
+          } else {
+            super.mergeFrom(other);
+            return this;
+          }
+        }
+
+        public Builder mergeFrom(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry other) {
+          if (other == org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance()) return this;
+          if (other.hasTerm()) {
+            setTerm(other.getTerm());
+          }
+          if (other.hasIndex()) {
+            setIndex(other.getIndex());
+          }
+          if (other.hasData()) {
+            mergeData(other.getData());
+          }
+          this.mergeUnknownFields(other.getUnknownFields());
+          return this;
+        }
+
+        public final boolean isInitialized() {
+          if (hasData()) {
+            if (!getData().isInitialized()) {
+              
+              return false;
+            }
+          }
+          return true;
+        }
+
+        public Builder mergeFrom(
+            com.google.protobuf.CodedInputStream input,
+            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+            throws java.io.IOException {
+          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parsedMessage = null;
+          try {
+            parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+            parsedMessage = (org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry) e.getUnfinishedMessage();
+            throw e;
+          } finally {
+            if (parsedMessage != null) {
+              mergeFrom(parsedMessage);
+            }
+          }
+          return this;
+        }
+        private int bitField0_;
+
+        // optional int64 term = 1;
+        private long term_ ;
+        /**
+         * <code>optional int64 term = 1;</code>
+         */
+        public boolean hasTerm() {
+          return ((bitField0_ & 0x00000001) == 0x00000001);
+        }
+        /**
+         * <code>optional int64 term = 1;</code>
+         */
+        public long getTerm() {
+          return term_;
+        }
+        /**
+         * <code>optional int64 term = 1;</code>
+         */
+        public Builder setTerm(long value) {
+          bitField0_ |= 0x00000001;
+          term_ = value;
+          onChanged();
+          return this;
+        }
+        /**
+         * <code>optional int64 term = 1;</code>
+         */
+        public Builder clearTerm() {
+          bitField0_ = (bitField0_ & ~0x00000001);
+          term_ = 0L;
+          onChanged();
+          return this;
+        }
+
+        // optional int64 index = 2;
+        private long index_ ;
+        /**
+         * <code>optional int64 index = 2;</code>
+         */
+        public boolean hasIndex() {
+          return ((bitField0_ & 0x00000002) == 0x00000002);
+        }
+        /**
+         * <code>optional int64 index = 2;</code>
+         */
+        public long getIndex() {
+          return index_;
+        }
+        /**
+         * <code>optional int64 index = 2;</code>
+         */
+        public Builder setIndex(long value) {
+          bitField0_ |= 0x00000002;
+          index_ = value;
+          onChanged();
+          return this;
+        }
+        /**
+         * <code>optional int64 index = 2;</code>
+         */
+        public Builder clearIndex() {
+          bitField0_ = (bitField0_ & ~0x00000002);
+          index_ = 0L;
+          onChanged();
+          return this;
+        }
+
+        // optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;
+        private org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload data_ = org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+        private com.google.protobuf.SingleFieldBuilder<
+            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder> dataBuilder_;
+        /**
+         * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+         */
+        public boolean hasData() {
+          return ((bitField0_ & 0x00000004) == 0x00000004);
+        }
+        /**
+         * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+         */
+        public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getData() {
+          if (dataBuilder_ == null) {
+            return data_;
+          } else {
+            return dataBuilder_.getMessage();
+          }
+        }
+        /**
+         * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+         */
+        public Builder setData(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload value) {
+          if (dataBuilder_ == null) {
+            if (value == null) {
+              throw new NullPointerException();
+            }
+            data_ = value;
+            onChanged();
+          } else {
+            dataBuilder_.setMessage(value);
+          }
+          bitField0_ |= 0x00000004;
+          return this;
+        }
+        /**
+         * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+         */
+        public Builder setData(
+            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder builderForValue) {
+          if (dataBuilder_ == null) {
+            data_ = builderForValue.build();
+            onChanged();
+          } else {
+            dataBuilder_.setMessage(builderForValue.build());
+          }
+          bitField0_ |= 0x00000004;
+          return this;
+        }
+        /**
+         * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+         */
+        public Builder mergeData(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload value) {
+          if (dataBuilder_ == null) {
+            if (((bitField0_ & 0x00000004) == 0x00000004) &&
+                data_ != org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance()) {
+              data_ =
+                org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.newBuilder(data_).mergeFrom(value).buildPartial();
+            } else {
+              data_ = value;
+            }
+            onChanged();
+          } else {
+            dataBuilder_.mergeFrom(value);
+          }
+          bitField0_ |= 0x00000004;
+          return this;
+        }
+        /**
+         * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+         */
+        public Builder clearData() {
+          if (dataBuilder_ == null) {
+            data_ = org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+            onChanged();
+          } else {
+            dataBuilder_.clear();
+          }
+          bitField0_ = (bitField0_ & ~0x00000004);
+          return this;
+        }
+        /**
+         * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+         */
+        public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder getDataBuilder() {
+          bitField0_ |= 0x00000004;
+          onChanged();
+          return getDataFieldBuilder().getBuilder();
+        }
+        /**
+         * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+         */
+        public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder getDataOrBuilder() {
+          if (dataBuilder_ != null) {
+            return dataBuilder_.getMessageOrBuilder();
+          } else {
+            return data_;
+          }
+        }
+        /**
+         * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
+         */
+        private com.google.protobuf.SingleFieldBuilder<
+            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder> 
+            getDataFieldBuilder() {
+          if (dataBuilder_ == null) {
+            dataBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+                org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder>(
+                    data_,
+                    getParentForChildren(),
+                    isClean());
+            data_ = null;
+          }
+          return dataBuilder_;
+        }
+
+        // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry)
+      }
+
+      static {
+        defaultInstance = new ReplicatedLogEntry(true);
+        defaultInstance.initFields();
+      }
+
+      // @@protoc_insertion_point(class_scope:org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry)
+    }
+
+    private int bitField0_;
+    // optional int64 term = 1;
+    public static final int TERM_FIELD_NUMBER = 1;
+    private long term_;
+    /**
+     * <code>optional int64 term = 1;</code>
+     */
+    public boolean hasTerm() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>optional int64 term = 1;</code>
+     */
+    public long getTerm() {
+      return term_;
+    }
+
+    // optional string leaderId = 2;
+    public static final int LEADERID_FIELD_NUMBER = 2;
+    private java.lang.Object leaderId_;
+    /**
+     * <code>optional string leaderId = 2;</code>
+     */
+    public boolean hasLeaderId() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>optional string leaderId = 2;</code>
+     */
+    public java.lang.String getLeaderId() {
+      java.lang.Object ref = leaderId_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          leaderId_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string leaderId = 2;</code>
+     */
+    public com.google.protobuf.ByteString
+        getLeaderIdBytes() {
+      java.lang.Object ref = leaderId_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        leaderId_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // optional int64 prevLogIndex = 3;
+    public static final int PREVLOGINDEX_FIELD_NUMBER = 3;
+    private long prevLogIndex_;
+    /**
+     * <code>optional int64 prevLogIndex = 3;</code>
+     */
+    public boolean hasPrevLogIndex() {
+      return ((bitField0_ & 0x00000004) == 0x00000004);
+    }
+    /**
+     * <code>optional int64 prevLogIndex = 3;</code>
+     */
+    public long getPrevLogIndex() {
+      return prevLogIndex_;
+    }
+
+    // optional int64 prevLogTerm = 4;
+    public static final int PREVLOGTERM_FIELD_NUMBER = 4;
+    private long prevLogTerm_;
+    /**
+     * <code>optional int64 prevLogTerm = 4;</code>
+     */
+    public boolean hasPrevLogTerm() {
+      return ((bitField0_ & 0x00000008) == 0x00000008);
+    }
+    /**
+     * <code>optional int64 prevLogTerm = 4;</code>
+     */
+    public long getPrevLogTerm() {
+      return prevLogTerm_;
+    }
+
+    // repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;
+    public static final int LOGENTRIES_FIELD_NUMBER = 5;
+    private java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> logEntries_;
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    public java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> getLogEntriesList() {
+      return logEntries_;
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    public java.util.List<? extends org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder> 
+        getLogEntriesOrBuilderList() {
+      return logEntries_;
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    public int getLogEntriesCount() {
+      return logEntries_.size();
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getLogEntries(int index) {
+      return logEntries_.get(index);
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+     */
+    public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder getLogEntriesOrBuilder(
+        int index) {
+      return logEntries_.get(index);
+    }
+
+    // optional int64 leaderCommit = 6;
+    public static final int LEADERCOMMIT_FIELD_NUMBER = 6;
+    private long leaderCommit_;
+    /**
+     * <code>optional int64 leaderCommit = 6;</code>
+     */
+    public boolean hasLeaderCommit() {
+      return ((bitField0_ & 0x00000010) == 0x00000010);
+    }
+    /**
+     * <code>optional int64 leaderCommit = 6;</code>
+     */
+    public long getLeaderCommit() {
+      return leaderCommit_;
+    }
+
+    private void initFields() {
+      term_ = 0L;
+      leaderId_ = "";
+      prevLogIndex_ = 0L;
+      prevLogTerm_ = 0L;
+      logEntries_ = java.util.Collections.emptyList();
+      leaderCommit_ = 0L;
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      for (int i = 0; i < getLogEntriesCount(); i++) {
+        if (!getLogEntries(i).isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeInt64(1, term_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeBytes(2, getLeaderIdBytes());
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        output.writeInt64(3, prevLogIndex_);
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        output.writeInt64(4, prevLogTerm_);
+      }
+      for (int i = 0; i < logEntries_.size(); i++) {
+        output.writeMessage(5, logEntries_.get(i));
+      }
+      if (((bitField0_ & 0x00000010) == 0x00000010)) {
+        output.writeInt64(6, leaderCommit_);
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt64Size(1, term_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(2, getLeaderIdBytes());
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt64Size(3, prevLogIndex_);
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt64Size(4, prevLogTerm_);
+      }
+      for (int i = 0; i < logEntries_.size(); i++) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(5, logEntries_.get(i));
+      }
+      if (((bitField0_ & 0x00000010) == 0x00000010)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt64Size(6, leaderCommit_);
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntriesOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getLogEntriesFieldBuilder();
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        term_ = 0L;
+        bitField0_ = (bitField0_ & ~0x00000001);
+        leaderId_ = "";
+        bitField0_ = (bitField0_ & ~0x00000002);
+        prevLogIndex_ = 0L;
+        bitField0_ = (bitField0_ & ~0x00000004);
+        prevLogTerm_ = 0L;
+        bitField0_ = (bitField0_ & ~0x00000008);
+        if (logEntriesBuilder_ == null) {
+          logEntries_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000010);
+        } else {
+          logEntriesBuilder_.clear();
+        }
+        leaderCommit_ = 0L;
+        bitField0_ = (bitField0_ & ~0x00000020);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor;
+      }
+
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries getDefaultInstanceForType() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries build() {
+        org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries buildPartial() {
+        org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries result = new org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.term_ = term_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.leaderId_ = leaderId_;
+        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+          to_bitField0_ |= 0x00000004;
+        }
+        result.prevLogIndex_ = prevLogIndex_;
+        if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
+          to_bitField0_ |= 0x00000008;
+        }
+        result.prevLogTerm_ = prevLogTerm_;
+        if (logEntriesBuilder_ == null) {
+          if (((bitField0_ & 0x00000010) == 0x00000010)) {
+            logEntries_ = java.util.Collections.unmodifiableList(logEntries_);
+            bitField0_ = (bitField0_ & ~0x00000010);
+          }
+          result.logEntries_ = logEntries_;
+        } else {
+          result.logEntries_ = logEntriesBuilder_.build();
+        }
+        if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
+          to_bitField0_ |= 0x00000010;
+        }
+        result.leaderCommit_ = leaderCommit_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries) {
+          return mergeFrom((org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries other) {
+        if (other == org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.getDefaultInstance()) return this;
+        if (other.hasTerm()) {
+          setTerm(other.getTerm());
+        }
+        if (other.hasLeaderId()) {
+          bitField0_ |= 0x00000002;
+          leaderId_ = other.leaderId_;
+          onChanged();
+        }
+        if (other.hasPrevLogIndex()) {
+          setPrevLogIndex(other.getPrevLogIndex());
+        }
+        if (other.hasPrevLogTerm()) {
+          setPrevLogTerm(other.getPrevLogTerm());
+        }
+        if (logEntriesBuilder_ == null) {
+          if (!other.logEntries_.isEmpty()) {
+            if (logEntries_.isEmpty()) {
+              logEntries_ = other.logEntries_;
+              bitField0_ = (bitField0_ & ~0x00000010);
+            } else {
+              ensureLogEntriesIsMutable();
+              logEntries_.addAll(other.logEntries_);
+            }
+            onChanged();
+          }
+        } else {
+          if (!other.logEntries_.isEmpty()) {
+            if (logEntriesBuilder_.isEmpty()) {
+              logEntriesBuilder_.dispose();
+              logEntriesBuilder_ = null;
+              logEntries_ = other.logEntries_;
+              bitField0_ = (bitField0_ & ~0x00000010);
+              logEntriesBuilder_ = 
+                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+                   getLogEntriesFieldBuilder() : null;
+            } else {
+              logEntriesBuilder_.addAllMessages(other.logEntries_);
+            }
+          }
+        }
+        if (other.hasLeaderCommit()) {
+          setLeaderCommit(other.getLeaderCommit());
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        for (int i = 0; i < getLogEntriesCount(); i++) {
+          if (!getLogEntries(i).isInitialized()) {
+            
+            return false;
+          }
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // optional int64 term = 1;
+      private long term_ ;
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public boolean hasTerm() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public long getTerm() {
+        return term_;
+      }
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public Builder setTerm(long value) {
+        bitField0_ |= 0x00000001;
+        term_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public Builder clearTerm() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        term_ = 0L;
+        onChanged();
+        return this;
+      }
+
+      // optional string leaderId = 2;
+      private java.lang.Object leaderId_ = "";
+      /**
+       * <code>optional string leaderId = 2;</code>
+       */
+      public boolean hasLeaderId() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>optional string leaderId = 2;</code>
+       */
+      public java.lang.String getLeaderId() {
+        java.lang.Object ref = leaderId_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          leaderId_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string leaderId = 2;</code>
+       */
+      public com.google.protobuf.ByteString
+          getLeaderIdBytes() {
+        java.lang.Object ref = leaderId_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          leaderId_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string leaderId = 2;</code>
+       */
+      public Builder setLeaderId(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        leaderId_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string leaderId = 2;</code>
+       */
+      public Builder clearLeaderId() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        leaderId_ = getDefaultInstance().getLeaderId();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string leaderId = 2;</code>
+       */
+      public Builder setLeaderIdBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        leaderId_ = value;
+        onChanged();
+        return this;
+      }
+
+      // optional int64 prevLogIndex = 3;
+      private long prevLogIndex_ ;
+      /**
+       * <code>optional int64 prevLogIndex = 3;</code>
+       */
+      public boolean hasPrevLogIndex() {
+        return ((bitField0_ & 0x00000004) == 0x00000004);
+      }
+      /**
+       * <code>optional int64 prevLogIndex = 3;</code>
+       */
+      public long getPrevLogIndex() {
+        return prevLogIndex_;
+      }
+      /**
+       * <code>optional int64 prevLogIndex = 3;</code>
+       */
+      public Builder setPrevLogIndex(long value) {
+        bitField0_ |= 0x00000004;
+        prevLogIndex_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int64 prevLogIndex = 3;</code>
+       */
+      public Builder clearPrevLogIndex() {
+        bitField0_ = (bitField0_ & ~0x00000004);
+        prevLogIndex_ = 0L;
+        onChanged();
+        return this;
+      }
+
+      // optional int64 prevLogTerm = 4;
+      private long prevLogTerm_ ;
+      /**
+       * <code>optional int64 prevLogTerm = 4;</code>
+       */
+      public boolean hasPrevLogTerm() {
+        return ((bitField0_ & 0x00000008) == 0x00000008);
+      }
+      /**
+       * <code>optional int64 prevLogTerm = 4;</code>
+       */
+      public long getPrevLogTerm() {
+        return prevLogTerm_;
+      }
+      /**
+       * <code>optional int64 prevLogTerm = 4;</code>
+       */
+      public Builder setPrevLogTerm(long value) {
+        bitField0_ |= 0x00000008;
+        prevLogTerm_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int64 prevLogTerm = 4;</code>
+       */
+      public Builder clearPrevLogTerm() {
+        bitField0_ = (bitField0_ & ~0x00000008);
+        prevLogTerm_ = 0L;
+        onChanged();
+        return this;
+      }
+
+      // repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;
+      private java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> logEntries_ =
+        java.util.Collections.emptyList();
+      private void ensureLogEntriesIsMutable() {
+        if (!((bitField0_ & 0x00000010) == 0x00000010)) {
+          logEntries_ = new java.util.ArrayList<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry>(logEntries_);
+          bitField0_ |= 0x00000010;
+         }
+      }
+
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder> logEntriesBuilder_;
+
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> getLogEntriesList() {
+        if (logEntriesBuilder_ == null) {
+          return java.util.Collections.unmodifiableList(logEntries_);
+        } else {
+          return logEntriesBuilder_.getMessageList();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public int getLogEntriesCount() {
+        if (logEntriesBuilder_ == null) {
+          return logEntries_.size();
+        } else {
+          return logEntriesBuilder_.getCount();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getLogEntries(int index) {
+        if (logEntriesBuilder_ == null) {
+          return logEntries_.get(index);
+        } else {
+          return logEntriesBuilder_.getMessage(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public Builder setLogEntries(
+          int index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry value) {
+        if (logEntriesBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureLogEntriesIsMutable();
+          logEntries_.set(index, value);
+          onChanged();
+        } else {
+          logEntriesBuilder_.setMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public Builder setLogEntries(
+          int index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder builderForValue) {
+        if (logEntriesBuilder_ == null) {
+          ensureLogEntriesIsMutable();
+          logEntries_.set(index, builderForValue.build());
+          onChanged();
+        } else {
+          logEntriesBuilder_.setMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public Builder addLogEntries(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry value) {
+        if (logEntriesBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureLogEntriesIsMutable();
+          logEntries_.add(value);
+          onChanged();
+        } else {
+          logEntriesBuilder_.addMessage(value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public Builder addLogEntries(
+          int index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry value) {
+        if (logEntriesBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureLogEntriesIsMutable();
+          logEntries_.add(index, value);
+          onChanged();
+        } else {
+          logEntriesBuilder_.addMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public Builder addLogEntries(
+          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder builderForValue) {
+        if (logEntriesBuilder_ == null) {
+          ensureLogEntriesIsMutable();
+          logEntries_.add(builderForValue.build());
+          onChanged();
+        } else {
+          logEntriesBuilder_.addMessage(builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public Builder addLogEntries(
+          int index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder builderForValue) {
+        if (logEntriesBuilder_ == null) {
+          ensureLogEntriesIsMutable();
+          logEntries_.add(index, builderForValue.build());
+          onChanged();
+        } else {
+          logEntriesBuilder_.addMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public Builder addAllLogEntries(
+          java.lang.Iterable<? extends org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> values) {
+        if (logEntriesBuilder_ == null) {
+          ensureLogEntriesIsMutable();
+          super.addAll(values, logEntries_);
+          onChanged();
+        } else {
+          logEntriesBuilder_.addAllMessages(values);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public Builder clearLogEntries() {
+        if (logEntriesBuilder_ == null) {
+          logEntries_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000010);
+          onChanged();
+        } else {
+          logEntriesBuilder_.clear();
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public Builder removeLogEntries(int index) {
+        if (logEntriesBuilder_ == null) {
+          ensureLogEntriesIsMutable();
+          logEntries_.remove(index);
+          onChanged();
+        } else {
+          logEntriesBuilder_.remove(index);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder getLogEntriesBuilder(
+          int index) {
+        return getLogEntriesFieldBuilder().getBuilder(index);
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder getLogEntriesOrBuilder(
+          int index) {
+        if (logEntriesBuilder_ == null) {
+          return logEntries_.get(index);  } else {
+          return logEntriesBuilder_.getMessageOrBuilder(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public java.util.List<? extends org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder> 
+           getLogEntriesOrBuilderList() {
+        if (logEntriesBuilder_ != null) {
+          return logEntriesBuilder_.getMessageOrBuilderList();
+        } else {
+          return java.util.Collections.unmodifiableList(logEntries_);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder addLogEntriesBuilder() {
+        return getLogEntriesFieldBuilder().addBuilder(
+            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder addLogEntriesBuilder(
+          int index) {
+        return getLogEntriesFieldBuilder().addBuilder(
+            index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
+       */
+      public java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder> 
+           getLogEntriesBuilderList() {
+        return getLogEntriesFieldBuilder().getBuilderList();
+      }
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder> 
+          getLogEntriesFieldBuilder() {
+        if (logEntriesBuilder_ == null) {
+          logEntriesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+              org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder>(
+                  logEntries_,
+                  ((bitField0_ & 0x00000010) == 0x00000010),
+                  getParentForChildren(),
+                  isClean());
+          logEntries_ = null;
+        }
+        return logEntriesBuilder_;
+      }
+
+      // optional int64 leaderCommit = 6;
+      private long leaderCommit_ ;
+      /**
+       * <code>optional int64 leaderCommit = 6;</code>
+       */
+      public boolean hasLeaderCommit() {
+        return ((bitField0_ & 0x00000020) == 0x00000020);
+      }
+      /**
+       * <code>optional int64 leaderCommit = 6;</code>
+       */
+      public long getLeaderCommit() {
+        return leaderCommit_;
+      }
+      /**
+       * <code>optional int64 leaderCommit = 6;</code>
+       */
+      public Builder setLeaderCommit(long value) {
+        bitField0_ |= 0x00000020;
+        leaderCommit_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int64 leaderCommit = 6;</code>
+       */
+      public Builder clearLeaderCommit() {
+        bitField0_ = (bitField0_ & ~0x00000020);
+        leaderCommit_ = 0L;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.cluster.raft.AppendEntries)
+    }
+
+    static {
+      defaultInstance = new AppendEntries(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.cluster.raft.AppendEntries)
+  }
+
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_fieldAccessorTable;
+
+  public static com.google.protobuf.Descriptors.FileDescriptor
+      getDescriptor() {
+    return descriptor;
+  }
+  private static com.google.protobuf.Descriptors.FileDescriptor
+      descriptor;
+  static {
+    java.lang.String[] descriptorData = {
+      "\n\033AppendEntriesMessages.proto\022(org.opend" +
+      "aylight.controller.cluster.raft\"\227\003\n\rAppe" +
+      "ndEntries\022\014\n\004term\030\001 \001(\003\022\020\n\010leaderId\030\002 \001(" +
+      "\t\022\024\n\014prevLogIndex\030\003 \001(\003\022\023\n\013prevLogTerm\030\004" +
+      " \001(\003\022^\n\nlogEntries\030\005 \003(\0132J.org.opendayli" +
+      "ght.controller.cluster.raft.AppendEntrie" +
+      "s.ReplicatedLogEntry\022\024\n\014leaderCommit\030\006 \001" +
+      "(\003\032\304\001\n\022ReplicatedLogEntry\022\014\n\004term\030\001 \001(\003\022" +
+      "\r\n\005index\030\002 \001(\003\022`\n\004data\030\003 \001(\0132R.org.opend" +
+      "aylight.controller.cluster.raft.AppendEn",
+      "tries.ReplicatedLogEntry.Payload\032/\n\007Payl" +
+      "oad\022\036\n\026clientPayloadClassName\030\001 \001(\t*\004\010\002\020" +
+      "eBV\n;org.opendaylight.controller.cluster" +
+      ".raft.protobuff.messagesB\025AppendEntriesM" +
+      "essagesH\001"
+    };
+    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+        public com.google.protobuf.ExtensionRegistry assignDescriptors(
+            com.google.protobuf.Descriptors.FileDescriptor root) {
+          descriptor = root;
+          internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor =
+            getDescriptor().getMessageTypes().get(0);
+          internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor,
+              new java.lang.String[] { "Term", "LeaderId", "PrevLogIndex", "PrevLogTerm", "LogEntries", "LeaderCommit", });
+          internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor =
+            internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor.getNestedTypes().get(0);
+          internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor,
+              new java.lang.String[] { "Term", "Index", "Data", });
+          internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor =
+            internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor.getNestedTypes().get(0);
+          internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor,
+              new java.lang.String[] { "ClientPayloadClassName", });
+          return null;
+        }
+      };
+    com.google.protobuf.Descriptors.FileDescriptor
+      .internalBuildGeneratedFileFrom(descriptorData,
+        new com.google.protobuf.Descriptors.FileDescriptor[] {
+        }, assigner);
+  }
+
+  // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/messages/VotingMessages.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/messages/VotingMessages.java
new file mode 100644 (file)
index 0000000..5b3bd2b
--- /dev/null
@@ -0,0 +1,767 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: VotingMessages.proto
+
+package org.opendaylight.controller.cluster.raft.protobuff.messages;
+
+public final class VotingMessages {
+  private VotingMessages() {}
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistry registry) {
+  }
+  public interface RequestVoteOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // optional int64 term = 1;
+    /**
+     * <code>optional int64 term = 1;</code>
+     */
+    boolean hasTerm();
+    /**
+     * <code>optional int64 term = 1;</code>
+     */
+    long getTerm();
+
+    // optional string candidateId = 2;
+    /**
+     * <code>optional string candidateId = 2;</code>
+     */
+    boolean hasCandidateId();
+    /**
+     * <code>optional string candidateId = 2;</code>
+     */
+    java.lang.String getCandidateId();
+    /**
+     * <code>optional string candidateId = 2;</code>
+     */
+    com.google.protobuf.ByteString
+        getCandidateIdBytes();
+
+    // optional int64 lastLongIndex = 3;
+    /**
+     * <code>optional int64 lastLongIndex = 3;</code>
+     */
+    boolean hasLastLongIndex();
+    /**
+     * <code>optional int64 lastLongIndex = 3;</code>
+     */
+    long getLastLongIndex();
+
+    // optional int64 lastLongTerm = 4;
+    /**
+     * <code>optional int64 lastLongTerm = 4;</code>
+     */
+    boolean hasLastLongTerm();
+    /**
+     * <code>optional int64 lastLongTerm = 4;</code>
+     */
+    long getLastLongTerm();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.cluster.raft.RequestVote}
+   */
+  public static final class RequestVote extends
+      com.google.protobuf.GeneratedMessage
+      implements RequestVoteOrBuilder {
+    // Use RequestVote.newBuilder() to construct.
+    private RequestVote(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private RequestVote(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final RequestVote defaultInstance;
+    public static RequestVote getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public RequestVote getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private RequestVote(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 8: {
+              bitField0_ |= 0x00000001;
+              term_ = input.readInt64();
+              break;
+            }
+            case 18: {
+              bitField0_ |= 0x00000002;
+              candidateId_ = input.readBytes();
+              break;
+            }
+            case 24: {
+              bitField0_ |= 0x00000004;
+              lastLongIndex_ = input.readInt64();
+              break;
+            }
+            case 32: {
+              bitField0_ |= 0x00000008;
+              lastLongTerm_ = input.readInt64();
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.class, org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<RequestVote> PARSER =
+        new com.google.protobuf.AbstractParser<RequestVote>() {
+      public RequestVote parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new RequestVote(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<RequestVote> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // optional int64 term = 1;
+    public static final int TERM_FIELD_NUMBER = 1;
+    private long term_;
+    /**
+     * <code>optional int64 term = 1;</code>
+     */
+    public boolean hasTerm() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>optional int64 term = 1;</code>
+     */
+    public long getTerm() {
+      return term_;
+    }
+
+    // optional string candidateId = 2;
+    public static final int CANDIDATEID_FIELD_NUMBER = 2;
+    private java.lang.Object candidateId_;
+    /**
+     * <code>optional string candidateId = 2;</code>
+     */
+    public boolean hasCandidateId() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>optional string candidateId = 2;</code>
+     */
+    public java.lang.String getCandidateId() {
+      java.lang.Object ref = candidateId_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          candidateId_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string candidateId = 2;</code>
+     */
+    public com.google.protobuf.ByteString
+        getCandidateIdBytes() {
+      java.lang.Object ref = candidateId_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        candidateId_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // optional int64 lastLongIndex = 3;
+    public static final int LASTLONGINDEX_FIELD_NUMBER = 3;
+    private long lastLongIndex_;
+    /**
+     * <code>optional int64 lastLongIndex = 3;</code>
+     */
+    public boolean hasLastLongIndex() {
+      return ((bitField0_ & 0x00000004) == 0x00000004);
+    }
+    /**
+     * <code>optional int64 lastLongIndex = 3;</code>
+     */
+    public long getLastLongIndex() {
+      return lastLongIndex_;
+    }
+
+    // optional int64 lastLongTerm = 4;
+    public static final int LASTLONGTERM_FIELD_NUMBER = 4;
+    private long lastLongTerm_;
+    /**
+     * <code>optional int64 lastLongTerm = 4;</code>
+     */
+    public boolean hasLastLongTerm() {
+      return ((bitField0_ & 0x00000008) == 0x00000008);
+    }
+    /**
+     * <code>optional int64 lastLongTerm = 4;</code>
+     */
+    public long getLastLongTerm() {
+      return lastLongTerm_;
+    }
+
+    private void initFields() {
+      term_ = 0L;
+      candidateId_ = "";
+      lastLongIndex_ = 0L;
+      lastLongTerm_ = 0L;
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeInt64(1, term_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeBytes(2, getCandidateIdBytes());
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        output.writeInt64(3, lastLongIndex_);
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        output.writeInt64(4, lastLongTerm_);
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt64Size(1, term_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(2, getCandidateIdBytes());
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt64Size(3, lastLongIndex_);
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt64Size(4, lastLongTerm_);
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.cluster.raft.RequestVote}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVoteOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.class, org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        term_ = 0L;
+        bitField0_ = (bitField0_ & ~0x00000001);
+        candidateId_ = "";
+        bitField0_ = (bitField0_ & ~0x00000002);
+        lastLongIndex_ = 0L;
+        bitField0_ = (bitField0_ & ~0x00000004);
+        lastLongTerm_ = 0L;
+        bitField0_ = (bitField0_ & ~0x00000008);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor;
+      }
+
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote getDefaultInstanceForType() {
+        return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote build() {
+        org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote buildPartial() {
+        org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote result = new org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.term_ = term_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.candidateId_ = candidateId_;
+        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+          to_bitField0_ |= 0x00000004;
+        }
+        result.lastLongIndex_ = lastLongIndex_;
+        if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
+          to_bitField0_ |= 0x00000008;
+        }
+        result.lastLongTerm_ = lastLongTerm_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote) {
+          return mergeFrom((org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote other) {
+        if (other == org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.getDefaultInstance()) return this;
+        if (other.hasTerm()) {
+          setTerm(other.getTerm());
+        }
+        if (other.hasCandidateId()) {
+          bitField0_ |= 0x00000002;
+          candidateId_ = other.candidateId_;
+          onChanged();
+        }
+        if (other.hasLastLongIndex()) {
+          setLastLongIndex(other.getLastLongIndex());
+        }
+        if (other.hasLastLongTerm()) {
+          setLastLongTerm(other.getLastLongTerm());
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // optional int64 term = 1;
+      private long term_ ;
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public boolean hasTerm() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public long getTerm() {
+        return term_;
+      }
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public Builder setTerm(long value) {
+        bitField0_ |= 0x00000001;
+        term_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int64 term = 1;</code>
+       */
+      public Builder clearTerm() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        term_ = 0L;
+        onChanged();
+        return this;
+      }
+
+      // optional string candidateId = 2;
+      private java.lang.Object candidateId_ = "";
+      /**
+       * <code>optional string candidateId = 2;</code>
+       */
+      public boolean hasCandidateId() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>optional string candidateId = 2;</code>
+       */
+      public java.lang.String getCandidateId() {
+        java.lang.Object ref = candidateId_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          candidateId_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string candidateId = 2;</code>
+       */
+      public com.google.protobuf.ByteString
+          getCandidateIdBytes() {
+        java.lang.Object ref = candidateId_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          candidateId_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string candidateId = 2;</code>
+       */
+      public Builder setCandidateId(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        candidateId_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string candidateId = 2;</code>
+       */
+      public Builder clearCandidateId() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        candidateId_ = getDefaultInstance().getCandidateId();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string candidateId = 2;</code>
+       */
+      public Builder setCandidateIdBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        candidateId_ = value;
+        onChanged();
+        return this;
+      }
+
+      // optional int64 lastLongIndex = 3;
+      private long lastLongIndex_ ;
+      /**
+       * <code>optional int64 lastLongIndex = 3;</code>
+       */
+      public boolean hasLastLongIndex() {
+        return ((bitField0_ & 0x00000004) == 0x00000004);
+      }
+      /**
+       * <code>optional int64 lastLongIndex = 3;</code>
+       */
+      public long getLastLongIndex() {
+        return lastLongIndex_;
+      }
+      /**
+       * <code>optional int64 lastLongIndex = 3;</code>
+       */
+      public Builder setLastLongIndex(long value) {
+        bitField0_ |= 0x00000004;
+        lastLongIndex_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int64 lastLongIndex = 3;</code>
+       */
+      public Builder clearLastLongIndex() {
+        bitField0_ = (bitField0_ & ~0x00000004);
+        lastLongIndex_ = 0L;
+        onChanged();
+        return this;
+      }
+
+      // optional int64 lastLongTerm = 4;
+      private long lastLongTerm_ ;
+      /**
+       * <code>optional int64 lastLongTerm = 4;</code>
+       */
+      public boolean hasLastLongTerm() {
+        return ((bitField0_ & 0x00000008) == 0x00000008);
+      }
+      /**
+       * <code>optional int64 lastLongTerm = 4;</code>
+       */
+      public long getLastLongTerm() {
+        return lastLongTerm_;
+      }
+      /**
+       * <code>optional int64 lastLongTerm = 4;</code>
+       */
+      public Builder setLastLongTerm(long value) {
+        bitField0_ |= 0x00000008;
+        lastLongTerm_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int64 lastLongTerm = 4;</code>
+       */
+      public Builder clearLastLongTerm() {
+        bitField0_ = (bitField0_ & ~0x00000008);
+        lastLongTerm_ = 0L;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.cluster.raft.RequestVote)
+    }
+
+    static {
+      defaultInstance = new RequestVote(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.cluster.raft.RequestVote)
+  }
+
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_cluster_raft_RequestVote_fieldAccessorTable;
+
+  public static com.google.protobuf.Descriptors.FileDescriptor
+      getDescriptor() {
+    return descriptor;
+  }
+  private static com.google.protobuf.Descriptors.FileDescriptor
+      descriptor;
+  static {
+    java.lang.String[] descriptorData = {
+      "\n\024VotingMessages.proto\022(org.opendaylight" +
+      ".controller.cluster.raft\"]\n\013RequestVote\022" +
+      "\014\n\004term\030\001 \001(\003\022\023\n\013candidateId\030\002 \001(\t\022\025\n\rla" +
+      "stLongIndex\030\003 \001(\003\022\024\n\014lastLongTerm\030\004 \001(\003B" +
+      "O\n;org.opendaylight.controller.cluster.r" +
+      "aft.protobuff.messagesB\016VotingMessagesH\001"
+    };
+    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+        public com.google.protobuf.ExtensionRegistry assignDescriptors(
+            com.google.protobuf.Descriptors.FileDescriptor root) {
+          descriptor = root;
+          internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor =
+            getDescriptor().getMessageTypes().get(0);
+          internal_static_org_opendaylight_controller_cluster_raft_RequestVote_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor,
+              new java.lang.String[] { "Term", "CandidateId", "LastLongIndex", "LastLongTerm", });
+          return null;
+        }
+      };
+    com.google.protobuf.Descriptors.FileDescriptor
+      .internalBuildGeneratedFileFrom(descriptorData,
+        new com.google.protobuf.Descriptors.FileDescriptor[] {
+        }, assigner);
+  }
+
+  // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/resources/AppendEntriesMessages.proto b/opendaylight/md-sal/sal-akka-raft/src/main/resources/AppendEntriesMessages.proto
new file mode 100644 (file)
index 0000000..ab591ea
--- /dev/null
@@ -0,0 +1,30 @@
+package org.opendaylight.controller.cluster.raft;
+
+option java_package = "org.opendaylight.controller.cluster.raft.protobuff.messages";
+option java_outer_classname = "AppendEntriesMessages";
+option optimize_for = SPEED;
+
+message AppendEntries {
+    optional int64 term = 1;
+    optional string leaderId = 2;
+    optional int64 prevLogIndex = 3;
+    optional int64 prevLogTerm = 4;
+
+    message ReplicatedLogEntry {
+        optional int64 term = 1;
+        optional int64 index = 2;
+
+        message Payload {
+            optional string clientPayloadClassName = 1;
+            extensions 2 to 100;
+        }
+
+        optional Payload data = 3;
+    }
+
+    repeated ReplicatedLogEntry logEntries = 5;
+    optional int64 leaderCommit = 6;
+
+}
+
+
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/resources/KeyValueMessages.proto b/opendaylight/md-sal/sal-akka-raft/src/main/resources/KeyValueMessages.proto
new file mode 100644 (file)
index 0000000..7ee0b21
--- /dev/null
@@ -0,0 +1,13 @@
+package org.opendaylight.controller.cluster.raft;
+
+import "AppendEntriesMessages.proto";
+
+option java_package = "org.opendaylight.controller.cluster.example.protobuff.messages";
+option java_outer_classname = "KeyValueMessages";
+option optimize_for = SPEED;
+
+// proto file for the payload of Example, extending AppendEntries
+extend AppendEntries.ReplicatedLogEntry.Payload {
+    optional string key = 2;
+    optional string value = 3;
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/resources/VotingMessages.proto b/opendaylight/md-sal/sal-akka-raft/src/main/resources/VotingMessages.proto
new file mode 100644 (file)
index 0000000..6a45a2b
--- /dev/null
@@ -0,0 +1,13 @@
+package org.opendaylight.controller.cluster.raft;
+
+option java_package = "org.opendaylight.controller.cluster.raft.protobuff.messages";
+option java_outer_classname = "VotingMessages";
+option optimize_for = SPEED;
+
+message RequestVote {
+    optional int64 term = 1;
+    optional string candidateId = 2;
+    optional int64 lastLongIndex = 3;
+    optional int64 lastLongTerm = 4;
+
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/resources/application.conf b/opendaylight/md-sal/sal-akka-raft/src/main/resources/application.conf
new file mode 100644 (file)
index 0000000..9e42a13
--- /dev/null
@@ -0,0 +1,20 @@
+akka {
+
+    loglevel = "DEBUG"
+
+    actor {
+        # enable to test serialization only.
+        # serialize-messages = on
+
+        serializers {
+          java  = "akka.serialization.JavaSerializer"
+          proto = "akka.remote.serialization.ProtobufSerializer"
+        }
+
+        serialization-bindings {
+            "org.opendaylight.controller.cluster.raft.ReplicatedLogImplEntry" = java
+            "com.google.protobuf.Message" = proto
+            "com.google.protobuf.GeneratedMessage" = proto
+        }
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/AbstractActorTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/AbstractActorTest.java
new file mode 100644 (file)
index 0000000..1971432
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * 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.raft;
+
+import akka.actor.ActorSystem;
+import akka.testkit.JavaTestKit;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+public abstract class AbstractActorTest {
+    private static ActorSystem system;
+
+    @BeforeClass
+    public static void setUpClass() {
+        System.setProperty("shard.persistent", "false");
+        system = ActorSystem.create("test");
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+        JavaTestKit.shutdownActorSystem(system);
+        system = null;
+    }
+
+    protected ActorSystem getSystem() {
+        return system;
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MockRaftActorContext.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MockRaftActorContext.java
new file mode 100644 (file)
index 0000000..2e200cb
--- /dev/null
@@ -0,0 +1,331 @@
+/*
+ * 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.raft;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSelection;
+import akka.actor.ActorSystem;
+import akka.actor.Props;
+import akka.event.Logging;
+import akka.event.LoggingAdapter;
+import com.google.protobuf.GeneratedMessage;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
+import org.opendaylight.controller.cluster.raft.protobuff.messages.MockPayloadMessages;
+import com.google.common.base.Preconditions;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class MockRaftActorContext implements RaftActorContext {
+
+    private String id;
+    private ActorSystem system;
+    private ActorRef actor;
+    private long index = 0;
+    private long lastApplied = 0;
+    private final ElectionTerm electionTerm;
+    private ReplicatedLog replicatedLog;
+    private Map<String, String> peerAddresses = new HashMap();
+
+    public MockRaftActorContext(){
+        electionTerm = null;
+
+        initReplicatedLog();
+    }
+
+    public MockRaftActorContext(String id, ActorSystem system, ActorRef actor){
+        this.id = id;
+        this.system = system;
+        this.actor = actor;
+
+        final String id1 = id;
+        electionTerm = new ElectionTerm() {
+            /**
+             * Identifier of the actor whose election term information this is
+             */
+            private final String id = id1;
+            private long currentTerm = 0;
+            private String votedFor = "";
+
+            public long getCurrentTerm() {
+                return currentTerm;
+            }
+
+            public String getVotedFor() {
+                return votedFor;
+            }
+
+            public void update(long currentTerm, String votedFor){
+                this.currentTerm = currentTerm;
+                this.votedFor = votedFor;
+
+                // TODO : Write to some persistent state
+            }
+
+            @Override public void updateAndPersist(long currentTerm,
+                String votedFor) {
+                update(currentTerm, votedFor);
+            }
+        };
+
+        initReplicatedLog();
+    }
+
+
+    public void initReplicatedLog(){
+        this.replicatedLog = new SimpleReplicatedLog();
+        this.replicatedLog.append(new MockReplicatedLogEntry(1, 1, new MockPayload("")));
+    }
+
+    @Override public ActorRef actorOf(Props props) {
+        return system.actorOf(props);
+    }
+
+    @Override public ActorSelection actorSelection(String path) {
+        return system.actorSelection(path);
+    }
+
+    @Override public String getId() {
+        return id;
+    }
+
+    @Override public ActorRef getActor() {
+        return actor;
+    }
+
+    @Override public ElectionTerm getTermInformation() {
+        return electionTerm;
+    }
+
+    public void setIndex(long index){
+        this.index = index;
+    }
+
+    @Override public long getCommitIndex() {
+        return index;
+    }
+
+    @Override public void setCommitIndex(long commitIndex) {
+        this.index = commitIndex;
+    }
+
+    @Override public void setLastApplied(long lastApplied){
+        this.lastApplied = lastApplied;
+    }
+
+    @Override public long getLastApplied() {
+        return lastApplied;
+    }
+
+    public void setReplicatedLog(ReplicatedLog replicatedLog) {
+        this.replicatedLog = replicatedLog;
+    }
+
+    @Override public ReplicatedLog getReplicatedLog() {
+        return replicatedLog;
+    }
+
+    @Override public ActorSystem getActorSystem() {
+        return this.system;
+    }
+
+    @Override public LoggingAdapter getLogger() {
+        return Logging.getLogger(system, this);
+    }
+
+    @Override public Map<String, String> getPeerAddresses() {
+        return peerAddresses;
+    }
+
+    @Override public String getPeerAddress(String peerId) {
+        return peerAddresses.get(peerId);
+    }
+
+    @Override public void addToPeers(String name, String address) {
+        peerAddresses.put(name, address);
+    }
+
+    @Override public void removePeer(String name) {
+        peerAddresses.remove(name);
+    }
+
+    @Override public ActorSelection getPeerActorSelection(String peerId) {
+        String peerAddress = getPeerAddress(peerId);
+        if(peerAddress != null){
+            return actorSelection(peerAddress);
+        }
+        return null;
+    }
+
+    @Override public void setPeerAddress(String peerId, String peerAddress) {
+        Preconditions.checkState(peerAddresses.containsKey(peerId));
+        peerAddresses.put(peerId, peerAddress);
+    }
+
+    public void setPeerAddresses(Map<String, String> peerAddresses) {
+        this.peerAddresses = peerAddresses;
+    }
+
+
+
+    public static class SimpleReplicatedLog implements ReplicatedLog {
+        private final List<ReplicatedLogEntry> log = new ArrayList<>();
+
+        @Override public ReplicatedLogEntry get(long index) {
+            if(index >= log.size() || index < 0){
+                return null;
+            }
+            return log.get((int) index);
+        }
+
+        @Override public ReplicatedLogEntry last() {
+            if(log.size() == 0){
+                return null;
+            }
+            return log.get(log.size()-1);
+        }
+
+        @Override public long lastIndex() {
+            if(log.size() == 0){
+                return -1;
+            }
+
+            return last().getIndex();
+        }
+
+        @Override public long lastTerm() {
+            if(log.size() == 0){
+                return -1;
+            }
+
+            return last().getTerm();
+        }
+
+        @Override public void removeFrom(long index) {
+            if(index >= log.size() || index < 0){
+                return;
+            }
+
+            log.subList((int) index, log.size()).clear();
+            //log.remove((int) index);
+        }
+
+        @Override public void removeFromAndPersist(long index) {
+            removeFrom(index);
+        }
+
+        @Override public void append(ReplicatedLogEntry replicatedLogEntry) {
+            log.add(replicatedLogEntry);
+        }
+
+        @Override public void appendAndPersist(
+            ReplicatedLogEntry replicatedLogEntry) {
+            append(replicatedLogEntry);
+        }
+
+        @Override public List<ReplicatedLogEntry> getFrom(long index) {
+            if(index >= log.size() || index < 0){
+                return Collections.EMPTY_LIST;
+            }
+            List<ReplicatedLogEntry> entries = new ArrayList<>();
+            for(int i=(int) index ; i < log.size() ; i++) {
+                entries.add(get(i));
+            }
+            return entries;
+        }
+
+        @Override public long size() {
+            return log.size();
+        }
+
+        @Override public boolean isPresent(long index) {
+            if(index >= log.size() || index < 0){
+                return false;
+            }
+
+            return true;
+        }
+
+        @Override public boolean isInSnapshot(long index) {
+            return false;
+        }
+
+        @Override public Object getSnapshot() {
+            return null;
+        }
+
+        @Override public long getSnapshotIndex() {
+            return -1;
+        }
+
+        @Override public long getSnapshotTerm() {
+            return -1;
+        }
+    }
+
+    public static class MockPayload extends Payload implements Serializable {
+        private String value = "";
+
+        public MockPayload(String s) {
+            this.value = s;
+        }
+
+        @Override public  Map<GeneratedMessage.GeneratedExtension, String> encode() {
+            Map<GeneratedMessage.GeneratedExtension, String> map = new HashMap<GeneratedMessage.GeneratedExtension, String>();
+            map.put(MockPayloadMessages.value, value);
+            return map;
+        }
+
+        @Override public Payload decode(
+            AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload payloadProtoBuff) {
+            String value = payloadProtoBuff.getExtension(MockPayloadMessages.value);
+            this.value = value;
+            return this;
+        }
+
+        @Override public String getClientPayloadClassName() {
+            return MockPayload.class.getName();
+        }
+
+        public String toString() {
+            return value;
+        }
+    }
+
+    public static class MockReplicatedLogEntry implements ReplicatedLogEntry, Serializable {
+
+        private final long term;
+        private final long index;
+        private final Payload data;
+
+        public MockReplicatedLogEntry(long term, long index, Payload data){
+
+            this.term = term;
+            this.index = index;
+            this.data = data;
+        }
+
+        @Override public Payload getData() {
+            return data;
+        }
+
+        @Override public long getTerm() {
+            return term;
+        }
+
+        @Override public long getIndex() {
+            return index;
+        }
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractRaftActorBehaviorTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractRaftActorBehaviorTest.java
new file mode 100644 (file)
index 0000000..8068dfb
--- /dev/null
@@ -0,0 +1,368 @@
+package org.opendaylight.controller.cluster.raft.behaviors;
+
+import akka.actor.ActorRef;
+import akka.actor.Props;
+import akka.testkit.JavaTestKit;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.raft.AbstractActorTest;
+import org.opendaylight.controller.cluster.raft.MockRaftActorContext;
+import org.opendaylight.controller.cluster.raft.RaftActorContext;
+import org.opendaylight.controller.cluster.raft.RaftState;
+import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
+import org.opendaylight.controller.cluster.raft.SerializationUtils;
+import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
+import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
+import org.opendaylight.controller.cluster.raft.messages.RaftRPC;
+import org.opendaylight.controller.cluster.raft.messages.RequestVote;
+import org.opendaylight.controller.cluster.raft.messages.RequestVoteReply;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+import org.opendaylight.controller.cluster.raft.utils.DoNothingActor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+public abstract class AbstractRaftActorBehaviorTest extends AbstractActorTest {
+
+    private final ActorRef behaviorActor = getSystem().actorOf(Props.create(
+        DoNothingActor.class));
+
+    /**
+     * This test checks that when a new Raft RPC message is received with a newer
+     * term the RaftActor gets into the Follower state.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testHandleRaftRPCWithNewerTerm() throws Exception {
+        new JavaTestKit(getSystem()) {{
+
+            assertStateChangesToFollowerWhenRaftRPCHasNewerTerm(getTestActor(),
+                createAppendEntriesWithNewerTerm());
+
+            assertStateChangesToFollowerWhenRaftRPCHasNewerTerm(getTestActor(),
+                createAppendEntriesReplyWithNewerTerm());
+
+            assertStateChangesToFollowerWhenRaftRPCHasNewerTerm(getTestActor(),
+                createRequestVoteWithNewerTerm());
+
+            assertStateChangesToFollowerWhenRaftRPCHasNewerTerm(getTestActor(),
+                createRequestVoteReplyWithNewerTerm());
+
+
+        }};
+    }
+
+
+    /**
+     * This test verifies that when an AppendEntries is received with a term that
+     * is less that the currentTerm of the RaftActor then the RaftActor does not
+     * change it's state and it responds back with a failure
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testHandleAppendEntriesSenderTermLessThanReceiverTerm()
+        throws Exception {
+        new JavaTestKit(getSystem()) {{
+
+            MockRaftActorContext context = (MockRaftActorContext)
+                createActorContext();
+
+            // First set the receivers term to a high number (1000)
+            context.getTermInformation().update(1000, "test");
+
+            AppendEntries appendEntries =
+                new AppendEntries(100, "leader-1", 0, 0, null, 101);
+
+            RaftActorBehavior behavior = createBehavior(context);
+
+            // Send an unknown message so that the state of the RaftActor remains unchanged
+            RaftState expected = behavior.handleMessage(getRef(), "unknown");
+
+            RaftState raftState =
+                behavior.handleMessage(getRef(), appendEntries);
+
+            assertEquals(expected, raftState);
+
+            // Also expect an AppendEntriesReply to be sent where success is false
+            final Boolean out = new ExpectMsg<Boolean>(duration("1 seconds"),
+                "AppendEntriesReply") {
+                // do not put code outside this method, will run afterwards
+                protected Boolean match(Object in) {
+                    if (in instanceof AppendEntriesReply) {
+                        AppendEntriesReply reply = (AppendEntriesReply) in;
+                        return reply.isSuccess();
+                    } else {
+                        throw noMatch();
+                    }
+                }
+            }.get();
+
+            assertEquals(false, out);
+
+
+        }};
+    }
+
+
+    @Test
+    public void testHandleAppendEntriesAddSameEntryToLog(){
+        new JavaTestKit(getSystem()) {
+            {
+
+                MockRaftActorContext context = (MockRaftActorContext)
+                    createActorContext();
+
+                // First set the receivers term to lower number
+                context.getTermInformation().update(2, "test");
+
+                // Prepare the receivers log
+                MockRaftActorContext.SimpleReplicatedLog log =
+                    new MockRaftActorContext.SimpleReplicatedLog();
+                log.append(
+                    new MockRaftActorContext.MockReplicatedLogEntry(1, 0, new MockRaftActorContext.MockPayload("zero")));
+
+                context.setReplicatedLog(log);
+
+                List<ReplicatedLogEntry> entries = new ArrayList<>();
+                entries.add(
+                    new MockRaftActorContext.MockReplicatedLogEntry(1, 0, new MockRaftActorContext.MockPayload("zero")));
+
+                AppendEntries appendEntries =
+                    new AppendEntries(2, "leader-1", -1, 1, entries, 0);
+
+                RaftActorBehavior behavior = createBehavior(context);
+
+                if (AbstractRaftActorBehaviorTest.this instanceof CandidateTest) {
+                    // Resetting the Candidates term to make sure it will match
+                    // the term sent by AppendEntries. If this was not done then
+                    // the test will fail because the Candidate will assume that
+                    // the message was sent to it from a lower term peer and will
+                    // thus respond with a failure
+                    context.getTermInformation().update(2, "test");
+                }
+
+                // Send an unknown message so that the state of the RaftActor remains unchanged
+                RaftState expected = behavior.handleMessage(getRef(), "unknown");
+
+                RaftState raftState =
+                    behavior.handleMessage(getRef(), appendEntries);
+
+                assertEquals(expected, raftState);
+
+                assertEquals(1, log.size());
+
+
+            }};
+    }
+
+    /**
+     * This test verifies that when a RequestVote is received by the RaftActor
+     * with a term which is greater than the RaftActors' currentTerm and the
+     * senders' log is more upto date than the receiver that the receiver grants
+     * the vote to the sender
+     */
+    @Test
+    public void testHandleRequestVoteWhenSenderTermGreaterThanCurrentTermAndSenderLogMoreUpToDate() {
+        new JavaTestKit(getSystem()) {{
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    RaftActorBehavior behavior = createBehavior(
+                        createActorContext(behaviorActor));
+
+                    RaftState raftState = behavior.handleMessage(getTestActor(),
+                        new RequestVote(1000, "test", 10000, 999));
+
+                    if(behavior.state() != RaftState.Follower){
+                        assertEquals(RaftState.Follower, raftState);
+                    } else {
+
+                        final Boolean out =
+                            new ExpectMsg<Boolean>(duration("1 seconds"),
+                                "RequestVoteReply") {
+                                // do not put code outside this method, will run afterwards
+                                protected Boolean match(Object in) {
+                                    if (in instanceof RequestVoteReply) {
+                                        RequestVoteReply reply =
+                                            (RequestVoteReply) in;
+                                        return reply.isVoteGranted();
+                                    } else {
+                                        throw noMatch();
+                                    }
+                                }
+                            }.get();
+
+                        assertEquals(true, out);
+                    }
+                }
+            };
+        }};
+    }
+
+    /**
+     * This test verifies that when a RaftActor receives a RequestVote message
+     * with a term that is greater than it's currentTerm but a less up-to-date
+     * log then the receiving RaftActor will not grant the vote to the sender
+     */
+    @Test
+    public void testHandleRequestVoteWhenSenderTermGreaterThanCurrentTermButSenderLogLessUptoDate() {
+        new JavaTestKit(getSystem()) {{
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    RaftActorContext actorContext =
+                        createActorContext(behaviorActor);
+
+                    MockRaftActorContext.SimpleReplicatedLog
+                        log = new MockRaftActorContext.SimpleReplicatedLog();
+                    log.append(
+                        new MockRaftActorContext.MockReplicatedLogEntry(20000,
+                            1000000, new MockRaftActorContext.MockPayload("")));
+
+                    ((MockRaftActorContext) actorContext).setReplicatedLog(log);
+
+                    RaftActorBehavior behavior = createBehavior(actorContext);
+
+                    RaftState raftState = behavior.handleMessage(getTestActor(),
+                        new RequestVote(1000, "test", 10000, 999));
+
+                    if(behavior.state() != RaftState.Follower){
+                        assertEquals(RaftState.Follower, raftState);
+                    } else {
+                        final Boolean out =
+                            new ExpectMsg<Boolean>(duration("1 seconds"),
+                                "RequestVoteReply") {
+                                // do not put code outside this method, will run afterwards
+                                protected Boolean match(Object in) {
+                                    if (in instanceof RequestVoteReply) {
+                                        RequestVoteReply reply =
+                                            (RequestVoteReply) in;
+                                        return reply.isVoteGranted();
+                                    } else {
+                                        throw noMatch();
+                                    }
+                                }
+                            }.get();
+
+                        assertEquals(false, out);
+                    }
+                }
+            };
+        }};
+    }
+
+
+
+    /**
+     * This test verifies that the receiving RaftActor will not grant a vote
+     * to a sender if the sender's term is lesser than the currentTerm of the
+     * recipient RaftActor
+     */
+    @Test
+    public void testHandleRequestVoteWhenSenderTermLessThanCurrentTerm() {
+        new JavaTestKit(getSystem()) {{
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    RaftActorContext context =
+                        createActorContext(behaviorActor);
+
+                    context.getTermInformation().update(1000, null);
+
+                    RaftActorBehavior follower = createBehavior(context);
+
+                    follower.handleMessage(getTestActor(),
+                        new RequestVote(999, "test", 10000, 999));
+
+                    final Boolean out =
+                        new ExpectMsg<Boolean>(duration("1 seconds"),
+                            "RequestVoteReply") {
+                            // do not put code outside this method, will run afterwards
+                            protected Boolean match(Object in) {
+                                if (in instanceof RequestVoteReply) {
+                                    RequestVoteReply reply =
+                                        (RequestVoteReply) in;
+                                    return reply.isVoteGranted();
+                                } else {
+                                    throw noMatch();
+                                }
+                            }
+                        }.get();
+
+                    assertEquals(false, out);
+                }
+            };
+        }};
+    }
+
+    protected void assertStateChangesToFollowerWhenRaftRPCHasNewerTerm(
+        ActorRef actorRef, RaftRPC rpc) {
+
+        RaftActorContext actorContext = createActorContext();
+        Payload p = new MockRaftActorContext.MockPayload("");
+        setLastLogEntry(
+            (MockRaftActorContext) actorContext, 0, 0, p);
+
+        RaftState raftState = createBehavior(actorContext)
+            .handleMessage(actorRef, rpc);
+
+        assertEquals(RaftState.Follower, raftState);
+    }
+
+    protected MockRaftActorContext.SimpleReplicatedLog setLastLogEntry(
+        MockRaftActorContext actorContext, long term, long index, Payload data) {
+        return setLastLogEntry(actorContext,
+            new MockRaftActorContext.MockReplicatedLogEntry(term, index, data));
+    }
+
+    protected MockRaftActorContext.SimpleReplicatedLog setLastLogEntry(
+        MockRaftActorContext actorContext, ReplicatedLogEntry logEntry) {
+        MockRaftActorContext.SimpleReplicatedLog
+            log = new MockRaftActorContext.SimpleReplicatedLog();
+        log.append(logEntry);
+        actorContext.setReplicatedLog(log);
+
+        return log;
+    }
+
+    protected abstract RaftActorBehavior createBehavior(
+        RaftActorContext actorContext);
+
+    protected RaftActorBehavior createBehavior() {
+        return createBehavior(createActorContext());
+    }
+
+    protected RaftActorContext createActorContext() {
+        return new MockRaftActorContext();
+    }
+
+    protected RaftActorContext createActorContext(ActorRef actor) {
+        return new MockRaftActorContext("test", getSystem(), actor);
+    }
+
+    protected AppendEntries createAppendEntriesWithNewerTerm() {
+        return new AppendEntries(100, "leader-1", 0, 0, null, 1);
+    }
+
+    protected AppendEntriesReply createAppendEntriesReplyWithNewerTerm() {
+        return new AppendEntriesReply("follower-1", 100, false, 100, 100);
+    }
+
+    protected RequestVote createRequestVoteWithNewerTerm() {
+        return new RequestVote(100, "candidate-1", 10, 100);
+    }
+
+    protected RequestVoteReply createRequestVoteReplyWithNewerTerm() {
+        return new RequestVoteReply(100, false);
+    }
+
+    protected Object fromSerializableMessage(Object serializable){
+        return SerializationUtils.fromSerializable(serializable);
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/CandidateTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/CandidateTest.java
new file mode 100644 (file)
index 0000000..c763683
--- /dev/null
@@ -0,0 +1,299 @@
+package org.opendaylight.controller.cluster.raft.behaviors;
+
+import akka.actor.ActorRef;
+import akka.actor.Props;
+import akka.testkit.JavaTestKit;
+import junit.framework.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.raft.MockRaftActorContext;
+import org.opendaylight.controller.cluster.raft.RaftActorContext;
+import org.opendaylight.controller.cluster.raft.RaftState;
+import org.opendaylight.controller.cluster.raft.base.messages.ElectionTimeout;
+import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
+import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
+import org.opendaylight.controller.cluster.raft.messages.RequestVote;
+import org.opendaylight.controller.cluster.raft.messages.RequestVoteReply;
+import org.opendaylight.controller.cluster.raft.utils.DoNothingActor;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+
+public class CandidateTest extends AbstractRaftActorBehaviorTest {
+
+    private final ActorRef candidateActor = getSystem().actorOf(Props.create(
+        DoNothingActor.class));
+
+    private final ActorRef peerActor1 = getSystem().actorOf(Props.create(
+        DoNothingActor.class));
+
+    private final ActorRef peerActor2 = getSystem().actorOf(Props.create(
+        DoNothingActor.class));
+
+    private final ActorRef peerActor3 = getSystem().actorOf(Props.create(
+        DoNothingActor.class));
+
+    private final ActorRef peerActor4 = getSystem().actorOf(Props.create(
+        DoNothingActor.class));
+
+    private final Map<String, String> onePeer = new HashMap<>();
+    private final Map<String, String> twoPeers = new HashMap<>();
+    private final Map<String, String> fourPeers = new HashMap<>();
+
+    @Before
+    public void setUp(){
+        onePeer.put(peerActor1.path().toString(),
+            peerActor1.path().toString());
+
+        twoPeers.put(peerActor1.path().toString(),
+            peerActor1.path().toString());
+        twoPeers.put(peerActor2.path().toString(),
+            peerActor2.path().toString());
+
+        fourPeers.put(peerActor1.path().toString(),
+            peerActor1.path().toString());
+        fourPeers.put(peerActor2.path().toString(),
+            peerActor2.path().toString());
+        fourPeers.put(peerActor3.path().toString(),
+            peerActor3.path().toString());
+        fourPeers.put(peerActor4.path().toString(),
+            peerActor3.path().toString());
+
+
+    }
+
+    @Test
+    public void testWhenACandidateIsCreatedItIncrementsTheCurrentTermAndVotesForItself(){
+        RaftActorContext raftActorContext = createActorContext();
+        long expectedTerm = raftActorContext.getTermInformation().getCurrentTerm();
+
+        new Candidate(raftActorContext);
+
+        assertEquals(expectedTerm+1, raftActorContext.getTermInformation().getCurrentTerm());
+        assertEquals(raftActorContext.getId(), raftActorContext.getTermInformation().getVotedFor());
+    }
+
+    @Test
+    public void testThatAnElectionTimeoutIsTriggered(){
+        new JavaTestKit(getSystem()) {{
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    Candidate candidate = new Candidate(createActorContext(getTestActor()));
+
+                    final Boolean out = new ExpectMsg<Boolean>(duration("1 seconds"), "ElectionTimeout") {
+                        // do not put code outside this method, will run afterwards
+                        protected Boolean match(Object in) {
+                            if (in instanceof ElectionTimeout) {
+                                 return true;
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get();
+
+                    assertEquals(true, out);
+                }
+            };
+        }};
+    }
+
+    @Test
+    public void testHandleElectionTimeoutWhenThereAreZeroPeers(){
+        RaftActorContext raftActorContext = createActorContext();
+        Candidate candidate =
+            new Candidate(raftActorContext);
+
+        RaftState raftState =
+            candidate.handleMessage(candidateActor, new ElectionTimeout());
+
+        Assert.assertEquals(RaftState.Leader, raftState);
+    }
+
+    @Test
+    public void testHandleElectionTimeoutWhenThereAreTwoNodesInCluster(){
+        MockRaftActorContext raftActorContext =
+            (MockRaftActorContext) createActorContext();
+        raftActorContext.setPeerAddresses(onePeer);
+        Candidate candidate =
+            new Candidate(raftActorContext);
+
+        RaftState raftState =
+            candidate.handleMessage(candidateActor, new ElectionTimeout());
+
+        Assert.assertEquals(RaftState.Candidate, raftState);
+    }
+
+    @Test
+    public void testBecomeLeaderOnReceivingMajorityVotesInThreeNodesInCluster(){
+        MockRaftActorContext raftActorContext =
+            (MockRaftActorContext) createActorContext();
+        raftActorContext.setPeerAddresses(twoPeers);
+        Candidate candidate =
+            new Candidate(raftActorContext);
+
+        RaftState stateOnFirstVote = candidate.handleMessage(peerActor1, new RequestVoteReply(0, true));
+
+        Assert.assertEquals(RaftState.Leader, stateOnFirstVote);
+
+    }
+
+    @Test
+    public void testBecomeLeaderOnReceivingMajorityVotesInFiveNodesInCluster(){
+        MockRaftActorContext raftActorContext =
+            (MockRaftActorContext) createActorContext();
+        raftActorContext.setPeerAddresses(fourPeers);
+        Candidate candidate =
+            new Candidate(raftActorContext);
+
+        RaftState stateOnFirstVote = candidate.handleMessage(peerActor1, new RequestVoteReply(0, true));
+
+        RaftState stateOnSecondVote = candidate.handleMessage(peerActor2, new RequestVoteReply(0, true));
+
+        Assert.assertEquals(RaftState.Candidate, stateOnFirstVote);
+        Assert.assertEquals(RaftState.Leader, stateOnSecondVote);
+
+    }
+
+    @Test
+    public void testResponseToAppendEntriesWithLowerTerm(){
+        new JavaTestKit(getSystem()) {{
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    Candidate candidate = new Candidate(createActorContext(getTestActor()));
+
+                    candidate.handleMessage(getTestActor(), new AppendEntries(0, "test", 0,0,Collections.EMPTY_LIST, 0));
+
+                    final Boolean out = new ExpectMsg<Boolean>(duration("1 seconds"), "AppendEntriesResponse") {
+                        // do not put code outside this method, will run afterwards
+                        protected Boolean match(Object in) {
+                            if (in instanceof AppendEntriesReply) {
+                                AppendEntriesReply reply = (AppendEntriesReply) in;
+                                return reply.isSuccess();
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get();
+
+                    assertEquals(false, out);
+                }
+            };
+        }};
+    }
+
+    @Test
+    public void testResponseToRequestVoteWithLowerTerm(){
+        new JavaTestKit(getSystem()) {{
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    Candidate candidate = new Candidate(createActorContext(getTestActor()));
+
+                    candidate.handleMessage(getTestActor(), new RequestVote(0, "test", 0, 0));
+
+                    final Boolean out = new ExpectMsg<Boolean>(duration("1 seconds"), "AppendEntriesResponse") {
+                        // do not put code outside this method, will run afterwards
+                        protected Boolean match(Object in) {
+                            if (in instanceof RequestVoteReply) {
+                                RequestVoteReply reply = (RequestVoteReply) in;
+                                return reply.isVoteGranted();
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get();
+
+                    assertEquals(false, out);
+                }
+            };
+        }};
+    }
+
+    @Test
+    public void testHandleRequestVoteWhenSenderTermEqualToCurrentTermAndVotedForIsNull(){
+        new JavaTestKit(getSystem()) {{
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    RaftActorContext context = createActorContext(getTestActor());
+
+                    context.getTermInformation().update(1000, null);
+
+                    // Once a candidate is created it will immediately increment the current term so after
+                    // construction the currentTerm should be 1001
+                    RaftActorBehavior follower = createBehavior(context);
+
+                    follower.handleMessage(getTestActor(), new RequestVote(1001, "test", 10000, 999));
+
+                    final Boolean out = new ExpectMsg<Boolean>(duration("1 seconds"), "RequestVoteReply") {
+                        // do not put code outside this method, will run afterwards
+                        protected Boolean match(Object in) {
+                            if (in instanceof RequestVoteReply) {
+                                RequestVoteReply reply = (RequestVoteReply) in;
+                                return reply.isVoteGranted();
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get();
+
+                    assertEquals(true, out);
+                }
+            };
+        }};
+    }
+
+    @Test
+    public void testHandleRequestVoteWhenSenderTermEqualToCurrentTermAndVotedForIsNotTheSameAsCandidateId(){
+        new JavaTestKit(getSystem()) {{
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    RaftActorContext context = createActorContext(getTestActor());
+
+                    context.getTermInformation().update(1000, "test");
+
+                    RaftActorBehavior follower = createBehavior(context);
+
+                    follower.handleMessage(getTestActor(), new RequestVote(1001, "candidate", 10000, 999));
+
+                    final Boolean out = new ExpectMsg<Boolean>(duration("1 seconds"), "RequestVoteReply") {
+                        // do not put code outside this method, will run afterwards
+                        protected Boolean match(Object in) {
+                            if (in instanceof RequestVoteReply) {
+                                RequestVoteReply reply = (RequestVoteReply) in;
+                                return reply.isVoteGranted();
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get();
+
+                    assertEquals(false, out);
+                }
+            };
+        }};
+    }
+
+
+
+    @Override protected RaftActorBehavior createBehavior(RaftActorContext actorContext) {
+        return new Candidate(actorContext);
+    }
+
+    @Override protected RaftActorContext createActorContext() {
+        return new MockRaftActorContext("test", getSystem(), candidateActor);
+    }
+
+
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/FollowerTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/FollowerTest.java
new file mode 100644 (file)
index 0000000..c015d95
--- /dev/null
@@ -0,0 +1,410 @@
+package org.opendaylight.controller.cluster.raft.behaviors;
+
+import akka.actor.ActorRef;
+import akka.actor.Props;
+import akka.testkit.JavaTestKit;
+import junit.framework.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.raft.MockRaftActorContext;
+import org.opendaylight.controller.cluster.raft.RaftActorContext;
+import org.opendaylight.controller.cluster.raft.RaftState;
+import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
+import org.opendaylight.controller.cluster.raft.base.messages.ElectionTimeout;
+import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
+import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
+import org.opendaylight.controller.cluster.raft.messages.RequestVote;
+import org.opendaylight.controller.cluster.raft.messages.RequestVoteReply;
+import org.opendaylight.controller.cluster.raft.utils.DoNothingActor;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class FollowerTest extends AbstractRaftActorBehaviorTest {
+
+    private final ActorRef followerActor = getSystem().actorOf(Props.create(
+        DoNothingActor.class));
+
+
+    @Override protected RaftActorBehavior createBehavior(RaftActorContext actorContext) {
+        return new Follower(actorContext);
+    }
+
+    @Override protected RaftActorContext createActorContext() {
+        return new MockRaftActorContext("test", getSystem(), followerActor);
+    }
+
+    @Test
+    public void testThatAnElectionTimeoutIsTriggered(){
+        new JavaTestKit(getSystem()) {{
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    Follower follower = new Follower(createActorContext(getTestActor()));
+
+                    final Boolean out = new ExpectMsg<Boolean>(duration("1 seconds"), "ElectionTimeout") {
+                        // do not put code outside this method, will run afterwards
+                        protected Boolean match(Object in) {
+                            if (in instanceof ElectionTimeout) {
+                                return true;
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get();
+
+                    assertEquals(true, out);
+                }
+            };
+        }};
+    }
+
+    @Test
+    public void testHandleElectionTimeout(){
+        RaftActorContext raftActorContext = createActorContext();
+        Follower follower =
+            new Follower(raftActorContext);
+
+        RaftState raftState =
+            follower.handleMessage(followerActor, new ElectionTimeout());
+
+        Assert.assertEquals(RaftState.Candidate, raftState);
+    }
+
+    @Test
+    public void testHandleRequestVoteWhenSenderTermEqualToCurrentTermAndVotedForIsNull(){
+        new JavaTestKit(getSystem()) {{
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    RaftActorContext context = createActorContext(getTestActor());
+
+                    context.getTermInformation().update(1000, null);
+
+                    RaftActorBehavior follower = createBehavior(context);
+
+                    follower.handleMessage(getTestActor(), new RequestVote(1000, "test", 10000, 999));
+
+                    final Boolean out = new ExpectMsg<Boolean>(duration("1 seconds"), "RequestVoteReply") {
+                        // do not put code outside this method, will run afterwards
+                        protected Boolean match(Object in) {
+                            if (in instanceof RequestVoteReply) {
+                                RequestVoteReply reply = (RequestVoteReply) in;
+                                return reply.isVoteGranted();
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get();
+
+                    assertEquals(true, out);
+                }
+            };
+        }};
+    }
+
+    @Test
+    public void testHandleRequestVoteWhenSenderTermEqualToCurrentTermAndVotedForIsNotTheSameAsCandidateId(){
+        new JavaTestKit(getSystem()) {{
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    RaftActorContext context = createActorContext(getTestActor());
+
+                    context.getTermInformation().update(1000, "test");
+
+                    RaftActorBehavior follower = createBehavior(context);
+
+                    follower.handleMessage(getTestActor(), new RequestVote(1000, "candidate", 10000, 999));
+
+                    final Boolean out = new ExpectMsg<Boolean>(duration("1 seconds"), "RequestVoteReply") {
+                        // do not put code outside this method, will run afterwards
+                        protected Boolean match(Object in) {
+                            if (in instanceof RequestVoteReply) {
+                                RequestVoteReply reply = (RequestVoteReply) in;
+                                return reply.isVoteGranted();
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get();
+
+                    assertEquals(false, out);
+                }
+            };
+        }};
+    }
+
+    /**
+     * This test verifies that when an AppendEntries RPC is received by a RaftActor
+     * with a commitIndex that is greater than what has been applied to the
+     * state machine of the RaftActor, the RaftActor applies the state and
+     * sets it current applied state to the commitIndex of the sender.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testHandleAppendEntriesWithNewerCommitIndex() throws Exception {
+        new JavaTestKit(getSystem()) {{
+
+            RaftActorContext context =
+                createActorContext();
+
+            context.setLastApplied(100);
+            setLastLogEntry((MockRaftActorContext) context, 0, 0, new MockRaftActorContext.MockPayload(""));
+
+            List<ReplicatedLogEntry> entries =
+                Arrays.asList(
+                    (ReplicatedLogEntry) new MockRaftActorContext.MockReplicatedLogEntry(100, 101,
+                        new MockRaftActorContext.MockPayload("foo"))
+                );
+
+            // The new commitIndex is 101
+            AppendEntries appendEntries =
+                new AppendEntries(100, "leader-1", 0, 0, entries, 101);
+
+            RaftState raftState =
+                createBehavior(context).handleMessage(getRef(), appendEntries);
+
+            assertEquals(101L, context.getLastApplied());
+
+        }};
+    }
+
+    /**
+     * This test verifies that when an AppendEntries is received a specific prevLogTerm
+     * which does not match the term that is in RaftActors log entry at prevLogIndex
+     * then the RaftActor does not change it's state and it returns a failure.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testHandleAppendEntriesSenderPrevLogTermNotSameAsReceiverPrevLogTerm()
+        throws Exception {
+        new JavaTestKit(getSystem()) {{
+
+            MockRaftActorContext context = (MockRaftActorContext)
+                createActorContext();
+
+            // First set the receivers term to lower number
+            context.getTermInformation().update(95, "test");
+
+            // Set the last log entry term for the receiver to be greater than
+            // what we will be sending as the prevLogTerm in AppendEntries
+            MockRaftActorContext.SimpleReplicatedLog mockReplicatedLog =
+                setLastLogEntry(context, 20, 0, new MockRaftActorContext.MockPayload(""));
+
+            // AppendEntries is now sent with a bigger term
+            // this will set the receivers term to be the same as the sender's term
+            AppendEntries appendEntries =
+                new AppendEntries(100, "leader-1", 0, 0, null, 101);
+
+            RaftActorBehavior behavior = createBehavior(context);
+
+            // Send an unknown message so that the state of the RaftActor remains unchanged
+            RaftState expected = behavior.handleMessage(getRef(), "unknown");
+
+            RaftState raftState =
+                behavior.handleMessage(getRef(), appendEntries);
+
+            assertEquals(expected, raftState);
+
+            // Also expect an AppendEntriesReply to be sent where success is false
+            final Boolean out = new ExpectMsg<Boolean>(duration("1 seconds"),
+                "AppendEntriesReply") {
+                // do not put code outside this method, will run afterwards
+                protected Boolean match(Object in) {
+                    if (in instanceof AppendEntriesReply) {
+                        AppendEntriesReply reply = (AppendEntriesReply) in;
+                        return reply.isSuccess();
+                    } else {
+                        throw noMatch();
+                    }
+                }
+            }.get();
+
+            assertEquals(false, out);
+
+
+        }};
+    }
+
+
+
+    /**
+     * This test verifies that when a new AppendEntries message is received with
+     * new entries and the logs of the sender and receiver match that the new
+     * entries get added to the log and the log is incremented by the number of
+     * entries received in appendEntries
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testHandleAppendEntriesAddNewEntries() throws Exception {
+        new JavaTestKit(getSystem()) {{
+
+            MockRaftActorContext context = (MockRaftActorContext)
+                createActorContext();
+
+            // First set the receivers term to lower number
+            context.getTermInformation().update(1, "test");
+
+            // Prepare the receivers log
+            MockRaftActorContext.SimpleReplicatedLog log =
+                new MockRaftActorContext.SimpleReplicatedLog();
+            log.append(
+                new MockRaftActorContext.MockReplicatedLogEntry(1, 0, new MockRaftActorContext.MockPayload("zero")));
+            log.append(
+                new MockRaftActorContext.MockReplicatedLogEntry(1, 1, new MockRaftActorContext.MockPayload("one")));
+            log.append(
+                new MockRaftActorContext.MockReplicatedLogEntry(1, 2, new MockRaftActorContext.MockPayload("two")));
+
+            context.setReplicatedLog(log);
+
+            // Prepare the entries to be sent with AppendEntries
+            List<ReplicatedLogEntry> entries = new ArrayList<>();
+            entries.add(
+                new MockRaftActorContext.MockReplicatedLogEntry(1, 3, new MockRaftActorContext.MockPayload("three")));
+            entries.add(
+                new MockRaftActorContext.MockReplicatedLogEntry(1, 4, new MockRaftActorContext.MockPayload("four")));
+
+            // Send appendEntries with the same term as was set on the receiver
+            // before the new behavior was created (1 in this case)
+            // This will not work for a Candidate because as soon as a Candidate
+            // is created it increments the term
+            AppendEntries appendEntries =
+                new AppendEntries(1, "leader-1", 2, 1, entries, 4);
+
+            RaftActorBehavior behavior = createBehavior(context);
+
+            // Send an unknown message so that the state of the RaftActor remains unchanged
+            RaftState expected = behavior.handleMessage(getRef(), "unknown");
+
+            RaftState raftState =
+                behavior.handleMessage(getRef(), appendEntries);
+
+            assertEquals(expected, raftState);
+            assertEquals(5, log.last().getIndex() + 1);
+            assertNotNull(log.get(3));
+            assertNotNull(log.get(4));
+
+            // Also expect an AppendEntriesReply to be sent where success is false
+            final Boolean out = new ExpectMsg<Boolean>(duration("1 seconds"),
+                "AppendEntriesReply") {
+                // do not put code outside this method, will run afterwards
+                protected Boolean match(Object in) {
+                    if (in instanceof AppendEntriesReply) {
+                        AppendEntriesReply reply = (AppendEntriesReply) in;
+                        return reply.isSuccess();
+                    } else {
+                        throw noMatch();
+                    }
+                }
+            }.get();
+
+            assertEquals(true, out);
+
+
+        }};
+    }
+
+
+
+    /**
+     * This test verifies that when a new AppendEntries message is received with
+     * new entries and the logs of the sender and receiver are out-of-sync that
+     * the log is first corrected by removing the out of sync entries from the
+     * log and then adding in the new entries sent with the AppendEntries message
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testHandleAppendEntriesCorrectReceiverLogEntries()
+        throws Exception {
+        new JavaTestKit(getSystem()) {{
+
+            MockRaftActorContext context = (MockRaftActorContext)
+                createActorContext();
+
+            // First set the receivers term to lower number
+            context.getTermInformation().update(2, "test");
+
+            // Prepare the receivers log
+            MockRaftActorContext.SimpleReplicatedLog log =
+                new MockRaftActorContext.SimpleReplicatedLog();
+            log.append(
+                new MockRaftActorContext.MockReplicatedLogEntry(1, 0, new MockRaftActorContext.MockPayload("zero")));
+            log.append(
+                new MockRaftActorContext.MockReplicatedLogEntry(1, 1, new MockRaftActorContext.MockPayload("one")));
+            log.append(
+                new MockRaftActorContext.MockReplicatedLogEntry(1, 2, new MockRaftActorContext.MockPayload("two")));
+
+            context.setReplicatedLog(log);
+
+            // Prepare the entries to be sent with AppendEntries
+            List<ReplicatedLogEntry> entries = new ArrayList<>();
+            entries.add(
+                new MockRaftActorContext.MockReplicatedLogEntry(2, 2, new MockRaftActorContext.MockPayload("two-1")));
+            entries.add(
+                new MockRaftActorContext.MockReplicatedLogEntry(2, 3, new MockRaftActorContext.MockPayload("three")));
+
+            // Send appendEntries with the same term as was set on the receiver
+            // before the new behavior was created (1 in this case)
+            // This will not work for a Candidate because as soon as a Candidate
+            // is created it increments the term
+            AppendEntries appendEntries =
+                new AppendEntries(2, "leader-1", 1, 1, entries, 3);
+
+            RaftActorBehavior behavior = createBehavior(context);
+
+            // Send an unknown message so that the state of the RaftActor remains unchanged
+            RaftState expected = behavior.handleMessage(getRef(), "unknown");
+
+            RaftState raftState =
+                behavior.handleMessage(getRef(), appendEntries);
+
+            assertEquals(expected, raftState);
+
+            // The entry at index 2 will be found out-of-sync with the leader
+            // and will be removed
+            // Then the two new entries will be added to the log
+            // Thus making the log to have 4 entries
+            assertEquals(4, log.last().getIndex() + 1);
+            assertNotNull(log.get(2));
+
+            assertEquals("one", log.get(1).getData().toString());
+
+            // Check that the entry at index 2 has the new data
+            assertEquals("two-1", log.get(2).getData().toString());
+
+            assertEquals("three", log.get(3).getData().toString());
+
+            assertNotNull(log.get(3));
+
+            // Also expect an AppendEntriesReply to be sent where success is false
+            final Boolean out = new ExpectMsg<Boolean>(duration("1 seconds"),
+                "AppendEntriesReply") {
+                // do not put code outside this method, will run afterwards
+                protected Boolean match(Object in) {
+                    if (in instanceof AppendEntriesReply) {
+                        AppendEntriesReply reply = (AppendEntriesReply) in;
+                        return reply.isSuccess();
+                    } else {
+                        throw noMatch();
+                    }
+                }
+            }.get();
+
+            assertEquals(true, out);
+
+
+        }};
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/LeaderTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/LeaderTest.java
new file mode 100644 (file)
index 0000000..d33b339
--- /dev/null
@@ -0,0 +1,203 @@
+package org.opendaylight.controller.cluster.raft.behaviors;
+
+import akka.actor.ActorRef;
+import akka.actor.Props;
+import akka.testkit.JavaTestKit;
+import junit.framework.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.raft.MockRaftActorContext;
+import org.opendaylight.controller.cluster.raft.RaftActorContext;
+import org.opendaylight.controller.cluster.raft.RaftState;
+import org.opendaylight.controller.cluster.raft.base.messages.ApplyState;
+import org.opendaylight.controller.cluster.raft.base.messages.Replicate;
+import org.opendaylight.controller.cluster.raft.base.messages.SendHeartBeat;
+import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
+import org.opendaylight.controller.cluster.raft.utils.DoNothingActor;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+
+public class LeaderTest extends AbstractRaftActorBehaviorTest {
+
+    private ActorRef leaderActor =
+        getSystem().actorOf(Props.create(DoNothingActor.class));
+    private ActorRef senderActor =
+        getSystem().actorOf(Props.create(DoNothingActor.class));
+
+    @Test
+    public void testHandleMessageForUnknownMessage() throws Exception {
+        new JavaTestKit(getSystem()) {{
+            Leader leader =
+                new Leader(createActorContext());
+
+            // handle message should return the Leader state when it receives an
+            // unknown message
+            RaftState state = leader.handleMessage(senderActor, "foo");
+            Assert.assertEquals(RaftState.Leader, state);
+        }};
+    }
+
+
+    @Test
+    public void testThatLeaderSendsAHeartbeatMessageToAllFollowers() {
+        new JavaTestKit(getSystem()) {{
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    ActorRef followerActor = getTestActor();
+
+                    MockRaftActorContext actorContext =
+                        (MockRaftActorContext) createActorContext();
+
+                    Map<String, String> peerAddresses = new HashMap();
+
+                    peerAddresses.put(followerActor.path().toString(),
+                        followerActor.path().toString());
+
+                    actorContext.setPeerAddresses(peerAddresses);
+
+                    Leader leader = new Leader(actorContext);
+                    leader.handleMessage(senderActor, new SendHeartBeat());
+
+                    final String out =
+                        new ExpectMsg<String>(duration("1 seconds"), "match hint") {
+                            // do not put code outside this method, will run afterwards
+                            protected String match(Object in) {
+                                Object msg = fromSerializableMessage(in);
+                                if (msg instanceof AppendEntries) {
+                                    if (((AppendEntries)msg).getTerm() == 0) {
+                                        return "match";
+                                    }
+                                    return null;
+                                } else {
+                                    throw noMatch();
+                                }
+                            }
+                        }.get(); // this extracts the received message
+
+                    assertEquals("match", out);
+
+                }
+
+
+            };
+        }};
+    }
+
+    @Test
+    public void testHandleReplicateMessageSendAppendEntriesToFollower() {
+        new JavaTestKit(getSystem()) {{
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    ActorRef followerActor = getTestActor();
+
+                    MockRaftActorContext actorContext =
+                        (MockRaftActorContext) createActorContext();
+
+                    Map<String, String> peerAddresses = new HashMap();
+
+                    peerAddresses.put(followerActor.path().toString(),
+                        followerActor.path().toString());
+
+                    actorContext.setPeerAddresses(peerAddresses);
+
+                    Leader leader = new Leader(actorContext);
+                    RaftState raftState = leader
+                        .handleMessage(senderActor, new Replicate(null, null,
+                            new MockRaftActorContext.MockReplicatedLogEntry(1,
+                                100,
+                                new MockRaftActorContext.MockPayload("foo"))
+                        ));
+
+                    // State should not change
+                    assertEquals(RaftState.Leader, raftState);
+
+                    final String out =
+                        new ExpectMsg<String>(duration("1 seconds"), "match hint") {
+                            // do not put code outside this method, will run afterwards
+                            protected String match(Object in) {
+                                Object msg = fromSerializableMessage(in);
+                                if (msg instanceof AppendEntries) {
+                                    if (((AppendEntries)msg).getTerm() == 0) {
+                                        return "match";
+                                    }
+                                    return null;
+                                } else {
+                                    throw noMatch();
+                                }
+                            }
+                        }.get(); // this extracts the received message
+
+                    assertEquals("match", out);
+
+                }
+
+
+            };
+        }};
+    }
+
+    @Test
+    public void testHandleReplicateMessageWhenThereAreNoFollowers() {
+        new JavaTestKit(getSystem()) {{
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    ActorRef raftActor = getTestActor();
+
+                    MockRaftActorContext actorContext =
+                        new MockRaftActorContext("test", getSystem(), raftActor);
+
+                    Leader leader = new Leader(actorContext);
+                    RaftState raftState = leader
+                        .handleMessage(senderActor, new Replicate(null, "state-id",
+                            new MockRaftActorContext.MockReplicatedLogEntry(1,
+                                100,
+                                new MockRaftActorContext.MockPayload("foo"))
+                        ));
+
+                    // State should not change
+                    assertEquals(RaftState.Leader, raftState);
+
+                    assertEquals(100, actorContext.getCommitIndex());
+
+                    final String out =
+                        new ExpectMsg<String>(duration("1 seconds"),
+                            "match hint") {
+                            // do not put code outside this method, will run afterwards
+                            protected String match(Object in) {
+                                if (in instanceof ApplyState) {
+                                    if (((ApplyState) in).getIdentifier().equals("state-id")) {
+                                        return "match";
+                                    }
+                                    return null;
+                                } else {
+                                    throw noMatch();
+                                }
+                            }
+                        }.get(); // this extracts the received message
+
+                    assertEquals("match", out);
+
+                }
+
+
+            };
+        }};
+    }
+
+    @Override protected RaftActorBehavior createBehavior(
+        RaftActorContext actorContext) {
+        return new Leader(actorContext);
+    }
+
+    @Override protected RaftActorContext createActorContext() {
+        return new MockRaftActorContext("test", getSystem(), leaderActor);
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/protobuff/messages/MockPayloadMessages.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/protobuff/messages/MockPayloadMessages.java
new file mode 100644 (file)
index 0000000..1f618a3
--- /dev/null
@@ -0,0 +1,57 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: MockPayload.proto
+
+package org.opendaylight.controller.cluster.raft.protobuff.messages;
+
+public final class MockPayloadMessages {
+  private MockPayloadMessages() {}
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistry registry) {
+    registry.add(org.opendaylight.controller.cluster.raft.protobuff.messages.MockPayloadMessages.value);
+  }
+  public static final int VALUE_FIELD_NUMBER = 2;
+  /**
+   * <code>extend .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload { ... }</code>
+   */
+  public static final
+    com.google.protobuf.GeneratedMessage.GeneratedExtension<
+      org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
+      java.lang.String> value = com.google.protobuf.GeneratedMessage
+          .newFileScopedGeneratedExtension(
+        java.lang.String.class,
+        null);
+
+  public static com.google.protobuf.Descriptors.FileDescriptor
+      getDescriptor() {
+    return descriptor;
+  }
+  private static com.google.protobuf.Descriptors.FileDescriptor
+      descriptor;
+  static {
+    java.lang.String[] descriptorData = {
+      "\n\021MockPayload.proto\022(org.opendaylight.co" +
+      "ntroller.cluster.raft\032\033AppendEntriesMess" +
+      "ages.proto:a\n\005value\022R.org.opendaylight.c" +
+      "ontroller.cluster.raft.AppendEntries.Rep" +
+      "licatedLogEntry.Payload\030\002 \001(\tBR\n;org.ope" +
+      "ndaylight.controller.cluster.raft.protob" +
+      "uff.messagesB\023MockPayloadMessages"
+    };
+    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+        public com.google.protobuf.ExtensionRegistry assignDescriptors(
+            com.google.protobuf.Descriptors.FileDescriptor root) {
+          descriptor = root;
+          value.internalInit(descriptor.getExtensions().get(0));
+          return null;
+        }
+      };
+    com.google.protobuf.Descriptors.FileDescriptor
+      .internalBuildGeneratedFileFrom(descriptorData,
+        new com.google.protobuf.Descriptors.FileDescriptor[] {
+          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.getDescriptor(),
+        }, assigner);
+  }
+
+  // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/utils/DoNothingActor.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/utils/DoNothingActor.java
new file mode 100644 (file)
index 0000000..741c473
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * 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.raft.utils;
+
+import akka.actor.UntypedActor;
+
+public class DoNothingActor extends UntypedActor{
+    @Override public void onReceive(Object message) throws Exception {
+
+    }
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/resources/MockPayload.proto b/opendaylight/md-sal/sal-akka-raft/src/test/resources/MockPayload.proto
new file mode 100644 (file)
index 0000000..0e0c604
--- /dev/null
@@ -0,0 +1,10 @@
+import "AppendEntriesMessages.proto";
+
+package org.opendaylight.controller.cluster.raft;
+
+option java_package = "org.opendaylight.controller.cluster.raft.protobuff.messages";
+option java_outer_classname = "MockPayloadMessages";
+
+extend AppendEntries.ReplicatedLogEntry.Payload {
+    optional string value = 2;
+}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/resources/application.conf b/opendaylight/md-sal/sal-akka-raft/src/test/resources/application.conf
new file mode 100644 (file)
index 0000000..dbe7508
--- /dev/null
@@ -0,0 +1,20 @@
+akka {
+
+    loglevel = "DEBUG"
+
+    actor {
+        # enable to test serialization only.
+        serialize-messages = on
+
+        serializers {
+          java  = "akka.serialization.JavaSerializer"
+          proto = "akka.remote.serialization.ProtobufSerializer"
+        }
+
+        serialization-bindings {
+            "org.opendaylight.controller.cluster.raft.ReplicatedLogImplEntry" = java
+            "com.google.protobuf.Message" = proto
+            "com.google.protobuf.GeneratedMessage" = proto
+        }
+    }
+}
index eac65ad6775a8b6ac6a9b8c99b8f710a78d9a484..24ec89ebb27da82f92fa569216ee7db5fc07d6cc 100644 (file)
@@ -4,7 +4,7 @@ import org.opendaylight.controller.md.sal.common.api.data.TransactionChain;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-public interface BindingTransactionChain extends TransactionChain<InstanceIdentifier<?>, DataObject> {
+public interface BindingTransactionChain extends TransactionFactory, TransactionChain<InstanceIdentifier<?>, DataObject> {
 
     @Override
     ReadOnlyTransaction newReadOnlyTransaction();
index b60d8ff1be71ba7dc0e22a93f240445868241e10..619a08eac5f30a6f3a7ff7f5f154b1be4c74bdbc 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.controller.md.sal.binding.api;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainFactory;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -20,7 +21,8 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
  * <p>
  * For more information on usage, please see the documentation in {@link AsyncDataBroker}.
  */
-public interface DataBroker extends AsyncDataBroker<InstanceIdentifier<?>, DataObject, DataChangeListener>, BindingService, TransactionChainFactory<InstanceIdentifier<?>, DataObject> {
+public interface DataBroker extends TransactionFactory, AsyncDataBroker<InstanceIdentifier<?>, DataObject, DataChangeListener>, BindingService, TransactionChainFactory<InstanceIdentifier<?>, DataObject> {
+
     @Override
     ReadOnlyTransaction newReadOnlyTransaction();
 
@@ -33,4 +35,7 @@ public interface DataBroker extends AsyncDataBroker<InstanceIdentifier<?>, DataO
     @Override
     ListenerRegistration<DataChangeListener> registerDataChangeListener(LogicalDatastoreType store,
             InstanceIdentifier<?> path, DataChangeListener listener, DataChangeScope triggeringScope);
+
+    @Override
+    BindingTransactionChain createTransactionChain(TransactionChainListener listener);
 }
diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/MountPoint.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/MountPoint.java
new file mode 100644 (file)
index 0000000..ee0a113
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * 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.sal.binding.api;
+
+import org.opendaylight.controller.sal.binding.api.BindingAwareService;
+import org.opendaylight.yangtools.concepts.Identifiable;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+import com.google.common.base.Optional;
+
+public interface MountPoint extends Identifiable<InstanceIdentifier<?>>{
+
+    <T extends BindingAwareService> Optional<T> getService(Class<T> service);
+
+}
diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/MountPointService.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/MountPointService.java
new file mode 100644 (file)
index 0000000..dd3a37e
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * 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.sal.binding.api;
+
+import java.util.EventListener;
+
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+import com.google.common.base.Optional;
+
+public interface MountPointService {
+
+    Optional<MountPoint> getMountPoint(InstanceIdentifier<?> mountPoint);
+
+    <T extends MountPointListener> ListenerRegistration<T> registerListener(InstanceIdentifier<?> path, T listener);
+
+
+    public interface MountPointListener extends EventListener {
+
+        void onMountPointCreated(InstanceIdentifier<?> path);
+
+        void onMountPointRemoved(InstanceIdentifier<?> path);
+
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/TransactionFactory.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/TransactionFactory.java
new file mode 100644 (file)
index 0000000..4483cf9
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * 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.sal.binding.api;
+
+import org.opendaylight.controller.md.sal.common.api.data.AsyncDataTransactionFactory;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public interface TransactionFactory extends AsyncDataTransactionFactory<InstanceIdentifier<?>, DataObject>{
+
+    @Override
+    ReadOnlyTransaction newReadOnlyTransaction();
+
+    @Override
+    ReadWriteTransaction newReadWriteTransaction();
+
+    @Override
+    WriteTransaction newWriteOnlyTransaction();
+
+}
index 0cef81d35922650357ee4bd7e502b5c79f11a3f8..a6ba2e2799b99f884c119dae6ef67e44bd85a562 100644 (file)
@@ -18,8 +18,110 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
  * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
  */
 public interface WriteTransaction extends AsyncWriteTransaction<InstanceIdentifier<?>, DataObject> {
-    @Override
-    void put(LogicalDatastoreType store, InstanceIdentifier<?> path, DataObject data);
+
+    /**
+     * Stores a piece of data at the specified path. This acts as an add / replace
+     * operation, which is to say that whole subtree will be replaced by the specified data.
+     * * <p>
+     * This method does not automatically create missing parent nodes. It is equivalent to invoking
+     * {@link #put(LogicalDatastoreType, InstanceIdentifier, DataObject, boolean)}
+     * with <code>createMissingParents</code> set to false.
+     * <p>
+     * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
+     * <p>
+     * If you need to make sure that a parent object exists but you do not want modify
+     * its pre-existing state by using put, consider using {@link #merge} instead.
+     *
+     * @param store
+     *            the logical data store which should be modified
+     * @param path
+     *            the data object path
+     * @param data
+     *            the data object to be written to the specified path
+     * @throws IllegalStateException
+     *             if the transaction has already been submitted
+     */
+    <T extends DataObject> void put(LogicalDatastoreType store, InstanceIdentifier<T> path, T data);
+
+
+    /**
+     * Stores a piece of data at the specified path. This acts as an add /
+     * replace operation, which is to say that whole subtree will be replaced by
+     * the specified data.
+     * <p>
+     * For more information on usage and examples, please see the documentation
+     * in {@link AsyncWriteTransaction}.
+     * <p>
+     * If you need to make sure that a parent object exists but you do not want
+     * modify its pre-existing state by using put, consider using {@link #merge}
+     * instead.
+     *
+     * Note: Using <code>createMissingParents</code> with value true, may
+     * introduce garbage in data store, or recreate nodes, which were deleted by
+     * previous transaction.
+     *
+     * @param store
+     *            the logical data store which should be modified
+     * @param path
+     *            the data object path
+     * @param data
+     *            the data object to be written to the specified path
+     * @param createMissingParents
+     *            if true, any missing parent nodes will be automatically
+     *            created using a merge operation.
+     * @throws IllegalStateException
+     *             if the transaction has already been submitted
+     */
+    <T extends DataObject> void put(LogicalDatastoreType store, InstanceIdentifier<T> path, T data,
+            boolean createMissingParents);
+
+    /**
+     * Merges a piece of data with the existing data at a specified path. Any pre-existing data
+     * which is not explicitly overwritten will be preserved. This means that if you store a container,
+     * its child lists will be merged.
+     * <p>
+     * This method does not automatically create missing parent nodes. It is equivalent to invoking
+     * {@link #merge(LogicalDatastoreType, InstanceIdentifier, DataObject, boolean)}
+     * with <code>createMissingParents</code> set to false.
+     * <p>
+     * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
+     *<p>
+     * If you require an explicit replace operation, use {@link #put} instead.
+     * @param store
+     *            the logical data store which should be modified
+     * @param path
+     *            the data object path
+     * @param data
+     *            the data object to be merged to the specified path
+     * @throws IllegalStateException
+     *             if the transaction has already been submitted
+     */
+    <T extends DataObject> void merge(LogicalDatastoreType store, InstanceIdentifier<T> path, T data);
+
+    /**
+     * Merges a piece of data with the existing data at a specified path. Any
+     * pre-existing data which is not explicitly overwritten will be preserved.
+     * This means that if you store a container, its child lists will be merged.
+     * <p>
+     * For more information on usage and examples, please see the documentation
+     * in {@link AsyncWriteTransaction}.
+     * <p>
+     * If you require an explicit replace operation, use {@link #put} instead.
+     *
+     * @param store
+     *            the logical data store which should be modified
+     * @param path
+     *            the data object path
+     * @param data
+     *            the data object to be merged to the specified path
+     * @param createMissingParents
+     *            if true, any missing parent nodes will be automatically created
+     *            using a merge operation.
+     * @throws IllegalStateException
+     *             if the transaction has already been submitted
+     */
+    <T extends DataObject> void merge(LogicalDatastoreType store, InstanceIdentifier<T> path, T data,
+            boolean createMissingParents);
 
     @Override
     void delete(LogicalDatastoreType store, InstanceIdentifier<?> path);
index a41186dae11eda694687e7698663dffbc3364c26..5e24560853e733c42744512366721a4d8b12823c 100644 (file)
@@ -168,6 +168,9 @@ public interface BindingAwareBroker {
          * Returns the implemented RPC service interface.
          */
         Class<T> getServiceType();
+
+        @Override
+        void close();
     }
 
     /**
index 5aa3b99b3009ea850c8131eef042391b0d7c6d5a..7fa40b8d070c8301ba892080d587b651318cf1d1 100644 (file)
@@ -33,5 +33,5 @@ public interface DataProviderService extends DataBrokerService, DataProvisionSer
      * @deprecated Data Reader contract is removed from capabilities of MD-SAL and is replaced by  replaced by org.opendaylight.controller.sal.core.spi.data.DOMStore contract.
      */
     @Deprecated
-    Registration<DataReader<InstanceIdentifier<? extends DataObject>,DataObject>> registerDataReader(InstanceIdentifier<? extends DataObject> path,DataReader<InstanceIdentifier<? extends DataObject>,DataObject> reader);
+    Registration registerDataReader(InstanceIdentifier<? extends DataObject> path,DataReader<InstanceIdentifier<? extends DataObject>,DataObject> reader);
 }
index 0f0ce0dc9dd24fb41bc54bde70c196ba2d4d511e..b0c2d742e214046be839cca263dbc0652005aa9b 100644 (file)
@@ -19,11 +19,11 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
 import org.opendaylight.yangtools.yang.data.impl.codec.CodecRegistry;
 import org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException;
-import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.slf4j.Logger;
@@ -74,7 +74,7 @@ public final class RuntimeMappingModule extends
         }
 
         final RuntimeGeneratedMappingServiceImpl service = new RuntimeGeneratedMappingServiceImpl(SingletonHolder.CLASS_POOL);
-        bundleContext.registerService(SchemaServiceListener.class, service, new Hashtable<String,String>());
+        bundleContext.registerService(SchemaContextListener.class, service, new Hashtable<String,String>());
         return service;
     }
 
@@ -127,13 +127,13 @@ public final class RuntimeMappingModule extends
         }
 
         @Override
-        public Entry<InstanceIdentifier, CompositeNode> toDataDom(
+        public Entry<YangInstanceIdentifier, CompositeNode> toDataDom(
                 Entry<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject>, DataObject> entry) {
             return delegate.toDataDom(entry);
         }
 
         @Override
-        public InstanceIdentifier toDataDom(
+        public YangInstanceIdentifier toDataDom(
                 org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject> path) {
             return delegate.toDataDom(path);
         }
@@ -146,7 +146,7 @@ public final class RuntimeMappingModule extends
         }
 
         @Override
-        public org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> fromDataDom(InstanceIdentifier entry)
+        public org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> fromDataDom(YangInstanceIdentifier entry)
                 throws DeserializationException {
             return delegate.fromDataDom(entry);
         }
index 58d78a85dcee79f3eeff39640663dc82533f3aca..2d81b6022d35af1c70fba4adb269ffc2d8c93dce 100644 (file)
@@ -7,11 +7,15 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
+import com.google.common.base.Objects;
+import com.google.common.base.Optional;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
@@ -31,21 +35,16 @@ import org.opendaylight.yangtools.concepts.Delegator;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
 import org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
-import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Objects;
-import com.google.common.base.Optional;
-import com.google.common.collect.Iterables;
-
-public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBroker>, DomForwardedBroker,
-        SchemaContextListener, AutoCloseable {
+public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBroker>, DomForwardedBroker, SchemaContextListener, AutoCloseable {
 
     private static final Logger LOG = LoggerFactory.getLogger(AbstractForwardedDataBroker.class);
     // The Broker to whom we do all forwarding
@@ -58,14 +57,14 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
     private final BindingToNormalizedNodeCodec codec;
     private BindingIndependentConnector connector;
     private ProviderSession context;
-    private final ListenerRegistration<SchemaServiceListener> schemaListenerRegistration;
+    private final ListenerRegistration<SchemaContextListener> schemaListenerRegistration;
 
     protected AbstractForwardedDataBroker(final DOMDataBroker domDataBroker,
             final BindingIndependentMappingService mappingService,final SchemaService schemaService) {
         this.domDataBroker = domDataBroker;
         this.mappingService = mappingService;
         this.codec = new BindingToNormalizedNodeCodec(mappingService);
-        this.schemaListenerRegistration = schemaService.registerSchemaServiceListener(this);
+        this.schemaListenerRegistration = schemaService.registerSchemaContextListener(this);
     }
 
     protected BindingToNormalizedNodeCodec getCodec() {
@@ -91,17 +90,17 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
             final DataChangeScope triggeringScope) {
         DOMDataChangeListener domDataChangeListener = new TranslatingDataChangeInvoker(store, path, listener,
                 triggeringScope);
-        org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath = codec.toNormalized(path);
+        YangInstanceIdentifier domPath = codec.toNormalized(path);
         ListenerRegistration<DOMDataChangeListener> domRegistration = domDataBroker.registerDataChangeListener(store,
                 domPath, domDataChangeListener, triggeringScope);
         return new ListenerRegistrationImpl(listener, domRegistration);
     }
 
     protected Map<InstanceIdentifier<?>, DataObject> toBinding(
-            final Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, ? extends NormalizedNode<?, ?>> normalized) {
+            final Map<YangInstanceIdentifier, ? extends NormalizedNode<?, ?>> normalized) {
         Map<InstanceIdentifier<?>, DataObject> newMap = new HashMap<>();
 
-        for (Map.Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, ? extends NormalizedNode<?, ?>> entry : sortedEntries(normalized)) {
+        for (Map.Entry<YangInstanceIdentifier, ? extends NormalizedNode<?, ?>> entry : sortedEntries(normalized)) {
             try {
                 Optional<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> potential = getCodec().toBinding(
                         entry);
@@ -116,25 +115,43 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
         return newMap;
     }
 
-    private static <T> Iterable<Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier,T>> sortedEntries(final Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, T> map) {
-        ArrayList<Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, T>> entries = new ArrayList<>(map.entrySet());
-        Collections.sort(entries, new Comparator<Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, T>>() {
+    private static final Comparator<Entry<YangInstanceIdentifier, ?>> MAP_ENTRY_COMPARATOR = new Comparator<Entry<YangInstanceIdentifier, ?>>() {
+        @Override
+        public int compare(final Entry<YangInstanceIdentifier, ?> left,
+                final Entry<YangInstanceIdentifier, ?> right) {
+            final Iterator<?> li = left.getKey().getPathArguments().iterator();
+            final Iterator<?> ri = right.getKey().getPathArguments().iterator();
+
+            // Iterate until left is exhausted...
+            while (li.hasNext()) {
+                if (!ri.hasNext()) {
+                    // Left is deeper
+                    return 1;
+                }
 
-            @Override
-            public int compare(final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, T> left,
-                    final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, T> right) {
-                int leftSize = Iterables.size(left.getKey().getPathArguments());
-                int rightSize = Iterables.size(right.getKey().getPathArguments());
-                return Integer.compare(leftSize, rightSize);
+                li.next();
+                ri.next();
             }
-        });
-        return entries;
+
+            // Check if right is exhausted
+            return ri.hasNext() ? -1 : 0;
+        }
+    };
+
+    private static <T> Iterable<Entry<YangInstanceIdentifier,T>> sortedEntries(final Map<YangInstanceIdentifier, T> map) {
+        if (!map.isEmpty()) {
+            ArrayList<Entry<YangInstanceIdentifier, T>> entries = new ArrayList<>(map.entrySet());
+            Collections.sort(entries, MAP_ENTRY_COMPARATOR);
+            return entries;
+        } else {
+            return Collections.emptySet();
+        }
     }
 
     protected Set<InstanceIdentifier<?>> toBinding(
-            final Set<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> normalized) {
+            final Set<YangInstanceIdentifier> normalized) {
         Set<InstanceIdentifier<?>> hashSet = new HashSet<>();
-        for (org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalizedPath : normalized) {
+        for (YangInstanceIdentifier normalizedPath : normalized) {
             try {
                 Optional<InstanceIdentifier<? extends DataObject>> potential = getCodec().toBinding(normalizedPath);
                 if (potential.isPresent()) {
@@ -176,13 +193,13 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
 
         @Override
         public void onDataChanged(
-                final AsyncDataChangeEvent<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> change) {
+                final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
             bindingDataChangeListener.onDataChanged(new TranslatedDataChangeEvent(change, path));
         }
     }
 
     private class TranslatedDataChangeEvent implements AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> {
-        private final AsyncDataChangeEvent<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> domEvent;
+        private final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> domEvent;
         private final InstanceIdentifier<?> path;
 
         private Map<InstanceIdentifier<?>, DataObject> createdCache;
@@ -193,7 +210,7 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
         private Optional<DataObject> updatedDataCache;
 
         public TranslatedDataChangeEvent(
-                final AsyncDataChangeEvent<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> change,
+                final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change,
                 final InstanceIdentifier<?> path) {
             this.domEvent = change;
             this.path = path;
index a6d20c5c34cb06457ccaf8727c40980164fdefe4..e52fcdce23a075dfbc06a79401868d7d88ee3873 100644 (file)
@@ -13,7 +13,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataReadTransaction;
 import org.opendaylight.yangtools.concepts.Delegator;
 import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 import com.google.common.base.Optional;
@@ -22,7 +22,7 @@ import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 
 
-abstract class AbstractForwardedTransaction<T extends AsyncTransaction<InstanceIdentifier, NormalizedNode<?, ?>>>
+abstract class AbstractForwardedTransaction<T extends AsyncTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>>>
         implements Delegator<T>, Identifiable<Object> {
 
     private final T delegate;
@@ -45,7 +45,7 @@ abstract class AbstractForwardedTransaction<T extends AsyncTransaction<InstanceI
     }
 
     @SuppressWarnings("unchecked")
-    protected final <S extends AsyncTransaction<InstanceIdentifier, NormalizedNode<?, ?>>> S getDelegateChecked(final Class<S> txType) {
+    protected final <S extends AsyncTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>>> S getDelegateChecked(final Class<S> txType) {
         Preconditions.checkState(txType.isInstance(delegate));
         return (S) delegate;
     }
index 3988bc6960266654e86110f3c3c96764b8db854d..5ced7bae9fd3459b494a50013e297aacd8b3425f 100644 (file)
@@ -10,16 +10,14 @@ package org.opendaylight.controller.md.sal.binding.impl;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map.Entry;
 import java.util.concurrent.ExecutionException;
 
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationException;
 import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationOperation;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
-import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -34,28 +32,9 @@ public class AbstractReadWriteTransaction extends AbstractWriteTransaction<DOMDa
         super(delegate, codec);
     }
 
-    protected final void doPutWithEnsureParents(final LogicalDatastoreType store, final InstanceIdentifier<?> path, final DataObject data) {
-        final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> normalized = getCodec()
-                .toNormalizedNode(path, data);
-
-        final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalizedPath = normalized.getKey();
-        ensureParentsByMerge(store, normalizedPath, path);
-        LOG.debug("Tx: {} : Putting data {}", getDelegate().getIdentifier(), normalizedPath);
-        doPut(store, path, data);
-    }
-
-    protected final void doMergeWithEnsureParents(final LogicalDatastoreType store, final InstanceIdentifier<?> path, final DataObject data) {
-        final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> normalized = getCodec()
-                .toNormalizedNode(path, data);
-
-        final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalizedPath = normalized.getKey();
-        ensureParentsByMerge(store, normalizedPath, path);
-        LOG.debug("Tx: {} : Merge data {}", getDelegate().getIdentifier(), normalizedPath);
-        doMerge(store, path, data);
-    }
-
-    private final void ensureParentsByMerge(final LogicalDatastoreType store,
-            final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalizedPath,
+    @Override
+    protected final void ensureParentsByMerge(final LogicalDatastoreType store,
+            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalizedPath,
             final InstanceIdentifier<?> path) {
         List<PathArgument> currentArguments = new ArrayList<>();
         DataNormalizationOperation<?> currentOp = getCodec().getDataNormalizer().getRootOperation();
@@ -68,7 +47,7 @@ public class AbstractReadWriteTransaction extends AbstractWriteTransaction<DOMDa
                 throw new IllegalArgumentException(String.format("Invalid child encountered in path %s", path), e);
             }
             currentArguments.add(currentArg);
-            org.opendaylight.yangtools.yang.data.api.InstanceIdentifier currentPath = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.create(
+            org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier currentPath = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.create(
                     currentArguments);
 
             final Optional<NormalizedNode<?, ?>> d;
index a8eef5a3cae2687f6cc552454407e0bb8bf9eb97..65a9c1abebd1b1a0373a2a32b742ceb0f94cfec3 100644 (file)
@@ -16,7 +16,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.Identifiable;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -30,7 +30,7 @@ import com.google.common.util.concurrent.CheckedFuture;
  * Abstract Base Transaction for transactions which are backed by
  * {@link DOMDataWriteTransaction}
  */
-public class AbstractWriteTransaction<T extends DOMDataWriteTransaction> extends
+public abstract class AbstractWriteTransaction<T extends DOMDataWriteTransaction> extends
         AbstractForwardedTransaction<T> {
 
     private static final Logger LOG = LoggerFactory.getLogger(AbstractWriteTransaction.class);
@@ -40,15 +40,36 @@ public class AbstractWriteTransaction<T extends DOMDataWriteTransaction> extends
         super(delegate, codec);
     }
 
-    protected final void doPut(final LogicalDatastoreType store,
-            final InstanceIdentifier<?> path, final DataObject data) {
-       final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> normalized = getCodec()
+
+    public final <U extends DataObject> void put(final LogicalDatastoreType store,
+            final InstanceIdentifier<U> path, final U data, final boolean createParents) {
+       final Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, NormalizedNode<?, ?>> normalized = getCodec()
                 .toNormalizedNode(path, data);
-        ensureListParentIfNeeded(store,path,normalized);
+        if(createParents) {
+            ensureParentsByMerge(store, normalized.getKey(), path);
+        } else {
+            ensureListParentIfNeeded(store,path,normalized);
+        }
         getDelegate().put(store, normalized.getKey(), normalized.getValue());
     }
 
 
+    public final <U extends DataObject> void merge(final LogicalDatastoreType store,
+            final InstanceIdentifier<U> path, final U data,final boolean createParents) {
+
+        final Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, NormalizedNode<?, ?>> normalized = getCodec()
+                .toNormalizedNode(path, data);
+
+        if(createParents) {
+            ensureParentsByMerge(store, normalized.getKey(), path);
+        } else {
+            ensureListParentIfNeeded(store,path,normalized);
+        }
+
+        getDelegate().merge(store, normalized.getKey(), normalized.getValue());
+    }
+
+
     /**
      *
      * Ensures list parent if item is list, otherwise noop.
@@ -82,9 +103,9 @@ public class AbstractWriteTransaction<T extends DOMDataWriteTransaction> extends
      * @param normalized Normalized version of data to be written
      */
     private void ensureListParentIfNeeded(final LogicalDatastoreType store, final InstanceIdentifier<?> path,
-            final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> normalized) {
+            final Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, NormalizedNode<?, ?>> normalized) {
         if(Identifiable.class.isAssignableFrom(path.getTargetType())) {
-            org.opendaylight.yangtools.yang.data.api.InstanceIdentifier parentMapPath = getParent(normalized.getKey()).get();
+            org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier parentMapPath = getParent(normalized.getKey()).get();
             NormalizedNode<?, ?> emptyParent = getCodec().getDefaultNodeFor(parentMapPath);
             getDelegate().merge(store, parentMapPath, emptyParent);
         }
@@ -92,32 +113,34 @@ public class AbstractWriteTransaction<T extends DOMDataWriteTransaction> extends
     }
 
     // FIXME (should be probaly part of InstanceIdentifier)
-    protected static Optional<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> getParent(
-            final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier child) {
+    protected static Optional<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> getParent(
+            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier child) {
 
         Iterable<PathArgument> mapEntryItemPath = child.getPathArguments();
         int parentPathSize = Iterables.size(mapEntryItemPath) - 1;
         if(parentPathSize > 1) {
-            return Optional.of(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.create(Iterables.limit(mapEntryItemPath,  parentPathSize)));
+            return Optional.of(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.create(Iterables.limit(mapEntryItemPath,  parentPathSize)));
         } else if(parentPathSize == 0) {
-            return Optional.of(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.create(Collections.<PathArgument>emptyList()));
+            return Optional.of(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.create(Collections.<PathArgument>emptyList()));
         } else {
             return Optional.absent();
         }
     }
 
-    protected final void doMerge(final LogicalDatastoreType store,
-            final InstanceIdentifier<?> path, final DataObject data) {
-
-        final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> normalized = getCodec()
-                .toNormalizedNode(path, data);
-        ensureListParentIfNeeded(store,path,normalized);
-        getDelegate().merge(store, normalized.getKey(), normalized.getValue());
-    }
+    /**
+     * Subclasses of this class are required to implement creation of parent
+     * nodes based on behaviour of their underlying transaction.
+     *
+     * @param store
+     * @param key
+     * @param path
+     */
+    protected abstract void ensureParentsByMerge(LogicalDatastoreType store,
+            org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier key, InstanceIdentifier<?> path);
 
     protected final void doDelete(final LogicalDatastoreType store,
             final InstanceIdentifier<?> path) {
-        final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalized = getCodec().toNormalized(path);
+        final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized = getCodec().toNormalized(path);
         getDelegate().delete(store, normalized);
     }
 
index 7e622baac3d07e0168173f9f551ed83215c90d79..f261deb99c1863b5c5d5547577ca3e8c1f58875a 100644 (file)
@@ -7,15 +7,23 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.common.impl.service.AbstractDataTransaction;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationException;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationOperation;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 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.YangInstanceIdentifier.PathArgument;
+
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.ListenableFuture;
 
@@ -27,13 +35,37 @@ class BindingDataWriteTransactionImpl<T extends DOMDataWriteTransaction> extends
     }
 
     @Override
-    public void put(final LogicalDatastoreType store, final InstanceIdentifier<?> path, final DataObject data) {
-        doPut(store, path, data);
+    public <U extends DataObject> void put(final LogicalDatastoreType store, final InstanceIdentifier<U> path,
+                                           final U data) {
+        put(store, path, data,false);
     }
 
     @Override
-    public void merge(final LogicalDatastoreType store, final InstanceIdentifier<?> path, final DataObject data) {
-        doMerge(store, path, data);
+    public <T extends DataObject> void merge(final LogicalDatastoreType store, final InstanceIdentifier<T> path,
+                                             final T data) {
+        merge(store, path, data,false);
+    }
+
+
+    @Override
+    protected void ensureParentsByMerge(final LogicalDatastoreType store,
+            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalizedPath, final InstanceIdentifier<?> path) {
+        List<PathArgument> currentArguments = new ArrayList<>();
+        DataNormalizationOperation<?> currentOp = getCodec().getDataNormalizer().getRootOperation();
+        Iterator<PathArgument> iterator = normalizedPath.getPathArguments().iterator();
+        while (iterator.hasNext()) {
+            PathArgument currentArg = iterator.next();
+            try {
+                currentOp = currentOp.getChild(currentArg);
+            } catch (DataNormalizationException e) {
+                throw new IllegalArgumentException(String.format("Invalid child encountered in path %s", path), e);
+            }
+            currentArguments.add(currentArg);
+            org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier currentPath = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.create(
+                    currentArguments);
+
+            getDelegate().merge(store, currentPath, currentOp.createDefault(currentArg));
+        }
     }
 
     @Override
index f8c1cf6b99f4dfd7664251db168b0f59eddce557..66caaea7083af18f1ffaedc3113f4e35d167b4ff 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.md.sal.binding.impl;
 
 import java.lang.reflect.Method;
 import java.util.AbstractMap.SimpleEntry;
+import java.util.Collection;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map.Entry;
@@ -28,9 +29,9 @@ import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.AugmentationIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+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.AugmentationNode;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
@@ -66,7 +67,7 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
         this.bindingToLegacy = mappingService;
     }
 
-    public org.opendaylight.yangtools.yang.data.api.InstanceIdentifier toNormalized(
+    public org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier toNormalized(
             final InstanceIdentifier<? extends DataObject> binding) {
 
         // Used instance-identifier codec do not support serialization of last
@@ -80,17 +81,17 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
         return toNormalizedImpl(binding);
     }
 
-    public Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> toNormalizedNode(
+    public Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, NormalizedNode<?, ?>> toNormalizedNode(
             final InstanceIdentifier<? extends DataObject> bindingPath, final DataObject bindingObject) {
         return toNormalizedNode(toBindingEntry(bindingPath, bindingObject));
 
     }
 
-    public Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> toNormalizedNode(
+    public Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, NormalizedNode<?, ?>> toNormalizedNode(
             final Entry<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject>, DataObject> binding) {
-        Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> legacyEntry = bindingToLegacy
+        Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> legacyEntry = bindingToLegacy
                 .toDataDom(binding);
-        Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> normalizedEntry = legacyToNormalized
+        Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedEntry = legacyToNormalized
                 .toNormalized(legacyEntry);
         LOG.trace("Serialization of {}, Legacy Representation: {}, Normalized Representation: {}", binding,
                 legacyEntry, normalizedEntry);
@@ -101,7 +102,7 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
                 if (child instanceof AugmentationNode) {
                     ImmutableList<PathArgument> childArgs = ImmutableList.<PathArgument> builder()
                             .addAll(normalizedEntry.getKey().getPathArguments()).add(child.getIdentifier()).build();
-                    org.opendaylight.yangtools.yang.data.api.InstanceIdentifier childPath = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+                    org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier childPath = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
                             .create(childArgs);
                     return toDOMEntry(childPath, child);
                 }
@@ -122,7 +123,7 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
      *
      */
     public Optional<InstanceIdentifier<? extends DataObject>> toBinding(
-            final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalized)
+            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized)
                     throws DeserializationException {
 
         PathArgument lastArgument = Iterables.getLast(normalized.getPathArguments());
@@ -139,7 +140,7 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
     }
 
     private Optional<InstanceIdentifier<? extends DataObject>> toBindingAugmented(
-            final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalized)
+            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized)
                     throws DeserializationException {
         Optional<InstanceIdentifier<? extends DataObject>> potential = toBindingImpl(normalized);
         // Shorthand check, if codec already supports deserialization
@@ -157,7 +158,7 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
         // path.
         LOG.trace("Looking for candidates to match {}", normalized);
         for (QName child : lastArgument.getPossibleChildNames()) {
-            org.opendaylight.yangtools.yang.data.api.InstanceIdentifier childPath = normalized.node(child);
+            org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier childPath = normalized.node(child);
             try {
                 if (isNotRepresentable(childPath)) {
                     LOG.trace("Path {} is not BI-representable, skipping it", childPath);
@@ -189,9 +190,9 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
     }
 
     private Optional<InstanceIdentifier<? extends DataObject>> toBindingImpl(
-            final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalized)
+            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized)
                     throws DeserializationException {
-        org.opendaylight.yangtools.yang.data.api.InstanceIdentifier legacyPath;
+        org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier legacyPath;
 
         try {
             if (isNotRepresentable(normalized)) {
@@ -206,7 +207,7 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
         return Optional.<InstanceIdentifier<? extends DataObject>> of(bindingToLegacy.fromDataDom(legacyPath));
     }
 
-    private boolean isNotRepresentable(final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalized)
+    private boolean isNotRepresentable(final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized)
             throws DataNormalizationException {
         DataNormalizationOperation<?> op = findNormalizationOperation(normalized);
         if (op.isMixin() && op.getIdentifier() instanceof NodeIdentifier) {
@@ -219,7 +220,7 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
     }
 
     private DataNormalizationOperation<?> findNormalizationOperation(
-            final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalized)
+            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized)
                     throws DataNormalizationException {
         DataNormalizationOperation<?> current = legacyToNormalized.getRootOperation();
         for (PathArgument arg : normalized.getPathArguments()) {
@@ -235,9 +236,9 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
                 key, value);
     }
 
-    private static final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> toDOMEntry(
-            final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier key, final NormalizedNode<?, ?> value) {
-        return new SimpleEntry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>>(key,
+    private static final Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, NormalizedNode<?, ?>> toDOMEntry(
+            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier key, final NormalizedNode<?, ?> value) {
+        return new SimpleEntry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, NormalizedNode<?, ?>>(key,
                 value);
     }
 
@@ -263,7 +264,7 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
     }
 
     public Optional<Entry<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject>, DataObject>> toBinding(
-            final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, ? extends NormalizedNode<?, ?>> normalized)
+            final Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, ? extends NormalizedNode<?, ?>> normalized)
                     throws DeserializationException {
         Optional<InstanceIdentifier<? extends DataObject>> potentialPath = toBinding(normalized.getKey());
         if (potentialPath.isPresent()) {
@@ -283,15 +284,15 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
         legacyToNormalized = new DataNormalizer(arg0);
     }
 
-    private org.opendaylight.yangtools.yang.data.api.InstanceIdentifier toNormalizedAugmented(
+    private org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier toNormalizedAugmented(
             final InstanceIdentifier<?> augPath) {
-        org.opendaylight.yangtools.yang.data.api.InstanceIdentifier processed = toNormalizedImpl(augPath);
+        org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier processed = toNormalizedImpl(augPath);
         // If used instance identifier codec added supports for deserialization
         // of last AugmentationIdentifier we will just reuse it
         if (isAugmentationIdentifier(processed)) {
             return processed;
         }
-        Optional<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> additionalSerialized;
+        Optional<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> additionalSerialized;
         additionalSerialized = toNormalizedAugmentedUsingChildContainers(augPath, processed);
 
         if (additionalSerialized.isPresent()) {
@@ -324,9 +325,9 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
      *            Processed path
      * @return
      */
-    private Optional<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> toNormalizedAugmentedUsingChildLeafs(
+    private Optional<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> toNormalizedAugmentedUsingChildLeafs(
             final InstanceIdentifier<?> augPath,
-            final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier parentPath) {
+            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier parentPath) {
         try {
             DataNormalizationOperation<?> parentOp = legacyToNormalized.getOperation(parentPath);
             if(!parentOp.getDataSchemaNode().isPresent()) {
@@ -362,14 +363,14 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
      * @return
      */
     @SuppressWarnings("rawtypes")
-    private Optional<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> toNormalizedAugmentedUsingChildContainers(
+    private Optional<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> toNormalizedAugmentedUsingChildContainers(
             final InstanceIdentifier<?> augPath,
-            final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier parentPath) {
+            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier parentPath) {
         for (Class augChild : BindingReflections.getChildrenClasses(augPath.getTargetType())) {
             @SuppressWarnings("unchecked")
             InstanceIdentifier<?> childPath = augPath.child(augChild);
-            org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalized = toNormalizedImpl(childPath);
-            org.opendaylight.yangtools.yang.data.api.InstanceIdentifier potentialDiscovered = shortenToLastAugmentation(
+            org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized = toNormalizedImpl(childPath);
+            org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier potentialDiscovered = shortenToLastAugmentation(
                     normalized, parentPath);
             if (potentialDiscovered != null) {
                 return Optional.of(potentialDiscovered);
@@ -406,9 +407,8 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
         return Iterables.filter(augmentations, new Predicate<AugmentationSchema>() {
             @Override
             public boolean apply(final AugmentationSchema schema) {
-                final Set<DataSchemaNode> childNodes = schema.getChildNodes();
-                return !schema.getChildNodes().isEmpty()
-                        && module.equals(Iterables.get(childNodes, 0).getQName().getModule());
+                final Collection<DataSchemaNode> childNodes = schema.getChildNodes();
+                return !childNodes.isEmpty() && module.equals(Iterables.get(childNodes, 0).getQName().getModule());
             }
         });
     }
@@ -436,9 +436,9 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
                 && method.getName().startsWith("get") && method.getParameterTypes().length == 0;
     }
 
-    private org.opendaylight.yangtools.yang.data.api.InstanceIdentifier shortenToLastAugmentation(
-            final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalized,
-            final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier parentPath) {
+    private org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier shortenToLastAugmentation(
+            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized,
+            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier parentPath) {
         int parentSize = Iterables.size(parentPath.getPathArguments());
         int position = 0;
         int foundPosition = -1;
@@ -450,7 +450,7 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
         }
         if (foundPosition > 0 && foundPosition > parentSize) {
             Iterable<PathArgument> shortened = Iterables.limit(normalized.getPathArguments(), foundPosition);
-            return org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.create(shortened);
+            return org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.create(shortened);
         }
         return null;
     }
@@ -468,11 +468,11 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
         return InstanceIdentifier.create(Iterables.limit(binding.getPathArguments(), foundPosition));
     }
 
-    private org.opendaylight.yangtools.yang.data.api.InstanceIdentifier toNormalizedImpl(
+    private org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier toNormalizedImpl(
             final InstanceIdentifier<? extends DataObject> binding) {
-        final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier legacyPath = bindingToLegacy
+        final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier legacyPath = bindingToLegacy
                 .toDataDom(binding);
-        final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalized = legacyToNormalized
+        final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized = legacyToNormalized
                 .toNormalized(legacyPath);
         return normalized;
     }
@@ -485,7 +485,7 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
         return Augmentation.class.isAssignableFrom(potential.getTargetType());
     }
 
-    private boolean isAugmentationIdentifier(final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier processed) {
+    private boolean isAugmentationIdentifier(final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier processed) {
         return Iterables.getLast(processed.getPathArguments()) instanceof AugmentationIdentifier;
     }
 
@@ -500,7 +500,7 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
         return count;
     }
 
-    private static int getAugmentationCount(final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier potential) {
+    private static int getAugmentationCount(final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier potential) {
         int count = 0;
         for (PathArgument arg : potential.getPathArguments()) {
             if (arg instanceof AugmentationIdentifier) {
@@ -553,7 +553,7 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
      * @param path DOM Path
      * @return Node with defaults set on.
      */
-    public NormalizedNode<?, ?> getDefaultNodeFor(final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path) {
+    public NormalizedNode<?, ?> getDefaultNodeFor(final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier path) {
         Iterator<PathArgument> iterator = path.getPathArguments().iterator();
         DataNormalizationOperation<?> currentOp = legacyToNormalized.getRootOperation();
         while (iterator.hasNext()) {
index 12f26b09bb2cf1645d645438302e705c3c0489ce..c924b74a12bb0e7c6f080e98dffc09352faa16a7 100644 (file)
@@ -55,6 +55,7 @@ import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
 
+@SuppressWarnings("deprecation")
 public class ForwardedBackwardsCompatibleDataBroker extends AbstractForwardedDataBroker implements DataProviderService, AutoCloseable {
 
     private static final Logger LOG = LoggerFactory.getLogger(ForwardedBackwardsCompatibleDataBroker.class);
@@ -87,7 +88,7 @@ public class ForwardedBackwardsCompatibleDataBroker extends AbstractForwardedDat
     }
 
     @Override
-    public Registration<DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject>> registerCommitHandler(
+    public Registration registerCommitHandler(
             final InstanceIdentifier<? extends DataObject> path,
             final DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject> commitHandler) {
 
@@ -122,7 +123,7 @@ public class ForwardedBackwardsCompatibleDataBroker extends AbstractForwardedDat
     }
 
     @Override
-    public Registration<DataReader<InstanceIdentifier<? extends DataObject>, DataObject>> registerDataReader(
+    public Registration registerDataReader(
             final InstanceIdentifier<? extends DataObject> path,
             final DataReader<InstanceIdentifier<? extends DataObject>, DataObject> reader) {
         throw new UnsupportedOperationException("Data reader contract is not supported.");
@@ -213,10 +214,13 @@ public class ForwardedBackwardsCompatibleDataBroker extends AbstractForwardedDat
         @Override
         public void putOperationalData(final InstanceIdentifier<? extends DataObject> path, final DataObject data) {
             boolean previouslyRemoved = posponedRemovedOperational.remove(path);
+
+            @SuppressWarnings({ "rawtypes", "unchecked" })
+            final InstanceIdentifier<DataObject> castedPath = (InstanceIdentifier) path;
             if(previouslyRemoved) {
-                doPutWithEnsureParents(LogicalDatastoreType.OPERATIONAL, path, data);
+                put(LogicalDatastoreType.OPERATIONAL, castedPath, data,true);
             } else {
-                doMergeWithEnsureParents(LogicalDatastoreType.OPERATIONAL, path, data);
+                merge(LogicalDatastoreType.OPERATIONAL, castedPath, data,true);
             }
         }
 
@@ -231,10 +235,12 @@ public class ForwardedBackwardsCompatibleDataBroker extends AbstractForwardedDat
                 created.put(path, data);
             }
             updated.put(path, data);
+            @SuppressWarnings({"rawtypes","unchecked"})
+            final InstanceIdentifier<DataObject> castedPath = (InstanceIdentifier) path;
             if(previouslyRemoved) {
-                doPutWithEnsureParents(LogicalDatastoreType.CONFIGURATION, path, data);
+                put(LogicalDatastoreType.CONFIGURATION, castedPath, data,true);
             } else {
-                doMergeWithEnsureParents(LogicalDatastoreType.CONFIGURATION, path, data);
+                merge(LogicalDatastoreType.CONFIGURATION, castedPath, data,true);
             }
         }
 
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/RpcIsNotRoutedException.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/RpcIsNotRoutedException.java
new file mode 100644 (file)
index 0000000..5317324
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2013 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.codegen;
+
+import com.google.common.base.Preconditions;
+
+/**
+ * Exception is raised when supplied Bidning Aware
+ * RPCService class is not routed and was used in context
+ * where routed RPCs should only be used.
+ *
+ */
+public class RpcIsNotRoutedException extends IllegalStateException {
+
+    private static final long serialVersionUID = 1L;
+
+    public RpcIsNotRoutedException(final String message, final Throwable cause) {
+        super(Preconditions.checkNotNull(message), cause);
+    }
+
+    public RpcIsNotRoutedException(final String message) {
+        super(Preconditions.checkNotNull(message));
+    }
+}
index 9b7b8e28c90657aedc2f53c8c17d1697a0cd6e62..c7c5f10f71bd1073a9e6040ce62b23bbd39c0bc3 100644 (file)
@@ -84,8 +84,9 @@ public interface RuntimeCodeGenerator {
      *            - Subclass of RpcService for which Router is to be generated.
      * @return Instance of RpcService of provided serviceType which implements
      *         also {@link RpcRouter}<T> and {@link org.opendaylight.controller.sal.binding.spi.DelegateProxy}
+     * @throws RpcIsNotRoutedException
      */
-    <T extends RpcService> RpcRouter<T> getRouterFor(Class<T> serviceType,String name) throws IllegalArgumentException;
+    <T extends RpcService> RpcRouter<T> getRouterFor(Class<T> serviceType,String name) throws IllegalArgumentException, RpcIsNotRoutedException;
 
     NotificationInvokerFactory getInvokerFactory();
 }
index 9605a4d3723b6f21ccf8ce5810ad078ba3e3bbd6..1fa54be2005b06d0be70226ac4abd30625f8a8bb 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.sal.binding.codegen.impl;
 
+import com.google.common.base.Supplier;
+
 import java.util.Map;
 import java.util.WeakHashMap;
 
@@ -19,16 +21,16 @@ import javax.annotation.concurrent.GuardedBy;
 
 import org.eclipse.xtext.xbase.lib.Extension;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
+import org.opendaylight.controller.sal.binding.codegen.RpcIsNotRoutedException;
 import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory;
 import org.opendaylight.yangtools.sal.binding.generator.util.JavassistUtils;
+import org.opendaylight.yangtools.yang.binding.BindingMapping;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.NotificationListener;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.opendaylight.yangtools.yang.binding.annotations.RoutingContext;
 import org.opendaylight.yangtools.yang.binding.util.ClassLoaderUtils;
 
-import com.google.common.base.Supplier;
-
 abstract class AbstractRuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.codegen.RuntimeCodeGenerator, NotificationInvokerFactory {
     @GuardedBy("this")
     private final Map<Class<? extends NotificationListener>, RuntimeGeneratedInvokerPrototype> invokerClasses = new WeakHashMap<>();
@@ -56,11 +58,11 @@ abstract class AbstractRuntimeCodeGenerator implements org.opendaylight.controll
     protected abstract <T extends RpcService> Supplier<T> directProxySupplier(final Class<T> serviceType);
     protected abstract <T extends RpcService> Supplier<T> routerSupplier(final Class<T> serviceType, RpcServiceMetadata metadata);
 
-    private RpcServiceMetadata getRpcMetadata(final CtClass iface) throws ClassNotFoundException, NotFoundException {
+    private RpcServiceMetadata getRpcMetadata(final CtClass iface) throws ClassNotFoundException, NotFoundException, RpcIsNotRoutedException {
         final RpcServiceMetadata metadata = new RpcServiceMetadata();
 
         for (CtMethod method : iface.getMethods()) {
-            if (iface.equals(method.getDeclaringClass()) && method.getParameterTypes().length == 1) {
+            if (isRpcMethodWithInput(iface, method)) {
                 final RpcMetadata routingPair = getRpcMetadata(method);
                 if (routingPair != null) {
                     metadata.addContext(routingPair.getContext());
@@ -81,6 +83,8 @@ abstract class AbstractRuntimeCodeGenerator implements org.opendaylight.controll
                      *        remains to be investigated.
                      */
                     Thread.currentThread().getContextClassLoader().loadClass(routingPair.getInputType().getName());
+                } else {
+                    throw new RpcIsNotRoutedException("RPC " + method.getName() + " from "+ iface.getName() +" is not routed");
                 }
             }
         }
@@ -88,6 +92,18 @@ abstract class AbstractRuntimeCodeGenerator implements org.opendaylight.controll
         return metadata;
     }
 
+
+    private boolean isRpcMethodWithInput(final CtClass iface, final CtMethod method) throws NotFoundException {
+        if(iface.equals(method.getDeclaringClass())
+                && method.getParameterTypes().length == 1) {
+            final CtClass onlyArg = method.getParameterTypes()[0];
+            if(onlyArg.isInterface() && onlyArg.getName().endsWith(BindingMapping.RPC_INPUT_SUFFIX)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     private RpcMetadata getRpcMetadata(final CtMethod method) throws NotFoundException {
         final CtClass inputClass = method.getParameterTypes()[0];
         return rpcMethodMetadata(inputClass, inputClass, method.getName());
@@ -120,20 +136,17 @@ abstract class AbstractRuntimeCodeGenerator implements org.opendaylight.controll
             return invoker;
         }
 
-        utils.getLock().lock();
-        try {
+        synchronized (utils) {
             invoker = ClassLoaderUtils.withClassLoader(cls.getClassLoader(), new Supplier<RuntimeGeneratedInvokerPrototype>() {
                 @Override
                 public RuntimeGeneratedInvokerPrototype get() {
                     return generateListenerInvoker(cls);
                 }
             });
-
-            invokerClasses.put(cls, invoker);
-            return invoker;
-        } finally {
-            utils.getLock().unlock();
         }
+
+        invokerClasses.put(cls, invoker);
+        return invoker;
     }
 
     @Override
@@ -143,16 +156,13 @@ abstract class AbstractRuntimeCodeGenerator implements org.opendaylight.controll
 
     @Override
     public final <T extends RpcService> T getDirectProxyFor(final Class<T> serviceType) {
-        utils.getLock().lock();
-        try {
+        synchronized (utils) {
             return ClassLoaderUtils.withClassLoader(serviceType.getClassLoader(), directProxySupplier(serviceType));
-        } finally {
-            utils.getLock().unlock();
         }
     }
 
     @Override
-    public final <T extends RpcService> RpcRouter<T> getRouterFor(final Class<T> serviceType, final String name) {
+    public final <T extends RpcService> RpcRouter<T> getRouterFor(final Class<T> serviceType, final String name) throws RpcIsNotRoutedException {
         final RpcServiceMetadata metadata = ClassLoaderUtils.withClassLoader(serviceType.getClassLoader(), new Supplier<RpcServiceMetadata>() {
             @Override
             public RpcServiceMetadata get() {
@@ -164,12 +174,9 @@ abstract class AbstractRuntimeCodeGenerator implements org.opendaylight.controll
             }
         });
 
-        utils.getLock().lock();
-        try {
+        synchronized (utils) {
             final T instance = ClassLoaderUtils.withClassLoader(serviceType.getClassLoader(), routerSupplier(serviceType, metadata));
             return new RpcRouterCodegenInstance<T>(name, serviceType, instance, metadata.getContexts());
-        } finally {
-            utils.getLock().unlock();
         }
     }
 
index 9ede01b6a3e62ba3bdbd685b22309ab799b09ba7..d4cfb563f633cb1f21a0a6055010a9a98bfd19b7 100644 (file)
@@ -147,14 +147,14 @@ public class DataBrokerImpl extends
         }
 
         @Override
-        public Registration<DataReader<InstanceIdentifier<? extends DataObject>, DataObject>> registerConfigurationReader(
+        public Registration registerConfigurationReader(
                 final InstanceIdentifier<? extends DataObject> path,
                 final DataReader<InstanceIdentifier<? extends DataObject>, DataObject> reader) {
             throw new UnsupportedOperationException("Not supported");
         }
 
         @Override
-        public Registration<DataReader<InstanceIdentifier<? extends DataObject>, DataObject>> registerOperationalReader(
+        public Registration registerOperationalReader(
                 final InstanceIdentifier<? extends DataObject> path,
                 final DataReader<InstanceIdentifier<? extends DataObject>, DataObject> reader) {
             throw new UnsupportedOperationException("Not supported");
index df09f78620a11bcce20f04034e6a7b7cf144780f..05651bfabe5c521d66c25a219fb096b5d9ef0ecb 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.sal.binding.impl;
 
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.Executors;
 
 import org.opendaylight.controller.md.sal.binding.util.AbstractBindingSalProviderInstance;
 import org.opendaylight.controller.sal.binding.api.mount.MountProviderInstance;
@@ -20,6 +21,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
 
 public class MountPointManagerImpl implements MountProviderService {
 
@@ -82,7 +84,7 @@ public class MountPointManagerImpl implements MountProviderService {
         RpcProviderRegistryImpl rpcRegistry = new RpcProviderRegistryImpl("mount");
         NotificationBrokerImpl notificationBroker = new NotificationBrokerImpl(getNotificationExecutor());
         DataBrokerImpl dataBroker = new DataBrokerImpl();
-        dataBroker.setExecutor(getDataCommitExecutor());
+        dataBroker.setExecutor(MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor()));
         BindingMountPointImpl mountInstance = new BindingMountPointImpl(path, rpcRegistry, notificationBroker,
                 dataBroker);
         mountPoints.putIfAbsent(path, mountInstance);
index c61ec4926a65f58f31fd03657162b0af70b23c0e..f2e467038f003cbc3acaa9dad3f4d108b0df691c 100644 (file)
@@ -9,16 +9,14 @@ package org.opendaylight.controller.sal.binding.impl;
 
 import static com.google.common.base.Preconditions.checkState;
 
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-
 import java.util.EventListener;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
-import java.util.WeakHashMap;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChange;
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
@@ -29,6 +27,7 @@ import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistr
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
+import org.opendaylight.controller.sal.binding.codegen.RpcIsNotRoutedException;
 import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeGenerator;
 import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper;
 import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;
@@ -41,6 +40,13 @@ import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Throwables;
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import com.google.common.util.concurrent.UncheckedExecutionException;
+
 public class RpcProviderRegistryImpl implements RpcProviderRegistry, RouteChangePublisher<RpcContextIdentifier, InstanceIdentifier<?>> {
 
     private RuntimeCodeGenerator rpcFactory = SingletonHolder.RPC_GENERATOR_IMPL;
@@ -56,7 +62,9 @@ public class RpcProviderRegistryImpl implements RpcProviderRegistry, RouteChange
                 }
             });
 
-    private final Map<Class<? extends RpcService>, RpcRouter<?>> rpcRouters = new WeakHashMap<>();
+    private final Cache<Class<? extends RpcService>, RpcRouter<?>> rpcRouters = CacheBuilder.newBuilder().weakKeys()
+            .build();
+
     private final ListenerRegistry<RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> routeChangeListeners = ListenerRegistry
             .create();
     private final ListenerRegistry<RouterInstantiationListener> routerInstantiationListener = ListenerRegistry.create();
@@ -85,12 +93,20 @@ public class RpcProviderRegistryImpl implements RpcProviderRegistry, RouteChange
     @Override
     public final <T extends RpcService> RpcRegistration<T> addRpcImplementation(final Class<T> type, final T implementation)
             throws IllegalStateException {
-        @SuppressWarnings("unchecked")
-        RpcRouter<T> potentialRouter = (RpcRouter<T>) rpcRouters.get(type);
-        if (potentialRouter != null) {
+
+        // FIXME: This should be well documented - addRpcImplementation for
+        // routed RPCs
+        try {
+            // Note: If RPC is really global, expected count of registrations
+            // of this method is really low.
+            RpcRouter<T> potentialRouter = getRpcRouter(type);
             checkState(potentialRouter.getDefaultService() == null,
-                    "Default service for routed RPC already registered.");
+                        "Default service for routed RPC already registered.");
             return potentialRouter.registerDefaultService(implementation);
+        } catch (RpcIsNotRoutedException e) {
+            // NOOP - we could safely continue, since RPC is not routed
+            // so we fallback to global routing.
+            LOG.debug("RPC is not routed. Using global registration.",e);
         }
         T publicProxy = getRpcService(type);
         RpcService currentDelegate = RuntimeCodeHelper.getDelegate(publicProxy);
@@ -107,28 +123,37 @@ public class RpcProviderRegistryImpl implements RpcProviderRegistry, RouteChange
         return (T) publicProxies.getUnchecked(type);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
+
     public <T extends RpcService> RpcRouter<T> getRpcRouter(final Class<T> type) {
-        RpcRouter<?> potentialRouter = rpcRouters.get(type);
-        if (potentialRouter != null) {
-            return (RpcRouter<T>) potentialRouter;
-        }
-        synchronized (this) {
-            /**
-             * Potential Router could be instantiated by other thread while we
-             * were waiting for the lock.
-             */
-            potentialRouter = rpcRouters.get(type);
-            if (potentialRouter != null) {
-                return (RpcRouter<T>) potentialRouter;
+        try {
+            final AtomicBoolean created = new AtomicBoolean(false);
+            @SuppressWarnings( "unchecked")
+            // LoadingCache is unsuitable for RpcRouter since we need to distinguish
+            // first creation of RPC Router, so that is why
+            // we are using normal cache with load API and shared AtomicBoolean
+            // for this call, which will be set to true if router was created.
+            RpcRouter<T> router = (RpcRouter<T>) rpcRouters.get(type,new Callable<RpcRouter<?>>() {
+
+                @Override
+                public org.opendaylight.controller.sal.binding.api.rpc.RpcRouter<?> call()  {
+                    RpcRouter<?> router = rpcFactory.getRouterFor(type, name);
+                    router.registerRouteChangeListener(new RouteChangeForwarder<T>(type));
+                    LOG.debug("Registering router {} as global implementation of {} in {}", router, type.getSimpleName(), this);
+                    RuntimeCodeHelper.setDelegate(getRpcService(type), router.getInvocationProxy());
+                    created.set(true);
+                    return router;
+                }
+            });
+            if(created.get()) {
+                notifyListenersRoutedCreated(router);
             }
-            RpcRouter<T> router = rpcFactory.getRouterFor(type, name);
-            router.registerRouteChangeListener(new RouteChangeForwarder(type));
-            LOG.debug("Registering router {} as global implementation of {} in {}", router, type.getSimpleName(), this);
-            RuntimeCodeHelper.setDelegate(getRpcService(type), router.getInvocationProxy());
-            rpcRouters.put(type, router);
-            notifyListenersRoutedCreated(router);
             return router;
+        } catch (ExecutionException | UncheckedExecutionException e) {
+            // We rethrow Runtime Exceptions which were wrapped by
+            // Execution Exceptions
+            // otherwise we throw IllegalStateException with original
+            Throwables.propagateIfPossible(e.getCause());
+            throw new IllegalStateException("Could not load RPC Router for "+type.getName(),e);
         }
     }
 
@@ -159,7 +184,7 @@ public class RpcProviderRegistryImpl implements RpcProviderRegistry, RouteChange
             final RouterInstantiationListener listener) {
         ListenerRegistration<RouterInstantiationListener> reg = routerInstantiationListener.register(listener);
         try {
-            for (RpcRouter<?> router : rpcRouters.values()) {
+            for (RpcRouter<?> router : rpcRouters.asMap().values()) {
                 listener.onRpcRouterCreated(router);
             }
         } catch (Exception e) {
@@ -225,7 +250,7 @@ public class RpcProviderRegistryImpl implements RpcProviderRegistry, RouteChange
                 try {
                     listener.getInstance().onRouteChange(toPublish);
                 } catch (Exception e) {
-                    e.printStackTrace();
+                    LOG.error("Unhandled exception during invoking listener",listener.getInstance(),e);
                 }
             }
         }
index 71253d02d66ff0230ad483dea2297afee072c8ba..d00d8b7fa83894c6a4a1a2b19894ddfae2513d78 100644 (file)
@@ -16,7 +16,6 @@ import java.util.Collections;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import org.opendaylight.controller.md.sal.binding.impl.AbstractForwardedDataBroker;
-import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublisher;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
@@ -47,7 +46,7 @@ public class BindingIndependentConnector implements //
         AutoCloseable {
 
     private static final Logger LOG = LoggerFactory.getLogger(BindingIndependentConnector.class);
-    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier ROOT_BI = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+    private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier ROOT_BI = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
             .builder().toInstance();
 
     private BindingIndependentMappingService mappingService;
@@ -59,7 +58,7 @@ public class BindingIndependentConnector implements //
     private final BindingToDomCommitHandler bindingToDomCommitHandler;
     private final DomToBindingCommitHandler domToBindingCommitHandler;
 
-    private Registration<DataCommitHandler<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode>> biCommitHandlerRegistration;
+    private Registration biCommitHandlerRegistration;
     private RpcProvisionRegistry biRpcRegistry;
     private RpcProviderRegistry baRpcRegistry;
 
@@ -89,7 +88,7 @@ public class BindingIndependentConnector implements //
     @Override
     public DataObject readOperationalData(final InstanceIdentifier<? extends DataObject> path) {
         try {
-            org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath = mappingService.toDataDom(path);
+            org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier biPath = mappingService.toDataDom(path);
             CompositeNode result = biDataService.readOperationalData(biPath);
             return potentialAugmentationRead(path, biPath, result);
         } catch (DeserializationException e) {
@@ -98,7 +97,7 @@ public class BindingIndependentConnector implements //
     }
 
     private DataObject potentialAugmentationRead(InstanceIdentifier<? extends DataObject> path,
-            final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath, final CompositeNode result)
+            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier biPath, final CompositeNode result)
             throws DeserializationException {
         Class<? extends DataObject> targetType = path.getTargetType();
         if (Augmentation.class.isAssignableFrom(targetType)) {
@@ -115,7 +114,7 @@ public class BindingIndependentConnector implements //
     @Override
     public DataObject readConfigurationData(final InstanceIdentifier<? extends DataObject> path) {
         try {
-            org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath = mappingService.toDataDom(path);
+            org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier biPath = mappingService.toDataDom(path);
             CompositeNode result = biDataService.readConfigurationData(biPath);
             return potentialAugmentationRead(path, biPath, result);
         } catch (DeserializationException e) {
index 743430938735624d1640800ee44059b02f40ab3d..44198bfc767bd8454a7bd83ef3bbfad4b553b3fa 100644 (file)
@@ -76,25 +76,25 @@ class BindingToDomCommitHandler implements
         DataModificationTransaction target = biDataService.beginTransaction();
         LOG.debug("Created DOM Transaction {} for {},", target.getIdentifier(), source.getIdentifier());
         for (InstanceIdentifier<? extends DataObject> entry : source.getRemovedConfigurationData()) {
-            org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biEntry = mappingService.toDataDom(entry);
+            org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier biEntry = mappingService.toDataDom(entry);
             target.removeConfigurationData(biEntry);
             LOG.debug("Delete of Binding Configuration Data {} is translated to {}", entry, biEntry);
         }
         for (InstanceIdentifier<? extends DataObject> entry : source.getRemovedOperationalData()) {
-            org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biEntry = mappingService.toDataDom(entry);
+            org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier biEntry = mappingService.toDataDom(entry);
             target.removeOperationalData(biEntry);
             LOG.debug("Delete of Binding Operational Data {} is translated to {}", entry, biEntry);
         }
         for (Map.Entry<InstanceIdentifier<? extends DataObject>, DataObject> entry : source.getUpdatedConfigurationData()
             .entrySet()) {
-            Map.Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> biEntry = mappingService
+            Map.Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> biEntry = mappingService
                 .toDataDom(entry);
             target.putConfigurationData(biEntry.getKey(), biEntry.getValue());
             LOG.debug("Update of Binding Configuration Data {} is translated to {}", entry, biEntry);
         }
         for (Map.Entry<InstanceIdentifier<? extends DataObject>, DataObject> entry : source.getUpdatedOperationalData()
             .entrySet()) {
-            Map.Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> biEntry = mappingService
+            Map.Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> biEntry = mappingService
                 .toDataDom(entry);
             target.putOperationalData(biEntry.getKey(), biEntry.getValue());
             LOG.debug("Update of Binding Operational Data {} is translated to {}", entry, biEntry);
index 88024b9af2ce9e478352e2feba43baa8dfa5557b..43334f06ac5b9aa1761998ffbc7e161725d43208 100644 (file)
@@ -23,7 +23,7 @@ import org.slf4j.LoggerFactory;
 @Deprecated
 class DomToBindingCommitHandler implements //
     RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier<? extends DataObject>, DataObject>>, //
-    DataCommitHandler<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> {
+    DataCommitHandler<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> {
 
     private final Logger LOG = LoggerFactory.getLogger(DomToBindingCommitHandler.class);
 
@@ -60,8 +60,8 @@ class DomToBindingCommitHandler implements //
     }
 
     @Override
-    public org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> requestCommit(
-        final DataModification<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> domTransaction) {
+    public org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> requestCommit(
+        final DataModification<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> domTransaction) {
         Object identifier = domTransaction.getIdentifier();
 
         /**
@@ -82,7 +82,7 @@ class DomToBindingCommitHandler implements //
     }
 
     private org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction createDomToBindingTransaction(
-        final DataModification<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> source) {
+        final DataModification<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> source) {
         if (baDataService == null) {
             final String msg = "Binding Aware Service is not initialized correctly! DOM to Binding Transaction cannot be created for ";
             LOG.error(msg + "{}", source);
@@ -96,7 +96,7 @@ class DomToBindingCommitHandler implements //
 
         org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction target = baDataService
             .beginTransaction();
-        for (org.opendaylight.yangtools.yang.data.api.InstanceIdentifier entry : source.getRemovedConfigurationData()) {
+        for (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier entry : source.getRemovedConfigurationData()) {
             try {
 
                 InstanceIdentifier<?> baEntry = mappingService.fromDataDom(entry);
@@ -105,7 +105,7 @@ class DomToBindingCommitHandler implements //
                 LOG.error("Ommiting from BA transaction: {}.", entry, e);
             }
         }
-        for (org.opendaylight.yangtools.yang.data.api.InstanceIdentifier entry : source.getRemovedOperationalData()) {
+        for (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier entry : source.getRemovedOperationalData()) {
             try {
 
                 InstanceIdentifier<?> baEntry = mappingService.fromDataDom(entry);
@@ -114,7 +114,7 @@ class DomToBindingCommitHandler implements //
                 LOG.error("Ommiting from BA transaction: {}.", entry, e);
             }
         }
-        for (Map.Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> entry : source
+        for (Map.Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> entry : source
             .getUpdatedConfigurationData().entrySet()) {
             try {
                 InstanceIdentifier<?> baKey = mappingService.fromDataDom(entry.getKey());
@@ -124,7 +124,7 @@ class DomToBindingCommitHandler implements //
                 LOG.error("Ommiting from BA transaction: {}.", entry.getKey(), e);
             }
         }
-        for (Map.Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> entry : source
+        for (Map.Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> entry : source
             .getUpdatedOperationalData().entrySet()) {
             try {
 
index ffcab597b14aab379fa59133edae016ab4b0f5e6..ab6d56c15a5bdb696f5cb136965519206f40ef79 100644 (file)
@@ -58,7 +58,7 @@ class DomToBindingRpcForwarder implements RpcImplementation, InvocationHandler {
     private final RpcProviderRegistry baRpcRegistry;
     private final RpcProviderRegistryImpl baRpcRegistryImpl;
 
-    private final Function<InstanceIdentifier<?>, org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> toDOMInstanceIdentifier;
+    private final Function<InstanceIdentifier<?>, org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> toDOMInstanceIdentifier;
 
     private final static Method EQUALS_METHOD;
 
@@ -75,10 +75,10 @@ class DomToBindingRpcForwarder implements RpcImplementation, InvocationHandler {
         this.rpcServiceType = new WeakReference<Class<? extends RpcService>>(service);
         this.supportedRpcs = mappingService.getRpcQNamesFor(service);
 
-        toDOMInstanceIdentifier = new Function<InstanceIdentifier<?>, org.opendaylight.yangtools.yang.data.api.InstanceIdentifier>() {
+        toDOMInstanceIdentifier = new Function<InstanceIdentifier<?>, org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier>() {
 
             @Override
-            public org.opendaylight.yangtools.yang.data.api.InstanceIdentifier apply(final InstanceIdentifier<?> input) {
+            public org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier apply(final InstanceIdentifier<?> input) {
                 return mappingService.toDataDom(input);
             }
         };
@@ -162,7 +162,7 @@ class DomToBindingRpcForwarder implements RpcImplementation, InvocationHandler {
     public void registerPaths(final Class<? extends BaseIdentity> context,
         final Class<? extends RpcService> service, final Set<InstanceIdentifier<?>> set) {
         QName ctx = BindingReflections.findQName(context);
-        for (org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path : FluentIterable.from(set).transform(
+        for (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier path : FluentIterable.from(set).transform(
             toDOMInstanceIdentifier)) {
             for (org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration reg : registrations) {
                 reg.registerPath(ctx, path);
@@ -188,7 +188,7 @@ class DomToBindingRpcForwarder implements RpcImplementation, InvocationHandler {
     public void removePaths(final Class<? extends BaseIdentity> context, final Class<? extends RpcService> service,
         final Set<InstanceIdentifier<?>> set) {
         QName ctx = BindingReflections.findQName(context);
-        for (org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path : FluentIterable.from(set).transform(
+        for (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier path : FluentIterable.from(set).transform(
             toDOMInstanceIdentifier)) {
             for (org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration reg : registrations) {
                 reg.unregisterPath(ctx, path);
index cb271a1a9110f0c4cde4a1c3eb3e7138ddcdc58a..a5a34dad807e7800fc422c4b256f6067a61c5451 100644 (file)
@@ -10,18 +10,18 @@ import org.opendaylight.controller.md.sal.common.api.data.DataModification;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 class DomToBindingTransaction implements
-    DataCommitHandler.DataCommitTransaction<InstanceIdentifier, CompositeNode> {
+    DataCommitHandler.DataCommitTransaction<YangInstanceIdentifier, CompositeNode> {
 
     private final org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction backing;
-    private final DataModification<InstanceIdentifier, CompositeNode> modification;
+    private final DataModification<YangInstanceIdentifier, CompositeNode> modification;
     private final ConcurrentMap<Object, DomToBindingTransaction> bindingOpenedTransactions;
 
     public DomToBindingTransaction(
     final org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction backing,
-    final DataModification<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> modification,
+    final DataModification<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> modification,
         ConcurrentMap<Object, DomToBindingTransaction> bindingOpenedTransactions) {
         super();
         this.backing = backing;
@@ -31,7 +31,7 @@ class DomToBindingTransaction implements
     }
 
     @Override
-    public DataModification<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getModification() {
+    public DataModification<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getModification() {
         return modification;
     }
 
index 8c74008990614ea07bba2499508c7d6143a15c4a..92836631a80c26e2a9cfd6807e77e74d75b5f418 100644 (file)
@@ -18,7 +18,7 @@ import org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException;
 import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionService.MountProvisionListener;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
@@ -33,7 +33,7 @@ public class DomForwardedBindingBrokerImpl extends RootBindingAwareBroker implem
     private final BindingMountPointForwardingManager bindingForwardingManager = new BindingMountPointForwardingManager();
 
     private ConcurrentMap<InstanceIdentifier<?>, BindingIndependentConnector> connectors = new ConcurrentHashMap<>();
-    private ConcurrentMap<InstanceIdentifier<?>, org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> forwarded = new ConcurrentHashMap<>();
+    private ConcurrentMap<InstanceIdentifier<?>, org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> forwarded = new ConcurrentHashMap<>();
     private ListenerRegistration<MountProvisionListener> domListenerRegistration;
     private ListenerRegistration<org.opendaylight.controller.sal.binding.api.mount.MountProviderService.MountProvisionListener> baListenerRegistration;
 
@@ -89,8 +89,8 @@ public class DomForwardedBindingBrokerImpl extends RootBindingAwareBroker implem
     }
 
     private void tryToDeployConnector(InstanceIdentifier<?> baPath,
-            org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath) {
-        org.opendaylight.yangtools.yang.data.api.InstanceIdentifier previous = forwarded.putIfAbsent(baPath, biPath);
+            org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier biPath) {
+        org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier previous = forwarded.putIfAbsent(baPath, biPath);
         if (previous != null) {
             return;
         }
@@ -111,7 +111,7 @@ public class DomForwardedBindingBrokerImpl extends RootBindingAwareBroker implem
         return mountConnector;
     }
 
-    public synchronized void tryToDeployDomForwarder(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath) {
+    public synchronized void tryToDeployDomForwarder(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier domPath) {
         InstanceIdentifier<?> baPath;
         try {
             baPath = connector.getMappingService().fromDataDom(domPath);
@@ -130,7 +130,7 @@ public class DomForwardedBindingBrokerImpl extends RootBindingAwareBroker implem
         if (potentialConnector != null) {
             return;
         }
-        org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath = connector.getMappingService().toDataDom(baPath);
+        org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier domPath = connector.getMappingService().toDataDom(baPath);
         tryToDeployConnector(baPath, domPath);
     }
 
@@ -138,19 +138,19 @@ public class DomForwardedBindingBrokerImpl extends RootBindingAwareBroker implem
         // FIXME: Implement closeMountPoint
     }
 
-    public synchronized void undeployDomForwarder(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier biPath) {
+    public synchronized void undeployDomForwarder(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier biPath) {
         // FIXME: Implement closeMountPoint
     }
 
     private class DomMountPointForwardingManager implements MountProvisionListener {
 
         @Override
-        public void onMountPointCreated(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path) {
+        public void onMountPointCreated(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier path) {
             tryToDeployDomForwarder(path);
         }
 
         @Override
-        public void onMountPointRemoved(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path) {
+        public void onMountPointRemoved(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier path) {
             undeployDomForwarder(path);
         }
     }
index 6b05b1046f66c427c506457c27bb8bad7d6ac689..fd0a169694c5836b52fe02bc1207805cd071ffef 100644 (file)
@@ -14,8 +14,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.AugmentationIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 public class BindingNormalizedCodecTest extends AbstractSchemaAwareTest {
index 110e5b4dce3f02e7f32aad00d0c8915ea188bb47..8782046eeef3c13da933bc01ab8d68476b0a0664 100644 (file)
@@ -23,6 +23,7 @@ import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcR
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
+import org.opendaylight.controller.sal.binding.codegen.RpcIsNotRoutedException;
 import org.opendaylight.controller.sal.binding.impl.RpcProviderRegistryImpl;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.bi.ba.rpcservice.rev140701.OpendaylightTestRpcServiceService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList;
@@ -77,6 +78,28 @@ public class RpcProviderRegistryTest {
         assertNotNull(regTwo);
     }
 
+    @Test
+    public void routedRpcRegisteredUsingGlobalAsDefaultInstance() throws Exception {
+        OpendaylightTestRoutedRpcService def = Mockito.mock(OpendaylightTestRoutedRpcService.class);
+        rpcRegistry.addRpcImplementation(OpendaylightTestRoutedRpcService.class, def);
+        RpcRouter<OpendaylightTestRoutedRpcService> router = rpcRegistry.getRpcRouter(OpendaylightTestRoutedRpcService.class);
+        assertEquals(def, router.getDefaultService());
+    }
+
+    @Test
+    public void nonRoutedRegisteredAsRouted() {
+        OpendaylightTestRpcServiceService one = Mockito.mock(OpendaylightTestRpcServiceService.class);
+        try {
+            rpcRegistry.addRoutedRpcImplementation(OpendaylightTestRpcServiceService.class, one);
+            fail("RpcIsNotRoutedException should be thrown");
+        } catch (RpcIsNotRoutedException e) {
+            assertNotNull(e.getMessage());
+        } catch (Exception e) {
+            fail("RpcIsNotRoutedException should be thrown");
+        }
+
+    }
+
     @Test
     public void testRpcRouterInstance() throws Exception  {
         OpendaylightTestRoutedRpcService def = Mockito.mock(OpendaylightTestRoutedRpcService.class);
index b577e2af1f2c845586615985fa77ec1169abd291..b504837d6780aa344eb706a786733b321a2fa65e 100644 (file)
@@ -7,12 +7,16 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl.test;
 
+import static org.junit.Assert.assertTrue;
+
 import java.util.concurrent.ExecutionException;
 
 import org.junit.Test;
+import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.binding.test.AbstractDataBrokerTest;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.Top;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TopBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList;
@@ -20,19 +24,49 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelListKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
+import com.google.common.base.Optional;
+
 
 public class WriteTransactionTest extends AbstractDataBrokerTest {
 
     private static final InstanceIdentifier<Top> TOP_PATH = InstanceIdentifier.create(Top.class);
     private static final TopLevelListKey TOP_LIST_KEY = new TopLevelListKey("foo");
     private static final InstanceIdentifier<TopLevelList> NODE_PATH = TOP_PATH.child(TopLevelList.class, TOP_LIST_KEY);
-
+    private static final TopLevelList NODE = new TopLevelListBuilder().setKey(TOP_LIST_KEY).build();
     @Test
     public void test() throws InterruptedException, ExecutionException {
         WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
         writeTx.put(LogicalDatastoreType.OPERATIONAL, TOP_PATH, new TopBuilder().build());
-        writeTx.put(LogicalDatastoreType.OPERATIONAL, NODE_PATH, new TopLevelListBuilder().setKey(TOP_LIST_KEY).build());
+        writeTx.put(LogicalDatastoreType.OPERATIONAL, NODE_PATH, NODE);
         writeTx.submit().get();
     }
 
+    @Test
+    public void testPutCreateParentsSuccess() throws TransactionCommitFailedException, InterruptedException, ExecutionException {
+
+        WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.OPERATIONAL, NODE_PATH, NODE,true);
+        writeTx.submit().checkedGet();
+
+        ReadOnlyTransaction readTx = getDataBroker().newReadOnlyTransaction();
+        Optional<Top> topNode = readTx.read(LogicalDatastoreType.OPERATIONAL, TOP_PATH).get();
+        assertTrue("Top node must exists after commit",topNode.isPresent());
+        Optional<TopLevelList> listNode = readTx.read(LogicalDatastoreType.OPERATIONAL, NODE_PATH).get();
+        assertTrue("List node must exists after commit",listNode.isPresent());
+    }
+
+    @Test
+    public void testMergeCreateParentsSuccess() throws TransactionCommitFailedException, InterruptedException, ExecutionException {
+
+        WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.merge(LogicalDatastoreType.OPERATIONAL, NODE_PATH, NODE,true);
+        writeTx.submit().checkedGet();
+
+        ReadOnlyTransaction readTx = getDataBroker().newReadOnlyTransaction();
+        Optional<Top> topNode = readTx.read(LogicalDatastoreType.OPERATIONAL, TOP_PATH).get();
+        assertTrue("Top node must exists after commit",topNode.isPresent());
+        Optional<TopLevelList> listNode = readTx.read(LogicalDatastoreType.OPERATIONAL, NODE_PATH).get();
+        assertTrue("List node must exists after commit",listNode.isPresent());
+    }
+
 }
index 79aa6b634b8b91136c2b7177992fcc028326ce6c..e0f6f3546f528a2e72621447b8110dc9e377be71 100644 (file)
@@ -47,13 +47,13 @@ public class DataBrokerTestCustomizer {
 
     public DOMStore createConfigurationDatastore() {
         InMemoryDOMDataStore store = new InMemoryDOMDataStore("CFG", MoreExecutors.sameThreadExecutor());
-        schemaService.registerSchemaServiceListener(store);
+        schemaService.registerSchemaContextListener(store);
         return store;
     }
 
     public DOMStore createOperationalDatastore() {
         InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", MoreExecutors.sameThreadExecutor());
-        schemaService.registerSchemaServiceListener(store);
+        schemaService.registerSchemaContextListener(store);
         return store;
     }
 
index 6cefd13398a69789250e917abb78f6b937cbd8e5..7b67d3b10f4d2eacd2659eefdd1a72af2ca51482 100644 (file)
@@ -64,8 +64,8 @@ public class MultipleAugmentationPutsTest extends AbstractDataServiceTest implem
     private static final InstanceIdentifier<Node> NODE_INSTANCE_ID_BA =
             NODES_INSTANCE_ID_BA.child(Node.class, NODE_KEY);
 
-    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier NODE_INSTANCE_ID_BI = //
-    org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
+    private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier NODE_INSTANCE_ID_BI = //
+    org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder() //
             .node(Nodes.QNAME) //
             .nodeWithKey(Node.QNAME, NODE_KEY_BI) //
             .toInstance();
@@ -158,7 +158,7 @@ public class MultipleAugmentationPutsTest extends AbstractDataServiceTest implem
         return new AugmentationVerifier<Node>(readedNode);
     }
 
-    private void assertBindingIndependentVersion(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier nodeId) {
+    private void assertBindingIndependentVersion(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier nodeId) {
         CompositeNode node = biDataService.readOperationalData(nodeId);
         assertNotNull(node);
     }
index f5e902c775a9320857e9665ff79792f71b0a628c..deb4a8aecacfbcffe47a2cee869c7d117c68f801 100644 (file)
@@ -67,7 +67,7 @@ import com.google.common.util.concurrent.ListeningExecutorService;
 @Beta
 public class BindingTestContext implements AutoCloseable {
 
-    public static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier TREE_ROOT = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+    public static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier TREE_ROOT = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
             .builder().toInstance();
 
     private static final Logger LOG = LoggerFactory.getLogger(BindingTestContext.class);
@@ -144,8 +144,8 @@ public class BindingTestContext implements AutoCloseable {
 
         biCompatibleBroker = new BackwardsCompatibleDataBroker(newDOMDataBroker,mockSchemaService);
 
-        mockSchemaService.registerSchemaServiceListener(configStore);
-        mockSchemaService.registerSchemaServiceListener(operStore);
+        mockSchemaService.registerSchemaContextListener(configStore);
+        mockSchemaService.registerSchemaContextListener(operStore);
         biDataLegacyBroker = biCompatibleBroker;
     }
 
@@ -246,7 +246,7 @@ public class BindingTestContext implements AutoCloseable {
     public void startBindingToDomMappingService() {
         checkState(classPool != null, "ClassPool needs to be present");
         mappingServiceImpl = new RuntimeGeneratedMappingServiceImpl(classPool);
-        mockSchemaService.registerSchemaServiceListener(mappingServiceImpl);
+        mockSchemaService.registerSchemaContextListener(mappingServiceImpl);
     }
 
     private void updateYangSchema(final ImmutableSet<YangModuleInfo> moduleInfos) {
index c8acbcd994352d80c85d51c15035fb706af9251d..63a4ffb23a3930d4830ea3e300c168578172c39c 100644 (file)
@@ -13,14 +13,14 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 
 @SuppressWarnings("deprecation")
 public final class MockSchemaService implements SchemaService, SchemaContextProvider {
 
     private SchemaContext schemaContext;
 
-    ListenerRegistry<SchemaServiceListener> listeners = ListenerRegistry.create();
+    ListenerRegistry<SchemaContextListener> listeners = ListenerRegistry.create();
 
     @Override
     public void addModule(final Module module) {
@@ -38,8 +38,8 @@ public final class MockSchemaService implements SchemaService, SchemaContextProv
     }
 
     @Override
-    public ListenerRegistration<SchemaServiceListener> registerSchemaServiceListener(
-            final SchemaServiceListener listener) {
+    public ListenerRegistration<SchemaContextListener> registerSchemaContextListener(
+            final SchemaContextListener listener) {
         return listeners.register(listener);
     }
 
@@ -55,8 +55,8 @@ public final class MockSchemaService implements SchemaService, SchemaContextProv
 
     public synchronized void changeSchema(final SchemaContext newContext) {
         schemaContext = newContext;
-        for (ListenerRegistration<SchemaServiceListener> listener : listeners) {
+        for (ListenerRegistration<SchemaContextListener> listener : listeners) {
             listener.getInstance().onGlobalContextUpdated(schemaContext);
         }
     }
-}
\ No newline at end of file
+}
index cd68559ae5304eb721771981069c312333b33868..aa136451a19511de6d032674086c9e45d34c0224 100644 (file)
@@ -56,14 +56,14 @@ import com.google.common.util.concurrent.ListenableFuture;
 @SuppressWarnings("deprecation")
 public class ListProcessingAndOrderingTest extends AbstractDataServiceTest {
 
-    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier DOM_UNORDERED_LIST_PATH = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+    private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier DOM_UNORDERED_LIST_PATH = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
             .builder(Lists.QNAME).node(UnorderedContainer.QNAME).node(UnorderedList.QNAME).build();
 
-    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier DOM_ORDERED_LIST_PATH = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+    private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier DOM_ORDERED_LIST_PATH = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
             .builder(Lists.QNAME).node(OrderedContainer.QNAME).node(OrderedList.QNAME).build();
 
 
-    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier DOM_UNKEYED_LIST_PATH = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+    private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier DOM_UNKEYED_LIST_PATH = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
             .builder(Lists.QNAME).node(UnkeyedContainer.QNAME).node(UnkeyedList.QNAME).build();
 
     private static final InstanceIdentifier<UnorderedContainer> UNORDERED_CONTAINER_PATH = InstanceIdentifier.builder(Lists.class).child(UnorderedContainer.class).build();
@@ -135,7 +135,7 @@ public class ListProcessingAndOrderingTest extends AbstractDataServiceTest {
     }
 
     private NormalizedNode<?, ?> resolveDataAsserted(
-            final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath) {
+            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier domPath) {
 
         try (DOMDataReadOnlyTransaction readTx = testContext.getDomAsyncDataBroker().newReadOnlyTransaction()){
             ListenableFuture<Optional<NormalizedNode<?, ?>>> data = readTx.read(LogicalDatastoreType.OPERATIONAL, domPath);
@@ -171,7 +171,7 @@ public class ListProcessingAndOrderingTest extends AbstractDataServiceTest {
 
     private void assertXmlRepresentation(final InstanceIdentifier<?> containerPath, final String... childNameValues) {
 
-        org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath = testContext.getBindingToDomMappingService().toDataDom(containerPath);
+        org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier domPath = testContext.getBindingToDomMappingService().toDataDom(containerPath);
         CompositeNode compositeNode = testContext.getDomDataBroker().readOperationalData(domPath);
         assertNotNull(compositeNode);
 
index 0c767f61850e0102a6f8534d753b542064edfaaa..34a71ac0c4bc2cee1f601d6f8346ddc100eba939 100644 (file)
@@ -222,7 +222,7 @@ public class DOMCodecBug01Test extends AbstractDataServiceTest {
     }
 
     private void verifyDataAreStoredProperly() {
-        CompositeNode biFlows = biDataService.readConfigurationData(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.of(Flows.QNAME));
+        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 dd8eaa7d5f6f821a54c9694c7469e0b96e0d9d49..c07125a5dcce9b2130c37e8f99feb646252e54ad 100644 (file)
@@ -72,16 +72,16 @@ public class DOMCodecBug03Test extends AbstractDataServiceTest implements DataCh
             .toInstance();
 
 
-    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier NODE_INSTANCE_ID_BI = //
-    org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
+    private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier NODE_INSTANCE_ID_BI = //
+    org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder() //
             .node(Nodes.QNAME) //
             .nodeWithKey(Node.QNAME, NODE_KEY_BI) //
             .toInstance();
     private static final QName SUPPORTED_ACTIONS_QNAME = QName.create(FlowCapableNode.QNAME, SupportedActions.QNAME.getLocalName());
 
 
-    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier SUPPORTED_ACTIONS_INSTANCE_ID_BI = //
-            org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
+    private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier SUPPORTED_ACTIONS_INSTANCE_ID_BI = //
+            org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder() //
                     .node(Nodes.QNAME) //
                     .nodeWithKey(Node.QNAME, NODE_KEY_BI) //
                     .node(SUPPORTED_ACTIONS_QNAME) //
@@ -206,7 +206,7 @@ public class DOMCodecBug03Test extends AbstractDataServiceTest implements DataCh
     }
 
     private void assertBindingIndependentVersion(
-            final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier nodeId) {
+            final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier nodeId) {
         CompositeNode node = biDataService.readOperationalData(nodeId);
         assertNotNull(node);
     }
index fb5fd1fa6c8f438b120078d1d995ca839dc6b5a7..735138a530ab801149adbaceb79e38c3b27d92b9 100644 (file)
@@ -78,13 +78,12 @@ public class DeleteNestedAugmentationListenParentTest extends AbstractDataServic
         FlowBuilder builder = new FlowBuilder()
             .setKey(FLOW_KEY)
             .addAugmentation(FlowStatisticsData.class,new FlowStatisticsDataBuilder()
-                    .setFlowStatistics(new FlowStatisticsBuilder()
-                        .setBarrier(true)
-                        .setMatch(new MatchBuilder()
-                            .build())
-                        .build())
+                    .setFlowStatistics(new FlowStatisticsBuilder().build())
                     .build())
-        ;//.build();
+            .setBarrier(true)
+            .setMatch(new MatchBuilder()
+            .build())
+        ;
         return builder.build();
     }
 
index 33a4399cb513519ead16e0c16b9e81d57f13e0a7..767ccaade304a711b7c54f4c958a8b4c2ea5ae5b 100644 (file)
@@ -68,8 +68,8 @@ public class PutAugmentationTest extends AbstractDataServiceTest implements Data
             .augmentation(FlowCapableNode.class) //
             .build();
 
-    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier NODE_INSTANCE_ID_BI = //
-    org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
+    private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier NODE_INSTANCE_ID_BI = //
+    org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder() //
             .node(Nodes.QNAME) //
             .nodeWithKey(Node.QNAME, NODE_KEY_BI) //
             .toInstance();
@@ -216,7 +216,7 @@ public class PutAugmentationTest extends AbstractDataServiceTest implements Data
         assertNull(node);
     }
 
-    private void assertBindingIndependentVersion(final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier nodeId) {
+    private void assertBindingIndependentVersion(final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier nodeId) {
         CompositeNode node = biDataService.readOperationalData(nodeId);
         assertNotNull(node);
     }
index ae54896c6d0faa75b40d105319e4c7b3c8b3dc1c..a3b0819501c57ffdcf3764c243a20e680d8d9ecf 100644 (file)
@@ -93,8 +93,8 @@ public class ChangeOriginatedInDomBrokerTest extends AbstractDataServiceTest {
     private static final Map<QName, Object> TABLE_KEY_BI = //
     ImmutableMap.<QName, Object> of(TABLE_ID_QNAME, TABLE_ID);;
 
-    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier FLOW_INSTANCE_ID_BI = //
-    org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
+    private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier FLOW_INSTANCE_ID_BI = //
+    org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder() //
             .node(Nodes.QNAME) //
             .nodeWithKey(Node.QNAME, NODE_KEY_BI) //
             .nodeWithKey(Table.QNAME, TABLE_KEY_BI) //
index 804fcc9fbe8bb4983b10e1120467e4ae03f50bf5..a79b0fd53eec2ecd677108757f38d9c4692197e0 100644 (file)
@@ -65,13 +65,13 @@ public class CrossBrokerMountPointTest {
     private static final QName AUGMENTED_GROUP_STATISTICS = QName.create(NodeGroupStatistics.QNAME,
             GroupStatistics.QNAME.getLocalName());
 
-    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier NODE_INSTANCE_ID_BI = //
-    org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
+    private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier NODE_INSTANCE_ID_BI = //
+    org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder() //
             .node(Nodes.QNAME) //
             .nodeWithKey(Node.QNAME, NODE_KEY_BI) //
             .toInstance();
 
-    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier GROUP_STATISTICS_ID_BI = org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+    private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier GROUP_STATISTICS_ID_BI = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
             //
             .builder(NODE_INSTANCE_ID_BI)
             .nodeWithKey(QName.create(FlowCapableNode.QNAME, "group"), QName.create(FlowCapableNode.QNAME, "group-id"),
@@ -112,16 +112,16 @@ public class CrossBrokerMountPointTest {
         final BigInteger packetCount = BigInteger.valueOf(500L);
 
 
-        DataReader<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> simpleReader = new DataReader<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode>() {
+        DataReader<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> simpleReader = new DataReader<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode>() {
 
             @Override
-            public CompositeNode readConfigurationData(final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier arg0) {
+            public CompositeNode readConfigurationData(final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier arg0) {
                 return null;
             }
 
 
             @Override
-            public CompositeNode readOperationalData(final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier arg0) {
+            public CompositeNode readOperationalData(final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier arg0) {
                 if (arg0.equals(GROUP_STATISTICS_ID_BI)) {
                     ImmutableCompositeNode data = ImmutableCompositeNode
                             .builder()
index 48e1db0e631c3c02505913c02192866d35756ae7..4cc3780c6f0ebff8b25c0043c845034d3a15aba1 100644 (file)
@@ -72,10 +72,10 @@ public class CrossBrokerRpcTest {
     public static final InstanceIdentifier<Node> BA_NODE_C_ID = createBANodeIdentifier(NODE_C);
     public static final InstanceIdentifier<Node> BA_NODE_D_ID = createBANodeIdentifier(NODE_D);
 
-    public static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier BI_NODE_A_ID = createBINodeIdentifier(NODE_A);
-    public static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier BI_NODE_B_ID = createBINodeIdentifier(NODE_B);
-    public static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier BI_NODE_C_ID = createBINodeIdentifier(NODE_C);
-    public static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier BI_NODE_D_ID = createBINodeIdentifier(NODE_D);
+    public static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier BI_NODE_A_ID = createBINodeIdentifier(NODE_A);
+    public static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier BI_NODE_B_ID = createBINodeIdentifier(NODE_B);
+    public static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier BI_NODE_C_ID = createBINodeIdentifier(NODE_C);
+    public static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier BI_NODE_D_ID = createBINodeIdentifier(NODE_D);
 
 
 
@@ -158,8 +158,8 @@ public class CrossBrokerRpcTest {
         return InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(node)).toInstance();
     }
 
-    private static org.opendaylight.yangtools.yang.data.api.InstanceIdentifier createBINodeIdentifier(NodeId node) {
-        return org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder().node(Nodes.QNAME)
+    private static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier createBINodeIdentifier(NodeId node) {
+        return org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder().node(Nodes.QNAME)
                 .nodeWithKey(Node.QNAME, NODE_ID_QNAME, node.getValue()).toInstance();
     }
 
index 0c123ebe66aac8a77de4bc62b17920d6d0003a93..6686a83a2e26ed55ca2a2cb7e9f40c3bce679f19 100644 (file)
@@ -68,7 +68,7 @@ public class DOMRpcServiceTestBugfix560 {
     private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
 
     private static final InstanceIdentifier<Node> BA_MOUNT_ID = createBANodeIdentifier(MOUNT_NODE);
-    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier BI_MOUNT_ID = createBINodeIdentifier(MOUNT_NODE);
+    private static final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier BI_MOUNT_ID = createBINodeIdentifier(MOUNT_NODE);
 
     private BindingTestContext testContext;
     private MountProvisionService domMountPointService;
@@ -104,9 +104,9 @@ public class DOMRpcServiceTestBugfix560 {
         schemaContext = mountSchemaContext;
     }
 
-    private static org.opendaylight.yangtools.yang.data.api.InstanceIdentifier createBINodeIdentifier(
+    private static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier createBINodeIdentifier(
             final NodeId mountNode) {
-        return org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+        return org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier
                 .builder().node(Nodes.QNAME)
                 .nodeWithKey(Node.QNAME, NODE_ID_QNAME, mountNode.getValue())
                 .toInstance();
index e6bbaab2d9dec48c659ac1bbf38e646fc021662b..9ec5bcf6c29ea58114f58da3c1eba47999841a55 100644 (file)
@@ -33,7 +33,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.Node
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowListener;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SwitchFlowRemoved;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
-import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.NotificationListener;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
@@ -43,8 +43,8 @@ public class NotificationTest extends AbstractTest {
     private final FlowListener listener1 = new FlowListener();
     private final FlowListener listener2 = new FlowListener();
 
-    private Registration<NotificationListener> listener1Reg;
-    private Registration<NotificationListener> listener2Reg;
+    private ListenerRegistration<NotificationListener> listener1Reg;
+    private ListenerRegistration<NotificationListener> listener2Reg;
 
     private NotificationProviderService notifyProviderService;
 
index 8f367de6c8976c687600a941b491aff4fcbfeb2f..830942f3377db22d9e7f431091aac3732b88bcef 100644 (file)
@@ -40,14 +40,14 @@ public abstract class AbstractBindingSalProviderInstance<D extends DataProviderS
     }
 
     @Override
-    public Registration<DataReader<InstanceIdentifier<? extends DataObject>, DataObject>> registerDataReader(
+    public Registration registerDataReader(
             InstanceIdentifier<? extends DataObject> path,
             DataReader<InstanceIdentifier<? extends DataObject>, DataObject> reader) {
         return getDataBrokerChecked().registerDataReader(path, reader);
     }
 
     @Override
-    public Registration<DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject>> registerCommitHandler(
+    public Registration registerCommitHandler(
             InstanceIdentifier<? extends DataObject> path,
             DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject> commitHandler) {
         return getDataBrokerChecked().registerCommitHandler(path, commitHandler);
index f088c0a0bdde1f29f5ff0bd4054d3b3137ab8f7e..3b3217db6ba8f5cde5dbc88c6ede86d8ea2a0147 100644 (file)
@@ -11,7 +11,7 @@ import java.util.EventListener;
 
 import org.opendaylight.yangtools.concepts.Registration;
 
-public interface RegistrationListener<T extends Registration<?>> extends EventListener {
+public interface RegistrationListener<T extends Registration> extends EventListener {
 
     void onRegister(T registration);
 
index 9aaa77ca61f1c5f16df1650a696899d90c96e5f5..e47b54a0a1e6e138292530994a57b539501fc1bb 100644 (file)
@@ -27,15 +27,57 @@ import com.google.common.util.concurrent.ListenableFuture;
  * change for the data tree and it is not visible to any other concurrently running
  * transaction.
  * <p>
- * Applications publish the changes proposed in the transaction by calling {@link #commit}
- * on the transaction. This seals the transaction
+ * Applications make changes to the local data tree in the transaction by via the
+ * <b>put</b>, <b>merge</b>, and <b>delete</b> operations.
+ *
+ * <h2>Put operation</h2>
+ * Stores a piece of data at a specified path. This acts as an add / replace
+ * operation, which is to say that whole subtree will be replaced by the
+ * specified data.
+ * <p>
+ * Performing the following put operations:
+ *
+ * <pre>
+ * 1) container { list [ a ] }
+ * 2) container { list [ b ] }
+ * </pre>
+ *
+ * will result in the following data being present:
+ *
+ * <pre>
+ * container { list [ b ] }
+ * </pre>
+ * <h2>Merge operation</h2>
+ * Merges a piece of data with the existing data at a specified path. Any pre-existing data
+ * which is not explicitly overwritten will be preserved. This means that if you store a container,
+ * its child lists will be merged.
+ * <p>
+ * Performing the following merge operations:
+ *
+ * <pre>
+ * 1) container { list [ a ] }
+ * 2) container { list [ b ] }
+ * </pre>
+ *
+ * will result in the following data being present:
+ *
+ * <pre>
+ * container { list [ a, b ] }
+ * </pre>
+ *
+ * This also means that storing the container will preserve any
+ * augmentations which have been attached to it.
+ *
+ * <h2>Delete operation</h2>
+ * Removes a piece of data from a specified path.
+ * <p>
+ * After applying changes to the local data tree, applications publish the changes proposed in the
+ * transaction by calling {@link #submit} on the transaction. This seals the transaction
  * (preventing any further writes using this transaction) and submits it to be
  * processed and applied to global conceptual data tree.
  * <p>
  * The transaction commit may fail due to a concurrent transaction modifying and committing data in
- * an incompatible way. See {@link #commit()} for more concrete commit failure examples.
- *
- *
+ * an incompatible way. See {@link #submit} for more concrete commit failure examples.
  * <p>
  * <b>Implementation Note:</b> This interface is not intended to be implemented
  * by users of MD-SAL, but only to be consumed by them.
@@ -57,7 +99,7 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
      * {@link TransactionStatus#CANCELED} will have no effect, and transaction
      * is considered cancelled.
      *
-     * Invoking cancel() on finished transaction  (future returned by {@link #commit()}
+     * Invoking cancel() on finished transaction  (future returned by {@link #submit()}
      * already completed with {@link TransactionStatus#COMMITED}) will always
      * fail (return false).
      *
@@ -69,74 +111,7 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
     boolean cancel();
 
     /**
-     * Store a piece of data at specified path. This acts as an add / replace
-     * operation, which is to say that whole subtree will be replaced by
-     * specified path. Performing the following put operations:
-     *
-     * <pre>
-     * 1) container { list [ a ] }
-     * 2) container { list [ b ] }
-     * </pre>
-     *
-     * will result in the following data being present:
-     *
-     * <pre>
-     * container { list [ b ] }
-     * </pre>
-     *
-     *
-     * If you need to make sure that a parent object exists, but you do not want modify
-     * its preexisting state by using put, consider using
-     * {@link #merge(LogicalDatastoreType, Path, Object)}
-     *
-     * @param store
-     *            Logical data store which should be modified
-     * @param path
-     *            Data object path
-     * @param data
-     *            Data object to be written to specified path
-     * @throws IllegalStateException
-     *             if the transaction is no longer {@link TransactionStatus#NEW}
-     */
-    void put(LogicalDatastoreType store, P path, D data);
-
-    /**
-     * Store a piece of data at the specified path. This acts as a merge operation,
-     * which is to say that any pre-existing data which is not explicitly
-     * overwritten will be preserved. This means that if you store a container,
-     * its child lists will be merged. Performing the following merge
-     * operations:
-     *
-     * <pre>
-     * 1) container { list [ a ] }
-     * 2) container { list [ b ] }
-     * </pre>
-     *
-     * will result in the following data being present:
-     *
-     * <pre>
-     * container { list [ a, b ] }
-     * </pre>
-     *
-     * This also means that storing the container will preserve any
-     * augmentations which have been attached to it.
-     *<p>
-     * If you require an explicit replace operation, use
-     * {@link #put(LogicalDatastoreType, Path, Object)} instead.
-     *
-     * @param store
-     *            Logical data store which should be modified
-     * @param path
-     *            Data object path
-     * @param data
-     *            Data object to be written to specified path
-     * @throws IllegalStateException
-     *             if the transaction is no longer {@link TransactionStatus#NEW}
-     */
-    void merge(LogicalDatastoreType store, P path, D data);
-
-    /**
-     * Remove a piece of data from specified path. This operation does not fail
+     * Removes a piece of data from specified path. This operation does not fail
      * if the specified path does not exist.
      *
      * @param store
@@ -184,7 +159,7 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
      *      InstanceIdentifier<MyDataObject> path = ...;
      *      writeTx.put( LogicalDatastoreType.OPERATIONAL, path, data );
      *
-     *      Futures.addCallback( writeTx.commit(), new FutureCallback<Void>() {
+     *      Futures.addCallback( writeTx.submit(), new FutureCallback<Void>() {
      *          public void onSuccess( Void result ) {
      *              // succeeded
      *          }
@@ -312,8 +287,8 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
      * txA.put(CONFIGURATION, PATH, A);    // writes to PATH value A
      * txB.put(CONFIGURATION, PATH, B)     // writes to PATH value B
      *
-     * ListenableFuture futureA = txA.commit(); // transaction A is sealed and committed
-     * ListenebleFuture futureB = txB.commit(); // transaction B is sealed and committed
+     * ListenableFuture futureA = txA.submit(); // transaction A is sealed and submitted
+     * ListenebleFuture futureB = txB.submit(); // transaction B is sealed and submitted
      * </pre>
      *
      * Commit of transaction A will be processed asynchronously and data tree
index 224751c37dbd8dabebe44da114b8d1055253877e..dceb3de5bf1af839a72c28ddb14ba0dfa0132a21 100644 (file)
@@ -20,7 +20,7 @@ import org.opendaylight.yangtools.concepts.Registration;
  * @param <D>
  */
 @Deprecated
-public interface DataCommitHandlerRegistration<P extends Path<P>,D> extends Registration<DataCommitHandler<P, D>>{
+public interface DataCommitHandlerRegistration<P extends Path<P>,D> extends Registration {
 
     P getPath();
 }
index bd80a5389316f754a202af7c363c2332f7951859..6c7166eaee01fc9557acf2ef8962a825ef9b12bd 100644 (file)
@@ -20,7 +20,7 @@ import org.opendaylight.yangtools.concepts.Registration;
 @Deprecated
 public interface DataProvisionService<P extends Path<P> , D> {
 
-    public Registration<DataCommitHandler<P, D>> registerCommitHandler(P path, DataCommitHandler<P, D> commitHandler);
+    public Registration registerCommitHandler(P path, DataCommitHandler<P, D> commitHandler);
 
     public ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<P, D>>>
         registerCommitHandlerListener(RegistrationListener<DataCommitHandlerRegistration<P, D>> commitHandlerListener);
index bfca8f8bccf316d956dd8d621e0e868adf19b8f9..feccbbad92f694fb070af73c355376acbf26e928 100644 (file)
@@ -7,9 +7,11 @@
  */
 package org.opendaylight.controller.md.sal.common.api.notify;
 
-import org.opendaylight.yangtools.concepts.Registration;
+import java.util.EventListener;
 
-public interface NotificationSubscriptionService<T,N,L> {
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 
-    Registration<L> registerNotificationListener(T type,L listener);
+public interface NotificationSubscriptionService<T,N,L extends EventListener> {
+
+    ListenerRegistration<L> registerNotificationListener(T type,L listener);
 }
index 6fe8d6921730fc55e4fe3900ea66823ee2b644ed..7b1cdeae9f7dbc707b6b4aafe60cb02a773c7ca3 100644 (file)
@@ -17,7 +17,7 @@ import org.opendaylight.yangtools.concepts.Registration;
  * @param <P> the path identifier type
  * @param <S> the RPC implementation type
  */
-public interface RoutedRegistration<C, P extends Path<P>, S> extends Registration<S> {
+public interface RoutedRegistration<C, P extends Path<P>, S> extends Registration {
 
     /**
      * Registers the RPC implementation associated with this registration for the given path
index ee9af6cb80d91ccc4083a61e3e6a01604769a757..5dfb55ebd939615a10c6b0b0ceb4c4a6758c0940 100644 (file)
@@ -97,13 +97,13 @@ public abstract class AbstractDataReadRouter<P extends Path<P>, D> implements Da
      * @param reader Reader instance which is responsible for reading particular subpath.
      * @return
      */
-    public Registration<DataReader<P, D>> registerOperationalReader(P path, DataReader<P, D> reader) {
+    public Registration registerOperationalReader(P path, DataReader<P, D> reader) {
         OperationalDataReaderRegistration<P, D> ret = new OperationalDataReaderRegistration<>(path, reader);
         operationalReaders.put(path, ret);
         return ret;
     }
 
-    public Registration<DataReader<P, D>> registerConfigurationReader(P path, DataReader<P, D> reader) {
+    public Registration registerConfigurationReader(P path, DataReader<P, D> reader) {
         ConfigurationDataReaderRegistration<P, D> ret = new ConfigurationDataReaderRegistration<>(path, reader);
         configReaders.put(path, ret);
         return ret;
index d8bde3d41a623178e1e202b6ba1bc67aa7b49525..a732f2f1b96b72ee72a6987e2f2b94651656bf09 100644 (file)
@@ -230,7 +230,7 @@ public abstract class AbstractDataBroker<P extends Path<P>, D extends Object, DC
     }
 
     @Override
-    public final Registration<DataCommitHandler<P, D>> registerCommitHandler(final P path,
+    public final Registration registerCommitHandler(final P path,
             final DataCommitHandler<P, D> commitHandler) {
         synchronized (commitHandler) {
             final DataCommitHandlerRegistrationImpl<P, D> registration = new DataCommitHandlerRegistrationImpl<P, D>(
@@ -266,8 +266,8 @@ public abstract class AbstractDataBroker<P extends Path<P>, D extends Object, DC
     public final CompositeObjectRegistration<DataReader<P, D>> registerDataReader(final P path,
             final DataReader<P, D> reader) {
 
-        final Registration<DataReader<P, D>> confReg = getDataReadRouter().registerConfigurationReader(path, reader);
-        final Registration<DataReader<P, D>> dataReg = getDataReadRouter().registerOperationalReader(path, reader);
+        final Registration confReg = getDataReadRouter().registerConfigurationReader(path, reader);
+        final Registration dataReg = getDataReadRouter().registerOperationalReader(path, reader);
         return new CompositeObjectRegistration<DataReader<P, D>>(reader, Arrays.asList(confReg, dataReg));
     }
 
index 617697710449b32602682802d10dd2022f551ee2..b8dfca1604eb9e1ca82454f60f508abfffe01694 100644 (file)
@@ -21,11 +21,11 @@ import java.util.concurrent.ConcurrentHashMap;
 import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.AugmentationIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.Node;
 import org.opendaylight.yangtools.yang.data.api.SimpleNode;
 import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode;
index e2a960a67aae708d34a4145479b8797fe535d0d6..3e14d5e4b7682abca507d1cc666bb9d19b09fd01 100644 (file)
@@ -16,9 +16,9 @@ import java.util.Map;
 
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.AugmentationIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.Node;
 import org.opendaylight.yangtools.yang.data.api.SimpleNode;
 import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode;
@@ -46,7 +46,7 @@ public class DataNormalizer {
         operation = DataNormalizationOperation.from(ctx);
     }
 
-    public InstanceIdentifier toNormalized(final InstanceIdentifier legacy) {
+    public YangInstanceIdentifier toNormalized(final YangInstanceIdentifier legacy) {
         ImmutableList.Builder<PathArgument> normalizedArgs = ImmutableList.builder();
 
         DataNormalizationOperation<?> currentOp = operation;
@@ -69,10 +69,10 @@ public class DataNormalizer {
             throw new IllegalArgumentException(String.format("Failed to normalize path %s", legacy), e);
         }
 
-        return InstanceIdentifier.create(normalizedArgs.build());
+        return YangInstanceIdentifier.create(normalizedArgs.build());
     }
 
-    public DataNormalizationOperation<?> getOperation(final InstanceIdentifier legacy) throws DataNormalizationException {
+    public DataNormalizationOperation<?> getOperation(final YangInstanceIdentifier legacy) throws DataNormalizationException {
         DataNormalizationOperation<?> currentOp = operation;
         Iterator<PathArgument> arguments = legacy.getPathArguments().iterator();
 
@@ -82,15 +82,15 @@ public class DataNormalizer {
         return currentOp;
     }
 
-    public Map.Entry<InstanceIdentifier, NormalizedNode<?, ?>> toNormalized(
-            final Map.Entry<InstanceIdentifier, CompositeNode> legacy) {
+    public Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> toNormalized(
+            final Map.Entry<YangInstanceIdentifier, CompositeNode> legacy) {
         return toNormalized(legacy.getKey(), legacy.getValue());
     }
 
-    public Map.Entry<InstanceIdentifier, NormalizedNode<?, ?>> toNormalized(final InstanceIdentifier legacyPath,
+    public Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> toNormalized(final YangInstanceIdentifier legacyPath,
             final CompositeNode legacyData) {
 
-        InstanceIdentifier normalizedPath = toNormalized(legacyPath);
+        YangInstanceIdentifier normalizedPath = toNormalized(legacyPath);
 
         DataNormalizationOperation<?> currentOp = operation;
         for (PathArgument arg : normalizedPath.getPathArguments()) {
@@ -121,11 +121,11 @@ public class DataNormalizer {
 
         Preconditions.checkArgument(currentOp != null,
                 "Instance Identifier %s does not reference correct schema Node.", normalizedPath);
-        return new AbstractMap.SimpleEntry<InstanceIdentifier, NormalizedNode<?, ?>>(normalizedPath,
+        return new AbstractMap.SimpleEntry<YangInstanceIdentifier, NormalizedNode<?, ?>>(normalizedPath,
                 currentOp.normalize(legacyData));
     }
 
-    public InstanceIdentifier toLegacy(final InstanceIdentifier normalized) throws DataNormalizationException {
+    public YangInstanceIdentifier toLegacy(final YangInstanceIdentifier normalized) throws DataNormalizationException {
         ImmutableList.Builder<PathArgument> legacyArgs = ImmutableList.builder();
         DataNormalizationOperation<?> currentOp = operation;
         for (PathArgument normalizedArg : normalized.getPathArguments()) {
@@ -134,10 +134,10 @@ public class DataNormalizer {
                 legacyArgs.add(normalizedArg);
             }
         }
-        return InstanceIdentifier.create(legacyArgs.build());
+        return YangInstanceIdentifier.create(legacyArgs.build());
     }
 
-    public CompositeNode toLegacy(final InstanceIdentifier normalizedPath, final NormalizedNode<?, ?> normalizedData) {
+    public CompositeNode toLegacy(final YangInstanceIdentifier normalizedPath, final NormalizedNode<?, ?> normalizedData) {
         // Preconditions.checkArgument(normalizedData instanceof
         // DataContainerNode<?>,"Node object %s, %s should be of type DataContainerNode",normalizedPath,normalizedData);
         if (normalizedData instanceof DataContainerNode<?>) {
index dcb90a83ba1e3b15284b9a7d8d8bcabacf99cb3b..1595288608cfdbcd5166ccc8f780c1cb98a8e837 100644 (file)
@@ -32,12 +32,12 @@ import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.AugmentationIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.Node;
 import org.opendaylight.yangtools.yang.data.api.SimpleNode;
 import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode;
@@ -103,8 +103,8 @@ public class DataNormalizerTest {
     static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
     static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
 
-    static final InstanceIdentifier TEST_PATH = InstanceIdentifier.of(TEST_QNAME);
-    static final InstanceIdentifier OUTER_LIST_PATH = InstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME)
+    static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME);
+    static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME)
             .build();
     static final QName ONE_QNAME = QName.create(TEST_QNAME, "one");
     static final QName TWO_QNAME = QName.create(TEST_QNAME, "two");
@@ -119,10 +119,10 @@ public class DataNormalizerTest {
 
     static final Short OUTER_LIST_ID = (short) 10;
 
-    static final InstanceIdentifier OUTER_LIST_PATH_LEGACY = InstanceIdentifier.builder(TEST_QNAME)
+    static final YangInstanceIdentifier OUTER_LIST_PATH_LEGACY = YangInstanceIdentifier.builder(TEST_QNAME)
             .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, OUTER_LIST_ID).build();
 
-    static final InstanceIdentifier LEAF_TWO_PATH_LEGACY = InstanceIdentifier.builder(OUTER_LIST_PATH_LEGACY)
+    static final YangInstanceIdentifier LEAF_TWO_PATH_LEGACY = YangInstanceIdentifier.builder(OUTER_LIST_PATH_LEGACY)
             .node(TWO_QNAME).build();
 
     static final QName ANY_XML_LEAF_QNAME = QName.create(TEST_QNAME, "leaf");;
@@ -141,13 +141,13 @@ public class DataNormalizerTest {
         SchemaContext testCtx = createTestContext();
         DataNormalizer normalizer = new DataNormalizer(testCtx);
 
-        InstanceIdentifier normalizedPath = normalizer.toNormalized(LEAF_TWO_PATH_LEGACY);
+        YangInstanceIdentifier normalizedPath = normalizer.toNormalized(LEAF_TWO_PATH_LEGACY);
 
         verifyNormalizedInstanceIdentifier(normalizedPath, TEST_QNAME, OUTER_LIST_QNAME, new Object[] {
                 OUTER_LIST_QNAME, ID_QNAME, OUTER_LIST_ID }, OUTER_CHOICE_QNAME, TWO_QNAME);
     }
 
-    private void verifyNormalizedInstanceIdentifier(final InstanceIdentifier actual, final Object... expPath) {
+    private void verifyNormalizedInstanceIdentifier(final YangInstanceIdentifier actual, final Object... expPath) {
 
         assertNotNull("Actual InstanceIdentifier is null", actual);
         assertEquals("InstanceIdentifier path length", expPath.length, Iterables.size(actual.getPathArguments()));
@@ -181,11 +181,11 @@ public class DataNormalizerTest {
 
         DataNormalizer normalizer = new DataNormalizer(createTestContext());
 
-        InstanceIdentifier normalized = InstanceIdentifier.builder().node(TEST_QNAME).node(OUTER_LIST_QNAME)
+        YangInstanceIdentifier normalized = YangInstanceIdentifier.builder().node(TEST_QNAME).node(OUTER_LIST_QNAME)
                 .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, OUTER_LIST_ID).node(OUTER_CHOICE_QNAME).node(TWO_QNAME)
                 .build();
 
-        InstanceIdentifier legacy = normalizer.toLegacy(normalized);
+        YangInstanceIdentifier legacy = normalizer.toLegacy(normalized);
 
         assertEquals("Legacy InstanceIdentifier", LEAF_TWO_PATH_LEGACY, legacy);
     }
@@ -295,7 +295,7 @@ public class DataNormalizerTest {
                 .withNodeIdentifier(new NodeIdentifier(TEST_QNAME)).withChild(testAnyXmlNode).build();
 
         DataNormalizer normalizer = new DataNormalizer(createTestContext());
-        Node<?> legacyNode = normalizer.toLegacy(InstanceIdentifier.builder(TEST_QNAME).build(), testContainerNode);
+        Node<?> legacyNode = normalizer.toLegacy(YangInstanceIdentifier.builder(TEST_QNAME).build(), testContainerNode);
 
         verifyLegacyNode(
                 legacyNode,
@@ -332,7 +332,7 @@ public class DataNormalizerTest {
 
         DataNormalizer normalizer = new DataNormalizer(createTestContext());
 
-        Node<?> legacyNode = normalizer.toLegacy(InstanceIdentifier.builder(TEST_QNAME).build(), testContainerNode);
+        Node<?> legacyNode = normalizer.toLegacy(YangInstanceIdentifier.builder(TEST_QNAME).build(), testContainerNode);
 
         verifyLegacyNode(
                 legacyNode,
@@ -359,7 +359,7 @@ public class DataNormalizerTest {
 
         DataNormalizer normalizer = new DataNormalizer(createTestContext());
 
-        Node<?> legacyNode = normalizer.toLegacy(InstanceIdentifier.builder(TEST_QNAME).build(), testContainerNode);
+        Node<?> legacyNode = normalizer.toLegacy(YangInstanceIdentifier.builder(TEST_QNAME).build(), testContainerNode);
 
         verifyLegacyNode(
                 legacyNode,
@@ -563,8 +563,8 @@ public class DataNormalizerTest {
             testBuilder.add(unkeyedListBuilder.toInstance());
         }
 
-        Entry<InstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
-                .toNormalized(new AbstractMap.SimpleEntry<InstanceIdentifier, CompositeNode>(InstanceIdentifier.create(
+        Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
+                .toNormalized(new AbstractMap.SimpleEntry<YangInstanceIdentifier, CompositeNode>(YangInstanceIdentifier.create(
                         ImmutableList.<PathArgument> of(new NodeIdentifier(TEST_QNAME))), testBuilder.toInstance()));
 
         verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME);
@@ -627,8 +627,8 @@ public class DataNormalizerTest {
         CompositeNode anyXmlLegacy = anyXmlBuilder.toInstance();
         testBuilder.add(anyXmlLegacy);
 
-        Entry<InstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
-                .toNormalized(new AbstractMap.SimpleEntry<InstanceIdentifier, CompositeNode>(InstanceIdentifier.create(
+        Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
+                .toNormalized(new AbstractMap.SimpleEntry<YangInstanceIdentifier, CompositeNode>(YangInstanceIdentifier.create(
                         ImmutableList.<PathArgument> of(new NodeIdentifier(TEST_QNAME))), testBuilder.toInstance()));
 
         verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME);
@@ -651,8 +651,8 @@ public class DataNormalizerTest {
 
         testBuilder.add(outerContBuilder.toInstance());
 
-        Entry<InstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
-                .toNormalized(new AbstractMap.SimpleEntry<InstanceIdentifier, CompositeNode>(InstanceIdentifier.create(
+        Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
+                .toNormalized(new AbstractMap.SimpleEntry<YangInstanceIdentifier, CompositeNode>(YangInstanceIdentifier.create(
                         ImmutableList.<PathArgument> of(new NodeIdentifier(TEST_QNAME))), testBuilder.toInstance()));
 
         verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME);
@@ -663,8 +663,8 @@ public class DataNormalizerTest {
         verifyNormalizedNode(normalizedNodeEntry.getValue(),
                 expectContainerNode(TEST_QNAME, expectContainerNode(OUTER_CONTAINER_QNAME, expAugmentation)));
 
-        normalizedNodeEntry = normalizer.toNormalized(new AbstractMap.SimpleEntry<InstanceIdentifier, CompositeNode>(
-                InstanceIdentifier.create(Lists.newArrayList(new NodeIdentifier(TEST_QNAME), new NodeIdentifier(
+        normalizedNodeEntry = normalizer.toNormalized(new AbstractMap.SimpleEntry<YangInstanceIdentifier, CompositeNode>(
+                YangInstanceIdentifier.create(Lists.newArrayList(new NodeIdentifier(TEST_QNAME), new NodeIdentifier(
                         OUTER_CONTAINER_QNAME))), outerContBuilder.toInstance()));
 
         verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME, OUTER_CONTAINER_QNAME,
@@ -689,8 +689,8 @@ public class DataNormalizerTest {
             testBuilder.addLeaf(ORDERED_LEAF_LIST_QNAME, "ordered-value" + i);
         }
 
-        Entry<InstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
-                .toNormalized(new AbstractMap.SimpleEntry<InstanceIdentifier, CompositeNode>(InstanceIdentifier.create(
+        Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedNodeEntry = normalizer
+                .toNormalized(new AbstractMap.SimpleEntry<YangInstanceIdentifier, CompositeNode>(YangInstanceIdentifier.create(
                         ImmutableList.<PathArgument> of(new NodeIdentifier(TEST_QNAME))), testBuilder.toInstance()));
 
         verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME);
index 519d21bf4fe6aea0fd3e0cdeda94132d7ce8b113..67fb6622d1772581d3ecec6133ab807bc6889ec2 100644 (file)
@@ -11,14 +11,14 @@ import java.util.Set;
 
 import org.opendaylight.controller.sal.core.api.RpcImplementation;
 import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 public interface Connector extends RpcImplementation, NotificationListener {
 
 
 
-    Set<InstanceIdentifier> getConfigurationPrefixes();
-    Set<InstanceIdentifier> getRuntimePrefixes();
+    Set<YangInstanceIdentifier> getConfigurationPrefixes();
+    Set<YangInstanceIdentifier> getRuntimePrefixes();
 
     void registerListener(ConnectorListener listener);
     void unregisterListener(ConnectorListener listener);
index ac9c893a0b9180c3de76a9f8e99cd7132bdbbb4f..935baba7a23540eddb71f732d5f9b8c8a9514cce 100644 (file)
@@ -9,11 +9,11 @@ package org.opendaylight.controller.sal.connector.api;
 
 import java.util.Set;
 
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 public interface ConnectorListener {
 
-    void onPrefixesAnnounced(Set<InstanceIdentifier> prefixes);
-    void onPrefixesWithdrawn(Set<InstanceIdentifier> prefixes);
+    void onPrefixesAnnounced(Set<YangInstanceIdentifier> prefixes);
+    void onPrefixesWithdrawn(Set<YangInstanceIdentifier> prefixes);
 
 }
index 5152363ab2640e1dc1a612612bdcb0129e64692a..94c895dab385a92e3f547099ac83010cb7e517ec 100644 (file)
       <artifactId>scala-library</artifactId>
     </dependency>
 
+    <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>sal-protocolbuffer-encoding</artifactId>
+        <version>1.1-SNAPSHOT</version>
+    </dependency>
+
+    <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>sal-akka-raft</artifactId>
+        <version>1.1-SNAPSHOT</version>
+    </dependency>
+
     <!-- Test Dependencies -->
     <dependency>
       <groupId>junit</groupId>
             <Private-Package></Private-Package>
             <Import-Package>!*snappy;!org.jboss.*;*</Import-Package>
             <Embed-Dependency>
+                sal-protocolbuffer-encoding;
+                sal-akka-raft;
                 !sal*;
                 !*config-api*;
                 !*testkit*;
index 0f10258e9ef77c9d2a1347f5118e64fd508517c2..ce0516064ea7adc355df09f45986449553b3460e 100644 (file)
@@ -27,9 +27,9 @@ public abstract class AbstractUntypedActor extends UntypedActor {
     }
 
     @Override public void onReceive(Object message) throws Exception {
-        LOG.debug("Received message {}", message);
+        LOG.debug("Received message {}", message.getClass().getSimpleName());
         handleReceive(message);
-        LOG.debug("Done handling message {}", message);
+        LOG.debug("Done handling message {}", message.getClass().getSimpleName());
     }
 
     protected abstract void handleReceive(Object message) throws Exception;
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ClusterWrapper.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ClusterWrapper.java
new file mode 100644 (file)
index 0000000..2eac240
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * 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;
+
+public interface ClusterWrapper {
+    void subscribeToMemberEvents(ActorRef actorRef);
+    String getCurrentMemberName();
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ClusterWrapperImpl.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ClusterWrapperImpl.java
new file mode 100644 (file)
index 0000000..142aacd
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * 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.ActorSystem;
+import akka.cluster.Cluster;
+import akka.cluster.ClusterEvent;
+
+public class ClusterWrapperImpl implements ClusterWrapper {
+    private final Cluster cluster;
+    private final String currentMemberName;
+
+    public ClusterWrapperImpl(ActorSystem actorSystem){
+        cluster = Cluster.get(actorSystem);
+        currentMemberName = (String) cluster.getSelfRoles().toArray()[0];
+
+    }
+
+    public void subscribeToMemberEvents(ActorRef actorRef){
+        cluster.subscribe(actorRef, ClusterEvent.initialStateAsEvents(),
+            ClusterEvent.MemberEvent.class,
+            ClusterEvent.UnreachableMember.class);
+    }
+
+    public String getCurrentMemberName() {
+        return currentMemberName;
+    }
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/CompositeModificationPayload.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/CompositeModificationPayload.java
new file mode 100644 (file)
index 0000000..955e4bb
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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 com.google.common.base.Preconditions;
+import com.google.protobuf.GeneratedMessage;
+import org.opendaylight.controller.cluster.example.protobuff.messages.KeyValueMessages;
+import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
+import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
+import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+public class CompositeModificationPayload extends Payload implements
+    Serializable {
+
+    private final PersistentMessages.CompositeModification modification;
+
+    public CompositeModificationPayload(){
+        modification = null;
+    }
+    public CompositeModificationPayload(Object modification){
+        this.modification = (PersistentMessages.CompositeModification) modification;
+    }
+
+    @Override public Map<GeneratedMessage.GeneratedExtension, PersistentMessages.CompositeModification> encode() {
+        Preconditions.checkState(modification!=null);
+        Map<GeneratedMessage.GeneratedExtension, PersistentMessages.CompositeModification> map = new HashMap<>();
+        map.put(org.opendaylight.controller.mdsal.CompositeModificationPayload.modification, this.modification);
+        return map;
+    }
+
+    @Override public Payload decode(
+        AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload payload) {
+        PersistentMessages.CompositeModification modification = payload
+            .getExtension(
+                org.opendaylight.controller.mdsal.CompositeModificationPayload.modification);
+        payload.getExtension(KeyValueMessages.value);
+        return new CompositeModificationPayload(modification);
+    }
+
+    public Object getModification(){
+        return this.modification;
+    }
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Configuration.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Configuration.java
new file mode 100644 (file)
index 0000000..3423907
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * 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 com.google.common.base.Optional;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
+
+import java.util.List;
+import java.util.Map;
+
+public interface Configuration {
+
+    /**
+     * Given a memberName find all the shards that belong on that member and
+     * return the names of those shards
+     *
+     * @param memberName
+     * @return
+     */
+    List<String> getMemberShardNames(String memberName);
+
+    /**
+     * Given a module namespace return the name of a module
+     * @param nameSpace
+     * @return
+     */
+    Optional<String> getModuleNameFromNameSpace(String nameSpace);
+
+    /**
+     * Get a mapping of the module names to it's corresponding ShardStrategy
+     * @return
+     */
+    Map<String, ShardStrategy> getModuleNameToShardStrategyMap();
+
+    /**
+     * Given a module name find all the shardNames corresponding to it
+     * @param moduleName
+     * @return
+     */
+    List<String> getShardNamesFromModuleName(String moduleName);
+
+    /**
+     * Given a shardName find all the members on which it belongs
+     *
+     * @param shardName
+     * @return
+     */
+    List<String> getMembersFromShardName(String shardName);
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ConfigurationImpl.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ConfigurationImpl.java
new file mode 100644 (file)
index 0000000..3459002
--- /dev/null
@@ -0,0 +1,241 @@
+/*
+ * 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 com.google.common.base.Optional;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+import com.typesafe.config.ConfigObject;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.DefaultShardStrategy;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ModuleShardStrategy;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class ConfigurationImpl implements Configuration {
+
+    private final List<ModuleShard> moduleShards = new ArrayList<>();
+
+    private final List<Module> modules = new ArrayList<>();
+
+    private static final Logger
+        LOG = LoggerFactory.getLogger(DistributedDataStore.class);
+
+
+    public ConfigurationImpl(String moduleShardsConfigPath,
+
+        String modulesConfigPath){
+
+        File moduleShardsFile = new File("./configuration/initial/" + moduleShardsConfigPath);
+        File modulesFile = new File("./configuration/initial/" + modulesConfigPath);
+
+        Config moduleShardsConfig = null;
+        if(moduleShardsFile.exists()) {
+            LOG.info("module shards config file exists - reading config from it");
+            moduleShardsConfig = ConfigFactory.parseFile(moduleShardsFile);
+        } else {
+            LOG.warn("module shards configuration read from resource");
+            moduleShardsConfig = ConfigFactory.load(moduleShardsConfigPath);
+        }
+
+        Config modulesConfig = null;
+        if(modulesFile.exists()) {
+            LOG.info("modules config file exists - reading config from it");
+            modulesConfig = ConfigFactory.parseFile(modulesFile);
+        } else {
+            LOG.warn("modules configuration read from resource");
+            modulesConfig = ConfigFactory.load(modulesConfigPath);
+        }
+
+        readModuleShards(moduleShardsConfig);
+
+        readModules(modulesConfig);
+    }
+
+    @Override public List<String> getMemberShardNames(String memberName){
+        List<String> shards = new ArrayList();
+        for(ModuleShard ms : moduleShards){
+            for(Shard s : ms.getShards()){
+                for(String m : s.getReplicas()){
+                    if(memberName.equals(m)){
+                        shards.add(s.getName());
+                    }
+                }
+            }
+        }
+        return shards;
+
+    }
+
+    @Override public Optional<String> getModuleNameFromNameSpace(String nameSpace) {
+        for(Module m : modules){
+            if(m.getNameSpace().equals(nameSpace)){
+                return Optional.of(m.getName());
+            }
+        }
+        return Optional.absent();
+    }
+
+    @Override public Map<String, ShardStrategy> getModuleNameToShardStrategyMap() {
+        Map<String, ShardStrategy> map = new HashMap<>();
+        for(Module m : modules){
+            map.put(m.getName(), m.getShardStrategy());
+        }
+        return map;
+    }
+
+    @Override public List<String> getShardNamesFromModuleName(String moduleName) {
+        for(ModuleShard m : moduleShards){
+            if(m.getModuleName().equals(moduleName)){
+                List<String> l = new ArrayList<>();
+                for(Shard s : m.getShards()){
+                    l.add(s.getName());
+                }
+                return l;
+            }
+        }
+
+        return Collections.EMPTY_LIST;
+    }
+
+    @Override public List<String> getMembersFromShardName(String shardName) {
+        List<String> shards = new ArrayList();
+        for(ModuleShard ms : moduleShards){
+            for(Shard s : ms.getShards()) {
+                if(s.getName().equals(shardName)){
+                    return s.getReplicas();
+                }
+            }
+        }
+        return Collections.EMPTY_LIST;
+    }
+
+
+
+    private void readModules(Config modulesConfig) {
+        List<? extends ConfigObject> modulesConfigObjectList =
+            modulesConfig.getObjectList("modules");
+
+        for(ConfigObject o : modulesConfigObjectList){
+            ConfigObjectWrapper w = new ConfigObjectWrapper(o);
+            modules.add(new Module(w.stringValue("name"), w.stringValue(
+                "namespace"), w.stringValue("shard-strategy")));
+        }
+    }
+
+    private void readModuleShards(Config moduleShardsConfig) {
+        List<? extends ConfigObject> moduleShardsConfigObjectList =
+            moduleShardsConfig.getObjectList("module-shards");
+
+        for(ConfigObject moduleShardConfigObject : moduleShardsConfigObjectList){
+
+            String moduleName = moduleShardConfigObject.get("name").unwrapped().toString();
+
+            List<? extends ConfigObject> shardsConfigObjectList =
+                moduleShardConfigObject.toConfig().getObjectList("shards");
+
+            List<Shard> shards = new ArrayList<>();
+
+            for(ConfigObject shard : shardsConfigObjectList){
+                String shardName = shard.get("name").unwrapped().toString();
+                List<String> replicas = shard.toConfig().getStringList("replicas");
+                shards.add(new Shard(shardName, replicas));
+            }
+
+            this.moduleShards.add(new ModuleShard(moduleName, shards));
+        }
+    }
+
+
+    private class ModuleShard {
+        private final String moduleName;
+        private final List<Shard> shards;
+
+        public ModuleShard(String moduleName, List<Shard> shards) {
+            this.moduleName = moduleName;
+            this.shards = shards;
+        }
+
+        public String getModuleName() {
+            return moduleName;
+        }
+
+        public List<Shard> getShards() {
+            return shards;
+        }
+    }
+
+    private class Shard {
+        private final String name;
+        private final List<String> replicas;
+
+        Shard(String name, List<String> replicas) {
+            this.name = name;
+            this.replicas = replicas;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public List<String> getReplicas() {
+            return replicas;
+        }
+    }
+
+    private class Module {
+
+        private final String name;
+        private final String nameSpace;
+        private final ShardStrategy shardStrategy;
+
+        Module(String name, String nameSpace, String shardStrategy) {
+            this.name = name;
+            this.nameSpace = nameSpace;
+            if(ModuleShardStrategy.NAME.equals(shardStrategy)){
+                this.shardStrategy = new ModuleShardStrategy(name, ConfigurationImpl.this);
+            } else {
+                this.shardStrategy = new DefaultShardStrategy();
+            }
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public String getNameSpace() {
+            return nameSpace;
+        }
+
+        public ShardStrategy getShardStrategy() {
+            return shardStrategy;
+        }
+    }
+
+
+    private static class ConfigObjectWrapper{
+
+        private final ConfigObject configObject;
+
+        ConfigObjectWrapper(ConfigObject configObject){
+            this.configObject = configObject;
+        }
+
+        public String stringValue(String name){
+            return configObject.get(name).unwrapped().toString();
+        }
+    }
+}
index fd4f9f75b5bd801aaa1fd9484c3e0b01a8d522ae..3af6f56a2c78fe40ddd9cfa60ac5fe7bd60348c9 100644 (file)
@@ -14,36 +14,41 @@ import org.opendaylight.controller.cluster.datastore.messages.DataChanged;
 import org.opendaylight.controller.cluster.datastore.messages.DataChangedReply;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+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;
 
 public class DataChangeListener extends AbstractUntypedActor {
-    private final AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> listener;
+    private final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> listener;
+    private final SchemaContext schemaContext;
+    private final YangInstanceIdentifier pathId;
 
-    public DataChangeListener(
-        AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> listener) {
+    public DataChangeListener(SchemaContext schemaContext,
+                              AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> listener, YangInstanceIdentifier pathId) {
         this.listener = listener;
+        this.schemaContext = schemaContext;
+        this.pathId  = pathId;
     }
 
     @Override public void handleReceive(Object message) throws Exception {
-        if(message instanceof DataChanged){
-            DataChanged reply = (DataChanged) message;
-            AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>>
+        if(message.getClass().equals(DataChanged.SERIALIZABLE_CLASS)){
+            DataChanged reply = DataChanged.fromSerialize(schemaContext,message, pathId);
+            AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>>
                 change = reply.getChange();
             this.listener.onDataChanged(change);
 
             if(getSender() != null){
-                getSender().tell(new DataChangedReply(), getSelf());
+                getSender().tell(new DataChangedReply().toSerializable(), getSelf());
             }
 
         }
     }
 
-    public static Props props(final AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> listener) {
+    public static Props props(final SchemaContext schemaContext, final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> listener, final YangInstanceIdentifier pathId) {
         return Props.create(new Creator<DataChangeListener>() {
             @Override
             public DataChangeListener create() throws Exception {
-                return new DataChangeListener(listener);
+                return new DataChangeListener(schemaContext,listener,pathId );
             }
 
         });
index 8423b9853db919261c1d7511731cb17928807454..cd9c330268e1316f2f76296bc4736bc3e7c8487f 100644 (file)
@@ -12,21 +12,24 @@ import akka.actor.ActorSelection;
 import org.opendaylight.controller.cluster.datastore.messages.DataChanged;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+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;
 
 /**
  * DataChangeListenerProxy represents a single remote DataChangeListener
  */
-public class DataChangeListenerProxy implements AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>{
+public class DataChangeListenerProxy implements AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>{
     private final ActorSelection dataChangeListenerActor;
+    private final SchemaContext schemaContext;
 
-    public DataChangeListenerProxy(ActorSelection dataChangeListenerActor) {
+    public DataChangeListenerProxy(SchemaContext schemaContext,ActorSelection dataChangeListenerActor) {
         this.dataChangeListenerActor = dataChangeListenerActor;
+        this.schemaContext = schemaContext;
     }
 
     @Override public void onDataChanged(
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
-        dataChangeListenerActor.tell(new DataChanged(change), null);
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
+        dataChangeListenerActor.tell(new DataChanged(schemaContext,change).toSerializable(), null);
     }
 }
index dca97354876812601d69c6bc9764779608710d09..9e50b5b332babf4bcc033aeea3778fed850681d3 100644 (file)
@@ -14,29 +14,29 @@ import akka.japi.Creator;
 import org.opendaylight.controller.cluster.datastore.messages.CloseDataChangeListenerRegistration;
 import org.opendaylight.controller.cluster.datastore.messages.CloseDataChangeListenerRegistrationReply;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 public class DataChangeListenerRegistration extends AbstractUntypedActor {
 
-    private final org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>>
+    private final org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>>
         registration;
 
     public DataChangeListenerRegistration(
-        org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> registration) {
+        org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> registration) {
         this.registration = registration;
     }
 
     @Override
     public void handleReceive(Object message) throws Exception {
-        if (message instanceof CloseDataChangeListenerRegistration) {
+        if (message.getClass().equals(CloseDataChangeListenerRegistration.SERIALIZABLE_CLASS)) {
             closeListenerRegistration(
-                (CloseDataChangeListenerRegistration) message);
+                new CloseDataChangeListenerRegistration());
         }
     }
 
     public static Props props(
-        final org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> registration) {
+        final org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> registration) {
         return Props.create(new Creator<DataChangeListenerRegistration>() {
 
             @Override
@@ -50,7 +50,7 @@ public class DataChangeListenerRegistration extends AbstractUntypedActor {
         CloseDataChangeListenerRegistration message) {
         registration.close();
         getSender()
-            .tell(new CloseDataChangeListenerRegistrationReply(), getSelf());
+            .tell(new CloseDataChangeListenerRegistrationReply().toSerializable(), getSelf());
         getSelf().tell(PoisonPill.getInstance(), getSelf());
     }
 }
index 83737cfac5b4133d051839f2a1b4b29245f80f80..e3cdbb4ee131d1b0961e9d57c8eeb5ee6e568b61 100644 (file)
@@ -14,7 +14,7 @@ import akka.actor.PoisonPill;
 import org.opendaylight.controller.cluster.datastore.messages.CloseDataChangeListenerRegistration;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 /**
@@ -29,7 +29,7 @@ public class DataChangeListenerRegistrationProxy implements ListenerRegistration
     private final AsyncDataChangeListener listener;
     private final ActorRef dataChangeListenerActor;
 
-    public <L extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>>
+    public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>>
     DataChangeListenerRegistrationProxy(
         ActorSelection listenerRegistrationActor,
         L listener, ActorRef dataChangeListenerActor) {
@@ -45,7 +45,7 @@ public class DataChangeListenerRegistrationProxy implements ListenerRegistration
 
     @Override
     public void close() {
-        listenerRegistrationActor.tell(new CloseDataChangeListenerRegistration(), null);
+        listenerRegistrationActor.tell(new CloseDataChangeListenerRegistration().toSerializable(), null);
         dataChangeListenerActor.tell(PoisonPill.getInstance(), null);
     }
 }
index 4401104a85971c77c1b9a9333c727348f5398656..2ef8e5f449f8df564ae42943c6597224b832bcb4 100644 (file)
@@ -13,6 +13,7 @@ import akka.actor.ActorSystem;
 import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListener;
 import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListenerReply;
 import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory;
 import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
@@ -22,7 +23,7 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransactio
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+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;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
@@ -44,6 +45,9 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, Au
     private final String type;
     private final ActorContext actorContext;
 
+    private SchemaContext schemaContext;
+
+
 
     /**
      * Executor used to run FutureTask's
@@ -56,8 +60,10 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, Au
     private final ExecutorService executor =
         Executors.newFixedThreadPool(10);
 
-    public DistributedDataStore(ActorSystem actorSystem, String type) {
-        this(new ActorContext(actorSystem, actorSystem.actorOf(ShardManager.props(type), "shardmanager-" + type)), type);
+    public DistributedDataStore(ActorSystem actorSystem, String type, ClusterWrapper cluster, Configuration configuration) {
+        this(new ActorContext(actorSystem, actorSystem
+            .actorOf(ShardManager.props(type, cluster, configuration),
+                "shardmanager-" + type), cluster, configuration), type);
     }
 
     public DistributedDataStore(ActorContext actorContext, String type) {
@@ -67,20 +73,22 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, Au
 
 
     @Override
-    public <L extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
-        InstanceIdentifier path, L listener,
+    public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
+        YangInstanceIdentifier path, L listener,
         AsyncDataBroker.DataChangeScope scope) {
 
         ActorRef dataChangeListenerActor = actorContext.getActorSystem().actorOf(
-            DataChangeListener.props(listener));
+            DataChangeListener.props(schemaContext,listener,path ));
+
+        String shardName = ShardStrategyFactory.getStrategy(path).findShard(path);
 
-        Object result = actorContext.executeShardOperation(Shard.DEFAULT_NAME,
+        Object result = actorContext.executeShardOperation(shardName,
             new RegisterChangeListener(path, dataChangeListenerActor.path(),
-                AsyncDataBroker.DataChangeScope.BASE),
+                scope).toSerializable(),
             ActorContext.ASK_DURATION
         );
 
-        RegisterChangeListenerReply reply = (RegisterChangeListenerReply) result;
+        RegisterChangeListenerReply reply = RegisterChangeListenerReply.fromSerializable(actorContext.getActorSystem(),result);
         return new DataChangeListenerRegistrationProxy(actorContext.actorSelection(reply.getListenerRegistrationPath()), listener, dataChangeListenerActor);
     }
 
@@ -88,28 +96,29 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, Au
 
     @Override
     public DOMStoreTransactionChain createTransactionChain() {
-        return new TransactionChainProxy(actorContext, executor);
+        return new TransactionChainProxy(actorContext, executor, schemaContext);
     }
 
     @Override
     public DOMStoreReadTransaction newReadOnlyTransaction() {
         return new TransactionProxy(actorContext, TransactionProxy.TransactionType.READ_ONLY,
-            executor);
+            executor, schemaContext);
     }
 
     @Override
     public DOMStoreWriteTransaction newWriteOnlyTransaction() {
         return new TransactionProxy(actorContext, TransactionProxy.TransactionType.WRITE_ONLY,
-            executor);
+            executor, schemaContext);
     }
 
     @Override
     public DOMStoreReadWriteTransaction newReadWriteTransaction() {
         return new TransactionProxy(actorContext, TransactionProxy.TransactionType.READ_WRITE,
-            executor);
+            executor, schemaContext);
     }
 
     @Override public void onGlobalContextUpdated(SchemaContext schemaContext) {
+        this.schemaContext = schemaContext;
         actorContext.getShardManager().tell(
             new UpdateSchemaContext(schemaContext), null);
     }
index f19cb9284cf3ecd81cbe2672c731db3d80af0d3a..6d87271f00d54fcdbf6ca70c27843248b0bbc1b9 100644 (file)
@@ -8,14 +8,19 @@
 
 package org.opendaylight.controller.cluster.datastore;
 
+import akka.actor.ActorSystem;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
 
 public class DistributedDataStoreFactory {
     public static DistributedDataStore createInstance(String name, SchemaService schemaService){
+        ActorSystem actorSystem = ActorSystemFactory.getInstance();
+        Configuration config = new ConfigurationImpl("module-shards.conf", "modules.conf");
         final DistributedDataStore dataStore =
-            new DistributedDataStore(ActorSystemFactory.getInstance(), name);
+            new DistributedDataStore(actorSystem, name, new ClusterWrapperImpl(actorSystem),config );
+       ShardStrategyFactory.setConfiguration(config);
         schemaService
-            .registerSchemaServiceListener(dataStore);
+            .registerSchemaContextListener(dataStore);
         return dataStore;
 
     }
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/NoOpCohort.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/NoOpCohort.java
new file mode 100644 (file)
index 0000000..eb28159
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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.UntypedActor;
+import org.opendaylight.controller.cluster.datastore.messages.AbortTransaction;
+import org.opendaylight.controller.cluster.datastore.messages.AbortTransactionReply;
+import org.opendaylight.controller.cluster.datastore.messages.CanCommitTransaction;
+import org.opendaylight.controller.cluster.datastore.messages.CanCommitTransactionReply;
+import org.opendaylight.controller.cluster.datastore.messages.CommitTransaction;
+import org.opendaylight.controller.cluster.datastore.messages.CommitTransactionReply;
+import org.opendaylight.controller.cluster.datastore.messages.PreCommitTransaction;
+import org.opendaylight.controller.cluster.datastore.messages.PreCommitTransactionReply;
+
+public class NoOpCohort extends UntypedActor {
+
+    @Override public void onReceive(Object message) throws Exception {
+        if (message.getClass().equals(CanCommitTransaction.SERIALIZABLE_CLASS)) {
+            getSender().tell(new CanCommitTransactionReply(false).toSerializable(), getSelf());
+        } else if (message.getClass().equals(PreCommitTransaction.SERIALIZABLE_CLASS)) {
+            getSender().tell(
+                new PreCommitTransactionReply().toSerializable(),
+                getSelf());
+        } else if (message.getClass().equals(CommitTransaction.SERIALIZABLE_CLASS)) {
+            getSender().tell(new CommitTransactionReply().toSerializable(), getSelf());
+        } else if (message.getClass().equals(AbortTransaction.SERIALIZABLE_CLASS)) {
+            getSender().tell(new AbortTransactionReply().toSerializable(), getSelf());
+        } else {
+            throw new Exception ("Not recognized message received,message="+message);
+        }
+
+    }
+}
+
index 3425608d235ddce1555dac19f6bc3e985b65f7f9..999d0f8bafca9639baa70ea7c893656f87704ae7 100644 (file)
@@ -14,29 +14,33 @@ import akka.actor.Props;
 import akka.event.Logging;
 import akka.event.LoggingAdapter;
 import akka.japi.Creator;
-import akka.persistence.Persistent;
-import akka.persistence.UntypedProcessor;
+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;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChain;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChainReply;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
 import org.opendaylight.controller.cluster.datastore.messages.ForwardedCommitTransaction;
-import org.opendaylight.controller.cluster.datastore.messages.NonPersistent;
+import org.opendaylight.controller.cluster.datastore.messages.PeerAddressResolved;
 import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListener;
 import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListenerReply;
 import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext;
 import org.opendaylight.controller.cluster.datastore.modification.Modification;
+import org.opendaylight.controller.cluster.datastore.modification.MutableCompositeModification;
+import org.opendaylight.controller.cluster.raft.RaftActor;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 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.yangtools.yang.data.api.InstanceIdentifier;
+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;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -49,7 +53,7 @@ import java.util.concurrent.Executors;
  * Our Shard uses InMemoryDataStore as it's internal representation and delegates all requests it
  * </p>
  */
-public class Shard extends UntypedProcessor {
+public class Shard extends RaftActor {
 
     public static final String DEFAULT_NAME = "default";
 
@@ -58,137 +62,208 @@ public class Shard extends UntypedProcessor {
 
     private final InMemoryDOMDataStore store;
 
-    private final Map<Modification, DOMStoreThreePhaseCommitCohort>
+    private final Map<Object, DOMStoreThreePhaseCommitCohort>
         modificationToCohort = new HashMap<>();
 
-    private final LoggingAdapter log =
+    private final LoggingAdapter LOG =
         Logging.getLogger(getContext().system(), this);
 
     // By default persistent will be true and can be turned off using the system
     // property persistent
     private final boolean persistent;
 
-    private Shard(String name) {
+    private final String name;
+
+    private SchemaContext schemaContext;
+
+    private final ShardStats shardMBean;
+
+    private Shard(String name, Map<String, String> peerAddresses) {
+        super(name, peerAddresses);
+
+        this.name = name;
 
         String setting = System.getProperty("shard.persistent");
+
         this.persistent = !"false".equals(setting);
 
-        log.info("Creating shard : {} persistent : {}", name , persistent);
+        LOG.info("Creating shard : {} persistent : {}", name, persistent);
 
         store = new InMemoryDOMDataStore(name, storeExecutor);
+
+        shardMBean = ShardMBeanFactory.getShardStatsMBean(name);
+
     }
 
-    public static Props props(final String name) {
+    public static Props props(final String name, final Map<String, String> peerAddresses) {
         return Props.create(new Creator<Shard>() {
 
             @Override
             public Shard create() throws Exception {
-                return new Shard(name);
+                return new Shard(name, peerAddresses);
             }
 
         });
     }
 
 
-    @Override
-    public void onReceive(Object message) throws Exception {
-        log.debug("Received message {}", message);
+    @Override public void onReceiveCommand(Object message){
+        LOG.debug("Received message {} from {}", message.getClass().toString(), getSender());
 
-        if (message instanceof CreateTransactionChain) {
-            createTransactionChain();
-        } else if (message instanceof RegisterChangeListener) {
-            registerChangeListener((RegisterChangeListener) message);
+        if (message.getClass().equals(CreateTransactionChain.SERIALIZABLE_CLASS)) {
+            if(isLeader()) {
+                createTransactionChain();
+            } else if(getLeader() != null){
+                getLeader().forward(message, getContext());
+            }
+        } else if (message.getClass().equals(RegisterChangeListener.SERIALIZABLE_CLASS)) {
+            registerChangeListener(RegisterChangeListener.fromSerializable(getContext().system(), message));
         } else if (message instanceof UpdateSchemaContext) {
             updateSchemaContext((UpdateSchemaContext) message);
         } else if (message instanceof ForwardedCommitTransaction) {
             handleForwardedCommit((ForwardedCommitTransaction) message);
-        } else if (message instanceof Persistent) {
-            commit((Modification) ((Persistent) message).payload());
-        } else if (message instanceof CreateTransaction) {
-            createTransaction((CreateTransaction) message);
-        } else if(message instanceof NonPersistent){
-            commit((Modification) ((NonPersistent) message).payload());
+        } else if (message.getClass().equals(CreateTransaction.SERIALIZABLE_CLASS)) {
+            if(isLeader()) {
+                createTransaction(CreateTransaction.fromSerializable(message));
+            } else if(getLeader() != null){
+                getLeader().forward(message, getContext());
+            }
+        } else if (message instanceof PeerAddressResolved){
+            PeerAddressResolved resolved = (PeerAddressResolved) message;
+            setPeerAddress(resolved.getPeerId(), resolved.getPeerAddress());
+        } else {
+          super.onReceiveCommand(message);
         }
     }
 
     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()), "shard-" + createTransaction.getTransactionId());
+            ShardTransaction.props(transaction, getSelf(), schemaContext), transactionId);
+
         getSender()
-            .tell(new CreateTransactionReply(transactionActor.path(), createTransaction.getTransactionId()),
+            .tell(new CreateTransactionReply(Serialization.serializedActorPath(transactionActor), createTransaction.getTransactionId()).toSerializable(),
                 getSelf());
     }
 
-    private void commit(Modification modification) {
+    private void commit(final ActorRef sender, Object serialized) {
+        Modification modification = MutableCompositeModification.fromSerializable(serialized, schemaContext);
         DOMStoreThreePhaseCommitCohort cohort =
-            modificationToCohort.remove(modification);
+            modificationToCohort.remove(serialized);
         if (cohort == null) {
-            log.error(
+            LOG.error(
                 "Could not find cohort for modification : " + modification);
+            LOG.info("Writing modification using a new transaction");
+            modification.apply(store.newReadWriteTransaction());
             return;
         }
+
         final ListenableFuture<Void> future = cohort.commit();
-        final ActorRef sender = getSender();
+        shardMBean.incrementCommittedTransactionCount();
         final ActorRef self = getSelf();
         future.addListener(new Runnable() {
             @Override
             public void run() {
                 try {
                     future.get();
-                    sender.tell(new CommitTransactionReply(), self);
+
+                    if(sender != null) {
+                        sender
+                            .tell(new CommitTransactionReply().toSerializable(),
+                                self);
+                    } else {
+                        LOG.error("sender is null ???");
+                    }
                 } catch (InterruptedException | ExecutionException e) {
                     // FIXME : Handle this properly
-                    log.error(e, "An exception happened when committing");
+                    LOG.error(e, "An exception happened when committing");
                 }
             }
         }, getContext().dispatcher());
     }
 
     private void handleForwardedCommit(ForwardedCommitTransaction message) {
+        Object serializedModification = message.getModification().toSerializable();
+
         modificationToCohort
-            .put(message.getModification(), message.getCohort());
+            .put(serializedModification , message.getCohort());
+
         if(persistent) {
-            getSelf().forward(Persistent.create(message.getModification()),
-                getContext());
+            this.persistData(getSender(), "identifier", new CompositeModificationPayload(serializedModification));
         } else {
-            getSelf().forward(NonPersistent.create(message.getModification()),
-                getContext());
+            this.commit(getSender(), serializedModification);
         }
     }
 
     private void updateSchemaContext(UpdateSchemaContext message) {
+        this.schemaContext = message.getSchemaContext();
         store.onGlobalContextUpdated(message.getSchemaContext());
     }
 
     private void registerChangeListener(
         RegisterChangeListener registerChangeListener) {
 
+        LOG.debug("registerDataChangeListener for " + registerChangeListener.getPath());
+
+
         ActorSelection dataChangeListenerPath = getContext()
-            .system().actorSelection(registerChangeListener.getDataChangeListenerPath());
+            .system().actorSelection(
+                registerChangeListener.getDataChangeListenerPath());
 
-        AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>
-            listener = new DataChangeListenerProxy(dataChangeListenerPath);
+        AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>
+            listener = new DataChangeListenerProxy(schemaContext,dataChangeListenerPath);
 
-        org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>>
+        org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>>
             registration =
             store.registerChangeListener(registerChangeListener.getPath(),
                 listener, registerChangeListener.getScope());
         ActorRef listenerRegistration =
             getContext().actorOf(
                 DataChangeListenerRegistration.props(registration));
+
+        LOG.debug("registerDataChangeListener sending reply, listenerRegistrationPath = " + listenerRegistration.path().toString());
+
         getSender()
-            .tell(new RegisterChangeListenerReply(listenerRegistration.path()),
+            .tell(new RegisterChangeListenerReply(listenerRegistration.path()).toSerializable(),
                 getSelf());
     }
 
     private void createTransactionChain() {
         DOMStoreTransactionChain chain = store.createTransactionChain();
         ActorRef transactionChain =
-            getContext().actorOf(ShardTransactionChain.props(chain));
+            getContext().actorOf(
+                ShardTransactionChain.props(chain, schemaContext));
         getSender()
-            .tell(new CreateTransactionChainReply(transactionChain.path()),
+            .tell(new CreateTransactionChainReply(transactionChain.path())
+                .toSerializable(),
                 getSelf());
     }
+
+    @Override protected void applyState(ActorRef clientActor, String identifier,
+        Object data) {
+
+        if(data instanceof CompositeModificationPayload){
+            Object modification =
+                ((CompositeModificationPayload) data).getModification();
+            commit(clientActor, modification);
+        } else {
+            LOG.error("Unknown state received {}", data);
+        }
+
+    }
+
+    @Override protected Object createSnapshot() {
+        throw new UnsupportedOperationException("createSnapshot");
+    }
+
+    @Override protected void applySnapshot(Object snapshot) {
+        throw new UnsupportedOperationException("applySnapshot");
+    }
+
+    @Override public String persistenceId() {
+        return this.name;
+    }
 }
index 250ef49e6f0b73ca33ad0a41eb36c661b9560038..5fbce4cd98900be65053939ca7a51d4f7a929a98 100644 (file)
@@ -11,14 +11,19 @@ package org.opendaylight.controller.cluster.datastore;
 import akka.actor.ActorPath;
 import akka.actor.ActorRef;
 import akka.actor.Address;
+import akka.actor.OneForOneStrategy;
 import akka.actor.Props;
-import akka.event.Logging;
-import akka.event.LoggingAdapter;
+import akka.actor.SupervisorStrategy;
+import akka.cluster.ClusterEvent;
 import akka.japi.Creator;
+import akka.japi.Function;
+import com.google.common.base.Preconditions;
 import org.opendaylight.controller.cluster.datastore.messages.FindPrimary;
+import org.opendaylight.controller.cluster.datastore.messages.PeerAddressResolved;
 import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound;
 import org.opendaylight.controller.cluster.datastore.messages.PrimaryNotFound;
 import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext;
+import scala.concurrent.duration.Duration;
 
 import java.util.HashMap;
 import java.util.List;
@@ -49,54 +54,242 @@ import java.util.Map;
  */
 public class ShardManager extends AbstractUntypedActor {
 
-  // Stores a mapping between a shard name and the address of the current primary
-  private final Map<String, Address> shardNameToPrimaryAddress = new HashMap<>();
-
-  // Stores a mapping between a member name and the address of the member
-  private final Map<String, Address> memberNameToAddress = new HashMap<>();
-
-  // Stores a mapping between the shard name and all the members on which a replica of that shard are available
-  private final Map<String, List<String>> shardNameToMembers = new HashMap<>();
-
-  private final LoggingAdapter log = Logging.getLogger(getContext().system(), this);
-
-  private final ActorPath defaultShardPath;
-
-  /**
-   *
-   * @param type defines the kind of data that goes into shards created by this shard manager. Examples of type would be
-   *             configuration or operational
-   */
-  private ShardManager(String type){
-    ActorRef actor = getContext().actorOf(Shard.props("shard-" + Shard.DEFAULT_NAME + "-" + type), "shard-" + Shard.DEFAULT_NAME + "-" + type);
-    defaultShardPath = actor.path();
-  }
-
-  public static Props props(final String type){
-    return Props.create(new Creator<ShardManager>(){
-
-      @Override
-      public ShardManager create() throws Exception {
-        return new ShardManager(type);
-      }
-    });
-  }
-
-  @Override
-  public void handleReceive(Object message) throws Exception {
-    if (message instanceof FindPrimary) {
-      FindPrimary msg = ((FindPrimary) message);
-      String shardName = msg.getShardName();
-      if(Shard.DEFAULT_NAME.equals(shardName)){
-        getSender().tell(new PrimaryFound(defaultShardPath.toString()), getSelf());
-      } else {
-        getSender().tell(new PrimaryNotFound(shardName), getSelf());
-      }
-    } else if(message instanceof UpdateSchemaContext){
-        // FIXME : Notify all local shards of a context change
-        getContext().system().actorSelection(defaultShardPath).forward(message, getContext());
+    // Stores a mapping between a member name and the address of the member
+    private final Map<String, Address> memberNameToAddress = new HashMap<>();
+
+    private final Map<String, ShardInformation> localShards = new HashMap<>();
+
+
+    private final String type;
+
+    private final ClusterWrapper cluster;
+
+    private final Configuration configuration;
+
+    /**
+     * @param type defines the kind of data that goes into shards created by this shard manager. Examples of type would be
+     *             configuration or operational
+     */
+    private ShardManager(String type, ClusterWrapper cluster, Configuration configuration) {
+
+        this.type = Preconditions.checkNotNull(type, "type should not be null");
+        this.cluster = Preconditions.checkNotNull(cluster, "cluster should not be null");
+        this.configuration = Preconditions.checkNotNull(configuration, "configuration should not be null");
+
+        // Subscribe this actor to cluster member events
+        cluster.subscribeToMemberEvents(getSelf());
+
+        // Create all the local Shards and make them a child of the ShardManager
+        // TODO: This may need to be initiated when we first get the schema context
+        createLocalShards();
+    }
+
+    public static Props props(final String type,
+        final ClusterWrapper cluster,
+        final Configuration configuration) {
+        return Props.create(new Creator<ShardManager>() {
+
+            @Override
+            public ShardManager create() throws Exception {
+                return new ShardManager(type, cluster, configuration);
+            }
+        });
+    }
+
+
+    @Override
+    public void handleReceive(Object message) throws Exception {
+        if (message.getClass().equals(FindPrimary.SERIALIZABLE_CLASS)) {
+            findPrimary(
+                FindPrimary.fromSerializable(message));
+
+        } else if (message instanceof UpdateSchemaContext) {
+            updateSchemaContext(message);
+        } else if (message instanceof ClusterEvent.MemberUp){
+            memberUp((ClusterEvent.MemberUp) message);
+        } else if(message instanceof ClusterEvent.MemberRemoved) {
+            memberRemoved((ClusterEvent.MemberRemoved) message);
+        } else if(message instanceof ClusterEvent.UnreachableMember) {
+            ignoreMessage(message);
+        } else{
+          throw new Exception ("Not recognized message received, message="+message);
+        }
+
+    }
+
+    private void ignoreMessage(Object message){
+        LOG.debug("Unhandled message : " + message);
+    }
+
+    private void memberRemoved(ClusterEvent.MemberRemoved message) {
+        memberNameToAddress.remove(message.member().roles().head());
+    }
+
+    private void memberUp(ClusterEvent.MemberUp message) {
+        String memberName = message.member().roles().head();
+
+        memberNameToAddress.put(memberName , message.member().address());
+
+        for(ShardInformation info : localShards.values()){
+            String shardName = info.getShardName();
+            info.updatePeerAddress(getShardActorName(memberName, shardName),
+                getShardActorPath(shardName, memberName));
+        }
+    }
+
+    private void updateSchemaContext(Object message) {
+        for(ShardInformation info : localShards.values()){
+            info.getActor().tell(message,getSelf());
+        }
+    }
+
+    private void findPrimary(FindPrimary message) {
+        String shardName = message.getShardName();
+
+        List<String> members =
+            configuration.getMembersFromShardName(shardName);
+
+        // First see if the there is a local replica for the shard
+        ShardInformation info = localShards.get(shardName);
+        if(info != null) {
+            ActorPath shardPath = info.getActorPath();
+            if (shardPath != null) {
+                getSender()
+                    .tell(
+                        new PrimaryFound(shardPath.toString()).toSerializable(),
+                        getSelf());
+                return;
+            }
+        }
+
+        if(cluster.getCurrentMemberName() != null) {
+            members.remove(cluster.getCurrentMemberName());
+        }
+
+        // There is no way for us to figure out the primary (for now) so assume
+        // that one of the remote nodes is a primary
+        for(String memberName : members) {
+            Address address = memberNameToAddress.get(memberName);
+            if(address != null){
+                String path =
+                    getShardActorPath(shardName, memberName);
+                getSender().tell(new PrimaryFound(path).toSerializable(), getSelf());
+                return;
+            }
+        }
+        getSender().tell(new PrimaryNotFound(shardName).toSerializable(), getSelf());
+    }
+
+    private String
+
+
+    getShardActorPath(String shardName, String memberName) {
+        Address address = memberNameToAddress.get(memberName);
+        if(address != null) {
+            return address.toString() + "/user/shardmanager-" + this.type + "/"
+                + getShardActorName(
+                memberName, shardName);
+        }
+        return null;
+    }
+
+    private String getShardActorName(String memberName, String shardName){
+        return memberName + "-shard-" + shardName + "-" + this.type;
     }
-  }
 
+    // Create the shards that are local to this member
+    private void createLocalShards() {
+        String memberName = this.cluster.getCurrentMemberName();
+        List<String> memberShardNames =
+            this.configuration.getMemberShardNames(memberName);
 
+        for(String shardName : memberShardNames){
+            String shardActorName = getShardActorName(memberName, shardName);
+            Map<String, String> peerAddresses = getPeerAddresses(shardName);
+            ActorRef actor = getContext()
+                .actorOf(Shard.props(shardActorName, peerAddresses),
+                    shardActorName);
+            localShards.put(shardName, new ShardInformation(shardName, actor, peerAddresses));
+        }
+
+    }
+
+    private Map<String, String> getPeerAddresses(String shardName){
+
+        Map<String, String> peerAddresses = new HashMap<>();
+
+        List<String> members =
+            this.configuration.getMembersFromShardName(shardName);
+
+        String currentMemberName = this.cluster.getCurrentMemberName();
+
+        for(String memberName : members){
+            if(!currentMemberName.equals(memberName)){
+                String shardActorName = getShardActorName(memberName, shardName);
+                String path =
+                    getShardActorPath(shardName, currentMemberName);
+                peerAddresses.put(shardActorName, path);
+            }
+        }
+        return peerAddresses;
+    }
+
+
+    @Override
+    public SupervisorStrategy supervisorStrategy() {
+        return new OneForOneStrategy(10, Duration.create("1 minute"),
+            new Function<Throwable, SupervisorStrategy.Directive>() {
+                @Override
+                public SupervisorStrategy.Directive apply(Throwable t) {
+                    return SupervisorStrategy.resume();
+                }
+            }
+        );
+
+    }
+
+    private class ShardInformation {
+        private final String shardName;
+        private final ActorRef actor;
+        private final ActorPath actorPath;
+        private final Map<String, String> peerAddresses;
+
+        private ShardInformation(String shardName, ActorRef actor,
+            Map<String, String> peerAddresses) {
+            this.shardName = shardName;
+            this.actor = actor;
+            this.actorPath = actor.path();
+            this.peerAddresses = peerAddresses;
+        }
+
+        public String getShardName() {
+            return shardName;
+        }
+
+        public ActorRef getActor(){
+            return actor;
+        }
+
+        public ActorPath getActorPath() {
+            return actorPath;
+        }
+
+        public Map<String, String> getPeerAddresses() {
+            return peerAddresses;
+        }
+
+        public void updatePeerAddress(String peerId, String peerAddress){
+            LOG.info("updatePeerAddress for peer {} with address {}", peerId, peerAddress);
+            if(peerAddresses.containsKey(peerId)){
+                peerAddresses.put(peerId, peerAddress);
+
+                LOG.info("Sending PeerAddressResolved for peer {} with address {} to {}", peerId, peerAddress, actor.path());
+
+                actor
+                    .tell(new PeerAddressResolved(peerId, peerAddress),
+                        getSelf());
+
+            }
+        }
+    }
 }
index e3d1e2d9d42e4968f4b81ca0ea33d40c2b7b07f7..737f57bf5d7314536f5fc20b1cbc45167f1b6e97 100644 (file)
@@ -37,8 +37,9 @@ import org.opendaylight.controller.cluster.datastore.modification.WriteModificat
 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.yangtools.yang.data.api.InstanceIdentifier;
+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;
 
 import java.util.concurrent.ExecutionException;
 
@@ -67,6 +68,7 @@ import java.util.concurrent.ExecutionException;
 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
@@ -82,37 +84,38 @@ public class ShardTransaction extends AbstractUntypedActor {
         Logging.getLogger(getContext().system(), this);
 
     public ShardTransaction(DOMStoreReadWriteTransaction transaction,
-        ActorRef shardActor) {
-        this(null, transaction, shardActor);
+        ActorRef shardActor, SchemaContext schemaContext) {
+        this(null, transaction, shardActor, schemaContext);
     }
 
     public ShardTransaction(DOMStoreTransactionChain transactionChain, DOMStoreReadWriteTransaction transaction,
-        ActorRef shardActor) {
+        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 ActorRef shardActor, final SchemaContext schemaContext) {
         return Props.create(new Creator<ShardTransaction>() {
 
             @Override
             public ShardTransaction create() throws Exception {
-                return new ShardTransaction(transaction, shardActor);
+                return new ShardTransaction(transaction, shardActor, schemaContext);
             }
         });
     }
 
     public static Props props(final DOMStoreTransactionChain transactionChain, final DOMStoreReadWriteTransaction transaction,
-        final ActorRef shardActor) {
+        final ActorRef shardActor, final SchemaContext schemaContext) {
         return Props.create(new Creator<ShardTransaction>() {
 
             @Override
             public ShardTransaction create() throws Exception {
-                return new ShardTransaction(transactionChain, transaction, shardActor);
+                return new ShardTransaction(transactionChain, transaction, shardActor, schemaContext);
             }
         });
     }
@@ -120,29 +123,31 @@ public class ShardTransaction extends AbstractUntypedActor {
 
     @Override
     public void handleReceive(Object message) throws Exception {
-        if (message instanceof ReadData) {
-            readData((ReadData) message);
-        } else if (message instanceof WriteData) {
-            writeData((WriteData) message);
-        } else if (message instanceof MergeData) {
-            mergeData((MergeData) message);
-        } else if (message instanceof DeleteData) {
-            deleteData((DeleteData) message);
-        } else if (message instanceof ReadyTransaction) {
-            readyTransaction((ReadyTransaction) message);
-        } else if (message instanceof CloseTransaction) {
-            closeTransaction((CloseTransaction) message);
+        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);
         }
     }
 
     private void readData(ReadData message) {
         final ActorRef sender = getSender();
         final ActorRef self = getSelf();
-        final InstanceIdentifier path = message.getPath();
+        final YangInstanceIdentifier path = message.getPath();
         final ListenableFuture<Optional<NormalizedNode<?, ?>>> future =
             transaction.read(path);
 
@@ -152,9 +157,9 @@ public class ShardTransaction extends AbstractUntypedActor {
                 try {
                     Optional<NormalizedNode<?, ?>> optional = future.get();
                     if (optional.isPresent()) {
-                        sender.tell(new ReadDataReply(optional.get()), self);
+                        sender.tell(new ReadDataReply(schemaContext,optional.get()).toSerializable(), self);
                     } else {
-                        sender.tell(new ReadDataReply(null), self);
+                        sender.tell(new ReadDataReply(schemaContext,null).toSerializable(), self);
                     }
                 } catch (InterruptedException | ExecutionException e) {
                     log.error(e,
@@ -169,22 +174,24 @@ public class ShardTransaction extends AbstractUntypedActor {
 
     private void writeData(WriteData message) {
         modification.addModification(
-            new WriteModification(message.getPath(), message.getData()));
+            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(), getSelf());
+        getSender().tell(new WriteDataReply().toSerializable(), getSelf());
     }
 
     private void mergeData(MergeData message) {
         modification.addModification(
-            new MergeModification(message.getPath(), message.getData()));
+            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(), getSelf());
+        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(), getSelf());
+        getSender().tell(new DeleteDataReply().toSerializable(), getSelf());
     }
 
     private void readyTransaction(ReadyTransaction message) {
@@ -192,13 +199,13 @@ public class ShardTransaction extends AbstractUntypedActor {
         ActorRef cohortActor = getContext().actorOf(
             ThreePhaseCommitCohort.props(cohort, shardActor, modification), "cohort");
         getSender()
-            .tell(new ReadyTransactionReply(cohortActor.path()), getSelf());
+            .tell(new ReadyTransactionReply(cohortActor.path()).toSerializable(), getSelf());
 
     }
 
     private void closeTransaction(CloseTransaction message) {
         transaction.close();
-        getSender().tell(new CloseTransactionReply(), getSelf());
+        getSender().tell(new CloseTransactionReply().toSerializable(), getSelf());
         getSelf().tell(PoisonPill.getInstance(), getSelf());
     }
 
index 1092e9a793d82443b2bda82eeb81fbebb7360675..50042411b17eeb0b0428963535008e8a777ca915 100644 (file)
@@ -17,6 +17,7 @@ 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;
 
 /**
  * The ShardTransactionChain Actor represents a remote TransactionChain
@@ -24,19 +25,23 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
 public class ShardTransactionChain extends AbstractUntypedActor {
 
     private final DOMStoreTransactionChain chain;
+    private final SchemaContext schemaContext;
 
-    public ShardTransactionChain(DOMStoreTransactionChain chain) {
+    public ShardTransactionChain(DOMStoreTransactionChain chain, SchemaContext schemaContext) {
         this.chain = chain;
+        this.schemaContext = schemaContext;
     }
 
     @Override
     public void handleReceive(Object message) throws Exception {
-        if (message instanceof CreateTransaction) {
-            CreateTransaction createTransaction = (CreateTransaction) message;
+        if (message.getClass().equals(CreateTransaction.SERIALIZABLE_CLASS)) {
+            CreateTransaction createTransaction = CreateTransaction.fromSerializable( message);
             createTransaction(createTransaction);
-        } else if (message instanceof CloseTransactionChain) {
+        } else if (message.getClass().equals(CloseTransactionChain.SERIALIZABLE_CLASS)) {
             chain.close();
-            getSender().tell(new CloseTransactionChainReply(), getSelf());
+            getSender().tell(new CloseTransactionChainReply().toSerializable(), getSelf());
+        }else{
+          throw new Exception("Not recognized message recieved="+message);
         }
     }
 
@@ -44,18 +49,18 @@ public class ShardTransactionChain extends AbstractUntypedActor {
         DOMStoreReadWriteTransaction transaction =
             chain.newReadWriteTransaction();
         ActorRef transactionActor = getContext().actorOf(ShardTransaction
-            .props(chain, transaction, getContext().parent()), "shard-" + createTransaction.getTransactionId());
+            .props(chain, transaction, getContext().parent(), schemaContext), "shard-" + createTransaction.getTransactionId());
         getSender()
-            .tell(new CreateTransactionReply(transactionActor.path(), createTransaction.getTransactionId()),
+            .tell(new CreateTransactionReply(transactionActor.path().toString(),createTransaction.getTransactionId()).toSerializable(),
                 getSelf());
     }
 
-    public static Props props(final DOMStoreTransactionChain chain) {
+    public static Props props(final DOMStoreTransactionChain chain, final SchemaContext schemaContext) {
         return Props.create(new Creator<ShardTransactionChain>() {
 
             @Override
             public ShardTransactionChain create() throws Exception {
-                return new ShardTransactionChain(chain);
+                return new ShardTransactionChain(chain, schemaContext);
             }
         });
     }
index 060c9d6b509ab26f481a59c492da753ab70a2400..a8deb0153a400eefbf28fd4269892c86ea61ef35 100644 (file)
@@ -58,14 +58,16 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor {
 
     @Override
     public void handleReceive(Object message) throws Exception {
-        if (message instanceof CanCommitTransaction) {
-            canCommit((CanCommitTransaction) message);
-        } else if (message instanceof PreCommitTransaction) {
-            preCommit((PreCommitTransaction) message);
-        } else if (message instanceof CommitTransaction) {
-            commit((CommitTransaction) message);
-        } else if (message instanceof AbortTransaction) {
-            abort((AbortTransaction) message);
+        if (message.getClass().equals(CanCommitTransaction.SERIALIZABLE_CLASS)) {
+            canCommit(new CanCommitTransaction());
+        } else if (message.getClass().equals(PreCommitTransaction.SERIALIZABLE_CLASS)) {
+            preCommit(new PreCommitTransaction());
+        } else if (message.getClass().equals(CommitTransaction.SERIALIZABLE_CLASS)) {
+            commit(new CommitTransaction());
+        } else if (message.getClass().equals(AbortTransaction.SERIALIZABLE_CLASS)) {
+            abort(new AbortTransaction());
+        } else {
+          throw new Exception ("Not recognized message received,message="+message);
         }
     }
 
@@ -79,7 +81,7 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor {
             public void run() {
                 try {
                     future.get();
-                    sender.tell(new AbortTransactionReply(), self);
+                    sender.tell(new AbortTransactionReply().toSerializable(), self);
                 } catch (InterruptedException | ExecutionException e) {
                     log.error(e, "An exception happened when aborting");
                 }
@@ -107,7 +109,7 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor {
             public void run() {
                 try {
                     future.get();
-                    sender.tell(new PreCommitTransactionReply(), self);
+                    sender.tell(new PreCommitTransactionReply().toSerializable(), self);
                 } catch (InterruptedException | ExecutionException e) {
                     log.error(e, "An exception happened when preCommitting");
                 }
@@ -126,7 +128,7 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor {
             public void run() {
                 try {
                     Boolean canCommit = future.get();
-                    sender.tell(new CanCommitTransactionReply(canCommit), self);
+                    sender.tell(new CanCommitTransactionReply(canCommit).toSerializable(), self);
                 } catch (InterruptedException | ExecutionException e) {
                     log.error(e, "An exception happened when aborting");
                 }
index 279ecba40977e1293a9fbad090cd1a0dfddff2a4..b56dc9432f0b28067ca2daaba1cd95f936cb816e 100644 (file)
@@ -67,12 +67,12 @@ public class ThreePhaseCommitCohortProxy implements
                 try {
                     Object response =
                         actorContext.executeRemoteOperation(cohort,
-                            new CanCommitTransaction(),
+                            new CanCommitTransaction().toSerializable(),
                             ActorContext.ASK_DURATION);
 
-                    if (response instanceof CanCommitTransactionReply) {
+                    if (response.getClass().equals(CanCommitTransactionReply.SERIALIZABLE_CLASS)) {
                         CanCommitTransactionReply reply =
-                            (CanCommitTransactionReply) response;
+                            CanCommitTransactionReply.fromSerializable(response);
                         if (!reply.getCanCommit()) {
                             return false;
                         }
@@ -97,15 +97,15 @@ public class ThreePhaseCommitCohortProxy implements
     }
 
     @Override public ListenableFuture<Void> preCommit() {
-        return voidOperation(new PreCommitTransaction(), PreCommitTransactionReply.class);
+        return voidOperation(new PreCommitTransaction().toSerializable(), PreCommitTransactionReply.SERIALIZABLE_CLASS);
     }
 
     @Override public ListenableFuture<Void> abort() {
-        return voidOperation(new AbortTransaction(), AbortTransactionReply.class);
+        return voidOperation(new AbortTransaction().toSerializable(), AbortTransactionReply.SERIALIZABLE_CLASS);
     }
 
     @Override public ListenableFuture<Void> commit() {
-        return voidOperation(new CommitTransaction(), CommitTransactionReply.class);
+        return voidOperation(new CommitTransaction().toSerializable(), CommitTransactionReply.SERIALIZABLE_CLASS);
     }
 
     private ListenableFuture<Void> voidOperation(final Object message, final Class expectedResponseClass){
index 71b61ffaa0bbfd81121b87ee616e3cce2e71ac07..2e8538d07768479e336bfbcc877778e3c4872277 100644 (file)
@@ -13,6 +13,7 @@ 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.DOMStoreTransactionChain;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 import java.util.concurrent.ExecutorService;
 
@@ -22,28 +23,30 @@ import java.util.concurrent.ExecutorService;
 public class TransactionChainProxy implements DOMStoreTransactionChain{
     private final ActorContext actorContext;
     private final ExecutorService transactionExecutor;
+    private final SchemaContext schemaContext;
 
-    public TransactionChainProxy(ActorContext actorContext, ExecutorService transactionExecutor) {
+    public TransactionChainProxy(ActorContext actorContext, ExecutorService transactionExecutor, SchemaContext schemaContext) {
         this.actorContext = actorContext;
         this.transactionExecutor = transactionExecutor;
+        this.schemaContext = schemaContext;
     }
 
     @Override
     public DOMStoreReadTransaction newReadOnlyTransaction() {
         return new TransactionProxy(actorContext,
-            TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+            TransactionProxy.TransactionType.READ_ONLY, transactionExecutor, schemaContext);
     }
 
     @Override
     public DOMStoreReadWriteTransaction newReadWriteTransaction() {
         return new TransactionProxy(actorContext,
-            TransactionProxy.TransactionType.WRITE_ONLY, transactionExecutor);
+            TransactionProxy.TransactionType.WRITE_ONLY, transactionExecutor, schemaContext);
     }
 
     @Override
     public DOMStoreWriteTransaction newWriteOnlyTransaction() {
         return new TransactionProxy(actorContext,
-            TransactionProxy.TransactionType.READ_WRITE, transactionExecutor);
+            TransactionProxy.TransactionType.READ_WRITE, transactionExecutor, schemaContext);
     }
 
     @Override
index 74245c42592ca3d6743d0aef3b48bb2e6ace2b45..c85d32012fed9ee036a96b2e3663c061eabd0385 100644 (file)
@@ -9,10 +9,14 @@
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorPath;
+import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
+import akka.actor.Props;
 import com.google.common.base.Optional;
+import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListenableFutureTask;
+import org.opendaylight.controller.cluster.datastore.exceptions.TimeoutException;
 import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
@@ -23,11 +27,15 @@ import org.opendaylight.controller.cluster.datastore.messages.ReadDataReply;
 import org.opendaylight.controller.cluster.datastore.messages.ReadyTransaction;
 import org.opendaylight.controller.cluster.datastore.messages.ReadyTransactionReply;
 import org.opendaylight.controller.cluster.datastore.messages.WriteData;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory;
 import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+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;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -58,92 +66,77 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction {
 
     private static final AtomicLong counter = new AtomicLong();
 
+    private static final Logger
+        LOG = LoggerFactory.getLogger(TransactionProxy.class);
+
+
     private final TransactionType transactionType;
     private final ActorContext actorContext;
-    private final Map<String, ActorSelection> remoteTransactionPaths = new HashMap<>();
+    private final Map<String, TransactionContext> remoteTransactionPaths = new HashMap<>();
     private final String identifier;
     private final ExecutorService executor;
+    private final SchemaContext schemaContext;
 
     public TransactionProxy(
         ActorContext actorContext,
         TransactionType transactionType,
-        ExecutorService executor
-        ) {
+        ExecutorService executor,
+        SchemaContext schemaContext
+    ) {
 
-        this.identifier = "txn-" + counter.getAndIncrement();
+        this.identifier = actorContext.getCurrentMemberName() + "-txn-" + counter.getAndIncrement();
         this.transactionType = transactionType;
         this.actorContext = actorContext;
         this.executor = executor;
+        this.schemaContext = schemaContext;
+
 
-        Object response = actorContext.executeShardOperation(Shard.DEFAULT_NAME, new CreateTransaction(identifier), ActorContext.ASK_DURATION);
-        if(response instanceof CreateTransactionReply){
-            CreateTransactionReply reply = (CreateTransactionReply) response;
-            remoteTransactionPaths.put(Shard.DEFAULT_NAME, actorContext.actorSelection(reply.getTransactionPath()));
-        }
     }
 
     @Override
-    public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final InstanceIdentifier path) {
-        final ActorSelection remoteTransaction = remoteTransactionFromIdentifier(path);
-
-        Callable<Optional<NormalizedNode<?,?>>> call = new Callable() {
-
-            @Override public Optional<NormalizedNode<?,?>> call() throws Exception {
-                Object response = actorContext
-                    .executeRemoteOperation(remoteTransaction, new ReadData(path),
-                        ActorContext.ASK_DURATION);
-                if(response instanceof ReadDataReply){
-                    ReadDataReply reply = (ReadDataReply) response;
-                    if(reply.getNormalizedNode() == null){
-                        return Optional.absent();
-                    }
-                    //FIXME : A cast should not be required here ???
-                    return (Optional<NormalizedNode<?, ?>>) Optional.of(reply.getNormalizedNode());
-                }
+    public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final YangInstanceIdentifier path) {
 
-                return Optional.absent();
-            }
-        };
+        createTransactionIfMissing(actorContext, path);
 
-        ListenableFutureTask<Optional<NormalizedNode<?, ?>>>
-            future = ListenableFutureTask.create(call);
-
-        executor.submit(future);
-
-        return future;
+        return transactionContext(path).readData(path);
     }
 
     @Override
-    public void write(InstanceIdentifier path, NormalizedNode<?, ?> data) {
-        final ActorSelection remoteTransaction = remoteTransactionFromIdentifier(path);
-        remoteTransaction.tell(new WriteData(path, data), null);
+    public void write(YangInstanceIdentifier path, NormalizedNode<?, ?> data) {
+
+        createTransactionIfMissing(actorContext, path);
+
+        transactionContext(path).writeData(path, data);
     }
 
     @Override
-    public void merge(InstanceIdentifier path, NormalizedNode<?, ?> data) {
-        final ActorSelection remoteTransaction = remoteTransactionFromIdentifier(path);
-        remoteTransaction.tell(new MergeData(path, data), null);
+    public void merge(YangInstanceIdentifier path, NormalizedNode<?, ?> data) {
+
+        createTransactionIfMissing(actorContext, path);
+
+        transactionContext(path).mergeData(path, data);
     }
 
     @Override
-    public void delete(InstanceIdentifier path) {
-        final ActorSelection remoteTransaction = remoteTransactionFromIdentifier(path);
-        remoteTransaction.tell(new DeleteData(path), null);
+    public void delete(YangInstanceIdentifier path) {
+
+        createTransactionIfMissing(actorContext, path);
+
+        transactionContext(path).deleteData(path);
     }
 
     @Override
     public DOMStoreThreePhaseCommitCohort ready() {
         List<ActorPath> cohortPaths = new ArrayList<>();
 
-        for(ActorSelection remoteTransaction : remoteTransactionPaths.values()) {
-            Object result = actorContext.executeRemoteOperation(remoteTransaction,
-                new ReadyTransaction(),
-                ActorContext.ASK_DURATION
-            );
+        for(TransactionContext transactionContext : remoteTransactionPaths.values()) {
+            Object result = transactionContext.readyTransaction();
 
-            if(result instanceof ReadyTransactionReply){
-                ReadyTransactionReply reply = (ReadyTransactionReply) result;
-                cohortPaths.add(reply.getCohortPath());
+            if(result.getClass().equals(ReadyTransactionReply.SERIALIZABLE_CLASS)){
+                ReadyTransactionReply reply = ReadyTransactionReply.fromSerializable(actorContext.getActorSystem(),result);
+                String resolvedCohortPath = transactionContext
+                    .getResolvedCohortPath(reply.getCohortPath().toString());
+                cohortPaths.add(actorContext.actorFor(resolvedCohortPath));
             }
         }
 
@@ -157,17 +150,211 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction {
 
     @Override
     public void close() {
-        for(ActorSelection remoteTransaction : remoteTransactionPaths.values()) {
-            remoteTransaction.tell(new CloseTransaction(), null);
+        for(TransactionContext transactionContext : remoteTransactionPaths.values()) {
+            transactionContext.closeTransaction();
         }
     }
 
-    private ActorSelection remoteTransactionFromIdentifier(InstanceIdentifier path){
+    private TransactionContext transactionContext(YangInstanceIdentifier path){
         String shardName = shardNameFromIdentifier(path);
         return remoteTransactionPaths.get(shardName);
     }
 
-    private String shardNameFromIdentifier(InstanceIdentifier path){
-        return Shard.DEFAULT_NAME;
+    private String shardNameFromIdentifier(YangInstanceIdentifier path){
+        return ShardStrategyFactory.getStrategy(path).findShard(path);
+    }
+
+    private void createTransactionIfMissing(ActorContext actorContext, YangInstanceIdentifier path) {
+        String shardName = ShardStrategyFactory.getStrategy(path).findShard(path);
+
+        TransactionContext transactionContext =
+            remoteTransactionPaths.get(shardName);
+
+        if(transactionContext != null){
+            // A transaction already exists with that shard
+            return;
+        }
+
+        try {
+            Object response = actorContext.executeShardOperation(shardName,
+                new CreateTransaction(identifier).toSerializable(),
+                ActorContext.ASK_DURATION);
+            if (response.getClass()
+                .equals(CreateTransactionReply.SERIALIZABLE_CLASS)) {
+                CreateTransactionReply reply =
+                    CreateTransactionReply.fromSerializable(response);
+
+                String transactionPath = reply.getTransactionPath();
+
+                LOG.info("Received transaction path = {}"  , transactionPath );
+
+                ActorSelection transactionActor =
+                    actorContext.actorSelection(transactionPath);
+                transactionContext =
+                    new TransactionContextImpl(shardName, transactionPath,
+                        transactionActor);
+
+                remoteTransactionPaths.put(shardName, transactionContext);
+            }
+        } catch(TimeoutException e){
+            remoteTransactionPaths.put(shardName, new NoOpTransactionContext(shardName));
+        }
+    }
+
+    private interface TransactionContext {
+        String getShardName();
+
+        String getResolvedCohortPath(String cohortPath);
+
+        public void closeTransaction();
+
+        public Object readyTransaction();
+
+        void deleteData(YangInstanceIdentifier path);
+
+        void mergeData(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
+
+        ListenableFuture<Optional<NormalizedNode<?, ?>>> readData(final YangInstanceIdentifier path);
+
+        void writeData(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
+    }
+
+
+    private class TransactionContextImpl implements TransactionContext{
+        private final String shardName;
+        private final String actorPath;
+        private final ActorSelection  actor;
+
+
+        private TransactionContextImpl(String shardName, String actorPath,
+            ActorSelection actor) {
+            this.shardName = shardName;
+            this.actorPath = actorPath;
+            this.actor = actor;
+        }
+
+        @Override public String getShardName() {
+            return shardName;
+        }
+
+        private ActorSelection getActor() {
+            return actor;
+        }
+
+        @Override public String getResolvedCohortPath(String cohortPath){
+            return actorContext.resolvePath(actorPath, cohortPath);
+        }
+
+        @Override public void closeTransaction() {
+            getActor().tell(
+                new CloseTransaction().toSerializable(), null);
+        }
+
+        @Override public Object readyTransaction() {
+            return actorContext.executeRemoteOperation(getActor(),
+                new ReadyTransaction().toSerializable(),
+                ActorContext.ASK_DURATION
+            );
+
+        }
+
+        @Override public void deleteData(YangInstanceIdentifier path) {
+            getActor().tell(new DeleteData(path).toSerializable(), null);
+        }
+
+        @Override public void mergeData(YangInstanceIdentifier path, NormalizedNode<?, ?> data){
+            getActor().tell(new MergeData(path, data, schemaContext).toSerializable(), null);
+        }
+
+        @Override public ListenableFuture<Optional<NormalizedNode<?, ?>>> readData(final YangInstanceIdentifier path) {
+
+            Callable<Optional<NormalizedNode<?,?>>> call = new Callable() {
+
+                @Override public Optional<NormalizedNode<?,?>> call() throws Exception {
+                    Object response = actorContext
+                        .executeRemoteOperation(getActor(), new ReadData(path).toSerializable(),
+                            ActorContext.ASK_DURATION);
+                    if(response.getClass().equals(ReadDataReply.SERIALIZABLE_CLASS)){
+                        ReadDataReply reply = ReadDataReply.fromSerializable(schemaContext,path, response);
+                        if(reply.getNormalizedNode() == null){
+                            return Optional.absent();
+                        }
+                        //FIXME : A cast should not be required here ???
+                        return (Optional<NormalizedNode<?, ?>>) Optional.of(reply.getNormalizedNode());
+                    }
+
+                    return Optional.absent();
+                }
+            };
+
+            ListenableFutureTask<Optional<NormalizedNode<?, ?>>>
+                future = ListenableFutureTask.create(call);
+
+            executor.submit(future);
+
+            return future;
+        }
+
+        @Override public void writeData(YangInstanceIdentifier path, NormalizedNode<?, ?> data) {
+            getActor().tell(new WriteData(path, data, schemaContext).toSerializable(), null);
+        }
+
+    }
+
+    private class NoOpTransactionContext implements TransactionContext {
+
+        private final Logger
+            LOG = LoggerFactory.getLogger(NoOpTransactionContext.class);
+
+        private final String shardName;
+
+        private ActorRef cohort;
+
+        public NoOpTransactionContext(String shardName){
+            this.shardName = shardName;
+        }
+        @Override public String getShardName() {
+            return  shardName;
+
+        }
+
+        @Override public String getResolvedCohortPath(String cohortPath) {
+            return cohort.path().toString();
+        }
+
+        @Override public void closeTransaction() {
+            LOG.error("closeTransaction called");
+        }
+
+        @Override public Object readyTransaction() {
+            LOG.error("readyTransaction called");
+            cohort = actorContext.getActorSystem().actorOf(Props.create(NoOpCohort.class));
+            return new ReadyTransactionReply(cohort.path()).toSerializable();
+        }
+
+        @Override public void deleteData(YangInstanceIdentifier path) {
+            LOG.error("deleteData called path = {}", path);
+        }
+
+        @Override public void mergeData(YangInstanceIdentifier path,
+            NormalizedNode<?, ?> data) {
+            LOG.error("mergeData called path = {}", path);
+        }
+
+        @Override
+        public ListenableFuture<Optional<NormalizedNode<?, ?>>> readData(
+            YangInstanceIdentifier path) {
+            LOG.error("readData called path = {}", path);
+            return Futures.immediateFuture(
+                Optional.<NormalizedNode<?, ?>>absent());
+        }
+
+        @Override public void writeData(YangInstanceIdentifier path,
+            NormalizedNode<?, ?> data) {
+            LOG.error("writeData called path = {}", path);
+        }
     }
+
+
+
 }
index 4780aaccfb960b0254dde011a543666a373282dc..472cd387345a5ffd61747af83629dcb86a8100f3 100644 (file)
@@ -9,7 +9,7 @@
 package org.opendaylight.controller.cluster.datastore.exceptions;
 
 public class TimeoutException extends RuntimeException {
-    public TimeoutException(Exception e){
-        super(e);
+    public TimeoutException(String message, Exception e){
+        super(message, e);
     }
 }
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/AbstractBaseMBean.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/AbstractBaseMBean.java
new file mode 100644 (file)
index 0000000..de1ac18
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * 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.jmx.mbeans;
+
+
+import com.google.common.base.Preconditions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanRegistrationException;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import java.lang.management.ManagementFactory;
+
+/**
+ * All MBeans should extend this class that help in registering and
+ * unregistering the MBeans.
+ *
+ */
+
+
+public abstract class AbstractBaseMBean {
+
+
+  public static String BASE_JMX_PREFIX = "org.opendaylight.controller:";
+  public static String JMX_TYPE_DISTRIBUTED_DATASTORE = "DistributedDatastore";
+  public static String JMX_CATEGORY_SHARD = "Shard";
+
+  private static final Logger LOG = LoggerFactory
+      .getLogger(AbstractBaseMBean.class);
+
+  MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+  /**
+   * gets the MBean ObjectName
+   *
+   * @return Object name of the MBean
+   * @throws MalformedObjectNameException - The bean name does not have the right format.
+   * @throws NullPointerException - The bean name is null
+   */
+  protected ObjectName getMBeanObjectName()
+      throws MalformedObjectNameException, NullPointerException {
+    String name = BASE_JMX_PREFIX + "type="+getMBeanType()+",Category="+
+                                   getMBeanCategory() + ",name="+
+                                   getMBeanName();
+
+
+    return new ObjectName(name);
+  }
+
+  public boolean registerMBean() {
+    boolean registered = false;
+    try {
+      // Object to identify MBean
+      final ObjectName mbeanName = this.getMBeanObjectName();
+
+      Preconditions.checkArgument(mbeanName != null,
+          "Object name of the MBean cannot be null");
+
+      LOG.debug("Register MBean {}", mbeanName);
+
+      // unregistered if already registered
+      if (server.isRegistered(mbeanName)) {
+
+        LOG.debug("MBean {} found to be already registered", mbeanName);
+
+        try {
+          unregisterMBean(mbeanName);
+        } catch (Exception e) {
+
+          LOG.warn("unregister mbean {} resulted in exception {} ", mbeanName,
+              e);
+        }
+      }
+      server.registerMBean(this, mbeanName);
+
+      LOG.debug("MBean {} registered successfully",
+          mbeanName.getCanonicalName());
+      registered = true;
+    } catch (Exception e) {
+
+      LOG.error("registration failed {}", e);
+
+    }
+    return registered;
+  }
+
+
+  public boolean unregisterMBean() {
+    boolean unregister = false;
+    try {
+      ObjectName mbeanName = this.getMBeanObjectName();
+      unregister = true;
+      unregisterMBean(mbeanName);
+    } catch (Exception e) {
+
+      LOG.error("Failed when unregistering MBean {}", e);
+    }
+    return unregister;
+  }
+
+  private void unregisterMBean(ObjectName mbeanName)
+      throws MBeanRegistrationException, InstanceNotFoundException {
+
+    server.unregisterMBean(mbeanName);
+
+  }
+
+
+  /**
+   * @return name of bean
+   */
+  protected abstract String getMBeanName();
+
+  /**
+   * @return type of the MBean
+   */
+  protected abstract String getMBeanType();
+
+
+  /**
+   * @return Category name of teh bean
+   */
+  protected abstract String getMBeanCategory();
+
+  //require for test cases
+  public MBeanServer getMBeanServer() {
+    return server;
+  }
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardMBeanFactory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardMBeanFactory.java
new file mode 100644 (file)
index 0000000..a335908
--- /dev/null
@@ -0,0 +1,26 @@
+package org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author: syedbahm
+ * Date: 7/16/14
+ */
+public class ShardMBeanFactory {
+  private static Map<String,ShardStats> shardMBeans= new HashMap<String,ShardStats>();
+
+  public static ShardStats getShardStatsMBean(String shardName){
+       if(shardMBeans.containsKey(shardName)){
+            return shardMBeans.get(shardName);
+       }else {
+         ShardStats shardStatsMBeanImpl = new ShardStats(shardName);
+
+         if(shardStatsMBeanImpl.registerMBean()) {
+           shardMBeans.put(shardName, shardStatsMBeanImpl);
+         }
+         return shardStatsMBeanImpl;
+       }
+  }
+
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStats.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStats.java
new file mode 100644 (file)
index 0000000..2da6aae
--- /dev/null
@@ -0,0 +1,70 @@
+package org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard;
+
+import org.opendaylight.controller.cluster.datastore.jmx.mbeans.AbstractBaseMBean;
+
+/**
+ * @author: syedbahm
+ */
+public class ShardStats extends AbstractBaseMBean implements ShardStatsMBean {
+  private  Long committedTransactionsCount;
+  private Long journalMessagesCount;
+  final private String shardName;
+
+  ShardStats(String shardName){
+    this.shardName = shardName;
+    committedTransactionsCount =0L;
+    journalMessagesCount = 0L;
+  };
+
+
+  @Override
+  public String getShardName() {
+    return shardName;
+  }
+
+  @Override
+  public Long getCommittedTransactionsCount() {
+    return committedTransactionsCount;
+  }
+
+  @Override
+  public Long getJournalMessagesCount() {
+    //FIXME: this will be populated once after integration with Raft stuff
+    return journalMessagesCount;
+  }
+
+
+  public Long incrementCommittedTransactionCount() {
+    return committedTransactionsCount++;
+  }
+
+
+  public void updateCommittedTransactionsCount(long currentCount){
+     committedTransactionsCount = currentCount;
+
+  }
+
+  public void updateJournalMessagesCount(long currentCount){
+    journalMessagesCount  = currentCount;
+
+  }
+
+
+
+  @Override
+  protected String getMBeanName() {
+    return  shardName;
+  }
+
+  @Override
+  protected String getMBeanType() {
+    return JMX_TYPE_DISTRIBUTED_DATASTORE;
+  }
+
+  @Override
+  protected String getMBeanCategory() {
+    return JMX_CATEGORY_SHARD;
+  }
+
+
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStatsMBean.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStatsMBean.java
new file mode 100644 (file)
index 0000000..c107e49
--- /dev/null
@@ -0,0 +1,11 @@
+package org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard;
+
+/**
+ * @author: syedbahm
+ */
+public interface ShardStatsMBean {
+   String getShardName();
+   Long getCommittedTransactionsCount();
+   Long getJournalMessagesCount();
+
+}
index 4cf713a0b3efa0a16aa68a9230af81bf568aa0ad..4515bd70427a6eca892bb61115817941684d0a1c 100644 (file)
@@ -8,5 +8,13 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class AbortTransaction {
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+public class AbortTransaction implements SerializableMessage {
+  public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.AbortTransaction.class;
+
+  @Override
+  public Object toSerializable() {
+    return ThreePhaseCommitCohortMessages.AbortTransaction.newBuilder().build();
+  }
 }
index 84234e58075203a4adb39c46a961718509464dfb..31a06fe4c51f66329dd2b85dc49bad38afeb7b25 100644 (file)
@@ -8,5 +8,14 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class AbortTransactionReply {
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+public class AbortTransactionReply implements SerializableMessage {
+  public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.AbortTransactionReply.class;
+
+
+  @Override
+  public Object toSerializable() {
+    return ThreePhaseCommitCohortMessages.AbortTransactionReply.newBuilder().build();
+  }
 }
index 526d60fc75b2571616b9c911d218faaba612b8f2..2c032aff65ea569567b09595f76b9b52a1108124 100644 (file)
@@ -8,5 +8,13 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class CanCommitTransaction {
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+public class CanCommitTransaction implements SerializableMessage {
+  public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CanCommitTransaction.class;
+
+  @Override
+  public Object toSerializable() {
+    return  ThreePhaseCommitCohortMessages.CanCommitTransaction.newBuilder().build();
+  }
 }
index d143c14b3bd491147d5dabc42301878601f4a99f..bbcd4de03facf583db5e9def54d9512bde2ebb1b 100644 (file)
@@ -8,7 +8,10 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class CanCommitTransactionReply {
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+public class CanCommitTransactionReply implements SerializableMessage {
+  public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CanCommitTransactionReply.class;
   private final Boolean canCommit;
 
   public CanCommitTransactionReply(Boolean canCommit) {
@@ -18,4 +21,14 @@ public class CanCommitTransactionReply {
   public Boolean getCanCommit() {
     return canCommit;
   }
+
+  @Override
+  public Object toSerializable() {
+    return  ThreePhaseCommitCohortMessages.CanCommitTransactionReply.newBuilder().setCanCommit(canCommit).build();
+  }
+
+
+  public static CanCommitTransactionReply fromSerializable(Object message) {
+    return  new CanCommitTransactionReply(((ThreePhaseCommitCohortMessages.CanCommitTransactionReply)message).getCanCommit());
+  }
 }
index c3cb00c25fcf64285ebd0722df0f934b07d07ae4..57237bcbe219d0a93ba0de4d25001683ed425bed 100644 (file)
@@ -8,5 +8,12 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class CloseDataChangeListenerRegistration {
+import org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages;
+
+public class CloseDataChangeListenerRegistration implements SerializableMessage {
+  public static Class SERIALIZABLE_CLASS = ListenerRegistrationMessages.CloseDataChangeListenerRegistration.class;
+  @Override
+  public Object toSerializable() {
+    return ListenerRegistrationMessages.CloseDataChangeListenerRegistration.newBuilder().build();
+  }
 }
index d5c75eb68a1dbe31f965ae483b71bb6ec5031e5d..faf73c87ebe4ef6bdb8926ccfc3742ecc86d9ebe 100644 (file)
@@ -8,5 +8,14 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class CloseDataChangeListenerRegistrationReply {
+import org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages;
+
+public class CloseDataChangeListenerRegistrationReply implements SerializableMessage{
+  public static Class SERIALIZABLE_CLASS = ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.class;
+
+  @Override
+  public Object toSerializable() {
+    return ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.newBuilder().build();
+  }
+
 }
index 6809f4b1357c1e7140ad7366b40dfb1511934180..451e39cf6a75d2ac0777c60d25de969c0d0fd2ef 100644 (file)
@@ -8,5 +8,12 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class CloseTransaction {
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+
+public class CloseTransaction implements SerializableMessage{
+  public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.CloseTransaction.class;
+  @Override
+  public Object toSerializable() {
+    return ShardTransactionMessages.CloseTransaction.newBuilder().build();
+  }
 }
index 04c422b68e0909decec335b298d478a89417b308..efa51fde2090c3762f8d32e5d75b2a4a50c77757 100644 (file)
@@ -8,5 +8,12 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class CloseTransactionChain {
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages;
+
+public class CloseTransactionChain implements SerializableMessage{
+  public static final Class SERIALIZABLE_CLASS = ShardTransactionChainMessages.CloseTransactionChain.class;
+  @Override
+  public Object toSerializable() {
+    return ShardTransactionChainMessages.CloseTransactionChain.newBuilder().build();
+  }
 }
index 89fa93bf9ac16ce201391f0adf82815034ed4dee..23699b7be6c64cb103241329ad9fa72a585cf10b 100644 (file)
@@ -8,5 +8,13 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class CloseTransactionChainReply {
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages;
+
+public class CloseTransactionChainReply implements SerializableMessage {
+  public static final Class SERIALIZABLE_CLASS = ShardTransactionChainMessages.CloseTransactionChainReply.class;
+  @Override
+  public Object toSerializable() {
+    return ShardTransactionChainMessages.CloseTransactionChainReply.newBuilder().build();
+  }
+
 }
index 4910a3ea0e57316075fd1dd65cae3b831eb732f9..666d182aaff24c9e3d7a8da86a5de061dc4e0999 100644 (file)
@@ -8,5 +8,12 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class CloseTransactionReply {
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+
+public class CloseTransactionReply implements SerializableMessage {
+  public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.CloseTransactionReply.class;
+  @Override
+  public Object toSerializable() {
+    return ShardTransactionMessages.CloseTransactionReply.newBuilder().build();
+  }
 }
index d7b210fd0307f019b537e6420a5a3001bb8cd234..14187139aafefd1758dd0dff444882b1ae4c54c9 100644 (file)
@@ -8,5 +8,13 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class CommitTransaction {
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+public class CommitTransaction implements SerializableMessage {
+  public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CommitTransaction.class;
+
+  @Override
+  public Object toSerializable() {
+    return  ThreePhaseCommitCohortMessages.CommitTransaction.newBuilder().build();
+  }
 }
index a0e5e895d2d6d4af282949fb77be0daee93c4ce8..afeba298797ea2aead2879ec98d4100bde0996cd 100644 (file)
@@ -8,5 +8,14 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class CommitTransactionReply {
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+public class CommitTransactionReply implements SerializableMessage {
+
+  public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CommitTransactionReply.class;
+
+  @Override
+  public Object toSerializable() {
+    return  ThreePhaseCommitCohortMessages.CommitTransactionReply.newBuilder().build();
+  }
 }
index 611064169655185fe0423bfc879b751d625a538b..795131fdbf6400f0b53c98f91d167bf31f45d493 100644 (file)
@@ -8,15 +8,30 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class CreateTransaction {
-    private final String transactionId;
 
-    public CreateTransaction(String transactionId){
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
 
-        this.transactionId = transactionId;
-    }
 
-    public String getTransactionId() {
-        return transactionId;
-    }
+public class CreateTransaction implements SerializableMessage {
+  public static Class SERIALIZABLE_CLASS = ShardTransactionMessages.CreateTransaction.class;
+  private final String transactionId;
+
+  public CreateTransaction(String transactionId){
+
+    this.transactionId = transactionId;
+  }
+
+  public String getTransactionId() {
+    return transactionId;
+  }
+
+  @Override
+  public Object toSerializable() {
+    return  ShardTransactionMessages.CreateTransaction.newBuilder().setTransactionId(transactionId).build();
+  }
+
+  public static CreateTransaction fromSerializable(Object message){
+    return new CreateTransaction(((ShardTransactionMessages.CreateTransaction)message).getTransactionId());
+  }
+
 }
index cdad3324ab0db6ca08aff0455931fd45fbd5bf2a..6339749f7bb298f27238493dfa999035f48d70ad 100644 (file)
@@ -8,6 +8,13 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class CreateTransactionChain {
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages;
 
+public class CreateTransactionChain implements SerializableMessage{
+  public static Class SERIALIZABLE_CLASS = ShardTransactionChainMessages.CreateTransactionChain.class;
+
+  @Override
+  public Object toSerializable() {
+    return  ShardTransactionChainMessages.CreateTransactionChain.newBuilder().build();
+  }
 }
index 49dd9b63d2d6d96f991f63c4e82a380870adfdce..4a497622fc1934978b172b60556a00409beb382e 100644 (file)
@@ -9,8 +9,11 @@
 package org.opendaylight.controller.cluster.datastore.messages;
 
 import akka.actor.ActorPath;
+import akka.actor.ActorSystem;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages;
 
-public class CreateTransactionChainReply {
+public class CreateTransactionChainReply implements SerializableMessage {
+  public static final Class SERIALIZABLE_CLASS = ShardTransactionChainMessages.CreateTransactionChainReply.class;
   private final ActorPath transactionChainPath;
 
   public CreateTransactionChainReply(ActorPath transactionChainPath) {
@@ -20,4 +23,17 @@ public class CreateTransactionChainReply {
   public ActorPath getTransactionChainPath() {
     return transactionChainPath;
   }
+
+  @Override
+  public ShardTransactionChainMessages.CreateTransactionChainReply toSerializable() {
+    return ShardTransactionChainMessages.CreateTransactionChainReply.newBuilder()
+        .setTransactionChainPath(transactionChainPath.toString()).build();
+  }
+
+  public static CreateTransactionChainReply fromSerializable(ActorSystem actorSystem,Object serializable){
+    ShardTransactionChainMessages.CreateTransactionChainReply o = (ShardTransactionChainMessages.CreateTransactionChainReply) serializable;
+    return new CreateTransactionChainReply(
+        actorSystem.actorFor(o.getTransactionChainPath()).path());
+  }
+
 }
index 46b7194c84c1f13b9503623d43ad1e2aef7a50aa..096d131d5a5517821ae2e228aa4c4332315a37a9 100644 (file)
@@ -8,23 +8,38 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-import akka.actor.ActorPath;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
 
-public class CreateTransactionReply {
-    private final ActorPath transactionPath;
+public class CreateTransactionReply implements SerializableMessage {
+
+    public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.CreateTransactionReply.class;
+    private final String transactionPath;
     private final String transactionId;
 
-    public CreateTransactionReply(ActorPath transactionPath,
+    public CreateTransactionReply(String transactionPath,
         String transactionId) {
         this.transactionPath = transactionPath;
         this.transactionId = transactionId;
     }
 
-    public ActorPath getTransactionPath() {
+    public String getTransactionPath() {
         return transactionPath;
     }
 
     public String getTransactionId() {
         return transactionId;
     }
+
+    public Object toSerializable(){
+        return ShardTransactionMessages.CreateTransactionReply.newBuilder()
+            .setTransactionActorPath(transactionPath)
+            .setTransactionId(transactionId)
+            .build();
+    }
+
+    public static CreateTransactionReply fromSerializable(Object serializable){
+        ShardTransactionMessages.CreateTransactionReply o = (ShardTransactionMessages.CreateTransactionReply) serializable;
+        return new CreateTransactionReply(o.getTransactionActorPath(), o.getTransactionId());
+    }
+
 }
index c55dae56dd5d77564750b6e650096bf7dff365fe..a8827bebf4386b1a63918a30cb1b31faa81335a8 100644 (file)
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
+import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
+import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages;
+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;
 
-public class DataChanged {
-    private final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>>
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class DataChanged implements SerializableMessage {
+    public static final Class SERIALIZABLE_CLASS =
+        DataChangeListenerMessages.DataChanged.class;
+    final private SchemaContext schemaContext;
+    private final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>>
         change;
 
-    public DataChanged(
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
+
+
+    public DataChanged(SchemaContext schemaContext,
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
         this.change = change;
+        this.schemaContext = schemaContext;
     }
 
-    public AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> getChange() {
+
+    public AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> getChange() {
         return change;
     }
+
+
+    private NormalizedNodeMessages.Node convertToNodeTree(
+        NormalizedNode<?, ?> normalizedNode) {
+
+        return new NormalizedNodeToNodeCodec(schemaContext)
+            .encode(YangInstanceIdentifier.builder().build(), normalizedNode)
+            .getNormalizedNode();
+
+    }
+
+    private Iterable<NormalizedNodeMessages.InstanceIdentifier> convertToRemovePaths(
+        Set<YangInstanceIdentifier> removedPaths) {
+        final Set<NormalizedNodeMessages.InstanceIdentifier> removedPathInstanceIds = new HashSet<>();
+        for (YangInstanceIdentifier id : removedPaths) {
+            removedPathInstanceIds.add(InstanceIdentifierUtils.toSerializable(id));
+        }
+        return new Iterable<NormalizedNodeMessages.InstanceIdentifier>() {
+            public Iterator<NormalizedNodeMessages.InstanceIdentifier> iterator() {
+                return removedPathInstanceIds.iterator();
+            }
+        };
+
+    }
+
+    private NormalizedNodeMessages.NodeMap convertToNodeMap(
+        Map<YangInstanceIdentifier, NormalizedNode<?, ?>> data) {
+        NormalizedNodeToNodeCodec normalizedNodeToNodeCodec =
+            new NormalizedNodeToNodeCodec(schemaContext);
+        NormalizedNodeMessages.NodeMap.Builder nodeMapBuilder =
+            NormalizedNodeMessages.NodeMap.newBuilder();
+        NormalizedNodeMessages.NodeMapEntry.Builder builder =
+            NormalizedNodeMessages.NodeMapEntry.newBuilder();
+        for (Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry : data
+            .entrySet()) {
+
+
+            NormalizedNodeMessages.InstanceIdentifier instanceIdentifier =
+                InstanceIdentifierUtils.toSerializable(entry.getKey());
+
+            builder.setInstanceIdentifierPath(instanceIdentifier)
+                .setNormalizedNode(normalizedNodeToNodeCodec
+                    .encode(entry.getKey(), entry.getValue())
+                    .getNormalizedNode());
+            nodeMapBuilder.addMapEntries(builder.build());
+        }
+        return nodeMapBuilder.build();
+    }
+
+
+    @Override
+    public Object toSerializable() {
+        return DataChangeListenerMessages.DataChanged.newBuilder()
+            .addAllRemovedPaths(convertToRemovePaths(change.getRemovedPaths()))
+            .setCreatedData(convertToNodeMap(change.getCreatedData()))
+            .setOriginalData(convertToNodeMap(change.getOriginalData()))
+            .setUpdatedData(convertToNodeMap(change.getUpdatedData()))
+            .setOriginalSubTree(convertToNodeTree(change.getOriginalSubtree()))
+            .setUpdatedSubTree(convertToNodeTree(change.getUpdatedSubtree()))
+            .build();
+    }
+
+    public static DataChanged fromSerialize(SchemaContext sc, Object message,
+        YangInstanceIdentifier pathId) {
+        DataChangeListenerMessages.DataChanged dataChanged =
+            (DataChangeListenerMessages.DataChanged) message;
+        DataChangedEvent event = new DataChangedEvent(sc);
+        if (dataChanged.getCreatedData() != null && dataChanged.getCreatedData()
+            .isInitialized()) {
+            event.setCreatedData(dataChanged.getCreatedData());
+        }
+        if (dataChanged.getOriginalData() != null && dataChanged
+            .getOriginalData().isInitialized()) {
+            event.setOriginalData(dataChanged.getOriginalData());
+        }
+
+        if (dataChanged.getUpdatedData() != null && dataChanged.getUpdatedData()
+            .isInitialized()) {
+            event.setUpdateData(dataChanged.getUpdatedData());
+        }
+
+        if (dataChanged.getOriginalSubTree() != null && dataChanged
+            .getOriginalSubTree().isInitialized()) {
+            event.setOriginalSubtree(dataChanged.getOriginalSubTree(), pathId);
+        }
+
+        if (dataChanged.getUpdatedSubTree() != null && dataChanged
+            .getUpdatedSubTree().isInitialized()) {
+            event.setUpdatedSubtree(dataChanged.getOriginalSubTree(), pathId);
+        }
+
+        if (dataChanged.getRemovedPathsList() != null && !dataChanged
+            .getRemovedPathsList().isEmpty()) {
+            event.setRemovedPaths(dataChanged.getRemovedPathsList());
+        }
+
+        return new DataChanged(sc, event);
+
+    }
+
+    static class DataChangedEvent implements
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> {
+        private final SchemaContext schemaContext;
+        private Map<YangInstanceIdentifier, NormalizedNode<?, ?>> createdData;
+        private final NormalizedNodeToNodeCodec nodeCodec;
+        private Map<YangInstanceIdentifier, NormalizedNode<?, ?>> updatedData;
+        private Map<YangInstanceIdentifier, NormalizedNode<?, ?>> originalData;
+        private NormalizedNode<?, ?> originalSubTree;
+        private NormalizedNode<?, ?> updatedSubTree;
+        private Set<YangInstanceIdentifier> removedPathIds;
+
+        DataChangedEvent(SchemaContext schemaContext) {
+            this.schemaContext = schemaContext;
+            nodeCodec = new NormalizedNodeToNodeCodec(schemaContext);
+        }
+
+        @Override
+        public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getCreatedData() {
+            if(createdData == null){
+                return Collections.emptyMap();
+            }
+            return createdData;
+        }
+
+        DataChangedEvent setCreatedData(
+            NormalizedNodeMessages.NodeMap nodeMap) {
+            this.createdData = convertNodeMapToMap(nodeMap);
+            return this;
+        }
+
+        private Map<YangInstanceIdentifier, NormalizedNode<?, ?>> convertNodeMapToMap(
+            NormalizedNodeMessages.NodeMap nodeMap) {
+            Map<YangInstanceIdentifier, NormalizedNode<?, ?>> mapEntries =
+                new HashMap<YangInstanceIdentifier, NormalizedNode<?, ?>>();
+            for (NormalizedNodeMessages.NodeMapEntry nodeMapEntry : nodeMap
+                .getMapEntriesList()) {
+                YangInstanceIdentifier id = InstanceIdentifierUtils
+                    .fromSerializable(nodeMapEntry.getInstanceIdentifierPath());
+                mapEntries.put(id,
+                    nodeCodec.decode(id, nodeMapEntry.getNormalizedNode()));
+            }
+            return mapEntries;
+        }
+
+
+        @Override
+        public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getUpdatedData() {
+            if(updatedData == null){
+                return Collections.emptyMap();
+            }
+            return updatedData;
+        }
+
+        DataChangedEvent setUpdateData(NormalizedNodeMessages.NodeMap nodeMap) {
+            this.updatedData = convertNodeMapToMap(nodeMap);
+            return this;
+        }
+
+        @Override
+        public Set<YangInstanceIdentifier> getRemovedPaths() {
+            if (removedPathIds == null) {
+                return Collections.emptySet();
+            }
+            return removedPathIds;
+        }
+
+        public DataChangedEvent setRemovedPaths(List<NormalizedNodeMessages.InstanceIdentifier> removedPaths) {
+            Set<YangInstanceIdentifier> removedIds = new HashSet<>();
+            for (NormalizedNodeMessages.InstanceIdentifier path : removedPaths) {
+                removedIds.add(InstanceIdentifierUtils.fromSerializable(path));
+            }
+            this.removedPathIds = removedIds;
+            return this;
+        }
+
+        @Override
+        public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getOriginalData() {
+            if (originalData == null) {
+                Collections.emptyMap();
+            }
+            return originalData;
+        }
+
+        DataChangedEvent setOriginalData(
+            NormalizedNodeMessages.NodeMap nodeMap) {
+            this.originalData = convertNodeMapToMap(nodeMap);
+            return this;
+        }
+
+        @Override
+        public NormalizedNode<?, ?> getOriginalSubtree() {
+            return originalSubTree;
+        }
+
+        DataChangedEvent setOriginalSubtree(NormalizedNodeMessages.Node node,
+            YangInstanceIdentifier instanceIdentifierPath) {
+            originalSubTree = nodeCodec.decode(instanceIdentifierPath, node);
+            return this;
+        }
+
+        @Override
+        public NormalizedNode<?, ?> getUpdatedSubtree() {
+            return updatedSubTree;
+        }
+
+        DataChangedEvent setUpdatedSubtree(NormalizedNodeMessages.Node node,
+            YangInstanceIdentifier instanceIdentifierPath) {
+            updatedSubTree = nodeCodec.decode(instanceIdentifierPath, node);
+            return this;
+        }
+
+
+    }
+
+
+
 }
index 3531021b940b1fbe137ceeecada9b59057db2a48..cffe985d18630beff2ba53b48b35f532cd100db3 100644 (file)
@@ -8,5 +8,12 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class DataChangedReply {
+import org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages;
+
+public class DataChangedReply implements SerializableMessage {
+  public static final Class SERIALIZABLE_CLASS = DataChangeListenerMessages.DataChangedReply.class;
+  @Override
+  public Object toSerializable() {
+    return DataChangeListenerMessages.DataChangedReply.newBuilder().build();
+  }
 }
index 384e75ae7e6a11a7073ef3142586aeb68f59a4c0..17861a5a68b0e7da27f7b7996ddb2c87cdcd22ad 100644 (file)
@@ -8,16 +8,31 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
-public class DeleteData {
-  private final InstanceIdentifier path;
+public class DeleteData implements SerializableMessage {
 
-  public DeleteData(InstanceIdentifier path) {
-    this.path = path;
-  }
+    public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.DeleteData.class;
 
-  public InstanceIdentifier getPath() {
-    return path;
-  }
+    private final YangInstanceIdentifier path;
+
+    public DeleteData(YangInstanceIdentifier path) {
+        this.path = path;
+    }
+
+    public YangInstanceIdentifier getPath() {
+        return path;
+    }
+
+    @Override public Object toSerializable() {
+        return ShardTransactionMessages.DeleteData.newBuilder()
+            .setInstanceIdentifierPathArguments(InstanceIdentifierUtils.toSerializable(path)).build();
+    }
+
+    public static DeleteData fromSerizalizable(Object serializable){
+        ShardTransactionMessages.DeleteData o = (ShardTransactionMessages.DeleteData) serializable;
+        return new DeleteData(InstanceIdentifierUtils.fromSerializable(o.getInstanceIdentifierPathArguments()));
+    }
 }
index a3c73056858d5a8d339151d57fe2dd4047649e4f..8e2a7b72951a27b5d2b1fe039ed619db5ac62ffd 100644 (file)
@@ -8,5 +8,12 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class DeleteDataReply {
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+
+public class DeleteDataReply implements SerializableMessage{
+  public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.DeleteDataReply.class;
+  @Override
+  public Object toSerializable() {
+    return ShardTransactionMessages.DeleteDataReply.newBuilder().build();
+  }
 }
index f2497e6517f376e4d7173efdbd4aeb21596d3990..f584467ee91b37f2b0866cb9a39556eba3c9ace8 100644 (file)
@@ -9,13 +9,14 @@
 package org.opendaylight.controller.cluster.datastore.messages;
 
 import com.google.common.base.Preconditions;
+import org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages;
 
 /**
  * The FindPrimary message is used to locate the primary of any given shard
  *
- * TODO : Make this serializable
  */
-public class FindPrimary{
+public class FindPrimary implements SerializableMessage{
+  public static final Class SERIALIZABLE_CLASS = ShardManagerMessages.FindPrimary.class;
     private final String shardName;
 
     public FindPrimary(String shardName){
@@ -28,4 +29,13 @@ public class FindPrimary{
     public String getShardName() {
         return shardName;
     }
+
+  @Override
+  public Object toSerializable() {
+    return ShardManagerMessages.FindPrimary.newBuilder().setShardName(shardName).build();
+  }
+
+  public static FindPrimary fromSerializable(Object message){
+    return new FindPrimary(((ShardManagerMessages.FindPrimary)message).getShardName());
+  }
 }
index 75d1e95c1e715c28f1e9b6d53758c8cad9722bd4..ba790816c4aefa72d5db0e97b392af205e979f4b 100644 (file)
@@ -8,11 +8,41 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
+import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+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;
 
-public class MergeData extends ModifyData {
-  public MergeData(InstanceIdentifier path, NormalizedNode<?, ?> data) {
-    super(path, data);
-  }
+public class MergeData extends ModifyData{
+
+    public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.MergeData.class;
+
+    public MergeData(YangInstanceIdentifier path, NormalizedNode<?, ?> data,
+        SchemaContext context) {
+        super(path, data, context);
+    }
+
+    @Override public Object toSerializable() {
+
+        NormalizedNodeMessages.Node normalizedNode =
+            new NormalizedNodeToNodeCodec(schemaContext).encode(path, data)
+                .getNormalizedNode();
+        return ShardTransactionMessages.MergeData.newBuilder()
+            .setInstanceIdentifierPathArguments(InstanceIdentifierUtils.toSerializable(path))
+            .setNormalizedNode(normalizedNode).build();
+    }
+
+    public static MergeData fromSerializable(Object serializable, SchemaContext schemaContext){
+        ShardTransactionMessages.MergeData o = (ShardTransactionMessages.MergeData) serializable;
+        YangInstanceIdentifier identifier = InstanceIdentifierUtils.fromSerializable(o.getInstanceIdentifierPathArguments());
+
+        NormalizedNode<?, ?> normalizedNode =
+            new NormalizedNodeToNodeCodec(schemaContext)
+                .decode(identifier, o.getNormalizedNode());
+
+        return new MergeData(identifier, normalizedNode, schemaContext);
+    }
 }
index 8e90972f87ef33f7e34f29008cb346340291a62e..81b1c3bbb1e3dab609b903ed5b40f57e8da07523 100644 (file)
@@ -8,5 +8,13 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class MergeDataReply {
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+
+public class MergeDataReply implements SerializableMessage{
+  public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.MergeDataReply.class;
+
+  @Override
+  public Object toSerializable() {
+    return ShardTransactionMessages.MergeDataReply.newBuilder().build();
+  }
 }
index da8608876e4d7b53a2113e6140b9e8bb26bf22e9..b5c39d1c3fa630a674efb1302d3441f8dd8403ed 100644 (file)
@@ -8,24 +8,33 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import com.google.common.base.Preconditions;
+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;
 
-public abstract class ModifyData {
-  private final InstanceIdentifier path;
-  private final NormalizedNode<?,?> data;
+public abstract class ModifyData implements SerializableMessage {
+    protected final YangInstanceIdentifier path;
+    protected final NormalizedNode<?, ?> data;
+    protected final SchemaContext schemaContext;
 
-  public ModifyData(InstanceIdentifier path, NormalizedNode<?, ?> data) {
-    this.path = path;
-    this.data = data;
-  }
+    public ModifyData(YangInstanceIdentifier path, NormalizedNode<?, ?> data,
+        SchemaContext context) {
+        Preconditions.checkNotNull(context,
+            "Cannot serialize an object which does not have a schema schemaContext");
 
-  public InstanceIdentifier getPath() {
-    return path;
-  }
 
-  public NormalizedNode<?, ?> getData() {
-    return data;
-  }
+        this.path = path;
+        this.data = data;
+        this.schemaContext = context;
+    }
+
+    public YangInstanceIdentifier getPath() {
+        return path;
+    }
+
+    public NormalizedNode<?, ?> getData() {
+        return data;
+    }
 
 }
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PeerAddressResolved.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PeerAddressResolved.java
new file mode 100644 (file)
index 0000000..8c2543e
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * 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.messages;
+
+public class PeerAddressResolved {
+    private final String peerId;
+    private final String peerAddress;
+
+    public PeerAddressResolved(String peerId, String peerAddress) {
+        this.peerId = peerId;
+        this.peerAddress = peerAddress;
+    }
+
+    public String getPeerId() {
+        return peerId;
+    }
+
+    public String getPeerAddress() {
+        return peerAddress;
+    }
+}
index 87a9c77a4fcf3486db1cabc83db52ce0bbb4b53c..1e5a05329b72c38b72637a6ceaeee3002741b64e 100644 (file)
@@ -8,5 +8,14 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class PreCommitTransaction {
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+public class PreCommitTransaction implements SerializableMessage{
+
+  public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.PreCommitTransaction.class;
+
+  @Override
+  public Object toSerializable() {
+    return  ThreePhaseCommitCohortMessages.PreCommitTransaction.newBuilder().build();
+  }
 }
index f499c720d234f817c1d7254cb5e164d4e4b2c5f4..1aedae3ae72fb51b0794e12ee338c0ca478c97f4 100644 (file)
@@ -8,5 +8,14 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class PreCommitTransactionReply {
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+public class PreCommitTransactionReply implements SerializableMessage{
+
+  public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.PreCommitTransactionReply.class;
+
+  @Override
+  public Object toSerializable() {
+    return  ThreePhaseCommitCohortMessages.PreCommitTransactionReply.newBuilder().build();
+  }
 }
index d6aae3786fc3e4f1e08eda17c168345c83073dc9..69502837bcc6c114a1daa98986006ed0bd206aab 100644 (file)
@@ -8,7 +8,10 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class PrimaryFound {
+import org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages;
+
+public class PrimaryFound implements SerializableMessage {
+  public static final Class SERIALIZABLE_CLASS = ShardManagerMessages.PrimaryFound.class;
   private final String primaryPath;
 
   public PrimaryFound(String primaryPath) {
@@ -44,4 +47,12 @@ public class PrimaryFound {
   }
 
 
+  @Override
+  public Object toSerializable() {
+    return  ShardManagerMessages.PrimaryFound.newBuilder().setPrimaryPath(primaryPath).build();
+  }
+
+  public static PrimaryFound fromSerializable(Object message){
+    return new PrimaryFound(((ShardManagerMessages.PrimaryFound)message).getPrimaryPath());
+  }
 }
index c66e12cb395d4850392716644644d91dc830da4b..057028c469416df2767a067ef5e36e4256babd35 100644 (file)
@@ -9,8 +9,10 @@
 package org.opendaylight.controller.cluster.datastore.messages;
 
 import com.google.common.base.Preconditions;
+import org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages;
 
-public class PrimaryNotFound {
+public class PrimaryNotFound implements SerializableMessage {
+  public static final Class SERIALIZABLE_CLASS = ShardManagerMessages.PrimaryNotFound.class;
 
     private final String shardName;
 
@@ -37,4 +39,13 @@ public class PrimaryNotFound {
     public int hashCode() {
         return shardName != null ? shardName.hashCode() : 0;
     }
+
+  @Override
+  public Object toSerializable() {
+    return ShardManagerMessages.PrimaryNotFound.newBuilder().setShardName(shardName).build();
+  }
+
+  public static PrimaryNotFound fromSerializable(Object message){
+    return new PrimaryNotFound(((ShardManagerMessages.PrimaryNotFound)message).getShardName());
+  }
 }
index 2f56a9740b2d4872a116dbccc31ceeb33e6425f1..a698f4634797116875871d20bf5d68d90ffb1ff7 100644 (file)
@@ -8,16 +8,30 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 public class ReadData {
-  private final InstanceIdentifier path;
+  public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.ReadData.class;
+  private final YangInstanceIdentifier path;
 
-  public ReadData(InstanceIdentifier path) {
+  public ReadData(YangInstanceIdentifier path) {
     this.path = path;
   }
 
-  public InstanceIdentifier getPath() {
+  public YangInstanceIdentifier getPath() {
     return path;
   }
+
+  public Object toSerializable(){
+    return ShardTransactionMessages.ReadData.newBuilder()
+        .setInstanceIdentifierPathArguments(InstanceIdentifierUtils.toSerializable(path))
+        .build();
+  }
+
+  public static ReadData fromSerializable(Object serializable){
+    ShardTransactionMessages.ReadData o = (ShardTransactionMessages.ReadData) serializable;
+    return new ReadData(InstanceIdentifierUtils.fromSerializable(o.getInstanceIdentifierPathArguments()));
+  }
 }
index 52e2c29249704fc2831b1db0d97ad1a4f9b2ecdc..c5498ca228b3f846b5fd528b2da4dd2a4afef7a2 100644 (file)
@@ -8,17 +8,42 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
+import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+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;
 
-public class ReadDataReply {
-  private final NormalizedNode<?, ?> normalizedNode;
+public class ReadDataReply implements SerializableMessage{
 
-  public ReadDataReply(NormalizedNode<?, ?> normalizedNode){
+  private final NormalizedNode<?, ?> normalizedNode;
+  private final SchemaContext schemaContext;
+  public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.ReadDataReply.class;
+  public ReadDataReply(SchemaContext context,NormalizedNode<?, ?> normalizedNode){
 
     this.normalizedNode = normalizedNode;
+    this.schemaContext = context;
   }
 
   public NormalizedNode<?, ?> getNormalizedNode() {
     return normalizedNode;
   }
+
+  public Object toSerializable(){
+    if(normalizedNode != null) {
+      return ShardTransactionMessages.ReadDataReply.newBuilder()
+          .setNormalizedNode(new NormalizedNodeToNodeCodec(schemaContext)
+                  .encode(YangInstanceIdentifier.builder().build(), normalizedNode).getNormalizedNode()
+          ).build();
+    }else{
+      return ShardTransactionMessages.ReadDataReply.newBuilder().build();
+
+    }
+
+  }
+
+  public static ReadDataReply fromSerializable(SchemaContext schemaContext,YangInstanceIdentifier id,Object serializable){
+    ShardTransactionMessages.ReadDataReply o = (ShardTransactionMessages.ReadDataReply) serializable;
+    return new ReadDataReply(schemaContext,new NormalizedNodeToNodeCodec(schemaContext).decode(id, o.getNormalizedNode()));
+  }
 }
index 58eef66fc75a156a823e2fad00ad8f1b4ef0b128..3a51d9850b78ae1272fb419bbec7068bfd81bbea 100644 (file)
@@ -8,5 +8,14 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class ReadyTransaction {
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+
+public class ReadyTransaction implements SerializableMessage{
+  public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.ReadyTransaction.class;
+
+  @Override
+  public Object toSerializable() {
+    return ShardTransactionMessages.ReadyTransaction.newBuilder().build();
+  }
+
 }
index 32d31bf84db44e87a4ebbbd6328c97c3898fd9ae..5273dc247925608326f9756e5dcbb061b106e5e2 100644 (file)
@@ -9,8 +9,11 @@
 package org.opendaylight.controller.cluster.datastore.messages;
 
 import akka.actor.ActorPath;
+import akka.actor.ActorSystem;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
 
-public class ReadyTransactionReply {
+public class ReadyTransactionReply implements SerializableMessage {
+  public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.ReadyTransactionReply.class;
   private final ActorPath cohortPath;
 
   public ReadyTransactionReply(ActorPath cohortPath) {
@@ -21,4 +24,16 @@ public class ReadyTransactionReply {
   public ActorPath getCohortPath() {
     return cohortPath;
   }
+
+  @Override
+  public ShardTransactionMessages.ReadyTransactionReply toSerializable() {
+    return ShardTransactionMessages.ReadyTransactionReply.newBuilder()
+        .setActorPath(cohortPath.toString()).build();
+  }
+
+  public static ReadyTransactionReply fromSerializable(ActorSystem actorSystem,Object serializable){
+    ShardTransactionMessages.ReadyTransactionReply o = (ShardTransactionMessages.ReadyTransactionReply) serializable;
+    return new ReadyTransactionReply(
+        actorSystem.actorFor(o.getActorPath()).path());
+  }
 }
index 7c9e4f0665a2710e2ed4b28f4792e6a043a48800..c1ec0a87cba2c64db745879fa08211cea9821b2c 100644 (file)
@@ -9,16 +9,20 @@
 package org.opendaylight.controller.cluster.datastore.messages;
 
 import akka.actor.ActorPath;
+import akka.actor.ActorSystem;
+import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
-public class RegisterChangeListener {
-    private final InstanceIdentifier path;
+public class RegisterChangeListener implements SerializableMessage {
+  public static final Class SERIALIZABLE_CLASS = ListenerRegistrationMessages.RegisterChangeListener.class;
+    private final YangInstanceIdentifier path;
     private final ActorPath dataChangeListenerPath;
     private final AsyncDataBroker.DataChangeScope scope;
 
 
-    public RegisterChangeListener(InstanceIdentifier path,
+    public RegisterChangeListener(YangInstanceIdentifier path,
         ActorPath dataChangeListenerPath,
         AsyncDataBroker.DataChangeScope scope) {
         this.path = path;
@@ -26,7 +30,7 @@ public class RegisterChangeListener {
         this.scope = scope;
     }
 
-    public InstanceIdentifier getPath() {
+    public YangInstanceIdentifier getPath() {
         return path;
     }
 
@@ -38,4 +42,22 @@ public class RegisterChangeListener {
     public ActorPath getDataChangeListenerPath() {
         return dataChangeListenerPath;
     }
+
+
+    @Override
+    public ListenerRegistrationMessages.RegisterChangeListener toSerializable() {
+      return ListenerRegistrationMessages.RegisterChangeListener.newBuilder()
+          .setInstanceIdentifierPath(InstanceIdentifierUtils.toSerializable(path))
+          .setDataChangeListenerActorPath(dataChangeListenerPath.toString())
+          .setDataChangeScope(scope.ordinal()).build();
+    }
+
+  public static RegisterChangeListener fromSerializable(ActorSystem actorSystem,Object serializable){
+    ListenerRegistrationMessages.RegisterChangeListener o = (ListenerRegistrationMessages.RegisterChangeListener) serializable;
+    return new RegisterChangeListener(InstanceIdentifierUtils.fromSerializable(o.getInstanceIdentifierPath()),
+                                                actorSystem.actorFor(o.getDataChangeListenerActorPath()).path(),
+                                              AsyncDataBroker.DataChangeScope.values()[o.getDataChangeScope()]);
+  }
+
+
 }
index ae8bbbd75adf2717a3a50d579bd7f179a31841b5..8d980d283db9c9187733e44c4f685287c83a97ea 100644 (file)
@@ -9,8 +9,11 @@
 package org.opendaylight.controller.cluster.datastore.messages;
 
 import akka.actor.ActorPath;
+import akka.actor.ActorSystem;
+import org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages;
 
-public class RegisterChangeListenerReply {
+public class RegisterChangeListenerReply implements SerializableMessage{
+  public static final Class SERIALIZABLE_CLASS = ListenerRegistrationMessages.RegisterChangeListenerReply.class;
   private final ActorPath listenerRegistrationPath;
 
   public RegisterChangeListenerReply(ActorPath listenerRegistrationPath) {
@@ -20,4 +23,17 @@ public class RegisterChangeListenerReply {
   public ActorPath getListenerRegistrationPath() {
     return listenerRegistrationPath;
   }
+
+  @Override
+  public ListenerRegistrationMessages.RegisterChangeListenerReply toSerializable() {
+    return ListenerRegistrationMessages.RegisterChangeListenerReply.newBuilder()
+            .setListenerRegistrationPath(listenerRegistrationPath.toString()).build();
+  }
+
+  public static RegisterChangeListenerReply fromSerializable(ActorSystem actorSystem,Object serializable){
+    ListenerRegistrationMessages.RegisterChangeListenerReply o = (ListenerRegistrationMessages.RegisterChangeListenerReply) serializable;
+    return new RegisterChangeListenerReply(
+        actorSystem.actorFor(o.getListenerRegistrationPath()).path()
+        );
+  }
 }
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/SerializableMessage.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/SerializableMessage.java
new file mode 100644 (file)
index 0000000..d87b903
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * 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.messages;
+
+public interface SerializableMessage {
+    Object toSerializable();
+}
index 1348e65aa30679cbdb8ae539eb0aa91d4d54594c..87fa010b373d679eae58ff306a262de406c9c148 100644 (file)
@@ -8,12 +8,42 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
+import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+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;
 
 public class WriteData extends ModifyData{
 
-  public WriteData(InstanceIdentifier path, NormalizedNode<?, ?> data) {
-    super(path, data);
+  public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.WriteData.class;
+
+  public WriteData(YangInstanceIdentifier path, NormalizedNode<?, ?> data, SchemaContext schemaContext) {
+    super(path, data, schemaContext);
   }
+
+    @Override public Object toSerializable() {
+
+        NormalizedNodeMessages.Node normalizedNode =
+            new NormalizedNodeToNodeCodec(schemaContext).encode(path, data)
+                .getNormalizedNode();
+        return ShardTransactionMessages.WriteData.newBuilder()
+            .setInstanceIdentifierPathArguments(InstanceIdentifierUtils.toSerializable(path))
+            .setNormalizedNode(normalizedNode).build();
+
+    }
+
+    public static WriteData fromSerializable(Object serializable, SchemaContext schemaContext){
+        ShardTransactionMessages.WriteData o = (ShardTransactionMessages.WriteData) serializable;
+        YangInstanceIdentifier identifier = InstanceIdentifierUtils.fromSerializable(o.getInstanceIdentifierPathArguments());
+
+        NormalizedNode<?, ?> normalizedNode =
+            new NormalizedNodeToNodeCodec(schemaContext)
+                .decode(identifier, o.getNormalizedNode());
+
+        return new WriteData(identifier, normalizedNode, schemaContext);
+    }
+
 }
index 2a2b4ed25d2587eab787430f0ccc509596b6656b..5404fb65103557235ae8e56f95eebd645ea11b9d 100644 (file)
@@ -8,5 +8,12 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
-public class WriteDataReply {
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+
+public class WriteDataReply implements SerializableMessage{
+  public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.WriteDataReply.class;
+  @Override
+  public Object toSerializable() {
+    return ShardTransactionMessages.WriteDataReply.newBuilder().build();
+  }
 }
index 5d9f96277ddcba65b05801ea328c8e80333744f3..169397bf877168cee54be4fd013870e158c17b0c 100644 (file)
@@ -9,7 +9,7 @@
 package org.opendaylight.controller.cluster.datastore.modification;
 
 
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 import java.io.Serializable;
 
@@ -21,9 +21,9 @@ public abstract class AbstractModification implements Modification,
 
     private static final long serialVersionUID = 1638042650152084457L;
 
-    protected final InstanceIdentifier path;
+    protected final YangInstanceIdentifier path;
 
-    protected AbstractModification(InstanceIdentifier path) {
+    protected AbstractModification(YangInstanceIdentifier path) {
         this.path = path;
     }
 }
index 063ec3e1fcc34ca96192bd4e0c90e40c604c43a6..593f458afa314f458ad314e6af22701160810c35 100644 (file)
@@ -8,14 +8,16 @@
 
 package org.opendaylight.controller.cluster.datastore.modification;
 
+import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
  * DeleteModification store all the parameters required to delete a path from the data tree
  */
 public class DeleteModification extends AbstractModification {
-  public DeleteModification(InstanceIdentifier path) {
+  public DeleteModification(YangInstanceIdentifier path) {
     super(path);
   }
 
@@ -23,4 +25,16 @@ public class DeleteModification extends AbstractModification {
   public void apply(DOMStoreWriteTransaction transaction) {
     transaction.delete(path);
   }
+
+    @Override public Object toSerializable() {
+        return PersistentMessages.Modification.newBuilder()
+            .setType(this.getClass().toString())
+            .setPath(InstanceIdentifierUtils.toSerializable(this.path))
+            .build();
+    }
+
+    public static DeleteModification fromSerializable(Object serializable){
+        PersistentMessages.Modification o = (PersistentMessages.Modification) serializable;
+        return new DeleteModification(InstanceIdentifierUtils.fromSerializable(o.getPath()));
+    }
 }
index 5a15d76d27b0f34c270063438e8da41db853cc85..2d11500eb7e44369ce428bab44a057723df83036 100644 (file)
@@ -8,25 +8,39 @@
 
 package org.opendaylight.controller.cluster.datastore.modification;
 
+import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
 
 import java.util.List;
 
-public class ImmutableCompositeModification implements CompositeModification{
+public class ImmutableCompositeModification implements CompositeModification {
 
-  private final CompositeModification modification;
+    private final CompositeModification modification;
 
-  public ImmutableCompositeModification(CompositeModification modification){
-    this.modification = modification;
-  }
+    public ImmutableCompositeModification(CompositeModification modification) {
+        this.modification = modification;
+    }
 
-  @Override
-  public List<Modification> getModifications() {
-    return modification.getModifications();
-  }
+    @Override
+    public List<Modification> getModifications() {
+        return modification.getModifications();
+    }
 
-  @Override
-  public void apply(DOMStoreWriteTransaction transaction) {
-    modification.apply(transaction);
-  }
+    @Override
+    public void apply(DOMStoreWriteTransaction transaction) {
+        modification.apply(transaction);
+    }
+
+    @Override public Object toSerializable() {
+
+        PersistentMessages.CompositeModification.Builder builder =
+            PersistentMessages.CompositeModification.newBuilder();
+
+        for (Modification m : modification.getModifications()) {
+            builder.addModification(
+                (PersistentMessages.Modification) m.toSerializable());
+        }
+
+        return builder.build();
+    }
 }
index 0457a7828029b2cb820f48499941f9809edb7126..f06adcf96f9ff7c16f1842187bbc98119b53152c 100644 (file)
@@ -8,24 +8,58 @@
 
 package org.opendaylight.controller.cluster.datastore.modification;
 
+import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
+import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+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;
 
 /**
  * MergeModification stores all the parameters required to merge data into the specified path
  */
-public class MergeModification extends AbstractModification{
-  private final NormalizedNode data;
+public class MergeModification extends AbstractModification {
+    private final NormalizedNode data;
+    private final SchemaContext schemaContext;
 
 
-  public MergeModification(InstanceIdentifier path, NormalizedNode data) {
-    super(path);
-    this.data = data;
-  }
+    public MergeModification(YangInstanceIdentifier path, NormalizedNode data,
+        SchemaContext schemaContext) {
+        super(path);
+        this.data = data;
+        this.schemaContext = schemaContext;
+    }
+
+    @Override
+    public void apply(DOMStoreWriteTransaction transaction) {
+        transaction.merge(path, data);
+    }
+
+    @Override public Object toSerializable() {
+        NormalizedNodeMessages.Container encode =
+            new NormalizedNodeToNodeCodec(schemaContext).encode(
+                path, data);
+
+        return PersistentMessages.Modification.newBuilder()
+            .setType(this.getClass().toString())
+            .setPath(InstanceIdentifierUtils.toSerializable(this.path))
+            .setData(encode.getNormalizedNode())
+            .build();
+
+    }
+
+    public static MergeModification fromSerializable(
+        Object serializable,
+        SchemaContext schemaContext) {
+        PersistentMessages.Modification o = (PersistentMessages.Modification) serializable;
+
+        YangInstanceIdentifier path = InstanceIdentifierUtils.fromSerializable(o.getPath());
+        NormalizedNode data = new NormalizedNodeToNodeCodec(schemaContext).decode(
+            path, o.getData());
+
+        return new MergeModification(path, data, schemaContext);
+    }
 
-  @Override
-  public void apply(DOMStoreWriteTransaction transaction) {
-    transaction.merge(path, data);
-  }
 }
index 60dbf0f4b17e06131db9c0939f257a2af76a31fb..ed9b1fe3b9548f9b529b4e1e9ce6929e41fcda11 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.controller.cluster.datastore.modification;
 
+import org.opendaylight.controller.cluster.datastore.messages.SerializableMessage;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
 
 /**
@@ -24,7 +25,7 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
  * which can then be applied to a write transaction
  * </p>
  */
-public interface Modification {
+public interface Modification extends SerializableMessage {
   /**
    * Apply the modification to the specified transaction
    * @param transaction
index 9f37ba42d3c97076af0dfff3146c61338036968d..1a005d856e30ceb3b9cd359b5fd14ef42bc14cf0 100644 (file)
@@ -8,9 +8,10 @@
 
 package org.opendaylight.controller.cluster.datastore.modification;
 
+import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
-import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -20,7 +21,7 @@ import java.util.List;
  * CompositeModification {@link org.opendaylight.controller.cluster.datastore.modification.MutableCompositeModification#addModification(Modification)}
  */
 public class MutableCompositeModification
-    implements CompositeModification, Serializable {
+    implements CompositeModification {
 
     private static final long serialVersionUID = 1163377899140186790L;
 
@@ -46,4 +47,33 @@ public class MutableCompositeModification
     public List<Modification> getModifications() {
         return Collections.unmodifiableList(modifications);
     }
+
+    @Override public Object toSerializable() {
+        PersistentMessages.CompositeModification.Builder builder =
+            PersistentMessages.CompositeModification.newBuilder();
+
+        for (Modification m : modifications) {
+            builder.addModification(
+                (PersistentMessages.Modification) m.toSerializable());
+        }
+
+        return builder.build();
+    }
+
+    public static MutableCompositeModification fromSerializable(Object serializable, SchemaContext schemaContext){
+        PersistentMessages.CompositeModification o = (PersistentMessages.CompositeModification) serializable;
+        MutableCompositeModification compositeModification = new MutableCompositeModification();
+
+        for(PersistentMessages.Modification m : o.getModificationList()){
+            if(m.getType().equals(DeleteModification.class.toString())){
+                compositeModification.addModification(DeleteModification.fromSerializable(m));
+            } else if(m.getType().equals(WriteModification.class.toString())){
+                compositeModification.addModification(WriteModification.fromSerializable(m, schemaContext));
+            } else if(m.getType().equals(MergeModification.class.toString())){
+                compositeModification.addModification(MergeModification.fromSerializable(m, schemaContext));
+            }
+        }
+
+        return compositeModification;
+    }
 }
index 1b2a87f42bb0cbfc61852534b1a9d65419491741..b4a7dd62d00121debd5cde36c358e02f4c264df8 100644 (file)
@@ -8,9 +8,14 @@
 
 package org.opendaylight.controller.cluster.datastore.modification;
 
+import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
+import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+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;
 
 /**
  * WriteModification stores all the parameters required to write data to the specified path
@@ -18,15 +23,42 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 public class WriteModification extends AbstractModification {
 
   private final NormalizedNode data;
+    private final SchemaContext schemaContext;
 
-  public WriteModification(InstanceIdentifier path, NormalizedNode data) {
+    public WriteModification(YangInstanceIdentifier path, NormalizedNode data, SchemaContext schemaContext) {
     super(path);
     this.data = data;
-  }
+        this.schemaContext = schemaContext;
+    }
 
   @Override
   public void apply(DOMStoreWriteTransaction transaction) {
     transaction.write(path, data);
   }
 
+    @Override public Object toSerializable() {
+        NormalizedNodeMessages.Container encode =
+            new NormalizedNodeToNodeCodec(schemaContext).encode(
+                path, data);
+
+
+        return PersistentMessages.Modification.newBuilder()
+            .setType(this.getClass().toString())
+            .setPath(InstanceIdentifierUtils.toSerializable(this.path))
+            .setData(encode.getNormalizedNode())
+            .build();
+
+    }
+
+    public static WriteModification fromSerializable(
+        Object serializable,
+        SchemaContext schemaContext) {
+        PersistentMessages.Modification o = (PersistentMessages.Modification) serializable;
+
+        YangInstanceIdentifier path = InstanceIdentifierUtils.fromSerializable(o.getPath());
+        NormalizedNode data = new NormalizedNodeToNodeCodec(schemaContext).decode(
+            path, o.getData());
+
+        return new WriteModification(path, data, schemaContext);
+    }
 }
index a8ab5c4bd390ea3567613b8a9075c1cd430b0066..55c682b86000187e10e2376b3f69e94a87772d73 100644 (file)
@@ -8,7 +8,7 @@
 
 package org.opendaylight.controller.cluster.datastore.shardstrategy;
 
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
  * The DefaultShardStrategy basically puts all data into the default Shard
@@ -22,7 +22,7 @@ public class DefaultShardStrategy implements ShardStrategy{
   public static final String DEFAULT_SHARD = "default";
 
   @Override
-  public String findShard(InstanceIdentifier path) {
+  public String findShard(YangInstanceIdentifier path) {
     return DEFAULT_SHARD;
   }
 }
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ModuleShardStrategy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ModuleShardStrategy.java
new file mode 100644 (file)
index 0000000..6f4b65a
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * 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.shardstrategy;
+
+import org.opendaylight.controller.cluster.datastore.Configuration;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+public class ModuleShardStrategy implements ShardStrategy {
+
+    public static final String NAME = "module";
+
+    private final String moduleName;
+    private final Configuration configuration;
+
+    public ModuleShardStrategy(String moduleName, Configuration configuration){
+        this.moduleName = moduleName;
+
+        this.configuration = configuration;
+    }
+
+    @Override public String findShard(YangInstanceIdentifier path) {
+        return configuration.getShardNamesFromModuleName(moduleName).get(0);
+    }
+}
index f75eb2d863e65a636397b254d66607af588134c5..2df945edd5e9b9c16ed454e55859611afe8a66e0 100644 (file)
@@ -8,7 +8,7 @@
 
 package org.opendaylight.controller.cluster.datastore.shardstrategy;
 
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
  * The role of ShardStrategy is to figure out which Shards a given piece of data belongs to
@@ -20,5 +20,5 @@ public interface ShardStrategy {
    * @param path The location of the data in the logical tree
    * @return
    */
-  String findShard(InstanceIdentifier path);
+  String findShard(YangInstanceIdentifier path);
 }
index 210537925b151a0b0c140433d4d1f009fa90acf6..f4ab8fab6f768e84bd48c15ebc83e862315e09eb 100644 (file)
@@ -8,41 +8,52 @@
 
 package org.opendaylight.controller.cluster.datastore.shardstrategy;
 
+import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.controller.cluster.datastore.Configuration;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 public class ShardStrategyFactory {
-  private static final Map<String, ShardStrategy> moduleNameToStrategyMap = new ConcurrentHashMap();
+    private static Map<String, ShardStrategy> moduleNameToStrategyMap =
+        new ConcurrentHashMap();
 
-  private static final String UNKNOWN_MODULE_NAME = "unknown";
+    private static final String UNKNOWN_MODULE_NAME = "unknown";
+    private static Configuration configuration;
 
-  public static ShardStrategy getStrategy(InstanceIdentifier path){
-    Preconditions.checkNotNull(path, "path should not be null");
 
-    String moduleName = getModuleName(path);
-    ShardStrategy shardStrategy = moduleNameToStrategyMap.get(moduleName);
-    if(shardStrategy == null){
-      return new DefaultShardStrategy();
+    public static void setConfiguration(Configuration configuration){
+        ShardStrategyFactory.configuration = configuration;
+        moduleNameToStrategyMap = configuration.getModuleNameToShardStrategyMap();
     }
 
-    return shardStrategy;
-  }
+    public static ShardStrategy getStrategy(YangInstanceIdentifier path) {
+        Preconditions.checkState(configuration != null, "configuration should not be missing");
+        Preconditions.checkNotNull(path, "path should not be null");
 
 
-  private static String getModuleName(InstanceIdentifier path){
-    return UNKNOWN_MODULE_NAME;
-  }
+        String moduleName = getModuleName(path);
+        ShardStrategy shardStrategy = moduleNameToStrategyMap.get(moduleName);
+        if (shardStrategy == null) {
+            return new DefaultShardStrategy();
+        }
 
-  /**
-   * This is to be used in the future to register a custom shard strategy
-   *
-   * @param moduleName
-   * @param shardStrategy
-   */
-  public static void registerShardStrategy(String moduleName, ShardStrategy shardStrategy){
-    throw new UnsupportedOperationException("registering a custom shard strategy not supported yet");
-  }
+        return shardStrategy;
+    }
+
+
+    private static String getModuleName(YangInstanceIdentifier path) {
+        String namespace = path.getPathArguments().iterator().next().getNodeType().getNamespace().toASCIIString();
+
+        Optional<String> optional =
+            configuration.getModuleNameFromNameSpace(namespace);
+
+        if(!optional.isPresent()){
+            return UNKNOWN_MODULE_NAME;
+        }
+
+        return optional.get();
+    }
 }
index c97e07db6d60c867c9f4c1687c9495ae9722a3c9..ac0893da5ad157c230fad2aab7401b27d0054751 100644 (file)
@@ -14,10 +14,13 @@ import akka.actor.ActorSelection;
 import akka.actor.ActorSystem;
 import akka.actor.PoisonPill;
 import akka.util.Timeout;
+import org.opendaylight.controller.cluster.datastore.ClusterWrapper;
+import org.opendaylight.controller.cluster.datastore.Configuration;
 import org.opendaylight.controller.cluster.datastore.exceptions.PrimaryNotFoundException;
 import org.opendaylight.controller.cluster.datastore.exceptions.TimeoutException;
 import org.opendaylight.controller.cluster.datastore.messages.FindPrimary;
 import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import scala.concurrent.Await;
@@ -39,15 +42,25 @@ public class ActorContext {
     private static final Logger
         LOG = LoggerFactory.getLogger(ActorContext.class);
 
-    public static final FiniteDuration ASK_DURATION = Duration.create(5, TimeUnit.SECONDS);
-    public static final Duration AWAIT_DURATION = Duration.create(5, TimeUnit.SECONDS);
+    public static final FiniteDuration ASK_DURATION =
+        Duration.create(5, TimeUnit.SECONDS);
+    public static final Duration AWAIT_DURATION =
+        Duration.create(5, TimeUnit.SECONDS);
 
     private final ActorSystem actorSystem;
     private final ActorRef shardManager;
+    private final ClusterWrapper clusterWrapper;
+    private final Configuration configuration;
 
-    public ActorContext(ActorSystem actorSystem, ActorRef shardManager){
+    private SchemaContext schemaContext = null;
+
+    public ActorContext(ActorSystem actorSystem, ActorRef shardManager,
+        ClusterWrapper clusterWrapper,
+        Configuration configuration) {
         this.actorSystem = actorSystem;
         this.shardManager = shardManager;
+        this.clusterWrapper = clusterWrapper;
+        this.configuration = configuration;
     }
 
     public ActorSystem getActorSystem() {
@@ -58,11 +71,11 @@ public class ActorContext {
         return shardManager;
     }
 
-    public ActorSelection actorSelection(String actorPath){
+    public ActorSelection actorSelection(String actorPath) {
         return actorSystem.actorSelection(actorPath);
     }
 
-    public ActorSelection actorSelection(ActorPath actorPath){
+    public ActorSelection actorSelection(ActorPath actorPath) {
         return actorSystem.actorSelection(actorPath);
     }
 
@@ -74,72 +87,84 @@ public class ActorContext {
      * @return
      */
     public ActorSelection findPrimary(String shardName) {
+        String path = findPrimaryPath(shardName);
+        return actorSystem.actorSelection(path);
+    }
+
+    public String findPrimaryPath(String shardName) {
         Object result = executeLocalOperation(shardManager,
-            new FindPrimary(shardName), ASK_DURATION);
+            new FindPrimary(shardName).toSerializable(), ASK_DURATION);
 
-        if(result instanceof PrimaryFound){
-            PrimaryFound found = (PrimaryFound) result;
+        if (result.getClass().equals(PrimaryFound.SERIALIZABLE_CLASS)) {
+            PrimaryFound found = PrimaryFound.fromSerializable(result);
 
-            LOG.error("Primary found {}", found.getPrimaryPath());
+            LOG.debug("Primary found {}", found.getPrimaryPath());
 
-            return actorSystem.actorSelection(found.getPrimaryPath());
+            return found.getPrimaryPath();
         }
-        throw new PrimaryNotFoundException();
+        throw new PrimaryNotFoundException("Could not find primary for shardName " + shardName);
     }
 
+
     /**
      * Executes an operation on a local actor and wait for it's response
+     *
      * @param actor
      * @param message
      * @param duration
      * @return The response of the operation
      */
     public Object executeLocalOperation(ActorRef actor, Object message,
-        FiniteDuration duration){
+        FiniteDuration duration) {
         Future<Object> future =
             ask(actor, message, new Timeout(duration));
 
         try {
             return Await.result(future, AWAIT_DURATION);
         } catch (Exception e) {
-            throw new TimeoutException(e);
+            throw new TimeoutException("Sending message " + message.getClass().toString() + " to actor " + actor.toString() + " failed" , e);
         }
     }
 
     /**
      * Execute an operation on a remote actor and wait for it's response
+     *
      * @param actor
      * @param message
      * @param duration
      * @return
      */
     public Object executeRemoteOperation(ActorSelection actor, Object message,
-        FiniteDuration duration){
+        FiniteDuration duration) {
+
+        LOG.debug("Sending remote message {} to {}", message.getClass().toString(), actor.toString());
+
         Future<Object> future =
             ask(actor, message, new Timeout(duration));
 
         try {
             return Await.result(future, AWAIT_DURATION);
         } catch (Exception e) {
-            throw new TimeoutException(e);
+            throw new TimeoutException("Sending message " + message.getClass().toString() + " to actor " + actor.toString() + " failed" , e);
         }
     }
 
     /**
      * Execute an operation on the primary for a given shard
      * <p>
-     *     This method first finds the primary for a given shard ,then sends
-     *     the message to the remote shard and waits for a response
+     * This method first finds the primary for a given shard ,then sends
+     * the message to the remote shard and waits for a response
      * </p>
+     *
      * @param shardName
      * @param message
      * @param duration
-     * @throws org.opendaylight.controller.cluster.datastore.exceptions.TimeoutException if the message to the remote shard times out
-     * @throws org.opendaylight.controller.cluster.datastore.exceptions.PrimaryNotFoundException if the primary shard is not found
-     *
      * @return
+     * @throws org.opendaylight.controller.cluster.datastore.exceptions.TimeoutException         if the message to the remote shard times out
+     * @throws org.opendaylight.controller.cluster.datastore.exceptions.PrimaryNotFoundException if the primary shard is not found
      */
-    public Object executeShardOperation(String shardName, Object message, FiniteDuration duration){
+    public Object executeShardOperation(String shardName, Object message,
+        FiniteDuration duration) {
         ActorSelection primary = findPrimary(shardName);
 
         return executeRemoteOperation(primary, message, duration);
@@ -149,4 +174,37 @@ public class ActorContext {
         shardManager.tell(PoisonPill.getInstance(), null);
         actorSystem.shutdown();
     }
+
+    /**
+     * @deprecated Need to stop using this method. There are ways to send a
+     * remote ActorRef as a string which should be used instead of this hack
+     *
+     * @param primaryPath
+     * @param localPathOfRemoteActor
+     * @return
+     */
+    @Deprecated
+    public String resolvePath(final String primaryPath,
+        final String localPathOfRemoteActor) {
+        StringBuilder builder = new StringBuilder();
+        String[] primaryPathElements = primaryPath.split("/");
+        builder.append(primaryPathElements[0]).append("//")
+            .append(primaryPathElements[1]).append(primaryPathElements[2]);
+        String[] remotePathElements = localPathOfRemoteActor.split("/");
+        for (int i = 3; i < remotePathElements.length; i++) {
+            builder.append("/").append(remotePathElements[i]);
+        }
+
+        return builder.toString();
+
+    }
+
+    public ActorPath actorFor(String path){
+        return actorSystem.actorFor(path).path();
+    }
+
+    public String getCurrentMemberName(){
+        return clusterWrapper.getCurrentMemberName();
+    }
+
 }
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/InstanceIdentifierUtils.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/InstanceIdentifierUtils.java
new file mode 100644 (file)
index 0000000..20268a6
--- /dev/null
@@ -0,0 +1,72 @@
+package org.opendaylight.controller.cluster.datastore.utils;
+
+import org.opendaylight.controller.cluster.datastore.node.utils.NodeIdentifierFactory;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author: syedbahm
+ */
+public class InstanceIdentifierUtils {
+
+    protected static final Logger logger = LoggerFactory
+        .getLogger(InstanceIdentifierUtils.class);
+
+    public static String getParentPath(String currentElementPath) {
+        String parentPath = "";
+
+        if (currentElementPath != null) {
+            String[] parentPaths = currentElementPath.split("/");
+            if (parentPaths.length > 2) {
+                for (int i = 0; i < parentPaths.length - 1; i++) {
+                    if (parentPaths[i].length() > 0) {
+                        parentPath += "/" + parentPaths[i];
+                    }
+                }
+            }
+        }
+        return parentPath;
+    }
+
+    @Deprecated
+    public static YangInstanceIdentifier from(String path) {
+        String[] ids = path.split("/");
+
+        List<YangInstanceIdentifier.PathArgument> pathArguments =
+            new ArrayList<>();
+        for (String nodeId : ids) {
+            if (!"".equals(nodeId)) {
+                pathArguments
+                    .add(NodeIdentifierFactory.getArgument(nodeId));
+            }
+        }
+        final YangInstanceIdentifier instanceIdentifier =
+            YangInstanceIdentifier.create(pathArguments);
+        return instanceIdentifier;
+    }
+
+    /**
+     * @deprecated Use {@link org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils} instead
+     * @param path
+     * @return
+     */
+    @Deprecated
+    public static NormalizedNodeMessages.InstanceIdentifier toSerializable(YangInstanceIdentifier path){
+        return org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils.toSerializable(path);
+    }
+
+    /**
+     * @deprecated Use {@link org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils} instead
+     * @param path
+     * @return
+     */
+    @Deprecated
+    public static YangInstanceIdentifier fromSerializable(NormalizedNodeMessages.InstanceIdentifier path){
+        return org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils.fromSerializable(path);
+    }
+}
index b56c26b578fbdb9cc5b6416d44bce30694b49692..76914c2c84f020268377b2a5d191cf831bb96f6d 100644 (file)
@@ -1,3 +1,15 @@
 ODLCluster{
 
+actor {
+        serializers {
+          java = "akka.serialization.JavaSerializer"
+          proto = "akka.remote.serialization.ProtobufSerializer"
+        }
+
+        serialization-bindings {
+            "com.google.protobuf.Message" = proto
+
+        }
+    }
+
 }
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/resources/module-shards.conf b/opendaylight/md-sal/sal-distributed-datastore/src/main/resources/module-shards.conf
new file mode 100644 (file)
index 0000000..60dd775
--- /dev/null
@@ -0,0 +1,25 @@
+module-shards = [
+    {
+        name = "default"
+        shards = [
+            {
+                name="default",
+                replicas = [
+                    "member-1",
+                ]
+            }
+        ]
+    },
+    {
+        name = "inventory"
+        shards = [
+            {
+                name="inventory"
+                replicas = [
+                    "member-1",
+                ]
+            }
+        ]
+    }
+
+]
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/resources/modules.conf b/opendaylight/md-sal/sal-distributed-datastore/src/main/resources/modules.conf
new file mode 100644 (file)
index 0000000..05ef33f
--- /dev/null
@@ -0,0 +1,7 @@
+modules = [
+    {
+        name = "inventory"
+        namespace = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:people"
+        shard-strategy = "module"
+    }
+]
index 214b3e9d3d989d73d0cd618db937a0fa6bcfdcb6..e23a76b0b223ee2b8ee0d5398da878cd520caf65 100644 (file)
@@ -10,22 +10,38 @@ package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorSystem;
 import akka.testkit.JavaTestKit;
+import org.apache.commons.io.FileUtils;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 
+import java.io.File;
+import java.io.IOException;
+
 public abstract class AbstractActorTest {
     private static ActorSystem system;
 
     @BeforeClass
-    public static void setUpClass() {
+    public static void setUpClass() throws IOException {
+        File journal = new File("journal");
+
+        if(journal.exists()) {
+            FileUtils.deleteDirectory(journal);
+        }
+
         System.setProperty("shard.persistent", "false");
         system = ActorSystem.create("test");
     }
 
     @AfterClass
-    public static void tearDownClass() {
+    public static void tearDownClass() throws IOException {
         JavaTestKit.shutdownActorSystem(system);
         system = null;
+
+        File journal = new File("journal");
+
+        if(journal.exists()) {
+            FileUtils.deleteDirectory(journal);
+        }
     }
 
     protected ActorSystem getSystem() {
index dfefc5ed579b36163f882485f38f577b53832b8e..11ad559744a3923aebfbb07472771b98a4439ab0 100644 (file)
@@ -12,12 +12,10 @@ import akka.actor.ActorPath;
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
 import akka.actor.Props;
-import akka.actor.Terminated;
 import akka.testkit.JavaTestKit;
 import junit.framework.Assert;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.messages.CommitTransaction;
-import org.opendaylight.controller.cluster.datastore.messages.CommitTransactionReply;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChain;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChainReply;
@@ -35,10 +33,13 @@ import scala.concurrent.Await;
 import scala.concurrent.Future;
 import scala.concurrent.duration.FiniteDuration;
 
+import java.util.Collections;
+
 public class BasicIntegrationTest extends AbstractActorTest {
 
     @Test
     public void integrationTest() throws Exception{
+        // System.setProperty("shard.persistent", "true");
         // This test will
         // - create a Shard
         // - initiate a transaction
@@ -48,24 +49,33 @@ public class BasicIntegrationTest extends AbstractActorTest {
 
 
         new JavaTestKit(getSystem()) {{
-            final Props props = Shard.props("config");
+            final Props props = Shard.props("config", Collections.EMPTY_MAP);
             final ActorRef shard = getSystem().actorOf(props);
 
             new Within(duration("5 seconds")) {
                 protected void run() {
 
+
                     shard.tell(
                         new UpdateSchemaContext(TestModel.createTestContext()),
                         getRef());
 
-                    shard.tell(new CreateTransactionChain(), getRef());
+
+                    // Wait for Shard to become a Leader
+                    try {
+                        Thread.sleep(1000);
+                    } catch (InterruptedException e) {
+                        e.printStackTrace();
+                    }
+                    // 1. Create a TransactionChain
+                    shard.tell(new CreateTransactionChain().toSerializable(), getRef());
 
                     final ActorSelection transactionChain =
                         new ExpectMsg<ActorSelection>("CreateTransactionChainReply") {
                             protected ActorSelection match(Object in) {
-                                if (in instanceof CreateTransactionChainReply) {
+                                if (in.getClass().equals(CreateTransactionChainReply.SERIALIZABLE_CLASS)) {
                                     ActorPath transactionChainPath =
-                                        ((CreateTransactionChainReply) in)
+                                        CreateTransactionChainReply.fromSerializable(getSystem(),in)
                                             .getTransactionChainPath();
                                     return getSystem()
                                         .actorSelection(transactionChainPath);
@@ -77,17 +87,19 @@ public class BasicIntegrationTest extends AbstractActorTest {
 
                     Assert.assertNotNull(transactionChain);
 
-                    transactionChain.tell(new CreateTransaction("txn-1"), getRef());
+                    System.out.println("Successfully created transaction chain");
+
+                    // 2. Create a Transaction on the TransactionChain
+                    transactionChain.tell(new CreateTransaction("txn-1").toSerializable(), getRef());
 
                     final ActorSelection transaction =
                         new ExpectMsg<ActorSelection>("CreateTransactionReply") {
                             protected ActorSelection match(Object in) {
-                                if (in instanceof CreateTransactionReply) {
-                                    ActorPath transactionPath =
-                                        ((CreateTransactionReply) in)
-                                            .getTransactionPath();
+                                if (CreateTransactionReply.SERIALIZABLE_CLASS.equals(in.getClass())) {
+                                    CreateTransactionReply reply = CreateTransactionReply.fromSerializable(in);
                                     return getSystem()
-                                        .actorSelection(transactionPath);
+                                        .actorSelection(reply
+                                            .getTransactionPath());
                                 } else {
                                     throw noMatch();
                                 }
@@ -96,16 +108,16 @@ public class BasicIntegrationTest extends AbstractActorTest {
 
                     Assert.assertNotNull(transaction);
 
-                    // Add a watch on the transaction actor so that we are notified when it dies
-                    final ActorRef transactionActorRef = watchActor(transaction);
+                    System.out.println("Successfully created transaction");
 
+                    // 3. Write some data
                     transaction.tell(new WriteData(TestModel.TEST_PATH,
-                        ImmutableNodes.containerNode(TestModel.TEST_QNAME)),
+                        ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext()).toSerializable(),
                         getRef());
 
                     Boolean writeDone = new ExpectMsg<Boolean>("WriteDataReply") {
                         protected Boolean match(Object in) {
-                            if (in instanceof WriteDataReply) {
+                            if (in.getClass().equals(WriteDataReply.SERIALIZABLE_CLASS)) {
                                 return true;
                             } else {
                                 throw noMatch();
@@ -115,14 +127,18 @@ public class BasicIntegrationTest extends AbstractActorTest {
 
                     Assert.assertTrue(writeDone);
 
-                    transaction.tell(new ReadyTransaction(), getRef());
+                    System.out.println("Successfully wrote data");
+
+                    // 4. Ready the transaction for commit
+
+                    transaction.tell(new ReadyTransaction().toSerializable(), getRef());
 
                     final ActorSelection cohort =
                         new ExpectMsg<ActorSelection>("ReadyTransactionReply") {
                             protected ActorSelection match(Object in) {
-                                if (in instanceof ReadyTransactionReply) {
+                                if (in.getClass().equals(ReadyTransactionReply.SERIALIZABLE_CLASS)) {
                                     ActorPath cohortPath =
-                                        ((ReadyTransactionReply) in)
+                                        ReadyTransactionReply.fromSerializable(getSystem(),in)
                                             .getCohortPath();
                                     return getSystem()
                                         .actorSelection(cohortPath);
@@ -134,15 +150,16 @@ public class BasicIntegrationTest extends AbstractActorTest {
 
                     Assert.assertNotNull(cohort);
 
-                    // Add a watch on the transaction actor so that we are notified when it dies
-                    final ActorRef cohorActorRef = watchActor(cohort);
+                    System.out.println("Successfully readied the transaction");
 
-                    cohort.tell(new PreCommitTransaction(), getRef());
+                    // 5. PreCommit the transaction
+
+                    cohort.tell(new PreCommitTransaction().toSerializable(), getRef());
 
                     Boolean preCommitDone =
                         new ExpectMsg<Boolean>("PreCommitTransactionReply") {
                             protected Boolean match(Object in) {
-                                if (in instanceof PreCommitTransactionReply) {
+                                if (in.getClass().equals(PreCommitTransactionReply.SERIALIZABLE_CLASS)) {
                                     return true;
                                 } else {
                                     throw noMatch();
@@ -152,52 +169,14 @@ public class BasicIntegrationTest extends AbstractActorTest {
 
                     Assert.assertTrue(preCommitDone);
 
-                    // FIXME : When we commit on the cohort it "kills" the Transaction.
-                    // This in turn kills the child of Transaction as well.
-                    // The order in which we receive the terminated event for both
-                    // these actors is not fixed which may cause this test to fail
-                    cohort.tell(new CommitTransaction(), getRef());
-
-                    final Boolean terminatedCohort =
-                        new ExpectMsg<Boolean>("Terminated Cohort") {
-                            protected Boolean match(Object in) {
-                                if (in instanceof Terminated) {
-                                    return cohorActorRef.equals(((Terminated) in).actor());
-                                } else {
-                                    throw noMatch();
-                                }
-                            }
-                        }.get(); // this extracts the received message
-
-                    Assert.assertTrue(terminatedCohort);
-
+                    System.out.println("Successfully pre-committed the transaction");
 
-                    final Boolean terminatedTransaction =
-                        new ExpectMsg<Boolean>("Terminated Transaction") {
-                            protected Boolean match(Object in) {
-                                if (in instanceof Terminated) {
-                                    return transactionActorRef.equals(((Terminated) in).actor());
-                                } else {
-                                    throw noMatch();
-                                }
-                            }
-                        }.get(); // this extracts the received message
-
-                    Assert.assertTrue(terminatedTransaction);
-
-                    final Boolean commitDone =
-                        new ExpectMsg<Boolean>("CommitTransactionReply") {
-                            protected Boolean match(Object in) {
-                                if (in instanceof CommitTransactionReply) {
-                                    return true;
-                                } else {
-                                    throw noMatch();
-                                }
-                            }
-                        }.get(); // this extracts the received message
+                    // 6. Commit the transaction
+                    cohort.tell(new CommitTransaction().toSerializable(), getRef());
 
-                    Assert.assertTrue(commitDone);
+                    // FIXME : Add assertions that the commit worked and that the cohort and transaction actors were terminated
 
+                    System.out.println("TODO : Check Successfully committed the transaction");
                 }
 
 
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ConfigurationImplTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ConfigurationImplTest.java
new file mode 100644 (file)
index 0000000..56fd3c5
--- /dev/null
@@ -0,0 +1,41 @@
+package org.opendaylight.controller.cluster.datastore;
+
+import com.typesafe.config.ConfigFactory;
+import junit.framework.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.File;
+import java.util.List;
+
+import static org.junit.Assert.assertTrue;
+
+public class ConfigurationImplTest {
+
+    private static ConfigurationImpl configuration;
+
+    @BeforeClass
+    public static void staticSetup(){
+        configuration = new ConfigurationImpl("module-shards.conf", "modules.conf");
+    }
+
+    @Test
+    public void testConstructor(){
+        Assert.assertNotNull(configuration);
+    }
+
+    @Test
+    public void testGetMemberShardNames(){
+        List<String> memberShardNames =
+            configuration.getMemberShardNames("member-1");
+
+        assertTrue(memberShardNames.contains("people-1"));
+        assertTrue(memberShardNames.contains("cars-1"));
+    }
+
+    @Test
+    public void testReadConfigurationFromFile(){
+        File f = new File("./module-shards.conf");
+        ConfigFactory.parseFile(f);
+    }
+}
index a8409a6f85fcfd78063277a3ffd344457a62d369..8c1cbbbba07119884f804bd823fb7947cbcf389f 100644 (file)
@@ -1,3 +1,4 @@
+
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorRef;
@@ -8,61 +9,79 @@ import org.opendaylight.controller.cluster.datastore.messages.DataChanged;
 import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
 import org.opendaylight.controller.cluster.datastore.utils.DoNothingActor;
 import org.opendaylight.controller.cluster.datastore.utils.MessageCollectorActor;
+import org.opendaylight.controller.cluster.datastore.utils.MockClusterWrapper;
+import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration;
+import org.opendaylight.controller.md.cluster.datastore.model.CompositeModel;
+import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 public class DataChangeListenerProxyTest extends AbstractActorTest {
 
-    private static class MockDataChangeEvent implements
-        AsyncDataChangeEvent<InstanceIdentifier,NormalizedNode<?,?>> {
+  private static class MockDataChangedEvent implements AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> {
+    Map<YangInstanceIdentifier,NormalizedNode<?,?>> createdData = new HashMap();
+    Map<YangInstanceIdentifier,NormalizedNode<?,?>> updatedData = new HashMap();
+    Map<YangInstanceIdentifier,NormalizedNode<?,?>> originalData = new HashMap();
+
+
+
+    @Override
+    public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getCreatedData() {
+      createdData.put(YangInstanceIdentifier.builder().build(), CompositeModel.createDocumentOne(CompositeModel.createTestContext()));
+      return createdData;
+    }
 
-        @Override
-        public Map<InstanceIdentifier, NormalizedNode<?, ?>> getCreatedData() {
-            throw new UnsupportedOperationException("getCreatedData");
-        }
+    @Override
+    public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getUpdatedData() {
+      updatedData.put(YangInstanceIdentifier.builder().build(), CompositeModel.createTestContainer());
+      return updatedData;
 
-        @Override
-        public Map<InstanceIdentifier, NormalizedNode<?, ?>> getUpdatedData() {
-            throw new UnsupportedOperationException("getUpdatedData");
-        }
+    }
 
-        @Override public Set<InstanceIdentifier> getRemovedPaths() {
-            throw new UnsupportedOperationException("getRemovedPaths");
-        }
+    @Override
+    public Set<YangInstanceIdentifier> getRemovedPaths() {
+      Set<YangInstanceIdentifier>ids = new HashSet();
+      ids.add( CompositeModel.TEST_PATH);
+      return ids;
+    }
 
-        @Override
-        public Map<InstanceIdentifier, ? extends NormalizedNode<?, ?>> getOriginalData() {
-            throw new UnsupportedOperationException("getOriginalData");
-        }
+    @Override
+    public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getOriginalData() {
+      originalData.put(YangInstanceIdentifier.builder().build(), CompositeModel.createFamily());
+      return originalData;
+    }
 
-        @Override public NormalizedNode<?, ?> getOriginalSubtree() {
-            throw new UnsupportedOperationException("getOriginalSubtree");
-        }
+    @Override public NormalizedNode<?, ?> getOriginalSubtree() {
+      return CompositeModel.createFamily() ;
+    }
 
-        @Override public NormalizedNode<?, ?> getUpdatedSubtree() {
-            throw new UnsupportedOperationException("getUpdatedSubtree");
-        }
+    @Override public NormalizedNode<?, ?> getUpdatedSubtree() {
+      return CompositeModel.createTestContainer();
     }
+  }
+
 
-    @Test
+  @Test
     public void testOnDataChanged() throws Exception {
         final Props props = Props.create(MessageCollectorActor.class);
         final ActorRef actorRef = getSystem().actorOf(props);
 
         DataChangeListenerProxy dataChangeListenerProxy =
-            new DataChangeListenerProxy(
+            new DataChangeListenerProxy(TestModel.createTestContext(),
                 getSystem().actorSelection(actorRef.path()));
 
-        dataChangeListenerProxy.onDataChanged(new MockDataChangeEvent());
+        dataChangeListenerProxy.onDataChanged(new MockDataChangedEvent());
 
         //Check if it was received by the remote actor
         ActorContext
-            testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)));
+            testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)), new MockClusterWrapper(), new MockConfiguration());
         Object messages = testContext
             .executeLocalOperation(actorRef, "messages",
                 ActorContext.ASK_DURATION);
@@ -75,7 +94,7 @@ public class DataChangeListenerProxyTest extends AbstractActorTest {
 
         Assert.assertEquals(1, listMessages.size());
 
-        Assert.assertTrue(listMessages.get(0) instanceof DataChanged);
+        Assert.assertTrue(listMessages.get(0).getClass().equals(DataChanged.SERIALIZABLE_CLASS));
 
     }
 }
index 33b5d956115c7c4be6b20d47df82d4b11cce8c65..c99a7e8c8c4908133bac2a9710e3549f02e2410c 100644 (file)
@@ -8,9 +8,11 @@ import org.opendaylight.controller.cluster.datastore.messages.CloseDataChangeLis
 import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
 import org.opendaylight.controller.cluster.datastore.utils.DoNothingActor;
 import org.opendaylight.controller.cluster.datastore.utils.MessageCollectorActor;
+import org.opendaylight.controller.cluster.datastore.utils.MockClusterWrapper;
+import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 import java.util.List;
@@ -20,10 +22,10 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest{
     private ActorRef dataChangeListenerActor = getSystem().actorOf(Props.create(DoNothingActor.class));
 
     private static class MockDataChangeListener implements
-        AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> {
+        AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> {
 
         @Override public void onDataChanged(
-            AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
+            AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
             throw new UnsupportedOperationException("onDataChanged");
         }
     }
@@ -58,7 +60,7 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest{
 
         //Check if it was received by the remote actor
         ActorContext
-            testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)));
+            testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)),new MockClusterWrapper(), new MockConfiguration());
         Object messages = testContext
             .executeLocalOperation(actorRef, "messages",
                 ActorContext.ASK_DURATION);
@@ -71,6 +73,6 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest{
 
         Assert.assertEquals(1, listMessages.size());
 
-        Assert.assertTrue(listMessages.get(0) instanceof CloseDataChangeListenerRegistration);
+        Assert.assertTrue(listMessages.get(0).getClass().equals(CloseDataChangeListenerRegistration.SERIALIZABLE_CLASS));
     }
 }
index 23302b504ed1c63e4e4ad37d37adbfe251bc4696..8413bac3a7b4e52ea5a3e718ea61775403787d53 100644 (file)
@@ -13,7 +13,7 @@ import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 import static org.junit.Assert.assertEquals;
@@ -39,12 +39,12 @@ public class DataChangeListenerRegistrationTest extends AbstractActorTest {
       new Within(duration("1 seconds")) {
         protected void run() {
 
-          subject.tell(new CloseDataChangeListenerRegistration(), getRef());
+          subject.tell(new CloseDataChangeListenerRegistration().toSerializable(), getRef());
 
           final String out = new ExpectMsg<String>("match hint") {
             // do not put code outside this method, will run afterwards
             protected String match(Object in) {
-              if (in instanceof CloseDataChangeListenerRegistrationReply) {
+              if (in.getClass().equals(CloseDataChangeListenerRegistrationReply.SERIALIZABLE_CLASS)) {
                 return "match";
               } else {
                 throw noMatch();
@@ -62,10 +62,10 @@ public class DataChangeListenerRegistrationTest extends AbstractActorTest {
     }};
   }
 
-  private  AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> noOpDataChangeListener(){
-    return new AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>() {
+  private  AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> noOpDataChangeListener(){
+    return new AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>() {
       @Override
-      public void onDataChanged(AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
+      public void onDataChanged(AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
 
       }
     };
index 6f0816be5c8a19968c0c3811adf68f713497a033..fd610322201f1ffb168640d413f5afe0c8d743d7 100644 (file)
@@ -6,66 +6,90 @@ import akka.testkit.JavaTestKit;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.messages.DataChanged;
 import org.opendaylight.controller.cluster.datastore.messages.DataChangedReply;
+import org.opendaylight.controller.md.cluster.datastore.model.CompositeModel;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 public class DataChangeListenerTest extends AbstractActorTest {
 
-    private static class MockDataChangedEvent implements AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> {
+    private static class MockDataChangedEvent implements AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> {
+       Map<YangInstanceIdentifier,NormalizedNode<?,?>> createdData = new HashMap();
+       Map<YangInstanceIdentifier,NormalizedNode<?,?>> updatedData = new HashMap();
+       Map<YangInstanceIdentifier,NormalizedNode<?,?>> originalData = new HashMap();
+
+
 
         @Override
-        public Map<InstanceIdentifier, NormalizedNode<?, ?>> getCreatedData() {
-            throw new UnsupportedOperationException("getCreatedData");
+        public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getCreatedData() {
+            createdData.put(CompositeModel.FAMILY_PATH, CompositeModel.createFamily());
+            return createdData;
         }
 
         @Override
-        public Map<InstanceIdentifier, NormalizedNode<?, ?>> getUpdatedData() {
-            throw new UnsupportedOperationException("getUpdatedData");
+        public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getUpdatedData() {
+            updatedData.put(CompositeModel.FAMILY_PATH, CompositeModel.createFamily());
+            return updatedData;
+
         }
 
-        @Override public Set<InstanceIdentifier> getRemovedPaths() {
-            throw new UnsupportedOperationException("getRemovedPaths");
+        @Override
+        public Set<YangInstanceIdentifier> getRemovedPaths() {
+               Set<YangInstanceIdentifier>ids = new HashSet();
+               ids.add( CompositeModel.TEST_PATH);
+              return ids;
         }
 
         @Override
-        public Map<InstanceIdentifier, ? extends NormalizedNode<?, ?>> getOriginalData() {
-            throw new UnsupportedOperationException("getOriginalData");
+        public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getOriginalData() {
+          originalData.put(CompositeModel.FAMILY_PATH, CompositeModel.createFamily());
+          return originalData;
         }
 
         @Override public NormalizedNode<?, ?> getOriginalSubtree() {
-            throw new UnsupportedOperationException("getOriginalSubtree");
+
+
+          return originalData.put(CompositeModel.FAMILY_PATH, CompositeModel.createFamily());
         }
 
         @Override public NormalizedNode<?, ?> getUpdatedSubtree() {
-            throw new UnsupportedOperationException("getUpdatedSubtree");
+
+          //fixme: need to have some valid data here
+          return originalData.put(CompositeModel.FAMILY_PATH, CompositeModel.createFamily());
         }
     }
 
-    private class MockDataChangeListener implements AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> {
+    private class MockDataChangeListener implements AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> {
         private boolean gotIt = false;
+        private   AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change;
 
         @Override public void onDataChanged(
-            AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
-            gotIt = true;
+            AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
+            gotIt = true;this.change=change;
         }
 
         public boolean gotIt() {
             return gotIt;
         }
+        public  AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> getChange(){
+          return change;
+        }
     }
 
     @Test
     public void testDataChanged(){
         new JavaTestKit(getSystem()) {{
             final MockDataChangeListener listener = new MockDataChangeListener();
-            final Props props = DataChangeListener.props(listener);
+            final Props props = DataChangeListener.props(CompositeModel.createTestContext(),listener,CompositeModel.FAMILY_PATH );
             final ActorRef subject =
                 getSystem().actorOf(props, "testDataChanged");
 
@@ -73,15 +97,14 @@ public class DataChangeListenerTest extends AbstractActorTest {
                 protected void run() {
 
                     subject.tell(
-                        new DataChanged(new MockDataChangedEvent()),
+                        new DataChanged(CompositeModel.createTestContext(),new MockDataChangedEvent()).toSerializable(),
                         getRef());
 
                     final Boolean out = new ExpectMsg<Boolean>("dataChanged") {
                         // do not put code outside this method, will run afterwards
                         protected Boolean match(Object in) {
-                            if (in instanceof DataChangedReply) {
-                                DataChangedReply reply =
-                                    (DataChangedReply) in;
+                            if (in.getClass().equals(DataChangedReply.SERIALIZABLE_CLASS)) {
+
                                 return true;
                             } else {
                                 throw noMatch();
@@ -91,6 +114,7 @@ public class DataChangeListenerTest extends AbstractActorTest {
 
                     assertTrue(out);
                     assertTrue(listener.gotIt());
+                    assertNotNull(listener.getChange().getCreatedData());
                     // Will wait for the rest of the 3 seconds
                     expectNoMsg();
                 }
index f400e74231f83b7f72881656fe891404a0b7b24d..b5e3d24ef6d536d6afe2c9a6abc111bbb4b8688b 100644 (file)
@@ -1,26 +1,59 @@
 package org.opendaylight.controller.cluster.datastore;
 
+import akka.actor.ActorSystem;
+import akka.testkit.JavaTestKit;
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.ListenableFuture;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory;
+import org.opendaylight.controller.cluster.datastore.utils.MockClusterWrapper;
+import org.opendaylight.controller.md.cluster.datastore.model.CarsModel;
+import org.opendaylight.controller.md.cluster.datastore.model.PeopleModel;
+import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper;
 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 
+import java.util.concurrent.ExecutionException;
+
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertTrue;
 
-public class DistributedDataStoreIntegrationTest extends AbstractActorTest {
+public class DistributedDataStoreIntegrationTest{
+
+    private static ActorSystem system;
+
+    @Before
+    public void setUp() {
+        System.setProperty("shard.persistent", "false");
+        system = ActorSystem.create("test");
+    }
+
+    @After
+    public void tearDown() {
+        JavaTestKit.shutdownActorSystem(system);
+        system = null;
+    }
+
+    protected ActorSystem getSystem() {
+        return system;
+    }
 
     @Test
     public void integrationTest() throws Exception {
+        Configuration configuration = new ConfigurationImpl("module-shards.conf", "modules.conf");
+        ShardStrategyFactory.setConfiguration(configuration);
         DistributedDataStore distributedDataStore =
-            new DistributedDataStore(getSystem(), "config");
+            new DistributedDataStore(getSystem(), "config", new MockClusterWrapper(), configuration);
 
         distributedDataStore.onGlobalContextUpdated(TestModel.createTestContext());
 
+        Thread.sleep(1000);
+
         DOMStoreReadWriteTransaction transaction =
             distributedDataStore.newReadWriteTransaction();
 
@@ -51,4 +84,41 @@ public class DistributedDataStoreIntegrationTest extends AbstractActorTest {
 
     }
 
+
+    @Test
+    public void integrationTestWithMultiShardConfiguration()
+        throws ExecutionException, InterruptedException {
+        Configuration configuration = new ConfigurationImpl("module-shards.conf", "modules.conf");
+
+        ShardStrategyFactory.setConfiguration(configuration);
+        DistributedDataStore distributedDataStore =
+            new DistributedDataStore(getSystem(), "config", new MockClusterWrapper(), configuration);
+
+
+        distributedDataStore.onGlobalContextUpdated(SchemaContextHelper.full());
+
+        Thread.sleep(1000);
+
+        DOMStoreReadWriteTransaction transaction =
+            distributedDataStore.newReadWriteTransaction();
+
+        transaction.write(CarsModel.BASE_PATH, CarsModel.emptyContainer());
+        transaction.write(PeopleModel.BASE_PATH, PeopleModel.emptyContainer());
+
+        DOMStoreThreePhaseCommitCohort ready = transaction.ready();
+
+        ListenableFuture<Boolean> canCommit = ready.canCommit();
+
+        assertTrue(canCommit.get());
+
+        ListenableFuture<Void> preCommit = ready.preCommit();
+
+        preCommit.get();
+
+        ListenableFuture<Void> commit = ready.commit();
+
+        commit.get();
+
+    }
+
 }
index 5f82b40140eb11074c03419121ebd511c08d59e4..23a1ed49315ec827baa95c41b51dfe4d23159d4e 100644 (file)
@@ -3,20 +3,22 @@ package org.opendaylight.controller.cluster.datastore;
 import akka.actor.ActorRef;
 import akka.actor.Props;
 import junit.framework.Assert;
-import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
 import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListenerReply;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory;
 import org.opendaylight.controller.cluster.datastore.utils.DoNothingActor;
 import org.opendaylight.controller.cluster.datastore.utils.MockActorContext;
+import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration;
 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply;
 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.DOMStoreTransactionChain;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 public class DistributedDataStoreTest extends AbstractActorTest{
@@ -27,6 +29,7 @@ public class DistributedDataStoreTest extends AbstractActorTest{
 
     @org.junit.Before
     public void setUp() throws Exception {
+        ShardStrategyFactory.setConfiguration(new MockConfiguration());
         final Props props = Props.create(DoNothingActor.class);
 
         doNothingActorRef = getSystem().actorOf(props);
@@ -39,7 +42,10 @@ public class DistributedDataStoreTest extends AbstractActorTest{
         // Make CreateTransactionReply as the default response. Will need to be
         // tuned if a specific test requires some other response
         mockActorContext.setExecuteShardOperationResponse(
-            new CreateTransactionReply(doNothingActorRef.path(), "txn-1 "));
+            CreateTransactionReply.newBuilder()
+                .setTransactionActorPath(doNothingActorRef.path().toString())
+                .setTransactionId("txn-1 ")
+                .build());
     }
 
     @org.junit.After
@@ -49,11 +55,11 @@ public class DistributedDataStoreTest extends AbstractActorTest{
 
     @org.junit.Test
     public void testRegisterChangeListener() throws Exception {
-        mockActorContext.setExecuteShardOperationResponse(new RegisterChangeListenerReply(doNothingActorRef.path()));
+        mockActorContext.setExecuteShardOperationResponse(new RegisterChangeListenerReply(doNothingActorRef.path()).toSerializable());
         ListenerRegistration registration =
-                distributedDataStore.registerChangeListener(TestModel.TEST_PATH, new AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>() {
+                distributedDataStore.registerChangeListener(TestModel.TEST_PATH, new AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>() {
             @Override
-            public void onDataChanged(AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
+            public void onDataChanged(AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
                 throw new UnsupportedOperationException("onDataChanged");
             }
         }, AsyncDataBroker.DataChangeScope.BASE);
index fa436c16053bc42ad9835e7ecbccd1cb202fc4b8..87d257a3f217bf0bfac0b3c8ade1cbe8d4555b04 100644 (file)
@@ -4,24 +4,27 @@ import akka.actor.ActorSystem;
 import akka.actor.Props;
 import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+import junit.framework.Assert;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.messages.FindPrimary;
 import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound;
 import org.opendaylight.controller.cluster.datastore.messages.PrimaryNotFound;
+import org.opendaylight.controller.cluster.datastore.utils.MockClusterWrapper;
+import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration;
 import scala.concurrent.duration.Duration;
 
 public class ShardManagerTest {
     private static ActorSystem system;
 
     @BeforeClass
-    public static void setUp(){
+    public static void setUp() {
         system = ActorSystem.create("test");
     }
 
     @AfterClass
-    public static void tearDown(){
+    public static void tearDown() {
         JavaTestKit.shutdownActorSystem(system);
         system = null;
     }
@@ -30,15 +33,19 @@ public class ShardManagerTest {
     public void testOnReceiveFindPrimaryForNonExistentShard() throws Exception {
 
         new JavaTestKit(system) {{
-            final Props props = ShardManager.props("config");
-            final TestActorRef<ShardManager> subject = TestActorRef.create(system, props);
+            final Props props = ShardManager
+                .props("config", new MockClusterWrapper(),
+                    new MockConfiguration());
+            final TestActorRef<ShardManager> subject =
+                TestActorRef.create(system, props);
 
             new Within(duration("1 seconds")) {
                 protected void run() {
 
-                    subject.tell(new FindPrimary("inventory"), getRef());
+                    subject.tell(new FindPrimary("inventory").toSerializable(), getRef());
 
-                    expectMsgEquals(Duration.Zero(), new PrimaryNotFound("inventory"));
+                    expectMsgEquals(Duration.Zero(),
+                        new PrimaryNotFound("inventory").toSerializable());
 
                     // Will wait for the rest of the 3 seconds
                     expectNoMsg();
@@ -47,24 +54,99 @@ public class ShardManagerTest {
         }};
     }
 
-  @Test
-  public void testOnReceiveFindPrimaryForExistentShard() throws Exception {
+    @Test
+    public void testOnReceiveFindPrimaryForExistentShard() throws Exception {
+
+        new JavaTestKit(system) {{
+            final Props props = ShardManager
+                .props("config", new MockClusterWrapper(),
+                    new MockConfiguration());
+            final TestActorRef<ShardManager> subject =
+                TestActorRef.create(system, props);
+
+            // the run() method needs to finish within 3 seconds
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    subject.tell(new FindPrimary(Shard.DEFAULT_NAME).toSerializable(), getRef());
+
+                    expectMsgClass(PrimaryFound.SERIALIZABLE_CLASS);
+
+                    expectNoMsg();
+                }
+            };
+        }};
+    }
+
+    @Test
+    public void testOnReceiveMemberUp() throws Exception {
+
+        new JavaTestKit(system) {{
+            final Props props = ShardManager
+                .props("config", new MockClusterWrapper(),
+                    new MockConfiguration());
+            final TestActorRef<ShardManager> subject =
+                TestActorRef.create(system, props);
 
-    new JavaTestKit(system) {{
-      final Props props = ShardManager.props("config");
-      final TestActorRef<ShardManager> subject = TestActorRef.create(system, props);
+            // the run() method needs to finish within 3 seconds
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    MockClusterWrapper.sendMemberUp(subject, "member-2", getRef().path().toString());
 
-      // the run() method needs to finish within 3 seconds
-      new Within(duration("1 seconds")) {
-        protected void run() {
+                    subject.tell(new FindPrimary("astronauts").toSerializable(), getRef());
 
-          subject.tell(new FindPrimary(Shard.DEFAULT_NAME), getRef());
+                    final String out = new ExpectMsg<String>("primary found") {
+                        // do not put code outside this method, will run afterwards
+                        protected String match(Object in) {
+                            if (in.getClass().equals(PrimaryFound.SERIALIZABLE_CLASS)) {
+                                PrimaryFound f = PrimaryFound.fromSerializable(in);
+                                return f.getPrimaryPath();
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get(); // this extracts the received message
+
+                    Assert.assertTrue(out, out.contains("member-2-shard-astronauts-config"));
+
+                    expectNoMsg();
+                }
+            };
+        }};
+    }
+
+    @Test
+    public void testOnReceiveMemberDown() throws Exception {
+
+        new JavaTestKit(system) {{
+            final Props props = ShardManager
+                .props("config", new MockClusterWrapper(),
+                    new MockConfiguration());
+            final TestActorRef<ShardManager> subject =
+                TestActorRef.create(system, props);
+
+            // the run() method needs to finish within 3 seconds
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    MockClusterWrapper.sendMemberUp(subject, "member-2", getRef().path().toString());
+
+                    subject.tell(new FindPrimary("astronauts").toSerializable(), getRef());
+
+                    expectMsgClass(PrimaryFound.SERIALIZABLE_CLASS);
+
+                    MockClusterWrapper.sendMemberRemoved(subject, "member-2", getRef().path().toString());
+
+                    subject.tell(new FindPrimary("astronauts").toSerializable(), getRef());
+
+                    expectMsgClass(PrimaryNotFound.SERIALIZABLE_CLASS);
+
+                    expectNoMsg();
+                }
+            };
+        }};
+    }
 
-          expectMsgClass(PrimaryFound.class);
 
-          expectNoMsg();
-        }
-      };
-    }};
-  }
-}
\ No newline at end of file
+}
index ed447e004fd9b91a7ad7da1561fdb83bf3cbb2d7..7d57ea8284e90dc3f941b7b82385e5db28ed75f4 100644 (file)
@@ -7,17 +7,23 @@ import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChain;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChainReply;
-import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
+import org.opendaylight.controller.cluster.datastore.messages.PeerAddressResolved;
 import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListener;
 import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListenerReply;
 import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext;
+import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper;
 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -25,21 +31,29 @@ public class ShardTest extends AbstractActorTest {
     @Test
     public void testOnReceiveCreateTransactionChain() throws Exception {
         new JavaTestKit(getSystem()) {{
-            final Props props = Shard.props("config");
+            final Props props = Shard.props("config", Collections.EMPTY_MAP);
             final ActorRef subject =
                 getSystem().actorOf(props, "testCreateTransactionChain");
 
+
+            // Wait for Shard to become a Leader
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+
             new Within(duration("1 seconds")) {
                 protected void run() {
 
-                    subject.tell(new CreateTransactionChain(), getRef());
+                    subject.tell(new CreateTransactionChain().toSerializable(), getRef());
 
                     final String out = new ExpectMsg<String>("match hint") {
                         // do not put code outside this method, will run afterwards
                         protected String match(Object in) {
-                            if (in instanceof CreateTransactionChainReply) {
+                            if (in.getClass().equals(CreateTransactionChainReply.SERIALIZABLE_CLASS)){
                                 CreateTransactionChainReply reply =
-                                    (CreateTransactionChainReply) in;
+                                    CreateTransactionChainReply.fromSerializable(getSystem(),in);
                                 return reply.getTransactionChainPath()
                                     .toString();
                             } else {
@@ -63,7 +77,7 @@ public class ShardTest extends AbstractActorTest {
     @Test
     public void testOnReceiveRegisterListener() throws Exception {
         new JavaTestKit(getSystem()) {{
-            final Props props = Shard.props("config");
+            final Props props = Shard.props("config", Collections.EMPTY_MAP);
             final ActorRef subject =
                 getSystem().actorOf(props, "testRegisterChangeListener");
 
@@ -71,19 +85,19 @@ public class ShardTest extends AbstractActorTest {
                 protected void run() {
 
                     subject.tell(
-                        new UpdateSchemaContext(TestModel.createTestContext()),
+                        new UpdateSchemaContext(SchemaContextHelper.full()),
                         getRef());
 
                     subject.tell(new RegisterChangeListener(TestModel.TEST_PATH,
-                        getRef().path(), AsyncDataBroker.DataChangeScope.BASE),
+                        getRef().path(), AsyncDataBroker.DataChangeScope.BASE).toSerializable(),
                         getRef());
 
                     final String out = new ExpectMsg<String>("match hint") {
                         // do not put code outside this method, will run afterwards
                         protected String match(Object in) {
-                            if (in instanceof RegisterChangeListenerReply) {
+                            if (in.getClass().equals(RegisterChangeListenerReply.SERIALIZABLE_CLASS)) {
                                 RegisterChangeListenerReply reply =
-                                    (RegisterChangeListenerReply) in;
+                                    RegisterChangeListenerReply.fromSerializable(getSystem(),in);
                                 return reply.getListenerRegistrationPath()
                                     .toString();
                             } else {
@@ -106,10 +120,19 @@ public class ShardTest extends AbstractActorTest {
     @Test
     public void testCreateTransaction(){
         new JavaTestKit(getSystem()) {{
-            final Props props = Shard.props("config");
+            final Props props = Shard.props("config", Collections.EMPTY_MAP);
             final ActorRef subject =
                 getSystem().actorOf(props, "testCreateTransaction");
 
+
+            // Wait for Shard to become a Leader
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+
+
             new Within(duration("1 seconds")) {
                 protected void run() {
 
@@ -117,7 +140,7 @@ public class ShardTest extends AbstractActorTest {
                         new UpdateSchemaContext(TestModel.createTestContext()),
                         getRef());
 
-                    subject.tell(new CreateTransaction("txn-1"),
+                    subject.tell(new CreateTransaction("txn-1").toSerializable(),
                         getRef());
 
                     final String out = new ExpectMsg<String>("match hint") {
@@ -126,7 +149,7 @@ public class ShardTest extends AbstractActorTest {
                             if (in instanceof CreateTransactionReply) {
                                 CreateTransactionReply reply =
                                     (CreateTransactionReply) in;
-                                return reply.getTransactionPath()
+                                return reply.getTransactionActorPath()
                                     .toString();
                             } else {
                                 throw noMatch();
@@ -134,9 +157,8 @@ public class ShardTest extends AbstractActorTest {
                         }
                     }.get(); // this extracts the received message
 
-                    assertEquals("Unexpected transaction path " + out,
-                        "akka://test/user/testCreateTransaction/shard-txn-1",
-                        out);
+                    assertTrue("Unexpected transaction path " + out,
+                        out.contains("akka://test/user/testCreateTransaction/shard-txn-1"));
                     expectNoMsg();
                 }
 
@@ -145,13 +167,35 @@ public class ShardTest extends AbstractActorTest {
         }};
     }
 
+    @Test
+    public void testPeerAddressResolved(){
+        new JavaTestKit(getSystem()) {{
+            Map<String, String> peerAddresses = new HashMap<>();
+            peerAddresses.put("member-2", null);
+            final Props props = Shard.props("config", peerAddresses);
+            final ActorRef subject =
+                getSystem().actorOf(props, "testPeerAddressResolved");
 
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    subject.tell(
+                        new PeerAddressResolved("member-2", "akka://foobar"),
+                        getRef());
+
+                    expectNoMsg();
+                }
+
+
+            };
+        }};
+    }
 
-    private AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> noOpDataChangeListener() {
-        return new AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>() {
+    private AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> noOpDataChangeListener() {
+        return new AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>() {
             @Override
             public void onDataChanged(
-                AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
+                AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
 
             }
         };
index b07cbfd87ce268e3707064d81c2c5596af683af5..6330ad8acca33ab6c05f3263aa45ca459f0c283d 100644 (file)
@@ -27,30 +27,30 @@ public class ShardTransactionChainTest extends AbstractActorTest {
   @Test
   public void testOnReceiveCreateTransaction() throws Exception {
     new JavaTestKit(getSystem()) {{
-      final Props props = ShardTransactionChain.props(store.createTransactionChain());
+      final Props props = ShardTransactionChain.props(store.createTransactionChain(), TestModel.createTestContext());
       final ActorRef subject = getSystem().actorOf(props, "testCreateTransaction");
 
-      new Within(duration("1 seconds")) {
+     new Within(duration("1 seconds")) {
         protected void run() {
 
-          subject.tell(new CreateTransaction("txn-1"), getRef());
+          subject.tell(new CreateTransaction("txn-1").toSerializable(), getRef());
 
           final String out = new ExpectMsg<String>("match hint") {
             // do not put code outside this method, will run afterwards
             protected String match(Object in) {
-              if (in instanceof CreateTransactionReply) {
-                return ((CreateTransactionReply) in).getTransactionPath().toString();
-              } else {
+              if (in.getClass().equals(CreateTransactionReply.SERIALIZABLE_CLASS)) {
+                return CreateTransactionReply.fromSerializable(in).getTransactionPath();
+              }else{
                 throw noMatch();
               }
             }
           }.get(); // this extracts the received message
 
-            assertEquals("Unexpected transaction path " + out,
-                "akka://test/user/testCreateTransaction/shard-txn-1",
-                out);
+          assertEquals("Unexpected transaction path " + out,
+              "akka://test/user/testCreateTransaction/shard-txn-1",
+              out);
 
-            // Will wait for the rest of the 3 seconds
+          // Will wait for the rest of the 3 seconds
           expectNoMsg();
         }
 
@@ -62,18 +62,18 @@ public class ShardTransactionChainTest extends AbstractActorTest {
   @Test
   public void testOnReceiveCloseTransactionChain() throws Exception {
     new JavaTestKit(getSystem()) {{
-      final Props props = ShardTransactionChain.props(store.createTransactionChain());
+      final Props props = ShardTransactionChain.props(store.createTransactionChain(), TestModel.createTestContext());
       final ActorRef subject = getSystem().actorOf(props, "testCloseTransactionChain");
 
       new Within(duration("1 seconds")) {
         protected void run() {
 
-          subject.tell(new CloseTransactionChain(), getRef());
+          subject.tell(new CloseTransactionChain().toSerializable(), getRef());
 
           final String out = new ExpectMsg<String>("match hint") {
             // do not put code outside this method, will run afterwards
             protected String match(Object in) {
-              if (in instanceof CloseTransactionChainReply) {
+              if (in.getClass().equals(CloseTransactionChainReply.SERIALIZABLE_CLASS)) {
                 return "match";
               } else {
                 throw noMatch();
index 2d9ae93d9ee1d044b2809996b88d1183c16672f8..7884eeccdae7874f8d19c9090bf08d755cc991be 100644 (file)
@@ -26,8 +26,11 @@ import org.opendaylight.controller.cluster.datastore.modification.Modification;
 import org.opendaylight.controller.cluster.datastore.modification.WriteModification;
 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+import java.util.Collections;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -39,31 +42,33 @@ public class ShardTransactionTest extends AbstractActorTest {
     private static final InMemoryDOMDataStore store =
         new InMemoryDOMDataStore("OPER", storeExecutor);
 
+    private static final SchemaContext testSchemaContext = TestModel.createTestContext();
+
     static {
-        store.onGlobalContextUpdated(TestModel.createTestContext());
+        store.onGlobalContextUpdated(testSchemaContext);
     }
 
     @Test
     public void testOnReceiveReadData() throws Exception {
         new JavaTestKit(getSystem()) {{
-            final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+            final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
             final Props props =
-                ShardTransaction.props(store.newReadWriteTransaction(), shard);
+                ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext);
             final ActorRef subject = getSystem().actorOf(props, "testReadData");
 
             new Within(duration("1 seconds")) {
                 protected void run() {
 
                     subject.tell(
-                        new ReadData(InstanceIdentifier.builder().build()),
+                        new ReadData(YangInstanceIdentifier.builder().build()).toSerializable(),
                         getRef());
 
                     final String out = new ExpectMsg<String>("match hint") {
                         // do not put code outside this method, will run afterwards
                         protected String match(Object in) {
-                            if (in instanceof ReadDataReply) {
-                                if (((ReadDataReply) in).getNormalizedNode()
-                                    != null) {
+                            if (in.getClass().equals(ReadDataReply.SERIALIZABLE_CLASS)) {
+                              if (ReadDataReply.fromSerializable(testSchemaContext,YangInstanceIdentifier.builder().build(), in)
+                                  .getNormalizedNode()!= null) {
                                     return "match";
                                 }
                                 return null;
@@ -86,23 +91,24 @@ public class ShardTransactionTest extends AbstractActorTest {
     @Test
     public void testOnReceiveReadDataWhenDataNotFound() throws Exception {
         new JavaTestKit(getSystem()) {{
-            final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+            final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
             final Props props =
-                ShardTransaction.props(store.newReadWriteTransaction(), shard);
+                ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext);
             final ActorRef subject = getSystem().actorOf(props, "testReadDataWhenDataNotFound");
 
             new Within(duration("1 seconds")) {
                 protected void run() {
 
                     subject.tell(
-                        new ReadData(TestModel.TEST_PATH),
+                        new ReadData(TestModel.TEST_PATH).toSerializable(),
                         getRef());
 
                     final String out = new ExpectMsg<String>("match hint") {
                         // do not put code outside this method, will run afterwards
                         protected String match(Object in) {
-                            if (in instanceof ReadDataReply) {
-                                if (((ReadDataReply) in).getNormalizedNode()
+                            if (in.getClass().equals(ReadDataReply.SERIALIZABLE_CLASS)) {
+                                if (ReadDataReply.fromSerializable(testSchemaContext,TestModel.TEST_PATH, in)
+                                    .getNormalizedNode()
                                     == null) {
                                     return "match";
                                 }
@@ -159,9 +165,9 @@ public class ShardTransactionTest extends AbstractActorTest {
     @Test
     public void testOnReceiveWriteData() throws Exception {
         new JavaTestKit(getSystem()) {{
-            final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+            final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
             final Props props =
-                ShardTransaction.props(store.newReadWriteTransaction(), shard);
+                ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext());
             final ActorRef subject =
                 getSystem().actorOf(props, "testWriteData");
 
@@ -169,13 +175,13 @@ public class ShardTransactionTest extends AbstractActorTest {
                 protected void run() {
 
                     subject.tell(new WriteData(TestModel.TEST_PATH,
-                        ImmutableNodes.containerNode(TestModel.TEST_QNAME)),
+                        ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext()).toSerializable(),
                         getRef());
 
                     final String out = new ExpectMsg<String>("match hint") {
                         // do not put code outside this method, will run afterwards
                         protected String match(Object in) {
-                            if (in instanceof WriteDataReply) {
+                            if (in.getClass().equals(WriteDataReply.SERIALIZABLE_CLASS)) {
                                 return "match";
                             } else {
                                 throw noMatch();
@@ -197,9 +203,9 @@ public class ShardTransactionTest extends AbstractActorTest {
     @Test
     public void testOnReceiveMergeData() throws Exception {
         new JavaTestKit(getSystem()) {{
-            final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+            final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
             final Props props =
-                ShardTransaction.props(store.newReadWriteTransaction(), shard);
+                ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext);
             final ActorRef subject =
                 getSystem().actorOf(props, "testMergeData");
 
@@ -207,13 +213,13 @@ public class ShardTransactionTest extends AbstractActorTest {
                 protected void run() {
 
                     subject.tell(new MergeData(TestModel.TEST_PATH,
-                        ImmutableNodes.containerNode(TestModel.TEST_QNAME)),
+                        ImmutableNodes.containerNode(TestModel.TEST_QNAME), testSchemaContext).toSerializable(),
                         getRef());
 
-                    final String out = new ExpectMsg<String>("match hint") {
+                    final String out = new ExpectMsg<String>(duration("500 milliseconds"), "match hint") {
                         // do not put code outside this method, will run afterwards
                         protected String match(Object in) {
-                            if (in instanceof MergeDataReply) {
+                            if (in.getClass().equals(MergeDataReply.SERIALIZABLE_CLASS)) {
                                 return "match";
                             } else {
                                 throw noMatch();
@@ -236,21 +242,21 @@ public class ShardTransactionTest extends AbstractActorTest {
     @Test
     public void testOnReceiveDeleteData() throws Exception {
         new JavaTestKit(getSystem()) {{
-            final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+            final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
             final Props props =
-                ShardTransaction.props(store.newReadWriteTransaction(), shard);
+                ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext());
             final ActorRef subject =
                 getSystem().actorOf(props, "testDeleteData");
 
             new Within(duration("1 seconds")) {
                 protected void run() {
 
-                    subject.tell(new DeleteData(TestModel.TEST_PATH), getRef());
+                    subject.tell(new DeleteData(TestModel.TEST_PATH).toSerializable(), getRef());
 
                     final String out = new ExpectMsg<String>("match hint") {
                         // do not put code outside this method, will run afterwards
                         protected String match(Object in) {
-                            if (in instanceof DeleteDataReply) {
+                            if (in.getClass().equals(DeleteDataReply.SERIALIZABLE_CLASS)) {
                                 return "match";
                             } else {
                                 throw noMatch();
@@ -273,21 +279,21 @@ public class ShardTransactionTest extends AbstractActorTest {
     @Test
     public void testOnReceiveReadyTransaction() throws Exception {
         new JavaTestKit(getSystem()) {{
-            final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+            final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
             final Props props =
-                ShardTransaction.props(store.newReadWriteTransaction(), shard);
+                ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext());
             final ActorRef subject =
                 getSystem().actorOf(props, "testReadyTransaction");
 
             new Within(duration("1 seconds")) {
                 protected void run() {
 
-                    subject.tell(new ReadyTransaction(), getRef());
+                    subject.tell(new ReadyTransaction().toSerializable(), getRef());
 
                     final String out = new ExpectMsg<String>("match hint") {
                         // do not put code outside this method, will run afterwards
                         protected String match(Object in) {
-                            if (in instanceof ReadyTransactionReply) {
+                            if (in.getClass().equals(ReadyTransactionReply.SERIALIZABLE_CLASS)) {
                                 return "match";
                             } else {
                                 throw noMatch();
@@ -309,9 +315,9 @@ public class ShardTransactionTest extends AbstractActorTest {
     @Test
     public void testOnReceiveCloseTransaction() throws Exception {
         new JavaTestKit(getSystem()) {{
-            final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+            final ActorRef shard = getSystem().actorOf(Shard.props("config", Collections.EMPTY_MAP));
             final Props props =
-                ShardTransaction.props(store.newReadWriteTransaction(), shard);
+                ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext());
             final ActorRef subject =
                 getSystem().actorOf(props, "testCloseTransaction");
 
@@ -320,12 +326,12 @@ public class ShardTransactionTest extends AbstractActorTest {
             new Within(duration("2 seconds")) {
                 protected void run() {
 
-                    subject.tell(new CloseTransaction(), getRef());
+                    subject.tell(new CloseTransaction().toSerializable(), getRef());
 
                     final String out = new ExpectMsg<String>("match hint") {
                         // do not put code outside this method, will run afterwards
                         protected String match(Object in) {
-                            if (in instanceof CloseTransactionReply) {
+                            if (in.getClass().equals(CloseTransactionReply.SERIALIZABLE_CLASS)) {
                                 return "match";
                             } else {
                                 throw noMatch();
index 8ff785c8797eecb166c0381ab3e7a92980fa8396..992518e100a0381ab4c915128cc7975510bed2fc 100644 (file)
@@ -41,7 +41,7 @@ public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest {
 
     @Test
     public void testCanCommit() throws Exception {
-        actorContext.setExecuteRemoteOperationResponse(new CanCommitTransactionReply(true));
+        actorContext.setExecuteRemoteOperationResponse(new CanCommitTransactionReply(true).toSerializable());
 
         ListenableFuture<Boolean> future = proxy.canCommit();
 
@@ -51,7 +51,7 @@ public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest {
 
     @Test
     public void testPreCommit() throws Exception {
-        actorContext.setExecuteRemoteOperationResponse(new PreCommitTransactionReply());
+        actorContext.setExecuteRemoteOperationResponse(new PreCommitTransactionReply().toSerializable());
 
         ListenableFuture<Void> future = proxy.preCommit();
 
@@ -61,7 +61,7 @@ public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest {
 
     @Test
     public void testAbort() throws Exception {
-        actorContext.setExecuteRemoteOperationResponse(new AbortTransactionReply());
+        actorContext.setExecuteRemoteOperationResponse(new AbortTransactionReply().toSerializable());
 
         ListenableFuture<Void> future = proxy.abort();
 
@@ -71,7 +71,7 @@ public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest {
 
     @Test
     public void testCommit() throws Exception {
-        actorContext.setExecuteRemoteOperationResponse(new CommitTransactionReply());
+        actorContext.setExecuteRemoteOperationResponse(new CommitTransactionReply().toSerializable());
 
         ListenableFuture<Void> future = proxy.commit();
 
index a8df49f5ca4514ceb9ea1dfc25809cf789647150..f654e3aced738ef0c85a6400babe901d9c98d3ea 100644 (file)
@@ -5,19 +5,24 @@ import akka.actor.Props;
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.ListenableFuture;
 import junit.framework.Assert;
+import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction;
-import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
 import org.opendaylight.controller.cluster.datastore.messages.DeleteData;
 import org.opendaylight.controller.cluster.datastore.messages.MergeData;
+import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound;
 import org.opendaylight.controller.cluster.datastore.messages.ReadDataReply;
 import org.opendaylight.controller.cluster.datastore.messages.ReadyTransactionReply;
 import org.opendaylight.controller.cluster.datastore.messages.WriteData;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory;
 import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
 import org.opendaylight.controller.cluster.datastore.utils.DoNothingActor;
 import org.opendaylight.controller.cluster.datastore.utils.MessageCollectorActor;
 import org.opendaylight.controller.cluster.datastore.utils.MockActorContext;
+import org.opendaylight.controller.cluster.datastore.utils.MockClusterWrapper;
+import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration;
 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
+import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
@@ -28,21 +33,33 @@ import java.util.concurrent.Executors;
 
 public class TransactionProxyTest extends AbstractActorTest {
 
+    private final Configuration configuration = new MockConfiguration();
+
+    private final ActorContext testContext =
+        new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)), new MockClusterWrapper(), configuration );
+
     private ExecutorService transactionExecutor =
         Executors.newSingleThreadExecutor();
 
+    @Before
+    public void setUp(){
+        ShardStrategyFactory.setConfiguration(configuration);
+    }
+
     @Test
     public void testRead() throws Exception {
         final Props props = Props.create(DoNothingActor.class);
         final ActorRef actorRef = getSystem().actorOf(props);
 
         final MockActorContext actorContext = new MockActorContext(this.getSystem());
+        actorContext.setExecuteLocalOperationResponse(createPrimaryFound(actorRef));
         actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef));
         actorContext.setExecuteRemoteOperationResponse("message");
 
+
         TransactionProxy transactionProxy =
             new TransactionProxy(actorContext,
-                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor, TestModel.createTestContext());
 
 
         ListenableFuture<Optional<NormalizedNode<?, ?>>> read =
@@ -53,7 +70,7 @@ public class TransactionProxyTest extends AbstractActorTest {
         Assert.assertFalse(normalizedNodeOptional.isPresent());
 
         actorContext.setExecuteRemoteOperationResponse(new ReadDataReply(
-            ImmutableNodes.containerNode(TestModel.TEST_QNAME)));
+            TestModel.createTestContext(),ImmutableNodes.containerNode(TestModel.TEST_QNAME)).toSerializable());
 
         read = transactionProxy.read(TestModel.TEST_PATH);
 
@@ -68,12 +85,13 @@ public class TransactionProxyTest extends AbstractActorTest {
         final ActorRef actorRef = getSystem().actorOf(props);
 
         final MockActorContext actorContext = new MockActorContext(this.getSystem());
+        actorContext.setExecuteLocalOperationResponse(createPrimaryFound(actorRef));
         actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef));
         actorContext.setExecuteRemoteOperationResponse("message");
 
         TransactionProxy transactionProxy =
             new TransactionProxy(actorContext,
-                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor, TestModel.createTestContext());
 
 
         ListenableFuture<Optional<NormalizedNode<?, ?>>> read =
@@ -84,7 +102,7 @@ public class TransactionProxyTest extends AbstractActorTest {
         Assert.assertFalse(normalizedNodeOptional.isPresent());
 
         actorContext.setExecuteRemoteOperationResponse(new ReadDataReply(
-            null));
+           TestModel.createTestContext(), null).toSerializable());
 
         read = transactionProxy.read(TestModel.TEST_PATH);
 
@@ -99,17 +117,17 @@ public class TransactionProxyTest extends AbstractActorTest {
         final ActorRef actorRef = getSystem().actorOf(props);
 
         final MockActorContext actorContext = new MockActorContext(this.getSystem());
+        actorContext.setExecuteLocalOperationResponse(createPrimaryFound(actorRef));
         actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef));
         actorContext.setExecuteRemoteOperationResponse("message");
 
         TransactionProxy transactionProxy =
             new TransactionProxy(actorContext,
-                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor, TestModel.createTestContext());
 
         transactionProxy.write(TestModel.TEST_PATH,
             ImmutableNodes.containerNode(TestModel.NAME_QNAME));
 
-        ActorContext testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)));
         Object messages = testContext
             .executeLocalOperation(actorRef, "messages",
                 ActorContext.ASK_DURATION);
@@ -122,7 +140,11 @@ public class TransactionProxyTest extends AbstractActorTest {
 
         Assert.assertEquals(1, listMessages.size());
 
-        Assert.assertTrue(listMessages.get(0) instanceof WriteData);
+        Assert.assertEquals(WriteData.SERIALIZABLE_CLASS, listMessages.get(0).getClass());
+    }
+
+    private Object createPrimaryFound(ActorRef actorRef) {
+        return new PrimaryFound(actorRef.path().toString()).toSerializable();
     }
 
     @Test
@@ -131,17 +153,17 @@ public class TransactionProxyTest extends AbstractActorTest {
         final ActorRef actorRef = getSystem().actorOf(props);
 
         final MockActorContext actorContext = new MockActorContext(this.getSystem());
+        actorContext.setExecuteLocalOperationResponse(createPrimaryFound(actorRef));
         actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef));
         actorContext.setExecuteRemoteOperationResponse("message");
 
         TransactionProxy transactionProxy =
             new TransactionProxy(actorContext,
-                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor, TestModel.createTestContext());
 
         transactionProxy.merge(TestModel.TEST_PATH,
             ImmutableNodes.containerNode(TestModel.NAME_QNAME));
 
-        ActorContext testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)));
         Object messages = testContext
             .executeLocalOperation(actorRef, "messages",
                 ActorContext.ASK_DURATION);
@@ -154,7 +176,7 @@ public class TransactionProxyTest extends AbstractActorTest {
 
         Assert.assertEquals(1, listMessages.size());
 
-        Assert.assertTrue(listMessages.get(0) instanceof MergeData);
+        Assert.assertEquals(MergeData.SERIALIZABLE_CLASS, listMessages.get(0).getClass());
     }
 
     @Test
@@ -163,16 +185,16 @@ public class TransactionProxyTest extends AbstractActorTest {
         final ActorRef actorRef = getSystem().actorOf(props);
 
         final MockActorContext actorContext = new MockActorContext(this.getSystem());
+        actorContext.setExecuteLocalOperationResponse(createPrimaryFound(actorRef));
         actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef));
         actorContext.setExecuteRemoteOperationResponse("message");
 
         TransactionProxy transactionProxy =
             new TransactionProxy(actorContext,
-                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor, TestModel.createTestContext());
 
         transactionProxy.delete(TestModel.TEST_PATH);
 
-        ActorContext testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)));
         Object messages = testContext
             .executeLocalOperation(actorRef, "messages",
                 ActorContext.ASK_DURATION);
@@ -185,7 +207,7 @@ public class TransactionProxyTest extends AbstractActorTest {
 
         Assert.assertEquals(1, listMessages.size());
 
-        Assert.assertTrue(listMessages.get(0) instanceof DeleteData);
+        Assert.assertEquals(DeleteData.SERIALIZABLE_CLASS, listMessages.get(0).getClass());
     }
 
     @Test
@@ -194,14 +216,17 @@ public class TransactionProxyTest extends AbstractActorTest {
         final ActorRef doNothingActorRef = getSystem().actorOf(props);
 
         final MockActorContext actorContext = new MockActorContext(this.getSystem());
+        actorContext.setExecuteLocalOperationResponse(createPrimaryFound(doNothingActorRef));
         actorContext.setExecuteShardOperationResponse(createTransactionReply(doNothingActorRef));
-        actorContext.setExecuteRemoteOperationResponse(new ReadyTransactionReply(doNothingActorRef.path()));
+        actorContext.setExecuteRemoteOperationResponse(new ReadyTransactionReply(doNothingActorRef.path()).toSerializable());
 
         TransactionProxy transactionProxy =
             new TransactionProxy(actorContext,
-                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor, TestModel.createTestContext());
 
 
+        transactionProxy.read(TestModel.TEST_PATH);
+
         DOMStoreThreePhaseCommitCohort ready = transactionProxy.ready();
 
         Assert.assertTrue(ready instanceof ThreePhaseCommitCohortProxy);
@@ -222,7 +247,7 @@ public class TransactionProxyTest extends AbstractActorTest {
 
         TransactionProxy transactionProxy =
             new TransactionProxy(actorContext,
-                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor, TestModel.createTestContext());
 
         Assert.assertNotNull(transactionProxy.getIdentifier());
     }
@@ -233,16 +258,18 @@ public class TransactionProxyTest extends AbstractActorTest {
         final ActorRef actorRef = getSystem().actorOf(props);
 
         final MockActorContext actorContext = new MockActorContext(this.getSystem());
+        actorContext.setExecuteLocalOperationResponse(createPrimaryFound(actorRef));
         actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef));
         actorContext.setExecuteRemoteOperationResponse("message");
 
         TransactionProxy transactionProxy =
             new TransactionProxy(actorContext,
-                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor, TestModel.createTestContext());
+
+        transactionProxy.read(TestModel.TEST_PATH);
 
         transactionProxy.close();
 
-        ActorContext testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)));
         Object messages = testContext
             .executeLocalOperation(actorRef, "messages",
                 ActorContext.ASK_DURATION);
@@ -255,10 +282,13 @@ public class TransactionProxyTest extends AbstractActorTest {
 
         Assert.assertEquals(1, listMessages.size());
 
-        Assert.assertTrue(listMessages.get(0) instanceof CloseTransaction);
+        Assert.assertTrue(listMessages.get(0).getClass().equals(CloseTransaction.SERIALIZABLE_CLASS));
     }
 
     private CreateTransactionReply createTransactionReply(ActorRef actorRef){
-        return new CreateTransactionReply(actorRef.path(), "txn-1");
+        return CreateTransactionReply.newBuilder()
+            .setTransactionActorPath(actorRef.path().toString())
+            .setTransactionId("txn-1")
+            .build();
     }
 }
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStatsTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStatsTest.java
new file mode 100644 (file)
index 0000000..f7c4676
--- /dev/null
@@ -0,0 +1,55 @@
+package org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.jmx.mbeans.AbstractBaseMBean;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+public class ShardStatsTest {
+  private MBeanServer mbeanServer;
+ private  ShardStats  shardStats;
+  private ObjectName testMBeanName;
+
+  @Before
+  public void setUp() throws Exception {
+
+    shardStats = new ShardStats("shard-1");
+    shardStats.registerMBean();
+    mbeanServer= shardStats.getMBeanServer();
+    String objectName = AbstractBaseMBean.BASE_JMX_PREFIX + "type="+shardStats.getMBeanType()+",Category="+
+        shardStats.getMBeanCategory() + ",name="+
+        shardStats.getMBeanName();
+    testMBeanName = new ObjectName(objectName);
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    shardStats.unregisterMBean();
+  }
+
+  @Test
+  public void testGetShardName() throws Exception {
+
+    Object attribute = mbeanServer.getAttribute(testMBeanName,"ShardName");
+    Assert.assertEquals((String) attribute, "shard-1");
+
+  }
+
+  @Test
+  public void testGetCommittedTransactionsCount() throws Exception {
+    //let us increment some transactions count and then check
+    shardStats.incrementCommittedTransactionCount();
+    shardStats.incrementCommittedTransactionCount();
+    shardStats.incrementCommittedTransactionCount();
+
+    //now let us get from MBeanServer what is the transaction count.
+    Object attribute = mbeanServer.getAttribute(testMBeanName,"CommittedTransactionsCount");
+    Assert.assertEquals((Long) attribute, (Long)3L);
+
+
+  }
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/MergeDataTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/MergeDataTest.java
new file mode 100644 (file)
index 0000000..75128e6
--- /dev/null
@@ -0,0 +1,47 @@
+package org.opendaylight.controller.cluster.datastore.messages;
+
+import junit.framework.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
+import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+
+public class MergeDataTest {
+
+    @Test
+    public void testBasic(){
+        MergeData mergeData = new MergeData(TestModel.TEST_PATH, ImmutableNodes
+            .containerNode(TestModel.TEST_QNAME),
+            TestModel.createTestContext());
+
+        MergeData output = MergeData
+            .fromSerializable(mergeData.toSerializable(),
+                TestModel.createTestContext());
+
+    }
+
+    @Test
+    public void testNormalizedNodeEncodeDecode(){
+        NormalizedNode<?, ?> expected =
+            ImmutableNodes.containerNode(TestModel.TEST_QNAME);
+
+
+        NormalizedNodeMessages.Container node =
+            new NormalizedNodeToNodeCodec(TestModel.createTestContext())
+                .encode(TestModel.TEST_PATH,
+                    expected);
+
+        String parentPath = node.getParentPath();
+
+        NormalizedNodeMessages.Node normalizedNode =
+            node.getNormalizedNode();
+
+        NormalizedNode<?,?> actual = new NormalizedNodeToNodeCodec(TestModel.createTestContext()).decode(TestModel.TEST_PATH,
+            normalizedNode);
+
+
+        Assert.assertEquals(expected, actual);
+    }
+}
index efaca5d4f6f3d583aec500b683909b8c28d245b8..d9c550a6db482d39855dc5a48ebb26b2fec8c6ad 100644 (file)
@@ -17,7 +17,7 @@ import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 public abstract class AbstractModificationTest {
@@ -36,7 +36,7 @@ public abstract class AbstractModificationTest {
     cohort.commit();
   }
 
-  protected Optional<NormalizedNode<?,?>> readData(InstanceIdentifier path) throws Exception{
+  protected Optional<NormalizedNode<?,?>> readData(YangInstanceIdentifier path) throws Exception{
     DOMStoreReadTransaction transaction = store.newReadOnlyTransaction();
     ListenableFuture<Optional<NormalizedNode<?, ?>>> future = transaction.read(path);
     return future.get();
index c1f9f3a631765f9437c8db4d15aaf6a85b9b038c..b33f902929a470eae42bb51f19718a5846d7c5e4 100644 (file)
@@ -15,7 +15,7 @@ public class DeleteModificationTest extends AbstractModificationTest{
   public void testApply() throws Exception {
     //Write something into the datastore
     DOMStoreReadWriteTransaction writeTransaction = store.newReadWriteTransaction();
-    WriteModification writeModification = new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
+    WriteModification writeModification = new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext());
     writeModification.apply(writeTransaction);
     commitTransaction(writeTransaction);
 
@@ -32,4 +32,4 @@ public class DeleteModificationTest extends AbstractModificationTest{
     data = readData(TestModel.TEST_PATH);
     Assert.assertFalse(data.isPresent());
   }
-}
\ No newline at end of file
+}
index fd125fb79d8be2bc7fa85e31a914cf6d4c0a2dd3..9af3439ae196d95ca55148465d02b7beb8b9e5a6 100644 (file)
@@ -16,7 +16,7 @@ public class MergeModificationTest extends AbstractModificationTest{
 
     //Write something into the datastore
     DOMStoreReadWriteTransaction writeTransaction = store.newReadWriteTransaction();
-    MergeModification writeModification = new MergeModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
+    MergeModification writeModification = new MergeModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext());
     writeModification.apply(writeTransaction);
     commitTransaction(writeTransaction);
 
@@ -25,4 +25,4 @@ public class MergeModificationTest extends AbstractModificationTest{
     Assert.assertTrue(data.isPresent());
 
   }
-}
\ No newline at end of file
+}
index e30936b3272da5e5cfb975dd803bf3ea241213db..7a21c8cdc5eea9ea208c651286423c63b107a13b 100644 (file)
@@ -14,7 +14,7 @@ public class MutableCompositeModificationTest extends AbstractModificationTest {
   public void testApply() throws Exception {
 
     MutableCompositeModification compositeModification = new MutableCompositeModification();
-    compositeModification.addModification(new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME)));
+    compositeModification.addModification(new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext()));
 
     DOMStoreReadWriteTransaction transaction = store.newReadWriteTransaction();
     compositeModification.apply(transaction);
@@ -25,4 +25,4 @@ public class MutableCompositeModificationTest extends AbstractModificationTest {
     Assert.assertNotNull(data.get());
     Assert.assertEquals(TestModel.TEST_QNAME, data.get().getNodeType());
   }
-}
\ No newline at end of file
+}
index e206bf8196e034d0fdd4d3cb77207de41380e97e..75d8c00db8bb2c54bf7ab433c118d9a867914980 100644 (file)
@@ -14,7 +14,7 @@ public class WriteModificationTest extends AbstractModificationTest{
   public void testApply() throws Exception {
     //Write something into the datastore
     DOMStoreReadWriteTransaction writeTransaction = store.newReadWriteTransaction();
-    WriteModification writeModification = new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
+    WriteModification writeModification = new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext());
     writeModification.apply(writeTransaction);
     commitTransaction(writeTransaction);
 
@@ -23,4 +23,4 @@ public class WriteModificationTest extends AbstractModificationTest{
     Assert.assertTrue(data.isPresent());
 
   }
-}
\ No newline at end of file
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ModuleShardStrategyTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ModuleShardStrategyTest.java
new file mode 100644 (file)
index 0000000..88753e4
--- /dev/null
@@ -0,0 +1,33 @@
+package org.opendaylight.controller.cluster.datastore.shardstrategy;
+
+import junit.framework.Assert;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.opendaylight.controller.cluster.datastore.Configuration;
+import org.opendaylight.controller.cluster.datastore.ConfigurationImpl;
+import org.opendaylight.controller.md.cluster.datastore.model.CarsModel;
+
+public class ModuleShardStrategyTest {
+    @Rule
+    public ExpectedException expectedEx = ExpectedException.none();
+
+    private static Configuration configuration;
+
+    @BeforeClass
+    public static void setUpClass(){
+        configuration = new ConfigurationImpl("module-shards.conf", "modules.conf");
+    }
+
+
+    @Test
+    public void testFindShard() throws Exception {
+        ModuleShardStrategy moduleShardStrategy =
+            new ModuleShardStrategy("cars", configuration);
+
+        String shard = moduleShardStrategy.findShard(CarsModel.BASE_PATH);
+
+        Assert.assertEquals("cars-1", shard);
+    }
+}
index 2cff981b680f99de9855db40ed68bd49ed23a2fb..ab74ba811a6348c4969a2408644b0e48502af076 100644 (file)
@@ -1,29 +1,49 @@
 package org.opendaylight.controller.cluster.datastore.shardstrategy;
 
+import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
+import org.opendaylight.controller.cluster.datastore.ConfigurationImpl;
+import org.opendaylight.controller.md.cluster.datastore.model.CarsModel;
 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
 
 public class ShardStrategyFactoryTest {
 
-  @Rule
-  public ExpectedException expectedEx = ExpectedException.none();
+    @Rule
+    public ExpectedException expectedEx = ExpectedException.none();
 
-  @Test
-  public void testGetStrategy(){
-    ShardStrategy strategy = ShardStrategyFactory.getStrategy(TestModel.TEST_PATH);
-    assertNotNull(strategy);
-  }
+    @BeforeClass
+    public static void setUpClass(){
+        ShardStrategyFactory.setConfiguration(new ConfigurationImpl("module-shards.conf", "modules.conf"));
+    }
 
-  @Test
-  public void testGetStrategyNullPointerExceptionWhenPathIsNull(){
-    expectedEx.expect(NullPointerException.class);
-    expectedEx.expectMessage("path should not be null");
+    @Test
+    public void testGetStrategy() {
+        ShardStrategy strategy =
+            ShardStrategyFactory.getStrategy(TestModel.TEST_PATH);
+        assertNotNull(strategy);
+    }
 
-    ShardStrategyFactory.getStrategy(null);
-  }
+    @Test
+    public void testGetStrategyForKnownModuleName() {
+        ShardStrategy strategy =
+            ShardStrategyFactory.getStrategy(
+                YangInstanceIdentifier.of(CarsModel.BASE_QNAME));
+        assertTrue(strategy instanceof ModuleShardStrategy);
+    }
 
-}
\ No newline at end of file
+
+    @Test
+    public void testGetStrategyNullPointerExceptionWhenPathIsNull() {
+        expectedEx.expect(NullPointerException.class);
+        expectedEx.expectMessage("path should not be null");
+
+        ShardStrategyFactory.getStrategy(null);
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java
new file mode 100644 (file)
index 0000000..3dd0214
--- /dev/null
@@ -0,0 +1,47 @@
+package org.opendaylight.controller.cluster.datastore.utils;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSystem;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.AbstractActorTest;
+import org.opendaylight.controller.cluster.datastore.ClusterWrapper;
+import org.opendaylight.controller.cluster.datastore.Configuration;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+
+public class ActorContextTest extends AbstractActorTest{
+    @Test
+    public void testResolvePathForRemoteActor(){
+        ActorContext actorContext =
+            new ActorContext(mock(ActorSystem.class), mock(ActorRef.class),mock(
+                ClusterWrapper.class),
+                mock(Configuration.class));
+
+        String actual = actorContext.resolvePath(
+            "akka.tcp://system@127.0.0.1:2550/user/shardmanager/shard",
+            "akka://system/user/shardmanager/shard/transaction");
+
+        String expected = "akka.tcp://system@127.0.0.1:2550/user/shardmanager/shard/transaction";
+
+        assertEquals(expected, actual);
+    }
+
+    @Test
+    public void testResolvePathForLocalActor(){
+        ActorContext actorContext =
+            new ActorContext(getSystem(), mock(ActorRef.class), mock(ClusterWrapper.class),
+                mock(Configuration.class));
+
+        String actual = actorContext.resolvePath(
+            "akka://system/user/shardmanager/shard",
+            "akka://system/user/shardmanager/shard/transaction");
+
+        String expected = "akka://system/user/shardmanager/shard/transaction";
+
+        assertEquals(expected, actual);
+
+        System.out.println(actorContext
+            .actorFor("akka://system/user/shardmanager/shard/transaction"));
+    }
+}
index fe62516098253c8dbe9f19424854578c1fe0120f..1d1e6614886e32d5593112375cbefaab0a9c1507 100644 (file)
@@ -21,11 +21,11 @@ public class MockActorContext extends ActorContext {
     private Object executeLocalOperationResponse;
 
     public MockActorContext(ActorSystem actorSystem) {
-        super(actorSystem, null);
+        super(actorSystem, null, new MockClusterWrapper(), new MockConfiguration());
     }
 
     public MockActorContext(ActorSystem actorSystem, ActorRef shardManager) {
-        super(actorSystem, shardManager);
+        super(actorSystem, shardManager, new MockClusterWrapper(), new MockConfiguration());
     }
 
 
@@ -56,5 +56,8 @@ public class MockActorContext extends ActorContext {
         this.executeLocalOperationResponse = executeLocalOperationResponse;
     }
 
-
+    @Override public Object executeLocalOperation(ActorRef actor,
+        Object message, FiniteDuration duration) {
+        return this.executeLocalOperationResponse;
+    }
 }
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockClusterWrapper.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockClusterWrapper.java
new file mode 100644 (file)
index 0000000..803aa03
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * 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.utils;
+
+import akka.actor.ActorRef;
+import akka.actor.AddressFromURIString;
+import akka.cluster.ClusterEvent;
+import akka.cluster.MemberStatus;
+import akka.cluster.UniqueAddress;
+import org.opendaylight.controller.cluster.datastore.ClusterWrapper;
+import scala.collection.JavaConversions;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class MockClusterWrapper implements ClusterWrapper{
+
+    @Override public void subscribeToMemberEvents(ActorRef actorRef) {
+    }
+
+    @Override public String getCurrentMemberName() {
+        return "member-1";
+    }
+
+    public static void sendMemberUp(ActorRef to, String memberName, String address){
+        to.tell(createMemberUp(memberName, address), null);
+    }
+
+    public static void sendMemberRemoved(ActorRef to, String memberName, String address){
+        to.tell(createMemberRemoved(memberName, address), null);
+    }
+
+    private static ClusterEvent.MemberRemoved createMemberRemoved(String memberName, String address) {
+        akka.cluster.UniqueAddress uniqueAddress = new UniqueAddress(
+            AddressFromURIString.parse(address), 55);
+
+        Set<String> roles = new HashSet<>();
+
+        roles.add(memberName);
+
+        akka.cluster.Member member = new akka.cluster.Member(uniqueAddress, 1, MemberStatus
+            .removed(),
+            JavaConversions.asScalaSet(roles).<String>toSet());
+
+        return new ClusterEvent.MemberRemoved(member, MemberStatus.up());
+
+    }
+
+
+    private static ClusterEvent.MemberUp createMemberUp(String memberName, String address) {
+        akka.cluster.UniqueAddress uniqueAddress = new UniqueAddress(
+            AddressFromURIString.parse(address), 55);
+
+        Set<String> roles = new HashSet<>();
+
+        roles.add(memberName);
+
+        akka.cluster.Member member = new akka.cluster.Member(uniqueAddress, 1, MemberStatus.up(),
+            JavaConversions.asScalaSet(roles).<String>toSet());
+
+        return new ClusterEvent.MemberUp(member);
+    }
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockConfiguration.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockConfiguration.java
new file mode 100644 (file)
index 0000000..8d49c6f
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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.utils;
+
+import com.google.common.base.Optional;
+import org.opendaylight.controller.cluster.datastore.Configuration;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+public class MockConfiguration implements Configuration{
+    @Override public List<String> getMemberShardNames(String memberName) {
+        return Arrays.asList("default");
+    }
+
+    @Override public Optional<String> getModuleNameFromNameSpace(
+        String nameSpace) {
+        return Optional.absent();
+    }
+
+    @Override
+    public Map<String, ShardStrategy> getModuleNameToShardStrategyMap() {
+        return Collections.EMPTY_MAP;
+    }
+
+    @Override public List<String> getShardNamesFromModuleName(
+        String moduleName) {
+        return Collections.EMPTY_LIST;
+    }
+
+    @Override public List<String> getMembersFromShardName(String shardName) {
+        if("default".equals(shardName)) {
+            return Arrays.asList("member-1", "member-2");
+        } else if("astronauts".equals(shardName)){
+            return Arrays.asList("member-2", "member-3");
+        }
+
+        return Collections.EMPTY_LIST;
+    }
+}
index bb881d532263384a5828fdd5ec31b32040835242..939096e7f306c7c6d3f0b131fa0880f6374fa274 100644 (file)
@@ -19,7 +19,7 @@ public class TestUtils {
 
     public static void assertFirstSentMessage(ActorSystem actorSystem, ActorRef actorRef, Class clazz){
         ActorContext testContext = new ActorContext(actorSystem, actorSystem.actorOf(
-            Props.create(DoNothingActor.class)));
+            Props.create(DoNothingActor.class)), new MockClusterWrapper(), new MockConfiguration());
         Object messages = testContext
             .executeLocalOperation(actorRef, "messages",
                 ActorContext.ASK_DURATION);
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CarsModel.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CarsModel.java
new file mode 100644 (file)
index 0000000..6860872
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * 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.cluster.datastore.model;
+
+import java.math.BigInteger;
+import org.opendaylight.yangtools.yang.common.QName;
+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.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder;
+
+public class CarsModel {
+    public static final QName BASE_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:cars", "2014-03-13",
+        "cars");
+
+    public static final YangInstanceIdentifier BASE_PATH = YangInstanceIdentifier.of(BASE_QNAME);
+
+    public static final QName CARS_QNAME = QName.create(BASE_QNAME, "cars");
+    public static final QName CAR_QNAME = QName.create(CARS_QNAME, "car");
+    public static final QName CAR_NAME_QNAME = QName.create(CAR_QNAME, "name");
+    public static final QName CAR_PRICE_QNAME = QName.create(CAR_QNAME, "price");
+
+
+    public static NormalizedNode create(){
+
+        // Create a list builder
+        CollectionNodeBuilder<MapEntryNode, MapNode> cars =
+            ImmutableMapNodeBuilder.create().withNodeIdentifier(
+                new YangInstanceIdentifier.NodeIdentifier(
+                    CAR_QNAME));
+
+        // Create an entry for the car altima
+        MapEntryNode altima =
+            ImmutableNodes.mapEntryBuilder(CAR_QNAME, CAR_NAME_QNAME, "altima")
+                .withChild(ImmutableNodes.leafNode(CAR_NAME_QNAME, "altima"))
+                .withChild(ImmutableNodes.leafNode(CAR_PRICE_QNAME, new BigInteger("1000")))
+                .build();
+
+        // Create an entry for the car accord
+        MapEntryNode honda =
+            ImmutableNodes.mapEntryBuilder(CAR_QNAME, CAR_NAME_QNAME, "accord")
+                .withChild(ImmutableNodes.leafNode(CAR_NAME_QNAME, "accord"))
+                .withChild(ImmutableNodes.leafNode(CAR_PRICE_QNAME, new BigInteger("2000")))
+                .build();
+
+        cars.withChild(altima);
+        cars.withChild(honda);
+
+        return ImmutableContainerNodeBuilder.create()
+            .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(BASE_QNAME))
+            .withChild(cars.build())
+            .build();
+
+    }
+
+    public static NormalizedNode emptyContainer(){
+        return ImmutableContainerNodeBuilder.create()
+            .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(BASE_QNAME))
+            .build();
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CompositeModel.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CompositeModel.java
new file mode 100644 (file)
index 0000000..ece3127
--- /dev/null
@@ -0,0 +1,372 @@
+package org.opendaylight.controller.md.cluster.datastore.model;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
+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.schema.Builders;
+import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+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.api.DataContainerNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetEntryNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetNodeBuilder;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntry;
+import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntryBuilder;
+import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapNodeBuilder;
+
+public class CompositeModel {
+
+  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 AUG_QNAME = QName.create(
+      "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug",
+      "2014-03-13", "name");
+
+  public static final QName DESC_QNAME = QName.create(TEST_QNAME, "desc");
+  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");
+  public static final QName ID_QNAME = QName.create(TEST_QNAME, "id");
+  public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
+  public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
+  private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
+  private static final String DATASTORE_AUG_YANG =
+      "/odl-datastore-augmentation.yang";
+  private static final String DATASTORE_TEST_NOTIFICATION_YANG =
+      "/odl-datastore-test-notification.yang";
+
+
+  public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier
+      .of(TEST_QNAME);
+  public static final YangInstanceIdentifier DESC_PATH = YangInstanceIdentifier
+      .builder(TEST_PATH).node(DESC_QNAME).build();
+  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");
+
+  private static final Integer ONE_ID = 1;
+  private static final Integer TWO_ID = 2;
+  private static final String TWO_ONE_NAME = "one";
+  private static final String TWO_TWO_NAME = "two";
+  private static final String DESC = "Hello there";
+
+  // Family specific constants
+  public static final QName FAMILY_QNAME =
+      QName
+          .create(
+              "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test",
+              "2014-04-17", "family");
+  public static final QName CHILDREN_QNAME = QName.create(FAMILY_QNAME,
+      "children");
+  public static final QName GRAND_CHILDREN_QNAME = QName.create(FAMILY_QNAME,
+      "grand-children");
+  public static final QName CHILD_NUMBER_QNAME = QName.create(FAMILY_QNAME,
+      "child-number");
+  public static final QName CHILD_NAME_QNAME = QName.create(FAMILY_QNAME,
+      "child-name");
+  public static final QName GRAND_CHILD_NUMBER_QNAME = QName.create(
+      FAMILY_QNAME, "grand-child-number");
+  public static final QName GRAND_CHILD_NAME_QNAME = QName.create(FAMILY_QNAME,
+      "grand-child-name");
+
+  public static final YangInstanceIdentifier FAMILY_PATH = YangInstanceIdentifier
+      .of(FAMILY_QNAME);
+  public static final YangInstanceIdentifier FAMILY_DESC_PATH = YangInstanceIdentifier
+      .builder(FAMILY_PATH).node(DESC_QNAME).build();
+  public static final YangInstanceIdentifier CHILDREN_PATH = YangInstanceIdentifier
+      .builder(FAMILY_PATH).node(CHILDREN_QNAME).build();
+
+  private static final Integer FIRST_CHILD_ID = 1;
+  private static final Integer SECOND_CHILD_ID = 2;
+
+  private static final String FIRST_CHILD_NAME = "first child";
+  private static final String SECOND_CHILD_NAME = "second child";
+
+  private static final Integer FIRST_GRAND_CHILD_ID = 1;
+  private static final Integer SECOND_GRAND_CHILD_ID = 2;
+
+  private static final String FIRST_GRAND_CHILD_NAME = "first grand child";
+  private static final String SECOND_GRAND_CHILD_NAME = "second grand child";
+
+  // first child
+  private static final YangInstanceIdentifier CHILDREN_1_PATH = YangInstanceIdentifier
+      .builder(CHILDREN_PATH)
+      .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID) //
+      .build();
+  private static final YangInstanceIdentifier CHILDREN_1_NAME_PATH =
+      YangInstanceIdentifier.builder(CHILDREN_PATH)
+          .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, FIRST_CHILD_NAME) //
+          .build();
+
+  private static final YangInstanceIdentifier CHILDREN_2_PATH = YangInstanceIdentifier
+      .builder(CHILDREN_PATH)
+      .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID) //
+      .build();
+  private static final YangInstanceIdentifier CHILDREN_2_NAME_PATH =
+      YangInstanceIdentifier.builder(CHILDREN_PATH)
+          .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, SECOND_CHILD_NAME) //
+          .build();
+
+
+  private static final YangInstanceIdentifier GRAND_CHILD_1_PATH =
+      YangInstanceIdentifier.builder(CHILDREN_1_PATH)
+          .node(GRAND_CHILDREN_QNAME)
+          //
+          .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+              FIRST_GRAND_CHILD_ID) //
+          .build();
+
+  private static final YangInstanceIdentifier GRAND_CHILD_1_NAME_PATH =
+      YangInstanceIdentifier.builder(CHILDREN_1_PATH)
+          .node(GRAND_CHILDREN_QNAME)
+          //
+          .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME,
+              FIRST_GRAND_CHILD_NAME) //
+          .build();
+
+  private static final YangInstanceIdentifier GRAND_CHILD_2_PATH =
+      YangInstanceIdentifier.builder(CHILDREN_2_PATH)
+          .node(GRAND_CHILDREN_QNAME)
+          //
+          .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+              SECOND_GRAND_CHILD_ID) //
+          .build();
+
+  private static final YangInstanceIdentifier GRAND_CHILD_2_NAME_PATH =
+      YangInstanceIdentifier.builder(CHILDREN_2_PATH)
+          .node(GRAND_CHILDREN_QNAME)
+          //
+          .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME,
+              SECOND_GRAND_CHILD_NAME) //
+          .build();
+
+  private static final YangInstanceIdentifier DESC_PATH_ID = YangInstanceIdentifier
+      .builder(DESC_PATH).build();
+  private static final YangInstanceIdentifier OUTER_LIST_1_PATH =
+      YangInstanceIdentifier.builder(OUTER_LIST_PATH)
+          .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, ONE_ID) //
+          .build();
+
+  private static final YangInstanceIdentifier OUTER_LIST_2_PATH =
+      YangInstanceIdentifier.builder(OUTER_LIST_PATH)
+          .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
+          .build();
+
+  private static final YangInstanceIdentifier TWO_TWO_PATH = YangInstanceIdentifier
+      .builder(OUTER_LIST_2_PATH).node(INNER_LIST_QNAME) //
+      .nodeWithKey(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME) //
+      .build();
+
+  private static final YangInstanceIdentifier TWO_TWO_VALUE_PATH =
+      YangInstanceIdentifier.builder(TWO_TWO_PATH).node(VALUE_QNAME) //
+          .build();
+
+  private static final MapEntryNode BAR_NODE = mapEntryBuilder(
+      OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
+      .withChild(mapNodeBuilder(INNER_LIST_QNAME) //
+          .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_ONE_NAME)) //
+          .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME)) //
+          .build()) //
+      .build();
+
+  public static final InputStream getDatastoreTestInputStream() {
+    return getInputStream(DATASTORE_TEST_YANG);
+  }
+
+  public static final InputStream getDatastoreAugInputStream() {
+    return getInputStream(DATASTORE_AUG_YANG);
+  }
+
+  public static final InputStream getDatastoreTestNotificationInputStream() {
+    return getInputStream(DATASTORE_TEST_NOTIFICATION_YANG);
+  }
+
+  private static InputStream getInputStream(final String resourceName) {
+    return TestModel.class.getResourceAsStream(resourceName);
+  }
+
+  public static SchemaContext createTestContext() {
+    List<InputStream> inputStreams = new ArrayList<>();
+    inputStreams.add(getDatastoreTestInputStream());
+    inputStreams.add(getDatastoreAugInputStream());
+    inputStreams.add(getDatastoreTestNotificationInputStream());
+
+    YangParserImpl parser = new YangParserImpl();
+    Set<Module> modules = parser.parseYangModelsFromStreams(inputStreams);
+    return parser.resolveSchemaContext(modules);
+  }
+
+  /**
+   * Returns a test document
+   *
+   * <pre>
+   * test
+   *     outer-list
+   *          id 1
+   *     outer-list
+   *          id 2
+   *          inner-list
+   *                  name "one"
+   *          inner-list
+   *                  name "two"
+   *
+   * </pre>
+   *
+   * @return
+   */
+  public static NormalizedNode<?, ?> createDocumentOne(
+      SchemaContext schemaContext) {
+    return ImmutableContainerNodeBuilder
+        .create()
+        .withNodeIdentifier(
+            new YangInstanceIdentifier.NodeIdentifier(schemaContext.getQName()))
+        .withChild(createTestContainer()).build();
+
+  }
+
+  public static ContainerNode createTestContainer() {
+
+
+    final LeafSetEntryNode<Object> nike =
+        ImmutableLeafSetEntryNodeBuilder
+            .create()
+            .withNodeIdentifier(
+                new YangInstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME,
+                    "shoe"), "nike")).withValue("nike").build();
+    final LeafSetEntryNode<Object> puma =
+        ImmutableLeafSetEntryNodeBuilder
+            .create()
+            .withNodeIdentifier(
+                new YangInstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME,
+                    "shoe"), "puma")).withValue("puma").build();
+    final LeafSetNode<Object> shoes =
+        ImmutableLeafSetNodeBuilder
+            .create()
+            .withNodeIdentifier(
+                new YangInstanceIdentifier.NodeIdentifier(QName.create(TEST_QNAME,
+                    "shoe"))).withChild(nike).withChild(puma).build();
+
+
+    final LeafSetEntryNode<Object> five =
+        ImmutableLeafSetEntryNodeBuilder
+            .create()
+            .withNodeIdentifier(
+                (new YangInstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME,
+                    "number"), 5))).withValue(5).build();
+    final LeafSetEntryNode<Object> fifteen =
+        ImmutableLeafSetEntryNodeBuilder
+            .create()
+            .withNodeIdentifier(
+                (new YangInstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME,
+                    "number"), 15))).withValue(15).build();
+    final LeafSetNode<Object> numbers =
+        ImmutableLeafSetNodeBuilder
+            .create()
+            .withNodeIdentifier(
+                new YangInstanceIdentifier.NodeIdentifier(QName.create(TEST_QNAME,
+                    "number"))).withChild(five).withChild(fifteen).build();
+
+
+    Set<QName> childAugmentations = new HashSet<>();
+    childAugmentations.add(AUG_QNAME);
+    final YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier =
+        new YangInstanceIdentifier.AugmentationIdentifier(null, childAugmentations);
+    final AugmentationNode augmentationNode =
+        Builders.augmentationBuilder()
+            .withNodeIdentifier(augmentationIdentifier)
+            .withChild(ImmutableNodes.leafNode(AUG_QNAME, "First Test"))
+            .build();
+    return ImmutableContainerNodeBuilder
+        .create()
+        .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME))
+        .withChild(ImmutableNodes.leafNode(DESC_QNAME, DESC))
+        .withChild(augmentationNode)
+        .withChild(shoes)
+        .withChild(numbers)
+        .withChild(
+            mapNodeBuilder(OUTER_LIST_QNAME)
+                .withChild(mapEntry(OUTER_LIST_QNAME, ID_QNAME, ONE_ID))
+                .withChild(BAR_NODE).build()).build();
+
+  }
+
+
+  public static ContainerNode createFamily() {
+    final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> familyContainerBuilder =
+        ImmutableContainerNodeBuilder.create().withNodeIdentifier(
+            new YangInstanceIdentifier.NodeIdentifier(FAMILY_QNAME));
+
+    final CollectionNodeBuilder<MapEntryNode, MapNode> childrenBuilder =
+        mapNodeBuilder(CHILDREN_QNAME);
+
+    final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> firstChildBuilder =
+        mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID);
+    final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> secondChildBuilder =
+        mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID);
+
+    final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> firstGrandChildBuilder =
+        mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+            FIRST_GRAND_CHILD_ID);
+    final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> secondGrandChildBuilder =
+        mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+            SECOND_GRAND_CHILD_ID);
+
+    firstGrandChildBuilder
+        .withChild(
+            ImmutableNodes.leafNode(GRAND_CHILD_NUMBER_QNAME,
+                FIRST_GRAND_CHILD_ID)).withChild(
+        ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
+            FIRST_GRAND_CHILD_NAME));
+
+    secondGrandChildBuilder.withChild(
+        ImmutableNodes
+            .leafNode(GRAND_CHILD_NUMBER_QNAME, SECOND_GRAND_CHILD_ID))
+        .withChild(
+            ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
+                SECOND_GRAND_CHILD_NAME));
+
+    firstChildBuilder
+        .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, FIRST_CHILD_ID))
+        .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, FIRST_CHILD_NAME))
+        .withChild(
+            mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
+                firstGrandChildBuilder.build()).build());
+
+
+    secondChildBuilder
+        .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, SECOND_CHILD_ID))
+        .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, SECOND_CHILD_NAME))
+        .withChild(
+            mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
+                firstGrandChildBuilder.build()).build());
+
+    childrenBuilder.withChild(firstChildBuilder.build());
+    childrenBuilder.withChild(secondChildBuilder.build());
+
+    return familyContainerBuilder.withChild(childrenBuilder.build()).build();
+  }
+
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/PeopleModel.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/PeopleModel.java
new file mode 100644 (file)
index 0000000..e637920
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * 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.cluster.datastore.model;
+
+import org.opendaylight.yangtools.yang.common.QName;
+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.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder;
+
+public class PeopleModel {
+    public static final QName BASE_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:people", "2014-03-13",
+        "people");
+
+    public static final YangInstanceIdentifier BASE_PATH = YangInstanceIdentifier.of(BASE_QNAME);
+    public static final QName PEOPLE_QNAME = QName.create(BASE_QNAME, "people");
+    public static final QName PERSON_QNAME = QName.create(PEOPLE_QNAME, "person");
+    public static final QName PERSON_NAME_QNAME = QName.create(PERSON_QNAME, "name");
+    public static final QName PERSON_AGE_QNAME = QName.create(PERSON_QNAME, "age");
+
+
+
+    public static NormalizedNode create(){
+
+        // Create a list builder
+        CollectionNodeBuilder<MapEntryNode, MapNode> cars =
+            ImmutableMapNodeBuilder.create().withNodeIdentifier(
+                new YangInstanceIdentifier.NodeIdentifier(
+                    PERSON_QNAME));
+
+        // Create an entry for the person jack
+        MapEntryNode jack =
+            ImmutableNodes.mapEntryBuilder(PERSON_QNAME, PERSON_NAME_QNAME, "jack")
+                .withChild(ImmutableNodes.leafNode(PERSON_NAME_QNAME, "jack"))
+                .withChild(ImmutableNodes.leafNode(PERSON_AGE_QNAME, 100L))
+                .build();
+
+        // Create an entry for the person jill
+        MapEntryNode jill =
+            ImmutableNodes.mapEntryBuilder(PERSON_QNAME, PERSON_NAME_QNAME, "jill")
+                .withChild(ImmutableNodes.leafNode(PERSON_NAME_QNAME, "jill"))
+                .withChild(ImmutableNodes.leafNode(PERSON_AGE_QNAME, 200L))
+                .build();
+
+        cars.withChild(jack);
+        cars.withChild(jill);
+
+        return ImmutableContainerNodeBuilder.create()
+            .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(BASE_QNAME))
+            .withChild(cars.build())
+            .build();
+
+    }
+
+    public static NormalizedNode emptyContainer(){
+        return ImmutableContainerNodeBuilder.create()
+            .withNodeIdentifier(
+                new YangInstanceIdentifier.NodeIdentifier(BASE_QNAME))
+            .build();
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/SampleModelsTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/SampleModelsTest.java
new file mode 100644 (file)
index 0000000..be8713c
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * 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.cluster.datastore.model;
+
+import junit.framework.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+
+public class SampleModelsTest {
+    @Test
+    public void testPeopleModel(){
+        final NormalizedNode<?, ?> expected = PeopleModel.create();
+
+
+        final NormalizedNodeMessages.Container node =
+            new NormalizedNodeToNodeCodec(SchemaContextHelper.full())
+                .encode(YangInstanceIdentifier.of(PeopleModel.BASE_QNAME),
+                    expected);
+
+        final NormalizedNodeMessages.Node normalizedNode =
+            node.getNormalizedNode();
+
+        final NormalizedNode<?,?> actual = new NormalizedNodeToNodeCodec(SchemaContextHelper.full()).decode(YangInstanceIdentifier.of(PeopleModel.BASE_QNAME),
+            normalizedNode);
+
+
+        Assert.assertEquals(expected, actual);
+
+    }
+
+
+    @Test
+    public void testCarsModel(){
+        final NormalizedNode<?, ?> expected = CarsModel.create();
+
+
+        final NormalizedNodeMessages.Container node =
+            new NormalizedNodeToNodeCodec(SchemaContextHelper.full())
+                .encode(YangInstanceIdentifier.of(CarsModel.BASE_QNAME),
+                    expected);
+
+        final NormalizedNodeMessages.Node normalizedNode =
+            node.getNormalizedNode();
+
+        final NormalizedNode<?,?> actual = new NormalizedNodeToNodeCodec(SchemaContextHelper.full()).decode(
+            YangInstanceIdentifier.of(CarsModel.BASE_QNAME),
+            normalizedNode);
+
+
+        Assert.assertEquals(expected, actual);
+
+    }
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/SchemaContextHelper.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/SchemaContextHelper.java
new file mode 100644 (file)
index 0000000..3395738
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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.cluster.datastore.model;
+
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+public class SchemaContextHelper {
+
+    public static InputStream getInputStream(final String yangFileName) {
+        return TestModel.class.getResourceAsStream(yangFileName);
+    }
+
+    public static SchemaContext full(){
+        YangParserImpl parser = new YangParserImpl();
+        List<InputStream> streams = new ArrayList<>();
+        streams.add(getInputStream("/odl-datastore-test.yang"));
+        streams.add(getInputStream("/people.yang"));
+        streams.add(getInputStream("/cars.yang"));
+
+        Set<Module> modules = parser.parseYangModelsFromStreams(streams);
+        return parser.resolveSchemaContext(modules);
+
+    }
+}
index 7a1def9f89491ef5697f0b58f1ed4792883e20ec..85441eca0d290ca4968cea22e793b4897fc3ec36 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.md.cluster.datastore.model;
 
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
@@ -29,8 +29,8 @@ public class TestModel {
   public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
   private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
 
-  public static final InstanceIdentifier TEST_PATH = InstanceIdentifier.of(TEST_QNAME);
-  public static final InstanceIdentifier OUTER_LIST_PATH = InstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
+  public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_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 2647850667e6f7f779d582b33267c1afcbc6d483..aebff27c7dc0345864bfb8ecff9f5b30789ecf24 100644 (file)
@@ -1,11 +1,14 @@
 akka {
     actor {
-        serializers {
-          java = "akka.serialization.JavaSerializer"
-        }
+         serializers {
+                  java = "akka.serialization.JavaSerializer"
+                  proto = "akka.remote.serialization.ProtobufSerializer"
+         }
 
         serialization-bindings {
             "org.opendaylight.controller.cluster.datastore.modification.MutableCompositeModification" = java
+            "com.google.protobuf.Message" = proto
+
         }
     }
-}
\ No newline at end of file
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/cars.yang b/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/cars.yang
new file mode 100644 (file)
index 0000000..d83135e
--- /dev/null
@@ -0,0 +1,22 @@
+module cars {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:cars";
+    prefix "cars";
+
+    revision "2014-03-13" {
+        description "Initial revision.";
+    }
+
+    container cars {
+        list car {
+            key name;
+            leaf name {
+                type string;
+            }
+
+            leaf price {
+                type uint64;
+            }
+        }
+    }
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/module-shards.conf b/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/module-shards.conf
new file mode 100644 (file)
index 0000000..b3de998
--- /dev/null
@@ -0,0 +1,49 @@
+module-shards = [
+    {
+        name = "default"
+        shards = [
+            {
+                name="default",
+                replicas = [
+                    "member-1",
+                    "member-2",
+                    "member-3"
+                ]
+            }
+        ]
+    },
+    {
+        name = "people"
+        shards = [
+            {
+                name="people-1"
+                replicas = [
+                    "member-1"
+                ]
+            }
+        ]
+    },
+    {
+        name = "cars"
+        shards = [
+            {
+                name="cars-1"
+                replicas = [
+                    "member-1"
+                ]
+            }
+        ]
+    },
+    {
+        name = "test"
+        shards = [
+            {
+                name="test-1"
+                replicas = [
+                    "member-1"
+                ]
+            }
+        ]
+    }
+
+]
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/modules.conf b/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/modules.conf
new file mode 100644 (file)
index 0000000..22854cb
--- /dev/null
@@ -0,0 +1,18 @@
+modules = [
+    {
+        name = "people"
+        namespace = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:people"
+        shard-strategy = "module"
+    },
+    {
+        name = "cars"
+        namespace = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:cars"
+        shard-strategy = "module"
+    },
+    {
+     name = "test"
+     namespace = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test"
+     shard-strategy = "module"
+    }
+
+]
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-augmentation.yang b/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-augmentation.yang
new file mode 100644 (file)
index 0000000..77d74c4
--- /dev/null
@@ -0,0 +1,19 @@
+module odl-datastore-augmentation {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug";
+    prefix "store-aug";
+
+    import odl-datastore-test {prefix test;revision-date "2014-03-13";}
+
+    revision "2014-03-13" {
+        description "Initial revision.";
+    }
+
+
+    augment "/test:test" {
+        leaf name {
+            type string;
+        }
+    }
+
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-test-notification.yang b/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-test-notification.yang
new file mode 100644 (file)
index 0000000..25cc53a
--- /dev/null
@@ -0,0 +1,33 @@
+module odl-datastore-test-notification {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test";
+    prefix "notification-test-using-family-model";
+
+    revision "2014-04-17" {
+        description "Family structure created on ";
+    }
+
+    container family {
+        leaf desc {
+            type string;
+        }
+        list children {
+            key child-number;
+            leaf child-number {
+                type uint16;
+            }
+            leaf child-name {
+                type string;
+            }
+           list grand-children {
+                key grand-child-number;
+                leaf grand-child-number {
+                    type uint16;
+                }
+                leaf grand-child-name {
+                    type string;
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/people.yang b/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/people.yang
new file mode 100644 (file)
index 0000000..7ede0e6
--- /dev/null
@@ -0,0 +1,22 @@
+module people {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:people";
+    prefix "people";
+
+    revision "2014-03-13" {
+        description "Initial revision.";
+    }
+
+    container people {
+        list person {
+            key name;
+            leaf name {
+                type string;
+            }
+
+            leaf age {
+                type uint32;
+            }
+        }
+    }
+}
index 613cf1bfe24e1b31cf854d978c35c48ef11d96f3..fdb864059fbca351bba441045d4a7a89810bb558 100644 (file)
@@ -10,7 +10,7 @@ import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainFactory;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
 import org.opendaylight.controller.sal.core.api.BrokerService;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 /**
@@ -22,8 +22,8 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
  *
  */
 public interface DOMDataBroker extends
-        AsyncDataBroker<InstanceIdentifier, NormalizedNode<?, ?>, DOMDataChangeListener>,
-        TransactionChainFactory<InstanceIdentifier, NormalizedNode<?, ?>>, BrokerService {
+        AsyncDataBroker<YangInstanceIdentifier, NormalizedNode<?, ?>, DOMDataChangeListener>,
+        TransactionChainFactory<YangInstanceIdentifier, NormalizedNode<?, ?>>, BrokerService, DOMService {
 
     /**
      * {@inheritDoc}
index d1f01760d2e3fef9b97c8d0c598cb6571eff5c75..393d1eaafeaaf85388af54fbd492316ebc013937 100644 (file)
@@ -8,9 +8,9 @@
 package org.opendaylight.controller.md.sal.dom.api;
 
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
-public interface DOMDataChangeListener extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> {
+public interface DOMDataChangeListener extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> {
 
 }
index 18fb9886611ab73098a0e34c41e08b6dd58a703e..856272f1f68d77b4f0e3e5978df6eda2fee54816 100644 (file)
@@ -1,9 +1,9 @@
 package org.opendaylight.controller.md.sal.dom.api;
 
 import org.opendaylight.controller.md.sal.common.api.data.AsyncReadOnlyTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
-public interface DOMDataReadOnlyTransaction extends DOMDataReadTransaction, AsyncReadOnlyTransaction<InstanceIdentifier, NormalizedNode<?, ?>> {
+public interface DOMDataReadOnlyTransaction extends DOMDataReadTransaction, AsyncReadOnlyTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>> {
 
 }
index 0d5e47faee198b95f453a07c99bcfaa3181ded3d..afa2286d53d94d4af669af7ba2c542221961372c 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.md.sal.dom.api;
 
 import org.opendaylight.controller.md.sal.common.api.data.AsyncReadTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 import com.google.common.base.Optional;
@@ -20,7 +20,7 @@ import com.google.common.util.concurrent.ListenableFuture;
  * <p>
  * For more information on usage and examples, please see the documentation in {@link AsyncReadTransaction}.
  */
-public interface DOMDataReadTransaction extends AsyncReadTransaction<InstanceIdentifier, NormalizedNode<?, ?>> {
+public interface DOMDataReadTransaction extends AsyncReadTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>> {
 
     /**
      * Reads data from provided logical data store located at the provided path.
@@ -42,5 +42,5 @@ public interface DOMDataReadTransaction extends AsyncReadTransaction<InstanceIde
      *         {@link ListenbleFuture#get()} returns {@link Optional#absent()}.
      *         </ul>
      */
-    ListenableFuture<Optional<NormalizedNode<?,?>>> read(LogicalDatastoreType store,InstanceIdentifier path);
+    ListenableFuture<Optional<NormalizedNode<?,?>>> read(LogicalDatastoreType store,YangInstanceIdentifier path);
 }
index 55600b07306d3f2a27681e9fbfaceccfe52c8404..d5fc5c957c852e563a82fb7871fcbee3f858d0f8 100644 (file)
@@ -8,9 +8,9 @@
 package org.opendaylight.controller.md.sal.dom.api;
 
 import org.opendaylight.controller.md.sal.common.api.data.AsyncReadWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
-public interface DOMDataReadWriteTransaction extends DOMDataReadTransaction, DOMDataWriteTransaction, AsyncReadWriteTransaction<InstanceIdentifier, NormalizedNode<?, ?>> {
+public interface DOMDataReadWriteTransaction extends DOMDataReadTransaction, DOMDataWriteTransaction, AsyncReadWriteTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>> {
 
 }
index 9415973de5af3e0ec49d144ab3d5e541948580ac..b8fe26387bf59bcd8d7c06d797b53a8f01c72cb5 100644 (file)
@@ -8,9 +8,54 @@
 package org.opendaylight.controller.md.sal.dom.api;
 
 import org.opendaylight.controller.md.sal.common.api.data.AsyncWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
-public interface DOMDataWriteTransaction extends AsyncWriteTransaction<InstanceIdentifier, NormalizedNode<?, ?>> {
+/**
+ * A transaction that provides mutation capabilities on a data tree.
+ * <p>
+ * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
+ */
+public interface DOMDataWriteTransaction extends AsyncWriteTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>> {
+
+    /**
+     * Stores a piece of data at the specified path. This acts as an add / replace
+     * operation, which is to say that whole subtree will be replaced by the specified data.
+     * <p>
+     * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
+     * <p>
+     * If you need to make sure that a parent object exists but you do not want modify
+     * its pre-existing state by using put, consider using {@link #merge} instead.
+     *
+     * @param store
+     *            the logical data store which should be modified
+     * @param path
+     *            the data object path
+     * @param data
+     *            the data object to be written to the specified path
+     * @throws IllegalStateException
+     *             if the transaction has already been submitted
+     */
+    void put(LogicalDatastoreType store, YangInstanceIdentifier path, NormalizedNode<?, ?> data);
 
+    /**
+     * Merges a piece of data with the existing data at a specified path. Any pre-existing data
+     * which is not explicitly overwritten will be preserved. This means that if you store a container,
+     * its child lists will be merged.
+     * <p>
+     * For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
+     *<p>
+     * If you require an explicit replace operation, use {@link #put} instead.
+     *
+     * @param store
+     *            the logical data store which should be modified
+     * @param path
+     *            the data object path
+     * @param data
+     *            the data object to be merged to the specified path
+     * @throws IllegalStateException
+     *             if the transaction has already been submitted
+     */
+    void merge(LogicalDatastoreType store, YangInstanceIdentifier path, NormalizedNode<?, ?> data);
 }
diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMMountPoint.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMMountPoint.java
new file mode 100644 (file)
index 0000000..1431155
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * 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.sal.dom.api;
+
+import org.opendaylight.yangtools.concepts.Identifiable;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+import com.google.common.base.Optional;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+public interface DOMMountPoint extends Identifiable<YangInstanceIdentifier> {
+
+    <T extends DOMService> Optional<T> getService(Class<T> cls);
+
+    SchemaContext getSchemaContext();
+}
diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMMountPointService.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMMountPointService.java
new file mode 100644 (file)
index 0000000..6023038
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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.sal.dom.api;
+
+import org.opendaylight.controller.sal.core.api.BrokerService;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+import com.google.common.base.Optional;
+
+
+public interface DOMMountPointService extends BrokerService {
+
+    Optional<DOMMountPoint> getMountPoint(YangInstanceIdentifier path);
+
+    DOMMountPointBuilder createMountPoint(YangInstanceIdentifier path);
+
+    ListenerRegistration<MountProvisionListener> registerProvisionListener(MountProvisionListener listener);
+
+    public interface DOMMountPointBuilder {
+
+        <T extends DOMService> DOMMountPointBuilder addService(Class<T> type,T impl);
+
+        DOMMountPointBuilder addInitialSchemaContext(SchemaContext ctx);
+
+        ObjectRegistration<DOMMountPoint> register();
+    }
+}
diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMService.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMService.java
new file mode 100644 (file)
index 0000000..357cb8b
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * 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.sal.dom.api;
+
+public interface DOMService {
+
+}
index 73a0c28465108e951ddafdd6fa2639bd088f9ff1..2d2fa48c058a4513a49f5504a70781f35695cb8e 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.md.sal.dom.api;
 
 import org.opendaylight.controller.md.sal.common.api.data.TransactionChain;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 /**
@@ -21,7 +21,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
  * <p>
  * This interface is type capture of {@link TransactionChain} for DOM Data Contracts.
  */
-public interface DOMTransactionChain extends TransactionChain<InstanceIdentifier, NormalizedNode<?, ?>> {
+public interface DOMTransactionChain extends TransactionChain<YangInstanceIdentifier, NormalizedNode<?, ?>> {
 
     @Override
     DOMDataReadOnlyTransaction newReadOnlyTransaction();
index 724cbe75f420e41ccfcfbe041f4b2854e2e1d616..203bd40329421ee08950eef0ef5023cf3c4edbe0 100644 (file)
@@ -16,7 +16,7 @@ import org.opendaylight.yangtools.concepts.ObjectRegistration;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.osgi.framework.BundleContext;
 
 /**
@@ -78,13 +78,18 @@ public interface Broker {
      *
      * @param cons
      *            Consumer to be registered.
-     * @param context
      * @return a session specific to consumer registration
      * @throws IllegalArgumentException
      *             If the consumer is <code>null</code>.
      * @throws IllegalStateException
      *             If the consumer is already registered.
      */
+    ConsumerSession registerConsumer(Consumer cons);
+
+    /*
+     * @deprecated Use registerConsumer(Consumer cons) instead (BundleContext is no longer used)
+     */
+    @Deprecated
     ConsumerSession registerConsumer(Consumer cons, BundleContext context);
 
     /**
@@ -110,13 +115,18 @@ public interface Broker {
      *
      * @param prov
      *            Provider to be registered.
-     * @param context
      * @return a session unique to the provider registration.
      * @throws IllegalArgumentException
      *             If the provider is <code>null</code>.
      * @throws IllegalStateException
      *             If the consumer is already registered.
      */
+    ProviderSession registerProvider(Provider prov);
+
+    /*
+     * @deprecated Use registerProvider(Provider cons) instead (BundleContext is no longer used)
+     */
+    @Deprecated
     ProviderSession registerProvider(Provider prov, BundleContext context);
 
     /**
@@ -240,6 +250,6 @@ public interface Broker {
         void close();
     }
 
-    public interface RoutedRpcRegistration extends RpcRegistration, RoutedRegistration<QName, InstanceIdentifier, RpcImplementation> {
+    public interface RoutedRpcRegistration extends RpcRegistration, RoutedRegistration<QName, YangInstanceIdentifier, RpcImplementation> {
     }
 }
index a693cd6c49b475bc5f046cbb48c465f37858729f..a5ab8ac911b20fc703b96185af66e9bb60c170d7 100644 (file)
@@ -38,21 +38,22 @@ public interface Consumer {
     public void onSessionInitiated(ConsumerSession session);
 
     /**
-     * Get a set of implementations of consumer functionality to be registered
-     * into system during the consumer registration to the SAL.
-     *
-     * This method is invoked by {@link Broker#registerConsumer(Consumer)}.
-     *
-     * @return Set of consumer functionality.
+     * @deprecated - no longer used or needed
+     * *
+     * Suggested implementation until removed:
+     * @code {
+     * public Collection<ConsumerFunctionality> getConsumerFunctionality() {
+     *    return Collections.emptySet();
+     * }
+     * }
      */
+    @Deprecated
     public Collection<ConsumerFunctionality> getConsumerFunctionality();
 
     /**
-     * The marker interface for the interfaces describing the consumer
-     * functionality contracts.
-     *
-     *
+     * @deprecated - no longer used or needed
      */
+    @Deprecated
     public interface ConsumerFunctionality {
 
     }
index 0a57d12579239ae29e9fff251651db8483f1ee16..4f32983f84b7e7f5a0408e1b5dfcdf4f5a01b65c 100644 (file)
@@ -42,27 +42,22 @@ public interface Provider {
     public void onSessionInitiated(ProviderSession session);
 
     /**
-     * Gets a set of implementations of provider functionality to be registered
-     * into system during the provider registration to the SAL.
+     * @deprecated - No longer used or needed
      *
-     * <p>
-     * This method is invoked by {@link Broker#registerProvider(Provider)} to
-     * learn the initial provided functionality
-     *
-     * @return Set of provider's functionality.
+     * Suggested implementation until removed:
+     * @code {
+     * public Collection<ProviderFunctionality> getProviderFunctionality() {
+     *  return Collections.emptySet();
+     * }
+     * }
      */
+    @Deprecated
     public Collection<ProviderFunctionality> getProviderFunctionality();
 
     /**
-     * Functionality provided by the {@link Provider}
-     *
-     * <p>
-     * Marker interface used to mark the interfaces describing specific
-     * functionality which could be exposed by providers to other components.
-     *
-
-     *
+     * @deprecated - no longer used or needed
      */
+    @Deprecated
     public interface ProviderFunctionality {
 
     }
index 4f11ba066110be3f73d855a5c4871195fc47306c..7a7b144fed323d2a4d8e606cfeb1916a3245f464 100644 (file)
@@ -10,12 +10,12 @@ package org.opendaylight.controller.sal.core.api;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 import com.google.common.util.concurrent.ListenableFuture;
 
 public interface RoutedRpcDefaultImplementation {
 
-    ListenableFuture<RpcResult<CompositeNode>> invokeRpc(QName rpc, InstanceIdentifier identifier, CompositeNode input);
+    ListenableFuture<RpcResult<CompositeNode>> invokeRpc(QName rpc, YangInstanceIdentifier identifier, CompositeNode input);
 
 }
index a22a6ef75e6be7d25461071b1c8290d1a13c0be4..050225c5c20f42e4fea8eabf26577051a09aa8a7 100644 (file)
@@ -8,13 +8,14 @@
 package org.opendaylight.controller.sal.core.api;
 
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublisher;
+import org.opendaylight.controller.md.sal.dom.api.DOMService;
 import org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.core.api.Broker.RpcRegistration;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
-public interface RpcProvisionRegistry extends RpcImplementation, BrokerService, RouteChangePublisher<RpcRoutingContext, InstanceIdentifier> {
+public interface RpcProvisionRegistry extends RpcImplementation, BrokerService, RouteChangePublisher<RpcRoutingContext, YangInstanceIdentifier>, DOMService {
 
     /**
      * Registers an implementation of the rpc.
index 9c7deaf406fb955bcb43339a784f1b17748579cf..88289b310607e2c226a28e009a4197018e55ee97 100644 (file)
@@ -12,7 +12,7 @@ import org.opendaylight.controller.md.sal.common.api.data.DataModificationTransa
 import org.opendaylight.controller.md.sal.common.api.data.DataReader;
 import org.opendaylight.controller.sal.core.api.BrokerService;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 
 /**
@@ -27,16 +27,16 @@ import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
 @Deprecated
 public interface DataBrokerService extends
     BrokerService, //
-    DataReader<InstanceIdentifier, CompositeNode>, //
-    DataModificationTransactionFactory<InstanceIdentifier, CompositeNode>, //
-    DataChangePublisher<InstanceIdentifier, CompositeNode, DataChangeListener> {
+    DataReader<YangInstanceIdentifier, CompositeNode>, //
+    DataModificationTransactionFactory<YangInstanceIdentifier, CompositeNode>, //
+    DataChangePublisher<YangInstanceIdentifier, CompositeNode, DataChangeListener> {
 
 
     @Override
-    public CompositeNode readConfigurationData(InstanceIdentifier path);
+    public CompositeNode readConfigurationData(YangInstanceIdentifier path);
 
     @Override
-    public CompositeNode readOperationalData(InstanceIdentifier path);
+    public CompositeNode readOperationalData(YangInstanceIdentifier path);
 
     @Override
     DataModificationTransaction beginTransaction();
index 2bf949d208b9bf563c9b7d41e39826bbd853339a..47ac2d78afcd39d49633166b1614178da4d7418a 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.sal.core.api.data;
 
 import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
  *
@@ -18,8 +18,8 @@ import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
 @Deprecated
 public interface DataChangeListener
         extends
-        org.opendaylight.controller.md.sal.common.api.data.DataChangeListener<InstanceIdentifier, CompositeNode> {
+        org.opendaylight.controller.md.sal.common.api.data.DataChangeListener<YangInstanceIdentifier, CompositeNode> {
 
     @Override
-    public void onDataChanged(DataChangeEvent<InstanceIdentifier, CompositeNode> change);
+    public void onDataChanged(DataChangeEvent<YangInstanceIdentifier, CompositeNode> change);
 }
index 82e62255c3ba465c86ef665038f362b6cad1f0fe..dd5755e33ccd3ce8175427e5c454a69e467d27a3 100644 (file)
@@ -15,7 +15,7 @@ import org.opendaylight.controller.md.sal.common.api.data.DataModification;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
  *
@@ -27,7 +27,7 @@ import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
  *
  */
 @Deprecated
-public interface DataModificationTransaction extends DataModification<InstanceIdentifier, CompositeNode> {
+public interface DataModificationTransaction extends DataModification<YangInstanceIdentifier, CompositeNode> {
 
     /**
      * Returns transaction identifier
index 0810fa3e98ab9041c51b0febb83184ec14f6463d..194da91695fbb32c94f4bcf3ef9c7ada91ebc64d 100644 (file)
@@ -13,7 +13,7 @@ import org.opendaylight.controller.sal.common.DataStoreIdentifier;
 import org.opendaylight.controller.sal.core.api.Provider;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
  *
@@ -23,7 +23,7 @@ import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
 @Deprecated
 public interface DataProviderService extends
     DataBrokerService, //
-    DataProvisionService<InstanceIdentifier, CompositeNode>
+    DataProvisionService<YangInstanceIdentifier, CompositeNode>
     {
 
     /**
@@ -63,9 +63,9 @@ public interface DataProviderService extends
     void removeRefresher(DataStoreIdentifier store, DataRefresher refresher);
 
 
-    Registration<DataReader<InstanceIdentifier, CompositeNode>> registerConfigurationReader(InstanceIdentifier path, DataReader<InstanceIdentifier, CompositeNode> reader);
+    Registration registerConfigurationReader(YangInstanceIdentifier path, DataReader<YangInstanceIdentifier, CompositeNode> reader);
 
-    Registration<DataReader<InstanceIdentifier, CompositeNode>> registerOperationalReader(InstanceIdentifier path, DataReader<InstanceIdentifier, CompositeNode> reader);
+    Registration registerOperationalReader(YangInstanceIdentifier path, DataReader<YangInstanceIdentifier, CompositeNode> reader);
 
     public interface DataRefresher extends Provider.ProviderFunctionality {
 
index 56d2e87c2c1007954c7560f01132298bf37f2387..d66d04816b300e7112f87da20924f272dc6b1ccf 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.controller.sal.core.api.data;
 import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
 import org.opendaylight.controller.md.sal.common.api.data.DataReader;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
  *
@@ -19,14 +19,14 @@ import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
  */
 @Deprecated
 public interface DataStore extends //
-    DataReader<InstanceIdentifier, CompositeNode>,
-    DataCommitHandler<InstanceIdentifier, CompositeNode> {
+    DataReader<YangInstanceIdentifier, CompositeNode>,
+    DataCommitHandler<YangInstanceIdentifier, CompositeNode> {
 
 
-    Iterable<InstanceIdentifier> getStoredConfigurationPaths();
-    Iterable<InstanceIdentifier> getStoredOperationalPaths();
+    Iterable<YangInstanceIdentifier> getStoredConfigurationPaths();
+    Iterable<YangInstanceIdentifier> getStoredOperationalPaths();
 
-    boolean containsConfigurationPath(InstanceIdentifier path);
-    boolean containsOperationalPath(InstanceIdentifier path);
+    boolean containsConfigurationPath(YangInstanceIdentifier path);
+    boolean containsOperationalPath(YangInstanceIdentifier path);
 
 }
index 34e5b1b8033d2cbda100b1fe6b0552af983abee3..c3e979c536b268c4a6156b7241e745f328569618 100644 (file)
@@ -11,7 +11,7 @@ import org.opendaylight.controller.sal.core.api.BrokerService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 
 public interface SchemaService extends BrokerService {
 
@@ -42,5 +42,11 @@ public interface SchemaService extends BrokerService {
      */
     SchemaContext getGlobalContext();
 
-    ListenerRegistration<SchemaServiceListener> registerSchemaServiceListener(SchemaServiceListener listener);
+    /**
+     * Register a listener for changes in schema context.
+     *
+     * @param listener Listener which should be registered
+     * @return Listener registration handle
+     */
+    ListenerRegistration<SchemaContextListener> registerSchemaContextListener(SchemaContextListener listener);
 }
index 5698b969771bd4296cbcb8d85ebbd03fcbca59ae..a4343ba5cf7e2b8da6cd9034b2264f2fd698310a 100644 (file)
@@ -21,6 +21,7 @@ import com.google.common.util.concurrent.ListenableFuture;
  * Interface representing a single mount instance and represents a way for
  * clients to access underlying data, RPCs and notifications.
  */
+@Deprecated
 public interface MountInstance extends //
         NotificationService, //
         DataBrokerService {
index 29e3b911c1d1b1d8a5cdf64b30da0842bff7d11f..a5c3b5d0f6460a3ecc805994a6877883ebf09738 100644 (file)
@@ -12,6 +12,7 @@ import org.opendaylight.controller.sal.core.api.data.DataProviderService;
 import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
+@Deprecated
 public interface MountProvisionInstance extends //
         MountInstance,//
         NotificationPublishService, //
diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountProvisionListener.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountProvisionListener.java
new file mode 100644 (file)
index 0000000..1d724e4
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * 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.core.api.mount;
+
+import java.util.EventListener;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+public interface MountProvisionListener extends EventListener {
+
+    void onMountPointCreated(YangInstanceIdentifier path);
+
+    void onMountPointRemoved(YangInstanceIdentifier path);
+
+}
index 1185c4528cee3e60bbc7bba70ab3beddc5eac021..37c30b6784c31b6d2131deed70f7e8eccf93202c 100644 (file)
@@ -7,27 +7,22 @@
  */
 package org.opendaylight.controller.sal.core.api.mount;
 
-import java.util.EventListener;
-
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
+/**
+ * @deprecated Use org.opendaylight.controller.md.sal.dom.api.DOMMountPointService instead
+ */
+@Deprecated
 public interface MountProvisionService extends MountService {
 
     @Override
-    public MountProvisionInstance getMountPoint(InstanceIdentifier path);
+    public MountProvisionInstance getMountPoint(YangInstanceIdentifier path);
 
-    MountProvisionInstance createMountPoint(InstanceIdentifier path);
+    MountProvisionInstance createMountPoint(YangInstanceIdentifier path);
 
-    MountProvisionInstance createOrGetMountPoint(InstanceIdentifier path);
+    MountProvisionInstance createOrGetMountPoint(YangInstanceIdentifier path);
 
     ListenerRegistration<MountProvisionListener> registerProvisionListener(MountProvisionListener listener);
 
-    public interface MountProvisionListener extends EventListener {
-
-        void onMountPointCreated(InstanceIdentifier path);
-
-        void onMountPointRemoved(InstanceIdentifier path);
-
-    }
 }
index 6d1f17255c7defd4a0e61a890d0b6246b4b466a1..55b74c63d324b171e1097a9c348df496500ccfed 100644 (file)
@@ -8,12 +8,15 @@
 package org.opendaylight.controller.sal.core.api.mount;
 
 import org.opendaylight.controller.sal.core.api.BrokerService;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
  * Client-level interface for interacting with mount points. It provides access
  * to {@link MountInstance} instances based on their path.
+ *
+ *  @deprecated Use org.opendaylight.controller.md.sal.dom.api.DOMMountPointService instead
  */
+@Deprecated
 public interface MountService extends BrokerService {
     /**
      * Obtain access to a mount instance registered at the specified path.
@@ -21,5 +24,5 @@ public interface MountService extends BrokerService {
      * @param path Path at which the instance is registered
      * @return Reference to the instance, or null if no such instance exists.
      */
-    MountInstance getMountPoint(InstanceIdentifier path);
+    MountInstance getMountPoint(YangInstanceIdentifier path);
 }
index f1156c39642af935a0d0a88d5d4d55bc6f40077f..4f5c7abf5f1bb560ea2b1d5d1b57982cfc700f4a 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.controller.sal.core.api.notify;
 
+import org.opendaylight.controller.md.sal.dom.api.DOMService;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 
 /**
@@ -23,7 +24,7 @@ import org.opendaylight.yangtools.yang.data.api.CompositeNode;
  * {@link NotificationListener#onNotification(CompositeNode)}
  * </ol>
  */
-public interface NotificationPublishService extends NotificationService {
+public interface NotificationPublishService extends NotificationService, DOMService {
     /**
      * Publishes a notification.
      *
index 1d67ca08241af4489c9582fdb5e39a576f67afca..9c0db42d6ceaf8007645b026057bc92558727d3b 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.sal.core.api.notify;
 
 import org.opendaylight.controller.sal.core.api.BrokerService;
-import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.QName;
 
 
@@ -38,6 +38,6 @@ public interface NotificationService extends BrokerService {
      * @param notification
      * @param listener
      */
-    Registration<NotificationListener> addNotificationListener(QName notification,
+    ListenerRegistration<NotificationListener> addNotificationListener(QName notification,
             NotificationListener listener);
 }
index 022882fcebd042404689f64abf2ed614894c3262..96e353b80e23c284885a48cf2302e9759cb29386 100644 (file)
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
     </dependency>
+
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>mockito-configuration</artifactId>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-simple</artifactId>
           <instructions>
             <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
             <Bundle-Activator>org.opendaylight.controller.sal.dom.broker.osgi.SchemaServiceActivator</Bundle-Activator>
-            <Export-Package>org.opendaylight.controller.sal.dom.broker.spi</Export-Package>
-            <Private-Package>org.opendaylight.controller.sal.dom.broker,
+            <Export-Package>org.opendaylight.controller.sal.dom.broker.spi,
+                            <!--sal.broker.impl is exported for sal-netconf-connector to use SchemaAwareRpcRegistry.-->
+                            <!-- TODO Remove sal.broker.impl from export when SchemaAwareRpcRegistry is not used in connector anymore -->
                             org.opendaylight.controller.sal.dom.broker.impl,
                             org.opendaylight.controller.sal.dom.broker.impl.*,
+            </Export-Package>
+            <Private-Package>org.opendaylight.controller.sal.dom.broker,
                             org.opendaylight.controller.sal.dom.broker.osgi,
                             org.opendaylight.controller.sal.dom.broker.util,
                             org.opendaylight.controller.config.yang.md.sal.dom.impl,
-                            org.opendaylight.controller.config.yang.md.sal.dom.statistics,
+                            org.opendaylight.controller.config.yang.md.sal.dom.statistics,\
                             org.opendaylight.controller.md.sal.dom.broker.impl,
                             org.opendaylight.controller.md.sal.dom.broker.impl.*,
                             org.opendaylight.yangtools.yang.util,
index 998d884b0cde71cd2fe774352229a61afd98761d..f1f16cd635ba9ab336eb286ba3e8593c51dc2c50 100644 (file)
@@ -7,8 +7,12 @@
  */
 package org.opendaylight.controller.config.yang.md.sal.dom.impl;
 
+import com.google.common.collect.ClassToInstanceMap;
+import com.google.common.collect.MutableClassToInstanceMap;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
 import org.opendaylight.controller.md.sal.dom.broker.impl.compat.BackwardsCompatibleDataBroker;
+import org.opendaylight.controller.md.sal.dom.broker.impl.mount.DOMMountPointServiceImpl;
 import org.opendaylight.controller.sal.core.api.BrokerService;
 import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
 import org.opendaylight.controller.sal.core.api.data.DataBrokerService;
@@ -17,17 +21,14 @@ import org.opendaylight.controller.sal.core.api.data.DataStore;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
 import org.opendaylight.controller.sal.core.api.mount.MountService;
+import org.opendaylight.controller.sal.dom.broker.BackwardsCompatibleMountPointManager;
 import org.opendaylight.controller.sal.dom.broker.BrokerImpl;
 import org.opendaylight.controller.sal.dom.broker.DataBrokerImpl;
 import org.opendaylight.controller.sal.dom.broker.GlobalBundleScanningSchemaServiceImpl;
-import org.opendaylight.controller.sal.dom.broker.MountPointManagerImpl;
 import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareDataStoreAdapter;
 import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareRpcBroker;
 import org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProviders;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-
-import com.google.common.collect.ClassToInstanceMap;
-import com.google.common.collect.MutableClassToInstanceMap;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
 *
@@ -72,22 +73,25 @@ public final class DomBrokerImplModule extends org.opendaylight.controller.confi
         services.putInstance(DataProviderService.class,legacyData);
         services.putInstance(DataBrokerService.class, legacyData);
 
+        final DOMMountPointService mountService = new DOMMountPointServiceImpl();
+        services.putInstance(DOMMountPointService.class, mountService);
 
-        MountPointManagerImpl mountService = new MountPointManagerImpl();
-        services.putInstance(MountService.class, mountService);
-        services.putInstance(MountProvisionService.class, mountService);
+        // TODO remove backwards service, use only new DOMMountPointService
+        final MountProvisionService backwardsMountService = new BackwardsCompatibleMountPointManager(mountService);
+        services.putInstance(MountService.class, backwardsMountService);
+        services.putInstance(MountProvisionService.class, backwardsMountService);
 
         return new BrokerImpl(router, services);
     }
 
     private DataProviderService createLegacyDataService(final DataStore legacyStore, final SchemaService schemaService) {
-        InstanceIdentifier rootPath = InstanceIdentifier.builder().toInstance();
+        YangInstanceIdentifier rootPath = YangInstanceIdentifier.builder().toInstance();
         DataBrokerImpl dataService = new DataBrokerImpl();
         SchemaAwareDataStoreAdapter wrappedStore = new SchemaAwareDataStoreAdapter();
         wrappedStore.changeDelegate(legacyStore);
         wrappedStore.setValidationEnabled(false);
 
-        schemaService.registerSchemaServiceListener(wrappedStore);
+        schemaService.registerSchemaContextListener(wrappedStore);
 
         dataService.registerConfigurationReader(rootPath, wrappedStore);
         dataService.registerCommitHandler(rootPath, wrappedStore);
index 69b17ee3c48aeb5aae64dc8c4b02e36abdfce7a7..667c0fc2826a100b2fc6ae77f4c0344a52d723f6 100644 (file)
@@ -50,7 +50,7 @@ public final class DomInmemoryDataBrokerModule extends
            //we will default to InMemoryDOMDataStore creation
           operStore = new InMemoryDOMDataStore("DOM-OPER", storeExecutor);
           //here we will register the SchemaContext listener
-          getSchemaServiceDependency().registerSchemaServiceListener((InMemoryDOMDataStore)operStore);
+          getSchemaServiceDependency().registerSchemaContextListener((InMemoryDOMDataStore)operStore);
         }
 
         DOMStore configStore = getConfigDataStoreDependency();
@@ -58,7 +58,7 @@ public final class DomInmemoryDataBrokerModule extends
            //we will default to InMemoryDOMDataStore creation
            configStore = new InMemoryDOMDataStore("DOM-CFG", storeExecutor);
           //here we will register the SchemaContext listener
-          getSchemaServiceDependency().registerSchemaServiceListener((InMemoryDOMDataStore)configStore);
+          getSchemaServiceDependency().registerSchemaContextListener((InMemoryDOMDataStore)configStore);
         }
         ImmutableMap<LogicalDatastoreType, DOMStore> datastores = ImmutableMap
                 .<LogicalDatastoreType, DOMStore> builder().put(LogicalDatastoreType.OPERATIONAL, operStore)
index fbc418dc2aec0203d4f52ad6b7ace8cc083ca019..62b026430ac07756bb21d2a90095a4c73ce6229a 100644 (file)
@@ -13,7 +13,7 @@ import org.opendaylight.yangtools.concepts.Delegator;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -90,8 +90,8 @@ org.opendaylight.controller.config.yang.md.sal.dom.impl.AbstractSchemaServiceImp
         }
 
         @Override
-        public ListenerRegistration<SchemaServiceListener> registerSchemaServiceListener(final SchemaServiceListener arg0) {
-            return delegate.registerSchemaServiceListener(arg0);
+        public ListenerRegistration<SchemaContextListener> registerSchemaContextListener(final SchemaContextListener arg0) {
+            return delegate.registerSchemaContextListener(arg0);
         }
 
         @Override
index 0be4327f7ae06231cd86814c62c724ddb16fd937..d3791a08782b6cbdf0217b85834af12bbf1b9fab 100644 (file)
@@ -8,7 +8,7 @@ package org.opendaylight.controller.md.sal.dom.broker.impl;
 
 import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 import com.google.common.base.Preconditions;
@@ -27,7 +27,7 @@ import com.google.common.collect.ImmutableMap;
  *            Subtransaction type
  */
 abstract class AbstractDOMForwardedCompositeTransaction<K, T extends DOMStoreTransaction> implements
-        AsyncTransaction<InstanceIdentifier, NormalizedNode<?, ?>> {
+        AsyncTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>> {
 
     private final ImmutableMap<K, T> backingTxs;
     private final Object identifier;
index 7731646a57d874348f0192be357a16f8de040212..d1b9a8f6005097ccc463d87efe2a52d0e3911b4c 100644 (file)
@@ -23,7 +23,7 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStore;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -54,7 +54,7 @@ public class DOMDataBrokerImpl extends AbstractDOMForwardedTransactionFactory<DO
 
     @Override
     public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store,
-            final InstanceIdentifier path, final DOMDataChangeListener listener, final DataChangeScope triggeringScope) {
+            final YangInstanceIdentifier path, final DOMDataChangeListener listener, final DataChangeScope triggeringScope) {
 
         DOMStore potentialStore = getTxFactories().get(store);
         checkState(potentialStore != null, "Requested logical data store is not available.");
index f207783c29f7820e5e472b13359d90f8b92f39db..c8edcbc6e2ef1dcf50e6b644da69c0224a62c140 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.controller.md.sal.dom.broker.impl;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 import com.google.common.base.Optional;
@@ -22,7 +22,7 @@ import com.google.common.util.concurrent.ListenableFuture;
  * Read Only Transaction, which is composed of several
  * {@link DOMStoreReadTransaction} transactions. Subtransaction is selected by
  * {@link LogicalDatastoreType} type parameter in
- * {@link #read(LogicalDatastoreType, InstanceIdentifier)}.
+ * {@link #read(LogicalDatastoreType, YangInstanceIdentifier)}.
  */
 class DOMForwardedReadOnlyTransaction extends
         AbstractDOMForwardedCompositeTransaction<LogicalDatastoreType, DOMStoreReadTransaction> implements
@@ -35,7 +35,7 @@ class DOMForwardedReadOnlyTransaction extends
 
     @Override
     public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store,
-            final InstanceIdentifier path) {
+            final YangInstanceIdentifier path) {
         return getSubtransaction(store).read(path);
     }
 
index e1d27e453bd5a2e0652ec5ab70161eded553025b..e6521b237727f10a8a1ccef376da0f13c0d61af9 100644 (file)
@@ -9,7 +9,7 @@
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 import com.google.common.base.Optional;
@@ -23,10 +23,10 @@ import com.google.common.util.concurrent.ListenableFuture;
  * {@link LogicalDatastoreType} type parameter in:
  *
  * <ul>
- * <li>{@link #read(LogicalDatastoreType, InstanceIdentifier)}
- * <li>{@link #put(LogicalDatastoreType, InstanceIdentifier, NormalizedNode)}
- * <li>{@link #delete(LogicalDatastoreType, InstanceIdentifier)}
- * <li>{@link #merge(LogicalDatastoreType, InstanceIdentifier, NormalizedNode)}
+ * <li>{@link #read(LogicalDatastoreType, YangInstanceIdentifier)}
+ * <li>{@link #put(LogicalDatastoreType, YangInstanceIdentifier, NormalizedNode)}
+ * <li>{@link #delete(LogicalDatastoreType, YangInstanceIdentifier)}
+ * <li>{@link #merge(LogicalDatastoreType, YangInstanceIdentifier, NormalizedNode)}
  * </ul>
  * {@link #commit()} will result in invocation of
  * {@link DOMDataCommitImplementation#submit(org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction, Iterable)}
@@ -46,7 +46,7 @@ class DOMForwardedReadWriteTransaction extends DOMForwardedWriteTransaction<DOMS
 
     @Override
     public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store,
-            final InstanceIdentifier path) {
+            final YangInstanceIdentifier path) {
         return getSubtransaction(store).read(path);
     }
 }
\ No newline at end of file
index 5bddd763fb396506702ec834f912245e2ec2177a..5d4ad4d803ac90d75c3769b76ef5133e6283cf17 100644 (file)
@@ -19,7 +19,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
 import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 import com.google.common.base.Preconditions;
@@ -36,9 +36,9 @@ import com.google.common.util.concurrent.ListenableFuture;
  * {@link LogicalDatastoreType} type parameter in:
  *
  * <ul>
- * <li>{@link #put(LogicalDatastoreType, InstanceIdentifier, NormalizedNode)}
- * <li>{@link #delete(LogicalDatastoreType, InstanceIdentifier)}
- * <li>{@link #merge(LogicalDatastoreType, InstanceIdentifier, NormalizedNode)}
+ * <li>{@link #put(LogicalDatastoreType, YangInstanceIdentifier, NormalizedNode)}
+ * <li>{@link #delete(LogicalDatastoreType, YangInstanceIdentifier)}
+ * <li>{@link #merge(LogicalDatastoreType, YangInstanceIdentifier, NormalizedNode)}
  * </ul>
  * <p>
  * {@link #commit()} will result in invocation of
@@ -86,19 +86,19 @@ class DOMForwardedWriteTransaction<T extends DOMStoreWriteTransaction> extends
     }
 
     @Override
-    public void put(final LogicalDatastoreType store, final InstanceIdentifier path, final NormalizedNode<?, ?> data) {
+    public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
         checkNotReady();
         getSubtransaction(store).write(path, data);
     }
 
     @Override
-    public void delete(final LogicalDatastoreType store, final InstanceIdentifier path) {
+    public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
         checkNotReady();
         getSubtransaction(store).delete(path);
     }
 
     @Override
-    public void merge(final LogicalDatastoreType store, final InstanceIdentifier path, final NormalizedNode<?, ?> data) {
+    public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
         checkNotReady();
         getSubtransaction(store).merge(path, data);
     }
index f361af948cb1c600a1c778fe97958cbcef1643d0..dc122cfdc24d672f9bcf563e26501a57b79bbad4 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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.sal.dom.broker.impl.compat;
 
 import javax.annotation.concurrent.ThreadSafe;
@@ -18,25 +25,24 @@ import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
-import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener;
 
 @ThreadSafe
 public class BackwardsCompatibleDataBroker implements DataProviderService {
 
     private final DOMDataBroker backingBroker;
     private volatile DataNormalizer normalizer;
-    private final ListenerRegistration<SchemaServiceListener> schemaReg;
+    private final ListenerRegistration<SchemaContextListener> schemaReg;
 
     public BackwardsCompatibleDataBroker(final DOMDataBroker newBiDataImpl, final SchemaService schemaService) {
         backingBroker = newBiDataImpl;
-        schemaReg = schemaService.registerSchemaServiceListener(new SchemaListener());
+        schemaReg = schemaService.registerSchemaContextListener(new SchemaListener());
     }
 
     @Override
-    public CompositeNode readConfigurationData(final InstanceIdentifier legacyPath) {
+    public CompositeNode readConfigurationData(final YangInstanceIdentifier legacyPath) {
         final BackwardsCompatibleTransaction<?> tx = BackwardsCompatibleTransaction.readOnlyTransaction(backingBroker.newReadOnlyTransaction(),normalizer);
         try {
             return tx.readConfigurationData(legacyPath);
@@ -46,7 +52,7 @@ public class BackwardsCompatibleDataBroker implements DataProviderService {
     }
 
     @Override
-    public CompositeNode readOperationalData(final InstanceIdentifier legacyPath) {
+    public CompositeNode readOperationalData(final YangInstanceIdentifier legacyPath) {
         final BackwardsCompatibleTransaction<?> tx = BackwardsCompatibleTransaction.readOnlyTransaction(backingBroker.newReadOnlyTransaction(),normalizer);
         try {
             return tx.readOperationalData(legacyPath);
@@ -61,9 +67,9 @@ public class BackwardsCompatibleDataBroker implements DataProviderService {
     }
 
     @Override
-    public ListenerRegistration<DataChangeListener> registerDataChangeListener(final InstanceIdentifier legacyPath,
+    public ListenerRegistration<DataChangeListener> registerDataChangeListener(final YangInstanceIdentifier legacyPath,
             final DataChangeListener listener) {
-        final InstanceIdentifier normalizedPath = normalizer.toNormalized(legacyPath);
+        final YangInstanceIdentifier normalizedPath = normalizer.toNormalized(legacyPath);
 
         final TranslatingListenerInvoker translatingCfgListener =
                 TranslatingListenerInvoker.createConfig(listener, normalizer);
@@ -77,10 +83,10 @@ public class BackwardsCompatibleDataBroker implements DataProviderService {
     }
 
     @Override
-    public Registration<DataCommitHandler<InstanceIdentifier, CompositeNode>> registerCommitHandler(
-            final InstanceIdentifier path, final DataCommitHandler<InstanceIdentifier, CompositeNode> commitHandler) {
+    public Registration registerCommitHandler(
+            final YangInstanceIdentifier path, final DataCommitHandler<YangInstanceIdentifier, CompositeNode> commitHandler) {
         // FIXME Do real forwarding
-        return new AbstractObjectRegistration<DataCommitHandler<InstanceIdentifier,CompositeNode>>(commitHandler) {
+        return new AbstractObjectRegistration<DataCommitHandler<YangInstanceIdentifier,CompositeNode>>(commitHandler) {
             @Override
             protected void removeRegistration() {
                 // NOOP
@@ -89,8 +95,8 @@ public class BackwardsCompatibleDataBroker implements DataProviderService {
     }
 
     @Override
-    public ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier, CompositeNode>>> registerCommitHandlerListener(
-            final RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier, CompositeNode>> commitHandlerListener) {
+    public ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<YangInstanceIdentifier, CompositeNode>>> registerCommitHandlerListener(
+            final RegistrationListener<DataCommitHandlerRegistration<YangInstanceIdentifier, CompositeNode>> commitHandlerListener) {
         return null;
     }
 
@@ -117,14 +123,14 @@ public class BackwardsCompatibleDataBroker implements DataProviderService {
     }
 
     @Override
-    public Registration<DataReader<InstanceIdentifier, CompositeNode>> registerConfigurationReader(
-            final InstanceIdentifier path, final DataReader<InstanceIdentifier, CompositeNode> reader) {
+    public Registration registerConfigurationReader(
+            final YangInstanceIdentifier path, final DataReader<YangInstanceIdentifier, CompositeNode> reader) {
         throw new UnsupportedOperationException("Data Reader contract is not supported.");
     }
 
     @Override
-    public Registration<DataReader<InstanceIdentifier, CompositeNode>> registerOperationalReader(
-            final InstanceIdentifier path, final DataReader<InstanceIdentifier, CompositeNode> reader) {
+    public Registration registerOperationalReader(
+            final YangInstanceIdentifier path, final DataReader<YangInstanceIdentifier, CompositeNode> reader) {
         throw new UnsupportedOperationException("Data Reader contract is not supported.");
     }
 
index f57579858cf559404510c897a9f2fe76b6cfed36..70baaae33939c59d4f1cf4336aed30c29b48826a 100644 (file)
@@ -33,8 +33,8 @@ import org.opendaylight.yangtools.concepts.Delegator;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -90,9 +90,9 @@ DataModificationTransaction, Delegator<T> {
     };
 
     @Override
-    public CompositeNode readConfigurationData(final InstanceIdentifier legacyPath) {
+    public CompositeNode readConfigurationData(final YangInstanceIdentifier legacyPath) {
 
-        InstanceIdentifier normalizedPath = normalizer.toNormalized(legacyPath);
+        YangInstanceIdentifier normalizedPath = normalizer.toNormalized(legacyPath);
 
         ListenableFuture<Optional<NormalizedNode<?, ?>>> normalizedData = asyncTx.read(
                 LogicalDatastoreType.CONFIGURATION, normalizedPath);
@@ -105,8 +105,8 @@ DataModificationTransaction, Delegator<T> {
     }
 
     @Override
-    public CompositeNode readOperationalData(final InstanceIdentifier legacyPath) {
-        InstanceIdentifier normalizedPath = normalizer.toNormalized(legacyPath);
+    public CompositeNode readOperationalData(final YangInstanceIdentifier legacyPath) {
+        YangInstanceIdentifier normalizedPath = normalizer.toNormalized(legacyPath);
 
         ListenableFuture<Optional<NormalizedNode<?, ?>>> normalizedData = asyncTx.read(
                 LogicalDatastoreType.OPERATIONAL, normalizedPath);
@@ -124,62 +124,62 @@ DataModificationTransaction, Delegator<T> {
     }
 
     @Override
-    public Map<InstanceIdentifier, CompositeNode> getCreatedConfigurationData() {
+    public Map<YangInstanceIdentifier, CompositeNode> getCreatedConfigurationData() {
         return Collections.emptyMap();
     }
 
     @Override
-    public Map<InstanceIdentifier, CompositeNode> getCreatedOperationalData() {
+    public Map<YangInstanceIdentifier, CompositeNode> getCreatedOperationalData() {
         return Collections.emptyMap();
     }
 
     @Override
-    public Map<InstanceIdentifier, CompositeNode> getOriginalConfigurationData() {
+    public Map<YangInstanceIdentifier, CompositeNode> getOriginalConfigurationData() {
         return Collections.emptyMap();
     }
 
     @Override
-    public Map<InstanceIdentifier, CompositeNode> getOriginalOperationalData() {
+    public Map<YangInstanceIdentifier, CompositeNode> getOriginalOperationalData() {
         return Collections.emptyMap();
     }
 
     @Override
-    public Set<InstanceIdentifier> getRemovedConfigurationData() {
+    public Set<YangInstanceIdentifier> getRemovedConfigurationData() {
         return Collections.emptySet();
     }
 
     @Override
-    public Set<InstanceIdentifier> getRemovedOperationalData() {
+    public Set<YangInstanceIdentifier> getRemovedOperationalData() {
         return Collections.emptySet();
     }
 
     @Override
-    public Map<InstanceIdentifier, CompositeNode> getUpdatedConfigurationData() {
+    public Map<YangInstanceIdentifier, CompositeNode> getUpdatedConfigurationData() {
         return Collections.emptyMap();
     }
 
     @Override
-    public Map<InstanceIdentifier, CompositeNode> getUpdatedOperationalData() {
+    public Map<YangInstanceIdentifier, CompositeNode> getUpdatedOperationalData() {
         return Collections.emptyMap();
     }
 
     @Override
-    public void putConfigurationData(final InstanceIdentifier path, final CompositeNode data) {
+    public void putConfigurationData(final YangInstanceIdentifier path, final CompositeNode data) {
         throw new UnsupportedOperationException();
     }
 
     @Override
-    public void putOperationalData(final InstanceIdentifier path, final CompositeNode data) {
+    public void putOperationalData(final YangInstanceIdentifier path, final CompositeNode data) {
         throw new UnsupportedOperationException();
     }
 
     @Override
-    public void removeConfigurationData(final InstanceIdentifier path) {
+    public void removeConfigurationData(final YangInstanceIdentifier path) {
         throw new UnsupportedOperationException();
     }
 
     @Override
-    public void removeOperationalData(final InstanceIdentifier path) {
+    public void removeOperationalData(final YangInstanceIdentifier path) {
         throw new UnsupportedOperationException();
     }
 
@@ -209,22 +209,22 @@ DataModificationTransaction, Delegator<T> {
         }
 
         @Override
-        public void putConfigurationData(final InstanceIdentifier legacyPath, final CompositeNode legacyData) {
+        public void putConfigurationData(final YangInstanceIdentifier legacyPath, final CompositeNode legacyData) {
             checkNotNull(legacyPath, "Path MUST NOT be null.");
             checkNotNull(legacyData, "Data for path %s MUST NOT be null",legacyData);
-            Entry<InstanceIdentifier, NormalizedNode<?, ?>> normalizedData = getNormalizer().toNormalized(legacyPath, legacyData);
+            Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedData = getNormalizer().toNormalized(legacyPath, legacyData);
             putWithEnsuredParents(LogicalDatastoreType.CONFIGURATION, normalizedData.getKey(), normalizedData.getValue());
         }
 
         @Override
-        public void putOperationalData(final InstanceIdentifier legacyPath, final CompositeNode legacyData) {
+        public void putOperationalData(final YangInstanceIdentifier legacyPath, final CompositeNode legacyData) {
             checkNotNull(legacyPath, "Path MUST NOT be null.");
             checkNotNull(legacyData, "Data for path %s MUST NOT be null",legacyData);
-            Entry<InstanceIdentifier, NormalizedNode<?, ?>> normalizedData = getNormalizer().toNormalized(legacyPath, legacyData);
+            Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedData = getNormalizer().toNormalized(legacyPath, legacyData);
             putWithEnsuredParents(LogicalDatastoreType.OPERATIONAL, normalizedData.getKey(), normalizedData.getValue());
         }
 
-        private void putWithEnsuredParents(final LogicalDatastoreType store, final InstanceIdentifier normalizedPath,
+        private void putWithEnsuredParents(final LogicalDatastoreType store, final YangInstanceIdentifier normalizedPath,
                 final NormalizedNode<?, ?> normalizedData) {
 
             LOG.trace("write {}:{} ",store,normalizedPath);
@@ -240,7 +240,7 @@ DataModificationTransaction, Delegator<T> {
                         throw new IllegalArgumentException(String.format("Invalid child encountered in path %s", normalizedPath), e);
                     }
                     currentArguments.add(currentArg);
-                    InstanceIdentifier currentPath = InstanceIdentifier.create(currentArguments);
+                    YangInstanceIdentifier currentPath = YangInstanceIdentifier.create(currentArguments);
                     boolean isPresent = getDelegate().read(store, currentPath).get().isPresent();
                     if(isPresent == false && iterator.hasNext()) {
                         getDelegate().merge(store, currentPath, currentOp.createDefault(currentArg));
@@ -254,13 +254,13 @@ DataModificationTransaction, Delegator<T> {
         }
 
         @Override
-        public void removeConfigurationData(final InstanceIdentifier legacyPath) {
+        public void removeConfigurationData(final YangInstanceIdentifier legacyPath) {
             checkNotNull(legacyPath, "Path MUST NOT be null.");
             getDelegate().delete(LogicalDatastoreType.CONFIGURATION, getNormalizer().toNormalized(legacyPath));
         }
 
         @Override
-        public void removeOperationalData(final InstanceIdentifier legacyPath) {
+        public void removeOperationalData(final YangInstanceIdentifier legacyPath) {
             checkNotNull(legacyPath, "Path MUST NOT be null.");
             getDelegate().delete(LogicalDatastoreType.OPERATIONAL, getNormalizer().toNormalized(legacyPath));
         }
index 3de07fc2abee209f0bbab84e822614604aea4bc9..d6d79cd624ae05ae178eaf67228525cfe4c80f43 100644 (file)
@@ -17,64 +17,64 @@ import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
 import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationException;
 import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizer;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 import com.google.common.collect.Maps;
 
 public abstract class TranslatingDataChangeEvent implements
-DataChangeEvent<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> {
+DataChangeEvent<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> {
 
     private TranslatingDataChangeEvent() {
     }
 
-    public static DataChangeEvent<InstanceIdentifier, CompositeNode> createOperational(
-            final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change, final DataNormalizer normalizer) {
+    public static DataChangeEvent<YangInstanceIdentifier, CompositeNode> createOperational(
+            final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change, final DataNormalizer normalizer) {
         return new OperationalChangeEvent(change, normalizer);
     }
 
-    public static DataChangeEvent<InstanceIdentifier, CompositeNode> createConfiguration(
-            final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change, final DataNormalizer normalizer) {
+    public static DataChangeEvent<YangInstanceIdentifier, CompositeNode> createConfiguration(
+            final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change, final DataNormalizer normalizer) {
         return new ConfigurationChangeEvent(change, normalizer);
     }
 
     @Override
-    public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getCreatedOperationalData() {
+    public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getCreatedOperationalData() {
         return Collections.emptyMap();
     }
 
     @Override
-    public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getCreatedConfigurationData() {
+    public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getCreatedConfigurationData() {
         return Collections.emptyMap();
     }
 
     @Override
-    public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getUpdatedOperationalData() {
+    public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getUpdatedOperationalData() {
         return Collections.emptyMap();
     }
 
     @Override
-    public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getUpdatedConfigurationData() {
+    public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getUpdatedConfigurationData() {
         return Collections.emptyMap();
     }
 
     @Override
-    public Set<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> getRemovedConfigurationData() {
+    public Set<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> getRemovedConfigurationData() {
         return Collections.emptySet();
     }
 
     @Override
-    public Set<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> getRemovedOperationalData() {
+    public Set<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> getRemovedOperationalData() {
         return Collections.emptySet();
     }
 
     @Override
-    public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getOriginalConfigurationData() {
+    public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getOriginalConfigurationData() {
         return Collections.emptyMap();
     }
 
     @Override
-    public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getOriginalOperationalData() {
+    public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getOriginalOperationalData() {
         return Collections.emptyMap();
     }
 
@@ -100,24 +100,24 @@ DataChangeEvent<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, Com
 
     private final static class OperationalChangeEvent extends TranslatingDataChangeEvent {
 
-        private final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> delegate;
+        private final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> delegate;
         private final DataNormalizer normalizer;
-        private Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> updatedCache;
+        private Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> updatedCache;
 
-        public OperationalChangeEvent(final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change,
+        public OperationalChangeEvent(final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change,
                 final DataNormalizer normalizer) {
             this.delegate = change;
             this.normalizer = normalizer;
         }
 
         @Override
-        public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getCreatedOperationalData() {
+        public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getCreatedOperationalData() {
             return transformToLegacy(normalizer, delegate.getCreatedData());
         }
 
 
         @Override
-        public Set<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> getRemovedOperationalData() {
+        public Set<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> getRemovedOperationalData() {
             return delegate.getRemovedPaths();
         }
 
@@ -134,16 +134,16 @@ DataChangeEvent<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, Com
         }
 
         @Override
-        public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getOriginalOperationalData() {
+        public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getOriginalOperationalData() {
             return transformToLegacy(normalizer, delegate.getOriginalData());
         }
 
         @Override
-        public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getUpdatedOperationalData() {
+        public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getUpdatedOperationalData() {
             if(updatedCache == null) {
-                final Map<InstanceIdentifier, CompositeNode> updated = transformToLegacy(normalizer, delegate.getUpdatedData());
-                final Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> created = getCreatedConfigurationData();
-                final HashMap<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> updatedComposite = new HashMap<>(created.size() + updated.size());
+                final Map<YangInstanceIdentifier, CompositeNode> updated = transformToLegacy(normalizer, delegate.getUpdatedData());
+                final Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> created = getCreatedConfigurationData();
+                final HashMap<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> updatedComposite = new HashMap<>(created.size() + updated.size());
                 updatedComposite.putAll(created);
                 updatedComposite.putAll(updated);
                 updatedCache = Collections.unmodifiableMap(updatedComposite);
@@ -158,10 +158,10 @@ DataChangeEvent<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, Com
 
     }
 
-    private static Map<InstanceIdentifier, CompositeNode> transformToLegacy(final DataNormalizer normalizer, final Map<InstanceIdentifier, ? extends NormalizedNode<?, ?>> nodes) {
-        final Map<InstanceIdentifier, CompositeNode> legacy = Maps.newHashMap();
+    private static Map<YangInstanceIdentifier, CompositeNode> transformToLegacy(final DataNormalizer normalizer, final Map<YangInstanceIdentifier, ? extends NormalizedNode<?, ?>> nodes) {
+        final Map<YangInstanceIdentifier, CompositeNode> legacy = Maps.newHashMap();
 
-        for (final Map.Entry<InstanceIdentifier, ? extends NormalizedNode<?, ?>> entry : nodes.entrySet()) {
+        for (final Map.Entry<YangInstanceIdentifier, ? extends NormalizedNode<?, ?>> entry : nodes.entrySet()) {
             try {
                 legacy.put(normalizer.toLegacy(entry.getKey()), normalizer.toLegacy(entry.getKey(), entry.getValue()));
             } catch (final DataNormalizationException e) {
@@ -173,24 +173,24 @@ DataChangeEvent<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, Com
 
     private final static class ConfigurationChangeEvent extends TranslatingDataChangeEvent {
 
-        private final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> delegate;
+        private final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> delegate;
         private final DataNormalizer normalizer;
-        private Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> updatedCache;
+        private Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> updatedCache;
 
-        public ConfigurationChangeEvent(final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change,
+        public ConfigurationChangeEvent(final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change,
                 final DataNormalizer normalizer) {
             this.delegate = change;
             this.normalizer = normalizer;
         }
 
         @Override
-        public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getCreatedConfigurationData() {
+        public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getCreatedConfigurationData() {
             return transformToLegacy(normalizer, delegate.getCreatedData());
         }
 
 
         @Override
-        public Set<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier> getRemovedConfigurationData() {
+        public Set<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier> getRemovedConfigurationData() {
             return delegate.getRemovedPaths();
         }
 
@@ -207,16 +207,16 @@ DataChangeEvent<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, Com
         }
 
         @Override
-        public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getOriginalConfigurationData() {
+        public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getOriginalConfigurationData() {
             return transformToLegacy(normalizer, delegate.getOriginalData());
         }
 
         @Override
-        public Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> getUpdatedConfigurationData() {
+        public Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> getUpdatedConfigurationData() {
             if(updatedCache == null) {
-                final Map<InstanceIdentifier, CompositeNode> updated = transformToLegacy(normalizer, delegate.getUpdatedData());
-                final Map<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> created = getCreatedConfigurationData();
-                final HashMap<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> updatedComposite = new HashMap<>(created.size() + updated.size());
+                final Map<YangInstanceIdentifier, CompositeNode> updated = transformToLegacy(normalizer, delegate.getUpdatedData());
+                final Map<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> created = getCreatedConfigurationData();
+                final HashMap<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, CompositeNode> updatedComposite = new HashMap<>(created.size() + updated.size());
                 updatedComposite.putAll(created);
                 updatedComposite.putAll(updated);
                 updatedCache = Collections.unmodifiableMap(updatedComposite);
index 1ce252df98ca4e030ec4fdfc43dd5004a432d54a..b9504e72685f92f401173030af658d34b1982dcf 100644 (file)
@@ -18,7 +18,7 @@ import org.opendaylight.controller.sal.core.api.data.DataChangeListener;
 import org.opendaylight.yangtools.concepts.Delegator;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 abstract class TranslatingListenerInvoker implements AutoCloseable, DOMDataChangeListener, Delegator<DataChangeListener> {
@@ -41,19 +41,19 @@ abstract class TranslatingListenerInvoker implements AutoCloseable, DOMDataChang
     }
 
     @Override
-    public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> normalizedChange) {
+    public void onDataChanged(final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedChange) {
         delegate.onDataChanged(getLegacyEvent(normalizer, normalizedChange));
     }
 
-    abstract DataChangeEvent<InstanceIdentifier, CompositeNode> getLegacyEvent(final DataNormalizer normalizer,
-                                                                               final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> normalizedChange);
+    abstract DataChangeEvent<YangInstanceIdentifier, CompositeNode> getLegacyEvent(final DataNormalizer normalizer,
+                                                                               final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedChange);
 
     @Override
     public DataChangeListener getDelegate() {
         return delegate;
     }
 
-    abstract void register(final DOMDataBroker backingBroker, final InstanceIdentifier normalizedPath);
+    abstract void register(final DOMDataBroker backingBroker, final YangInstanceIdentifier normalizedPath);
 
     @Override
     public void close() {
@@ -68,12 +68,12 @@ abstract class TranslatingListenerInvoker implements AutoCloseable, DOMDataChang
             super(listener, normalizer);
         }
 
-        DataChangeEvent<InstanceIdentifier, CompositeNode> getLegacyEvent(final DataNormalizer normalizer, final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> normalizedChange) {
+        DataChangeEvent<YangInstanceIdentifier, CompositeNode> getLegacyEvent(final DataNormalizer normalizer, final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedChange) {
             return TranslatingDataChangeEvent.createConfiguration(normalizedChange, normalizer);
         }
 
         @Override
-        void register(final DOMDataBroker backingBroker, final InstanceIdentifier normalizedPath) {
+        void register(final DOMDataBroker backingBroker, final YangInstanceIdentifier normalizedPath) {
             reg = backingBroker.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION, normalizedPath, this,
                     AsyncDataBroker.DataChangeScope.SUBTREE);
         }
@@ -85,12 +85,12 @@ abstract class TranslatingListenerInvoker implements AutoCloseable, DOMDataChang
             super(listener, normalizer);
         }
 
-        DataChangeEvent<InstanceIdentifier, CompositeNode> getLegacyEvent(final DataNormalizer normalizer, final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> normalizedChange) {
+        DataChangeEvent<YangInstanceIdentifier, CompositeNode> getLegacyEvent(final DataNormalizer normalizer, final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> normalizedChange) {
             return TranslatingDataChangeEvent.createOperational(normalizedChange, normalizer);
         }
 
         @Override
-        void register(final DOMDataBroker backingBroker, final InstanceIdentifier normalizedPath) {
+        void register(final DOMDataBroker backingBroker, final YangInstanceIdentifier normalizedPath) {
             reg = backingBroker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, normalizedPath, this,
                     AsyncDataBroker.DataChangeScope.SUBTREE);
         }
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/mount/DOMMountPointServiceImpl.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/mount/DOMMountPointServiceImpl.java
new file mode 100644 (file)
index 0000000..4165066
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * 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.sal.dom.broker.impl.mount;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ClassToInstanceMap;
+import com.google.common.collect.MutableClassToInstanceMap;
+import java.util.HashMap;
+import java.util.Map;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
+import org.opendaylight.controller.md.sal.dom.api.DOMService;
+import org.opendaylight.controller.md.sal.dom.broker.spi.mount.SimpleDOMMountPoint;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
+import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+public class DOMMountPointServiceImpl implements DOMMountPointService {
+
+    private final Map<YangInstanceIdentifier, DOMMountPoint> mountPoints = new HashMap<>();
+
+    private final ListenerRegistry<MountProvisionListener> listeners = ListenerRegistry.create();
+
+    @Override
+    public Optional<DOMMountPoint> getMountPoint(final YangInstanceIdentifier path) {
+        return Optional.fromNullable(mountPoints.get(path));
+    }
+
+    @Override
+    public DOMMountPointBuilder createMountPoint(final YangInstanceIdentifier path) {
+        Preconditions.checkState(!mountPoints.containsKey(path), "Mount point already exists");
+        return new DOMMountPointBuilderImpl(path);
+    }
+
+    public void notifyMountCreated(final YangInstanceIdentifier identifier) {
+        for (final ListenerRegistration<MountProvisionListener> listener : listeners
+                .getListeners()) {
+            listener.getInstance().onMountPointCreated(identifier);
+        }
+    }
+
+    public void notifyMountRemoved(final YangInstanceIdentifier identifier) {
+        for (final ListenerRegistration<MountProvisionListener> listener : listeners
+                .getListeners()) {
+            listener.getInstance().onMountPointRemoved(identifier);
+        }
+    }
+
+    @Override
+    public ListenerRegistration<MountProvisionListener> registerProvisionListener(
+            final MountProvisionListener listener) {
+        return listeners.register(listener);
+    }
+
+    public ObjectRegistration<DOMMountPoint> registerMountPoint(final DOMMountPoint mountPoint) {
+        synchronized (mountPoints) {
+            Preconditions.checkState(!mountPoints.containsKey(mountPoint.getIdentifier()), "Mount point already exists");
+            mountPoints.put(mountPoint.getIdentifier(), mountPoint);
+        }
+        notifyMountCreated(mountPoint.getIdentifier());
+
+        return new MountRegistration(mountPoint);
+    }
+
+    public void unregisterMountPoint(final YangInstanceIdentifier mountPointId) {
+        synchronized (mountPoints) {
+            Preconditions.checkState(mountPoints.containsKey(mountPointId), "Mount point does not exist");
+            mountPoints.remove(mountPointId);
+        }
+        notifyMountRemoved(mountPointId);
+    }
+
+    public class DOMMountPointBuilderImpl implements DOMMountPointBuilder {
+
+        ClassToInstanceMap<DOMService> services = MutableClassToInstanceMap.create();
+        private SimpleDOMMountPoint mountPoint;
+        private final YangInstanceIdentifier path;
+        private SchemaContext schemaContext;
+
+        public DOMMountPointBuilderImpl(final YangInstanceIdentifier path) {
+            this.path = path;
+        }
+
+        @Override
+        public <T extends DOMService> DOMMountPointBuilder addService(final Class<T> type, final T impl) {
+            services.putInstance(type, impl);
+            return this;
+        }
+
+        @Override
+        public DOMMountPointBuilder addInitialSchemaContext(final SchemaContext ctx) {
+            schemaContext = ctx;
+            return this;
+        }
+
+        @Override
+        public ObjectRegistration<DOMMountPoint> register() {
+            Preconditions.checkState(mountPoint == null, "Mount point is already built.");
+            mountPoint = SimpleDOMMountPoint.create(path, services,schemaContext);
+            return registerMountPoint(mountPoint);
+        }
+    }
+
+    private final class MountRegistration implements ObjectRegistration<DOMMountPoint> {
+        private final DOMMountPoint mountPoint;
+
+        public MountRegistration(final DOMMountPoint mountPoint) {
+            this.mountPoint = mountPoint;
+        }
+
+        @Override
+        public DOMMountPoint getInstance() {
+            return mountPoint;
+        }
+
+        @Override
+        public void close() throws Exception {
+            unregisterMountPoint(mountPoint.getIdentifier());
+        }
+    }
+}
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPoint.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPoint.java
new file mode 100644 (file)
index 0000000..61ea47e
--- /dev/null
@@ -0,0 +1,568 @@
+/*
+ * 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.dom.broker;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.JdkFutureAdapters;
+import com.google.common.util.concurrent.ListenableFuture;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.annotation.Nullable;
+import org.opendaylight.controller.md.sal.common.api.RegistrationListener;
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandlerRegistration;
+import org.opendaylight.controller.md.sal.common.api.data.DataReader;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
+import org.opendaylight.controller.md.sal.common.impl.ListenerRegistry;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationException;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizer;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataChangeListener;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
+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.api.DOMMountPoint;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
+import org.opendaylight.controller.md.sal.dom.api.DOMService;
+import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
+import org.opendaylight.controller.md.sal.dom.broker.impl.compat.BackwardsCompatibleDataBroker;
+import org.opendaylight.controller.sal.common.DataStoreIdentifier;
+import org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration;
+import org.opendaylight.controller.sal.core.api.Broker.RpcRegistration;
+import org.opendaylight.controller.sal.core.api.RoutedRpcDefaultImplementation;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
+import org.opendaylight.controller.sal.core.api.RpcRegistrationListener;
+import org.opendaylight.controller.sal.core.api.RpcRoutingContext;
+import org.opendaylight.controller.sal.core.api.data.DataChangeListener;
+import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction;
+import org.opendaylight.controller.sal.core.api.data.DataProviderService;
+import org.opendaylight.controller.sal.core.api.data.DataValidator;
+import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
+import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
+import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService;
+import org.opendaylight.controller.sal.dom.broker.impl.NotificationRouterImpl;
+import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareRpcBroker;
+import org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProvider;
+import org.opendaylight.controller.sal.dom.broker.spi.NotificationRouter;
+import org.opendaylight.controller.sal.dom.broker.util.ProxySchemaContext;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
+
+public class BackwardsCompatibleMountPoint implements MountProvisionInstance, SchemaContextProvider, SchemaService {
+
+    private final DataProviderService dataReader;
+    private final DataReader<YangInstanceIdentifier,CompositeNode> readWrapper;
+
+    private final YangInstanceIdentifier mountPath;
+    private final NotificationPublishService notificationPublishService;
+    private final RpcProvisionRegistry rpcs;
+
+    private final ListenerRegistry<SchemaContextListener> schemaListenerRegistry = new ListenerRegistry<>();
+
+    private SchemaContext schemaContext;
+
+    public BackwardsCompatibleMountPoint(final YangInstanceIdentifier path, final DOMMountPointService.DOMMountPointBuilder mountPointBuilder) {
+        this.mountPath = Preconditions.checkNotNull(path);
+        Preconditions.checkNotNull(mountPointBuilder);
+
+        dataReader = new DataBrokerImpl();
+        readWrapper = new ReadWrapper();
+        notificationPublishService = new DelgatingNotificationPublishService();
+        rpcs = new SchemaAwareRpcBroker(path.toString(), this);
+
+        mountPointBuilder.addService(DOMDataBroker.class, new BackwardsCompatibleDomStore(dataReader, this));
+        mountPointBuilder.addService(NotificationPublishService.class, notificationPublishService);
+        mountPointBuilder.addService(RpcProvisionRegistry.class, rpcs);
+
+        mountPointBuilder.addInitialSchemaContext(new ProxySchemaContext(this));
+
+        mountPointBuilder.register();
+    }
+
+    public BackwardsCompatibleMountPoint(final YangInstanceIdentifier path, final DOMMountPoint mount) {
+        this.mountPath = Preconditions.checkNotNull(path);
+        Preconditions.checkNotNull(mount);
+
+        final DOMDataBroker domBroker = getServiceWithCheck(mount, DOMDataBroker.class);
+
+        this.schemaContext = mount.getSchemaContext();
+
+        dataReader = new BackwardsCompatibleDataBroker(domBroker, this);
+
+        // Set schema context to provide it for BackwardsCompatibleDataBroker
+        if(schemaContext != null) {
+            setSchemaContext(schemaContext);
+        }
+
+        readWrapper = new ReadWrapper();
+
+        notificationPublishService = getServiceWithCheck(mount, NotificationPublishService.class);
+        rpcs = getServiceWithCheck(mount, RpcProvisionRegistry.class);
+    }
+
+    private <T extends DOMService> T getServiceWithCheck(final DOMMountPoint mount, final Class<T> type) {
+        final Optional<T> serviceOptional = mount.getService(type);
+        Preconditions.checkArgument(serviceOptional.isPresent(), "Service {} has to be set in {}. " +
+                "Cannot construct backwards compatible mount wrapper without it", type, mount);
+        return serviceOptional.get();
+    }
+
+    @Override
+    public void addModule(final Module module) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void removeModule(final Module module) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public SchemaContext getSessionContext() {
+        return getSchemaContext();
+    }
+
+    @Override
+    public SchemaContext getGlobalContext() {
+        return getSchemaContext();
+    }
+
+    @Override
+    public ListenerRegistration<SchemaContextListener> registerSchemaContextListener(final SchemaContextListener listener) {
+        return schemaListenerRegistry.register(listener);
+    }
+
+    @Override
+    public void publish(final CompositeNode notification) {
+        notificationPublishService.publish(notification);
+    }
+
+    @Override
+    public ListenerRegistration<NotificationListener> addNotificationListener(final QName notification, final NotificationListener listener) {
+        return notificationPublishService.addNotificationListener(notification, listener);
+    }
+
+    // TODO Read wrapper is never used ... same in org.opendaylight.controller.sal.dom.broker.MountPointImpl
+    public DataReader<YangInstanceIdentifier, CompositeNode> getReadWrapper() {
+        return readWrapper;
+    }
+
+    @Override
+    public CompositeNode readConfigurationData(final YangInstanceIdentifier path) {
+        return dataReader.readConfigurationData(path);
+    }
+
+    @Override
+    public CompositeNode readOperationalData(final YangInstanceIdentifier path) {
+        return dataReader.readOperationalData(path);
+    }
+
+    @Override
+    public Registration registerOperationalReader(
+            final YangInstanceIdentifier path, final DataReader<YangInstanceIdentifier, CompositeNode> reader) {
+        return dataReader.registerOperationalReader(path, reader);
+    }
+
+    @Override
+    public Registration registerConfigurationReader(
+            final YangInstanceIdentifier path, final DataReader<YangInstanceIdentifier, CompositeNode> reader) {
+        return dataReader.registerConfigurationReader(path, reader);
+    }
+
+    @Override
+    public RoutedRpcRegistration addRoutedRpcImplementation(final QName rpcType, final RpcImplementation implementation) {
+        return rpcs.addRoutedRpcImplementation(rpcType, implementation);
+    }
+
+    @Override
+    public void setRoutedRpcDefaultDelegate(final RoutedRpcDefaultImplementation defaultImplementation) {
+        rpcs.setRoutedRpcDefaultDelegate(defaultImplementation);
+    }
+
+    @Override
+    public RpcRegistration addRpcImplementation(final QName rpcType, final RpcImplementation implementation)
+            throws IllegalArgumentException {
+        return rpcs.addRpcImplementation(rpcType, implementation);
+    }
+
+    @Override
+    public Set<QName> getSupportedRpcs() {
+        return rpcs.getSupportedRpcs();
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<CompositeNode>> invokeRpc(final QName rpc, final CompositeNode input) {
+        return rpcs.invokeRpc(rpc, input);
+    }
+
+    @Override
+    public ListenerRegistration<RpcRegistrationListener> addRpcRegistrationListener(final RpcRegistrationListener listener) {
+        return rpcs.addRpcRegistrationListener(listener);
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<CompositeNode>> rpc(final QName type, final CompositeNode input) {
+        return rpcs.invokeRpc(type, input);
+    }
+
+    @Override
+    public DataModificationTransaction beginTransaction() {
+        return dataReader.beginTransaction();
+    }
+
+    @Override
+    public ListenerRegistration<DataChangeListener> registerDataChangeListener(final YangInstanceIdentifier path,
+            final DataChangeListener listener) {
+        return dataReader.registerDataChangeListener(path, listener);
+    }
+
+    @Override
+    public Registration registerCommitHandler(
+            final YangInstanceIdentifier path, final DataCommitHandler<YangInstanceIdentifier, CompositeNode> commitHandler) {
+        return dataReader.registerCommitHandler(path, commitHandler);
+    }
+
+    @Override
+    public void removeRefresher(final DataStoreIdentifier store, final DataRefresher refresher) {
+        // NOOP
+    }
+
+    @Override
+    public void addRefresher(final DataStoreIdentifier store, final DataRefresher refresher) {
+        // NOOP
+    }
+
+    @Override
+    public void addValidator(final DataStoreIdentifier store, final DataValidator validator) {
+        // NOOP
+    }
+    @Override
+    public void removeValidator(final DataStoreIdentifier store, final DataValidator validator) {
+        // NOOP
+    }
+
+    @Override
+    public SchemaContext getSchemaContext() {
+        return schemaContext;
+    }
+
+    @Override
+    public void setSchemaContext(final SchemaContext schemaContext) {
+        this.schemaContext = schemaContext;
+        for (ListenerRegistration<SchemaContextListener> schemaServiceListenerListenerRegistration : schemaListenerRegistry.getListeners()) {
+            schemaServiceListenerListenerRegistration.getInstance().onGlobalContextUpdated(schemaContext);
+        }
+    }
+
+    class ReadWrapper implements DataReader<YangInstanceIdentifier, CompositeNode> {
+        private YangInstanceIdentifier shortenPath(final YangInstanceIdentifier path) {
+            YangInstanceIdentifier ret = null;
+            if(mountPath.contains(path)) {
+                final List<PathArgument> newArgs = path.getPath().subList(mountPath.getPath().size(), path.getPath().size());
+                ret = YangInstanceIdentifier.create(newArgs);
+            }
+            return ret;
+        }
+
+        @Override
+        public CompositeNode readConfigurationData(final YangInstanceIdentifier path) {
+            final YangInstanceIdentifier newPath = shortenPath(path);
+            if(newPath == null) {
+                return null;
+            }
+            return BackwardsCompatibleMountPoint.this.readConfigurationData(newPath);
+        }
+
+        @Override
+        public CompositeNode readOperationalData(final YangInstanceIdentifier path) {
+            final YangInstanceIdentifier newPath = shortenPath(path);
+            if(newPath == null) {
+                return null;
+            }
+            return BackwardsCompatibleMountPoint.this.readOperationalData(newPath);
+        }
+    }
+
+    @Override
+    public ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<YangInstanceIdentifier, CompositeNode>>> registerCommitHandlerListener(
+            final RegistrationListener<DataCommitHandlerRegistration<YangInstanceIdentifier, CompositeNode>> commitHandlerListener) {
+        return dataReader.registerCommitHandlerListener(commitHandlerListener);
+    }
+
+    @Override
+    public <L extends RouteChangeListener<RpcRoutingContext, YangInstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(
+            final L listener) {
+        return rpcs.registerRouteChangeListener(listener);
+    }
+
+    @VisibleForTesting
+    static final class BackwardsCompatibleDomStore implements DOMDataBroker {
+        private final DataProviderService dataReader;
+        private final SchemaContextProvider schemaContextProvider;
+
+        public BackwardsCompatibleDomStore(final DataProviderService dataReader, final SchemaContextProvider schemaContextProvider) {
+            this.dataReader = dataReader;
+            this.schemaContextProvider = schemaContextProvider;
+        }
+
+        @Override
+        public DOMDataReadOnlyTransaction newReadOnlyTransaction() {
+            final DataNormalizer dataNormalizer = new DataNormalizer(schemaContextProvider.getSchemaContext());
+            return new BackwardsCompatibleReadTransaction(dataReader, dataNormalizer);
+        }
+
+        @Override
+        public DOMDataWriteTransaction newWriteOnlyTransaction() {
+            final DataNormalizer dataNormalizer = new DataNormalizer(schemaContextProvider.getSchemaContext());
+            return new BackwardsCompatibleWriteTransaction(dataReader, dataNormalizer);
+        }
+
+        @Override
+        public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store, final YangInstanceIdentifier path, final DOMDataChangeListener listener, final DataChangeScope triggeringScope) {
+            throw new UnsupportedOperationException("Register data listener not supported for mount point");
+        }
+
+        @Override
+        public DOMTransactionChain createTransactionChain(final TransactionChainListener listener) {
+            throw new UnsupportedOperationException("Transaction chain not supported for mount point");
+        }
+
+        @Override
+        public DOMDataReadWriteTransaction newReadWriteTransaction() {
+            final DataNormalizer dataNormalizer = new DataNormalizer(schemaContextProvider.getSchemaContext());
+            return new BackwardsCompatibleReadWriteTransaction(dataReader, dataNormalizer);
+        }
+
+        @VisibleForTesting
+        static final class BackwardsCompatibleReadTransaction implements DOMDataReadOnlyTransaction {
+            private final DataProviderService dataReader;
+            private final DataNormalizer normalizer;
+
+            public BackwardsCompatibleReadTransaction(final DataProviderService dataReader, final DataNormalizer normalizer) {
+                this.dataReader = dataReader;
+                this.normalizer = normalizer;
+            }
+
+            @Override
+            public Object getIdentifier() {
+                return this;
+            }
+
+            @Override
+            public void close() {
+                // NOOP
+            }
+
+            @Override
+            public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+
+                CompositeNode rawData = null;
+
+                switch (store) {
+                    case CONFIGURATION: {
+                        rawData = dataReader.readConfigurationData(path);
+                        break;
+                    }
+                    case OPERATIONAL: {
+                        rawData = dataReader.readOperationalData(path);
+                        break;
+                    }
+                }
+                Preconditions.checkNotNull(rawData, "Unable to read %s data on path %s", store, path);
+
+                final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> normalized = normalizer.toNormalized(path, rawData);
+                final Optional<NormalizedNode<?, ?>> normalizedNodeOptional = Optional.<NormalizedNode<?, ?>>fromNullable(normalized.getValue());
+                return com.google.common.util.concurrent.Futures.immediateFuture(normalizedNodeOptional);
+            }
+        }
+
+        @VisibleForTesting
+        static final class BackwardsCompatibleWriteTransaction implements DOMDataWriteTransaction {
+            private DataModificationTransaction oldTx;
+            private final DataNormalizer dataNormalizer;
+
+            public BackwardsCompatibleWriteTransaction(final DataProviderService dataReader, final DataNormalizer dataNormalizer) {
+                this.oldTx = dataReader.beginTransaction();
+                this.dataNormalizer = dataNormalizer;
+            }
+
+            @Override
+            public Object getIdentifier() {
+                return this;
+            }
+
+            @Override
+            public boolean cancel() {
+                oldTx = null;
+                return true;
+            }
+
+            @Override
+            public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+                final CompositeNode legacyData = dataNormalizer.toLegacy(path, data);
+                try {
+                    final YangInstanceIdentifier legacyPath = dataNormalizer.toLegacy(path);
+
+                    switch (store) {
+                        case CONFIGURATION: {
+                            oldTx.putConfigurationData(legacyPath, legacyData);
+                            return;
+                        }
+                    }
+
+                    throw new IllegalArgumentException("Cannot put data " + path + " to datastore " + store);
+                } catch (final DataNormalizationException e) {
+                    throw new IllegalArgumentException(String.format("Cannot transform path %s to legacy format", path), e);
+                }
+            }
+
+            @Override
+            public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+                // TODO not supported
+                throw new UnsupportedOperationException("Merge not supported for mount point");
+            }
+
+            @Override
+            public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+                try {
+                    final YangInstanceIdentifier legacyPath = dataNormalizer.toLegacy(path);
+
+                    switch (store) {
+                        case CONFIGURATION: {
+                            oldTx.removeConfigurationData(legacyPath);
+                            return;
+                        }
+                    }
+                    throw new IllegalArgumentException("Cannot delete data " + path + " from datastore " + store);
+                } catch (final DataNormalizationException e) {
+                    throw new IllegalArgumentException(String.format("Cannot transform path %s to legacy format", path), e);
+                }
+            }
+
+            @Override
+            public CheckedFuture<Void, TransactionCommitFailedException> submit() {
+                final ListenableFuture<Void> commitAsVoid = Futures.transform(commit(), new Function<RpcResult<TransactionStatus>, Void>() {
+                    @Override
+                    public Void apply(@Nullable final RpcResult<TransactionStatus> input) {
+                        return null;
+                    }
+                });
+
+                return Futures.makeChecked(commitAsVoid, new Function<Exception, TransactionCommitFailedException>() {
+                    @Override
+                    public TransactionCommitFailedException apply(@Nullable final Exception input) {
+                        return new TransactionCommitFailedException("Commit failed", input);
+                    }
+                });
+            }
+
+            @Override
+            public ListenableFuture<RpcResult<TransactionStatus>> commit() {
+                return JdkFutureAdapters.listenInPoolThread(oldTx.commit());
+            }
+        }
+
+
+        @VisibleForTesting
+        static class BackwardsCompatibleReadWriteTransaction implements DOMDataReadWriteTransaction {
+
+            private final DataProviderService dataReader;
+            private final DataNormalizer dataNormalizer;
+            private final BackwardsCompatibleWriteTransaction delegateWriteTx;
+
+            public BackwardsCompatibleReadWriteTransaction(final DataProviderService dataReader, final DataNormalizer dataNormalizer) {
+                this.dataReader = dataReader;
+                this.dataNormalizer = dataNormalizer;
+                this.delegateWriteTx = new BackwardsCompatibleWriteTransaction(dataReader, dataNormalizer);
+            }
+
+            @Override
+            public Object getIdentifier() {
+                return this;
+            }
+
+            @Override
+            public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+                return new BackwardsCompatibleReadTransaction(dataReader, dataNormalizer).read(store, path);
+            }
+
+            @Override
+            public boolean cancel() {
+                return delegateWriteTx.cancel();
+            }
+
+            @Override
+            public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+                delegateWriteTx.put(store, path, data);
+            }
+
+            @Override
+            public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+                delegateWriteTx.merge(store, path, data);
+            }
+
+            @Override
+            public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+                delegateWriteTx.delete(store, path);
+            }
+
+            @Override
+            public CheckedFuture<Void, TransactionCommitFailedException> submit() {
+                return delegateWriteTx.submit();
+            }
+
+            @Override
+            public ListenableFuture<RpcResult<TransactionStatus>> commit() {
+                return delegateWriteTx.commit();
+            }
+        }
+    }
+
+    private class DelgatingNotificationPublishService implements NotificationPublishService {
+        private final NotificationRouter notificationRouter;
+
+        public DelgatingNotificationPublishService(final NotificationRouter notificationRouter) {
+            this.notificationRouter = notificationRouter;
+        }
+
+        private DelgatingNotificationPublishService() {
+            this(new NotificationRouterImpl());
+        }
+
+        @Override
+        public void publish(final CompositeNode notification) {
+            notificationRouter.publish(notification);
+        }
+
+        @Override
+        public ListenerRegistration<NotificationListener> addNotificationListener(final QName notification, final NotificationListener listener) {
+            return notificationRouter.addNotificationListener(notification, listener);
+        }
+    }
+}
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPointManager.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPointManager.java
new file mode 100644 (file)
index 0000000..b01db3d
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * 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.dom.broker;
+
+import static com.google.common.base.Preconditions.checkState;
+
+import com.google.common.base.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+public class BackwardsCompatibleMountPointManager implements MountProvisionService, MountProvisionListener {
+
+    private final ListenerRegistry<MountProvisionListener> listeners = ListenerRegistry.create();
+    private final ConcurrentMap<YangInstanceIdentifier, MountProvisionInstance> mounts = new ConcurrentHashMap<>();
+
+    private final DOMMountPointService domMountPointService;
+
+    public BackwardsCompatibleMountPointManager(final DOMMountPointService domMountPointService) {
+        this.domMountPointService = domMountPointService;
+    }
+
+    @Override
+    public MountProvisionInstance createMountPoint(final YangInstanceIdentifier path) {
+        checkState(!mounts.containsKey(path), "Mount already created");
+        // Create mount point instance, wrap instance of new API with BackwardsCompatibleMountPoint to preserve backwards comatibility
+        final BackwardsCompatibleMountPoint mount = new BackwardsCompatibleMountPoint(path, domMountPointService.createMountPoint(path));
+        mounts.put(path, mount);
+        return mount;
+    }
+
+    public void notifyMountCreated(final YangInstanceIdentifier identifier) {
+        for (final ListenerRegistration<MountProvisionListener> listener : listeners.getListeners()) {
+            listener.getInstance().onMountPointCreated(identifier);
+        }
+    }
+
+    public void notifyMountRemoved(final YangInstanceIdentifier identifier) {
+        for (final ListenerRegistration<MountProvisionListener> listener : listeners.getListeners()) {
+            listener.getInstance().onMountPointRemoved(identifier);
+        }
+    }
+
+    @Override
+    public MountProvisionInstance createOrGetMountPoint(
+            final YangInstanceIdentifier path) {
+        final MountProvisionInstance mount = getMountPoint(path);
+        if (mount == null) {
+            return createMountPoint(path);
+        }
+        return mount;
+    }
+
+    @Override
+    public MountProvisionInstance getMountPoint(final YangInstanceIdentifier path) {
+        // If the mount point was created here, return directly
+        if(mounts.containsKey(path)) {
+            return mounts.get(path);
+        }
+
+        // If mount was created in underlying DOMMountService, wrap as MountProvisionInstance
+        final Optional<DOMMountPoint> mount = domMountPointService.getMountPoint(path);
+        if(mount.isPresent()) {
+            return new BackwardsCompatibleMountPoint(path, mount.get());
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public ListenerRegistration<MountProvisionListener> registerProvisionListener(
+            final MountProvisionListener listener) {
+        return domMountPointService.registerProvisionListener(listener);
+    }
+
+    @Override
+    public void onMountPointCreated(final YangInstanceIdentifier path) {
+        notifyMountCreated(path);
+    }
+
+    @Override
+    public void onMountPointRemoved(final YangInstanceIdentifier path) {
+            notifyMountRemoved(path);
+    }
+}
index 1af03e50465e2acc922f19ad66f15a3c640bfc34..a200793fea651ebb09b32bc53708d4cbbf3d67b3 100644 (file)
@@ -27,7 +27,7 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -62,22 +62,13 @@ public class BrokerImpl implements Broker, RpcProvisionRegistry, AutoCloseable {
     @Override
     public ConsumerSession registerConsumer(final Consumer consumer,
             final BundleContext ctx) {
-        checkPredicates(consumer);
-        log.trace("Registering consumer {}", consumer);
-        final ConsumerContextImpl session = newSessionFor(consumer, ctx);
-        consumer.onSessionInitiated(session);
-        sessions.add(session);
-        return session;
+        return registerConsumer(consumer);
     }
 
     @Override
     public ProviderSession registerProvider(final Provider provider,
             final BundleContext ctx) {
-        checkPredicates(provider);
-        final ProviderContextImpl session = newSessionFor(provider, ctx);
-        provider.onSessionInitiated(session);
-        providerSessions.add(session);
-        return session;
+        return registerProvider(provider);
     }
 
     protected Future<RpcResult<CompositeNode>> invokeRpcAsync(final QName rpc,
@@ -106,14 +97,12 @@ public class BrokerImpl implements Broker, RpcProvisionRegistry, AutoCloseable {
     }
 
     // Private Factory methods
-    private ConsumerContextImpl newSessionFor(final Consumer provider,
-            final BundleContext ctx) {
+    private ConsumerContextImpl newSessionFor(final Consumer provider) {
         ConsumerContextImpl ret = new ConsumerContextImpl(provider, this);
         return ret;
     }
 
-    private ProviderContextImpl newSessionFor(final Provider provider,
-            final BundleContext ctx) {
+    private ProviderContextImpl newSessionFor(final Provider provider) {
         ProviderContextImpl ret = new ProviderContextImpl(provider, this);
         return ret;
     }
@@ -158,7 +147,7 @@ public class BrokerImpl implements Broker, RpcProvisionRegistry, AutoCloseable {
     }
 
     @Override
-    public <L extends RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(
+    public <L extends RouteChangeListener<RpcRoutingContext, YangInstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(
             final L listener) {
         return router.registerRouteChangeListener(listener);
     }
@@ -208,4 +197,25 @@ public class BrokerImpl implements Broker, RpcProvisionRegistry, AutoCloseable {
         return Optional.fromNullable(services.getInstance(service));
     }
 
+
+    @Override
+    public ConsumerSession registerConsumer(Consumer consumer) {
+        checkPredicates(consumer);
+        log.trace("Registering consumer {}", consumer);
+        final ConsumerContextImpl session = newSessionFor(consumer);
+        consumer.onSessionInitiated(session);
+        sessions.add(session);
+        return session;
+    }
+
+
+    @Override
+    public ProviderSession registerProvider(Provider provider) {
+        checkPredicates(provider);
+        final ProviderContextImpl session = newSessionFor(provider);
+        provider.onSessionInitiated(session);
+        providerSessions.add(session);
+        return session;
+    }
+
 }
index 69f518bb32f5c57f467285f0a32056240893043b..27e351c28a05707a782be3b3e708b01d5cde60e6 100644 (file)
@@ -18,11 +18,11 @@ import org.opendaylight.controller.sal.core.api.data.DataValidator;
 import org.opendaylight.controller.sal.dom.broker.impl.DataReaderRouter;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 import com.google.common.util.concurrent.MoreExecutors;
 
-public class DataBrokerImpl extends AbstractDataBroker<InstanceIdentifier, CompositeNode, DataChangeListener> implements
+public class DataBrokerImpl extends AbstractDataBroker<YangInstanceIdentifier, CompositeNode, DataChangeListener> implements
         DataProviderService, AutoCloseable {
 
     private AtomicLong nextTransaction = new AtomicLong();
@@ -45,14 +45,14 @@ public class DataBrokerImpl extends AbstractDataBroker<InstanceIdentifier, Compo
     }
 
     @Override
-    public Registration<DataReader<InstanceIdentifier, CompositeNode>> registerConfigurationReader(
-            InstanceIdentifier path, DataReader<InstanceIdentifier, CompositeNode> reader) {
+    public Registration registerConfigurationReader(
+            YangInstanceIdentifier path, DataReader<YangInstanceIdentifier, CompositeNode> reader) {
         return getDataReadRouter().registerConfigurationReader(path, reader);
     }
 
     @Override
-    public Registration<DataReader<InstanceIdentifier, CompositeNode>> registerOperationalReader(
-            InstanceIdentifier path, DataReader<InstanceIdentifier, CompositeNode> reader) {
+    public Registration registerOperationalReader(
+            YangInstanceIdentifier path, DataReader<YangInstanceIdentifier, CompositeNode> reader) {
         return getDataReadRouter().registerOperationalReader(path, reader);
     }
 
index 65aa99deea9e70b62a0a86d6b108a10048ea1a30..f0dd5b921c7624ae985adc5cdf15bcc9546813fa 100644 (file)
@@ -13,9 +13,9 @@ import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
-public class DataTransactionImpl extends AbstractDataTransaction<InstanceIdentifier, CompositeNode>
+public class DataTransactionImpl extends AbstractDataTransaction<YangInstanceIdentifier, CompositeNode>
     implements DataModificationTransaction {
     private final ListenerRegistry<DataTransactionListener> listeners = new ListenerRegistry<DataTransactionListener>();
 
index 60a7e81c4c046183e6ee59e0f27d48e5a15e90bc..82637327f6b10d719c04e4fa04ad6a7b53b2dafe 100644 (file)
@@ -23,7 +23,7 @@ import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 import org.opendaylight.yangtools.yang.parser.impl.util.URLSchemaContextResolver;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -40,16 +40,16 @@ import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 
-public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvider, SchemaService, ServiceTrackerCustomizer<SchemaServiceListener, SchemaServiceListener>, AutoCloseable {
+public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvider, SchemaService, ServiceTrackerCustomizer<SchemaContextListener, SchemaContextListener>, AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(GlobalBundleScanningSchemaServiceImpl.class);
 
-    private final ListenerRegistry<SchemaServiceListener> listeners = new ListenerRegistry<>();
+    private final ListenerRegistry<SchemaContextListener> listeners = new ListenerRegistry<>();
     private final URLSchemaContextResolver contextResolver = new URLSchemaContextResolver();
     private final BundleScanner scanner = new BundleScanner();
     private final BundleContext context;
 
-    private ServiceTracker<SchemaServiceListener, SchemaServiceListener> listenerTracker;
-    private BundleTracker<Iterable<Registration<URL>>> bundleTracker;
+    private ServiceTracker<SchemaContextListener, SchemaContextListener> listenerTracker;
+    private BundleTracker<Iterable<Registration>> bundleTracker;
     private boolean starting = true;
     private static GlobalBundleScanningSchemaServiceImpl instance;
 
@@ -81,7 +81,7 @@ public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvi
     public void start() {
         checkState(context != null);
 
-        listenerTracker = new ServiceTracker<>(context, SchemaServiceListener.class, GlobalBundleScanningSchemaServiceImpl.this);
+        listenerTracker = new ServiceTracker<>(context, SchemaContextListener.class, GlobalBundleScanningSchemaServiceImpl.this);
         bundleTracker = new BundleTracker<>(context, BundleEvent.RESOLVED | BundleEvent.UNRESOLVED, scanner);
         bundleTracker.open();
         listenerTracker.open();
@@ -115,7 +115,7 @@ public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvi
     }
 
     @Override
-    public synchronized ListenerRegistration<SchemaServiceListener> registerSchemaServiceListener(final SchemaServiceListener listener) {
+    public synchronized ListenerRegistration<SchemaContextListener> registerSchemaContextListener(final SchemaContextListener listener) {
         Optional<SchemaContext> potentialCtx = contextResolver.getSchemaContext();
         if(potentialCtx.isPresent()) {
             listener.onGlobalContextUpdated(potentialCtx.get());
@@ -137,7 +137,7 @@ public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvi
 
     private synchronized void updateContext(final SchemaContext snapshot) {
         Object[] services = listenerTracker.getServices();
-        for (ListenerRegistration<SchemaServiceListener> listener : listeners) {
+        for (ListenerRegistration<SchemaContextListener> listener : listeners) {
             try {
                 listener.getInstance().onGlobalContextUpdated(snapshot);
             } catch (Exception e) {
@@ -146,7 +146,7 @@ public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvi
         }
         if (services != null) {
             for (Object rawListener : services) {
-                SchemaServiceListener listener = (SchemaServiceListener) rawListener;
+                final SchemaContextListener listener = (SchemaContextListener) rawListener;
                 try {
                     listener.onGlobalContextUpdated(snapshot);
                 } catch (Exception e) {
@@ -156,9 +156,9 @@ public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvi
         }
     }
 
-    private class BundleScanner implements BundleTrackerCustomizer<Iterable<Registration<URL>>> {
+    private class BundleScanner implements BundleTrackerCustomizer<Iterable<Registration>> {
         @Override
-        public Iterable<Registration<URL>> addingBundle(final Bundle bundle, final BundleEvent event) {
+        public Iterable<Registration> addingBundle(final Bundle bundle, final BundleEvent event) {
 
             if (bundle.getBundleId() == 0) {
                 return Collections.emptyList();
@@ -169,7 +169,7 @@ public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvi
                 return Collections.emptyList();
             }
 
-            final List<Registration<URL>> urls = new ArrayList<>();
+            final List<Registration> urls = new ArrayList<>();
             while (enumeration.hasMoreElements()) {
                 final URL u = enumeration.nextElement();
                 try {
@@ -189,7 +189,7 @@ public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvi
         }
 
         @Override
-        public void modifiedBundle(final Bundle bundle, final BundleEvent event, final Iterable<Registration<URL>> object) {
+        public void modifiedBundle(final Bundle bundle, final BundleEvent event, final Iterable<Registration> object) {
             LOG.debug("Modified bundle {} {} {}", bundle, event, object);
         }
 
@@ -200,8 +200,8 @@ public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvi
          */
 
         @Override
-        public synchronized void removedBundle(final Bundle bundle, final BundleEvent event, final Iterable<Registration<URL>> urls) {
-            for (Registration<URL> url : urls) {
+        public synchronized void removedBundle(final Bundle bundle, final BundleEvent event, final Iterable<Registration> urls) {
+            for (Registration url : urls) {
                 try {
                     url.close();
                 } catch (Exception e) {
@@ -213,9 +213,9 @@ public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvi
     }
 
     @Override
-    public synchronized SchemaServiceListener addingService(final ServiceReference<SchemaServiceListener> reference) {
+    public synchronized SchemaContextListener addingService(final ServiceReference<SchemaContextListener> reference) {
 
-        SchemaServiceListener listener = context.getService(reference);
+        SchemaContextListener listener = context.getService(reference);
         SchemaContext _ctxContext = getGlobalContext();
         if (getContext() != null && _ctxContext != null) {
             listener.onGlobalContextUpdated(_ctxContext);
@@ -234,12 +234,12 @@ public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvi
     }
 
     @Override
-    public void modifiedService(final ServiceReference<SchemaServiceListener> reference, final SchemaServiceListener service) {
+    public void modifiedService(final ServiceReference<SchemaContextListener> reference, final SchemaContextListener service) {
         // NOOP
     }
 
     @Override
-    public void removedService(final ServiceReference<SchemaServiceListener> reference, final SchemaServiceListener service) {
+    public void removedService(final ServiceReference<SchemaContextListener> reference, final SchemaContextListener service) {
         context.ungetService(reference);
     }
 }
index e69343d4fe82c7f36a7a9c378c8669e67cb1114b..054c8ea851cf2e8f56e6891a40c0dd790b72e34e 100644 (file)
@@ -36,25 +36,26 @@ import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 import com.google.common.util.concurrent.ListenableFuture;
 
+@Deprecated
 public class MountPointImpl implements MountProvisionInstance, SchemaContextProvider {
 
     private final SchemaAwareRpcBroker rpcs;
     private final DataBrokerImpl dataReader;
     private final NotificationRouter notificationRouter;
-    private final DataReader<InstanceIdentifier,CompositeNode> readWrapper;
+    private final DataReader<YangInstanceIdentifier,CompositeNode> readWrapper;
 
 
-    private final InstanceIdentifier mountPath;
+    private final YangInstanceIdentifier mountPath;
 
     private SchemaContext schemaContext;
 
-    public MountPointImpl(final InstanceIdentifier path) {
+    public MountPointImpl(final YangInstanceIdentifier path) {
         this.mountPath = path;
         rpcs = new SchemaAwareRpcBroker(path.toString(),this);
         dataReader = new DataBrokerImpl();
@@ -62,11 +63,11 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv
         readWrapper = new ReadWrapper();
     }
 
-    public InstanceIdentifier getMountPath() {
+    public YangInstanceIdentifier getMountPath() {
         return mountPath;
     }
 
-    public DataReader<InstanceIdentifier, CompositeNode> getReadWrapper() {
+    public DataReader<YangInstanceIdentifier, CompositeNode> getReadWrapper() {
         return readWrapper;
     }
 
@@ -76,29 +77,29 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv
     }
 
     @Override
-    public Registration<NotificationListener> addNotificationListener(final QName notification, final NotificationListener listener) {
+    public ListenerRegistration<NotificationListener> addNotificationListener(final QName notification, final NotificationListener listener) {
         return notificationRouter.addNotificationListener(notification, listener);
     }
 
     @Override
-    public CompositeNode readConfigurationData(final InstanceIdentifier path) {
+    public CompositeNode readConfigurationData(final YangInstanceIdentifier path) {
         return dataReader.readConfigurationData(path);
     }
 
     @Override
-    public CompositeNode readOperationalData(final InstanceIdentifier path) {
+    public CompositeNode readOperationalData(final YangInstanceIdentifier path) {
         return dataReader.readOperationalData(path);
     }
 
     @Override
-    public Registration<DataReader<InstanceIdentifier, CompositeNode>> registerOperationalReader(
-            final InstanceIdentifier path, final DataReader<InstanceIdentifier, CompositeNode> reader) {
+    public Registration registerOperationalReader(
+            final YangInstanceIdentifier path, final DataReader<YangInstanceIdentifier, CompositeNode> reader) {
         return dataReader.registerOperationalReader(path, reader);
     }
 
     @Override
-    public Registration<DataReader<InstanceIdentifier, CompositeNode>> registerConfigurationReader(
-            final InstanceIdentifier path, final DataReader<InstanceIdentifier, CompositeNode> reader) {
+    public Registration registerConfigurationReader(
+            final YangInstanceIdentifier path, final DataReader<YangInstanceIdentifier, CompositeNode> reader) {
         return dataReader.registerConfigurationReader(path, reader);
     }
 
@@ -144,14 +145,14 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv
     }
 
     @Override
-    public ListenerRegistration<DataChangeListener> registerDataChangeListener(final InstanceIdentifier path,
+    public ListenerRegistration<DataChangeListener> registerDataChangeListener(final YangInstanceIdentifier path,
             final DataChangeListener listener) {
         return dataReader.registerDataChangeListener(path, listener);
     }
 
     @Override
-    public Registration<DataCommitHandler<InstanceIdentifier, CompositeNode>> registerCommitHandler(
-            final InstanceIdentifier path, final DataCommitHandler<InstanceIdentifier, CompositeNode> commitHandler) {
+    public Registration registerCommitHandler(
+            final YangInstanceIdentifier path, final DataCommitHandler<YangInstanceIdentifier, CompositeNode> commitHandler) {
         return dataReader.registerCommitHandler(path, commitHandler);
     }
 
@@ -184,19 +185,19 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv
         this.schemaContext = schemaContext;
     }
 
-    class ReadWrapper implements DataReader<InstanceIdentifier, CompositeNode> {
-        private InstanceIdentifier shortenPath(final InstanceIdentifier path) {
-            InstanceIdentifier ret = null;
+    class ReadWrapper implements DataReader<YangInstanceIdentifier, CompositeNode> {
+        private YangInstanceIdentifier shortenPath(final YangInstanceIdentifier path) {
+            YangInstanceIdentifier ret = null;
             if(mountPath.contains(path)) {
                 List<PathArgument> newArgs = path.getPath().subList(mountPath.getPath().size(), path.getPath().size());
-                ret = InstanceIdentifier.create(newArgs);
+                ret = YangInstanceIdentifier.create(newArgs);
             }
             return ret;
         }
 
         @Override
-        public CompositeNode readConfigurationData(final InstanceIdentifier path) {
-            InstanceIdentifier newPath = shortenPath(path);
+        public CompositeNode readConfigurationData(final YangInstanceIdentifier path) {
+            YangInstanceIdentifier newPath = shortenPath(path);
             if(newPath == null) {
                 return null;
             }
@@ -204,8 +205,8 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv
         }
 
         @Override
-        public CompositeNode readOperationalData(final InstanceIdentifier path) {
-            InstanceIdentifier newPath = shortenPath(path);
+        public CompositeNode readOperationalData(final YangInstanceIdentifier path) {
+            YangInstanceIdentifier newPath = shortenPath(path);
             if(newPath == null) {
                 return null;
             }
@@ -214,13 +215,13 @@ public class MountPointImpl implements MountProvisionInstance, SchemaContextProv
     }
 
     @Override
-    public ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier, CompositeNode>>> registerCommitHandlerListener(
-            final RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier, CompositeNode>> commitHandlerListener) {
+    public ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<YangInstanceIdentifier, CompositeNode>>> registerCommitHandlerListener(
+            final RegistrationListener<DataCommitHandlerRegistration<YangInstanceIdentifier, CompositeNode>> commitHandlerListener) {
         return dataReader.registerCommitHandlerListener(commitHandlerListener);
     }
 
     @Override
-    public <L extends RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(
+    public <L extends RouteChangeListener<RpcRoutingContext, YangInstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(
             final L listener) {
         return rpcs.registerRouteChangeListener(listener);
     }
index 55a6ee77b470c2c2a98f5f2fbd30e47d1ba8f17d..d84f1dc03105389b81f9a8c239c5b33d7fcf3c6c 100644 (file)
@@ -14,21 +14,23 @@ import java.util.concurrent.ConcurrentMap;
 
 import org.opendaylight.controller.sal.core.api.data.DataProviderService;
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
+@Deprecated
 public class MountPointManagerImpl implements MountProvisionService {
 
     private final ListenerRegistry<MountProvisionListener> listeners =
             ListenerRegistry.create();
-    private final ConcurrentMap<InstanceIdentifier, MountPointImpl> mounts =
+    private final ConcurrentMap<YangInstanceIdentifier, MountPointImpl> mounts =
             new ConcurrentHashMap<>();
     private DataProviderService dataBroker = null;
 
     @Override
-    public MountProvisionInstance createMountPoint(final InstanceIdentifier path) {
+    public MountProvisionInstance createMountPoint(final YangInstanceIdentifier path) {
         checkState(!mounts.containsKey(path), "Mount already created");
         final MountPointImpl mount = new MountPointImpl(path);
         registerMountPoint(mount);
@@ -37,7 +39,7 @@ public class MountPointManagerImpl implements MountProvisionService {
         return mount;
     }
 
-    public void notifyMountCreated(final InstanceIdentifier identifier) {
+    public void notifyMountCreated(final YangInstanceIdentifier identifier) {
         for (final ListenerRegistration<MountProvisionListener> listener : listeners
                 .getListeners()) {
             listener.getInstance().onMountPointCreated(identifier);
@@ -53,7 +55,7 @@ public class MountPointManagerImpl implements MountProvisionService {
 
     @Override
     public MountProvisionInstance createOrGetMountPoint(
-            final InstanceIdentifier path) {
+            final YangInstanceIdentifier path) {
         final MountPointImpl mount = mounts.get(path);
         if (mount == null) {
             return createMountPoint(path);
@@ -62,7 +64,7 @@ public class MountPointManagerImpl implements MountProvisionService {
     }
 
     @Override
-    public MountProvisionInstance getMountPoint(final InstanceIdentifier path) {
+    public MountProvisionInstance getMountPoint(final YangInstanceIdentifier path) {
         return mounts.get(path);
     }
 
index 4b5b86d0dafd2cc08df1f7c9a31086350e3b3512..4f029bc919b1f58a1542a501e63987ea9334433f 100644 (file)
@@ -25,9 +25,9 @@ import java.util.Set;
 import org.opendaylight.controller.md.sal.common.impl.routing.AbstractDataReadRouter;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+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.Node;
 import org.opendaylight.yangtools.yang.data.api.SimpleNode;
 import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl;
@@ -35,7 +35,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class DataReaderRouter extends
-AbstractDataReadRouter<InstanceIdentifier, CompositeNode> {
+AbstractDataReadRouter<YangInstanceIdentifier, CompositeNode> {
     private final static Logger LOG = LoggerFactory
             .getLogger(DataReaderRouter.class);
     private final static URI NETCONF_NAMESPACE = URI
@@ -44,7 +44,7 @@ AbstractDataReadRouter<InstanceIdentifier, CompositeNode> {
             "data");
 
     @Override
-    protected CompositeNodeTOImpl merge(final InstanceIdentifier path,
+    protected CompositeNodeTOImpl merge(final YangInstanceIdentifier path,
             final Iterable<CompositeNode> data) {
         PathArgument pathArgument = Iterables.getLast(path.getPathArguments(), null);
         boolean empty = true;
@@ -117,11 +117,11 @@ AbstractDataReadRouter<InstanceIdentifier, CompositeNode> {
     }
 
     public Map<QName, SimpleNode<?>> getKeyNodes(
-            final InstanceIdentifier.PathArgument argument,
+            final YangInstanceIdentifier.PathArgument argument,
             final CompositeNode node) {
-        if (argument instanceof InstanceIdentifier.NodeIdentifierWithPredicates) {
+        if (argument instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates) {
             return _getKeyNodes(
-                    (InstanceIdentifier.NodeIdentifierWithPredicates) argument,
+                    (YangInstanceIdentifier.NodeIdentifierWithPredicates) argument,
                     node);
         } else if (argument != null) {
             return _getKeyNodes(argument, node);
index aa4297613e183a335aea53eef47e9f39b3788cc9..82c913327962132068aa663d941848402f8031bc 100644 (file)
@@ -13,7 +13,7 @@ import org.opendaylight.controller.md.sal.common.api.data.DataModification;
 import org.opendaylight.controller.sal.core.api.data.DataStore;
 import org.opendaylight.yangtools.concepts.Delegator;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 public class DataStoreStatsWrapper implements Delegator<DataStore>, DataStore {
 
@@ -38,7 +38,7 @@ public class DataStoreStatsWrapper implements Delegator<DataStore>, DataStore {
     }
 
     @Override
-    public CompositeNode readConfigurationData(InstanceIdentifier path) {
+    public CompositeNode readConfigurationData(YangInstanceIdentifier path) {
         cfgReadCount.incrementAndGet();
         final long startTime = System.nanoTime();
         try {
@@ -51,7 +51,7 @@ public class DataStoreStatsWrapper implements Delegator<DataStore>, DataStore {
     }
 
     @Override
-    public CompositeNode readOperationalData(InstanceIdentifier path) {
+    public CompositeNode readOperationalData(YangInstanceIdentifier path) {
         operReadCount.incrementAndGet();
         final long startTime = System.nanoTime();
         try {
@@ -63,8 +63,8 @@ public class DataStoreStatsWrapper implements Delegator<DataStore>, DataStore {
         }
     }
 
-    public DataCommitTransaction<InstanceIdentifier, CompositeNode> requestCommit(
-            DataModification<InstanceIdentifier, CompositeNode> modification) {
+    public DataCommitTransaction<YangInstanceIdentifier, CompositeNode> requestCommit(
+            DataModification<YangInstanceIdentifier, CompositeNode> modification) {
         requestCommitCount.incrementAndGet();
         final long startTime = System.nanoTime();
         try {
@@ -77,19 +77,19 @@ public class DataStoreStatsWrapper implements Delegator<DataStore>, DataStore {
     };
 
     @Override
-    public boolean containsConfigurationPath(InstanceIdentifier path) {
+    public boolean containsConfigurationPath(YangInstanceIdentifier path) {
         return delegate.containsConfigurationPath(path);
     }
 
-    public Iterable<InstanceIdentifier> getStoredConfigurationPaths() {
+    public Iterable<YangInstanceIdentifier> getStoredConfigurationPaths() {
         return delegate.getStoredConfigurationPaths();
     }
 
-    public Iterable<InstanceIdentifier> getStoredOperationalPaths() {
+    public Iterable<YangInstanceIdentifier> getStoredOperationalPaths() {
         return delegate.getStoredOperationalPaths();
     }
 
-    public boolean containsOperationalPath(InstanceIdentifier path) {
+    public boolean containsOperationalPath(YangInstanceIdentifier path) {
         return delegate.containsOperationalPath(path);
     }
 
index d7309b9ed31717ebe8641bdc4bee5f15ce8d948f..1f82bd71b4a4cdf07ce8bfbd0c8d0e3829659aa2 100644 (file)
@@ -18,7 +18,7 @@ import org.opendaylight.controller.sal.core.api.data.DataStore;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -26,44 +26,44 @@ public final class HashMapDataStore implements DataStore, AutoCloseable {
     private static final Logger LOG = LoggerFactory
             .getLogger(HashMapDataStore.class);
 
-    private final Map<InstanceIdentifier, CompositeNode> configuration = new ConcurrentHashMap<InstanceIdentifier, CompositeNode>();
-    private final Map<InstanceIdentifier, CompositeNode> operational = new ConcurrentHashMap<InstanceIdentifier, CompositeNode>();
+    private final Map<YangInstanceIdentifier, CompositeNode> configuration = new ConcurrentHashMap<YangInstanceIdentifier, CompositeNode>();
+    private final Map<YangInstanceIdentifier, CompositeNode> operational = new ConcurrentHashMap<YangInstanceIdentifier, CompositeNode>();
 
     @Override
-    public boolean containsConfigurationPath(final InstanceIdentifier path) {
+    public boolean containsConfigurationPath(final YangInstanceIdentifier path) {
         return configuration.containsKey(path);
     }
 
     @Override
-    public boolean containsOperationalPath(final InstanceIdentifier path) {
+    public boolean containsOperationalPath(final YangInstanceIdentifier path) {
         return operational.containsKey(path);
     }
 
     @Override
-    public Iterable<InstanceIdentifier> getStoredConfigurationPaths() {
+    public Iterable<YangInstanceIdentifier> getStoredConfigurationPaths() {
         return configuration.keySet();
     }
 
     @Override
-    public Iterable<InstanceIdentifier> getStoredOperationalPaths() {
+    public Iterable<YangInstanceIdentifier> getStoredOperationalPaths() {
         return operational.keySet();
     }
 
     @Override
-    public CompositeNode readConfigurationData(final InstanceIdentifier path) {
+    public CompositeNode readConfigurationData(final YangInstanceIdentifier path) {
         LOG.trace("Reading configuration path {}", path);
         return configuration.get(path);
     }
 
     @Override
-    public CompositeNode readOperationalData(InstanceIdentifier path) {
+    public CompositeNode readOperationalData(YangInstanceIdentifier path) {
         LOG.trace("Reading operational path {}", path);
         return operational.get(path);
     }
 
     @Override
-    public DataCommitHandler.DataCommitTransaction<InstanceIdentifier, CompositeNode> requestCommit(
-            final DataModification<InstanceIdentifier, CompositeNode> modification) {
+    public DataCommitHandler.DataCommitTransaction<YangInstanceIdentifier, CompositeNode> requestCommit(
+            final DataModification<YangInstanceIdentifier, CompositeNode> modification) {
         return new HashMapDataStoreTransaction(modification, this);
     }
 
@@ -72,24 +72,24 @@ public final class HashMapDataStore implements DataStore, AutoCloseable {
     }
 
     public RpcResult<Void> finish(HashMapDataStoreTransaction transaction) {
-        final DataModification<InstanceIdentifier, CompositeNode> modification = transaction
+        final DataModification<YangInstanceIdentifier, CompositeNode> modification = transaction
                 .getModification();
-        for (final InstanceIdentifier removal : modification
+        for (final YangInstanceIdentifier removal : modification
                 .getRemovedConfigurationData()) {
             LOG.trace("Removing configuration path {}", removal);
             remove(configuration, removal);
         }
-        for (final InstanceIdentifier removal : modification
+        for (final YangInstanceIdentifier removal : modification
                 .getRemovedOperationalData()) {
             LOG.trace("Removing operational path {}", removal);
             remove(operational, removal);
         }
         if (LOG.isTraceEnabled()) {
-            for (final InstanceIdentifier a : modification
+            for (final YangInstanceIdentifier a : modification
                     .getUpdatedConfigurationData().keySet()) {
                 LOG.trace("Adding configuration path {}", a);
             }
-            for (final InstanceIdentifier a : modification
+            for (final YangInstanceIdentifier a : modification
                     .getUpdatedOperationalData().keySet()) {
                 LOG.trace("Adding operational path {}", a);
             }
@@ -100,15 +100,15 @@ public final class HashMapDataStore implements DataStore, AutoCloseable {
         return RpcResultBuilder.<Void> success().build();
     }
 
-    public void remove(final Map<InstanceIdentifier, CompositeNode> map,
-            final InstanceIdentifier identifier) {
-        Set<InstanceIdentifier> affected = new HashSet<InstanceIdentifier>();
-        for (final InstanceIdentifier path : map.keySet()) {
+    public void remove(final Map<YangInstanceIdentifier, CompositeNode> map,
+            final YangInstanceIdentifier identifier) {
+        Set<YangInstanceIdentifier> affected = new HashSet<YangInstanceIdentifier>();
+        for (final YangInstanceIdentifier path : map.keySet()) {
             if (identifier.contains(path)) {
                 affected.add(path);
             }
         }
-        for (final InstanceIdentifier pathToRemove : affected) {
+        for (final YangInstanceIdentifier pathToRemove : affected) {
             LOG.trace("Removed path {}", pathToRemove);
             map.remove(pathToRemove);
         }
index bb66594ac942ec4700c4f30a3c3b6e2a69fd44a1..ee026b60063d5a8737f63b1417a8cb81d81f29c3 100644 (file)
@@ -11,15 +11,15 @@ import org.opendaylight.controller.md.sal.common.api.data.DataModification;
 import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 public class HashMapDataStoreTransaction implements
-        DataCommitTransaction<InstanceIdentifier, CompositeNode> {
-    private final DataModification<InstanceIdentifier, CompositeNode> modification;
+        DataCommitTransaction<YangInstanceIdentifier, CompositeNode> {
+    private final DataModification<YangInstanceIdentifier, CompositeNode> modification;
     private final HashMapDataStore datastore;
 
     HashMapDataStoreTransaction(
-            final DataModification<InstanceIdentifier, CompositeNode> modify,
+            final DataModification<YangInstanceIdentifier, CompositeNode> modify,
             final HashMapDataStore store) {
         modification = modify;
         datastore = store;
@@ -31,7 +31,7 @@ public class HashMapDataStoreTransaction implements
     }
 
     @Override
-    public DataModification<InstanceIdentifier, CompositeNode> getModification() {
+    public DataModification<YangInstanceIdentifier, CompositeNode> getModification() {
         return this.modification;
     }
 
index 7fba31114f6d53a2c491f91511109a32b6c8efec..1e93202007cbd9a800e485a9ba0343298160c035 100644 (file)
@@ -12,7 +12,7 @@ import java.util.Collection;
 import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
 import org.opendaylight.controller.sal.dom.broker.spi.NotificationRouter;
 import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
-import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 import org.slf4j.Logger;
@@ -25,12 +25,12 @@ import com.google.common.collect.Multimaps;
 public class NotificationRouterImpl implements NotificationRouter {
     private static Logger log = LoggerFactory.getLogger(NotificationRouterImpl.class);
 
-    private final Multimap<QName, ListenerRegistration> listeners = Multimaps.synchronizedSetMultimap(HashMultimap.<QName, ListenerRegistration>create());
+    private final Multimap<QName, MyListenerRegistration> listeners = Multimaps.synchronizedSetMultimap(HashMultimap.<QName, MyListenerRegistration>create());
 //    private Registration<NotificationListener> defaultListener;
 
     private void sendNotification(CompositeNode notification) {
         final QName type = notification.getNodeType();
-        final Collection<ListenerRegistration> toNotify = listeners.get(type);
+        final Collection<MyListenerRegistration> toNotify = listeners.get(type);
         log.trace("Publishing notification " + type);
 
         if ((toNotify == null) || toNotify.isEmpty()) {
@@ -38,7 +38,7 @@ public class NotificationRouterImpl implements NotificationRouter {
             return;
         }
 
-        for (ListenerRegistration listener : toNotify) {
+        for (MyListenerRegistration listener : toNotify) {
             try {
                 // FIXME: ensure that notification is immutable
                 listener.getInstance().onNotification(notification);
@@ -54,17 +54,17 @@ public class NotificationRouterImpl implements NotificationRouter {
     }
 
     @Override
-    public Registration<NotificationListener> addNotificationListener(QName notification, NotificationListener listener) {
-        ListenerRegistration ret = new ListenerRegistration(notification, listener);
+    public ListenerRegistration<NotificationListener> addNotificationListener(QName notification, NotificationListener listener) {
+        MyListenerRegistration ret = new MyListenerRegistration(notification, listener);
         listeners.put(notification, ret);
         return ret;
     }
 
-    private class ListenerRegistration extends AbstractListenerRegistration<NotificationListener> {
+    private class MyListenerRegistration extends AbstractListenerRegistration<NotificationListener> {
 
         final QName type;
 
-        public ListenerRegistration(QName type, NotificationListener instance) {
+        public MyListenerRegistration(QName type, NotificationListener instance) {
             super(instance);
             this.type = type;
         }
index e4f19bbb2adec2b1240cf7a7197b8bcb91492081..c2fa82b5888547ef9518c73357555930f2a85339 100644 (file)
@@ -11,7 +11,7 @@ import org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.core.api.RpcImplementation;
 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 class RoutedRpcRegImpl extends AbstractObjectRegistration<RpcImplementation> implements
         RoutedRpcRegistration {
@@ -26,12 +26,12 @@ class RoutedRpcRegImpl extends AbstractObjectRegistration<RpcImplementation> imp
     }
 
     @Override
-    public void registerPath(final QName context, final InstanceIdentifier path) {
+    public void registerPath(final QName context, final YangInstanceIdentifier path) {
         router.addPath(context, path, this);
     }
 
     @Override
-    public void unregisterPath(final QName context, final InstanceIdentifier path) {
+    public void unregisterPath(final QName context, final YangInstanceIdentifier path) {
         router.removePath(context, path, this);
     }
 
index a22aed7ab16aeea03fb5967f8b08572956ea9326..19ff03b7d2ca14fa4facb72d855bbf2b14f77b7d 100644 (file)
@@ -22,7 +22,7 @@ import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.SimpleNode;
 
 import com.google.common.collect.ImmutableSet;
@@ -33,7 +33,7 @@ class RoutedRpcSelector implements RpcImplementation, AutoCloseable, Identifiabl
     private final RpcRoutingStrategy strategy;
     private final Set<QName> supportedRpcs;
     private final RpcRoutingContext identifier;
-    final ConcurrentMap<InstanceIdentifier, RoutedRpcRegImpl> implementations = new ConcurrentHashMap<>();
+    final ConcurrentMap<YangInstanceIdentifier, RoutedRpcRegImpl> implementations = new ConcurrentHashMap<>();
     private final SchemaAwareRpcBroker router;
 
     public RoutedRpcSelector(final RpcRoutingStrategy strategy, final SchemaAwareRpcBroker router) {
@@ -70,7 +70,7 @@ class RoutedRpcSelector implements RpcImplementation, AutoCloseable, Identifiabl
         SimpleNode<?> routeContainer = inputContainer.getFirstSimpleByName(strategy.getLeaf());
         checkArgument(routeContainer != null, "Leaf %s must be set with value", strategy.getLeaf());
         Object route = routeContainer.getValue();
-        checkArgument(route instanceof InstanceIdentifier,
+        checkArgument(route instanceof YangInstanceIdentifier,
                       "The routed node %s is not an instance identifier", route);
         RpcImplementation potential = null;
         if (route != null) {
@@ -80,13 +80,13 @@ class RoutedRpcSelector implements RpcImplementation, AutoCloseable, Identifiabl
             }
         }
         if (potential == null) {
-            return router.invokeRpc(rpc, (InstanceIdentifier) route, input);
+            return router.invokeRpc(rpc, (YangInstanceIdentifier) route, input);
         }
         checkState(potential != null, "No implementation is available for rpc:%s path:%s", rpc, route);
         return potential.invokeRpc(rpc, input);
     }
 
-    public void addPath(final QName context, final InstanceIdentifier path, final RoutedRpcRegImpl routedRpcRegImpl) {
+    public void addPath(final QName context, final YangInstanceIdentifier path, final RoutedRpcRegImpl routedRpcRegImpl) {
         //checkArgument(strategy.getContext().equals(context),"Supplied context is not supported.");
         RoutedRpcRegImpl previous = implementations.put(path, routedRpcRegImpl);
         if (previous == null) {
@@ -95,7 +95,7 @@ class RoutedRpcSelector implements RpcImplementation, AutoCloseable, Identifiabl
 
     }
 
-    public void removePath(final QName context, final InstanceIdentifier path, final RoutedRpcRegImpl routedRpcRegImpl) {
+    public void removePath(final QName context, final YangInstanceIdentifier path, final RoutedRpcRegImpl routedRpcRegImpl) {
         boolean removed = implementations.remove(path, routedRpcRegImpl);
         if (removed) {
             router.notifyPathWithdrawal(context, strategy.getIdentifier(), path);
index 3cd7ed5e13ed16b2449f2386604aa81802679b17..94553f52757dbc24a811ab2a840c797d29608f3a 100644 (file)
@@ -33,7 +33,7 @@ import org.opendaylight.controller.sal.dom.broker.util.YangSchemaUtils;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.Node;
 import org.opendaylight.yangtools.yang.data.api.SimpleNode;
 import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl;
@@ -54,10 +54,10 @@ AutoCloseable {
 
     private SchemaContext schema = null;
     private boolean validationEnabled = false;
-    private final DataReader<InstanceIdentifier, CompositeNode> reader = new MergeFirstLevelReader();
+    private final DataReader<YangInstanceIdentifier, CompositeNode> reader = new MergeFirstLevelReader();
 
     @Override
-    public boolean containsConfigurationPath(final InstanceIdentifier path) {
+    public boolean containsConfigurationPath(final YangInstanceIdentifier path) {
         try {
             getDelegateReadLock().lock();
             return getDelegate().containsConfigurationPath(path);
@@ -68,7 +68,7 @@ AutoCloseable {
     }
 
     @Override
-    public boolean containsOperationalPath(final InstanceIdentifier path) {
+    public boolean containsOperationalPath(final YangInstanceIdentifier path) {
         try {
             getDelegateReadLock().lock();
             return getDelegate().containsOperationalPath(path);
@@ -79,7 +79,7 @@ AutoCloseable {
     }
 
     @Override
-    public Iterable<InstanceIdentifier> getStoredConfigurationPaths() {
+    public Iterable<YangInstanceIdentifier> getStoredConfigurationPaths() {
         try {
             getDelegateReadLock().lock();
             return getDelegate().getStoredConfigurationPaths();
@@ -90,7 +90,7 @@ AutoCloseable {
     }
 
     @Override
-    public Iterable<InstanceIdentifier> getStoredOperationalPaths() {
+    public Iterable<YangInstanceIdentifier> getStoredOperationalPaths() {
         try {
             getDelegateReadLock().lock();
             return getDelegate().getStoredOperationalPaths();
@@ -101,18 +101,18 @@ AutoCloseable {
     }
 
     @Override
-    public CompositeNode readConfigurationData(final InstanceIdentifier path) {
+    public CompositeNode readConfigurationData(final YangInstanceIdentifier path) {
         return reader.readConfigurationData(path);
     }
 
     @Override
-    public CompositeNode readOperationalData(final InstanceIdentifier path) {
+    public CompositeNode readOperationalData(final YangInstanceIdentifier path) {
         return reader.readOperationalData(path);
     }
 
     @Override
-    public org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction<InstanceIdentifier, CompositeNode> requestCommit(
-            final DataModification<InstanceIdentifier, CompositeNode> modification) {
+    public org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction<YangInstanceIdentifier, CompositeNode> requestCommit(
+            final DataModification<YangInstanceIdentifier, CompositeNode> modification) {
         validateAgainstSchema(modification);
         NormalizedDataModification cleanedUp = prepareMergedTransaction(modification);
         cleanedUp.status = TransactionStatus.SUBMITED;
@@ -127,7 +127,7 @@ AutoCloseable {
         this.validationEnabled = validationEnabled;
     }
 
-    private void validateAgainstSchema(final DataModification<InstanceIdentifier, CompositeNode> modification) {
+    private void validateAgainstSchema(final DataModification<YangInstanceIdentifier, CompositeNode> modification) {
         if (!validationEnabled) {
             return;
         }
@@ -153,7 +153,7 @@ AutoCloseable {
         this.schema = null;
     }
 
-    protected CompositeNode mergeData(final InstanceIdentifier path, final CompositeNode stored, final CompositeNode modified,
+    protected CompositeNode mergeData(final YangInstanceIdentifier path, final CompositeNode stored, final CompositeNode modified,
             final boolean config) {
         // long startTime = System.nanoTime();
         try {
@@ -165,13 +165,13 @@ AutoCloseable {
         }
     }
 
-    private DataSchemaNode schemaNodeFor(final InstanceIdentifier path) {
+    private DataSchemaNode schemaNodeFor(final YangInstanceIdentifier path) {
         checkState(schema != null, "YANG Schema is not available");
         return YangSchemaUtils.getSchemaNode(schema, path);
     }
 
     private NormalizedDataModification prepareMergedTransaction(
-            final DataModification<InstanceIdentifier, CompositeNode> original) {
+            final DataModification<YangInstanceIdentifier, CompositeNode> original) {
         NormalizedDataModification normalized = new NormalizedDataModification(original);
         LOG.trace("Transaction: {} Removed Configuration {}, Removed Operational {}", original.getIdentifier(),
                 original.getRemovedConfigurationData(), original.getRemovedConfigurationData());
@@ -180,40 +180,40 @@ AutoCloseable {
         LOG.trace("Transaction: {} Updated Configuration {}, Updated Operational {}", original.getIdentifier(),
                 original.getUpdatedConfigurationData().entrySet(), original.getUpdatedOperationalData().entrySet());
 
-        for (InstanceIdentifier entry : original.getRemovedConfigurationData()) {
+        for (YangInstanceIdentifier entry : original.getRemovedConfigurationData()) {
             normalized.deepRemoveConfigurationData(entry);
         }
-        for (InstanceIdentifier entry : original.getRemovedOperationalData()) {
+        for (YangInstanceIdentifier entry : original.getRemovedOperationalData()) {
             normalized.deepRemoveOperationalData(entry);
         }
-        for (Entry<InstanceIdentifier, CompositeNode> entry : original.getUpdatedConfigurationData().entrySet()) {
+        for (Entry<YangInstanceIdentifier, CompositeNode> entry : original.getUpdatedConfigurationData().entrySet()) {
             normalized.putDeepConfigurationData(entry.getKey(), entry.getValue());
         }
-        for (Entry<InstanceIdentifier, CompositeNode> entry : original.getUpdatedOperationalData().entrySet()) {
+        for (Entry<YangInstanceIdentifier, CompositeNode> entry : original.getUpdatedOperationalData().entrySet()) {
             normalized.putDeepOperationalData(entry.getKey(), entry.getValue());
         }
         return normalized;
     }
 
-    private Iterable<InstanceIdentifier> getConfigurationSubpaths(final InstanceIdentifier entry) {
+    private Iterable<YangInstanceIdentifier> getConfigurationSubpaths(final YangInstanceIdentifier entry) {
         // FIXME: This should be replaced by index
-        Iterable<InstanceIdentifier> paths = getStoredConfigurationPaths();
+        Iterable<YangInstanceIdentifier> paths = getStoredConfigurationPaths();
 
         return getChildrenPaths(entry, paths);
 
     }
 
-    public Iterable<InstanceIdentifier> getOperationalSubpaths(final InstanceIdentifier entry) {
+    public Iterable<YangInstanceIdentifier> getOperationalSubpaths(final YangInstanceIdentifier entry) {
         // FIXME: This should be indexed
-        Iterable<InstanceIdentifier> paths = getStoredOperationalPaths();
+        Iterable<YangInstanceIdentifier> paths = getStoredOperationalPaths();
 
         return getChildrenPaths(entry, paths);
     }
 
-    private static final Iterable<InstanceIdentifier> getChildrenPaths(final InstanceIdentifier entry,
-            final Iterable<InstanceIdentifier> paths) {
-        ImmutableSet.Builder<InstanceIdentifier> children = ImmutableSet.builder();
-        for (InstanceIdentifier potential : paths) {
+    private static final Iterable<YangInstanceIdentifier> getChildrenPaths(final YangInstanceIdentifier entry,
+            final Iterable<YangInstanceIdentifier> paths) {
+        ImmutableSet.Builder<YangInstanceIdentifier> children = ImmutableSet.builder();
+        for (YangInstanceIdentifier potential : paths) {
             if (entry.contains(potential)) {
                 children.add(entry);
             }
@@ -221,19 +221,19 @@ AutoCloseable {
         return children.build();
     }
 
-    private final Comparator<Entry<InstanceIdentifier, CompositeNode>> preparationComparator = new Comparator<Entry<InstanceIdentifier, CompositeNode>>() {
+    private final Comparator<Entry<YangInstanceIdentifier, CompositeNode>> preparationComparator = new Comparator<Entry<YangInstanceIdentifier, CompositeNode>>() {
         @Override
-        public int compare(final Entry<InstanceIdentifier, CompositeNode> o1, final Entry<InstanceIdentifier, CompositeNode> o2) {
-            InstanceIdentifier o1Key = o1.getKey();
-            InstanceIdentifier o2Key = o2.getKey();
+        public int compare(final Entry<YangInstanceIdentifier, CompositeNode> o1, final Entry<YangInstanceIdentifier, CompositeNode> o2) {
+            YangInstanceIdentifier o1Key = o1.getKey();
+            YangInstanceIdentifier o2Key = o2.getKey();
             return Integer.compare(o1Key.getPath().size(), o2Key.getPath().size());
         }
     };
 
-    private class MergeFirstLevelReader implements DataReader<InstanceIdentifier, CompositeNode> {
+    private class MergeFirstLevelReader implements DataReader<YangInstanceIdentifier, CompositeNode> {
 
         @Override
-        public CompositeNode readConfigurationData(final InstanceIdentifier path) {
+        public CompositeNode readConfigurationData(final YangInstanceIdentifier path) {
             getDelegateReadLock().lock();
             try {
                 if (Iterables.isEmpty(path.getPathArguments())) {
@@ -249,10 +249,10 @@ AutoCloseable {
                     qname = path.getPath().get(path.getPath().size() - 1).getNodeType();
                 }
 
-                FluentIterable<InstanceIdentifier> directChildren = FluentIterable.from(getStoredConfigurationPaths())
-                        .filter(new Predicate<InstanceIdentifier>() {
+                FluentIterable<YangInstanceIdentifier> directChildren = FluentIterable.from(getStoredConfigurationPaths())
+                        .filter(new Predicate<YangInstanceIdentifier>() {
                             @Override
-                            public boolean apply(final InstanceIdentifier input) {
+                            public boolean apply(final YangInstanceIdentifier input) {
                                 if (path.contains(input)) {
                                     int nesting = input.getPath().size() - path.getPath().size();
                                     if (nesting == 1) {
@@ -262,7 +262,7 @@ AutoCloseable {
                                 return false;
                             }
                         });
-                for (InstanceIdentifier instanceIdentifier : directChildren) {
+                for (YangInstanceIdentifier instanceIdentifier : directChildren) {
                     childNodes.add(getDelegate().readConfigurationData(instanceIdentifier));
                 }
                 if (original == null && childNodes.isEmpty()) {
@@ -276,7 +276,7 @@ AutoCloseable {
         }
 
         @Override
-        public CompositeNode readOperationalData(final InstanceIdentifier path) {
+        public CompositeNode readOperationalData(final YangInstanceIdentifier path) {
             getDelegateReadLock().lock();
             try {
                 if (Iterables.isEmpty(path.getPathArguments())) {
@@ -292,10 +292,10 @@ AutoCloseable {
                     qname = path.getPath().get(path.getPath().size() - 1).getNodeType();
                 }
 
-                FluentIterable<InstanceIdentifier> directChildren = FluentIterable.from(getStoredOperationalPaths())
-                        .filter(new Predicate<InstanceIdentifier>() {
+                FluentIterable<YangInstanceIdentifier> directChildren = FluentIterable.from(getStoredOperationalPaths())
+                        .filter(new Predicate<YangInstanceIdentifier>() {
                             @Override
-                            public boolean apply(final InstanceIdentifier input) {
+                            public boolean apply(final YangInstanceIdentifier input) {
                                 if (path.contains(input)) {
                                     int nesting = input.getPath().size() - path.getPath().size();
                                     if (nesting == 1) {
@@ -306,7 +306,7 @@ AutoCloseable {
                             }
                         });
 
-                for (InstanceIdentifier instanceIdentifier : directChildren) {
+                for (YangInstanceIdentifier instanceIdentifier : directChildren) {
                     childNodes.add(getDelegate().readOperationalData(instanceIdentifier));
                 }
                 if (original == null && childNodes.isEmpty()) {
@@ -320,14 +320,14 @@ AutoCloseable {
         }
     }
 
-    private class NormalizedDataModification extends AbstractDataModification<InstanceIdentifier, CompositeNode> {
+    private class NormalizedDataModification extends AbstractDataModification<YangInstanceIdentifier, CompositeNode> {
 
         private final String CONFIGURATIONAL_DATA_STORE_MARKER = "configurational";
         private final String OPERATIONAL_DATA_STORE_MARKER = "operational";
         private final Object identifier;
         private TransactionStatus status;
 
-        public NormalizedDataModification(final DataModification<InstanceIdentifier, CompositeNode> original) {
+        public NormalizedDataModification(final DataModification<YangInstanceIdentifier, CompositeNode> original) {
             super(getDelegate());
             identifier = original;
             status = TransactionStatus.NEW;
@@ -340,27 +340,27 @@ AutoCloseable {
          *
          * @param entry
          */
-        public void deepRemoveOperationalData(final InstanceIdentifier entry) {
-            Iterable<InstanceIdentifier> paths = getOperationalSubpaths(entry);
+        public void deepRemoveOperationalData(final YangInstanceIdentifier entry) {
+            Iterable<YangInstanceIdentifier> paths = getOperationalSubpaths(entry);
             removeOperationalData(entry);
-            for (InstanceIdentifier potential : paths) {
+            for (YangInstanceIdentifier potential : paths) {
                 removeOperationalData(potential);
             }
         }
 
-        public void deepRemoveConfigurationData(final InstanceIdentifier entry) {
-            Iterable<InstanceIdentifier> paths = getConfigurationSubpaths(entry);
+        public void deepRemoveConfigurationData(final YangInstanceIdentifier entry) {
+            Iterable<YangInstanceIdentifier> paths = getConfigurationSubpaths(entry);
             removeConfigurationData(entry);
-            for (InstanceIdentifier potential : paths) {
+            for (YangInstanceIdentifier potential : paths) {
                 removeConfigurationData(potential);
             }
         }
 
-        public void putDeepConfigurationData(final InstanceIdentifier entryKey, final CompositeNode entryData) {
+        public void putDeepConfigurationData(final YangInstanceIdentifier entryKey, final CompositeNode entryData) {
             this.putCompositeNodeData(entryKey, entryData, CONFIGURATIONAL_DATA_STORE_MARKER);
         }
 
-        public void putDeepOperationalData(final InstanceIdentifier entryKey, final CompositeNode entryData) {
+        public void putDeepOperationalData(final YangInstanceIdentifier entryKey, final CompositeNode entryData) {
             this.putCompositeNodeData(entryKey, entryData, OPERATIONAL_DATA_STORE_MARKER);
         }
 
@@ -380,18 +380,18 @@ AutoCloseable {
         }
 
         @Override
-        protected CompositeNode mergeConfigurationData(final InstanceIdentifier path, final CompositeNode stored,
+        protected CompositeNode mergeConfigurationData(final YangInstanceIdentifier path, final CompositeNode stored,
                 final CompositeNode modified) {
             return mergeData(path, stored, modified, true);
         }
 
         @Override
-        protected CompositeNode mergeOperationalData(final InstanceIdentifier path, final CompositeNode stored,
+        protected CompositeNode mergeOperationalData(final YangInstanceIdentifier path, final CompositeNode stored,
                 final CompositeNode modified) {
             return mergeData(path, stored, modified, false);
         }
 
-        private void putData(final InstanceIdentifier entryKey, final CompositeNode entryData, final String dataStoreIdentifier) {
+        private void putData(final YangInstanceIdentifier entryKey, final CompositeNode entryData, final String dataStoreIdentifier) {
             if (dataStoreIdentifier != null && entryKey != null && entryData != null) {
                 switch (dataStoreIdentifier) {
                 case (CONFIGURATIONAL_DATA_STORE_MARKER):
@@ -408,29 +408,29 @@ AutoCloseable {
             }
         }
 
-        private void putCompositeNodeData(final InstanceIdentifier entryKey, final CompositeNode entryData,
+        private void putCompositeNodeData(final YangInstanceIdentifier entryKey, final CompositeNode entryData,
                 final String dataStoreIdentifier) {
             this.putData(entryKey, entryData, dataStoreIdentifier);
 
             for (Node<?> child : entryData.getValue()) {
-                InstanceIdentifier subEntryId = InstanceIdentifier.builder(entryKey).node(child.getNodeType())
+                YangInstanceIdentifier subEntryId = YangInstanceIdentifier.builder(entryKey).node(child.getNodeType())
                         .toInstance();
                 if (child instanceof CompositeNode) {
                     DataSchemaNode subSchema = schemaNodeFor(subEntryId);
                     CompositeNode compNode = (CompositeNode) child;
-                    InstanceIdentifier instanceId = null;
+                    YangInstanceIdentifier instanceId = null;
 
                     if (subSchema instanceof ListSchemaNode) {
                         ListSchemaNode listSubSchema = (ListSchemaNode) subSchema;
                         Map<QName, Object> mapOfSubValues = this.getValuesFromListSchema(listSubSchema,
                                 (CompositeNode) child);
                         if (mapOfSubValues != null) {
-                            instanceId = InstanceIdentifier.builder(entryKey)
+                            instanceId = YangInstanceIdentifier.builder(entryKey)
                                     .nodeWithKey(listSubSchema.getQName(), mapOfSubValues).toInstance();
                         }
                     } else if (subSchema instanceof ContainerSchemaNode) {
                         ContainerSchemaNode containerSchema = (ContainerSchemaNode) subSchema;
-                        instanceId = InstanceIdentifier.builder(entryKey).node(subSchema.getQName()).toInstance();
+                        instanceId = YangInstanceIdentifier.builder(entryKey).node(subSchema.getQName()).toInstance();
                     }
                     if (instanceId != null) {
                         this.putCompositeNodeData(instanceId, compNode, dataStoreIdentifier);
index 7bc827dcb0329d41825638efa9b5d1748ac0c83c..44e7abc3aa117fcb778d56f7b1423f5bd07c2649 100644 (file)
@@ -31,7 +31,7 @@ import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -50,7 +50,7 @@ public class SchemaAwareRpcBroker implements RpcRouter, Identifiable<String>, Ro
 
 
     private final ListenerRegistry<RpcRegistrationListener> rpcRegistrationListeners = new ListenerRegistry<>();
-    private final ListenerRegistry<RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> routeChangeListeners = new ListenerRegistry<>();
+    private final ListenerRegistry<RouteChangeListener<RpcRoutingContext, YangInstanceIdentifier>> routeChangeListeners = new ListenerRegistry<>();
 
 
     private final String identifier;
@@ -216,7 +216,7 @@ public class SchemaAwareRpcBroker implements RpcRouter, Identifiable<String>, Ro
     }
 
     @Override
-    public ListenableFuture<RpcResult<CompositeNode>> invokeRpc(final QName rpc, final InstanceIdentifier route, final CompositeNode input) {
+    public ListenableFuture<RpcResult<CompositeNode>> invokeRpc(final QName rpc, final YangInstanceIdentifier route, final CompositeNode input) {
       checkState(defaultDelegate != null, "No implementation is available for rpc:%s path:%s", rpc, route);
       return defaultDelegate.invokeRpc(rpc, route, input);
     }
@@ -225,10 +225,10 @@ public class SchemaAwareRpcBroker implements RpcRouter, Identifiable<String>, Ro
         implementations.remove(registration.getType(), registration);
     }
 
-    void notifyPathAnnouncement(final QName context, final QName identifier, final InstanceIdentifier path) {
+    void notifyPathAnnouncement(final QName context, final QName identifier, final YangInstanceIdentifier path) {
         RpcRoutingContext contextWrapped = RpcRoutingContext.create(context, identifier);
-        RouteChange<RpcRoutingContext, InstanceIdentifier> change = RoutingUtils.announcementChange(contextWrapped , path);
-        for(ListenerRegistration<RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> routeListener : routeChangeListeners) {
+        RouteChange<RpcRoutingContext, YangInstanceIdentifier> change = RoutingUtils.announcementChange(contextWrapped , path);
+        for(ListenerRegistration<RouteChangeListener<RpcRoutingContext, YangInstanceIdentifier>> routeListener : routeChangeListeners) {
             try {
                 routeListener.getInstance().onRouteChange(change);
             } catch (Exception e) {
@@ -238,10 +238,10 @@ public class SchemaAwareRpcBroker implements RpcRouter, Identifiable<String>, Ro
 
     }
 
-    void notifyPathWithdrawal(final QName context,final QName identifier, final InstanceIdentifier path) {
+    void notifyPathWithdrawal(final QName context,final QName identifier, final YangInstanceIdentifier path) {
         RpcRoutingContext contextWrapped = RpcRoutingContext.create(context, identifier);
-        RouteChange<RpcRoutingContext, InstanceIdentifier> change = RoutingUtils.removalChange(contextWrapped , path);
-        for(ListenerRegistration<RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> routeListener : routeChangeListeners) {
+        RouteChange<RpcRoutingContext, YangInstanceIdentifier> change = RoutingUtils.removalChange(contextWrapped , path);
+        for(ListenerRegistration<RouteChangeListener<RpcRoutingContext, YangInstanceIdentifier>> routeListener : routeChangeListeners) {
             try {
                 routeListener.getInstance().onRouteChange(change);
             } catch (Exception e) {
@@ -251,10 +251,10 @@ public class SchemaAwareRpcBroker implements RpcRouter, Identifiable<String>, Ro
     }
 
     @Override
-    public <L extends RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(
+    public <L extends RouteChangeListener<RpcRoutingContext, YangInstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(
             final L listener) {
         ListenerRegistration<L> reg = routeChangeListeners.registerWithType(listener);
-        RouteChange<RpcRoutingContext, InstanceIdentifier> initial = createInitialRouteChange();
+        RouteChange<RpcRoutingContext, YangInstanceIdentifier> initial = createInitialRouteChange();
         try {
         listener.onRouteChange(initial);
         } catch (Exception e) {
@@ -263,15 +263,15 @@ public class SchemaAwareRpcBroker implements RpcRouter, Identifiable<String>, Ro
         return reg;
     }
 
-    private RouteChange<RpcRoutingContext, InstanceIdentifier> createInitialRouteChange() {
+    private RouteChange<RpcRoutingContext, YangInstanceIdentifier> createInitialRouteChange() {
         FluentIterable<RoutedRpcSelector> rpcSelectors = FluentIterable.from(implementations.values()).filter(RoutedRpcSelector.class);
 
 
-        ImmutableMap.Builder<RpcRoutingContext, Set<InstanceIdentifier>> announcements = ImmutableMap.builder();
-        ImmutableMap.Builder<RpcRoutingContext, Set<InstanceIdentifier>> removals = ImmutableMap.builder();
+        ImmutableMap.Builder<RpcRoutingContext, Set<YangInstanceIdentifier>> announcements = ImmutableMap.builder();
+        ImmutableMap.Builder<RpcRoutingContext, Set<YangInstanceIdentifier>> removals = ImmutableMap.builder();
         for (RoutedRpcSelector routedRpcSelector : rpcSelectors) {
             final RpcRoutingContext context = routedRpcSelector.getIdentifier();
-            final Set<InstanceIdentifier> paths = ImmutableSet.copyOf(routedRpcSelector.implementations.keySet());
+            final Set<YangInstanceIdentifier> paths = ImmutableSet.copyOf(routedRpcSelector.implementations.keySet());
             announcements.put(context, paths);
         }
         return RoutingUtils.change(announcements.build(), removals.build());
index 8d33ff7997dab4b2a09d813c9200e8b95f7dc762..275107ed8fb062bcfaf7c766cd0701ab3f0625af 100644 (file)
@@ -39,9 +39,9 @@ public abstract class AbstractBrokerServiceProxy<T extends BrokerService> implem
         return reference;
     }
 
-    private final Set<Registration<?>> registrations = Collections.synchronizedSet(new HashSet<Registration<?>>());
+    private final Set<Registration> registrations = Collections.synchronizedSet(new HashSet<Registration>());
 
-    protected <R extends Registration<?>> R addRegistration(final R registration) {
+    protected <R extends Registration> R addRegistration(final R registration) {
         if (registration != null) {
             registrations.add(registration);
         }
@@ -63,7 +63,7 @@ public abstract class AbstractBrokerServiceProxy<T extends BrokerService> implem
             RuntimeException potentialException = new RuntimeException(
                     "Uncaught exceptions occured during unregistration");
             boolean hasSuppressed = false;
-            for (Registration<?> registration : registrations) {
+            for (Registration registration : registrations) {
                 try {
                     registration.close();
                 } catch (Exception e) {
index 4f44f361d5d352e51378a681ef57dc48ebddd78c..b539cb948daadda555060379581788c1712bc1bf 100644 (file)
@@ -9,7 +9,7 @@ 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.api.DOMTransactionChain;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.osgi.framework.ServiceReference;
 
 public class DOMDataBrokerProxy extends AbstractBrokerServiceProxy<DOMDataBroker> implements DOMDataBroker {
@@ -35,7 +35,7 @@ public class DOMDataBrokerProxy extends AbstractBrokerServiceProxy<DOMDataBroker
 
     @Override
     public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store,
-            final InstanceIdentifier path, final DOMDataChangeListener listener,
+            final YangInstanceIdentifier path, final DOMDataChangeListener listener,
             final org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope triggeringScope) {
         return getDelegate().registerDataChangeListener(store, path, listener, triggeringScope);
     }
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DOMMountPointServiceProxy.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DOMMountPointServiceProxy.java
new file mode 100644 (file)
index 0000000..7a67755
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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.dom.broker.osgi;
+
+import com.google.common.base.Optional;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.osgi.framework.ServiceReference;
+
+public class DOMMountPointServiceProxy extends AbstractBrokerServiceProxy<DOMMountPointService> implements DOMMountPointService{
+
+
+    public DOMMountPointServiceProxy(final ServiceReference<DOMMountPointService> ref, final DOMMountPointService delegate) {
+        super(ref, delegate);
+    }
+
+    @Override
+    public Optional<DOMMountPoint> getMountPoint(final YangInstanceIdentifier path) {
+        return getDelegate().getMountPoint(path);
+    }
+
+    @Override
+    public DOMMountPointBuilder createMountPoint(final YangInstanceIdentifier path) {
+        return getDelegate().createMountPoint(path);
+    }
+
+    public ListenerRegistration<MountProvisionListener> registerProvisionListener(final MountProvisionListener listener) {
+        return getDelegate().registerProvisionListener(listener);
+    }
+}
index 30027ec929b2529d366de9c7fd5c6d0fe25f5d7d..94d423e0126931559e08ca40fd7c56b5e98f1843 100644 (file)
@@ -12,7 +12,7 @@ import org.opendaylight.controller.sal.core.api.data.DataChangeListener;
 import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.osgi.framework.ServiceReference;
 
 public class DataBrokerServiceProxy extends AbstractBrokerServiceProxy<DataBrokerService> implements DataBrokerService {
@@ -21,16 +21,16 @@ public class DataBrokerServiceProxy extends AbstractBrokerServiceProxy<DataBroke
         super(ref, delegate);
     }
 
-    public ListenerRegistration<DataChangeListener> registerDataChangeListener(InstanceIdentifier path,
+    public ListenerRegistration<DataChangeListener> registerDataChangeListener(YangInstanceIdentifier path,
             DataChangeListener listener) {
         return addRegistration(getDelegate().registerDataChangeListener(path, listener));
     }
 
-    public CompositeNode readConfigurationData(InstanceIdentifier path) {
+    public CompositeNode readConfigurationData(YangInstanceIdentifier path) {
         return getDelegate().readConfigurationData(path);
     }
 
-    public CompositeNode readOperationalData(InstanceIdentifier path) {
+    public CompositeNode readOperationalData(YangInstanceIdentifier path) {
         return getDelegate().readOperationalData(path);
     }
 
index caae2971f8bf8eaba5cc392f7252aa123c086fa4..86bfa23ed22c38b2135f3fcf80dc70b2701a104f 100644 (file)
@@ -19,7 +19,7 @@ import org.opendaylight.controller.sal.core.api.data.DataValidator;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.osgi.framework.ServiceReference;
 
 public class DataProviderServiceProxy extends AbstractBrokerServiceProxy<DataProviderService> implements
@@ -29,16 +29,16 @@ public class DataProviderServiceProxy extends AbstractBrokerServiceProxy<DataPro
         super(ref, delegate);
     }
 
-    public ListenerRegistration<DataChangeListener> registerDataChangeListener(InstanceIdentifier path,
+    public ListenerRegistration<DataChangeListener> registerDataChangeListener(YangInstanceIdentifier path,
             DataChangeListener listener) {
         return addRegistration(getDelegate().registerDataChangeListener(path, listener));
     }
 
-    public CompositeNode readConfigurationData(InstanceIdentifier path) {
+    public CompositeNode readConfigurationData(YangInstanceIdentifier path) {
         return getDelegate().readConfigurationData(path);
     }
 
-    public CompositeNode readOperationalData(InstanceIdentifier path) {
+    public CompositeNode readOperationalData(YangInstanceIdentifier path) {
         return getDelegate().readOperationalData(path);
     }
 
@@ -57,20 +57,20 @@ public class DataProviderServiceProxy extends AbstractBrokerServiceProxy<DataPro
     }
 
     @Override
-    public Registration<DataCommitHandler<InstanceIdentifier, CompositeNode>> registerCommitHandler(
-            InstanceIdentifier path, DataCommitHandler<InstanceIdentifier, CompositeNode> commitHandler) {
+    public Registration registerCommitHandler(
+            YangInstanceIdentifier path, DataCommitHandler<YangInstanceIdentifier, CompositeNode> commitHandler) {
         return addRegistration(getDelegate().registerCommitHandler(path, commitHandler));
     }
 
     @Override
-    public Registration<DataReader<InstanceIdentifier, CompositeNode>> registerConfigurationReader(
-            InstanceIdentifier path, DataReader<InstanceIdentifier, CompositeNode> reader) {
+    public Registration registerConfigurationReader(
+            YangInstanceIdentifier path, DataReader<YangInstanceIdentifier, CompositeNode> reader) {
         return addRegistration(getDelegate().registerConfigurationReader(path, reader));
     }
 
     @Override
-    public Registration<DataReader<InstanceIdentifier, CompositeNode>> registerOperationalReader(
-            InstanceIdentifier path, DataReader<InstanceIdentifier, CompositeNode> reader) {
+    public Registration registerOperationalReader(
+            YangInstanceIdentifier path, DataReader<YangInstanceIdentifier, CompositeNode> reader) {
         return addRegistration(getDelegate().registerOperationalReader(path, reader));
     }
 
@@ -85,8 +85,8 @@ public class DataProviderServiceProxy extends AbstractBrokerServiceProxy<DataPro
     }
 
     @Override
-    public ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier, CompositeNode>>> registerCommitHandlerListener(
-            RegistrationListener<DataCommitHandlerRegistration<InstanceIdentifier, CompositeNode>> commitHandlerListener) {
+    public ListenerRegistration<RegistrationListener<DataCommitHandlerRegistration<YangInstanceIdentifier, CompositeNode>>> registerCommitHandlerListener(
+            RegistrationListener<DataCommitHandlerRegistration<YangInstanceIdentifier, CompositeNode>> commitHandlerListener) {
         return addRegistration(getDelegate().registerCommitHandlerListener(commitHandlerListener));
     }
 }
index 24d5430d6d3713a0c6b3e5a5252eb710e9550e7d..c807aa0b84e8e6e9d745cd285b33692fdc785871 100644 (file)
@@ -8,9 +8,10 @@
 package org.opendaylight.controller.sal.dom.broker.osgi;
 
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.osgi.framework.ServiceReference;
 
 public class MountProviderServiceProxy extends AbstractBrokerServiceProxy<MountProvisionService> implements MountProvisionService{
@@ -21,17 +22,17 @@ public class MountProviderServiceProxy extends AbstractBrokerServiceProxy<MountP
     }
 
     @Override
-    public MountProvisionInstance getMountPoint(InstanceIdentifier path) {
+    public MountProvisionInstance getMountPoint(YangInstanceIdentifier path) {
         return getDelegate().getMountPoint(path);
     }
 
     @Override
-    public MountProvisionInstance createMountPoint(InstanceIdentifier path) {
+    public MountProvisionInstance createMountPoint(YangInstanceIdentifier path) {
         return getDelegate().createMountPoint(path);
     }
 
     @Override
-    public MountProvisionInstance createOrGetMountPoint(InstanceIdentifier path) {
+    public MountProvisionInstance createOrGetMountPoint(YangInstanceIdentifier path) {
         return getDelegate().createOrGetMountPoint(path);
     }
 
index cd26c4ea5c51f1f8d0283d8fb40803954528e48b..72cd41b9336d5233ad2129f7d81644b38065730b 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.sal.dom.broker.osgi;
 
 import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
 import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService;
-import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 import org.osgi.framework.ServiceReference;
@@ -22,7 +22,7 @@ public class NotificationPublishServiceProxy extends AbstractBrokerServiceProxy<
     }
 
     @Override
-    public Registration<NotificationListener> addNotificationListener(QName notification, NotificationListener listener) {
+    public ListenerRegistration<NotificationListener> addNotificationListener(QName notification, NotificationListener listener) {
         return addRegistration(getDelegate().addNotificationListener(notification, listener));
 
     }
index a0051dc38e5efa2f3156bc3fc6a2e9b8fb4d5420..4da7f025b34bec4ba57cf483e3595e6d0bbf545f 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.sal.dom.broker.osgi;
 
 import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
 import org.opendaylight.controller.sal.core.api.notify.NotificationService;
-import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.osgi.framework.ServiceReference;
 
@@ -21,7 +21,7 @@ public class NotificationServiceProxy extends AbstractBrokerServiceProxy<Notific
     }
 
     @Override
-    public Registration<NotificationListener> addNotificationListener(QName notification, NotificationListener listener) {
+    public ListenerRegistration<NotificationListener> addNotificationListener(QName notification, NotificationListener listener) {
         return addRegistration(getDelegate().addNotificationListener(notification, listener));
     }
 }
index c2d6add17a07c8ffefa711618034b690d35040ae..2ce2bac86227f2e9b0decf770a68dea7f5bcd1bb 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.sal.dom.broker.osgi;
 
 import java.util.Arrays;
 
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
 import org.opendaylight.controller.sal.core.api.BrokerService;
 import org.osgi.framework.ServiceReference;
 import org.opendaylight.controller.sal.core.api.data.DataBrokerService;
@@ -66,6 +67,13 @@ public class ProxyFactory {
                 ((ServiceReference<MountProvisionService>) ref), service);
     }
 
+    private static Object _createProxyImpl(final ServiceReference<?> ref,
+            final DOMMountPointService service) {
+
+        return new DOMMountPointServiceProxy(
+                ((ServiceReference<DOMMountPointService>) ref), service);
+    }
+
     private static Object _createProxyImpl(final ServiceReference<?> ref,
             final SchemaService service) {
 
@@ -113,6 +121,8 @@ public class ProxyFactory {
             return _createProxyImpl(ref, (SchemaService) service);
         } else if (service instanceof NotificationService) {
             return _createProxyImpl(ref, (NotificationService) service);
+        } else if (service instanceof DOMMountPointService) {
+            return _createProxyImpl(ref, (DOMMountPointService) service);
         } else if (service != null) {
             return _createProxyImpl(ref, service);
         } else {
index 7193a5317709e1b3494eef90bd563b628b6dadec..3c1901a53096c42ac7dc2a821a35887bb8dd77a2 100644 (file)
@@ -21,7 +21,7 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.osgi.framework.ServiceReference;
 
 import com.google.common.util.concurrent.ListenableFuture;
@@ -53,7 +53,7 @@ public class RpcProvisionRegistryProxy extends AbstractBrokerServiceProxy<RpcPro
     }
 
     @Override
-    public <L extends RouteChangeListener<RpcRoutingContext, InstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(final L listener) {
+    public <L extends RouteChangeListener<RpcRoutingContext, YangInstanceIdentifier>> ListenerRegistration<L> registerRouteChangeListener(final L listener) {
         return getDelegate().registerRouteChangeListener(listener);
     }
 
index 1d864eec5bab32c2e1de266ed22eb5f065273109..d8d2346a8cfa42a89685a2dc12552920aea59664 100644 (file)
@@ -8,10 +8,10 @@
 package org.opendaylight.controller.sal.dom.broker.osgi;
 
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
-import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 import org.osgi.framework.ServiceReference;
 
 public class SchemaServiceProxy extends AbstractBrokerServiceProxy<SchemaService> implements SchemaService {
@@ -41,12 +41,9 @@ public class SchemaServiceProxy extends AbstractBrokerServiceProxy<SchemaService
     }
 
     @Override
-    public ListenerRegistration<SchemaServiceListener> registerSchemaServiceListener(SchemaServiceListener listener) {
-        ListenerRegistration<SchemaServiceListener> registration = getDelegate().registerSchemaServiceListener(listener);
+    public ListenerRegistration<SchemaContextListener> registerSchemaContextListener(SchemaContextListener listener) {
+        ListenerRegistration<SchemaContextListener> registration = getDelegate().registerSchemaContextListener(listener);
         addRegistration(registration);
         return registration;
     }
-
-
-
 }
index ebe95d6eb5589624536c887f7b8802898b0e7384..2d8bd186c5fb3e5eb297722b10724fb44cee022d 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.sal.dom.broker.spi;
 
 import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
-import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 
@@ -22,7 +22,7 @@ public interface NotificationRouter {
      * @param notification
      * @param listener
      */
-    Registration<NotificationListener> addNotificationListener(QName notification,
+    ListenerRegistration<NotificationListener> addNotificationListener(QName notification,
             NotificationListener listener);
 
 }
index 2976c76ffa0a8ea91679baa975ecf2e77efc14cf..f5e7dc99bda604493b6b8bc8cd1b396a7efe438b 100644 (file)
@@ -12,7 +12,7 @@ import java.util.Map;
 import org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.core.api.RpcImplementation;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 public interface RoutedRpcProcessor extends RpcImplementation {
 
@@ -20,7 +20,7 @@ public interface RoutedRpcProcessor extends RpcImplementation {
 
     QName getRpcType();
 
-    Map<InstanceIdentifier,RpcImplementation> getRoutes();
+    Map<YangInstanceIdentifier,RpcImplementation> getRoutes();
 
     RpcImplementation getDefaultRoute();
 
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/ProxySchemaContext.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/util/ProxySchemaContext.java
new file mode 100644 (file)
index 0000000..311055f
--- /dev/null
@@ -0,0 +1,193 @@
+/*
+ * 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.dom.broker.util;
+
+import java.net.URI;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
+import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
+import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
+import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.Status;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.UsesNode;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+
+/**
+ * ProxySchema Context for SchemaContextProviders
+ */
+public class ProxySchemaContext implements SchemaContext {
+
+    private final SchemaContextProvider schemaProvider;
+
+    public ProxySchemaContext(final SchemaContextProvider schemaProvider) {
+        this.schemaProvider = schemaProvider;
+    }
+
+    private SchemaContext getCurrentSchema() {
+        Preconditions.checkState(schemaProvider.getSchemaContext() != null, "Schema context unavailable from %s", schemaProvider);
+        return schemaProvider.getSchemaContext();
+    }
+
+    @Override
+    public Set<DataSchemaNode> getDataDefinitions() {
+        return getCurrentSchema().getDataDefinitions();
+    }
+
+    @Override
+    public Set<Module> getModules() {
+        return getCurrentSchema().getModules();
+    }
+
+    @Override
+    public Set<NotificationDefinition> getNotifications() {
+        return getCurrentSchema().getNotifications();
+    }
+
+    @Override
+    public Set<RpcDefinition> getOperations() {
+        return getCurrentSchema().getOperations();
+    }
+
+    @Override
+    public Set<ExtensionDefinition> getExtensions() {
+        return getCurrentSchema().getExtensions();
+    }
+
+    @Override
+    public Module findModuleByName(final String s, final Date date) {
+        return getCurrentSchema().findModuleByName(s, date);
+    }
+
+    @Override
+    public Set<Module> findModuleByNamespace(final URI uri) {
+        return getCurrentSchema().findModuleByNamespace(uri);
+    }
+
+    @Override
+    public Module findModuleByNamespaceAndRevision(final URI uri, final Date date) {
+        return getCurrentSchema().findModuleByNamespaceAndRevision(uri, date);
+    }
+
+    @Override
+    public Optional<String> getModuleSource(final ModuleIdentifier moduleIdentifier) {
+        return getCurrentSchema().getModuleSource(moduleIdentifier);
+    }
+
+    @Override
+    public Set<ModuleIdentifier> getAllModuleIdentifiers() {
+        return getCurrentSchema().getAllModuleIdentifiers();
+    }
+
+    @Override
+    public boolean isPresenceContainer() {
+        return getCurrentSchema().isPresenceContainer();
+    }
+
+    @Override
+    public Set<TypeDefinition<?>> getTypeDefinitions() {
+        return getCurrentSchema().getTypeDefinitions();
+    }
+
+    @Override
+    public Collection<DataSchemaNode> getChildNodes() {
+        return getCurrentSchema().getChildNodes();
+    }
+
+    @Override
+    public Set<GroupingDefinition> getGroupings() {
+        return getCurrentSchema().getGroupings();
+    }
+
+    @Override
+    public DataSchemaNode getDataChildByName(final QName qName) {
+        return getCurrentSchema().getDataChildByName(qName);
+    }
+
+    @Override
+    public DataSchemaNode getDataChildByName(final String s) {
+        return getCurrentSchema().getDataChildByName(s);
+    }
+
+    @Override
+    public Set<UsesNode> getUses() {
+        return getCurrentSchema().getUses();
+    }
+
+    @Override
+    public Set<AugmentationSchema> getAvailableAugmentations() {
+        return getCurrentSchema().getAvailableAugmentations();
+    }
+
+    @Override
+    public boolean isAugmenting() {
+        return getCurrentSchema().isAugmenting();
+    }
+
+    @Override
+    public boolean isAddedByUses() {
+        return getCurrentSchema().isAddedByUses();
+    }
+
+    @Override
+    public boolean isConfiguration() {
+        return getCurrentSchema().isConfiguration();
+    }
+
+    @Override
+    public ConstraintDefinition getConstraints() {
+        return getCurrentSchema().getConstraints();
+    }
+
+    @Override
+    public QName getQName() {
+        return getCurrentSchema().getQName();
+    }
+
+    @Override
+    public SchemaPath getPath() {
+        return getCurrentSchema().getPath();
+    }
+
+    @Override
+    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return getCurrentSchema().getUnknownSchemaNodes();
+    }
+
+    @Override
+    public String getDescription() {
+        return getCurrentSchema().getDescription();
+    }
+
+    @Override
+    public String getReference() {
+        return getCurrentSchema().getReference();
+    }
+
+    @Override
+    public Status getStatus() {
+        return getCurrentSchema().getStatus();
+    }
+}
index 29392dc7b3e91e6c6dbe202cbe1b4e4292cce17d..970bb0289910d2f2cd5dc3c473acec9af661a2d0 100644 (file)
@@ -18,8 +18,8 @@ import java.util.List;
 import java.util.Set;
 
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
 import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
 import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
@@ -54,7 +54,7 @@ public final class YangSchemaUtils {
         throw new UnsupportedOperationException("Utility class.");
     }
 
-    public static DataSchemaNode getSchemaNode(final SchemaContext schema,final InstanceIdentifier path) {
+    public static DataSchemaNode getSchemaNode(final SchemaContext schema,final YangInstanceIdentifier path) {
         checkArgument(schema != null,"YANG Schema must not be null.");
         checkArgument(path != null,"Path must not be null.");
         return getSchemaNode(schema, FluentIterable.from(path.getPathArguments()).transform(QNAME_FROM_PATH_ARGUMENT));
@@ -92,8 +92,7 @@ public final class YangSchemaUtils {
     }
 
     private static DataSchemaNode searchInChoices(final DataNodeContainer node, final QName arg) {
-        Set<DataSchemaNode> children = node.getChildNodes();
-        for (DataSchemaNode child : children) {
+        for (DataSchemaNode child : node.getChildNodes()) {
             if (child instanceof ChoiceNode) {
                 ChoiceNode choiceNode = (ChoiceNode) child;
                 DataSchemaNode potential = searchInCases(choiceNode, arg);
index 2dec6f2e4d1bdf773001c66343c8cf1ad4549160..181396fc884699e07eef9e0778e1ce3655d5e721 100644 (file)
@@ -18,7 +18,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
 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.yang.data.api.InstanceIdentifier;
+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;
@@ -40,8 +40,8 @@ public class DOMBrokerPerformanceTest {
         return ImmutableNodes.mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, i);
     }
 
-    private static InstanceIdentifier outerListPath(final int i) {
-        return InstanceIdentifier.builder(TestModel.OUTER_LIST_PATH)//
+    private static YangInstanceIdentifier outerListPath(final int i) {
+        return YangInstanceIdentifier.builder(TestModel.OUTER_LIST_PATH)//
                 .nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, i) //
                 .build();
     }
@@ -141,11 +141,11 @@ public class DOMBrokerPerformanceTest {
                 int i = 0;
                 for (DOMDataReadWriteTransaction writeTx :transactions) {
                     // Writes /test/outer-list/i in writeTx
-                    InstanceIdentifier path = InstanceIdentifier.builder(outerListPath(i))
+                    YangInstanceIdentifier path = YangInstanceIdentifier.builder(outerListPath(i))
                             .node(TestModel.INNER_LIST_QNAME).build();
                     writeTx.put(OPERATIONAL, path, ImmutableNodes.mapNodeBuilder(TestModel.INNER_LIST_QNAME).build());
                     for (int j = 0; j < innerNum; j++) {
-                        InstanceIdentifier innerPath = InstanceIdentifier.builder(path)
+                        YangInstanceIdentifier innerPath = YangInstanceIdentifier.builder(path)
                                 .nodeWithKey(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME, String.valueOf(j))
                                 .build();
                         writeTx.put(
@@ -205,7 +205,7 @@ public class DOMBrokerPerformanceTest {
             public Void call() throws Exception {
                 for (int i = 0; i < txNum; i++) {
                     for (int j = 0; j < innerNum; j++) {
-                        InstanceIdentifier path = InstanceIdentifier
+                        YangInstanceIdentifier path = YangInstanceIdentifier
                                 .builder(outerListPath(i))
                                 //
                                 .node(TestModel.INNER_LIST_QNAME)
diff --git a/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/MountPointServiceTest.java b/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/MountPointServiceTest.java
new file mode 100644 (file)
index 0000000..4d686a9
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * 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.sal.dom.broker.impl;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import com.google.common.base.Optional;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService.DOMMountPointBuilder;
+import org.opendaylight.controller.md.sal.dom.broker.impl.mount.DOMMountPointServiceImpl;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+public class MountPointServiceTest {
+
+    private DOMMountPointService mountService;
+    private static final YangInstanceIdentifier PATH = YangInstanceIdentifier.of(QName.create("namespace", "12-12-2012", "top"));
+
+    @Before
+    public void setup() {
+        mountService = new DOMMountPointServiceImpl();
+    }
+
+    @Test
+    public void createSimpleMountPoint() {
+        Optional<DOMMountPoint> mountNotPresent = mountService.getMountPoint(PATH);
+        assertFalse(mountNotPresent.isPresent());
+        DOMMountPointBuilder mountBuilder = mountService.createMountPoint(PATH);
+        mountBuilder.register();
+
+        Optional<DOMMountPoint> mountPresent = mountService.getMountPoint(PATH);
+        assertTrue(mountPresent.isPresent());
+    }
+}
index 91aa57c25957a392bffb82f092c4b19f0a5ba4ed..d5ba2a2b9a50212e0b75c4036f1afc5fc890b065 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
@@ -29,8 +29,8 @@ public class TestModel {
     public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
     private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
 
-    public static final InstanceIdentifier TEST_PATH = InstanceIdentifier.of(TEST_QNAME);
-    public static final InstanceIdentifier OUTER_LIST_PATH = InstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
+    public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_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");
 
diff --git a/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPointManagerTest.java b/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPointManagerTest.java
new file mode 100644 (file)
index 0000000..4d239a9
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * 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.dom.broker;
+
+import static junit.framework.Assert.fail;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
+import org.opendaylight.controller.md.sal.dom.api.DOMService;
+import org.opendaylight.controller.md.sal.dom.broker.impl.mount.DOMMountPointServiceImpl;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Optional;
+
+public class BackwardsCompatibleMountPointManagerTest {
+    private static final Logger log = LoggerFactory.getLogger(BackwardsCompatibleMountPointManagerTest.class);
+
+    @Mock
+    private DOMMountPointServiceImpl domMountPointService;
+    @Mock
+    private DOMMountPointService.DOMMountPointBuilder mountBuilder;
+
+    private BackwardsCompatibleMountPointManager compatibleMountPointManager;
+    static final QName qName = QName.create("namespace", "12-12-1212", "mount");
+    static final YangInstanceIdentifier id = YangInstanceIdentifier.builder(qName).build();
+
+    @Before
+    public void setUp() throws Exception {
+        MockitoAnnotations.initMocks(this);
+        stubMountService();
+        compatibleMountPointManager = new BackwardsCompatibleMountPointManager(domMountPointService);
+    }
+
+    @Test
+    public void testCreateMountpointAlreadyCreated() throws Exception {
+        compatibleMountPointManager.createMountPoint(id);
+        verify(domMountPointService).createMountPoint(id);
+        verify(mountBuilder, times(3)).addService(any(Class.class), any(DOMService.class));
+        verify(mountBuilder).addInitialSchemaContext(any(SchemaContext.class));
+
+        try {
+            compatibleMountPointManager.createMountPoint(id);
+        } catch (final IllegalStateException e) {
+            log.debug("", e);
+            return;
+        }
+        fail("Should fail to create duplicate mount");
+    }
+
+    @Test
+    public void testCreateMountpointGetOrCreate() throws Exception {
+        compatibleMountPointManager = new BackwardsCompatibleMountPointManager(new DOMMountPointServiceImpl());
+
+        final MountProvisionListener listener = new MountProvisionListener() {
+            public int createdMounts = 0;
+
+            @Override
+            public void onMountPointCreated(final YangInstanceIdentifier path) {
+                if(createdMounts++ > 1 ) {
+                    fail("Only one mount point should have been created");
+                }
+            }
+
+            @Override
+            public void onMountPointRemoved(final YangInstanceIdentifier path) {}
+        };
+
+        compatibleMountPointManager.registerProvisionListener(listener);
+
+        final MountProvisionInstance m1 = compatibleMountPointManager.createOrGetMountPoint(id);
+        m1.setSchemaContext(mockSchemaContext());
+        compatibleMountPointManager.createOrGetMountPoint(id);
+        compatibleMountPointManager.createOrGetMountPoint(id);
+    }
+
+    private void stubMountService() {
+        doReturn(mockMountPointBuilder()).when(domMountPointService).createMountPoint(any(YangInstanceIdentifier.class));
+        doReturn(Optional.of(mockMountPoint())).when(domMountPointService).getMountPoint(any(YangInstanceIdentifier.class));
+    }
+
+    private DOMMountPoint mockMountPoint() {
+        final DOMMountPoint mock = mock(DOMMountPoint.class);
+        doAnswer(new Answer() {
+            @Override
+            public Object answer(final InvocationOnMock invocation) throws Throwable {
+                return Optional.of(mock(((Class<?>) invocation.getArguments()[0])));
+            }
+        }).when(mock).getService(any(Class.class));
+        doReturn(mockSchemaContext()).when(mock).getSchemaContext();
+        return mock;
+    }
+
+    static SchemaContext mockSchemaContext() {
+        final SchemaContext mock = mock(SchemaContext.class);
+        doReturn(qName).when(mock).getQName();
+        doReturn("schema").when(mock).toString();
+        doReturn(mock(DataSchemaNode.class)).when(mock).getDataChildByName(any(QName.class));
+        return mock;
+    }
+
+    private DOMMountPointService.DOMMountPointBuilder mockMountPointBuilder() {
+        doReturn(mountBuilder).when(mountBuilder).addService(any(Class.class), any(DOMService.class));
+        doReturn(mockObjectRegistration()).when(mountBuilder).register();
+        doReturn(mountBuilder).when(mountBuilder).addInitialSchemaContext(any(SchemaContext.class));
+        return mountBuilder;
+    }
+
+    private ObjectRegistration<?> mockObjectRegistration() {
+        return mock(ObjectRegistration.class);
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPointTest.java b/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/sal/dom/broker/BackwardsCompatibleMountPointTest.java
new file mode 100644 (file)
index 0000000..91ae0c2
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * 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.dom.broker;
+
+import static junit.framework.Assert.fail;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.ListenableFuture;
+import java.util.AbstractMap;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationException;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizer;
+import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction;
+import org.opendaylight.controller.sal.core.api.data.DataProviderService;
+import org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProvider;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BackwardsCompatibleMountPointTest {
+    private static final Logger log = LoggerFactory.getLogger(BackwardsCompatibleMountPointManagerTest.class);
+
+    private static final YangInstanceIdentifier id = BackwardsCompatibleMountPointManagerTest.id;
+    private final NormalizedNode<?, ?> normalizedNode = mockNormalizedNode();
+    private final CompositeNode compositeNode = mockCompositeNode();
+
+    @Mock
+    private DataProviderService oldBroker;
+    @Mock
+    private SchemaContextProvider schemaContextProvider;
+    @Mock
+    private DataModificationTransaction mockTx;
+
+    private BackwardsCompatibleMountPoint.BackwardsCompatibleDomStore backwardsCompatibleDomStore;
+
+    @Before
+    public void setUp() throws Exception {
+        MockitoAnnotations.initMocks(this);
+        stubSchemaProvider();
+        stubOldBroker();
+        backwardsCompatibleDomStore = new BackwardsCompatibleMountPoint.BackwardsCompatibleDomStore(oldBroker, schemaContextProvider);
+    }
+
+    private void stubOldBroker() {
+        doReturn(compositeNode).when(oldBroker).readConfigurationData(id);
+        doReturn(compositeNode).when(oldBroker).readOperationalData(id);
+        doReturn(mockTx).when(oldBroker).beginTransaction();
+        doNothing().when(mockTx).putConfigurationData(id, compositeNode);
+        doNothing().when(mockTx).putOperationalData(id, compositeNode);
+        doReturn(com.google.common.util.concurrent.Futures.immediateFuture(RpcResultBuilder.success(TransactionStatus.COMMITED))).when(mockTx).commit();
+    }
+
+    private CompositeNode mockCompositeNode() {
+        final CompositeNode mock = mock(CompositeNode.class);
+        doReturn("node").when(mock).toString();
+        return mock;
+    }
+
+    private void stubSchemaProvider() {
+        doReturn(BackwardsCompatibleMountPointManagerTest.mockSchemaContext()).when(schemaContextProvider).getSchemaContext();
+    }
+
+    @Test
+    public void testBackwardsCompatibleBroker() throws Exception {
+        backwardsCompatibleDomStore.newReadOnlyTransaction();
+        backwardsCompatibleDomStore.newWriteOnlyTransaction();
+        backwardsCompatibleDomStore.newReadWriteTransaction();
+    }
+
+    @Test
+    public void testReadTransaction() throws Exception {
+        final BackwardsCompatibleMountPoint.BackwardsCompatibleDomStore.BackwardsCompatibleReadTransaction tx =
+                new BackwardsCompatibleMountPoint.BackwardsCompatibleDomStore.BackwardsCompatibleReadTransaction(oldBroker, mockNormalizer());
+
+        ListenableFuture<Optional<NormalizedNode<?, ?>>> read = tx.read(LogicalDatastoreType.CONFIGURATION, id);
+        assertEquals(normalizedNode, read.get().get());
+        verify(oldBroker).readConfigurationData(id);
+
+        read = tx.read(LogicalDatastoreType.OPERATIONAL, id);
+        assertEquals(normalizedNode, read.get().get());
+
+        verify(oldBroker).readOperationalData(id);
+    }
+
+    @Test
+    public void testReadWriteTransactionOperational() throws Exception {
+        final BackwardsCompatibleMountPoint.BackwardsCompatibleDomStore.BackwardsCompatibleWriteTransaction tx =
+                new BackwardsCompatibleMountPoint.BackwardsCompatibleDomStore.BackwardsCompatibleWriteTransaction(oldBroker, mockNormalizer());
+
+        verify(oldBroker).beginTransaction();
+
+        tx.put(LogicalDatastoreType.CONFIGURATION, id, normalizedNode);
+        verify(mockTx).putConfigurationData(id, compositeNode);
+
+        tx.put(LogicalDatastoreType.CONFIGURATION, id, normalizedNode);
+        verify(mockTx, times(2)).putConfigurationData(id, compositeNode);
+
+        tx.commit();
+        verify(mockTx).commit();
+    }
+
+
+    @Test
+    public void testCannotPutOperational() throws Exception {
+        final BackwardsCompatibleMountPoint.BackwardsCompatibleDomStore.BackwardsCompatibleWriteTransaction tx =
+                new BackwardsCompatibleMountPoint.BackwardsCompatibleDomStore.BackwardsCompatibleWriteTransaction(oldBroker, mockNormalizer());
+
+        try {
+            tx.put(LogicalDatastoreType.OPERATIONAL, id, normalizedNode);
+        } catch (IllegalArgumentException e) {
+            // Cannot put operational data
+            log.debug("", e);
+            return;
+        }
+
+        fail("Should fail when putting operational data");
+    }
+
+    private DataNormalizer mockNormalizer() throws DataNormalizationException {
+        final DataNormalizer mock = mock(DataNormalizer.class);
+        doReturn(new AbstractMap.SimpleEntry<YangInstanceIdentifier, NormalizedNode<?, ?>>(id, normalizedNode) {})
+                .when(mock).toNormalized(any(YangInstanceIdentifier.class), any(CompositeNode.class));
+        doReturn(compositeNode).when(mock).toLegacy(any(YangInstanceIdentifier.class), any(NormalizedNode.class));
+        doReturn(id).when(mock).toLegacy(any(YangInstanceIdentifier.class));
+        return mock;
+    }
+
+    private NormalizedNode<?, ?> mockNormalizedNode() {
+        final NormalizedNode mock = mock(NormalizedNode.class);
+        doReturn("mockNormalizedNode").when(mock).toString();
+        return mock;
+    }
+}
diff --git a/opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/broker/spi/mount/SimpleDOMMountPoint.java b/opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/broker/spi/mount/SimpleDOMMountPoint.java
new file mode 100644 (file)
index 0000000..003da3e
--- /dev/null
@@ -0,0 +1,41 @@
+package org.opendaylight.controller.md.sal.dom.broker.spi.mount;
+
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
+import org.opendaylight.controller.md.sal.dom.api.DOMService;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.ClassToInstanceMap;
+import com.google.common.collect.ImmutableClassToInstanceMap;
+
+public class SimpleDOMMountPoint implements DOMMountPoint {
+
+    private final YangInstanceIdentifier identifier;
+    private final ClassToInstanceMap<DOMService> services;
+    private final SchemaContext schemaContext;
+
+    public static final SimpleDOMMountPoint create(final YangInstanceIdentifier identifier, final ClassToInstanceMap<DOMService> services, final SchemaContext ctx) {
+        return new SimpleDOMMountPoint(identifier, services, ctx);
+    }
+    private SimpleDOMMountPoint(final YangInstanceIdentifier identifier, final ClassToInstanceMap<DOMService> services, final SchemaContext ctx) {
+        this.identifier = identifier;
+        this.services = ImmutableClassToInstanceMap.copyOf(services);
+        this.schemaContext = ctx;
+    }
+
+    @Override
+    public YangInstanceIdentifier getIdentifier() {
+        return identifier;
+    }
+
+    @Override
+    public SchemaContext getSchemaContext() {
+        return schemaContext;
+    }
+
+    @Override
+    public <T extends DOMService> Optional<T> getService(final Class<T> cls) {
+        return Optional.fromNullable(services.getInstance(cls));
+    }
+}
index ab47d1034f884307a58a9453db55420ad9fd1947..0bab570bd130b4378c7e78510908eea5fa53a393 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.controller.sal.core.spi.data;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 /**
@@ -48,8 +48,8 @@ public interface DOMStore extends DOMStoreTransactionFactory {
      *         registration / interest on receiving data changes.
      *
      */
-    <L extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
-            InstanceIdentifier path, L listener, DataChangeScope scope);
+    <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
+            YangInstanceIdentifier path, L listener, DataChangeScope scope);
 
     /**
      *
index b546f2e77d20c93b215ea5305c1f0bd56ffa3fc0..ae1b3ee2aa32db9eb0836a6403fcadc5d0615a87 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.sal.core.spi.data;
 
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 import com.google.common.base.Optional;
@@ -31,5 +31,5 @@ public interface DOMStoreReadTransaction extends DOMStoreTransaction {
      *         {@link java.util.concurrent.Future#get()} returns {@link Optional#absent()}.
      *         </ul>
      */
-    ListenableFuture<Optional<NormalizedNode<?,?>>> read(InstanceIdentifier path);
+    ListenableFuture<Optional<NormalizedNode<?,?>>> read(YangInstanceIdentifier path);
 }
index 19bb0538c26023c2819f4cff2fa52964ed7056cb..0a090520f24dfd8ca94eac21a978c36bdac6eacc 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.sal.core.spi.data;
 
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 public interface DOMStoreWriteTransaction extends DOMStoreTransaction {
@@ -29,7 +29,7 @@ public interface DOMStoreWriteTransaction extends DOMStoreTransaction {
      *             if the client code already sealed transaction and invoked
      *             {@link #ready()}
      */
-    void write(InstanceIdentifier path, NormalizedNode<?, ?> data);
+    void write(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
 
     /**
      * Store a provided data at specified path. This acts as a add / replace
@@ -48,7 +48,7 @@ public interface DOMStoreWriteTransaction extends DOMStoreTransaction {
      *             if the client code already sealed transaction and invoked
      *             {@link #ready()}
      */
-    void merge(InstanceIdentifier path, NormalizedNode<?, ?> data);
+    void merge(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
 
     /**
      *
@@ -60,7 +60,7 @@ public interface DOMStoreWriteTransaction extends DOMStoreTransaction {
      *             if the client code already sealed transaction and invoked
      *             {@link #ready()}
      */
-    void delete(InstanceIdentifier path);
+    void delete(YangInstanceIdentifier path);
 
     /**
      *
diff --git a/opendaylight/md-sal/sal-dom-xsql/.checkstyle b/opendaylight/md-sal/sal-dom-xsql/.checkstyle
new file mode 100644 (file)
index 0000000..48e02b8
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+  <fileset name="all" enabled="true" check-config-name="Sun Checks" local="false">
+    <file-match-pattern match-pattern=".*" include-pattern="true"/>
+  </fileset>
+</fileset-config>
diff --git a/opendaylight/md-sal/sal-dom-xsql/.gitignore b/opendaylight/md-sal/sal-dom-xsql/.gitignore
new file mode 100644 (file)
index 0000000..a48e45b
--- /dev/null
@@ -0,0 +1 @@
+/target-ide
diff --git a/opendaylight/md-sal/sal-dom-xsql/pom.xml b/opendaylight/md-sal/sal-dom-xsql/pom.xml
new file mode 100644 (file)
index 0000000..2ab80da
--- /dev/null
@@ -0,0 +1,102 @@
+<?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>sal-parent</artifactId>
+    <version>1.1-SNAPSHOT</version>
+  </parent>
+  <artifactId>sal-dom-xsql</artifactId>
+  <packaging>bundle</packaging>
+  <name>sal-dom-xsql</name>
+  <description>XSQL language</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>config-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-binding-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-binding-config</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-common-util</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-core-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>yang-jmx-generator-plugin</artifactId>
+      <version>${config.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-binding</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-common</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.opendaylight.yangtools</groupId>
+        <artifactId>yang-maven-plugin</artifactId>
+        <dependencies>
+          <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>maven-sal-api-gen-plugin</artifactId>
+            <version>${yangtools.version}</version>
+            <type>jar</type>
+          </dependency>
+        </dependencies>
+        <executions>
+          <execution>
+            <goals>
+              <goal>generate-sources</goal>
+            </goals>
+            <configuration>
+              <yangFilesRootDir>src/main/yang</yangFilesRootDir>
+              <codeGenerators>
+                <generator>
+                  <codeGeneratorClass>org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator</codeGeneratorClass>
+                  <outputBaseDir>${jmxGeneratorPath}</outputBaseDir>
+                  <additionalConfiguration>
+                    <namespaceToPackage1>urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang</namespaceToPackage1>
+                  </additionalConfiguration>
+                </generator>
+                <generator>
+                  <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>
+                  <outputBaseDir>${salGeneratorPath}</outputBaseDir>
+                </generator>
+              </codeGenerators>
+              <inspectDependencies>true</inspectDependencies>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:XSQL</url>
+  <scm>
+    <developerConnection>Sharon Aicler</developerConnection>
+    <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:XSQL</url>
+  </scm>
+</project>
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/TablesResultSet.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/TablesResultSet.java
new file mode 100644 (file)
index 0000000..2f28052
--- /dev/null
@@ -0,0 +1,1241 @@
+package org.opendaylight.controller.md.sal.dom.xsql;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.NClob;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.RowId;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Statement;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.Map;
+
+public class TablesResultSet implements ResultSet {
+
+    private String tables[] = null;
+    private int pos = -1;
+
+    public TablesResultSet(XSQLBluePrint cache) {
+        //tables = cache.getInterfaceNames();
+    }
+
+    @Override
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean next() throws SQLException {
+        if (tables == null) {
+            return false;
+        }
+        pos++;
+        if (pos >= tables.length) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public void close() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public boolean wasNull() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public String getString(int columnIndex) throws SQLException {
+        return tables[pos];
+    }
+
+    @Override
+    public boolean getBoolean(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public byte getByte(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public short getShort(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getInt(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public long getLong(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public float getFloat(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public double getDouble(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(int columnIndex, int scale)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public byte[] getBytes(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Date getDate(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Time getTime(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Timestamp getTimestamp(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public InputStream getAsciiStream(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public InputStream getUnicodeStream(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public InputStream getBinaryStream(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getString(String columnLabel) throws SQLException {
+        return tables[pos];
+    }
+
+    @Override
+    public boolean getBoolean(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public byte getByte(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public short getShort(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getInt(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public long getLong(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public float getFloat(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public double getDouble(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(String columnLabel, int scale)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public byte[] getBytes(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Date getDate(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Time getTime(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Timestamp getTimestamp(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public InputStream getAsciiStream(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public InputStream getUnicodeStream(String columnLabel)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public InputStream getBinaryStream(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public SQLWarning getWarnings() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void clearWarnings() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public String getCursorName() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSetMetaData getMetaData() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Object getObject(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Object getObject(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public int findColumn(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public Reader getCharacterStream(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Reader getCharacterStream(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public boolean isBeforeFirst() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isAfterLast() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isFirst() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isLast() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public void beforeFirst() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void afterLast() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public boolean first() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean last() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public int getRow() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public boolean absolute(int row) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean relative(int rows) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean previous() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public void setFetchDirection(int direction) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public int getFetchDirection() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public void setFetchSize(int rows) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public int getFetchSize() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getType() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getConcurrency() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public boolean rowUpdated() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean rowInserted() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean rowDeleted() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public void updateNull(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBoolean(int columnIndex, boolean x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateByte(int columnIndex, byte x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateShort(int columnIndex, short x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateInt(int columnIndex, int x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateLong(int columnIndex, long x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateFloat(int columnIndex, float x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateDouble(int columnIndex, double x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBigDecimal(int columnIndex, BigDecimal x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateString(int columnIndex, String x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBytes(int columnIndex, byte[] x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateDate(int columnIndex, Date x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateTime(int columnIndex, Time x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateTimestamp(int columnIndex, Timestamp x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateAsciiStream(int columnIndex, InputStream x, int length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBinaryStream(int columnIndex, InputStream x, int length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateCharacterStream(int columnIndex, Reader x, int length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateObject(int columnIndex, Object x, int scaleOrLength)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateObject(int columnIndex, Object x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNull(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBoolean(String columnLabel, boolean x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateByte(String columnLabel, byte x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateShort(String columnLabel, short x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateInt(String columnLabel, int x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateLong(String columnLabel, long x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateFloat(String columnLabel, float x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateDouble(String columnLabel, double x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBigDecimal(String columnLabel, BigDecimal x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateString(String columnLabel, String x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBytes(String columnLabel, byte[] x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateDate(String columnLabel, Date x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateTime(String columnLabel, Time x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateTimestamp(String columnLabel, Timestamp x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateAsciiStream(String columnLabel, InputStream x, int length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBinaryStream(String columnLabel, InputStream x,
+        int length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateCharacterStream(String columnLabel, Reader reader,
+        int length) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateObject(String columnLabel, Object x, int scaleOrLength)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateObject(String columnLabel, Object x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void insertRow() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateRow() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void deleteRow() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void refreshRow() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void cancelRowUpdates() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void moveToInsertRow() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void moveToCurrentRow() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public Statement getStatement() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Object getObject(int columnIndex, Map<String, Class<?>> map)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Ref getRef(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Blob getBlob(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Clob getClob(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Array getArray(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Object getObject(String columnLabel, Map<String, Class<?>> map)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Ref getRef(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Blob getBlob(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Clob getClob(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Array getArray(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Date getDate(int columnIndex, Calendar cal) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Date getDate(String columnLabel, Calendar cal) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Time getTime(int columnIndex, Calendar cal) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Time getTime(String columnLabel, Calendar cal) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Timestamp getTimestamp(int columnIndex, Calendar cal)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Timestamp getTimestamp(String columnLabel, Calendar cal)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public URL getURL(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public URL getURL(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void updateRef(int columnIndex, Ref x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateRef(String columnLabel, Ref x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBlob(int columnIndex, Blob x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBlob(String columnLabel, Blob x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateClob(int columnIndex, Clob x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateClob(String columnLabel, Clob x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateArray(int columnIndex, Array x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateArray(String columnLabel, Array x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public RowId getRowId(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public RowId getRowId(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void updateRowId(int columnIndex, RowId x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateRowId(String columnLabel, RowId x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public int getHoldability() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public boolean isClosed() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public void updateNString(int columnIndex, String nString)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNString(String columnLabel, String nString)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNClob(String columnLabel, NClob nClob)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public NClob getNClob(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public NClob getNClob(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public SQLXML getSQLXML(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public SQLXML getSQLXML(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void updateSQLXML(int columnIndex, SQLXML xmlObject)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateSQLXML(String columnLabel, SQLXML xmlObject)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public String getNString(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getNString(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Reader getNCharacterStream(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Reader getNCharacterStream(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void updateNCharacterStream(int columnIndex, Reader x, long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNCharacterStream(String columnLabel, Reader reader,
+        long length) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateAsciiStream(int columnIndex, InputStream x, long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBinaryStream(int columnIndex, InputStream x, long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateCharacterStream(int columnIndex, Reader x, long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateAsciiStream(String columnLabel, InputStream x,
+        long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBinaryStream(String columnLabel, InputStream x,
+        long length) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateCharacterStream(String columnLabel, Reader reader,
+        long length) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBlob(int columnIndex, InputStream inputStream,
+        long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBlob(String columnLabel, InputStream inputStream,
+        long length) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateClob(int columnIndex, Reader reader, long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateClob(String columnLabel, Reader reader, long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNClob(int columnIndex, Reader reader, long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNClob(String columnLabel, Reader reader, long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNCharacterStream(int columnIndex, Reader x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNCharacterStream(String columnLabel, Reader reader)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateAsciiStream(int columnIndex, InputStream x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBinaryStream(int columnIndex, InputStream x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateCharacterStream(int columnIndex, Reader x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateAsciiStream(String columnLabel, InputStream x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBinaryStream(String columnLabel, InputStream x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateCharacterStream(String columnLabel, Reader reader)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBlob(int columnIndex, InputStream inputStream)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBlob(String columnLabel, InputStream inputStream)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateClob(int columnIndex, Reader reader) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateClob(String columnLabel, Reader reader)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNClob(int columnIndex, Reader reader)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNClob(String columnLabel, Reader reader)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public <T> T getObject(String columnLabel, Class<T> type)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}
+
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLAdapter.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLAdapter.java
new file mode 100644 (file)
index 0000000..6d4400f
--- /dev/null
@@ -0,0 +1,531 @@
+package org.opendaylight.controller.md.sal.dom.xsql;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataReadTransaction;
+import org.opendaylight.controller.md.sal.dom.xsql.jdbc.JDBCResultSet;
+import org.opendaylight.controller.md.sal.dom.xsql.jdbc.JDBCServer;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
+
+public class XSQLAdapter extends Thread implements SchemaContextListener {
+
+    private static final int SLEEP = 10000;
+    private static XSQLAdapter a = new XSQLAdapter();
+    private static PrintStream l = null;
+    public boolean stopped = false;
+    private List<String> elementHosts = new ArrayList<String>();
+    private String username;
+    private String password;
+    private String transport = "tcp";
+    private int reconnectTimeout;
+    private int nThreads;
+    private int qsize;
+    private String applicationName = "NQL Adapter";
+    private Map<String, NEEntry> elements = new ConcurrentHashMap<String, XSQLAdapter.NEEntry>();
+    private StringBuffer lastInputString = new StringBuffer();
+    private XSQLBluePrint bluePrint = new XSQLBluePrint();
+    private boolean toCsv = false;
+    private String exportToFileName = null;
+    private XSQLThreadPool threadPool = new XSQLThreadPool(1, "Tasks", 2000);
+    private JDBCServer jdbcServer = new JDBCServer(this);
+    private String pinningFile;
+    private ServerSocket serverSocket = null;
+    private DOMDataBroker domDataBroker = null;
+
+    private XSQLAdapter() {
+        XSQLAdapter.log("Starting Adapter");
+        this.setDaemon(true);
+        try {
+            serverSocket = new ServerSocket(34343);
+        } catch (Exception err) {
+            XSQLAdapter.log(err);
+        }
+        this.start();
+        XSQLAdapter.log("Adapter Started!");
+
+    }
+
+    public static XSQLAdapter getInstance() {
+        return a;
+    }
+
+    public static void main(String args[]) {
+        XSQLAdapter adapter = new XSQLAdapter();
+        adapter.start();
+    }
+
+    public static void log(String str) {
+        try {
+            if (l == null) {
+                synchronized (XSQLAdapter.class) {
+                    if (l == null) {
+                        l = new PrintStream(
+                                new FileOutputStream("/tmp/xql.log"));
+                    }
+                }
+            }
+            l.print(Calendar.getInstance().getTime());
+            l.print(" - ");
+            l.println(str);
+        } catch (Exception err) {
+            err.printStackTrace();
+        }
+    }
+
+    public static void log(Exception e) {
+        try {
+            if (l == null) {
+                synchronized (XSQLAdapter.class) {
+                    if (l == null) {
+                        l = new PrintStream(
+                                new FileOutputStream("/tmp/xql.log"));
+                    }
+                }
+            }
+            l.print(Calendar.getInstance().getTime());
+            l.print(" - ");
+            e.printStackTrace(l);
+        } catch (Exception err) {
+            err.printStackTrace();
+        }
+    }
+
+    @Override
+    public void onGlobalContextUpdated(SchemaContext context) {
+        Set<Module> modules = context.getModules();
+        for (Module m : modules) {
+            if (XSQLODLUtils.createOpenDaylightCache(this.bluePrint, m)) {
+                this.addRootElement(m);
+            }
+        }
+    }
+
+    public void setDataBroker(DOMDataBroker ddb) {
+        this.domDataBroker = ddb;
+    }
+
+    public XSQLBluePrint getBluePrint() {
+        return this.bluePrint;
+    }
+
+    public List<Object> collectModuleRoots(XSQLBluePrintNode table) {
+        if (table.getParent().isModule()) {
+            try {
+                List<Object> result = new LinkedList<Object>();
+                YangInstanceIdentifier instanceIdentifier = YangInstanceIdentifier
+                        .builder()
+                        .node(XSQLODLUtils.getPath(table.getODLNode()).get(0))
+                        .toInstance();
+                DOMDataReadTransaction t = this.domDataBroker
+                        .newReadOnlyTransaction();
+                Object node = t.read(LogicalDatastoreType.OPERATIONAL,
+                        instanceIdentifier).get();
+                node = XSQLODLUtils.get(node, "reference");
+                if (node == null) {
+                    return result;
+                }
+
+                // XSQLAdapter.log(""+node);
+                Map<?, ?> children = XSQLODLUtils.getChildren(node);
+                for (Object c : children.values()) {
+                    Map<?, ?> sons = XSQLODLUtils.getChildren(c);
+                    for (Object child : sons.values()) {
+                        result.add(child);
+                    }
+                }
+
+                return result;
+            } catch (Exception err) {
+                XSQLAdapter.log(err);
+            }
+        } else {
+            return collectModuleRoots(table.getParent());
+        }
+        return null;
+    }
+
+    public void execute(JDBCResultSet rs) {
+        List<XSQLBluePrintNode> tables = rs.getTables();
+        List<Object> roots = collectModuleRoots(tables.get(0));
+        XSQLBluePrintNode main = rs.getMainTable();
+        List<NETask> tasks = new LinkedList<XSQLAdapter.NETask>();
+
+        for (Object entry : roots) {
+            NETask task = new NETask(rs, entry, main, bluePrint);
+            rs.numberOfTasks++;
+            tasks.add(task);
+        }
+        for (NETask task : tasks) {
+            threadPool.addTask(task);
+        }
+    }
+
+    public void run() {
+        while (!stopped) {
+            try {
+                Socket s = serverSocket.accept();
+                new TelnetConnection(s);
+            } catch (Exception err) {
+                err.printStackTrace();
+                try {
+                    Thread.sleep(20000);
+                } catch (Exception err2) {
+                }
+                stopped = true;
+            }
+        }
+    }
+
+    public void addRootElement(Object o) {
+        NEEntry entry = new NEEntry(o);
+        elements.put(o.toString(), entry);
+
+    }
+
+    protected void processCommand(StringBuffer inputString, PrintStream sout,
+            TelnetConnection tc) {
+        if (inputString.toString().trim().equals("r")) {
+            sout.println(lastInputString);
+            inputString = lastInputString;
+        }
+        lastInputString = inputString;
+        String input = inputString.toString().trim();
+        if (input.startsWith("setExcel")) {
+            String substr = input.substring("setExcel".length()).trim();
+            if (!substr.equals("")) {
+                // excelPath01 = substr;
+            }
+            // sout.println("Excel Path="+excelPath01);
+        } else if (input.startsWith("list vrel")) {
+            String substr = input.substring("list vrel".length()).trim();
+            XSQLBluePrintNode node = bluePrint
+                    .getBluePrintNodeByTableName(substr);
+            if (node == null) {
+                sout.println("Unknown Interface " + substr);
+                return;
+            }
+            List<String> fld = new ArrayList<String>();
+            for (XSQLBluePrintRelation r : node.getRelations()) {
+                fld.add(r.toString());
+            }
+            String p[] = (String[]) fld.toArray(new String[fld.size()]);
+            Arrays.sort(p);
+            for (int i = 0; i < p.length; i++) {
+                sout.println(p[i]);
+            }
+        } else if (input.startsWith("list vfields")) {
+            String substr = input.substring("list vfields".length()).trim();
+            XSQLBluePrintNode node = bluePrint
+                    .getBluePrintNodeByTableName(substr);
+            if (node == null) {
+                sout.println("Unknown Interface " + substr);
+                return;
+            }
+            List<String> fld = new ArrayList<String>();
+            for (XSQLColumn c : node.getColumns()) {
+                fld.add(c.getName());
+            }
+            String p[] = (String[]) fld.toArray(new String[fld.size()]);
+            Arrays.sort(p);
+            for (int i = 0; i < p.length; i++) {
+                sout.println(p[i]);
+            }
+        } else if (input.startsWith("jdbc")) {
+            String addr = input.substring(5).trim();
+            jdbcServer.connectToClient(addr);
+            sout.println("Connected To " + addr);
+        } else if (input.startsWith("fetch")) {
+            // fetchSize = Integer.parseInt(input.substring(6).trim());
+        } else if (input.startsWith("list vtables")) {
+
+            String iNames[] = bluePrint.getAllTableNames().toArray(
+                    new String[0]);
+            Arrays.sort(iNames);
+            sout.println();
+            for (int i = 0; i < iNames.length; i++) {
+                sout.println(iNames[i]);
+            }
+        } else if (input.startsWith("cd sid")) {
+            String substr = input.substring("cd sid".length()).trim();
+            for (NEEntry e : elements.values()) {
+                if (((Module) e.ne).getName().equals(substr)) {
+                    tc.currentModule = (Module) e.ne;
+                }
+            }
+        } else if (input.equals("list sid")) {
+            String arr[] = new String[elements.size()];
+
+            int i = 0;
+            for (NEEntry entry : elements.values()) {
+                arr[i] = entry.toString();
+                i++;
+            }
+            Arrays.sort(arr);
+            for (String s : arr) {
+                sout.println(s);
+            }
+        } else if (input.equals("help") || input.equals("?")) {
+            // sout.println(getLongDescription());
+        } else if (input.equals("avmdata")) {
+            try {
+                // myConnection.getManagedData();
+            } catch (Exception err) {
+            }
+        } else if (input.equals("innerjoin")) {
+            // innerJoin = !innerJoin;
+            // sout.println("Inner Join set to "+innerJoin);
+        } else if (input.equals("exit")) {
+            try {
+                sout.close();
+            } catch (Exception err) {
+            }
+        } else if (input.equals("tocsv")) {
+            toCsv = !toCsv;
+            sout.println("to csv file is " + toCsv);
+        } else if (input.indexOf("filename") != -1) {
+            exportToFileName = input.substring(input.indexOf(" ")).trim();
+            sout.println("Exporting to file:" + exportToFileName);
+        } else if (!input.equals("")) {
+            if (toCsv) {
+                if (exportToFileName != null) {
+                    try {
+                        PrintStream o = new PrintStream(new File(
+                                exportToFileName));
+                        executeSql(inputString.toString(), o);
+                        o.close();
+                    } catch (Exception err) {
+                        err.printStackTrace();
+                    }
+                } else {
+                    try {
+                        String fName = "export-" + System.currentTimeMillis()
+                                + ".csv";
+                        PrintStream o = new PrintStream(new File(fName));
+                        executeSql(inputString.toString(), o);
+                        o.close();
+                        sout.println("Exported to file " + fName);
+                    } catch (Exception err) {
+                        err.printStackTrace();
+                    }
+
+                }
+            } else {
+                executeSql(inputString.toString(), sout);
+            }
+        }
+        sout.println();
+    }
+
+    public void executeSql(String sql, PrintStream out) {
+        JDBCResultSet rs = new JDBCResultSet(sql);
+        try {
+            int count = 0;
+            jdbcServer.execute(rs, this);
+            boolean isFirst = true;
+            int loc = rs.getFields().size() - 1;
+            int totalWidth = 0;
+            for (XSQLColumn c : rs.getFields()) {
+                if (isFirst) {
+                    isFirst = false;
+                    if (toCsv) {
+                        out.print("\"");
+                    }
+                }
+
+                if (!toCsv) {
+                    out.print("|");
+                }
+
+                out.print(c.getName());
+
+                if (!toCsv) {
+                    int cw = c.getCharWidth();
+                    int cnw = c.getName().length();
+                    if (cnw > cw) {
+                        c.setCharWidth(cnw);
+                    }
+                    int gap = cw - cnw;
+                    for (int i = 0; i < gap; i++) {
+                        out.print(" ");
+                    }
+                }
+
+                totalWidth += c.getCharWidth() + 1;
+
+                if (loc > 0) {
+                    if (toCsv) {
+                        out.print("\",\"");
+                    }
+                }
+                loc--;
+            }
+
+            if (toCsv) {
+                out.println("\"");
+            } else {
+                totalWidth++;
+                out.println("|");
+                for (int i = 0; i < totalWidth; i++) {
+                    out.print("-");
+                }
+                out.println();
+            }
+
+            while (rs.next()) {
+                isFirst = true;
+                loc = rs.getFields().size() - 1;
+                for (XSQLColumn c : rs.getFields()) {
+                    if (isFirst) {
+                        isFirst = false;
+                        if (toCsv) {
+                            out.print("\"");
+                        }
+                    }
+
+                    if (!toCsv) {
+                        out.print("|");
+                    }
+
+                    Object sValue = rs.getObject(c.toString());
+                    if (sValue == null) {
+                        sValue = "";
+                    }
+                    out.print(sValue);
+
+                    int cw = c.getCharWidth();
+                    int vw = sValue.toString().length();
+                    int gap = cw - vw;
+                    for (int i = 0; i < gap; i++) {
+                        out.print(" ");
+                    }
+
+                    if (loc > 0) {
+                        if (toCsv) {
+                            out.print("\",\"");
+                        }
+                    }
+                    loc--;
+                }
+                if (toCsv) {
+                    out.println("\"");
+                } else {
+                    out.println("|");
+                }
+                count++;
+            }
+            out.println("Total Number Of Records=" + count);
+        } catch (Exception err) {
+            err.printStackTrace(out);
+        }
+    }
+
+    public static class NETask implements Runnable {
+
+        private JDBCResultSet rs = null;
+        private Object modelRoot = null;
+        private XSQLBluePrintNode main = null;
+        private XSQLBluePrint bluePrint = null;
+
+        public NETask(JDBCResultSet _rs, Object _modelRoot,
+                XSQLBluePrintNode _main, XSQLBluePrint _bluePrint) {
+            this.rs = _rs;
+            this.modelRoot = _modelRoot;
+            this.main = _main;
+            this.bluePrint = _bluePrint;
+        }
+
+        public void run() {
+            rs.addRecords(modelRoot, main, true, main.getBluePrintNodeName(),
+                    bluePrint);
+            synchronized (rs) {
+                rs.numberOfTasks--;
+                if (rs.numberOfTasks == 0) {
+                    rs.setFinished(true);
+                    rs.notifyAll();
+                }
+            }
+        }
+    }
+
+    private static class NEEntry {
+        private Object ne = null;
+
+        public NEEntry(Object _ne) {
+            this.ne = _ne;
+        }
+
+        public String toString() {
+            Module m = (Module) ne;
+            return m.getName() + "  [" + m.getNamespace().toString() + "]";
+        }
+    }
+
+    private class TelnetConnection extends Thread {
+
+        private Socket socket = null;
+        private InputStream in = null;
+        private PrintStream out = null;
+        private Module currentModule = null;
+
+        public TelnetConnection(Socket s) {
+            this.socket = s;
+            try {
+                this.in = s.getInputStream();
+                this.out = new PrintStream(s.getOutputStream());
+                this.start();
+            } catch (Exception err) {
+                XSQLAdapter.log(err);
+            }
+        }
+
+        public void run() {
+            StringBuffer inputString = new StringBuffer();
+            String prompt = "XSQL>";
+            try {
+                while (!stopped) {
+                    if (currentModule != null) {
+                        prompt = "XQL/" + currentModule.getName() + ">";
+                    }
+                    out.print(prompt);
+                    char c = 0;
+                    byte data[] = new byte[1];
+                    while (c != '\n') {
+                        try {
+                            in.read(data);
+                            c = (char) data[0];
+                            inputString.append(c);
+                        } catch (Exception err) {
+                            err.printStackTrace(out);
+                        }
+                    }
+
+                    processCommand(inputString, out, this);
+                    inputString = new StringBuffer();
+                }
+            } catch (Exception err) {
+                try {
+                    socket.close();
+                } catch (Exception err2) {
+                }
+            }
+        }
+    }
+}
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrint.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrint.java
new file mode 100644 (file)
index 0000000..1a31662
--- /dev/null
@@ -0,0 +1,1314 @@
+package org.opendaylight.controller.md.sal.dom.xsql;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.Type;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.RowIdLifetime;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class XSQLBluePrint implements DatabaseMetaData {
+
+    public static final String CACHE_FILE_NAME = "BluePrintCache.dat";
+
+    private Map<String, XSQLBluePrintNode> tableNameToBluePrint = new HashMap<String, XSQLBluePrintNode>();
+    private Map<String, Map<String,XSQLBluePrintNode>> odlNameToBluePrint = new HashMap<String, Map<String,XSQLBluePrintNode>>();
+
+    private boolean cacheLoadedSuccessfuly = false;
+    private DatabaseMetaData myProxy = null;
+
+    public static final String replaceAll(String source, String toReplace,
+        String withThis) {
+        int index = source.indexOf(toReplace);
+        int index2 = 0;
+        StringBuffer result = new StringBuffer();
+        while (index != -1) {
+            result.append(source.substring(index2, index));
+            result.append(withThis);
+            index2 = index + toReplace.length();
+            index = source.indexOf(toReplace, index2);
+        }
+        if (index2 < source.length()) {
+            result.append(source.substring(index2));
+        }
+        return result.toString();
+    }
+
+    public XSQLBluePrint() {
+    }
+
+    private class NQLBluePrintProxy implements InvocationHandler {
+        public Object invoke(Object proxy, Method method, Object[] args)
+            throws Throwable {
+            System.out.println("Method " + method);
+            return method.invoke(XSQLBluePrint.this, args);
+        }
+    }
+
+    public DatabaseMetaData getProxy() {
+        if (myProxy == null) {
+            try {
+                myProxy = (DatabaseMetaData) Proxy
+                    .newProxyInstance(getClass().getClassLoader(),
+                        new Class[] {DatabaseMetaData.class},
+                        new NQLBluePrintProxy());
+            } catch (Exception err) {
+                err.printStackTrace();
+            }
+        }
+        return myProxy;
+    }
+
+    /*
+    public void loadBluePrintCache(String hostName) {
+        try {
+            ObjectInputStream in = new ObjectInputStream(
+                new FileInputStream(hostName + "-" + CACHE_FILE_NAME));
+            cache = (Map) in.readObject();
+            in.close();
+            cacheLoadedSuccessfuly = true;
+        } catch (Exception err) {
+            //err.printStackTrace();
+        }
+    }*/
+
+    public XSQLBluePrintNode[] getBluePrintNodeByODLTableName(String odlTableName) {
+        Map<String,XSQLBluePrintNode> map = this.odlNameToBluePrint.get(odlTableName);
+        if(map==null) return null;
+        return map.values().toArray(new XSQLBluePrintNode[map.size()]);
+    }
+
+    public XSQLBluePrintNode getBluePrintNodeByTableName(String tableName) {
+        if (tableName.indexOf(".") != -1) {
+            tableName = tableName.substring(tableName.lastIndexOf(".") + 1);
+        }
+
+        XSQLBluePrintNode node = tableNameToBluePrint.get(tableName);
+
+        if (node != null) {
+            return node;
+        }
+
+        for (XSQLBluePrintNode n : tableNameToBluePrint.values()) {
+            if (n.getBluePrintNodeName().endsWith(tableName)) {
+                return n;
+            }
+        }
+
+        for (XSQLBluePrintNode n : tableNameToBluePrint.values()) {
+            if (n.getBluePrintNodeName().toLowerCase().endsWith(tableName.toLowerCase())) {
+                return n;
+            }
+        }
+
+        for (XSQLBluePrintNode n : tableNameToBluePrint.values()) {
+            if (n.getBluePrintNodeName().toLowerCase().equals(tableName.toLowerCase())) {
+                return n;
+            }
+        }
+
+        for (XSQLBluePrintNode n : tableNameToBluePrint.values()) {
+            if (n.getBluePrintNodeName().toLowerCase().indexOf(tableName.toLowerCase())!= -1) {
+                return n;
+            }
+        }
+        return null;
+    }
+
+
+    public boolean isCacheLoaded() {
+        return cacheLoadedSuccessfuly;
+    }
+
+    private static Map<Class, Set<Class>> superClassMap = new HashMap<Class, Set<Class>>();
+
+    public static Set<Class> getInheritance(Class myObjectClass,
+        Class returnType) {
+
+        if (returnType != null && myObjectClass.equals(returnType)) {
+            return new HashSet<Class>();
+        }
+        Set<Class> result = superClassMap.get(myObjectClass);
+        if (result != null) {
+            return result;
+        }
+        result = new HashSet<Class>();
+        superClassMap.put(myObjectClass, result);
+        if (returnType != null) {
+            if (!returnType.equals(myObjectClass)) {
+                Class mySuperClass = myObjectClass.getSuperclass();
+                while (mySuperClass != null) {
+                    result.add(mySuperClass);
+                    mySuperClass = mySuperClass.getSuperclass();
+                }
+                result.addAll(collectInterfaces(myObjectClass));
+            }
+        }
+        return result;
+    }
+
+    public static Set<Class> collectInterfaces(Class cls) {
+        Set<Class> result = new HashSet();
+        Class myInterfaces[] = cls.getInterfaces();
+        if (myInterfaces != null) {
+            for (Class in : myInterfaces) {
+                result.add(in);
+                result.addAll(collectInterfaces(in));
+            }
+        }
+        return result;
+    }
+
+    public void addToBluePrintCache(XSQLBluePrintNode blNode) {
+        this.tableNameToBluePrint.put(blNode.getBluePrintNodeName(), blNode);
+        Map<String,XSQLBluePrintNode> map = this.odlNameToBluePrint.get(blNode.getODLTableName());
+        if(map==null){
+            map = new HashMap<String,XSQLBluePrintNode>();
+            this.odlNameToBluePrint.put(blNode.getODLTableName(),map);
+        }
+        map.put(blNode.getBluePrintNodeName(), blNode);
+    }
+
+    public Class getGenericType(ParameterizedType type) {
+        Type[] typeArguments = type.getActualTypeArguments();
+        for (Type typeArgument : typeArguments) {
+            if (typeArgument instanceof ParameterizedType) {
+                ParameterizedType pType = (ParameterizedType) typeArgument;
+                return (Class) pType.getRawType();
+            } else if (typeArgument instanceof Class) {
+                return (Class) typeArgument;
+            }
+        }
+        return null;
+    }
+
+    public Class getMethodReturnTypeFromGeneric(Method m) {
+        Type rType = m.getGenericReturnType();
+        if (rType instanceof ParameterizedType) {
+            return getGenericType((ParameterizedType) rType);
+        }
+        return null;
+    }
+
+    public List<String> getAllTableNames() {
+        List<String> names = new ArrayList<String>();
+        for (XSQLBluePrintNode n : this.tableNameToBluePrint.values()) {
+            if (!n.isModule() && !n.getColumns().isEmpty()) {
+                names.add(n.getBluePrintNodeName());
+            }
+        }
+        return names;
+
+    }
+
+    public List<String> getInterfaceNames(XSQLBluePrintNode node) {
+        Set<XSQLBluePrintNode> children = node.getChildren();
+        List<String> names = new ArrayList<String>();
+        for (XSQLBluePrintNode n : children) {
+            if (!n.isModule() && !n.getColumns().isEmpty()) {
+                names.add(n.toString());
+            }
+            names.addAll(getInterfaceNames(n));
+        }
+        return names;
+    }
+
+    @Override
+    public boolean allProceduresAreCallable() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean allTablesAreSelectable() throws SQLException {
+        return true;
+    }
+
+    @Override
+    public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean deletesAreDetected(int type) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public ResultSet getAttributes(String catalog, String schemaPattern,
+        String typeNamePattern, String attributeNamePattern)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getBestRowIdentifier(String catalog, String schema,
+        String table, int scope, boolean nullable) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getCatalogs() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getCatalogSeparator() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getCatalogTerm() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getClientInfoProperties() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getColumnPrivileges(String catalog, String schema,
+        String table, String columnNamePattern) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getColumns(String catalog, String schemaPattern,
+        String tableNamePattern, String columnNamePattern)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Connection getConnection() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getCrossReference(String parentCatalog,
+        String parentSchema, String parentTable, String foreignCatalog,
+        String foreignSchema, String foreignTable) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public int getDatabaseMajorVersion() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getDatabaseMinorVersion() throws SQLException {
+        // TODO Auto-generated method stub
+        return 1;
+    }
+
+    @Override
+    public String getDatabaseProductName() throws SQLException {
+        return "VNE Query Language";
+    }
+
+    @Override
+    public String getDatabaseProductVersion() throws SQLException {
+        return "0.1";
+    }
+
+    @Override
+    public int getDefaultTransactionIsolation() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getDriverMajorVersion() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getDriverMinorVersion() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public String getDriverName() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getDriverVersion() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getExportedKeys(String catalog, String schema,
+        String table)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getExtraNameCharacters() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getFunctionColumns(String catalog, String schemaPattern,
+        String functionNamePattern, String columnNamePattern)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getFunctions(String catalog, String schemaPattern,
+        String functionNamePattern) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getIdentifierQuoteString() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getImportedKeys(String catalog, String schema,
+        String table)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getIndexInfo(String catalog, String schema, String table,
+        boolean unique, boolean approximate) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public int getJDBCMajorVersion() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getJDBCMinorVersion() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxBinaryLiteralLength() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxCatalogNameLength() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxCharLiteralLength() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxColumnNameLength() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxColumnsInGroupBy() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxColumnsInIndex() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxColumnsInOrderBy() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxColumnsInSelect() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxColumnsInTable() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxConnections() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxCursorNameLength() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxIndexLength() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxProcedureNameLength() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxRowSize() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxSchemaNameLength() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxStatementLength() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxStatements() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxTableNameLength() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxTablesInSelect() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxUserNameLength() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public String getNumericFunctions() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getPrimaryKeys(String catalog, String schema, String table)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getProcedureColumns(String catalog, String schemaPattern,
+        String procedureNamePattern, String columnNamePattern)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getProcedures(String catalog, String schemaPattern,
+        String procedureNamePattern) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getProcedureTerm() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public int getResultSetHoldability() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public RowIdLifetime getRowIdLifetime() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getSchemas() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getSchemas(String catalog, String schemaPattern)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getSchemaTerm() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getSearchStringEscape() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getSQLKeywords() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public int getSQLStateType() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public String getStringFunctions() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getSuperTables(String catalog, String schemaPattern,
+        String tableNamePattern) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getSuperTypes(String catalog, String schemaPattern,
+        String typeNamePattern) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getSystemFunctions() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getTablePrivileges(String catalog, String schemaPattern,
+        String tableNamePattern) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getTables(String catalog, String schemaPattern,
+        String tableNamePattern, String[] types) throws SQLException {
+        return new TablesResultSet(this);
+    }
+
+    @Override
+    public ResultSet getTableTypes() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getTimeDateFunctions() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getTypeInfo() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getUDTs(String catalog, String schemaPattern,
+        String typeNamePattern, int[] types) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getURL() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getUserName() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getVersionColumns(String catalog, String schema,
+        String table) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public boolean insertsAreDetected(int type) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isCatalogAtStart() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isReadOnly() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean locatorsUpdateCopy() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean nullPlusNonNullIsNull() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean nullsAreSortedAtEnd() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean nullsAreSortedAtStart() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean nullsAreSortedHigh() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean nullsAreSortedLow() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean othersDeletesAreVisible(int type) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean othersInsertsAreVisible(int type) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean othersUpdatesAreVisible(int type) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean ownDeletesAreVisible(int type) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean ownInsertsAreVisible(int type) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean ownUpdatesAreVisible(int type) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean storesLowerCaseIdentifiers() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean storesMixedCaseIdentifiers() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean storesUpperCaseIdentifiers() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsAlterTableWithAddColumn() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsAlterTableWithDropColumn() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsANSI92EntryLevelSQL() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsANSI92FullSQL() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsANSI92IntermediateSQL() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsBatchUpdates() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsCatalogsInDataManipulation() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsCatalogsInPrivilegeDefinitions()
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsCatalogsInProcedureCalls() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsCatalogsInTableDefinitions() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsColumnAliasing() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsConvert() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsConvert(int fromType, int toType)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsCoreSQLGrammar() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsCorrelatedSubqueries() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsDataDefinitionAndDataManipulationTransactions()
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsDataManipulationTransactionsOnly()
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsDifferentTableCorrelationNames()
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsExpressionsInOrderBy() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsExtendedSQLGrammar() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsFullOuterJoins() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsGetGeneratedKeys() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsGroupBy() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsGroupByBeyondSelect() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsGroupByUnrelated() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsIntegrityEnhancementFacility() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsLikeEscapeClause() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsLimitedOuterJoins() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsMinimumSQLGrammar() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsMixedCaseIdentifiers() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsMultipleOpenResults() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsMultipleResultSets() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsMultipleTransactions() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsNamedParameters() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsNonNullableColumns() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsOrderByUnrelated() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsOuterJoins() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsPositionedDelete() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsPositionedUpdate() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsResultSetConcurrency(int type, int concurrency)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsResultSetHoldability(int holdability)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsResultSetType(int type) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsSavepoints() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsSchemasInDataManipulation() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsSchemasInIndexDefinitions() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsSchemasInProcedureCalls() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsSchemasInTableDefinitions() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsSelectForUpdate() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsStatementPooling() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsStoredFunctionsUsingCallSyntax()
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsStoredProcedures() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsSubqueriesInComparisons() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsSubqueriesInExists() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsSubqueriesInIns() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsSubqueriesInQuantifieds() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsTableCorrelationNames() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsTransactionIsolationLevel(int level)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsTransactions() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsUnion() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean supportsUnionAll() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean updatesAreDetected(int type) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean usesLocalFilePerTable() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean usesLocalFiles() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ResultSet getPseudoColumns(String catalog, String schemaPattern,
+        String tableNamePattern, String columnNamePattern)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public boolean generatedKeyAlwaysReturned() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintNode.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintNode.java
new file mode 100644 (file)
index 0000000..fbd818e
--- /dev/null
@@ -0,0 +1,236 @@
+package org.opendaylight.controller.md.sal.dom.xsql;
+
+import java.io.Serializable;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+public class XSQLBluePrintNode implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+    private Class<?> myInterface = null;
+    private String myInterfaceString = null;
+    private Set<XSQLBluePrintRelation> relations =
+        new HashSet<XSQLBluePrintRelation>();
+    private Set<XSQLBluePrintNode> inheritingNodes =
+        new HashSet<XSQLBluePrintNode>();
+    private Set<XSQLBluePrintNode> children = new HashSet<XSQLBluePrintNode>();
+    private XSQLBluePrintNode parent = null;
+
+    private int level = -1;
+    private transient Set<String> parentHierarchySet = null;
+    private String myInterfaceName = null;
+    private Set<XSQLColumn> columns = new HashSet<XSQLColumn>();
+
+    private transient Object odlNode = null;
+    private boolean module = false;
+    private String bluePrintTableName = null;
+    private String odlTableName = null;
+
+    public XSQLBluePrintNode(Class<?> _myInterface, int _level) {
+        this.myInterface = _myInterface;
+        this.myInterfaceString = _myInterface.getName();
+        this.myInterfaceName = myInterface.getSimpleName();
+        this.level = _level;
+    }
+
+    public XSQLBluePrintNode(Object _odlNode, int _level,XSQLBluePrintNode _parent) {
+        this.odlNode = _odlNode;
+        this.level = _level;
+        this.module = XSQLODLUtils.isModule(_odlNode);
+        this.parent = _parent;
+        this.bluePrintTableName = XSQLODLUtils.getBluePrintName(_odlNode);
+
+    }
+
+    public String getBluePrintNodeName(){
+        return this.bluePrintTableName;
+    }
+
+    public boolean isModule() {
+        return this.module;
+    }
+
+    public Set<XSQLBluePrintNode> getChildren() {
+        return this.children;
+    }
+
+    public String getODLTableName() {
+        if (this.odlTableName == null) {
+            this.odlTableName = XSQLODLUtils.getODLNodeName(this.odlNode);
+        }
+        return this.odlTableName;
+    }
+
+    public Object getODLNode() {
+        return this.odlNode;
+    }
+
+    public void AddChild(XSQLBluePrintNode ch) {
+        this.children.add(ch);
+    }
+
+    public boolean isModelChild(Class p) {
+        if (this.relations.size() == 0) {
+            return false;
+        }
+        for (XSQLBluePrintRelation parentRelation : this.relations) {
+            if (parentRelation.getParent().getInterface().equals(p)) {
+                return true;
+            }
+        }
+        for (XSQLBluePrintRelation dtr : this.relations) {
+            XSQLBluePrintNode parent = dtr.getParent();
+            if (!parent.getInterface().equals(this.getInterface()) && !parent
+                .getInterface().isAssignableFrom(this.getInterface()) &&
+                this.getInterface().isAssignableFrom(parent.getInterface())
+                && parent.isModelChild(p)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public Set<XSQLBluePrintRelation> getRelations() {
+        return this.relations;
+    }
+
+    public String getClassName() {
+        return this.myInterfaceString;
+    }
+
+    public void addInheritingNode(XSQLBluePrintNode node) {
+        this.inheritingNodes.add(node);
+    }
+
+    public Set<XSQLBluePrintNode> getInheritingNodes() {
+        return this.inheritingNodes;
+    }
+
+    public void addColumn(Object node, String tableName) {
+        XSQLColumn c = new XSQLColumn(node,getBluePrintNodeName(), this);
+        this.columns.add(c);
+    }
+
+    public void addColumn(String methodName) {
+        if (methodName.startsWith("get")) {
+            methodName = methodName.substring(3);
+        } else if (methodName.startsWith("is")) {
+            methodName = methodName.substring(2);
+        }
+        XSQLColumn c = new XSQLColumn(methodName, myInterfaceName, null);
+        this.columns.add(c);
+    }
+
+    public Collection<XSQLColumn> getColumns() {
+        return this.columns;
+    }
+
+    public XSQLColumn findColumnByName(String name) throws SQLException {
+
+        XSQLColumn exactMatch = null;
+        XSQLColumn indexOfMatch = null;
+        XSQLColumn exactLowercaseMatch = null;
+        XSQLColumn indexOfLowerCaseMatch = null;
+
+        for (XSQLColumn col : columns) {
+            if (col.getName().equals(name)) {
+                exactMatch = col;
+            }
+            if (col.getName().indexOf(name) != -1) {
+                indexOfMatch = col;
+            }
+            if (col.getName().toLowerCase().equals(name.toLowerCase())) {
+                exactLowercaseMatch = col;
+            }
+            if (col.getName().toLowerCase().indexOf(name.toLowerCase()) != -1) {
+                indexOfLowerCaseMatch = col;
+            }
+        }
+
+        if (exactMatch != null) {
+            return exactMatch;
+        }
+        if (exactLowercaseMatch != null) {
+            return exactLowercaseMatch;
+        }
+        if (indexOfMatch != null) {
+            return indexOfMatch;
+        }
+        if (indexOfLowerCaseMatch != null) {
+            return indexOfLowerCaseMatch;
+        }
+
+        throw new SQLException("Unknown field name '" + name + "'");
+    }
+
+
+    public void addParent(XSQLBluePrintNode parent, String property) {
+        try {
+            if (property.equals("ContainingTPs")) {
+                return;
+            }
+            //Method m = parent.getInterface().getMethod("get"+property, null);
+            //if(!m.getDeclaringClass().equals(parent.getInterface()))
+            //return;
+            XSQLBluePrintRelation rel =
+                new XSQLBluePrintRelation(parent, property, myInterface);
+            relations.add(rel);
+        } catch (Exception err) {
+            err.printStackTrace();
+        }
+    }
+
+    public XSQLBluePrintNode getParent() {
+        return this.parent;
+    }
+
+    public Set<XSQLBluePrintRelation> getClonedParents() {
+        Set<XSQLBluePrintRelation> result =
+            new HashSet<XSQLBluePrintRelation>();
+        result.addAll(this.relations);
+        return result;
+    }
+
+    public String toString() {
+        if (myInterfaceName != null) {
+            return myInterfaceName;
+        }
+        if (odlNode != null) {
+            return getBluePrintNodeName();
+        }
+        return "Unknown";
+    }
+
+    public Class getInterface() {
+        return this.myInterface;
+    }
+
+    public int getLevel() {
+        return this.level;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        XSQLBluePrintNode other = (XSQLBluePrintNode) obj;
+        if (odlNode != null) {
+            return getBluePrintNodeName().equals(other.getBluePrintNodeName());
+        } else if (this.odlTableName != null) {
+            return this.odlTableName.equals(other.odlTableName);
+        } else {
+            return other.myInterface.equals(myInterface);
+        }
+    }
+
+    @Override
+    public int hashCode() {
+        if (myInterfaceString != null) {
+            return myInterfaceString.hashCode();
+        } else if (odlNode != null) {
+            return bluePrintTableName.hashCode();
+        }
+        return 0;
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintRelation.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintRelation.java
new file mode 100644 (file)
index 0000000..1cb3aa5
--- /dev/null
@@ -0,0 +1,139 @@
+package org.opendaylight.controller.md.sal.dom.xsql;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class XSQLBluePrintRelation implements Serializable {
+    private static final long serialVersionUID = 2L;
+    private XSQLBluePrintNode parent = null;
+    private String property = null;
+    private Class<?> childClass = null;
+
+    public XSQLBluePrintRelation(XSQLBluePrintNode _parent, String _property,
+        Class<?> _childClass) {
+        this.parent = _parent;
+        this.property = _property;
+        this.childClass = _childClass;
+    }
+
+    public Class<?> getNEClosestClass() {
+        Class<?> p = parent.getInterface();
+        return getNEClosestClass(p);
+    }
+
+
+    public static Class<?> getNEClosestClass(Class<?> p) {
+        while (!p.getInterfaces()[0]
+            .equals(Object.class/*XSQLBluePrint.STOP_INTERFACE*/)) {
+            p = p.getInterfaces()[0];
+        }
+        return p;
+    }
+
+    public XSQLBluePrintNode getParent() {
+        return parent;
+    }
+
+    public String getProperty() {
+        return property;
+    }
+
+    public Class<?> getChildClass() {
+        return this.childClass;
+    }
+
+    public boolean equals(Object obj) {
+        XSQLBluePrintRelation other = (XSQLBluePrintRelation) obj;
+        if (other.parent != null && this.parent == null) {
+            return false;
+        }
+        if (other.parent == null && this.parent != null) {
+            return false;
+        }
+
+        if (other.parent == null && this.parent == null) {
+            return property.equals(other.property);
+        }
+
+        if (other.parent.toString().equals(this.parent.toString())) {
+            return property.equals(other.property);
+        }
+
+        return false;
+    }
+
+    public int hashCode() {
+        if (parent != null) {
+            return parent.toString().hashCode() + property.hashCode();
+        }
+        return property.hashCode();
+    }
+
+    public String toString() {
+        if (parent != null) {
+            return parent.toString() + ":" + property;
+        } else {
+            return property;
+        }
+    }
+
+    public List execute(Object o) {
+        List result = new LinkedList();
+        if (o == null) {
+            return null;
+        }
+
+        if (Set.class.isAssignableFrom(o.getClass())) {
+            Set lst = (Set) o;
+            for (Object oo : lst) {
+                addToResult(result, execute(oo));
+            }
+            return result;
+        } else if (List.class.isAssignableFrom(o.getClass())) {
+            List lst = (List) o;
+            for (Object oo : lst) {
+                addToResult(result, execute(oo));
+            }
+            return result;
+        } else if (Map.class.isAssignableFrom(o.getClass())) {
+            Map map = (Map) o;
+            for (Object oo : map.values()) {
+                addToResult(result, execute(oo));
+            }
+            return result;
+        }
+
+        addToResult(result, XSQLCriteria.getValue(o, this.property));
+
+        return result;
+    }
+
+    public static void addToResult(List result, Object o) {
+        if (o == null) {
+            return;
+        }
+        if (Set.class.isAssignableFrom(o.getClass())) {
+            Set lst = (Set) o;
+            for (Object oo : lst) {
+                result.add(oo);
+            }
+        } else if (List.class.isAssignableFrom(o.getClass())) {
+            List lst = (List) o;
+            for (Object oo : lst) {
+                result.add(oo);
+            }
+        } else if (Map.class.isAssignableFrom(o.getClass())) {
+            Map map = (Map) o;
+            for (Object oo : map.values()) {
+                result.add(oo);
+            }
+        } else {
+            result.add(o);
+        }
+    }
+
+}
+
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLColumn.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLColumn.java
new file mode 100644 (file)
index 0000000..55ac600
--- /dev/null
@@ -0,0 +1,80 @@
+package org.opendaylight.controller.md.sal.dom.xsql;
+
+import java.io.Serializable;
+
+public class XSQLColumn implements Serializable, Comparable {
+    private String name = null;
+    private String tableName = null;
+    private int charWidth = -1;
+    private Class type = null;
+    private transient Object bluePrintNode = null;
+
+    public XSQLColumn(Object odlNode, String _tableName, Object _bluePrintNode) {
+        this.name = XSQLODLUtils.getNodeNameFromDSN(odlNode);
+        this.tableName = _tableName;
+        this.bluePrintNode = _bluePrintNode;
+        this.type = XSQLODLUtils.getTypeForODLColumn(odlNode);
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getTableName() {
+        return tableName;
+    }
+
+    public void setCharWidth(int i) {
+        if (this.charWidth < i) {
+            this.charWidth = i;
+        }
+    }
+
+    public int getCharWidth() {
+        return this.charWidth;
+    }
+
+    @Override
+    public int hashCode() {
+        return this.name.hashCode() + this.tableName.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof XSQLColumn)) {
+            return false;
+        }
+        XSQLColumn other = (XSQLColumn) obj;
+        return tableName.equals(other.tableName) && name.equals(other.name);
+    }
+
+    public Object getBluePrintNode() {
+        return this.bluePrintNode;
+    }
+
+    @Override
+    public String toString() {
+        return tableName + "." + name;
+    }
+
+    @Override
+    public int compareTo(Object o) {
+        return this.toString().compareTo(o.toString());
+    }
+
+    public Object getResultSetValue(Object obj){
+        if(this.type.equals(String.class)){
+            return obj.toString();
+        }else
+        if(this.type.equals(int.class)){
+            return Integer.parseInt(obj.toString());
+        }else
+        if(this.type.equals(long.class)){
+            return Long.parseLong(obj.toString());
+        }else
+        if(this.type.equals(byte.class)){
+            return Byte.parseByte(obj.toString());
+        }
+        return null;
+    }
+}
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLCriteria.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLCriteria.java
new file mode 100644 (file)
index 0000000..ed75254
--- /dev/null
@@ -0,0 +1,371 @@
+package org.opendaylight.controller.md.sal.dom.xsql;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class XSQLCriteria implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private static final String operators[] =
+        new String[] {" and ", " or ", ">=", "<=", "!=", "=", ">", "<", "like",
+            "is null", "not null", "skip"};
+    private static final String STRING_CHAR = "'";
+
+    public static final int OP_CODE_AND = 0;
+    public static final int OP_CODE_OR = 1;
+    public static final int OP_CODE_GTEQ = 2;
+    public static final int OP_CODE_LTEQ = 3;
+    public static final int OP_CODE_NOT_EQ = 4;
+    public static final int OP_CODE_EQUAL = 5;
+    public static final int OP_CODE_GT = 6;
+    public static final int OP_CODE_LT = 7;
+    public static final int OP_CODE_LIKE = 8;
+    public static final int OP_CODE_NULL = 9;
+    public static final int OP_CODE_NOT_NULL = 10;
+    public static final int OP_CODE_SKIP = 11;
+
+    private XSQLCriteria left = null;
+    private XSQLCriteria right = null;
+
+    private int operation = -1;
+
+    private Object leftValue = null;
+    private Object rightValue = null;
+    private String criteria = null;
+
+    private static final Map<Class<?>, Map<String, Method>> methodCache =
+        new ConcurrentHashMap<Class<?>, Map<String, Method>>();
+
+    public XSQLCriteria(final String data, final int parentOperation) {
+        criteria = data;
+        parse(data, parentOperation);
+    }
+
+    private void parse(String data, int parentOperation) {
+
+        data = data.trim();
+
+        int index1 = data.indexOf("(");
+        if (index1 != -1) {
+            String leftCondition = data.substring(0, index1).trim();
+            if (leftCondition.trim().equals("")) {
+                int index2 = data.lastIndexOf(")");
+                if (index2 < data.length() - 1) {
+                    String rtValue = data.substring(index2 + 1).trim();
+                    if (!rtValue.equals("")) {
+                        left =
+                            new XSQLCriteria(data.substring(index1 + 1, index2),
+                                parentOperation);
+                        data = data.substring(index2 + 1);
+                    } else {
+                        data = data.substring(1, index2);
+                    }
+                } else {
+                    data = data.substring(1, index2);
+                }
+            } else {
+                right = new XSQLCriteria(
+                    data.substring(index1 + 1, data.length() - 1),
+                    parentOperation);
+                data = data.substring(0, index1);
+            }
+        }
+
+        for (int i = 0; i < operators.length; i++) {
+            index1 = data.indexOf(operators[i]);
+            if (index1 != -1) {
+                this.operation = i;
+                if (left == null) {
+                    left = new XSQLCriteria(data.substring(0, index1),
+                        this.operation);
+                }
+                if (left.leftValue != null && left.rightValue == null
+                    && left.right == null) {
+                    leftValue = left.leftValue;
+                    left = null;
+                }
+                if (right == null) {
+                    right = new XSQLCriteria(
+                        data.substring(index1 + operators[i].length()),
+                        this.operation);
+                }
+                if (right.leftValue != null && right.rightValue == null
+                    && right.right == null) {
+                    rightValue = right.leftValue;
+                    right = null;
+                }
+                return;
+            }
+        }
+
+        if (data.startsWith("'") && data.endsWith("'")) {
+            data = data.substring(1, data.length() - 1);
+        }
+
+        if (parentOperation == OP_CODE_LIKE && data.startsWith("%") && data.endsWith("%")
+            && data.substring(1, data.length() - 1).indexOf("%") == -1) {
+            data = data.substring(1, data.length() - 1);
+        }
+
+        leftValue = data;
+    }
+
+    public static Object getValue(Object element, String propertyName) {
+        try {
+            Map<String, Method> cache = methodCache.get(element.getClass());
+            if (cache == null) {
+                cache = new ConcurrentHashMap<String, Method>();
+                methodCache.put(element.getClass(), cache);
+            }
+
+            Method m = cache.get(propertyName);
+            if (m == null) {
+                Method methods[] = element.getClass().getMethods();
+                for (Method mm : methods) {
+                    if (mm.getName().equals(propertyName) || mm.getName()
+                        .equals("get" + propertyName) || mm.getName()
+                        .equals("is" + propertyName)) {
+                        m = mm;
+                        m.setAccessible(true);
+                        cache.put(propertyName, m);
+                        break;
+                    }
+                }
+            }
+
+            Object value = null;
+            if (m == null) {
+                return null;
+            }
+            if (m.getParameterTypes() == null
+                || m.getParameterTypes().length == 0) {
+                value = m.invoke(element, null);
+            } else {
+                if (String.class.isAssignableFrom(m.getParameterTypes()[0])) {
+                    return null;
+                }
+                Object arg = m.getParameterTypes()[0].newInstance();
+                value = m.invoke(element, arg);
+            }
+            return value;
+        } catch (Exception err) {
+            err.printStackTrace();
+        }
+        return null;
+    }
+
+    public int isObjectFitCriteria(Object element, String propertyName) {
+        Object value = getValue(element, propertyName);
+        if (value != null) {
+            value = value.toString();
+        }
+        return checkValue(value);
+    }
+
+    public int checkValue(Object value) {
+        if (leftValue != null && rightValue != null) {
+            Object aSide = null;
+            Object bSide = null;
+            if (leftValue.equals("?")) {
+                aSide = value;
+            } else {
+                aSide = leftValue;
+            }
+
+            if (rightValue.equals("?")) {
+                bSide = value;
+            } else {
+                bSide = rightValue;
+            }
+            if (operation != OP_CODE_SKIP && operation != OP_CODE_NULL) {
+                if (aSide == null && bSide != null) {
+                    return 0;
+                } else if (aSide != null && bSide == null) {
+                    return 0;
+                } else if (aSide == null && bSide == null) {
+                    return 1;
+                }
+            }
+            switch (operation) {
+                case OP_CODE_EQUAL:
+                    if (aSide.equals(bSide)) {
+                        return 1;
+                    } else {
+                        return 0;
+                    }
+                case OP_CODE_NOT_EQ:
+                    if (!aSide.equals(bSide)) {
+                        return 1;
+                    } else {
+                        return 0;
+                    }
+                case OP_CODE_LIKE:
+                    if (aSide.toString().indexOf(bSide.toString()) != -1) {
+                        return 1;
+                    } else {
+                        return 0;
+                    }
+                case OP_CODE_NULL:
+                    if (aSide == null) {
+                        return 1;
+                    } else {
+                        return 0;
+                    }
+                case OP_CODE_NOT_NULL:
+                    if (aSide != null) {
+                        return 1;
+                    } else {
+                        return 0;
+                    }
+                case OP_CODE_GT:
+                    if (aSide == null || bSide == null) {
+                        return 0;
+                    }
+                    if (Double.parseDouble(aSide.toString().trim()) > Double
+                        .parseDouble(bSide.toString().trim())) {
+                        return 1;
+                    } else {
+                        return 0;
+                    }
+                case OP_CODE_GTEQ:
+                    if (aSide == null || bSide == null) {
+                        return 0;
+                    }
+                    if (Double.parseDouble(aSide.toString().trim()) >= Double
+                        .parseDouble(bSide.toString().trim())) {
+                        return 1;
+                    } else {
+                        return 0;
+                    }
+
+                case OP_CODE_LT:
+                    if (aSide == null || bSide == null) {
+                        return 0;
+                    }
+                    if (Double.parseDouble(aSide.toString().trim()) < Double
+                        .parseDouble(bSide.toString().trim())) {
+                        return 1;
+                    } else {
+                        return 0;
+                    }
+                case OP_CODE_LTEQ:
+                    if (aSide == null || bSide == null) {
+                        return 0;
+                    }
+                    if (Double.parseDouble(aSide.toString().trim()) <= Double
+                        .parseDouble(bSide.toString().trim())) {
+                        return 1;
+                    } else {
+                        return 0;
+                    }
+            }
+        }
+
+        int leftResult = 0;
+        if (left != null) {
+            leftResult = left.checkValue(value);
+        }
+
+        int rightResult = 0;
+        if (right != null) {
+            rightResult = right.checkValue(value);
+        }
+
+        if (operation == OP_CODE_SKIP) {
+            if (rightResult == 0) {
+                return 2;
+            } else {
+                return 3;
+            }
+        }
+
+        if (operation == OP_CODE_AND) {
+            if (leftResult == 0) {
+                return 0;
+            }
+            if (rightResult == 0) {
+                return 0;
+            }
+            if (leftResult >= 2) {
+                return leftResult;
+            }
+            if (rightResult >= 2) {
+                return rightResult;
+            }
+
+            return 1;
+        }
+
+        if (operation == OP_CODE_OR) {
+            if (leftResult == 0 && rightResult == 0) {
+                return 0;
+            }
+            if (leftResult >= 2) {
+                return leftResult;
+            }
+            if (rightResult >= 2) {
+                return rightResult;
+            }
+            return 1;
+        }
+
+        return 0;
+    }
+
+    public String toString() {
+        return criteria;
+    }
+
+    public String getCriteriaForProperty(XSQLColumn col) {
+        StringBuffer result = new StringBuffer();
+        if (criteria == null) {
+            return "";
+        }
+
+        if (leftValue != null && rightValue != null) {
+            if (leftValue.toString().toLowerCase().equals(col.getName().toLowerCase()) ||
+                leftValue.toString().toLowerCase().equals(col.toString().toLowerCase()) /*||
+                /*col.getName().toLowerCase().indexOf(leftValue.toString().toLowerCase()) != -1*/) {
+                result.append("? ").append(operators[operation]).append(" ").append(rightValue);
+            }else
+            if (rightValue.toString().toLowerCase().equals(col.getName().toLowerCase()) ||
+                    rightValue.toString().toLowerCase().equals(col.toString().toLowerCase()) /*||
+                    col.getName().toLowerCase().indexOf(rightValue.toString().toLowerCase()) != -1*/) {
+                    result.append("? ").append(operators[operation]).append(" ").append(leftValue);
+            }
+            return result.toString();
+        } else if (left != null && right != null) {
+            String leftString = left.getCriteriaForProperty(col);
+            String rightString = right.getCriteriaForProperty(col);
+            if (!leftString.equals("") && !rightString.equals("")) {
+                return leftString + " " + operators[operation] + " "
+                    + rightString;
+            } else if (!leftString.equals("")) {
+                return leftString;
+            } else if (!rightString.equals("")) {
+                return rightString;
+            }
+            return "";
+        } else if (leftValue != null && leftValue.toString().toLowerCase()
+            .equals(col.toString().toLowerCase()) && right != null) {
+            return "? " + operators[operation] + " (" + right
+                .getCriteriaForProperty(col) + ")";
+        } else if (rightValue != null && rightValue.toString().toLowerCase()
+            .equals(col.toString().toLowerCase()) && left != null) {
+            return "(" + left.getCriteriaForProperty(col) + ") "
+                + operators[operation] + " ?";
+        }
+        return "";
+    }
+
+    public static void main(String args[]) {
+        XSQLCriteria p =
+            new XSQLCriteria("ip like '%101%' or (354>=0 or 456>=3)", -1);
+        System.out.println(p.checkValue("192.268.4.4"));
+        p = new XSQLCriteria("? like '%267%'", -1);
+        System.out.println(p.checkValue("192.268.4.4"));
+
+    }
+}
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLODLUtils.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLODLUtils.java
new file mode 100644 (file)
index 0000000..6a27230
--- /dev/null
@@ -0,0 +1,246 @@
+package org.opendaylight.controller.md.sal.dom.xsql;
+
+import java.lang.reflect.Field;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.Status;
+import org.opendaylight.yangtools.yang.model.util.Uint16;
+import org.opendaylight.yangtools.yang.model.util.Uint32;
+import org.opendaylight.yangtools.yang.model.util.Uint64;
+import org.opendaylight.yangtools.yang.model.util.Uint8;
+
+public class XSQLODLUtils {
+
+    private static Map<Class<?>, Class<?>> types =
+        new ConcurrentHashMap<Class<?>, Class<?>>();
+
+    static {
+        types.put(QName.class, QName.class);
+        types.put(SchemaPath.class, SchemaPath.class);
+        types.put(Status.class, Status.class);
+    }
+
+    public static boolean isColumnType(Class cls) {
+        return types.containsKey(cls);
+    }
+
+    public static String getTableName(Object odlNode) {
+        if (odlNode instanceof Module) {
+            return ((Module) odlNode).getNamespace().toString();
+        } else if (odlNode instanceof DataSchemaNode) {
+            SchemaPath p = ((DataSchemaNode) odlNode).getPath();
+            return extractTableName(p);
+        } else {
+            int i = 0;
+        }
+        return null;
+    }
+
+    public static String extractTableName(SchemaPath path) {
+        List<QName> lst = path.getPath();
+        StringBuffer name = new StringBuffer();
+        int i = 0;
+        for (QName q : lst) {
+            name.append(q.getLocalName());
+            i++;
+            if (i < lst.size()) {
+                name.append("/");
+            }
+        }
+        return name.toString();
+    }
+
+    public static String getBluePrintName(Object odlNode){
+        if (odlNode instanceof Module) {
+            return ((Module) odlNode).getNamespace().toString();
+        } else if (odlNode instanceof DataSchemaNode) {
+            SchemaPath p = ((DataSchemaNode) odlNode).getPath();
+            return extractTableName(p);
+        }
+        return null;
+    }
+
+    public static String getODLNodeName(Object odlNode) {
+        if (odlNode instanceof Module) {
+            return ((Module) odlNode).getNamespace().toString();
+        } else if (odlNode instanceof DataSchemaNode) {
+            SchemaPath p = ((DataSchemaNode) odlNode).getPath();
+            List<QName> lst = p.getPath();
+            return lst.get(lst.size() - 1).toString();
+        }
+        return null;
+    }
+
+    public static List<QName> getPath(Object odlNode) {
+        return ((DataSchemaNode) odlNode).getPath().getPath();
+    }
+
+
+    public static String getODLTableName(Object odlNode) {
+        if (odlNode instanceof Module) {
+            return ((Module) odlNode).getNamespace().toString();
+        } else if (odlNode instanceof DataSchemaNode) {
+            return ((DataSchemaNode) odlNode).getPath().toString();
+        }
+        return null;
+    }
+
+    public static String getNodeNameFromDSN(Object o) {
+        DataSchemaNode node = (DataSchemaNode) o;
+        String nodeName = node.getQName().toString();
+        int index = nodeName.lastIndexOf(")");
+        return nodeName.substring(index + 1);
+    }
+
+    public static boolean isModule(Object o) {
+        if (o instanceof Module) {
+            return true;
+        }
+        return false;
+    }
+
+    public static boolean createOpenDaylightCache(XSQLBluePrint bluePrint,Object module) {
+        XSQLBluePrintNode node = new XSQLBluePrintNode(module, 0,null);
+        bluePrint.addToBluePrintCache(node);
+        collectODL(bluePrint, node, ((Module) module).getChildNodes(), 1);
+        return true;
+    }
+
+    private static void collectODL(XSQLBluePrint bluePrint,
+        XSQLBluePrintNode parent, Collection<DataSchemaNode> nodes, int level) {
+        if (nodes == null) {
+            return;
+        }
+        for (DataSchemaNode n : nodes) {
+            if (n instanceof DataNodeContainer /*|| n instanceof LeafListSchemaNode*/
+                || n instanceof ListSchemaNode) {
+                XSQLBluePrintNode bn = new XSQLBluePrintNode(n, level,parent);
+                bluePrint.addToBluePrintCache(bn);
+                parent.AddChild(bn);
+                if (n instanceof DataNodeContainer) {
+                    level++;
+                    collectODL(bluePrint, bn,
+                        ((DataNodeContainer) n).getChildNodes(), level);
+                    level--;
+                } else if (n instanceof ListSchemaNode) {
+                    level++;
+                    collectODL(bluePrint, bn,
+                        ((ListSchemaNode) n).getChildNodes(), level);
+                    level--;
+                }
+            } else {
+                if (parent != null) {
+                    parent.addColumn(n, parent.getParent().getBluePrintNodeName());
+                } else {
+                    XSQLAdapter.log("NO Parent!");
+                }
+            }
+        }
+    }
+
+    public static Map<String, Field> refFieldsCache =
+        new HashMap<String, Field>();
+
+    public static Field findField(Class<?> c, String name) {
+        if (c == null) {
+            return null;
+        }
+        String cacheKey = c.getName() + name;
+        Field f = refFieldsCache.get(cacheKey);
+        if (f != null) {
+            return f;
+        }
+
+        try {
+            f = c.getDeclaredField(name);
+            f.setAccessible(true);
+            refFieldsCache.put(cacheKey, f);
+            return f;
+        } catch (Exception err) {
+        }
+
+        Class<?> s = c.getSuperclass();
+        if (s != null) {
+            f = findField(s, name);
+            if (f != null) {
+                refFieldsCache.put(cacheKey, f);
+            }
+            return f;
+        }
+        return null;
+    }
+
+
+    public static Object get(Object o, String name) {
+        try {
+            Class<?> c = o.getClass();
+            Field f = findField(c, name);
+            return f.get(o);
+        } catch (Exception err) {
+            XSQLAdapter.log(err);
+        }
+        return null;
+    }
+
+    public static List<Object> getMChildren(Object o) {
+        Map<?, ?> children = getChildren(o);
+        List<Object> result = new LinkedList<Object>();
+        for (Object val : children.values()) {
+            result.add((Object) val);
+        }
+        return result;
+    }
+
+    public static Map<?, ?> getChildren(Object o) {
+        return (Map<?, ?>) get(o, "children");
+    }
+
+    public static Object getValue(Object o) {
+        return get(o, "value");
+    }
+
+    public static String getNodeIdentiofier(Object o) {
+        try{
+            return ((PathArgument) get(o, "nodeIdentifier")).getNodeType().toString();
+        }catch(Exception err){
+            return null;
+        }
+    }
+
+    public static String getNodeName(Object o) {
+        Object nodeID = get(o, "nodeIdentifier");
+        if (nodeID != null) {
+            String nodeName = nodeID.toString();
+            int index = nodeName.lastIndexOf(")");
+            return nodeName.substring(index + 1);
+        }
+        return "NULL";
+    }
+
+    public static Class getTypeForODLColumn(Object odlNode){
+        Object type = get(odlNode,"type");
+        if(type instanceof Uint32 || type instanceof Uint64){
+            return long.class;
+        }else
+        if(type instanceof Uint16){
+            return int.class;
+        }else
+        if(type instanceof Uint8){
+            return byte.class;
+        }
+        return String.class;
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLThreadPool.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLThreadPool.java
new file mode 100644 (file)
index 0000000..c1db627
--- /dev/null
@@ -0,0 +1,110 @@
+package org.opendaylight.controller.md.sal.dom.xsql;
+
+import java.util.LinkedList;
+
+public class XSQLThreadPool {
+    private LinkedList<Runnable> tasks = new LinkedList<Runnable>();
+    private int threadCount = 0;
+    private int maxThreadCount = 10;
+    private String threadPoolName = "Simple Thread Pool";
+    private int waitTimeForIdle = 10000;
+    private int maxQueueSize = -1;
+    public Object waitForSlotSync = new Object();
+
+    public XSQLThreadPool(int _maxThreadCount, String name,
+        int _waitTimeForIdle) {
+        this.maxThreadCount = _maxThreadCount;
+        this.threadPoolName = name;
+        this.waitTimeForIdle = _waitTimeForIdle;
+    }
+
+    public void addTask(Runnable r) {
+        synchronized (tasks) {
+            tasks.add(r);
+            tasks.notifyAll();
+            if (threadCount < maxThreadCount) {
+                threadCount++;
+                new WorkerThread(threadCount).start();
+            }
+        }
+    }
+
+    private class WorkerThread extends Thread {
+
+        private long lastTimeExecuted = System.currentTimeMillis();
+
+        public WorkerThread(int threadNumber) {
+            super(
+                "Thread #" + threadNumber + " Of Threadpool " + threadPoolName);
+        }
+
+        public void run() {
+            Runnable runthis = null;
+            while (true) {
+                runthis = null;
+                if (maxQueueSize != -1) {
+                    synchronized (waitForSlotSync) {
+                        if (tasks.size() < maxQueueSize) {
+                            waitForSlotSync.notifyAll();
+                        }
+                    }
+                }
+                synchronized (tasks) {
+                    if (tasks.isEmpty()) {
+                        try {
+                            tasks.wait(2000);
+                        } catch (Exception err) {
+                        }
+                    }
+
+                    if (!tasks.isEmpty()) {
+                        runthis = tasks.removeFirst();
+                    }
+                }
+                if (runthis != null) {
+                    try {
+                        runthis.run();
+                    } catch (Exception err) {
+                        err.printStackTrace();
+                    }
+                    lastTimeExecuted = System.currentTimeMillis();
+                }
+                if (System.currentTimeMillis() - lastTimeExecuted
+                    > waitTimeForIdle) {
+                    break;
+                }
+            }
+            synchronized (tasks) {
+                threadCount--;
+            }
+        }
+    }
+
+    public int getNumberOfThreads() {
+        return threadCount;
+    }
+
+    public void waitForSlot() {
+        if (tasks.size() > maxQueueSize) {
+            synchronized (waitForSlotSync) {
+                try {
+                    waitForSlotSync.wait();
+                } catch (Exception err) {
+                    err.printStackTrace();
+                }
+            }
+        }
+    }
+
+    public boolean isEmpty() {
+        if (this.threadCount == 0) {
+            return true;
+        }
+        return false;
+    }
+
+    public void setMaxQueueSize(int size) {
+        this.maxQueueSize = size;
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCCommand.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCCommand.java
new file mode 100644 (file)
index 0000000..85ce0e5
--- /dev/null
@@ -0,0 +1,62 @@
+package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
+
+import java.io.Serializable;
+import java.util.Map;
+
+public class JDBCCommand implements Serializable {
+    public int type = 0;
+    public static final int TYPE_EXECUTE_QUERY = 1;
+    public static final int TYPE_QUERY_REPLY = 2;
+    public static final int TYPE_QUERY_RECORD = 3;
+    public static final int TYPE_QUERY_FINISH = 4;
+    public static final int TYPE_QUERY_ERROR = 5;
+
+    private JDBCResultSet rs = null;
+    private Map record = null;
+    private int rsID = -1;
+    private Exception err = null;
+
+    public JDBCCommand(Exception _err, int _RSID) {
+        this.type = TYPE_QUERY_ERROR;
+        this.err = _err;
+        this.rsID = _RSID;
+    }
+
+    public JDBCCommand(JDBCResultSet _rs, int _type) {
+        this.type = TYPE_EXECUTE_QUERY;
+        this.rs = _rs;
+        this.type = _type;
+        this.rsID = rs.getID();
+    }
+
+    public JDBCCommand(Map _record, int _rsID) {
+        this.record = _record;
+        this.rsID = _rsID;
+        this.type = TYPE_QUERY_RECORD;
+    }
+
+    public JDBCCommand(int _rsID) {
+        this.rsID = _rsID;
+        this.type = TYPE_QUERY_FINISH;
+    }
+
+    public int getType() {
+        return this.type;
+    }
+
+    public JDBCResultSet getRS() {
+        return this.rs;
+    }
+
+    public Map getRecord() {
+        return this.record;
+    }
+
+    public int getRSID() {
+        return this.rsID;
+    }
+
+    public Exception getERROR() {
+        return this.err;
+    }
+}
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCConnection.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCConnection.java
new file mode 100644 (file)
index 0000000..3e72dc9
--- /dev/null
@@ -0,0 +1,583 @@
+package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.CallableStatement;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.NClob;
+import java.sql.PreparedStatement;
+import java.sql.SQLClientInfoException;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Savepoint;
+import java.sql.Statement;
+import java.sql.Struct;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.Executor;
+
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter;
+
+public class JDBCConnection extends Thread implements Connection {
+    private Socket socket = null;
+    private DataInputStream in = null;
+    private DataOutputStream out = null;
+    private LinkedList<byte[]> queue = new LinkedList<byte[]>();
+    private XSQLAdapter adapter = null;
+
+    public JDBCConnection(Socket s, XSQLAdapter _a) {
+        this.socket = s;
+        this.adapter = _a;
+        try {
+            in = new DataInputStream(
+                new BufferedInputStream(s.getInputStream()));
+            out = new DataOutputStream(
+                new BufferedOutputStream(s.getOutputStream()));
+            new JDBCObjectReader();
+            this.start();
+        } catch (Exception err) {
+            err.printStackTrace();
+        }
+    }
+
+    public JDBCConnection(String addr) throws Exception {
+        socket = new Socket(addr, 40004);
+        try {
+            in = new DataInputStream(
+                new BufferedInputStream(socket.getInputStream()));
+            out = new DataOutputStream(
+                new BufferedOutputStream(socket.getOutputStream()));
+            new JDBCObjectReader();
+            this.start();
+        } catch (Exception err) {
+            err.printStackTrace();
+        }
+    }
+
+    public JDBCConnection(boolean server) {
+        try {
+            ServerSocket s = new ServerSocket(50003);
+            socket = s.accept();
+            try {
+                in = new DataInputStream(
+                    new BufferedInputStream(socket.getInputStream()));
+                out = new DataOutputStream(
+                    new BufferedOutputStream(socket.getOutputStream()));
+                new JDBCObjectReader();
+                this.start();
+            } catch (Exception err) {
+                err.printStackTrace();
+            }
+        } catch (Exception err) {
+            err.printStackTrace();
+        }
+    }
+
+
+    private boolean isStopped() {
+        if (adapter != null && adapter.stopped) {
+            return true;
+        }
+        if (socket == null || socket.isClosed()) {
+            return true;
+        }
+        return false;
+    }
+
+    public void run() {
+        byte data[] = null;
+        while (!isStopped()) {
+            try {
+                int len = in.readInt();
+                data = new byte[len];
+                in.readFully(data);
+                addObject(data);
+
+            } catch (Exception err) {
+                System.out.println("Connection Lost or Closed.");
+                try {
+                    socket.close();
+                } catch (Exception err2) {
+                }
+                //err.printStackTrace();
+            }
+        }
+    }
+
+    private void addObject(byte[] data) {
+        synchronized (queue) {
+            queue.add(data);
+            queue.notifyAll();
+        }
+    }
+
+    private class JDBCObjectReader extends Thread {
+
+        public JDBCObjectReader() {
+            super("JDBCObjectReader");
+            start();
+        }
+
+        public void run() {
+            while (!isStopped()) {
+                byte data[] = null;
+                synchronized (queue) {
+                    if (queue.size() == 0) {
+                        try {
+                            queue.wait(1000);
+                        } catch (Exception err) {
+                        }
+                    }
+                    if (queue.size() > 0) {
+                        data = queue.removeFirst();
+                    }
+                }
+                if (data != null) {
+                    JDBCCommand command = (JDBCCommand) deSerialize(data);
+                    processCommand(command);
+                }
+            }
+        }
+
+        private Object deSerialize(byte data[]) {
+            try {
+                ByteArrayInputStream in = new ByteArrayInputStream(data);
+                ObjectInputStream oin = new ObjectInputStream(in);
+                return oin.readObject();
+            } catch (Exception err) {
+                err.printStackTrace();
+            }
+            return null;
+        }
+    }
+
+    public void processCommand(JDBCCommand cmd) {
+        switch (cmd.getType()) {
+            case JDBCCommand.TYPE_EXECUTE_QUERY:
+                try {
+                    JDBCServer.execute(cmd.getRS(), adapter);
+                    send(new JDBCCommand(cmd.getRS(),
+                        JDBCCommand.TYPE_QUERY_REPLY));
+                    QueryUpdater u = new QueryUpdater(cmd.getRS());
+                    new Thread(u).start();
+                } catch (Exception err) {
+                    send(new JDBCCommand(err, cmd.getRSID()));
+                }
+                break;
+            case JDBCCommand.TYPE_QUERY_REPLY:
+                JDBCResultSet rs1 = JDBCStatement.getQuery(cmd.getRS().getID());
+                rs1.updateData(cmd.getRS());
+                break;
+            case JDBCCommand.TYPE_QUERY_RECORD:
+                JDBCResultSet rs2 = JDBCStatement.getQuery(cmd.getRSID());
+                rs2.addRecord(cmd.getRecord());
+                break;
+            case JDBCCommand.TYPE_QUERY_FINISH:
+                JDBCResultSet rs3 = JDBCStatement.removeQuery(cmd.getRSID());
+                rs3.setFinished(true);
+                break;
+            case JDBCCommand.TYPE_QUERY_ERROR:
+                System.err.println("ERROR Executing Query\n");
+                cmd.getERROR().printStackTrace();
+                JDBCResultSet rs4 = JDBCStatement.removeQuery(cmd.getRSID());
+                rs4.setError(cmd.getERROR());
+                rs4.setFinished(true);
+                synchronized (rs4) {
+                    rs4.notifyAll();
+                }
+        }
+    }
+
+    private class QueryUpdater implements Runnable {
+
+        private JDBCResultSet rs = null;
+
+        public QueryUpdater(JDBCResultSet _rs) {
+            this.rs = _rs;
+        }
+
+        public void run() {
+            while (rs.next()) {
+                JDBCCommand rec = new JDBCCommand(rs.getCurrent(), rs.getID());
+                send(rec);
+            }
+            JDBCCommand end = new JDBCCommand(rs.getID());
+            send(end);
+        }
+    }
+
+    public void send(Object o) {
+        try {
+            ByteArrayOutputStream bout = new ByteArrayOutputStream();
+            ObjectOutputStream oout = new ObjectOutputStream(bout);
+            oout.writeObject(o);
+            byte data[] = bout.toByteArray();
+            synchronized (socket) {
+                out.writeInt(data.length);
+                out.write(data);
+                out.flush();
+            }
+        } catch (Exception err) {
+            err.printStackTrace();
+        }
+    }
+
+    @Override
+    public boolean isWrapperFor(Class<?> arg0) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public <T> T unwrap(Class<T> arg0) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void clearWarnings() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void close() throws SQLException {
+        try {
+            socket.close();
+        } catch (Exception err) {
+        }
+        socket = null;
+    }
+
+    @Override
+    public void commit() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public Array createArrayOf(String typeName, Object[] elements)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Blob createBlob() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Clob createClob() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public NClob createNClob() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public SQLXML createSQLXML() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Statement createStatement() throws SQLException {
+        return new JDBCStatement(this);
+    }
+
+    @Override
+    public Statement createStatement(int resultSetType,
+        int resultSetConcurrency, int resultSetHoldability)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Statement createStatement(int resultSetType,
+        int resultSetConcurrency)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Struct createStruct(String typeName, Object[] attributes)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public boolean getAutoCommit() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public String getCatalog() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Properties getClientInfo() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getClientInfo(String name) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public int getHoldability() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public DatabaseMetaData getMetaData() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public int getTransactionIsolation() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public Map<String, Class<?>> getTypeMap() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public SQLWarning getWarnings() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public boolean isClosed() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isReadOnly() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isValid(int timeout) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public String nativeSQL(String sql) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public CallableStatement prepareCall(String sql, int resultSetType,
+        int resultSetConcurrency, int resultSetHoldability)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public CallableStatement prepareCall(String sql, int resultSetType,
+        int resultSetConcurrency) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public CallableStatement prepareCall(String sql) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, int resultSetType,
+        int resultSetConcurrency, int resultSetHoldability)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, int resultSetType,
+        int resultSetConcurrency) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, String[] columnNames)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void releaseSavepoint(Savepoint savepoint) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void rollback() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void rollback(Savepoint savepoint) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void setAutoCommit(boolean autoCommit) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void setCatalog(String catalog) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void setClientInfo(Properties properties)
+        throws SQLClientInfoException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void setClientInfo(String name, String value)
+        throws SQLClientInfoException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void setHoldability(int holdability) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void setReadOnly(boolean readOnly) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public Savepoint setSavepoint() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Savepoint setSavepoint(String name) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void setTransactionIsolation(int level) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void setSchema(String schema) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public String getSchema() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void abort(Executor executor) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void setNetworkTimeout(Executor executor, int milliseconds)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public int getNetworkTimeout() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+}
+
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCDriver.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCDriver.java
new file mode 100644 (file)
index 0000000..e4b4e24
--- /dev/null
@@ -0,0 +1,73 @@
+package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
+
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.DriverPropertyInfo;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+public class JDBCDriver implements Driver {
+
+    public static JDBCDriver drv = new JDBCDriver();
+
+    public JDBCDriver() {
+        try {
+            DriverManager.registerDriver(this);
+        } catch (SQLException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public boolean acceptsURL(String arg0) throws SQLException {
+        return true;
+    }
+
+    @Override
+    public Connection connect(String url, Properties arg1) throws SQLException {
+        System.err.println("JDBC Connection");
+        try {
+            if (url.equals("svr")) {
+                return new JDBCConnection(true);
+            } else {
+                return new JDBCConnection(url);
+            }
+        } catch (Exception err) {
+            err.printStackTrace();
+        }
+        return null;
+    }
+
+    @Override
+    public int getMajorVersion() {
+        return 1;
+    }
+
+    @Override
+    public int getMinorVersion() {
+        return 0;
+    }
+
+    @Override
+    public DriverPropertyInfo[] getPropertyInfo(String arg0, Properties arg1)
+        throws SQLException {
+        DriverPropertyInfo i = new DriverPropertyInfo("NQL", "NQL");
+        return new DriverPropertyInfo[] {i};
+    }
+
+    @Override
+    public boolean jdbcCompliant() {
+        return false;
+    }
+
+    @Override
+    public Logger getParentLogger() throws SQLFeatureNotSupportedException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCResultSet.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCResultSet.java
new file mode 100644 (file)
index 0000000..7603a3e
--- /dev/null
@@ -0,0 +1,1780 @@
+package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.NClob;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.RowId;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Statement;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint;
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrintNode;
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLColumn;
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLCriteria;
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLODLUtils;
+
+public class JDBCResultSet
+    implements Serializable, ResultSet, ResultSetMetaData {
+    private static final long serialVersionUID = -7450200738431047057L;
+
+    private String sql = null;
+    private List<XSQLBluePrintNode> tablesInQuery =
+        new ArrayList<XSQLBluePrintNode>();
+    private Map<String, XSQLBluePrintNode> tablesInQueryMap =
+        new ConcurrentHashMap<String, XSQLBluePrintNode>();
+    private List<XSQLColumn> fieldsInQuery = new ArrayList<XSQLColumn>();
+    private transient LinkedList<Map> records = new LinkedList<Map>();
+    private transient Map currentRecord = null;
+    private boolean finished = false;
+    private int id = 0;
+    private static Integer nextID = new Integer(0);
+    public int numberOfTasks = 0;
+    private Map<String, Map<XSQLColumn, List<XSQLCriteria>>> criteria =
+        new ConcurrentHashMap<String, Map<XSQLColumn, List<XSQLCriteria>>>();
+    private Exception err = null;
+    private List<Record> EMPTY_RESULT = new LinkedList<Record>();
+
+    public JDBCResultSet(String _sql) {
+        synchronized (JDBCResultSet.class) {
+            nextID++;
+            id = nextID;
+        }
+        this.sql = _sql;
+    }
+
+    public String getSQL() {
+        return this.sql;
+    }
+
+    public void setError(Exception _err) {
+        this.err = _err;
+    }
+
+    public Exception getError() {
+        return this.err;
+    }
+
+    public void updateData(JDBCResultSet rs) {
+        synchronized (this) {
+            this.tablesInQuery = rs.tablesInQuery;
+            this.tablesInQueryMap = rs.tablesInQueryMap;
+            this.fieldsInQuery = rs.fieldsInQuery;
+            this.notifyAll();
+        }
+    }
+
+    public int isObjectFitCriteria(Map objValues, String tableName) {
+        Map<XSQLColumn, List<XSQLCriteria>> tblCriteria = criteria.get(tableName);
+        if (tblCriteria == null) {
+            return 1;
+        }
+        for (Map.Entry<XSQLColumn, List<XSQLCriteria>> cc : tblCriteria
+            .entrySet()) {
+            for (XSQLCriteria c : cc.getValue()) {
+                Object value = objValues.get(cc.getKey().toString());
+                int result = c.checkValue(value);
+                if (result == 0) {
+                    return 0;
+                }
+            }
+        }
+        return 1;
+    }
+
+    public int isObjectFitCriteria(Object element, Class cls) {
+        Map<XSQLColumn, List<XSQLCriteria>> tblCriteria =
+            criteria.get(cls.getName());
+        if (tblCriteria == null) {
+            return 1;
+        }
+        for (Map.Entry<XSQLColumn, List<XSQLCriteria>> cc : tblCriteria
+            .entrySet()) {
+            for (XSQLCriteria c : cc.getValue()) {
+                int result =
+                    c.isObjectFitCriteria(element, cc.getKey().getName());
+                if (result == 0) {
+                    return 0;
+                }
+            }
+        }
+        return 1;
+    }
+
+    public Map<String, Map<XSQLColumn, List<XSQLCriteria>>> getCriteria() {
+        return this.criteria;
+    }
+
+    public int getID() {
+        return this.id;
+    }
+
+    public List<XSQLBluePrintNode> getTables() {
+        return tablesInQuery;
+    }
+
+    public void addTableToQuery(XSQLBluePrintNode node) {
+        if (this.tablesInQueryMap.containsKey(node.getBluePrintNodeName())) {
+            return;
+        }
+        this.tablesInQuery.add(node);
+        this.tablesInQueryMap.put(node.getBluePrintNodeName(), node);
+    }
+
+    public List<XSQLColumn> getFields() {
+        return this.fieldsInQuery;
+    }
+
+    public XSQLBluePrintNode getMainTable() {
+        if (tablesInQuery.size() == 1) {
+            return tablesInQuery.get(0);
+        }
+        XSQLBluePrintNode result = null;
+        for (XSQLBluePrintNode node : tablesInQuery) {
+            if (result == null) {
+                result = node;
+            } else if (result.getLevel() < node.getLevel()) {
+                result = node;
+            }
+        }
+        return result;
+    }
+
+    public boolean isFinished() {
+        return finished;
+    }
+
+    public void setFinished(boolean b) {
+        this.finished = b;
+    }
+
+    public int size() {
+        return this.records.size();
+    }
+
+    public void addRecord(Map r) {
+        synchronized (this) {
+            if (records == null) {
+                records = new LinkedList<Map>();
+            }
+            records.add(r);
+            this.notifyAll();
+        }
+    }
+
+
+    public void addRecord(ArrayList hierarchy) {
+        Map rec = new HashMap();
+        for (int i = hierarchy.size() - 1; i >= 0; i--) {
+            Object element = hierarchy.get(i);
+            for (XSQLColumn c : fieldsInQuery) {
+                if (c.getTableName()
+                    .equals(element.getClass().getSimpleName())) {
+                    try {
+                        Method m = element.getClass().getMethod(c.getName(), null);
+                        Object value = m.invoke(element, null);
+                        rec.put(c.getName(), value);
+                    } catch (Exception err) {
+                        err.printStackTrace();
+                    }
+                }
+            }
+        }
+        this.records.add(rec);
+    }
+
+    public boolean next() {
+        this.currentRecord = null;
+        if (records == null) {
+            records = new LinkedList<Map>();
+        }
+        while (!finished || records.size() > 0) {
+            synchronized (this) {
+                if (records.size() == 0) {
+                    try {
+                        this.wait(1000);
+                    } catch (Exception err) {
+                    }
+                    if (records.size() > 0) {
+                        try {
+                            currentRecord = records.removeFirst();
+                            return true;
+                        } finally {
+                            this.notifyAll();
+                        }
+                    }
+                } else {
+                    try {
+                        currentRecord = records.removeFirst();
+                        return true;
+                    } finally {
+                        this.notifyAll();
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    public Map getCurrent() {
+        return this.currentRecord;
+    }
+
+    private void createRecord(Object data, XSQLBluePrintNode node) {
+        Map rec = new HashMap();
+        for (XSQLColumn c : this.fieldsInQuery) {
+            if (c.getTableName().equals(node.getBluePrintNodeName())) {
+                try {
+                    Method m = node.getInterface().getMethod(c.getName(), null);
+                    Object value = m.invoke(data, null);
+                    if (value != null) {
+                        rec.put(c.getName(), value);
+                    } else {
+                        rec.put(c.getName(), "");
+                    }
+                } catch (Exception err) {
+                    err.printStackTrace();
+                }
+
+            }
+        }
+    }
+
+    public static class Record {
+        public Map data = new HashMap();
+        public Object element = null;
+
+        public Map getRecord() {
+            return this.data;
+        }
+    }
+
+    private Map collectColumnValues(Object node, XSQLBluePrintNode bpn) {
+        Map subChildren = XSQLODLUtils.getChildren(node);
+        Map result = new HashMap();
+        for (Object stc : subChildren.values()) {
+            if (stc.getClass().getName()
+                .endsWith("ImmutableAugmentationNode")) {
+                Map values = XSQLODLUtils.getChildren(stc);
+                for (Object key : values.keySet()) {
+                    Object val = values.get(key);
+                    if (val.getClass().getName()
+                        .endsWith("ImmutableLeafNode")) {
+                        Object value = XSQLODLUtils.getValue(val);
+                        String k = XSQLODLUtils.getNodeName(val);
+                        if (value != null) {
+                            result.put(bpn.getBluePrintNodeName() + "." + k,
+                                value.toString());
+                        }
+                    }
+                }
+            } else if (stc.getClass().getName().endsWith("ImmutableLeafNode")) {
+                String k = XSQLODLUtils.getNodeName(stc);
+                Object value = XSQLODLUtils.getValue(stc);
+                if (value != null) {
+                    result.put(bpn.getBluePrintNodeName() + "." + k, value.toString());
+                }
+            }
+        }
+        return result;
+    }
+
+    private void addToData(Record rec, XSQLBluePrintNode bpn, XSQLBluePrint bluePrint, Map fullRecord) {
+        XSQLBluePrintNode eNodes[] = bluePrint.getBluePrintNodeByODLTableName(XSQLODLUtils.getNodeIdentiofier(rec.element));
+        if (bpn != null) {
+            for (XSQLColumn c : fieldsInQuery) {
+                for(XSQLBluePrintNode eNode:eNodes){
+                    if (((XSQLBluePrintNode) c.getBluePrintNode()).getBluePrintNodeName().equals(eNode.getBluePrintNodeName())) {
+                        //Object value = Criteria.getValue(rec.element, c.getName());
+                        String columnName = c.toString();
+                        Object value = fullRecord.get(columnName);
+                        if (value != null) {
+                            try {
+                                Object rsValue = c.getResultSetValue(value);
+                                c.setCharWidth(rsValue.toString().length());
+                                rec.data.put(columnName, rsValue);
+                            } catch (Exception err) {
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    private boolean beenHere(Set<String> beenHereElement, Object element) {
+        if (beenHereElement == null) {
+            beenHereElement = new HashSet<String>();
+        }
+
+        String elementKey = null;
+
+        try {
+            elementKey = element.toString();
+        } catch (Exception err) {
+            elementKey = "Unknown";
+        }
+
+        if (beenHereElement.contains(elementKey)) {
+            return true;
+        }
+
+        beenHereElement.add(elementKey);
+        return false;
+    }
+
+    public List<Object> getChildren(Object node, String tableName,XSQLBluePrint bluePrint) {
+
+        List<Object> children = XSQLODLUtils.getMChildren(node);
+        List<Object> result = new LinkedList<Object>();
+
+        for (Object child : children) {
+
+            String odlNodeName = XSQLODLUtils.getNodeIdentiofier(child);
+            if(odlNodeName==null) continue;
+
+            XSQLBluePrintNode eNodes[] = bluePrint.getBluePrintNodeByODLTableName(odlNodeName);
+            if(eNodes==null) continue;
+
+            boolean match = false;
+            for(XSQLBluePrintNode enode:eNodes){
+                if(tableName.startsWith(enode.toString())){
+                    match = true;
+                    break;
+                }
+            }
+
+            if(!match) continue;
+
+            if (child.getClass().getName().endsWith("ImmutableContainerNode")) {
+                result.add(child);
+            }else
+            if (child.getClass().getName().endsWith("ImmutableAugmentationNode")) {
+                List<Object> _children = XSQLODLUtils.getMChildren(child);
+                for (Object c : _children) {
+                    if (c.getClass().getName().endsWith("ImmutableContainerNode")) {
+                        result.add(c);
+                    }
+                }
+            } else if (child.getClass().getName().endsWith("ImmutableMapNode")) {
+                result.addAll(XSQLODLUtils.getMChildren(child));
+            }
+        }
+        return result;
+    }
+
+    public List<Record> addRecords(Object element, XSQLBluePrintNode node,boolean root, String tableName,XSQLBluePrint bluePrint) {
+
+        List<Record> result = new LinkedList<Record>();
+        String nodeID = XSQLODLUtils.getNodeIdentiofier(element);
+        if (node.getODLTableName().equals(nodeID)) {
+            XSQLBluePrintNode bluePrintNode = bluePrint.getBluePrintNodeByODLTableName(nodeID)[0];
+            Record rec = new Record();
+            rec.element = element;
+            XSQLBluePrintNode bpn = this.tablesInQueryMap.get(bluePrintNode.getBluePrintNodeName());
+            if (this.criteria.containsKey(bluePrintNode.getBluePrintNodeName()) || bpn != null) {
+                Map<?, ?> allKeyValues = collectColumnValues(element, bpn);
+                if (!(isObjectFitCriteria(allKeyValues, bpn.getBluePrintNodeName()) == 1)) {
+                    return EMPTY_RESULT;
+                }
+                addToData(rec, bpn, bluePrint,allKeyValues);
+            }
+            if (root) {
+                addRecord(rec.data);
+            } else {
+                result.add(rec);
+            }
+            return result;
+        }
+
+        XSQLBluePrintNode parent = node.getParent();
+        List<Record> subRecords = addRecords(element, parent, false, tableName,bluePrint);
+        for (Record subRec : subRecords) {
+            List<Object> subO = getChildren(subRec.element, tableName,bluePrint);
+            if (subO != null) {
+                for (Object subData : subO) {
+                    Record rec = new Record();
+                    rec.element = subData;
+                    rec.data.putAll(subRec.data);
+
+                    String recID = XSQLODLUtils.getNodeIdentiofier(rec.element);
+                    XSQLBluePrintNode eNodes[] = bluePrint.getBluePrintNodeByODLTableName(recID);
+                    XSQLBluePrintNode bpn = null;
+                    for(XSQLBluePrintNode eNode:eNodes){
+                        bpn = this.tablesInQueryMap.get(eNode.getBluePrintNodeName());
+                        if(bpn!=null)
+                            break;
+                    }
+                    boolean isObjectInCriteria = true;
+                    if (bpn != null) {
+                        Map allKeyValues = collectColumnValues(rec.element, bpn);
+                        if ((isObjectFitCriteria(allKeyValues, bpn.getBluePrintNodeName()) == 1)) {
+                            addToData(rec, bpn,bluePrint,allKeyValues);
+                        } else {
+                            isObjectInCriteria = false;
+                        }
+                    }
+
+                    if (isObjectInCriteria) {
+                        if (root) {
+                            if(!rec.data.isEmpty())
+                                addRecord(rec.data);
+                        } else {
+                            result.add(rec);
+                        }
+                    }
+                }
+            }
+        }
+
+        return result;
+    }
+
+    @Override
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public boolean absolute(int row) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public void afterLast() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void beforeFirst() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void cancelRowUpdates() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void clearWarnings() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void close() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void deleteRow() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public int findColumn(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public boolean first() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public Array getArray(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Array getArray(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public InputStream getAsciiStream(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public InputStream getAsciiStream(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(int columnIndex, int scale)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(String columnLabel, int scale)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public InputStream getBinaryStream(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public InputStream getBinaryStream(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Blob getBlob(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Blob getBlob(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public boolean getBoolean(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean getBoolean(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public byte getByte(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public byte getByte(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public byte[] getBytes(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public byte[] getBytes(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Reader getCharacterStream(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Reader getCharacterStream(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Clob getClob(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Clob getClob(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public int getConcurrency() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public String getCursorName() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Date getDate(int columnIndex, Calendar cal) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Date getDate(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Date getDate(String columnLabel, Calendar cal) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Date getDate(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public double getDouble(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public double getDouble(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getFetchDirection() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getFetchSize() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public float getFloat(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public float getFloat(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getHoldability() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getInt(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getInt(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public long getLong(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public long getLong(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public ResultSetMetaData getMetaData() throws SQLException {
+        return this;
+    }
+
+    @Override
+    public Reader getNCharacterStream(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Reader getNCharacterStream(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public NClob getNClob(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public NClob getNClob(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getNString(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getNString(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Object getObject(int columnIndex, Map<String, Class<?>> map)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Object getObject(int columnIndex) throws SQLException {
+        return currentRecord
+            .get(this.fieldsInQuery.get(columnIndex - 1).toString());
+    }
+
+    @Override
+    public Object getObject(String columnLabel, Map<String, Class<?>> map)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Object getObject(String columnLabel) throws SQLException {
+        return currentRecord.get(columnLabel);
+    }
+
+    @Override
+    public Ref getRef(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Ref getRef(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public int getRow() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public RowId getRowId(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public RowId getRowId(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public SQLXML getSQLXML(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public SQLXML getSQLXML(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public short getShort(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public short getShort(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public Statement getStatement() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getString(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getString(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Time getTime(int columnIndex, Calendar cal) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Time getTime(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Time getTime(String columnLabel, Calendar cal) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Time getTime(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Timestamp getTimestamp(int columnIndex, Calendar cal)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Timestamp getTimestamp(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Timestamp getTimestamp(String columnLabel, Calendar cal)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Timestamp getTimestamp(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public int getType() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public URL getURL(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public URL getURL(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public InputStream getUnicodeStream(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public InputStream getUnicodeStream(String columnLabel)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public SQLWarning getWarnings() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void insertRow() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public boolean isAfterLast() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isBeforeFirst() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isClosed() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isFirst() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isLast() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean last() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public void moveToCurrentRow() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void moveToInsertRow() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public boolean previous() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public void refreshRow() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public boolean relative(int rows) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean rowDeleted() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean rowInserted() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean rowUpdated() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public void setFetchDirection(int direction) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void setFetchSize(int rows) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateArray(int columnIndex, Array x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateArray(String columnLabel, Array x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateAsciiStream(int columnIndex, InputStream x, int length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateAsciiStream(int columnIndex, InputStream x, long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateAsciiStream(int columnIndex, InputStream x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateAsciiStream(String columnLabel, InputStream x, int length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateAsciiStream(String columnLabel, InputStream x,
+        long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateAsciiStream(String columnLabel, InputStream x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBigDecimal(int columnIndex, BigDecimal x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBigDecimal(String columnLabel, BigDecimal x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBinaryStream(int columnIndex, InputStream x, int length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBinaryStream(int columnIndex, InputStream x, long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBinaryStream(int columnIndex, InputStream x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBinaryStream(String columnLabel, InputStream x,
+        int length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBinaryStream(String columnLabel, InputStream x,
+        long length) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBinaryStream(String columnLabel, InputStream x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBlob(int columnIndex, Blob x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBlob(int columnIndex, InputStream inputStream,
+        long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBlob(int columnIndex, InputStream inputStream)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBlob(String columnLabel, Blob x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBlob(String columnLabel, InputStream inputStream,
+        long length) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBlob(String columnLabel, InputStream inputStream)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBoolean(int columnIndex, boolean x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBoolean(String columnLabel, boolean x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateByte(int columnIndex, byte x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateByte(String columnLabel, byte x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBytes(int columnIndex, byte[] x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateBytes(String columnLabel, byte[] x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateCharacterStream(int columnIndex, Reader x, int length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateCharacterStream(int columnIndex, Reader x, long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateCharacterStream(int columnIndex, Reader x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateCharacterStream(String columnLabel, Reader reader,
+        int length) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateCharacterStream(String columnLabel, Reader reader,
+        long length) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateCharacterStream(String columnLabel, Reader reader)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateClob(int columnIndex, Clob x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateClob(int columnIndex, Reader reader, long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateClob(int columnIndex, Reader reader) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateClob(String columnLabel, Clob x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateClob(String columnLabel, Reader reader, long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateClob(String columnLabel, Reader reader)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateDate(int columnIndex, Date x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateDate(String columnLabel, Date x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateDouble(int columnIndex, double x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateDouble(String columnLabel, double x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateFloat(int columnIndex, float x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateFloat(String columnLabel, float x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateInt(int columnIndex, int x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateInt(String columnLabel, int x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateLong(int columnIndex, long x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateLong(String columnLabel, long x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNCharacterStream(int columnIndex, Reader x, long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNCharacterStream(int columnIndex, Reader x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNCharacterStream(String columnLabel, Reader reader,
+        long length) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNCharacterStream(String columnLabel, Reader reader)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNClob(int columnIndex, Reader reader, long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNClob(int columnIndex, Reader reader)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNClob(String columnLabel, NClob nClob)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNClob(String columnLabel, Reader reader, long length)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNClob(String columnLabel, Reader reader)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNString(int columnIndex, String nString)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNString(String columnLabel, String nString)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNull(int columnIndex) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateNull(String columnLabel) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateObject(int columnIndex, Object x, int scaleOrLength)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateObject(int columnIndex, Object x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateObject(String columnLabel, Object x, int scaleOrLength)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateObject(String columnLabel, Object x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateRef(int columnIndex, Ref x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateRef(String columnLabel, Ref x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateRow() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateRowId(int columnIndex, RowId x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateRowId(String columnLabel, RowId x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateSQLXML(int columnIndex, SQLXML xmlObject)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateSQLXML(String columnLabel, SQLXML xmlObject)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateShort(int columnIndex, short x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateShort(String columnLabel, short x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateString(int columnIndex, String x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateString(String columnLabel, String x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateTime(int columnIndex, Time x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateTime(String columnLabel, Time x) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateTimestamp(int columnIndex, Timestamp x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void updateTimestamp(String columnLabel, Timestamp x)
+        throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public boolean wasNull() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public String getCatalogName(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getColumnClassName(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public int getColumnCount() throws SQLException {
+        return fieldsInQuery.size();
+    }
+
+    @Override
+    public int getColumnDisplaySize(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public String getColumnLabel(int column) throws SQLException {
+        return this.fieldsInQuery.get(column - 1).toString();
+    }
+
+    @Override
+    public String getColumnName(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public int getColumnType(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public String getColumnTypeName(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public int getPrecision(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getScale(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public String getSchemaName(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public String getTableName(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public boolean isAutoIncrement(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isCaseSensitive(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isCurrency(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isDefinitelyWritable(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public int isNullable(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public boolean isReadOnly(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isSearchable(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isSigned(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isWritable(int column) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public <T> T getObject(String columnLabel, Class<T> type)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+
+    ////Metadata
+
+
+
+}
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCServer.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCServer.java
new file mode 100644 (file)
index 0000000..26b8c70
--- /dev/null
@@ -0,0 +1,206 @@
+package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
+
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter;
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint;
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrintNode;
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLColumn;
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLCriteria;
+
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class JDBCServer extends Thread {
+    private ServerSocket socket = null;
+    private XSQLAdapter adapter = null;
+
+    public JDBCServer(XSQLAdapter a) {
+        super("JDBC Server");
+        this.adapter = a;
+        start();
+    }
+
+    public void run() {
+        try {
+            socket = new ServerSocket(40004);
+            while (!adapter.stopped) {
+                Socket s = socket.accept();
+                new JDBCConnection(s, adapter);
+            }
+        } catch (Exception err) {
+            err.printStackTrace();
+        }
+    }
+
+    public void connectToClient(String addr) {
+        try {
+            Socket s = new Socket(addr, 50003);
+            new JDBCConnection(s, adapter);
+        } catch (Exception err) {
+            err.printStackTrace();
+        }
+    }
+
+    public static void execute(JDBCResultSet rs, XSQLAdapter adapter)
+        throws SQLException {
+        parseTables(rs, adapter.getBluePrint());
+        parseFields(rs, adapter.getBluePrint());
+        parseCriteria(rs, adapter.getBluePrint());
+        try {
+            adapter.execute(rs);
+        } catch (Exception err) {
+            throw new SQLException("Error", err);
+        }
+    }
+
+    public static void parseTables(JDBCResultSet rs, XSQLBluePrint bp)
+        throws SQLException {
+        String lowSQL = rs.getSQL().toLowerCase();
+        int from = lowSQL.indexOf("from");
+        int where = lowSQL.indexOf("where");
+        int subQuery = lowSQL.indexOf("select", 2);
+        int fromTo = lowSQL.indexOf(";");
+
+        if (where != -1 && subQuery != -1 && where < subQuery) {
+            fromTo = where;
+        } else if (where != -1 && subQuery != -1 && where > subQuery) {
+            fromTo = subQuery;
+        } else if (where != -1) {
+            fromTo = where;
+        } else if (subQuery != -1) {
+            fromTo = subQuery;
+        }
+
+        if (from == -1) {
+            throw new SQLException("Missing \"from\" statement.");
+        }
+
+        if (fromTo == -1) {
+            throw new SQLException("Missing terminating \";\".");
+        }
+
+        String tableNames = rs.getSQL().substring(from + 4, fromTo).trim();
+        StringTokenizer tokens = new StringTokenizer(tableNames, ",");
+        while (tokens.hasMoreTokens()) {
+            String tableName = tokens.nextToken().trim();
+            XSQLBluePrintNode table = bp.getBluePrintNodeByTableName(tableName);
+            if (table == null) {
+                throw new SQLException(
+                    "Unknown table name \"" + tableName + "\"");
+            }
+            rs.addTableToQuery(table);
+        }
+    }
+
+    public static void addCriteria(XSQLColumn col, XSQLCriteria c,
+        JDBCResultSet rs) {
+        Map<XSQLColumn, List<XSQLCriteria>> tblCriteria =
+            rs.getCriteria().get(col.getTableName());
+        if (tblCriteria == null) {
+            tblCriteria =
+                new ConcurrentHashMap<XSQLColumn, List<XSQLCriteria>>();
+            rs.getCriteria().put(col.getTableName(), tblCriteria);
+        }
+        List<XSQLCriteria> lstCriteria = tblCriteria.get(col);
+        if (lstCriteria == null) {
+            lstCriteria = new ArrayList<XSQLCriteria>();
+            tblCriteria.put(col, lstCriteria);
+        }
+        lstCriteria.add(c);
+    }
+
+    public static void parseFields(JDBCResultSet rs, XSQLBluePrint bp)
+        throws SQLException {
+        String lowSQL = rs.getSQL().toLowerCase();
+        if (!lowSQL.startsWith("select")) {
+            throw new SQLException("Missing 'select' statement.");
+        }
+        int from = lowSQL.indexOf("from");
+        if (from == -1) {
+            throw new SQLException("Missing 'from' statement.");
+        }
+        String fields = rs.getSQL().substring(6, from).trim();
+        StringTokenizer tokens = new StringTokenizer(fields, ",");
+        while (tokens.hasMoreTokens()) {
+            String token = tokens.nextToken().trim();
+            if (token.equals("*")) {
+                for (XSQLBluePrintNode table : rs.getTables()) {
+                    rs.getFields().addAll(table.getColumns());
+                }
+                return;
+            }
+            if (token.indexOf(".") != -1) {
+                XSQLBluePrintNode tbl = bp.getBluePrintNodeByTableName(
+                    token.substring(0, token.indexOf(".")).trim());
+                String p = token.substring(token.indexOf(".") + 1);
+                if (p.equals("*")) {
+                    for (XSQLColumn c : tbl.getColumns()) {
+                        rs.getFields().add(c);
+                    }
+                } else {
+                    XSQLColumn col = tbl.findColumnByName(p);
+                    rs.getFields().add(col);
+                }
+            } else {
+                XSQLColumn col = null;
+                for (XSQLBluePrintNode table : rs.getTables()) {
+                    try {
+                        col = table.findColumnByName(token);
+                    } catch (Exception err) {
+                    }
+                    if (col != null) {
+                        break;
+                    }
+                }
+                if (col == null) {
+                    throw new SQLException(
+                        "Unknown field name '" + token + "'.");
+                }
+
+                rs.getFields().add(col);
+            }
+        }
+    }
+
+    public static void parseCriteria(JDBCResultSet rs, XSQLBluePrint bp) {
+        String lowSQL = rs.getSQL().toLowerCase();
+        int where = lowSQL.indexOf("where");
+        int order = lowSQL.indexOf("order");
+        int subQuery = lowSQL.indexOf("select", 2);
+        int whereTo = lowSQL.indexOf(";");
+
+        if (where == -1) {
+            return;
+        }
+
+        if (where != -1 && subQuery != -1 && subQuery < where) {
+            return;
+        }
+
+        if (order != -1 && subQuery != -1 && order < subQuery) {
+            whereTo = order;
+        } else if (order != -1 && subQuery != -1 && order > subQuery) {
+            whereTo = subQuery;
+        } else if (order != -1) {
+            whereTo = order;
+        } else if (subQuery != -1) {
+            whereTo = subQuery;
+        }
+        String whereStatement =
+            rs.getSQL().substring(where + 5, whereTo).trim();
+        XSQLCriteria cr = new XSQLCriteria(whereStatement, -1);
+        for (XSQLBluePrintNode tbl : rs.getTables()) {
+            for (XSQLColumn col : tbl.getColumns()) {
+                String colCriteria = cr.getCriteriaForProperty(col);
+                if (colCriteria != null && !colCriteria.trim().equals("")) {
+                    addCriteria(col, new XSQLCriteria(colCriteria, -1), rs);
+                }
+            }
+        }
+    }
+}
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCStatement.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCStatement.java
new file mode 100644 (file)
index 0000000..a9ce1dd
--- /dev/null
@@ -0,0 +1,330 @@
+package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class JDBCStatement implements Statement {
+    private JDBCResultSet rs = null;
+    private transient JDBCConnection connection = null;
+    private static Map<Integer, JDBCResultSet> queries =
+        new ConcurrentHashMap<Integer, JDBCResultSet>();
+
+    public JDBCStatement(JDBCConnection con) {
+        this.connection = con;
+    }
+
+    public JDBCStatement() {
+
+    }
+
+    public static JDBCResultSet getQuery(int id) {
+        return queries.get(id);
+    }
+
+    public static JDBCResultSet removeQuery(int id) {
+        return queries.remove(id);
+    }
+
+    @Override
+    public java.sql.ResultSet executeQuery(String _sql) throws SQLException {
+        rs = new JDBCResultSet(_sql);
+        queries.put(rs.getID(), rs);
+        synchronized (rs) {
+            this.connection
+                .send(new JDBCCommand(rs, JDBCCommand.TYPE_EXECUTE_QUERY));
+            try {
+                rs.wait();
+            } catch (Exception err) {
+            }
+            if (rs.getError() != null) {
+                throw ((SQLException) rs.getError());
+            }
+        }
+        return rs;
+    }
+
+    @Override
+    public boolean execute(String _sql) throws SQLException {
+        return true;
+    }
+
+    public void addRecord(ArrayList hierarchy) {
+        rs.addRecord(hierarchy);
+    }
+
+    public int size() {
+        return rs.size();
+    }
+
+    public void setFinished(boolean b) {
+        this.rs.setFinished(b);
+    }
+
+    public JDBCResultSet getRS() {
+        return this.rs;
+    }
+
+    public ResultSet getResultSet() {
+        return this.rs;
+    }
+
+    @Override
+    public boolean isWrapperFor(Class<?> arg0) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public <T> T unwrap(Class<T> arg0) throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void addBatch(String sql) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void cancel() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void clearBatch() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void clearWarnings() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void close() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public boolean execute(String sql, int autoGeneratedKeys)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean execute(String sql, int[] columnIndexes)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean execute(String sql, String[] columnNames)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public int[] executeBatch() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public int executeUpdate(String sql, int autoGeneratedKeys)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int executeUpdate(String sql, int[] columnIndexes)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int executeUpdate(String sql, String[] columnNames)
+        throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int executeUpdate(String sql) throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public Connection getConnection() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public int getFetchDirection() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getFetchSize() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public java.sql.ResultSet getGeneratedKeys() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public int getMaxFieldSize() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getMaxRows() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public boolean getMoreResults() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean getMoreResults(int current) throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public int getQueryTimeout() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getResultSetConcurrency() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getResultSetHoldability() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getResultSetType() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int getUpdateCount() throws SQLException {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public SQLWarning getWarnings() throws SQLException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public boolean isClosed() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean isPoolable() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public void setCursorName(String name) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void setEscapeProcessing(boolean enable) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void setFetchDirection(int direction) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void setFetchSize(int rows) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void setMaxFieldSize(int max) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void setMaxRows(int max) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void setPoolable(boolean poolable) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void setQueryTimeout(int seconds) throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void closeOnCompletion() throws SQLException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public boolean isCloseOnCompletion() throws SQLException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+
+}
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/xsql/XSQLProvider.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/xsql/XSQLProvider.java
new file mode 100644 (file)
index 0000000..b421e56
--- /dev/null
@@ -0,0 +1,41 @@
+package org.opendaylight.xsql;
+
+import java.util.concurrent.ExecutionException;
+
+import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626.XSQL;
+import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626.XSQLBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Created by root on 6/26/14.
+ */
+public class XSQLProvider implements AutoCloseable {
+
+    public static final InstanceIdentifier<XSQL> ID = InstanceIdentifier.builder(XSQL.class).build();
+    private static final Logger LOG = LoggerFactory.getLogger(XSQLProvider.class);
+
+    public void close() {
+    }
+
+    public XSQL buildXSQL(DataProviderService dps) {
+            XSQLBuilder builder = new XSQLBuilder();
+            builder.setPort("34343");
+            XSQL xsql = builder.build();
+            if (dps != null) {
+                final DataModificationTransaction t = dps.beginTransaction();
+                t.removeOperationalData(ID);
+                t.putOperationalData(ID,xsql);
+
+                try {
+                    t.commit().get();
+                } catch (InterruptedException | ExecutionException e) {
+                   LOG.warn("Failed to update toaster status, operational otherwise", e);
+                }
+            }
+        return xsql;
+    }
+}
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/yang/gen/v1/http/netconfcentral/org/ns/xsql/rev140626/XSQLModule.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/yang/gen/v1/http/netconfcentral/org/ns/xsql/rev140626/XSQLModule.java
new file mode 100644 (file)
index 0000000..59cdc76
--- /dev/null
@@ -0,0 +1,30 @@
+package org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626;
+
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter;
+import org.opendaylight.xsql.XSQLProvider;
+
+public class XSQLModule extends org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626.AbstractXSQLModule {
+    public XSQLModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public XSQLModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626.XSQLModule oldModule, java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void customValidation() {
+        // add custom validation form module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        XSQLAdapter xsqlAdapter = XSQLAdapter.getInstance();
+        getSchemaServiceDependency().registerSchemaContextListener(xsqlAdapter);
+        xsqlAdapter.setDataBroker(getAsyncDataBrokerDependency());
+        XSQLProvider p = new XSQLProvider();
+        p.buildXSQL(getDataBrokerDependency());
+        return p;
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/yang/gen/v1/http/netconfcentral/org/ns/xsql/rev140626/XSQLModuleFactory.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/yang/gen/v1/http/netconfcentral/org/ns/xsql/rev140626/XSQLModuleFactory.java
new file mode 100644 (file)
index 0000000..ac0d9c1
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: XSQL yang module local name: XSQL
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Thu Jun 26 14:56:25 PDT 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626;
+public class XSQLModuleFactory extends org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626.AbstractXSQLModuleFactory {
+
+}
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/resources/04-xsql.xml b/opendaylight/md-sal/sal-dom-xsql/src/main/resources/04-xsql.xml
new file mode 100644 (file)
index 0000000..d7d547d
--- /dev/null
@@ -0,0 +1,29 @@
+<snapshot>
+    <configuration>
+        <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+            <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+                <module>
+                    <type xmlns:XSQL="http://netconfcentral.org/ns/XSQL">
+                        XSQL:XSQL
+                    </type>
+                    <name>XSQL</name>
+                    <data-broker>
+                       <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-data-broker</type>
+                       <name>binding-data-broker</name>
+                    </data-broker>
+                    <async-data-broker>
+                        <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-async-data-broker</type>
+                        <name>inmemory-data-broker</name>
+                    </async-data-broker>
+                    <schema-service>
+                        <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
+                        <name>yang-schema-service</name>
+                    </schema-service>
+                </module>
+            </modules>
+        </data>
+    </configuration>
+    <required-capabilities>
+        <capability>http://netconfcentral.org/ns/XSQL?module=XSQL&amp;revision=2014-06-26</capability>
+    </required-capabilities>
+</snapshot>
diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/yang/XSQL.yang b/opendaylight/md-sal/sal-dom-xsql/src/main/yang/XSQL.yang
new file mode 100644 (file)
index 0000000..0437e10
--- /dev/null
@@ -0,0 +1,72 @@
+module XSQL{
+    yang-version 1;
+    namespace "http://netconfcentral.org/ns/XSQL";
+    prefix XSQL;
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+    import rpc-context { prefix rpcx; revision-date 2013-06-17; }
+    import opendaylight-md-sal-dom {prefix sal;}
+    import opendaylight-md-sal-common {prefix common;}
+
+    organization "Netconf Central";
+    contact "Sharon Aicler <saichler@cisco.com>";
+    description "YANG version of the XSQL status";
+
+    revision "2014-06-26" {
+          description "XSQL module initial version";
+    }
+
+    container XSQL {
+        presence "Indicates the XSQL service is available";
+        description "Container to indicate the XSQL availability";
+        leaf port {
+            type string;
+            config false;
+            mandatory true;
+            description "The port the XSQL binds on";
+        }
+    }
+
+    identity XSQL {
+        base config:module-type;
+        config:java-name-prefix XSQL;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case XSQL {
+            when "/config:modules/config:module/config:type = 'XSQL'";
+
+                       container data-broker {
+                uses config:service-ref {
+                    refine type {
+                        mandatory false;
+                        config:required-identity mdsal:binding-data-broker;
+                    }
+                }
+            }         
+
+            container async-data-broker {
+                uses config:service-ref {
+                    refine type {
+                        mandatory false;
+                        config:required-identity sal:dom-async-data-broker;
+                    }
+                }
+
+            }
+
+            container schema-service {
+                uses config:service-ref {
+                    refine type {
+                        mandatory false;
+                        config:required-identity sal:schema-service;
+                    }
+                }
+
+            }
+
+        }
+    }
+
+}
index 01a5989dcd8a6b5afa67a50844e540cbd68c80c5..805608d479e0e76d1ecebb6a7398a884e11498cb 100644 (file)
@@ -23,7 +23,7 @@ public class InMemoryConfigDataStoreProviderModule extends org.opendaylight.cont
     @Override
     public java.lang.AutoCloseable createInstance() {
       InMemoryDOMDataStore   ids = new InMemoryDOMDataStore("DOM-CFG", MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor()));
-      getSchemaServiceDependency().registerSchemaServiceListener(ids);
+      getSchemaServiceDependency().registerSchemaContextListener(ids);
       return ids;
     }
 
index 172b0dbc01b0deb3e384a12a46722806db273bbc..f4795588ab61ef62a9f74f6eb1530da1b6307141 100644 (file)
@@ -23,7 +23,7 @@ public class InMemoryOperationalDataStoreProviderModule extends org.opendaylight
     @Override
     public java.lang.AutoCloseable createInstance() {
       InMemoryDOMDataStore ids = new InMemoryDOMDataStore("DOM-OPER", MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor()));
-      getSchemaServiceDependency().registerSchemaServiceListener(ids);
+      getOperationalSchemaServiceDependency().registerSchemaContextListener(ids);
       return ids;
     }
 
index 375376f383aa8beedcc8dccba4d1c37aeec0c788..27325d84a9ddf3ecf11133ab2d55137477b3fe25 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -17,10 +17,10 @@ class ChangeListenerNotifyTask implements Runnable {
 
     private static final Logger LOG = LoggerFactory.getLogger(ChangeListenerNotifyTask.class);
     private final Iterable<? extends DataChangeListenerRegistration<?>> listeners;
-    private final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> event;
+    private final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> event;
 
     public ChangeListenerNotifyTask(final Iterable<? extends DataChangeListenerRegistration<?>> listeners,
-            final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> event) {
+            final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> event) {
         this.listeners = listeners;
         this.event = event;
     }
index 743ddd1ae069f6f1435c51fa7eb5fe709650fbc3..5faebcef36c65294a36d7b3036453f45f8b20352 100644 (file)
@@ -15,14 +15,14 @@ import java.util.Set;
 
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 import com.google.common.base.Preconditions;
 
 public final class DOMImmutableDataChangeEvent implements
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> {
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> {
 
 
     private static final RemoveEventFactory REMOVE_EVENT_FACTORY = new RemoveEventFactory();
@@ -30,10 +30,10 @@ public final class DOMImmutableDataChangeEvent implements
 
     private final NormalizedNode<?, ?> original;
     private final NormalizedNode<?, ?> updated;
-    private final Map<InstanceIdentifier, NormalizedNode<?, ?>> originalData;
-    private final Map<InstanceIdentifier, NormalizedNode<?, ?>> createdData;
-    private final Map<InstanceIdentifier, NormalizedNode<?, ?>> updatedData;
-    private final Set<InstanceIdentifier> removedPaths;
+    private final Map<YangInstanceIdentifier, NormalizedNode<?, ?>> originalData;
+    private final Map<YangInstanceIdentifier, NormalizedNode<?, ?>> createdData;
+    private final Map<YangInstanceIdentifier, NormalizedNode<?, ?>> updatedData;
+    private final Set<YangInstanceIdentifier> removedPaths;
     private final DataChangeScope scope;
 
 
@@ -67,22 +67,22 @@ public final class DOMImmutableDataChangeEvent implements
     }
 
     @Override
-    public Map<InstanceIdentifier, NormalizedNode<?, ?>> getOriginalData() {
+    public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getOriginalData() {
         return originalData;
     }
 
     @Override
-    public Map<InstanceIdentifier, NormalizedNode<?, ?>> getCreatedData() {
+    public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getCreatedData() {
         return createdData;
     }
 
     @Override
-    public Map<InstanceIdentifier, NormalizedNode<?, ?>> getUpdatedData() {
+    public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getUpdatedData() {
         return updatedData;
     }
 
     @Override
-    public Set<InstanceIdentifier> getRemovedPaths() {
+    public Set<YangInstanceIdentifier> getRemovedPaths() {
         return removedPaths;
     }
 
@@ -98,7 +98,7 @@ public final class DOMImmutableDataChangeEvent implements
      *
      */
     public interface SimpleEventFactory {
-        DOMImmutableDataChangeEvent create(InstanceIdentifier path, NormalizedNode<PathArgument,?> data);
+        DOMImmutableDataChangeEvent create(YangInstanceIdentifier path, NormalizedNode<PathArgument,?> data);
     }
 
     /**
@@ -133,10 +133,10 @@ public final class DOMImmutableDataChangeEvent implements
         private NormalizedNode<?, ?> after;
         private NormalizedNode<?, ?> before;
 
-        private final Map<InstanceIdentifier, NormalizedNode<?, ?>> original = new HashMap<>();
-        private final Map<InstanceIdentifier, NormalizedNode<?, ?>> created = new HashMap<>();
-        private final Map<InstanceIdentifier, NormalizedNode<?, ?>> updated = new HashMap<>();
-        private final Set<InstanceIdentifier> removed = new HashSet<>();
+        private final Map<YangInstanceIdentifier, NormalizedNode<?, ?>> original = new HashMap<>();
+        private final Map<YangInstanceIdentifier, NormalizedNode<?, ?>> created = new HashMap<>();
+        private final Map<YangInstanceIdentifier, NormalizedNode<?, ?>> updated = new HashMap<>();
+        private final Set<YangInstanceIdentifier> removed = new HashSet<>();
 
         private Builder(final DataChangeScope scope) {
             Preconditions.checkNotNull(scope, "Data change scope should not be null.");
@@ -167,18 +167,18 @@ public final class DOMImmutableDataChangeEvent implements
             return this;
         }
 
-        public Builder addCreated(final InstanceIdentifier path, final NormalizedNode<?, ?> node) {
+        public Builder addCreated(final YangInstanceIdentifier path, final NormalizedNode<?, ?> node) {
             created.put(path, node);
             return this;
         }
 
-        public Builder addRemoved(final InstanceIdentifier path, final NormalizedNode<?, ?> node) {
+        public Builder addRemoved(final YangInstanceIdentifier path, final NormalizedNode<?, ?> node) {
             original.put(path, node);
             removed.add(path);
             return this;
         }
 
-        public Builder addUpdated(final InstanceIdentifier path, final NormalizedNode<?, ?> before,
+        public Builder addUpdated(final YangInstanceIdentifier path, final NormalizedNode<?, ?> before,
                 final NormalizedNode<?, ?> after) {
             original.put(path, before);
             updated.put(path, after);
@@ -189,7 +189,7 @@ public final class DOMImmutableDataChangeEvent implements
     private static final class RemoveEventFactory implements SimpleEventFactory {
 
         @Override
-        public DOMImmutableDataChangeEvent create(final InstanceIdentifier path, final NormalizedNode<PathArgument, ?> data) {
+        public DOMImmutableDataChangeEvent create(final YangInstanceIdentifier path, final NormalizedNode<PathArgument, ?> data) {
             return builder(DataChangeScope.BASE) //
                     .setBefore(data) //
                     .addRemoved(path, data) //
@@ -201,7 +201,7 @@ public final class DOMImmutableDataChangeEvent implements
     private static final class CreateEventFactory implements SimpleEventFactory {
 
         @Override
-        public DOMImmutableDataChangeEvent create(final InstanceIdentifier path, final NormalizedNode<PathArgument, ?> data) {
+        public DOMImmutableDataChangeEvent create(final YangInstanceIdentifier path, final NormalizedNode<PathArgument, ?> data) {
             return builder(DataChangeScope.BASE) //
                     .setAfter(data) //
                     .addCreated(path, data) //
index d8f024017ffa6a39fd2f2b8a0febce04414e9eb7..b26f43b2b73eb723f8116039b42fc650276606e5 100644 (file)
@@ -10,14 +10,14 @@ package org.opendaylight.controller.md.sal.dom.store.impl;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
-public interface DataChangeListenerRegistration<L extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> extends ListenerRegistration<L> {
+public interface DataChangeListenerRegistration<L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> extends ListenerRegistration<L> {
     @Override
     L getInstance();
 
-    InstanceIdentifier getPath();
+    YangInstanceIdentifier getPath();
 
     DataChangeScope getScope();
 }
index bef37980e5cb6b13c569fe8fb45eb3609609775e..c44d0909d688773d0cc37034cae21541f0823e6f 100644 (file)
@@ -35,7 +35,7 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
 import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
 import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+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;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
@@ -108,8 +108,8 @@ public class InMemoryDOMDataStore implements DOMStore, Identifiable<String>, Sch
         executor.shutdownNow();
     }
     @Override
-    public <L extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
-            final InstanceIdentifier path, final L listener, final DataChangeScope scope) {
+    public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
+            final YangInstanceIdentifier path, final L listener, final DataChangeScope scope) {
 
         /*
          * Make sure commit is not occurring right now. Listener has to be
index b679de54d63ad7697381768eeba6bb7a044c85ac..ff64cd64c412d57b12da080468f188d457948c6b 100644 (file)
@@ -24,11 +24,11 @@ import org.opendaylight.controller.md.sal.dom.store.impl.DOMImmutableDataChangeE
 import org.opendaylight.controller.md.sal.dom.store.impl.tree.ListenerTree;
 import org.opendaylight.controller.md.sal.dom.store.impl.tree.ListenerTree.Node;
 import org.opendaylight.controller.md.sal.dom.store.impl.tree.ListenerTree.Walker;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+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.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
@@ -239,7 +239,7 @@ final class ResolveDataChangeEventsTask implements Callable<Iterable<ChangeListe
      *            - After state of current node
      * @return Data Change Event of this node and all it's children
      */
-    private DOMImmutableDataChangeEvent resolveAnyChangeEvent(final InstanceIdentifier path,
+    private DOMImmutableDataChangeEvent resolveAnyChangeEvent(final YangInstanceIdentifier path,
             final Collection<ListenerTree.Node> listeners, final DataTreeCandidateNode node) {
 
         if (node.getModificationType() != ModificationType.UNMODIFIED &&
@@ -274,7 +274,7 @@ final class ResolveDataChangeEventsTask implements Callable<Iterable<ChangeListe
         throw new IllegalStateException(String.format("Unhandled node state %s at %s", node.getModificationType(), path));
     }
 
-    private DOMImmutableDataChangeEvent resolveReplacedEvent(final InstanceIdentifier path,
+    private DOMImmutableDataChangeEvent resolveReplacedEvent(final YangInstanceIdentifier path,
             final Collection<Node> listeners, final NormalizedNode<?, ?> beforeData,
             final NormalizedNode<?, ?> afterData) {
 
@@ -302,7 +302,7 @@ final class ResolveDataChangeEventsTask implements Callable<Iterable<ChangeListe
         }
     }
 
-    private DOMImmutableDataChangeEvent resolveNodeContainerReplaced(final InstanceIdentifier path,
+    private DOMImmutableDataChangeEvent resolveNodeContainerReplaced(final YangInstanceIdentifier path,
             final Collection<Node> listeners,
             final NormalizedNodeContainer<?, PathArgument, NormalizedNode<PathArgument, ?>> beforeCont,
                     final NormalizedNodeContainer<?, PathArgument, NormalizedNode<PathArgument, ?>> afterCont) {
@@ -314,7 +314,7 @@ final class ResolveDataChangeEventsTask implements Callable<Iterable<ChangeListe
         for (NormalizedNode<PathArgument, ?> beforeChild : beforeCont.getValue()) {
             PathArgument childId = beforeChild.getIdentifier();
             alreadyProcessed.add(childId);
-            InstanceIdentifier childPath = path.node(childId);
+            YangInstanceIdentifier childPath = path.node(childId);
             Collection<ListenerTree.Node> childListeners = getListenerChildrenWildcarded(listeners, childId);
             Optional<NormalizedNode<PathArgument, ?>> afterChild = afterCont.getChild(childId);
             DOMImmutableDataChangeEvent childChange = resolveNodeContainerChildUpdated(childPath, childListeners,
@@ -333,7 +333,7 @@ final class ResolveDataChangeEventsTask implements Callable<Iterable<ChangeListe
                 // and it was not present in previous loop, that means it is
                 // created.
                 Collection<ListenerTree.Node> childListeners = getListenerChildrenWildcarded(listeners, childId);
-                InstanceIdentifier childPath = path.node(childId);
+                YangInstanceIdentifier childPath = path.node(childId);
                 childChanges.add(resolveSameEventRecursivelly(childPath , childListeners, afterChild,
                         DOMImmutableDataChangeEvent.getCreateEventFactory()));
             }
@@ -355,7 +355,7 @@ final class ResolveDataChangeEventsTask implements Callable<Iterable<ChangeListe
         return replaceEvent;
     }
 
-    private DOMImmutableDataChangeEvent resolveNodeContainerChildUpdated(final InstanceIdentifier path,
+    private DOMImmutableDataChangeEvent resolveNodeContainerChildUpdated(final YangInstanceIdentifier path,
             final Collection<Node> listeners, final NormalizedNode<PathArgument, ?> before,
             final Optional<NormalizedNode<PathArgument, ?>> after) {
 
@@ -379,14 +379,14 @@ final class ResolveDataChangeEventsTask implements Callable<Iterable<ChangeListe
      * @param afterState
      * @return
      */
-    private DOMImmutableDataChangeEvent resolveCreateEvent(final InstanceIdentifier path,
+    private DOMImmutableDataChangeEvent resolveCreateEvent(final YangInstanceIdentifier path,
             final Collection<ListenerTree.Node> listeners, final NormalizedNode<?, ?> afterState) {
         @SuppressWarnings({ "unchecked", "rawtypes" })
         final NormalizedNode<PathArgument, ?> node = (NormalizedNode) afterState;
         return resolveSameEventRecursivelly(path, listeners, node, DOMImmutableDataChangeEvent.getCreateEventFactory());
     }
 
-    private DOMImmutableDataChangeEvent resolveDeleteEvent(final InstanceIdentifier path,
+    private DOMImmutableDataChangeEvent resolveDeleteEvent(final YangInstanceIdentifier path,
             final Collection<ListenerTree.Node> listeners, final NormalizedNode<?, ?> beforeState) {
 
         @SuppressWarnings({ "unchecked", "rawtypes" })
@@ -394,7 +394,7 @@ final class ResolveDataChangeEventsTask implements Callable<Iterable<ChangeListe
         return resolveSameEventRecursivelly(path, listeners, node, DOMImmutableDataChangeEvent.getRemoveEventFactory());
     }
 
-    private DOMImmutableDataChangeEvent resolveSameEventRecursivelly(final InstanceIdentifier path,
+    private DOMImmutableDataChangeEvent resolveSameEventRecursivelly(final YangInstanceIdentifier path,
             final Collection<Node> listeners, final NormalizedNode<PathArgument, ?> node,
             final SimpleEventFactory eventFactory) {
         final DOMImmutableDataChangeEvent event = eventFactory.create(path, node);
@@ -427,7 +427,7 @@ final class ResolveDataChangeEventsTask implements Callable<Iterable<ChangeListe
         return propagateEvent;
     }
 
-    private DOMImmutableDataChangeEvent resolveSubtreeChangeEvent(final InstanceIdentifier path,
+    private DOMImmutableDataChangeEvent resolveSubtreeChangeEvent(final YangInstanceIdentifier path,
             final Collection<ListenerTree.Node> listeners, final DataTreeCandidateNode modification) {
 
         Preconditions.checkArgument(modification.getDataBefore().isPresent(), "Subtree change with before-data not present at path %s", path);
@@ -442,7 +442,7 @@ final class ResolveDataChangeEventsTask implements Callable<Iterable<ChangeListe
         boolean oneModified = false;
         for (DataTreeCandidateNode childMod : modification.getChildNodes()) {
             PathArgument childId = childMod.getIdentifier();
-            InstanceIdentifier childPath = path.node(childId);
+            YangInstanceIdentifier childPath = path.node(childId);
             Collection<ListenerTree.Node> childListeners = getListenerChildrenWildcarded(listeners, childId);
 
 
index c76c70b700174512eee0f86b2622feb60c4352de..39d6483c525ed648ea8c7f922ce8c57ee0064af0 100644 (file)
@@ -12,7 +12,7 @@ import static com.google.common.base.Preconditions.checkState;
 
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -48,7 +48,7 @@ DOMStoreReadTransaction {
     }
 
     @Override
-    public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final InstanceIdentifier path) {
+    public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final YangInstanceIdentifier path) {
         checkNotNull(path, "Path must not be null.");
         checkState(stableSnapshot != null, "Transaction is closed");
         return Futures.immediateFuture(stableSnapshot.readNode(path));
index 1456386ff9b573d839401f1a47b18deb2764e626..ec17d7a3f7e4cbaccc2c5a4ffa1f65cddbd8d60e 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.md.sal.dom.store.impl;
 
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -41,7 +41,7 @@ DOMStoreReadWriteTransaction {
     }
 
     @Override
-    public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final InstanceIdentifier path) {
+    public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final YangInstanceIdentifier path) {
         LOG.debug("Tx: {} Read: {}", getIdentifier(), path);
         try {
             return Futures.immediateFuture(getMutatedView().readNode(path));
index 16675d3a8563f0a4142d86e248243c790085e940..34532ab98fdc45502e3794a8ea967e4e3da4f805 100644 (file)
@@ -12,7 +12,7 @@ import static com.google.common.base.Preconditions.checkState;
 
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -62,7 +62,7 @@ class SnapshotBackedWriteTransaction extends AbstractDOMStoreTransaction impleme
     }
 
     @Override
-    public void write(final InstanceIdentifier path, final NormalizedNode<?, ?> data) {
+    public void write(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
         checkNotReady();
         try {
             LOG.debug("Tx: {} Write: {}:{}", getIdentifier(), path, data);
@@ -79,7 +79,7 @@ class SnapshotBackedWriteTransaction extends AbstractDOMStoreTransaction impleme
     }
 
     @Override
-    public void merge(final InstanceIdentifier path, final NormalizedNode<?, ?> data) {
+    public void merge(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
         checkNotReady();
         try {
             LOG.debug("Tx: {} Merge: {}:{}", getIdentifier(), path, data);
@@ -96,7 +96,7 @@ class SnapshotBackedWriteTransaction extends AbstractDOMStoreTransaction impleme
     }
 
     @Override
-    public void delete(final InstanceIdentifier path) {
+    public void delete(final YangInstanceIdentifier path) {
         checkNotReady();
         try {
             LOG.debug("Tx: {} Delete: {}", getIdentifier(), path);
index 9d04a1b6ed039043a7737699b4c3bf88a5a91ef7..39152767dd0b063c373adaed9fd5704b8702719c 100644 (file)
@@ -27,8 +27,8 @@ import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListene
 import org.opendaylight.controller.md.sal.dom.store.impl.DataChangeListenerRegistration;
 import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
 import org.opendaylight.yangtools.concepts.Identifiable;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.StoreTreeNode;
 import org.slf4j.Logger;
@@ -64,7 +64,7 @@ public final class ListenerTree  {
      * @param scope Scope of triggering event.
      * @return Listener registration
      */
-    public <L extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> DataChangeListenerRegistration<L> registerDataChangeListener(final InstanceIdentifier path,
+    public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> DataChangeListenerRegistration<L> registerDataChangeListener(final YangInstanceIdentifier path,
             final L listener, final DataChangeScope scope) {
 
         // Take the write lock
@@ -84,7 +84,7 @@ public final class ListenerTree  {
                 }
 
                 @Override
-                public InstanceIdentifier getPath() {
+                public YangInstanceIdentifier getPath() {
                     return path;
                 }
 
@@ -251,7 +251,7 @@ public final class ListenerTree  {
 
     }
 
-    private abstract static class DataChangeListenerRegistrationImpl<T extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> extends AbstractListenerRegistration<T> //
+    private abstract static class DataChangeListenerRegistrationImpl<T extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> extends AbstractListenerRegistration<T> //
     implements DataChangeListenerRegistration<T> {
         public DataChangeListenerRegistrationImpl(final T listener) {
             super(listener);
index 03220a3e5d1b2bd3a8d39b2da43e279ac4dd769f..d4f57b53fed168dae3f1402123f9164f8c772455 100644 (file)
@@ -58,7 +58,10 @@ module opendaylight-inmemory-datastore-provider {
             case inmemory-operational-datastore-provider {
                 when "/config:modules/config:module/config:type = 'inmemory-operational-datastore-provider'";
 
-                container schema-service {
+                // Yang does not allow two cases from same namespaces with same children
+                // Schema-service dependency renamed to operational-schema-service
+                // to prevent conflict with schema-service container from inmemory-config-datastore-provider
+                container operational-schema-service {
                   uses config:service-ref {
                        refine type {
                               mandatory false;
index 4d2d07884f6f56ee40d601019079023ac0198437..3176ca764de198dac326dbfb9db51f6f2190ded8 100644 (file)
@@ -21,9 +21,9 @@ import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedCon
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
+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.NodeIdentifierWithPredicates;
 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;
@@ -39,7 +39,7 @@ import com.google.common.util.concurrent.MoreExecutors;
 
 public abstract class AbstractDataChangeListenerTest {
 
-    protected static final InstanceIdentifier TOP_LEVEL = InstanceIdentifier
+    protected static final YangInstanceIdentifier TOP_LEVEL = YangInstanceIdentifier
             .of(Top.QNAME);
     private static final QName NAME_QNAME = QName.create(Top.QNAME, "name");
     protected static final String FOO = "foo";
@@ -67,14 +67,14 @@ public abstract class AbstractDataChangeListenerTest {
     }
 
 
-    public static final InstanceIdentifier path(final String topName,
+    public static final YangInstanceIdentifier path(final String topName,
             final String nestedName) {
         return path(topName).node(NestedList.QNAME).node(
                 new NodeIdentifierWithPredicates(NestedList.QNAME, NAME_QNAME,
                         nestedName));
     }
 
-    public static final InstanceIdentifier path(final String topName) {
+    public static final YangInstanceIdentifier path(final String topName) {
         return TOP_LEVEL.node(TopLevelList.QNAME).node(
                 new NodeIdentifierWithPredicates(TopLevelList.QNAME,
                         NAME_QNAME, topName));
index 8ac93b180437a7193bbe6e466ed0f1c7567aa9f3..26987a6fba6426169ee7df98340c8ac0f0f4be47 100644 (file)
@@ -20,7 +20,7 @@ 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.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 import com.google.common.base.Preconditions;
@@ -29,13 +29,13 @@ import com.google.common.util.concurrent.SettableFuture;
 public class DatastoreTestTask {
 
     private final DOMStore store;
-    private AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> changeListener;
+    private AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> changeListener;
 
     private WriteTransactionCustomizer setup;
     private WriteTransactionCustomizer write;
     private ReadTransactionVerifier read;
     private WriteTransactionCustomizer cleanup;
-    private InstanceIdentifier changePath;
+    private YangInstanceIdentifier changePath;
     private DataChangeScope changeScope;
     private boolean postSetup = false;
     private final ChangeEventListener internalListener;
@@ -45,15 +45,15 @@ public class DatastoreTestTask {
         internalListener = new ChangeEventListener();
     }
 
-    public DatastoreTestTask changeListener(final InstanceIdentifier path, final DataChangeScope scope,
-            final AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> changeListener) {
+    public DatastoreTestTask changeListener(final YangInstanceIdentifier path, final DataChangeScope scope,
+            final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> changeListener) {
         this.changeListener = changeListener;
         this.changePath = path;
         this.changeScope = scope;
         return this;
     }
 
-    public DatastoreTestTask changeListener(final InstanceIdentifier path, final DataChangeScope scope) {
+    public DatastoreTestTask changeListener(final YangInstanceIdentifier path, final DataChangeScope scope) {
         this.changePath = path;
         this.changeScope = scope;
         return this;
@@ -105,7 +105,7 @@ public class DatastoreTestTask {
         }
     }
 
-    public Future<AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>>> getChangeEvent() {
+    public Future<AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>>> getChangeEvent() {
         return internalListener.receivedChange;
     }
 
@@ -128,20 +128,20 @@ public class DatastoreTestTask {
     }
 
     private final class ChangeEventListener implements
-            AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> {
+            AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> {
 
-        protected final SettableFuture<AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>>> receivedChange = SettableFuture
+        protected final SettableFuture<AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>>> receivedChange = SettableFuture
                 .create();
 
         @Override
-        public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
+        public void onDataChanged(final AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
             if (postSetup) {
                 receivedChange.set(change);
             }
         }
     }
 
-    public static final WriteTransactionCustomizer simpleWrite(final InstanceIdentifier path,
+    public static final WriteTransactionCustomizer simpleWrite(final YangInstanceIdentifier path,
             final NormalizedNode<?, ?> data) {
         return new WriteTransactionCustomizer() {
 
@@ -152,7 +152,7 @@ public class DatastoreTestTask {
         };
     }
 
-    public static final WriteTransactionCustomizer simpleMerge(final InstanceIdentifier path,
+    public static final WriteTransactionCustomizer simpleMerge(final YangInstanceIdentifier path,
             final NormalizedNode<?, ?> data) {
         return new WriteTransactionCustomizer() {
 
@@ -163,7 +163,7 @@ public class DatastoreTestTask {
         };
     }
 
-    public static final WriteTransactionCustomizer simpleDelete(final InstanceIdentifier path) {
+    public static final WriteTransactionCustomizer simpleDelete(final YangInstanceIdentifier path) {
         return new WriteTransactionCustomizer() {
             @Override
             public void customize(final DOMStoreReadWriteTransaction tx) {
index ef2a4743e22326d81a6384e71ae49f212770d83c..905dc0d19b8c1f3b671de983b4dbda5de89526ce 100644 (file)
@@ -11,7 +11,7 @@ import java.util.concurrent.ExecutionException;
 
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
@@ -23,7 +23,7 @@ public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
 
     @Override
     public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertContains(change.getCreatedData(), TOP_LEVEL, path(FOO), path(FOO, BAR));
         assertEmpty(change.getUpdatedData());
@@ -34,7 +34,7 @@ public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
     public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
             ExecutionException {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertContains(change.getCreatedData(), path(FOO, BAZ));
         assertContains(change.getUpdatedData(), TOP_LEVEL, path(FOO));
@@ -45,7 +45,7 @@ public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
     protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws InterruptedException,
             ExecutionException {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertContains(change.getCreatedData(), TOP_LEVEL, path(FOO), path(FOO, BAR), path(FOO, BAZ));
         assertEmpty(change.getUpdatedData());
@@ -56,7 +56,7 @@ public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
     protected void twoNestedExistsOneIsDeleted(final DatastoreTestTask task) throws InterruptedException,
             ExecutionException {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertEmpty(change.getCreatedData());
         assertContains(change.getUpdatedData(), TOP_LEVEL, path(FOO));
@@ -67,7 +67,7 @@ public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
     protected void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
             ExecutionException {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertEmpty(change.getCreatedData());
         assertEmpty(change.getUpdatedData());
@@ -76,7 +76,7 @@ public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
 
     @Override
     protected void existingOneNestedWriteAdditionalNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertContains(change.getCreatedData(), path(FOO,BAZ));
         assertNotContains(change.getCreatedData(), path(FOO,BAR));
@@ -86,7 +86,7 @@ public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
 
     @Override
     protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertContains(change.getCreatedData(), path(FOO,BAR),path(FOO,BAZ));
         assertContains(change.getUpdatedData(), TOP_LEVEL, path(FOO));
@@ -96,7 +96,7 @@ public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
 
     @Override
     protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertContains(change.getCreatedData(), path(FOO_SIBLING));
         assertContains(change.getUpdatedData(), TOP_LEVEL);
index ee62c0bfbfa8e27d9d2103057aa5173b0e5c4b3d..5cba93a712f6b313d0a40bd9ece03ec88135d567 100644 (file)
@@ -19,7 +19,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
@@ -28,7 +28,7 @@ import com.google.common.util.concurrent.MoreExecutors;
 
 public class SchemaUpdateForTransactionTest {
 
-    private static final InstanceIdentifier TOP_PATH = InstanceIdentifier.of(Top.QNAME);
+    private static final YangInstanceIdentifier TOP_PATH = YangInstanceIdentifier.of(Top.QNAME);
     private SchemaContext schemaContext;
     private InMemoryDOMDataStore domStore;
 
index 3feeb2967273fa60c998ccd5176030e51f244e9a..66e71a399f060ea955253854b8fb915f28eeca1d 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
@@ -29,8 +29,8 @@ public class TestModel {
     public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
     private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
 
-    public static final InstanceIdentifier TEST_PATH = InstanceIdentifier.of(TEST_QNAME);
-    public static final InstanceIdentifier OUTER_LIST_PATH = InstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
+    public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_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 4c1a860f2a0538da02174c1cc97e57f4b3557dba..7c8676eff56728f9b5307e177f9ffcbd0c4bb87f 100644 (file)
@@ -16,12 +16,12 @@ import java.util.concurrent.Future;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 public class WildcardedScopeBaseTest extends DefaultDataChangeListenerTestSuite {
 
-    private static final InstanceIdentifier TOP_LEVEL_LIST_ALL = TOP_LEVEL.node(TopLevelList.QNAME).node(
+    private static final YangInstanceIdentifier TOP_LEVEL_LIST_ALL = TOP_LEVEL.node(TopLevelList.QNAME).node(
             TopLevelList.QNAME);
 
     @Override
@@ -32,7 +32,7 @@ public class WildcardedScopeBaseTest extends DefaultDataChangeListenerTestSuite
     @Override
     public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertNotNull(change);
 
@@ -48,7 +48,7 @@ public class WildcardedScopeBaseTest extends DefaultDataChangeListenerTestSuite
     public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
             ExecutionException {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
         assertNotNull(change);
 
         assertContains(change.getCreatedData(), path(FOO, BAZ));
@@ -62,7 +62,7 @@ public class WildcardedScopeBaseTest extends DefaultDataChangeListenerTestSuite
     protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws InterruptedException,
             ExecutionException {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
         assertNotNull(change);
         assertFalse(change.getCreatedData().isEmpty());
 
@@ -92,7 +92,7 @@ public class WildcardedScopeBaseTest extends DefaultDataChangeListenerTestSuite
     public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
             ExecutionException {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertEmpty(change.getCreatedData());
         assertEmpty(change.getUpdatedData());
@@ -131,7 +131,7 @@ public class WildcardedScopeBaseTest extends DefaultDataChangeListenerTestSuite
 
     @Override
     protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertContains(change.getCreatedData(), path(FOO_SIBLING));
         assertNotContains(change.getUpdatedData(), path(FOO), TOP_LEVEL);
index 1f2cb224abe81b7484b47541e738b215a9051986..ac18d5c976d2ae0e9691d52eeac14fa7aef8da91 100644 (file)
@@ -16,12 +16,12 @@ import java.util.concurrent.Future;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
 
-    private static final InstanceIdentifier TOP_LEVEL_LIST_ALL = TOP_LEVEL.node(TopLevelList.QNAME).node(
+    private static final YangInstanceIdentifier TOP_LEVEL_LIST_ALL = TOP_LEVEL.node(TopLevelList.QNAME).node(
             TopLevelList.QNAME);
 
     @Override
@@ -32,7 +32,7 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
     @Override
     public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertNotNull(change);
 
@@ -48,7 +48,7 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
     public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
             ExecutionException {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
         assertNotNull(change);
 
         assertContains(change.getCreatedData(), path(FOO, BAZ));
@@ -62,7 +62,7 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
     protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws InterruptedException,
             ExecutionException {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
         assertNotNull(change);
         assertFalse(change.getCreatedData().isEmpty());
 
@@ -93,7 +93,7 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
     public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
             ExecutionException {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertEmpty(change.getCreatedData());
         assertEmpty(change.getUpdatedData());
@@ -132,7 +132,7 @@ public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
 
     @Override
     protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertContains(change.getCreatedData(), path(FOO_SIBLING));
         assertNotContains(change.getUpdatedData(),path(FOO), TOP_LEVEL);
index 010204888b85a6ad92f6971f0b4df75e5454e28b..7e67242dd3f941490d54f53bcb96d5987161d01f 100644 (file)
@@ -16,12 +16,12 @@ import java.util.concurrent.ExecutionException;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.TopLevelList;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
 
-    private static final InstanceIdentifier TOP_LEVEL_LIST_ALL = TOP_LEVEL.node(TopLevelList.QNAME).node(
+    private static final YangInstanceIdentifier TOP_LEVEL_LIST_ALL = TOP_LEVEL.node(TopLevelList.QNAME).node(
             TopLevelList.QNAME);
 
     @Override
@@ -32,7 +32,7 @@ public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSui
     @Override
     public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertNotContains(change.getCreatedData(), TOP_LEVEL);
         assertContains(change.getCreatedData(), path(FOO), path(FOO, BAR));
@@ -45,7 +45,7 @@ public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSui
     public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
             ExecutionException {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
         assertNotNull(change);
 
         assertContains(change.getCreatedData(), path(FOO, BAZ));
@@ -59,7 +59,7 @@ public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSui
     protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws InterruptedException,
             ExecutionException {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
         assertNotNull(change);
         assertFalse(change.getCreatedData().isEmpty());
 
@@ -74,7 +74,7 @@ public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSui
     protected void twoNestedExistsOneIsDeleted(final DatastoreTestTask task) throws InterruptedException,
             ExecutionException {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
         assertNotNull(change);
         assertTrue(change.getCreatedData().isEmpty());
         assertContains(change.getUpdatedData(), path(FOO));
@@ -86,7 +86,7 @@ public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSui
     public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
             ExecutionException {
 
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertEmpty(change.getCreatedData());
         assertEmpty(change.getUpdatedData());
@@ -97,7 +97,7 @@ public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSui
 
     @Override
     protected void existingOneNestedWriteAdditionalNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertContains(change.getCreatedData(), path(FOO,BAZ));
         assertNotContains(change.getCreatedData(), path(FOO,BAR));
@@ -108,7 +108,7 @@ public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSui
 
     @Override
     protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertContains(change.getCreatedData(), path(FOO,BAR),path(FOO,BAZ));
         assertContains(change.getUpdatedData(), path(FOO));
@@ -118,7 +118,7 @@ public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSui
 
     @Override
     protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
-        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
 
         assertContains(change.getCreatedData(), path(FOO_SIBLING));
         assertNotContains(change.getUpdatedData(), path(FOO), TOP_LEVEL);
index 0bf4b3238dd5f78a3e7b95626bd0d04a2ca8591a..10fe4a587a1f0c8ba7b52ac7e10314adbe1c9b62 100644 (file)
@@ -13,7 +13,6 @@
 
   <dependencies>
     <dependency>
-
       <groupId>${project.groupId}</groupId>
       <artifactId>netconf-client</artifactId>
       <version>${netconf.version}</version>
       <groupId>org.opendaylight.controller.model</groupId>
       <artifactId>model-inventory</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-broker-impl</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.yangtools</groupId>
       <artifactId>yang-data-impl</artifactId>
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>sal-broker-impl</artifactId>
-      <type>jar</type>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.yangtools</groupId>
       <artifactId>mockito-configuration</artifactId>
index 037bfb4a82c2cd8f34dbfe05513e602e7077b3ff..b75df80f4ef4b3091975e3b5e0f50a70ed9bc71c 100644 (file)
@@ -13,8 +13,10 @@ import static org.opendaylight.controller.config.api.JmxAttributeValidationExcep
 import java.io.File;
 import java.io.InputStream;
 import java.net.InetSocketAddress;
+import java.util.List;
 import java.util.concurrent.ExecutorService;
 
+import org.opendaylight.controller.config.api.JmxAttributeValidationException;
 import org.opendaylight.controller.netconf.client.NetconfClientDispatcher;
 import org.opendaylight.controller.netconf.client.conf.NetconfClientConfiguration;
 import org.opendaylight.controller.netconf.client.conf.NetconfReconnectingClientConfiguration;
@@ -24,6 +26,7 @@ import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.connect.api.RemoteDeviceHandler;
 import org.opendaylight.controller.sal.connect.netconf.NetconfDevice;
 import org.opendaylight.controller.sal.connect.netconf.listener.NetconfDeviceCommunicator;
+import org.opendaylight.controller.sal.connect.netconf.listener.NetconfSessionCapabilities;
 import org.opendaylight.controller.sal.connect.netconf.sal.NetconfDeviceSalFacade;
 import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
 import org.opendaylight.controller.sal.core.api.Broker;
@@ -40,6 +43,8 @@ import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Optional;
+
 /**
  *
  */
@@ -49,6 +54,7 @@ public final class NetconfConnectorModule extends org.opendaylight.controller.co
 
     private static AbstractCachingSchemaSourceProvider<String, InputStream> GLOBAL_NETCONF_SOURCE_PROVIDER = null;
     private BundleContext bundleContext;
+    private Optional<NetconfSessionCapabilities> userCapabilities;
 
     public NetconfConnectorModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
@@ -82,9 +88,11 @@ public final class NetconfConnectorModule extends org.opendaylight.controller.co
             checkNotNull(getPassword(), passwordJmxAttribute);
         }
 
+        userCapabilities = getUserCapabilities();
+
     }
 
-    private boolean isHostAddressPresent(Host address) {
+    private boolean isHostAddressPresent(final Host address) {
         return address.getDomainName() != null ||
                address.getIpAddress() != null && (address.getIpAddress().getIpv4Address() != null || address.getIpAddress().getIpv6Address() != null);
     }
@@ -98,10 +106,14 @@ public final class NetconfConnectorModule extends org.opendaylight.controller.co
         final Broker domBroker = getDomRegistryDependency();
         final BindingAwareBroker bindingBroker = getBindingRegistryDependency();
 
-        final RemoteDeviceHandler salFacade = new NetconfDeviceSalFacade(id, domBroker, bindingBroker, bundleContext, globalProcessingExecutor);
+        final RemoteDeviceHandler<NetconfSessionCapabilities> salFacade
+                = new NetconfDeviceSalFacade(id, domBroker, bindingBroker, bundleContext, globalProcessingExecutor);
         final NetconfDevice device =
                 NetconfDevice.createNetconfDevice(id, getGlobalNetconfSchemaProvider(), globalProcessingExecutor, salFacade);
-        final NetconfDeviceCommunicator listener = new NetconfDeviceCommunicator(id, device);
+
+        final NetconfDeviceCommunicator listener = userCapabilities.isPresent() ?
+                new NetconfDeviceCommunicator(id, device, userCapabilities.get()) : new NetconfDeviceCommunicator(id, device);
+
         final NetconfReconnectingClientConfiguration clientConfig = getClientConfig(listener);
 
         final NetconfClientDispatcher dispatcher = getClientDispatcherDependency();
@@ -116,6 +128,26 @@ public final class NetconfConnectorModule extends org.opendaylight.controller.co
         };
     }
 
+    private Optional<NetconfSessionCapabilities> getUserCapabilities() {
+        if(getYangModuleCapabilities() == null) {
+            return Optional.absent();
+        }
+
+        final List<String> capabilities = getYangModuleCapabilities().getCapability();
+        if(capabilities == null || capabilities.isEmpty()) {
+            return Optional.absent();
+        }
+
+        final NetconfSessionCapabilities parsedOverrideCapabilities = NetconfSessionCapabilities.fromStrings(capabilities);
+        JmxAttributeValidationException.checkCondition(
+                parsedOverrideCapabilities.getNonModuleCaps().isEmpty(),
+                "Capabilities to override can only contain module based capabilities, non-module capabilities will be retrieved from the device," +
+                        " configured non-module capabilities: " + parsedOverrideCapabilities.getNonModuleCaps(),
+                yangModuleCapabilitiesJmxAttribute);
+
+        return Optional.of(parsedOverrideCapabilities);
+    }
+
     private synchronized AbstractCachingSchemaSourceProvider<String, InputStream> getGlobalNetconfSchemaProvider() {
         if(GLOBAL_NETCONF_SOURCE_PROVIDER == null) {
             final String storageFile = "cache/schema";
@@ -175,8 +207,8 @@ public final class NetconfConnectorModule extends org.opendaylight.controller.co
         if(getAddress().getDomainName() != null) {
             return new InetSocketAddress(getAddress().getDomainName().getValue(), getPort().getValue());
         } else {
-            IpAddress ipAddress = getAddress().getIpAddress();
-            String ip = ipAddress.getIpv4Address() != null ? ipAddress.getIpv4Address().getValue() : ipAddress.getIpv6Address().getValue();
+            final IpAddress ipAddress = getAddress().getIpAddress();
+            final String ip = ipAddress.getIpv4Address() != null ? ipAddress.getIpv4Address().getValue() : ipAddress.getIpv6Address().getValue();
             return new InetSocketAddress(ip, getPort().getValue());
         }
     }
index de4ac7ac18a106f88f530ac4dc16ea047976b091..07d3c087740c811d4f8404c34d4d90c12ed17143 100644 (file)
@@ -118,6 +118,7 @@ public final class NetconfDevice implements RemoteDevice<NetconfSessionCapabilit
                 // Unable to initialize device, set as disconnected
                 logger.error("{}: Initialization failed", id, t);
                 salFacade.onDeviceDisconnected();
+                // TODO ssh connection is still open if sal initialization fails
             }
         });
     }
index 8045f8cb4a9556160b44fb46d4d3bbc12374435a..3871cdfa4f4cb7556313d8419407e1d3326dc802 100644 (file)
@@ -7,13 +7,19 @@
  */
 package org.opendaylight.controller.sal.connect.netconf.listener;
 
+import com.google.common.base.Optional;
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import io.netty.util.concurrent.Future;
+import io.netty.util.concurrent.FutureListener;
 import java.util.ArrayDeque;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Queue;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
-
 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.api.NetconfTerminationReason;
@@ -36,31 +42,35 @@ import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-
-import io.netty.util.concurrent.Future;
-import io.netty.util.concurrent.FutureListener;
-
 public class NetconfDeviceCommunicator implements NetconfClientSessionListener, RemoteDeviceCommunicator<NetconfMessage> {
 
     private static final Logger logger = LoggerFactory.getLogger(NetconfDeviceCommunicator.class);
 
     private final RemoteDevice<NetconfSessionCapabilities, NetconfMessage> remoteDevice;
+    private final Optional<NetconfSessionCapabilities> overrideNetconfCapabilities;
     private final RemoteDeviceId id;
     private final Lock sessionLock = new ReentrantLock();
 
+    private final Queue<Request> requests = new ArrayDeque<>();
+    private NetconfClientSession session;
+
+    public NetconfDeviceCommunicator(final RemoteDeviceId id, final RemoteDevice<NetconfSessionCapabilities, NetconfMessage> remoteDevice,
+            final NetconfSessionCapabilities netconfSessionCapabilities) {
+        this(id, remoteDevice, Optional.of(netconfSessionCapabilities));
+    }
+
     public NetconfDeviceCommunicator(final RemoteDeviceId id,
-            final RemoteDevice<NetconfSessionCapabilities, NetconfMessage> remoteDevice) {
+                                     final RemoteDevice<NetconfSessionCapabilities, NetconfMessage> remoteDevice) {
+        this(id, remoteDevice, Optional.<NetconfSessionCapabilities>absent());
+    }
+
+    private NetconfDeviceCommunicator(final RemoteDeviceId id, final RemoteDevice<NetconfSessionCapabilities, NetconfMessage> remoteDevice,
+            final Optional<NetconfSessionCapabilities> overrideNetconfCapabilities) {
         this.id = id;
         this.remoteDevice = remoteDevice;
+        this.overrideNetconfCapabilities = overrideNetconfCapabilities;
     }
 
-    private final Queue<Request> requests = new ArrayDeque<>();
-    private NetconfClientSession session;
-
     @Override
     public void onSessionUp(final NetconfClientSession session) {
         sessionLock.lock();
@@ -68,10 +78,15 @@ public class NetconfDeviceCommunicator implements NetconfClientSessionListener,
             logger.debug("{}: Session established", id);
             this.session = session;
 
-            final NetconfSessionCapabilities netconfSessionCapabilities =
+            NetconfSessionCapabilities netconfSessionCapabilities =
                                              NetconfSessionCapabilities.fromNetconfSession(session);
             logger.trace("{}: Session advertised capabilities: {}", id, netconfSessionCapabilities);
 
+            if(overrideNetconfCapabilities.isPresent()) {
+                netconfSessionCapabilities = netconfSessionCapabilities.replaceModuleCaps(overrideNetconfCapabilities.get());
+                logger.debug("{}: Session capabilities overridden, capabilities that will be used: {}", id, netconfSessionCapabilities);
+            }
+
             remoteDevice.onRemoteSessionUp(netconfSessionCapabilities, this);
         }
         finally {
@@ -223,7 +238,7 @@ public class NetconfDeviceCommunicator implements NetconfClientSessionListener,
                 return;
             }
 
-            request.future.set( RpcResultBuilder.<NetconfMessage>success( message ).build() );
+            request.future.set( RpcResultBuilder.success( message ).build() );
         }
     }
 
index 82903ea4ec174a373dc0648901cde3c5c02d0348..1a7d90e9c0ad1d9424da229b29eef9ebf7c9b6a4 100644 (file)
@@ -1,7 +1,16 @@
 package org.opendaylight.controller.sal.connect.netconf.listener;
 
-import java.util.Arrays;
+import com.google.common.base.Objects;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Predicate;
+import com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+
+import com.google.common.collect.Sets;
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.Set;
 
 import org.opendaylight.controller.netconf.client.NetconfClientSession;
@@ -10,54 +19,100 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Objects;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-
 public final class NetconfSessionCapabilities {
 
-    private static final Logger logger = LoggerFactory.getLogger(NetconfSessionCapabilities.class);
+    private static final class ParameterMatcher {
+        private final Predicate<String> predicate;
+        private final int skipLength;
+
+        ParameterMatcher(final String name) {
+            predicate = new Predicate<String>() {
+                @Override
+                public boolean apply(final String input) {
+                    return input.startsWith(name);
+                }
+            };
+
+            this.skipLength = name.length();
+        }
 
-    private final Set<String> capabilities;
+        private String from(final Iterable<String> params) {
+            final Optional<String> o = Iterables.tryFind(params, predicate);
+            if (!o.isPresent()) {
+                return null;
+            }
+
+            return o.get().substring(skipLength);
+        }
+    }
+
+    private static final Logger LOG = LoggerFactory.getLogger(NetconfSessionCapabilities.class);
+    private static final ParameterMatcher MODULE_PARAM = new ParameterMatcher("module=");
+    private static final ParameterMatcher REVISION_PARAM = new ParameterMatcher("revision=");
+    private static final ParameterMatcher BROKEN_REVISON_PARAM = new ParameterMatcher("amp;revision=");
+    private static final Splitter AMP_SPLITTER = Splitter.on('&');
+    private static final Predicate<String> CONTAINS_REVISION = new Predicate<String>() {
+        @Override
+        public boolean apply(final String input) {
+            return input.contains("revision=");
+        }
+    };
 
     private final Set<QName> moduleBasedCaps;
+    private final Set<String> nonModuleCaps;
 
-    private NetconfSessionCapabilities(final Set<String> capabilities, final Set<QName> moduleBasedCaps) {
-        this.capabilities = capabilities;
-        this.moduleBasedCaps = moduleBasedCaps;
+    private NetconfSessionCapabilities(final Set<String> nonModuleCaps, final Set<QName> moduleBasedCaps) {
+        this.nonModuleCaps = Preconditions.checkNotNull(nonModuleCaps);
+        this.moduleBasedCaps = Preconditions.checkNotNull(moduleBasedCaps);
     }
 
     public Set<QName> getModuleBasedCaps() {
         return moduleBasedCaps;
     }
 
-    public boolean containsCapability(final String capability) {
-        return capabilities.contains(capability);
+    public Set<String> getNonModuleCaps() {
+        return nonModuleCaps;
     }
 
-    public boolean containsCapability(final QName capability) {
+    public boolean containsNonModuleCapability(final String capability) {
+        return nonModuleCaps.contains(capability);
+    }
+
+    public boolean containsModuleCapability(final QName capability) {
         return moduleBasedCaps.contains(capability);
     }
 
     @Override
     public String toString() {
         return Objects.toStringHelper(this)
-                .add("capabilities", capabilities)
+                .add("capabilities", nonModuleCaps)
+                .add("moduleBasedCapabilities", moduleBasedCaps)
                 .add("rollback", isRollbackSupported())
                 .add("monitoring", isMonitoringSupported())
                 .toString();
     }
 
     public boolean isRollbackSupported() {
-        return containsCapability(NetconfMessageTransformUtil.NETCONF_ROLLBACK_ON_ERROR_URI.toString());
+        return containsNonModuleCapability(NetconfMessageTransformUtil.NETCONF_ROLLBACK_ON_ERROR_URI.toString());
+    }
+
+    public boolean isCandidateSupported() {
+        return containsNonModuleCapability(NetconfMessageTransformUtil.NETCONF_CANDIDATE_URI.toString());
     }
 
     public boolean isMonitoringSupported() {
-        return containsCapability(NetconfMessageTransformUtil.IETF_NETCONF_MONITORING)
-                || containsCapability(NetconfMessageTransformUtil.IETF_NETCONF_MONITORING.getNamespace().toString());
+        return containsModuleCapability(NetconfMessageTransformUtil.IETF_NETCONF_MONITORING)
+                || containsNonModuleCapability(NetconfMessageTransformUtil.IETF_NETCONF_MONITORING.getNamespace().toString());
+    }
+
+    public NetconfSessionCapabilities replaceModuleCaps(final NetconfSessionCapabilities netconfSessionModuleCapabilities) {
+        final Set<QName> moduleBasedCaps = Sets.newHashSet(netconfSessionModuleCapabilities.getModuleBasedCaps());
+
+        // Preserve monitoring module, since it indicates support for ietf-netconf-monitoring
+        if(containsModuleCapability(NetconfMessageTransformUtil.IETF_NETCONF_MONITORING)) {
+            moduleBasedCaps.add(NetconfMessageTransformUtil.IETF_NETCONF_MONITORING);
+        }
+        return new NetconfSessionCapabilities(getNonModuleCaps(), moduleBasedCaps);
     }
 
     public static NetconfSessionCapabilities fromNetconfSession(final NetconfClientSession session) {
@@ -65,47 +120,48 @@ public final class NetconfSessionCapabilities {
     }
 
     public static NetconfSessionCapabilities fromStrings(final Collection<String> capabilities) {
-        final Set<QName> moduleBasedCaps = Sets.newHashSet();
+        final Set<QName> moduleBasedCaps = new HashSet<>();
+        final Set<String> nonModuleCaps = Sets.newHashSet(capabilities);
 
         for (final String capability : capabilities) {
-            if(isModuleBasedCapability(capability)) {
-                final String[] parts = capability.split("\\?");
-                final String namespace = parts[0];
-                final FluentIterable<String> queryParams = FluentIterable.from(Arrays.asList(parts[1].split("&")));
-
-                String revision = getStringAndTransform(queryParams, "revision=", "revision=");
-
-                final String moduleName = getStringAndTransform(queryParams, "module=", "module=");
+            final int qmark = capability.indexOf('?');
+            if (qmark == -1) {
+                continue;
+            }
 
-                if (revision == null) {
-                    logger.debug("Netconf device was not reporting revision correctly, trying to get amp;revision=");
-                    revision = getStringAndTransform(queryParams, "amp;revision=", "amp;revision=");
+            final String namespace = capability.substring(0, qmark);
+            final Iterable<String> queryParams = AMP_SPLITTER.split(capability.substring(qmark + 1));
+            final String moduleName = MODULE_PARAM.from(queryParams);
+            if (moduleName == null) {
+                continue;
+            }
 
-                    if (revision == null) {
-                        logger.warn("Netconf device returned revision incorrectly escaped for {}", capability);
-                    }
-                }
+            String revision = REVISION_PARAM.from(queryParams);
+            if (revision != null) {
                 moduleBasedCaps.add(QName.create(namespace, revision, moduleName));
+                nonModuleCaps.remove(capability);
+                continue;
             }
-        }
-
-        return new NetconfSessionCapabilities(Sets.newHashSet(capabilities), moduleBasedCaps);
-    }
 
-    private static boolean isModuleBasedCapability(final String capability) {
-        return capability.contains("?") && capability.contains("module=") && capability.contains("revision=");
-    }
+            /*
+             * We have seen devices which mis-escape revision, but the revision may not
+             * even be there. First check if there is a substring that matches revision.
+             */
+            if (!Iterables.any(queryParams, CONTAINS_REVISION)) {
+                continue;
+            }
 
-    private static String getStringAndTransform(final Iterable<String> queryParams, final String match,
-                                                final String substringToRemove) {
-        final Optional<String> found = Iterables.tryFind(queryParams, new Predicate<String>() {
-            @Override
-            public boolean apply(final String input) {
-                return input.startsWith(match);
+            LOG.debug("Netconf device was not reporting revision correctly, trying to get amp;revision=");
+            revision = BROKEN_REVISON_PARAM.from(queryParams);
+            if (revision == null) {
+                LOG.warn("Netconf device returned revision incorrectly escaped for {}, ignoring it", capability);
             }
-        });
 
-        return found.isPresent() ? found.get().replaceAll(substringToRemove, "") : null;
-    }
+            // FIXME: do we really want to continue here?
+            moduleBasedCaps.add(QName.create(namespace, revision, moduleName));
+            nonModuleCaps.remove(capability);
+        }
 
+        return new NetconfSessionCapabilities(ImmutableSet.copyOf(nonModuleCaps), ImmutableSet.copyOf(moduleBasedCaps));
+    }
 }
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceCommitHandler.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceCommitHandler.java
deleted file mode 100644 (file)
index 26c6a27..0000000
+++ /dev/null
@@ -1,85 +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.connect.netconf.sal;
-
-import java.util.concurrent.ExecutionException;
-
-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.connect.util.RemoteDeviceId;
-import org.opendaylight.controller.sal.core.api.RpcImplementation;
-import org.opendaylight.yangtools.yang.common.RpcError;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class NetconfDeviceCommitHandler implements DataCommitHandler<InstanceIdentifier,CompositeNode> {
-
-    private static final Logger logger= LoggerFactory.getLogger(NetconfDeviceCommitHandler.class);
-
-    private final RemoteDeviceId id;
-    private final RpcImplementation rpc;
-    private final boolean rollbackSupported;
-
-    public NetconfDeviceCommitHandler(final RemoteDeviceId id, final RpcImplementation rpc, final boolean rollbackSupported) {
-        this.id = id;
-        this.rpc = rpc;
-        this.rollbackSupported = rollbackSupported;
-    }
-
-    @Override
-    public DataCommitTransaction<InstanceIdentifier, CompositeNode> requestCommit(
-            final DataModification<InstanceIdentifier, CompositeNode> modification) {
-
-        final NetconfDeviceTwoPhaseCommitTransaction twoPhaseCommit = new NetconfDeviceTwoPhaseCommitTransaction(id, rpc,
-                modification, true, rollbackSupported);
-        try {
-            twoPhaseCommit.prepare();
-        } catch (final InterruptedException e) {
-            Thread.currentThread().interrupt();
-            throw new RuntimeException(id + ": Interrupted while waiting for response", e);
-        } catch (final ExecutionException e) {
-            logger.warn("{}: Error executing pre commit operation on remote device", id, e);
-            return new FailingTransaction(twoPhaseCommit, e);
-        }
-
-        return twoPhaseCommit;
-    }
-
-    /**
-     * Always fail commit transaction that rolls back delegate transaction afterwards
-     */
-    private class FailingTransaction implements DataCommitTransaction<InstanceIdentifier, CompositeNode> {
-        private final NetconfDeviceTwoPhaseCommitTransaction twoPhaseCommit;
-        private final ExecutionException e;
-
-        public FailingTransaction(final NetconfDeviceTwoPhaseCommitTransaction twoPhaseCommit, final ExecutionException e) {
-            this.twoPhaseCommit = twoPhaseCommit;
-            this.e = e;
-        }
-
-        @Override
-        public DataModification<InstanceIdentifier, CompositeNode> getModification() {
-            return twoPhaseCommit.getModification();
-        }
-
-        @Override
-        public RpcResult<Void> finish() throws IllegalStateException {
-            return RpcResultBuilder.<Void>failed().withError( RpcError.ErrorType.APPLICATION,
-                    id + ": Unexpected operation error during pre-commit operations", e ).build();
-        }
-
-        @Override
-        public RpcResult<Void> rollback() throws IllegalStateException {
-            return twoPhaseCommit.rollback();
-        }
-    }
-}
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceDataBroker.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceDataBroker.java
new file mode 100644 (file)
index 0000000..f3a9acd
--- /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.sal.connect.netconf.sal;
+
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizer;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataChangeListener;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
+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.api.DOMTransactionChain;
+import org.opendaylight.controller.sal.connect.netconf.listener.NetconfSessionCapabilities;
+import org.opendaylight.controller.sal.connect.netconf.sal.tx.NetconfDeviceReadOnlyTx;
+import org.opendaylight.controller.sal.connect.netconf.sal.tx.NetconfDeviceReadWriteTx;
+import org.opendaylight.controller.sal.connect.netconf.sal.tx.NetconfDeviceWriteOnlyTx;
+import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+final class NetconfDeviceDataBroker implements DOMDataBroker {
+    private final RemoteDeviceId id;
+    private final RpcImplementation rpc;
+    private final NetconfSessionCapabilities netconfSessionPreferences;
+    private final DataNormalizer normalizer;
+
+    public NetconfDeviceDataBroker(final RemoteDeviceId id, final RpcImplementation rpc, final SchemaContext schemaContext, NetconfSessionCapabilities netconfSessionPreferences) {
+        this.id = id;
+        this.rpc = rpc;
+        this.netconfSessionPreferences = netconfSessionPreferences;
+        normalizer = new DataNormalizer(schemaContext);
+    }
+
+    @Override
+    public DOMDataReadOnlyTransaction newReadOnlyTransaction() {
+        return new NetconfDeviceReadOnlyTx(rpc, normalizer, id);
+    }
+
+    @Override
+    public DOMDataReadWriteTransaction newReadWriteTransaction() {
+        return new NetconfDeviceReadWriteTx(newReadOnlyTransaction(), newWriteOnlyTransaction());
+    }
+
+    @Override
+    public DOMDataWriteTransaction newWriteOnlyTransaction() {
+        return new NetconfDeviceWriteOnlyTx(id, rpc, normalizer, netconfSessionPreferences.isCandidateSupported(), netconfSessionPreferences.isRollbackSupported());
+    }
+
+    @Override
+    public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store, final YangInstanceIdentifier path, final DOMDataChangeListener listener, final DataChangeScope triggeringScope) {
+        throw new UnsupportedOperationException("Data change listeners not supported for netconf mount point");
+    }
+
+    @Override
+    public DOMTransactionChain createTransactionChain(final TransactionChainListener listener) {
+        // TODO implement
+        throw new UnsupportedOperationException("Transaction chains not supported for netconf mount point");
+    }
+}
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceDataReader.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceDataReader.java
deleted file mode 100644 (file)
index 3535c96..0000000
+++ /dev/null
@@ -1,100 +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.connect.netconf.sal;
-
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.CONFIG_SOURCE_RUNNING;
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_DATA_QNAME;
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_GET_CONFIG_QNAME;
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_GET_QNAME;
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.toFilterStructure;
-
-import java.util.concurrent.ExecutionException;
-
-import org.opendaylight.controller.md.sal.common.api.data.DataReader;
-import org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil;
-import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
-import org.opendaylight.controller.sal.core.api.RpcImplementation;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.Node;
-import org.opendaylight.yangtools.yang.data.api.SimpleNode;
-
-public final class NetconfDeviceDataReader implements DataReader<InstanceIdentifier,CompositeNode> {
-
-    private final RpcImplementation rpc;
-    private final RemoteDeviceId id;
-
-    public NetconfDeviceDataReader(final RemoteDeviceId id, final RpcImplementation rpc) {
-        this.id = id;
-        this.rpc = rpc;
-    }
-
-    @Override
-    public CompositeNode readConfigurationData(final InstanceIdentifier path) {
-        final RpcResult<CompositeNode> result;
-        try {
-            result = rpc.invokeRpc(NETCONF_GET_CONFIG_QNAME,
-                    NetconfMessageTransformUtil.wrap(NETCONF_GET_CONFIG_QNAME, CONFIG_SOURCE_RUNNING, toFilterStructure(path))).get();
-        } catch (final InterruptedException e) {
-            throw onInterruptedException(e);
-        } catch (final ExecutionException e) {
-            throw new RuntimeException(id + ": Read configuration data " + path + " failed", e);
-        }
-
-        final CompositeNode data = result.getResult().getFirstCompositeByName(NETCONF_DATA_QNAME);
-        return data == null ? null : (CompositeNode) findNode(data, path);
-    }
-
-    private RuntimeException onInterruptedException(final InterruptedException e) {
-        Thread.currentThread().interrupt();
-        return new RuntimeException(id + ": Interrupted while waiting for response", e);
-    }
-
-    @Override
-    public CompositeNode readOperationalData(final InstanceIdentifier path) {
-        final RpcResult<CompositeNode> result;
-        try {
-            result = rpc.invokeRpc(NETCONF_GET_QNAME, NetconfMessageTransformUtil.wrap(NETCONF_GET_QNAME, toFilterStructure(path))).get();
-        } catch (final InterruptedException e) {
-            throw onInterruptedException(e);
-        } catch (final ExecutionException e) {
-            throw new RuntimeException(id + ": Read operational data " + path + " failed", e);
-        }
-
-        final CompositeNode data = result.getResult().getFirstCompositeByName(NETCONF_DATA_QNAME);
-        return (CompositeNode) findNode(data, path);
-    }
-
-    private static Node<?> findNode(final CompositeNode node, final InstanceIdentifier identifier) {
-
-        Node<?> current = node;
-        for (final InstanceIdentifier.PathArgument arg : identifier.getPathArguments()) {
-            if (current instanceof SimpleNode<?>) {
-                return null;
-            } else if (current instanceof CompositeNode) {
-                final CompositeNode currentComposite = (CompositeNode) current;
-
-                current = currentComposite.getFirstCompositeByName(arg.getNodeType());
-                if (current == null) {
-                    current = currentComposite.getFirstCompositeByName(arg.getNodeType().withoutRevision());
-                }
-                if (current == null) {
-                    current = currentComposite.getFirstSimpleByName(arg.getNodeType());
-                }
-                if (current == null) {
-                    current = currentComposite.getFirstSimpleByName(arg.getNodeType().withoutRevision());
-                }
-                if (current == null) {
-                    return null;
-                }
-            }
-        }
-        return current;
-    }
-}
index e491496eed79af22628301f3497437d33aefa4b0..04d5e5e449e1f00305a8be995b3861d7ef24e47b 100644 (file)
@@ -8,27 +8,28 @@
 package org.opendaylight.controller.sal.connect.netconf.sal;
 
 import com.google.common.base.Function;
+import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.FluentIterable;
+import com.google.common.util.concurrent.CheckedFuture;
 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;
 import java.util.Set;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
+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.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.inventory.rev140108.NetconfNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.inventory.rev140108.NetconfNodeBuilder;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -42,123 +43,86 @@ final class NetconfDeviceDatastoreAdapter implements AutoCloseable {
     private static final Logger logger  = LoggerFactory.getLogger(NetconfDeviceDatastoreAdapter.class);
 
     private final RemoteDeviceId id;
-    private final DataProviderService dataService;
-    private final ListeningExecutorService executor;
+    private final DataBroker dataService;
 
-    NetconfDeviceDatastoreAdapter(final RemoteDeviceId deviceId, final DataProviderService dataService,
-            final ExecutorService executor) {
+    NetconfDeviceDatastoreAdapter(final RemoteDeviceId deviceId, final DataBroker dataService) {
         this.id = Preconditions.checkNotNull(deviceId);
         this.dataService = Preconditions.checkNotNull(dataService);
-        this.executor = MoreExecutors.listeningDecorator(Preconditions.checkNotNull(executor));
 
-        // Initial data change scheduled
-        submitDataChangeToExecutor(this.executor, new Runnable() {
-            @Override
-            public void run() {
-                initDeviceData();
-            }
-        }, deviceId);
+        initDeviceData();
     }
 
     public void updateDeviceState(final boolean up, final Set<QName> capabilities) {
-        submitDataChangeToExecutor(this.executor, new Runnable() {
-            @Override
-            public void run() {
-                updateDeviceStateInternal(up, capabilities);
-            }
-        }, id);
-    }
-
-    private void updateDeviceStateInternal(final boolean up, final Set<QName> capabilities) {
         final org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node data = buildDataForDeviceState(
                 up, capabilities, id);
 
-        final DataModificationTransaction transaction = dataService.beginTransaction();
-        logger.trace("{}: Update device state transaction {} putting operational data started.", id, transaction.getIdentifier());
-        transaction.removeOperationalData(id.getBindingPath());
-        transaction.putOperationalData(id.getBindingPath(), data);
-        logger.trace("{}: Update device state transaction {} putting operational data ended.", id, transaction.getIdentifier());
+        final ReadWriteTransaction transaction = dataService.newReadWriteTransaction();
+        logger.trace("{}: Update device state transaction {} merging operational data started.", id, transaction.getIdentifier());
+        transaction.merge(LogicalDatastoreType.OPERATIONAL, id.getBindingPath(), data);
+        logger.trace("{}: Update device state transaction {} merging operational data ended.", id, transaction.getIdentifier());
 
         commitTransaction(transaction, "update");
     }
 
     private void removeDeviceConfigAndState() {
-        final DataModificationTransaction transaction = dataService.beginTransaction();
+        final WriteTransaction transaction = dataService.newWriteOnlyTransaction();
         logger.trace("{}: Close device state transaction {} removing all data started.", id, transaction.getIdentifier());
-        transaction.removeConfigurationData(id.getBindingPath());
-        transaction.removeOperationalData(id.getBindingPath());
+        transaction.delete(LogicalDatastoreType.CONFIGURATION, id.getBindingPath());
+        transaction.delete(LogicalDatastoreType.OPERATIONAL, id.getBindingPath());
         logger.trace("{}: Close device state transaction {} removing all data ended.", id, transaction.getIdentifier());
 
         commitTransaction(transaction, "close");
     }
 
     private void initDeviceData() {
-        final DataModificationTransaction transaction = dataService.beginTransaction();
+        final WriteTransaction transaction = dataService.newWriteOnlyTransaction();
 
-        final InstanceIdentifier<Node> path = id.getBindingPath();
+        createNodesListIfNotPresent(transaction);
 
+        final InstanceIdentifier<Node> path = id.getBindingPath();
         final Node nodeWithId = getNodeWithId(id);
-        if (operationalNodeNotExisting(transaction, path)) {
-            transaction.putOperationalData(path, nodeWithId);
-        }
-        if (configurationNodeNotExisting(transaction, path)) {
-            transaction.putConfigurationData(path, nodeWithId);
-        }
 
-        commitTransaction(transaction, "init");
-    }
+        logger.trace("{}: Init device state transaction {} putting if absent operational data started.", id, transaction.getIdentifier());
+        transaction.merge(LogicalDatastoreType.OPERATIONAL, path, nodeWithId);
+        logger.trace("{}: Init device state transaction {} putting operational data ended.", id, transaction.getIdentifier());
 
-    private void commitTransaction(final DataModificationTransaction transaction, final String txType) {
-        // attempt commit
-        final RpcResult<TransactionStatus> result;
-        try {
-            result = transaction.commit().get();
-        } catch (InterruptedException | ExecutionException e) {
-            logger.error("{}: Transaction({}) failed", id, txType, e);
-            throw new IllegalStateException(id + " Transaction(" + txType + ") not committed correctly", e);
-        }
-
-        // verify success result + committed state
-        if (isUpdateSuccessful(result)) {
-            logger.trace("{}: Transaction({}) {} SUCCESSFUL", id, txType, transaction.getIdentifier());
-        } else {
-            logger.error("{}: Transaction({}) {} FAILED!", id, txType, transaction.getIdentifier());
-            throw new IllegalStateException(id + "  Transaction(" + txType + ") not committed correctly, " +
-                    "Errors: " + result.getErrors());
-        }
-    }
+        logger.trace("{}: Init device state transaction {} putting if absent config data started.", id, transaction.getIdentifier());
+        transaction.merge(LogicalDatastoreType.CONFIGURATION, path, nodeWithId);
+        logger.trace("{}: Init device state transaction {} putting config data ended.", id, transaction.getIdentifier());
 
-    @Override
-    public void close() throws Exception {
-        // Remove device data from datastore
-        submitDataChangeToExecutor(executor, new Runnable() {
-            @Override
-            public void run() {
-                removeDeviceConfigAndState();
-            }
-        }, id);
+        commitTransaction(transaction, "init");
     }
 
-    private static boolean isUpdateSuccessful(final RpcResult<TransactionStatus> result) {
-        return result.getResult() == TransactionStatus.COMMITED && result.isSuccessful();
+    private void createNodesListIfNotPresent(final WriteTransaction writeTx) {
+        final Nodes nodes = new NodesBuilder().build();
+        final InstanceIdentifier<Nodes> path = InstanceIdentifier.builder(Nodes.class).build();
+        logger.trace("{}: Merging {} container to ensure its presence", id, Nodes.QNAME, writeTx.getIdentifier());
+        writeTx.merge(LogicalDatastoreType.CONFIGURATION, path, nodes);
+        writeTx.merge(LogicalDatastoreType.OPERATIONAL, path, nodes);
     }
 
-    private static void submitDataChangeToExecutor(final ListeningExecutorService executor, final Runnable r,
-            final RemoteDeviceId id) {
-        // Submit data change
-        final ListenableFuture<?> f = executor.submit(r);
-        // Verify update execution
-        Futures.addCallback(f, new FutureCallback<Object>() {
+    private void commitTransaction(final WriteTransaction transaction, final String txType) {
+        logger.trace("{}: Committing Transaction {}:{}", id, txType, transaction.getIdentifier());
+        final CheckedFuture<Void, TransactionCommitFailedException> result = transaction.submit();
+
+        Futures.addCallback(result, new FutureCallback<Void>() {
             @Override
-            public void onSuccess(final Object result) {
-                logger.debug("{}: Device data updated successfully", id);
+            public void onSuccess(final Void result) {
+                logger.trace("{}: Transaction({}) {} SUCCESSFUL", id, txType, transaction.getIdentifier());
             }
 
             @Override
             public void onFailure(final Throwable t) {
-                logger.warn("{}: Device data update failed", id, t);
+                logger.error("{}: Transaction({}) {} FAILED!", id, txType, transaction.getIdentifier(), t);
+                throw new IllegalStateException(id + "  Transaction(" + txType + ") not committed correctly", t);
             }
         });
+
+    }
+
+    @Override
+    public void close() throws Exception {
+        removeDeviceConfigAndState();
     }
 
     public static org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node buildDataForDeviceState(
@@ -179,14 +143,11 @@ final class NetconfDeviceDatastoreAdapter implements AutoCloseable {
         return nodeBuilder.build();
     }
 
-    private static boolean configurationNodeNotExisting(final DataModificationTransaction transaction,
-            final InstanceIdentifier<Node> path) {
-        return null == transaction.readConfigurationData(path);
-    }
-
-    private static boolean operationalNodeNotExisting(final DataModificationTransaction transaction,
+    private static ListenableFuture<Optional<Node>> readNodeData(
+            final LogicalDatastoreType store,
+            final ReadWriteTransaction transaction,
             final InstanceIdentifier<Node> path) {
-        return null == transaction.readOperationalData(path);
+        return transaction.read(store, path);
     }
 
     private static Node getNodeWithId(final RemoteDeviceId id) {
index 8d5b7aed2f4482b7730d764598e2fd56f44c25a1..a0453bce550f3c91120fdc4808ab0f9650fff715 100644 (file)
@@ -44,6 +44,8 @@ public final class NetconfDeviceRpc implements RpcImplementation {
         return Collections.emptySet();
     }
 
+    // TODO change this to work with NormalizedNode api. Then we can loose DataNormalizer from Transactions
+
     @Override
     public ListenableFuture<RpcResult<CompositeNode>> invokeRpc(final QName rpc, final CompositeNode input) {
         final NetconfMessage message = transformRequest(rpc, input);
index 37b87045d5f0f9061f9c276183fb6fc156879060..dbef290197b91ea2e7eb55e19fbb9363cadace16 100644 (file)
@@ -7,32 +7,40 @@
  */
 package org.opendaylight.controller.sal.connect.netconf.sal;
 
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ExecutorService;
+
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.connect.api.RemoteDeviceHandler;
 import org.opendaylight.controller.sal.connect.netconf.listener.NetconfSessionCapabilities;
 import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
 import org.opendaylight.controller.sal.core.api.Broker;
 import org.opendaylight.controller.sal.core.api.RpcImplementation;
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
+import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
+import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
+import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService;
+import org.opendaylight.controller.sal.dom.broker.impl.NotificationRouterImpl;
+import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareRpcBroker;
+import org.opendaylight.controller.sal.dom.broker.spi.NotificationRouter;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
 import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
 public final class NetconfDeviceSalFacade implements AutoCloseable, RemoteDeviceHandler<NetconfSessionCapabilities> {
 
     private static final Logger logger= LoggerFactory.getLogger(NetconfDeviceSalFacade.class);
-    private static final InstanceIdentifier ROOT_PATH = InstanceIdentifier.builder().toInstance();
 
     private final RemoteDeviceId id;
     private final NetconfDeviceSalProvider salProvider;
@@ -58,24 +66,50 @@ public final class NetconfDeviceSalFacade implements AutoCloseable, RemoteDevice
     @Override
     public synchronized void onDeviceConnected(final SchemaContextProvider remoteSchemaContextProvider,
                                                final NetconfSessionCapabilities netconfSessionPreferences, final RpcImplementation deviceRpc) {
-        salProvider.getMountInstance().setSchemaContext(remoteSchemaContextProvider.getSchemaContext());
+        final SchemaContext schemaContext = remoteSchemaContextProvider.getSchemaContext();
+
+        // TODO remove deprecated SchemaContextProvider from SchemaAwareRpcBroker
+        // TODO move SchemaAwareRpcBroker from sal-broker-impl, now we have depend on the whole sal-broker-impl
+        final RpcProvisionRegistry rpcRegistry = new SchemaAwareRpcBroker(id.getPath().toString(), new org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProvider() {
+            @Override
+            public SchemaContext getSchemaContext() {
+                return schemaContext;
+            }
+        });
+        registerRpcsToSal(schemaContext, rpcRegistry, deviceRpc);
+        final DOMDataBroker domBroker = new NetconfDeviceDataBroker(id, deviceRpc, schemaContext, netconfSessionPreferences);
+
+        // TODO NotificationPublishService and NotificationRouter have the same interface
+        final NotificationPublishService notificationService = new NotificationPublishService() {
+
+            private final NotificationRouter innerRouter = new NotificationRouterImpl();
+
+            @Override
+            public void publish(final CompositeNode notification) {
+                innerRouter.publish(notification);
+            }
+
+            @Override
+            public ListenerRegistration<NotificationListener> addNotificationListener(final QName notification, final NotificationListener listener) {
+                return innerRouter.addNotificationListener(notification, listener);
+            }
+        };
+
+        salProvider.getMountInstance().onDeviceConnected(schemaContext, domBroker, rpcRegistry, notificationService);
         salProvider.getDatastoreAdapter().updateDeviceState(true, netconfSessionPreferences.getModuleBasedCaps());
-        registerDataHandlersToSal(deviceRpc, netconfSessionPreferences);
-        registerRpcsToSal(deviceRpc);
     }
 
     @Override
     public void onDeviceDisconnected() {
         salProvider.getDatastoreAdapter().updateDeviceState(false, Collections.<QName>emptySet());
+        salProvider.getMountInstance().onDeviceDisconnected();
     }
 
-    private void registerRpcsToSal(final RpcImplementation deviceRpc) {
-        final MountProvisionInstance mountInstance = salProvider.getMountInstance();
-
+    private void registerRpcsToSal(final SchemaContext schemaContext, final RpcProvisionRegistry rpcRegistry, final RpcImplementation deviceRpc) {
         final Map<QName, String> failedRpcs = Maps.newHashMap();
-        for (final RpcDefinition rpcDef : mountInstance.getSchemaContext().getOperations()) {
+        for (final RpcDefinition rpcDef : schemaContext.getOperations()) {
             try {
-                salRegistrations.add(mountInstance.addRpcImplementation(rpcDef.getQName(), deviceRpc));
+                salRegistrations.add(rpcRegistry.addRpcImplementation(rpcDef.getQName(), deviceRpc));
                 logger.debug("{}: Rpc {} from netconf registered successfully", id, rpcDef.getQName());
             } catch (final Exception e) {
                 // Only debug per rpc, warn for all of them at the end to pollute log a little less (e.g. routed rpcs)
@@ -94,18 +128,6 @@ public final class NetconfDeviceSalFacade implements AutoCloseable, RemoteDevice
         }
     }
 
-    private void registerDataHandlersToSal(final RpcImplementation deviceRpc,
-            final NetconfSessionCapabilities netconfSessionPreferences) {
-        final NetconfDeviceDataReader dataReader = new NetconfDeviceDataReader(id, deviceRpc);
-        final NetconfDeviceCommitHandler commitHandler = new NetconfDeviceCommitHandler(id, deviceRpc,
-                netconfSessionPreferences.isRollbackSupported());
-
-        final MountProvisionInstance mountInstance = salProvider.getMountInstance();
-        salRegistrations.add(mountInstance.registerConfigurationReader(ROOT_PATH, dataReader));
-        salRegistrations.add(mountInstance.registerOperationalReader(ROOT_PATH, dataReader));
-        salRegistrations.add(mountInstance.registerCommitHandler(ROOT_PATH, commitHandler));
-    }
-
     @Override
     public void close() {
         for (final AutoCloseable reg : Lists.reverse(salRegistrations)) {
index fc54bfbc3d8f0b93ec58d9df664b26815a500184..cf9174dd50d707ef36c5e80deefce3ea8f8be20c 100644 (file)
@@ -11,15 +11,21 @@ import com.google.common.base.Preconditions;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.concurrent.ExecutorService;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
 import org.opendaylight.controller.sal.core.api.Broker;
 import org.opendaylight.controller.sal.core.api.Provider;
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
+import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
+import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
 import org.opendaylight.yangtools.yang.binding.RpcService;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -29,17 +35,17 @@ final class NetconfDeviceSalProvider implements AutoCloseable, Provider, Binding
 
     private final RemoteDeviceId id;
     private final ExecutorService executor;
-    private volatile MountProvisionInstance mountInstance;
     private volatile NetconfDeviceDatastoreAdapter datastoreAdapter;
+    private MountInstance mountInstance;
 
     public NetconfDeviceSalProvider(final RemoteDeviceId deviceId, final ExecutorService executor) {
         this.id = deviceId;
         this.executor = executor;
     }
 
-    public MountProvisionInstance getMountInstance() {
+    public MountInstance getMountInstance() {
         Preconditions.checkState(mountInstance != null,
-                "%s: Sal provider was not initialized by sal. Cannot get mount instance", id);
+                "%s: Mount instance was not initialized by sal. Cannot get mount instance", id);
         return mountInstance;
     }
 
@@ -51,12 +57,12 @@ final class NetconfDeviceSalProvider implements AutoCloseable, Provider, Binding
 
     @Override
     public void onSessionInitiated(final Broker.ProviderSession session) {
-        final MountProvisionService mountService = session.getService(MountProvisionService.class);
+        logger.debug("{}: (BI)Session with sal established {}", id, session);
+
+        final DOMMountPointService mountService = session.getService(DOMMountPointService.class);
         if (mountService != null) {
-            mountInstance = mountService.createOrGetMountPoint(id.getPath());
+            mountInstance = new MountInstance(mountService, id);
         }
-
-        logger.debug("{}: (BI)Session with sal established {}", id, session);
     }
 
     @Override
@@ -76,20 +82,78 @@ final class NetconfDeviceSalProvider implements AutoCloseable, Provider, Binding
 
     @Override
     public void onSessionInitiated(final BindingAwareBroker.ProviderContext session) {
-        final DataProviderService dataBroker = session.getSALService(DataProviderService.class);
-        datastoreAdapter = new NetconfDeviceDatastoreAdapter(id, dataBroker, executor);
-
         logger.debug("{}: Session with sal established {}", id, session);
+
+        final DataBroker dataBroker = session.getSALService(DataBroker.class);
+        datastoreAdapter = new NetconfDeviceDatastoreAdapter(id, dataBroker);
     }
 
     @Override
-    public void onSessionInitialized(final BindingAwareBroker.ConsumerContext session) {
-    }
+    public void onSessionInitialized(final BindingAwareBroker.ConsumerContext session) {}
 
     public void close() throws Exception {
-        mountInstance = null;
+        mountInstance.close();
         datastoreAdapter.close();
         datastoreAdapter = null;
     }
 
+    static final class MountInstance implements AutoCloseable {
+
+        private DOMMountPointService mountService;
+        private final RemoteDeviceId id;
+        private ObjectRegistration<DOMMountPoint> registration;
+        private NotificationPublishService notificationSerivce;
+
+        MountInstance(final DOMMountPointService mountService, final RemoteDeviceId id) {
+            this.mountService = Preconditions.checkNotNull(mountService);
+            this.id = Preconditions.checkNotNull(id);
+        }
+
+        synchronized void onDeviceConnected(final SchemaContext initialCtx,
+                final DOMDataBroker broker, final RpcProvisionRegistry rpc,
+                final NotificationPublishService notificationSerivce) {
+
+            Preconditions.checkNotNull(mountService, "Closed");
+            Preconditions.checkState(registration == null, "Already initialized");
+
+            final DOMMountPointService.DOMMountPointBuilder mountBuilder = mountService.createMountPoint(id.getPath());
+            mountBuilder.addInitialSchemaContext(initialCtx);
+
+            mountBuilder.addService(DOMDataBroker.class, broker);
+            mountBuilder.addService(RpcProvisionRegistry.class, rpc);
+            this.notificationSerivce = notificationSerivce;
+            mountBuilder.addService(NotificationPublishService.class, notificationSerivce);
+
+            registration = mountBuilder.register();
+        }
+
+        synchronized void onDeviceDisconnected() {
+            if(registration == null) {
+                return;
+            }
+
+            try {
+                registration.close();
+            } catch (final Exception e) {
+                // Only log and ignore
+                logger.warn("Unable to unregister mount instance for {}. Ignoring exception", id.getPath(), e);
+            } finally {
+                registration = null;
+            }
+        }
+
+        @Override
+        synchronized public void close() throws Exception {
+            if(registration != null) {
+                onDeviceDisconnected();
+            }
+            mountService = null;
+        }
+
+        public synchronized void publish(final CompositeNode domNotification) {
+            Preconditions.checkNotNull(notificationSerivce, "Device not set up yet, cannot handle notification {}", domNotification);
+            notificationSerivce.publish(domNotification);
+        }
+    }
+
 }
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceTwoPhaseCommitTransaction.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceTwoPhaseCommitTransaction.java
deleted file mode 100644 (file)
index 960f2ef..0000000
+++ /dev/null
@@ -1,269 +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.connect.netconf.sal;
-
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_CANDIDATE_QNAME;
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_COMMIT_QNAME;
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_CONFIG_QNAME;
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_DEFAULT_OPERATION_QNAME;
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_EDIT_CONFIG_QNAME;
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_ERROR_OPTION_QNAME;
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_OPERATION_QNAME;
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_RUNNING_QNAME;
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_TARGET_QNAME;
-import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.ROLLBACK_ON_ERROR_OPTION;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.concurrent.ExecutionException;
-
-import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
-import org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil;
-import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
-import org.opendaylight.controller.sal.core.api.RpcImplementation;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.RpcError;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
-import org.opendaylight.yangtools.yang.data.api.ModifyAction;
-import org.opendaylight.yangtools.yang.data.api.Node;
-import org.opendaylight.yangtools.yang.data.api.SimpleNode;
-import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
-import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
-import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *  Remote transaction that delegates data change to remote device using netconf messages.
- */
-final class NetconfDeviceTwoPhaseCommitTransaction implements DataCommitTransaction<InstanceIdentifier, CompositeNode> {
-
-    private static final Logger LOG = LoggerFactory.getLogger(NetconfDeviceTwoPhaseCommitTransaction.class);
-
-    private final DataModification<InstanceIdentifier, CompositeNode> modification;
-    private final RpcImplementation rpc;
-    private final boolean rollbackSupported;
-    private final RemoteDeviceId id;
-    private final CompositeNode targetNode;
-
-    public NetconfDeviceTwoPhaseCommitTransaction(final RemoteDeviceId id, final RpcImplementation rpc,
-            final DataModification<InstanceIdentifier, CompositeNode> modification,
-            final boolean candidateSupported, final boolean rollbackOnErrorSupported) {
-        this.id = id;
-        this.rpc = Preconditions.checkNotNull(rpc);
-        this.modification = Preconditions.checkNotNull(modification);
-        this.targetNode = getTargetNode(candidateSupported);
-        this.rollbackSupported = rollbackOnErrorSupported;
-    }
-
-    /**
-     * Prepare phase, sends 1 or more netconf edit config operations to modify the data
-     *
-     * In case of failure or unexpected error response, ExecutionException is thrown
-     */
-    void prepare() throws InterruptedException, ExecutionException {
-        for (final InstanceIdentifier toRemove : modification.getRemovedConfigurationData()) {
-            sendDelete(toRemove);
-        }
-        for(final Entry<InstanceIdentifier, CompositeNode> toUpdate : modification.getUpdatedConfigurationData().entrySet()) {
-            sendMerge(toUpdate.getKey(),toUpdate.getValue());
-        }
-    }
-
-    private void sendMerge(final InstanceIdentifier key, final CompositeNode value) throws InterruptedException, ExecutionException {
-        sendEditRpc(createEditConfigStructure(key, Optional.<ModifyAction>absent(), Optional.of(value)), Optional.<ModifyAction>absent());
-    }
-
-    private void sendDelete(final InstanceIdentifier toDelete) throws InterruptedException, ExecutionException {
-        sendEditRpc(createEditConfigStructure(toDelete, Optional.of(ModifyAction.DELETE), Optional.<CompositeNode>absent()), Optional.of(ModifyAction.NONE));
-    }
-
-    private void sendEditRpc(final CompositeNode editStructure, final Optional<ModifyAction> defaultOperation) throws InterruptedException, ExecutionException {
-        final ImmutableCompositeNode editConfigRequest = createEditConfigRequest(editStructure, defaultOperation);
-        final RpcResult<CompositeNode> rpcResult = rpc.invokeRpc(NETCONF_EDIT_CONFIG_QNAME, editConfigRequest).get();
-
-        // Check result
-        if(rpcResult.isSuccessful() == false) {
-            throw new ExecutionException(
-                    String.format("%s: Pre-commit rpc failed, request: %s, errors: %s", id, editConfigRequest, rpcResult.getErrors()), null);
-        }
-    }
-
-    private ImmutableCompositeNode createEditConfigRequest(final CompositeNode editStructure, final Optional<ModifyAction> defaultOperation) {
-        final CompositeNodeBuilder<ImmutableCompositeNode> ret = ImmutableCompositeNode.builder();
-
-        // Target
-        final Node<?> targetWrapperNode = ImmutableCompositeNode.create(NETCONF_TARGET_QNAME, ImmutableList.<Node<?>>of(targetNode));
-        ret.add(targetWrapperNode);
-
-        // Default operation
-        if(defaultOperation.isPresent()) {
-            final SimpleNode<String> defOp = NodeFactory.createImmutableSimpleNode(NETCONF_DEFAULT_OPERATION_QNAME, null, modifyOperationToXmlString(defaultOperation.get()));
-            ret.add(defOp);
-        }
-
-        // Error option
-        if(rollbackSupported) {
-            ret.addLeaf(NETCONF_ERROR_OPTION_QNAME, ROLLBACK_ON_ERROR_OPTION);
-        }
-
-        ret.setQName(NETCONF_EDIT_CONFIG_QNAME);
-        // Edit content
-        ret.add(editStructure);
-        return ret.toInstance();
-    }
-
-    private CompositeNode createEditConfigStructure(final InstanceIdentifier dataPath, final Optional<ModifyAction> operation,
-            final Optional<CompositeNode> lastChildOverride) {
-        Preconditions.checkArgument(Iterables.isEmpty(dataPath.getPathArguments()) == false, "Instance identifier with empty path %s", dataPath);
-
-        List<PathArgument> reversedPath = Lists.reverse(dataPath.getPath());
-
-        // Create deepest edit element with expected edit operation
-        CompositeNode previous = getDeepestEditElement(reversedPath.get(0), operation, lastChildOverride);
-
-        // Remove already processed deepest child
-        reversedPath = Lists.newArrayList(reversedPath);
-        reversedPath.remove(0);
-
-        // Create edit structure in reversed order
-        for (final PathArgument arg : reversedPath) {
-            final CompositeNodeBuilder<ImmutableCompositeNode> builder = ImmutableCompositeNode.builder();
-            builder.setQName(arg.getNodeType());
-
-            addPredicatesToCompositeNodeBuilder(getPredicates(arg), builder);
-
-            builder.add(previous);
-            previous = builder.toInstance();
-        }
-        return ImmutableCompositeNode.create(NETCONF_CONFIG_QNAME, ImmutableList.<Node<?>>of(previous));
-    }
-
-    private void addPredicatesToCompositeNodeBuilder(final Map<QName, Object> predicates, final CompositeNodeBuilder<ImmutableCompositeNode> builder) {
-        for (final Entry<QName, Object> entry : predicates.entrySet()) {
-            builder.addLeaf(entry.getKey(), entry.getValue());
-        }
-    }
-
-    private Map<QName, Object> getPredicates(final PathArgument arg) {
-        Map<QName, Object> predicates = Collections.emptyMap();
-        if (arg instanceof NodeIdentifierWithPredicates) {
-            predicates = ((NodeIdentifierWithPredicates) arg).getKeyValues();
-        }
-        return predicates;
-    }
-
-    private CompositeNode getDeepestEditElement(final PathArgument arg, final Optional<ModifyAction> operation, final Optional<CompositeNode> lastChildOverride) {
-        final CompositeNodeBuilder<ImmutableCompositeNode> builder = ImmutableCompositeNode.builder();
-        builder.setQName(arg.getNodeType());
-
-        final Map<QName, Object> predicates = getPredicates(arg);
-        addPredicatesToCompositeNodeBuilder(predicates, builder);
-
-        if (operation.isPresent()) {
-            builder.setAttribute(NETCONF_OPERATION_QNAME, modifyOperationToXmlString(operation.get()));
-        }
-        if (lastChildOverride.isPresent()) {
-            final List<Node<?>> children = lastChildOverride.get().getValue();
-            for(final Node<?> child : children) {
-                if(!predicates.containsKey(child.getKey())) {
-                    builder.add(child);
-                }
-            }
-        }
-
-        return builder.toInstance();
-    }
-
-    private String modifyOperationToXmlString(final ModifyAction operation) {
-        return operation.name().toLowerCase();
-    }
-
-    /**
-     * Send commit rpc to finish the transaction
-     * In case of failure or unexpected error response, ExecutionException is thrown
-     */
-    @Override
-    public RpcResult<Void> finish() {
-        try {
-            final RpcResult<?> rpcResult = rpc.invokeRpc(NetconfMessageTransformUtil.NETCONF_COMMIT_QNAME, getCommitRequest()).get();
-            return new RpcResultVoidWrapper(rpcResult);
-        } catch (final InterruptedException e) {
-            Thread.currentThread().interrupt();
-            throw new RuntimeException(id + ": Interrupted while waiting for response", e);
-        } catch (final ExecutionException e) {
-            LOG.warn("{}: Failed to finish commit operation", id, e);
-            return RpcResultBuilder.<Void>failed().withError( RpcError.ErrorType.APPLICATION,
-                            id + ": Unexpected operation error during commit operation", e ).build();
-        }
-    }
-
-    private ImmutableCompositeNode getCommitRequest() {
-        final CompositeNodeBuilder<ImmutableCompositeNode> commitInput = ImmutableCompositeNode.builder();
-        commitInput.setQName(NETCONF_COMMIT_QNAME);
-        return commitInput.toInstance();
-    }
-
-    @Override
-    public DataModification<InstanceIdentifier, CompositeNode> getModification() {
-        return this.modification;
-    }
-
-    @Override
-    public RpcResult<Void> rollback() throws IllegalStateException {
-        // TODO BUG-732 implement rollback by sending discard changes
-        return null;
-    }
-
-    public CompositeNode getTargetNode(final boolean candidateSupported) {
-        if(candidateSupported) {
-            return ImmutableCompositeNode.create(NETCONF_CANDIDATE_QNAME, ImmutableList.<Node<?>>of());
-        } else {
-            return ImmutableCompositeNode.create(NETCONF_RUNNING_QNAME, ImmutableList.<Node<?>>of());
-        }
-    }
-
-    private static final class RpcResultVoidWrapper implements RpcResult<Void> {
-
-        private final RpcResult<?> rpcResult;
-
-        public RpcResultVoidWrapper(final RpcResult<?> rpcResult) {
-            this.rpcResult = rpcResult;
-        }
-
-        @Override
-        public boolean isSuccessful() {
-            return rpcResult.isSuccessful();
-        }
-
-        @Override
-        public Void getResult() {
-            return null;
-        }
-
-        @Override
-        public Collection<RpcError> getErrors() {
-            return rpcResult.getErrors();
-        }
-    }
-}
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/NetconfDeviceReadOnlyTx.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/NetconfDeviceReadOnlyTx.java
new file mode 100644 (file)
index 0000000..9ef44f6
--- /dev/null
@@ -0,0 +1,166 @@
+/*
+ * 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.connect.netconf.sal.tx;
+
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.CONFIG_SOURCE_RUNNING;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_DATA_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_GET_CONFIG_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_GET_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.toFilterStructure;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationException;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizer;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
+import org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil;
+import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.api.SimpleNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public final class NetconfDeviceReadOnlyTx implements DOMDataReadOnlyTransaction {
+
+    private static final Logger LOG  = LoggerFactory.getLogger(NetconfDeviceReadOnlyTx.class);
+
+    private final RpcImplementation rpc;
+    private final DataNormalizer normalizer;
+    private final RemoteDeviceId id;
+
+    public NetconfDeviceReadOnlyTx(final RpcImplementation rpc, final DataNormalizer normalizer, final RemoteDeviceId id) {
+        this.rpc = rpc;
+        this.normalizer = normalizer;
+        this.id = id;
+    }
+
+    public ListenableFuture<Optional<NormalizedNode<?, ?>>> readConfigurationData(final YangInstanceIdentifier path) {
+        final ListenableFuture<RpcResult<CompositeNode>> future = rpc.invokeRpc(NETCONF_GET_CONFIG_QNAME,
+                NetconfMessageTransformUtil.wrap(NETCONF_GET_CONFIG_QNAME, CONFIG_SOURCE_RUNNING, toFilterStructure(path)));
+
+        return Futures.transform(future, new Function<RpcResult<CompositeNode>, Optional<NormalizedNode<?, ?>>>() {
+            @Override
+            public Optional<NormalizedNode<?, ?>> apply(final RpcResult<CompositeNode> result) {
+                checkReadSuccess(result, path);
+
+                final CompositeNode data = result.getResult().getFirstCompositeByName(NETCONF_DATA_QNAME);
+                final CompositeNode node = (CompositeNode) findNode(data, path);
+
+                return data == null ?
+                        Optional.<NormalizedNode<?, ?>>absent() :
+                        transform(path, node);
+            }
+        });
+    }
+
+    private void checkReadSuccess(final RpcResult<CompositeNode> result, final YangInstanceIdentifier path) {
+        LOG.warn("{}: Unable to read data: {}, errors: {}", id, path, result.getErrors());
+        Preconditions.checkArgument(result.isSuccessful(), "%s: Unable to read data: %s, errors: %s", id, path, result.getErrors());
+    }
+
+    private Optional<NormalizedNode<?, ?>> transform(final YangInstanceIdentifier path, final CompositeNode node) {
+        if(node == null) {
+            return Optional.absent();
+        }
+        try {
+            return Optional.<NormalizedNode<?, ?>>of(normalizer.toNormalized(path, node).getValue());
+        } catch (final Exception e) {
+            LOG.error("{}: Unable to normalize data for {}, data: {}", id, path, node, e);
+            throw e;
+        }
+    }
+
+    public ListenableFuture<Optional<NormalizedNode<?, ?>>> readOperationalData(final YangInstanceIdentifier path) {
+        final ListenableFuture<RpcResult<CompositeNode>> future = rpc.invokeRpc(NETCONF_GET_QNAME, NetconfMessageTransformUtil.wrap(NETCONF_GET_QNAME, toFilterStructure(path)));
+
+        return Futures.transform(future, new Function<RpcResult<CompositeNode>, Optional<NormalizedNode<?, ?>>>() {
+            @Override
+            public Optional<NormalizedNode<?, ?>> apply(final RpcResult<CompositeNode> result) {
+                checkReadSuccess(result, path);
+
+                final CompositeNode data = result.getResult().getFirstCompositeByName(NETCONF_DATA_QNAME);
+                final CompositeNode node = (CompositeNode) findNode(data, path);
+
+                return data == null ?
+                        Optional.<NormalizedNode<?, ?>>absent() :
+                        transform(path, node);
+            }
+        });
+    }
+
+    private static Node<?> findNode(final CompositeNode node, final YangInstanceIdentifier identifier) {
+
+        Node<?> current = node;
+        for (final YangInstanceIdentifier.PathArgument arg : identifier.getPathArguments()) {
+            if (current instanceof SimpleNode<?>) {
+                return null;
+            } else if (current instanceof CompositeNode) {
+                final CompositeNode currentComposite = (CompositeNode) current;
+
+                current = currentComposite.getFirstCompositeByName(arg.getNodeType());
+                if (current == null) {
+                    current = currentComposite.getFirstCompositeByName(arg.getNodeType().withoutRevision());
+                }
+                if (current == null) {
+                    current = currentComposite.getFirstSimpleByName(arg.getNodeType());
+                }
+                if (current == null) {
+                    current = currentComposite.getFirstSimpleByName(arg.getNodeType().withoutRevision());
+                }
+                if (current == null) {
+                    return null;
+                }
+            }
+        }
+        return current;
+    }
+
+    @Override
+    public void close() {
+        // NOOP
+    }
+
+    @Override
+    public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+        final YangInstanceIdentifier legacyPath = toLegacyPath(normalizer, path, id);
+
+        switch (store) {
+            case CONFIGURATION : {
+                return readConfigurationData(legacyPath);
+            }
+            case OPERATIONAL : {
+                return readOperationalData(legacyPath);
+            }
+        }
+
+        throw new IllegalArgumentException(String.format("%s, Cannot read data %s for %s datastore, unknown datastore type", id, path, store));
+    }
+
+    static YangInstanceIdentifier toLegacyPath(final DataNormalizer normalizer, final YangInstanceIdentifier path, final RemoteDeviceId id) {
+        try {
+            return normalizer.toLegacy(path);
+        } catch (final DataNormalizationException e) {
+            throw new IllegalArgumentException(id + ": Cannot normalize path " + path, e);
+        }
+    }
+
+    @Override
+    public Object getIdentifier() {
+        return this;
+    }
+}
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/NetconfDeviceReadWriteTx.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/NetconfDeviceReadWriteTx.java
new file mode 100644 (file)
index 0000000..4054cf9
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * 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.connect.netconf.sal.tx;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.ListenableFuture;
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+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.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+
+public class NetconfDeviceReadWriteTx implements DOMDataReadWriteTransaction {
+
+    private final DOMDataReadTransaction delegateReadTx;
+    private final DOMDataWriteTransaction delegateWriteTx;
+
+    public NetconfDeviceReadWriteTx(final DOMDataReadTransaction delegateReadTx, final DOMDataWriteTransaction delegateWriteTx) {
+        this.delegateReadTx = delegateReadTx;
+        this.delegateWriteTx = delegateWriteTx;
+    }
+
+    @Override
+    public boolean cancel() {
+        return delegateWriteTx.cancel();
+    }
+
+    @Override
+    public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+        delegateWriteTx.put(store, path, data);
+    }
+
+    @Override
+    public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+        delegateWriteTx.merge(store, path, data);
+    }
+
+    @Override
+    public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+        delegateWriteTx.delete(store, path);
+    }
+
+    @Override
+    public CheckedFuture<Void, TransactionCommitFailedException> submit() {
+        return delegateWriteTx.submit();
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<TransactionStatus>> commit() {
+        return delegateWriteTx.commit();
+    }
+
+    @Override
+    public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+        return delegateReadTx.read(store, path);
+    }
+
+    @Override
+    public Object getIdentifier() {
+        return this;
+    }
+}
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/NetconfDeviceWriteOnlyTx.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/NetconfDeviceWriteOnlyTx.java
new file mode 100644 (file)
index 0000000..87f5477
--- /dev/null
@@ -0,0 +1,361 @@
+/*
+ * 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.connect.netconf.sal.tx;
+
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.DISCARD_CHANGES_RPC_CONTENT;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_CANDIDATE_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_CONFIG_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_DEFAULT_OPERATION_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_DISCARD_CHANGES_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_EDIT_CONFIG_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_ERROR_OPTION_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_OPERATION_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_RUNNING_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.NETCONF_TARGET_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.ROLLBACK_ON_ERROR_OPTION;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizer;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
+import org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil;
+import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.ModifyAction;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.api.SimpleNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
+import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
+import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class NetconfDeviceWriteOnlyTx implements DOMDataWriteTransaction, FutureCallback<RpcResult<TransactionStatus>> {
+
+    private static final Logger LOG  = LoggerFactory.getLogger(NetconfDeviceWriteOnlyTx.class);
+
+    private final RemoteDeviceId id;
+    private final RpcImplementation rpc;
+    private final DataNormalizer normalizer;
+
+    private final boolean rollbackSupported;
+    private final boolean candidateSupported;
+    private final CompositeNode targetNode;
+
+    // Allow commit to be called only once
+    private final AtomicBoolean finished = new AtomicBoolean(false);
+
+    public NetconfDeviceWriteOnlyTx(final RemoteDeviceId id, final RpcImplementation rpc, final DataNormalizer normalizer, final boolean candidateSupported, final boolean rollbackOnErrorSupported) {
+        this.id = id;
+        this.rpc = rpc;
+        this.normalizer = normalizer;
+
+        this.candidateSupported = candidateSupported;
+        this.targetNode = getTargetNode(this.candidateSupported);
+        this.rollbackSupported = rollbackOnErrorSupported;
+    }
+
+    @Override
+    public boolean cancel() {
+        if(isFinished()) {
+            return false;
+        }
+
+        return discardChanges();
+    }
+
+    private boolean isFinished() {
+        return finished.get();
+    }
+
+    private boolean discardChanges() {
+        finished.set(true);
+
+        if(candidateSupported) {
+            sendDiscardChanges();
+        }
+        return true;
+    }
+
+    // TODO should the edit operations be blocking ?
+    // TODO should the discard-changes operations be blocking ?
+
+    @Override
+    public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+        checkNotFinished();
+        Preconditions.checkArgument(store == LogicalDatastoreType.CONFIGURATION, "Can merge only configuration, not %s", store);
+
+        try {
+            final YangInstanceIdentifier legacyPath = NetconfDeviceReadOnlyTx.toLegacyPath(normalizer, path, id);
+            final CompositeNode legacyData = normalizer.toLegacy(path, data);
+            sendEditRpc(
+                    createEditConfigStructure(legacyPath, Optional.of(ModifyAction.REPLACE), Optional.fromNullable(legacyData)), Optional.of(ModifyAction.NONE));
+        } catch (final ExecutionException e) {
+            LOG.warn("{}: Error putting data to {}, data: {}, discarding changes", id, path, data, e);
+            discardChanges();
+            throw new RuntimeException(id + ": Error while replacing " + path, e);
+        }
+    }
+
+    private void checkNotFinished() {
+        Preconditions.checkState(isFinished() == false, "%s: Transaction %s already finished", id, getIdentifier());
+    }
+
+    @Override
+    public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+        checkNotFinished();
+        Preconditions.checkArgument(store == LogicalDatastoreType.CONFIGURATION, "%s: Can merge only configuration, not %s", id, store);
+
+        try {
+            final YangInstanceIdentifier legacyPath = NetconfDeviceReadOnlyTx.toLegacyPath(normalizer, path, id);
+            final CompositeNode legacyData = normalizer.toLegacy(path, data);
+            sendEditRpc(
+                    createEditConfigStructure(legacyPath, Optional.<ModifyAction> absent(), Optional.fromNullable(legacyData)), Optional.<ModifyAction> absent());
+        } catch (final ExecutionException e) {
+            LOG.warn("{}: Error merging data to {}, data: {}, discarding changes", id, path, data, e);
+            discardChanges();
+            throw new RuntimeException(id + ": Error while merging " + path, e);
+        }
+    }
+
+    @Override
+    public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
+        checkNotFinished();
+        Preconditions.checkArgument(store == LogicalDatastoreType.CONFIGURATION, "%s: Can merge only configuration, not %s", id, store);
+
+        try {
+            sendEditRpc(
+                    createEditConfigStructure(NetconfDeviceReadOnlyTx.toLegacyPath(normalizer, path, id), Optional.of(ModifyAction.DELETE), Optional.<CompositeNode>absent()), Optional.of(ModifyAction.NONE));
+        } catch (final ExecutionException e) {
+            LOG.warn("{}: Error deleting data {}, discarding changes", id, path, e);
+            discardChanges();
+            throw new RuntimeException(id + ": Error while deleting " + path, e);
+        }
+    }
+
+    @Override
+    public CheckedFuture<Void, TransactionCommitFailedException> submit() {
+        final ListenableFuture<Void> commmitFutureAsVoid = Futures.transform(commit(), new Function<RpcResult<TransactionStatus>, Void>() {
+            @Override
+            public Void apply(final RpcResult<TransactionStatus> input) {
+                return null;
+            }
+        });
+
+        return Futures.makeChecked(commmitFutureAsVoid, new Function<Exception, TransactionCommitFailedException>() {
+            @Override
+            public TransactionCommitFailedException apply(final Exception input) {
+                return new TransactionCommitFailedException("Submit of transaction " + getIdentifier() + " failed", input);
+            }
+        });
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<TransactionStatus>> commit() {
+        checkNotFinished();
+        finished.set(true);
+
+        if(candidateSupported == false) {
+            return Futures.immediateFuture(RpcResultBuilder.success(TransactionStatus.COMMITED).build());
+        }
+
+        final ListenableFuture<RpcResult<CompositeNode>> rpcResult = rpc.invokeRpc(
+                NetconfMessageTransformUtil.NETCONF_COMMIT_QNAME, NetconfMessageTransformUtil.COMMIT_RPC_CONTENT);
+
+        final ListenableFuture<RpcResult<TransactionStatus>> transformed = Futures.transform(rpcResult,
+                new Function<RpcResult<CompositeNode>, RpcResult<TransactionStatus>>() {
+                    @Override
+                    public RpcResult<TransactionStatus> apply(final RpcResult<CompositeNode> input) {
+                        if (input.isSuccessful()) {
+                            return RpcResultBuilder.success(TransactionStatus.COMMITED).build();
+                        } else {
+                            final RpcResultBuilder<TransactionStatus> failed = RpcResultBuilder.failed();
+                            for (final RpcError rpcError : input.getErrors()) {
+                                failed.withError(rpcError.getErrorType(), rpcError.getTag(), rpcError.getMessage(),
+                                        rpcError.getApplicationTag(), rpcError.getInfo(), rpcError.getCause());
+                            }
+                            return failed.build();
+                        }
+                    }
+                });
+
+        Futures.addCallback(transformed, this);
+        return transformed;
+    }
+
+    @Override
+    public void onSuccess(final RpcResult<TransactionStatus> result) {
+        LOG.debug("{}: Write successful, transaction: {}", id, getIdentifier());
+    }
+
+    @Override
+    public void onFailure(final Throwable t) {
+        LOG.warn("{}: Write failed, transaction {}, discarding changes", id, getIdentifier(), t);
+        discardChanges();
+    }
+
+    private void sendEditRpc(final CompositeNode editStructure, final Optional<ModifyAction> defaultOperation) throws ExecutionException {
+        final CompositeNode editConfigRequest = createEditConfigRequest(editStructure, defaultOperation);
+        final RpcResult<CompositeNode> rpcResult;
+        try {
+            rpcResult = rpc.invokeRpc(NETCONF_EDIT_CONFIG_QNAME, editConfigRequest).get();
+        } catch (final InterruptedException e) {
+            Thread.currentThread().interrupt();
+            throw new RuntimeException(id + ": Interrupted while waiting for response", e);
+        }
+
+        // Check result
+        if(rpcResult.isSuccessful() == false) {
+            throw new ExecutionException(
+                    String.format("%s: Pre-commit rpc failed, request: %s, errors: %s", id, editConfigRequest, rpcResult.getErrors()), null);
+        }
+    }
+
+    private void sendDiscardChanges() {
+        final ListenableFuture<RpcResult<CompositeNode>> discardFuture = rpc.invokeRpc(NETCONF_DISCARD_CHANGES_QNAME, DISCARD_CHANGES_RPC_CONTENT);
+        Futures.addCallback(discardFuture, new FutureCallback<RpcResult<CompositeNode>>() {
+            @Override
+            public void onSuccess(final RpcResult<CompositeNode> result) {
+                LOG.debug("{}: Discarding transaction: {}", id, getIdentifier());
+            }
+
+            @Override
+            public void onFailure(final Throwable t) {
+                LOG.error("{}: Discarding changes failed, transaction: {}. Device configuration might be corrupted", id, getIdentifier(), t);
+                throw new RuntimeException(id + ": Discarding changes failed, transaction " + getIdentifier(), t);
+            }
+        });
+    }
+
+    private CompositeNode createEditConfigStructure(final YangInstanceIdentifier dataPath, final Optional<ModifyAction> operation,
+                                                    final Optional<CompositeNode> lastChildOverride) {
+        Preconditions.checkArgument(Iterables.isEmpty(dataPath.getPathArguments()) == false, "Instance identifier with empty path %s", dataPath);
+
+        List<YangInstanceIdentifier.PathArgument> reversedPath = Lists.reverse(dataPath.getPath());
+
+        // Create deepest edit element with expected edit operation
+        CompositeNode previous = getDeepestEditElement(reversedPath.get(0), operation, lastChildOverride);
+
+        // Remove already processed deepest child
+        reversedPath = Lists.newArrayList(reversedPath);
+        reversedPath.remove(0);
+
+        // Create edit structure in reversed order
+        for (final YangInstanceIdentifier.PathArgument arg : reversedPath) {
+            final CompositeNodeBuilder<ImmutableCompositeNode> builder = ImmutableCompositeNode.builder();
+            builder.setQName(arg.getNodeType());
+
+            addPredicatesToCompositeNodeBuilder(getPredicates(arg), builder);
+
+            builder.add(previous);
+            previous = builder.toInstance();
+        }
+        return ImmutableCompositeNode.create(NETCONF_CONFIG_QNAME, ImmutableList.<Node<?>>of(previous));
+    }
+
+    private void addPredicatesToCompositeNodeBuilder(final Map<QName, Object> predicates, final CompositeNodeBuilder<ImmutableCompositeNode> builder) {
+        for (final Map.Entry<QName, Object> entry : predicates.entrySet()) {
+            builder.addLeaf(entry.getKey(), entry.getValue());
+        }
+    }
+
+    private Map<QName, Object> getPredicates(final YangInstanceIdentifier.PathArgument arg) {
+        Map<QName, Object> predicates = Collections.emptyMap();
+        if (arg instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates) {
+            predicates = ((YangInstanceIdentifier.NodeIdentifierWithPredicates) arg).getKeyValues();
+        }
+        return predicates;
+    }
+
+    private CompositeNode getDeepestEditElement(final YangInstanceIdentifier.PathArgument arg, final Optional<ModifyAction> operation, final Optional<CompositeNode> lastChildOverride) {
+        final CompositeNodeBuilder<ImmutableCompositeNode> builder = ImmutableCompositeNode.builder();
+        builder.setQName(arg.getNodeType());
+
+        final Map<QName, Object> predicates = getPredicates(arg);
+        addPredicatesToCompositeNodeBuilder(predicates, builder);
+
+        if (operation.isPresent()) {
+            builder.setAttribute(NETCONF_OPERATION_QNAME, modifyOperationToXmlString(operation.get()));
+        }
+        if (lastChildOverride.isPresent()) {
+            final List<Node<?>> children = lastChildOverride.get().getValue();
+            for(final Node<?> child : children) {
+                if(!predicates.containsKey(child.getKey())) {
+                    builder.add(child);
+                }
+            }
+        }
+
+        return builder.toInstance();
+    }
+
+    private CompositeNode createEditConfigRequest(final CompositeNode editStructure, final Optional<ModifyAction> defaultOperation) {
+        final CompositeNodeBuilder<ImmutableCompositeNode> ret = ImmutableCompositeNode.builder();
+
+        // Target
+        final Node<?> targetWrapperNode = ImmutableCompositeNode.create(NETCONF_TARGET_QNAME, ImmutableList.<Node<?>>of(targetNode));
+        ret.add(targetWrapperNode);
+
+        // Default operation
+        if(defaultOperation.isPresent()) {
+            final SimpleNode<String> defOp = NodeFactory.createImmutableSimpleNode(NETCONF_DEFAULT_OPERATION_QNAME, null, modifyOperationToXmlString(defaultOperation.get()));
+            ret.add(defOp);
+        }
+
+        // Error option
+        if(rollbackSupported) {
+            ret.addLeaf(NETCONF_ERROR_OPTION_QNAME, ROLLBACK_ON_ERROR_OPTION);
+        }
+
+        ret.setQName(NETCONF_EDIT_CONFIG_QNAME);
+        // Edit content
+        ret.add(editStructure);
+        return ret.toInstance();
+    }
+
+    private String modifyOperationToXmlString(final ModifyAction operation) {
+        return operation.name().toLowerCase();
+    }
+
+    public CompositeNode getTargetNode(final boolean candidateSupported) {
+        if(candidateSupported) {
+            return ImmutableCompositeNode.create(NETCONF_CANDIDATE_QNAME, ImmutableList.<Node<?>>of());
+        } else {
+            return ImmutableCompositeNode.create(NETCONF_RUNNING_QNAME, ImmutableList.<Node<?>>of());
+        }
+    }
+
+    @Override
+    public Object getIdentifier() {
+        return this;
+    }
+}
index 0aeec64690d971abfa7f74b1bd58385e669163fe..d3faddd471d0533c221b00cbe867a8b9d6431a12 100644 (file)
@@ -12,7 +12,6 @@ import com.google.common.collect.Collections2;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
 import java.net.URI;
@@ -29,13 +28,14 @@ import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.util.messages.NetconfMessageUtil;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcError;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.opendaylight.yangtools.yang.common.RpcError.ErrorSeverity;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.Node;
 import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl;
 import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
+import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
 import org.opendaylight.yangtools.yang.data.impl.SimpleNodeTOImpl;
 import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
@@ -46,8 +46,7 @@ import org.w3c.dom.Element;
 
 public class NetconfMessageTransformUtil {
 
-    private NetconfMessageTransformUtil() {
-    }
+    private NetconfMessageTransformUtil() {}
 
     public static final QName IETF_NETCONF_MONITORING = QName.create("urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring", "2010-10-04", "ietf-netconf-monitoring");
     public static URI NETCONF_URI = URI.create("urn:ietf:params:xml:ns:netconf:base:1.0");
@@ -67,24 +66,36 @@ public class NetconfMessageTransformUtil {
     public static QName NETCONF_DEFAULT_OPERATION_QNAME = QName.create(NETCONF_OPERATION_QNAME, "default-operation");
     public static QName NETCONF_EDIT_CONFIG_QNAME = QName.create(NETCONF_QNAME, "edit-config");
     public static QName NETCONF_GET_CONFIG_QNAME = QName.create(NETCONF_QNAME, "get-config");
+    public static QName NETCONF_DISCARD_CHANGES_QNAME = QName.create(NETCONF_QNAME, "discard-changes");
     public static QName NETCONF_TYPE_QNAME = QName.create(NETCONF_QNAME, "type");
     public static QName NETCONF_FILTER_QNAME = QName.create(NETCONF_QNAME, "filter");
     public static QName NETCONF_GET_QNAME = QName.create(NETCONF_QNAME, "get");
     public static QName NETCONF_RPC_QNAME = QName.create(NETCONF_QNAME, "rpc");
+
     public static URI NETCONF_ROLLBACK_ON_ERROR_URI = URI
             .create("urn:ietf:params:netconf:capability:rollback-on-error:1.0");
     public static String ROLLBACK_ON_ERROR_OPTION = "rollback-on-error";
 
-    public static Node<?> toFilterStructure(final InstanceIdentifier identifier) {
+    public static URI NETCONF_CANDIDATE_URI = URI
+            .create("urn:ietf:params:netconf:capability:candidate:1.0");
+
+    // Discard changes message
+    public static final CompositeNode DISCARD_CHANGES_RPC_CONTENT =
+            NodeFactory.createImmutableCompositeNode(NETCONF_DISCARD_CHANGES_QNAME, null, Collections.<Node<?>>emptyList());
+
+    // Commit changes message
+    public static final CompositeNode COMMIT_RPC_CONTENT =
+            NodeFactory.createImmutableCompositeNode(NETCONF_COMMIT_QNAME, null, Collections.<Node<?>>emptyList());
+
+    public static Node<?> toFilterStructure(final YangInstanceIdentifier identifier) {
         Node<?> previous = null;
         if (Iterables.isEmpty(identifier.getPathArguments())) {
             return null;
         }
 
-        for (final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument component : Lists
-                .reverse(identifier.getPath())) {
-            if (component instanceof InstanceIdentifier.NodeIdentifierWithPredicates) {
-                previous = toNode((InstanceIdentifier.NodeIdentifierWithPredicates)component, previous);
+        for (final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument component : identifier.getReversePathArguments()) {
+            if (component instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates) {
+                previous = toNode((YangInstanceIdentifier.NodeIdentifierWithPredicates)component, previous);
             } else {
                 previous = toNode(component, previous);
             }
@@ -92,7 +103,7 @@ public class NetconfMessageTransformUtil {
         return filter("subtree", previous);
     }
 
-    static Node<?> toNode(final InstanceIdentifier.NodeIdentifierWithPredicates argument, final Node<?> node) {
+    static Node<?> toNode(final YangInstanceIdentifier.NodeIdentifierWithPredicates argument, final Node<?> node) {
         final List<Node<?>> list = new ArrayList<>();
         for (final Map.Entry<QName, Object> arg : argument.getKeyValues().entrySet()) {
             list.add(new SimpleNodeTOImpl(arg.getKey(), null, arg.getValue()));
@@ -142,12 +153,12 @@ public class NetconfMessageTransformUtil {
 
         ErrorSeverity severity = toRpcErrorSeverity( ex.getErrorSeverity() );
         return severity == ErrorSeverity.ERROR ?
-                    RpcResultBuilder.newError(
+                RpcResultBuilder.newError(
                         toRpcErrorType( ex.getErrorType() ), ex.getErrorTag().getTagValue(),
                         ex.getLocalizedMessage(), null, infoBuilder.toString(), ex.getCause() ) :
-                    RpcResultBuilder.newWarning(
-                        toRpcErrorType( ex.getErrorType() ), ex.getErrorTag().getTagValue(),
-                        ex.getLocalizedMessage(), null, infoBuilder.toString(), ex.getCause() );
+                            RpcResultBuilder.newWarning(
+                                    toRpcErrorType( ex.getErrorType() ), ex.getErrorTag().getTagValue(),
+                                    ex.getLocalizedMessage(), null, infoBuilder.toString(), ex.getCause() );
     }
 
     private static ErrorSeverity toRpcErrorSeverity( final NetconfDocumentedException.ErrorSeverity severity ) {
@@ -197,7 +208,7 @@ public class NetconfMessageTransformUtil {
         return input;
     }
 
-    static Node<?> toNode(final InstanceIdentifier.PathArgument argument, final Node<?> node) {
+    static Node<?> toNode(final YangInstanceIdentifier.PathArgument argument, final Node<?> node) {
         if (node != null) {
             return new CompositeNodeTOImpl(argument.getNodeType(), null, Collections.<Node<?>> singletonList(node));
         } else {
@@ -271,5 +282,4 @@ public class NetconfMessageTransformUtil {
             return it.toInstance();
         }
     }
-
 }
index bd075d0606b08f3f94982e32d18ecdb468b9830a..1896e69f325aee65946e264499b1022c2e696f9e 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.controller.sal.connect.netconf.util;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -36,11 +37,11 @@ class NodeContainerProxy implements ContainerSchemaNode {
         this.qName = Preconditions.checkNotNull(qName, "qName");
     }
 
-    public NodeContainerProxy(final QName qName, final Set<DataSchemaNode> childNodes) {
+    public NodeContainerProxy(final QName qName, final Collection<DataSchemaNode> childNodes) {
         this(qName, asMap(childNodes));
     }
 
-    private static Map<QName, DataSchemaNode> asMap(final Set<DataSchemaNode> childNodes) {
+    private static Map<QName, DataSchemaNode> asMap(final Collection<DataSchemaNode> childNodes) {
         final Map<QName, DataSchemaNode> mapped = Maps.newHashMap();
         for (final DataSchemaNode childNode : childNodes) {
             mapped.put(childNode.getQName(), childNode);
index 4670846c7c54a312bad4268671baea44e8dfbd87..175cb8e2077c83df44117e81baa7d0b0cd3ef6ae 100644 (file)
@@ -20,7 +20,7 @@ import org.opendaylight.yangtools.yang.common.QName;
 public class RemoteDeviceId {
 
     private final String name;
-    private final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path;
+    private final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier path;
     private final InstanceIdentifier<Node> bindingPath;
     private final NodeKey key;
 
@@ -40,9 +40,9 @@ public class RemoteDeviceId {
         return InstanceIdentifier.builder(Nodes.class).child(Node.class, key).build();
     }
 
-    private static org.opendaylight.yangtools.yang.data.api.InstanceIdentifier createBIPath(final String name) {
-        final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.InstanceIdentifierBuilder builder =
-                org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder();
+    private static org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier createBIPath(final String name) {
+        final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.InstanceIdentifierBuilder builder =
+                org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.builder();
         builder.node(Nodes.QNAME).nodeWithKey(Node.QNAME, QName.create(Node.QNAME.getNamespace(), Node.QNAME.getRevision(), "id"), name);
 
         return builder.build();
@@ -56,7 +56,7 @@ public class RemoteDeviceId {
         return bindingPath;
     }
 
-    public org.opendaylight.yangtools.yang.data.api.InstanceIdentifier getPath() {
+    public org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier getPath() {
         return path;
     }
 
index 6bad4798c290524dc04ff2d39611f2a1f0c33453..e13398b1dfd36a748bcdeb019db55b30b01c4c04 100644 (file)
@@ -58,6 +58,14 @@ module odl-sal-netconf-connector-cfg {
                 type string;
             }
 
+            container yang-module-capabilities {
+                leaf-list capability {
+                    type string;
+                    description "Set a list of capabilities to override capabilities provided in device's hello message.
+                                 Can be used for devices that do not report any yang modules in their hello message";
+                }
+            }
+
             container dom-registry {
                 uses config:service-ref {
                     refine type {
index defaab629f3684de2be6a5b1d7a578749cd493e0..46ea4ff73c40ae0d29ec267d834a19e2d88faa19 100644 (file)
@@ -102,11 +102,11 @@ public class NetconfDeviceTest {
         device.onRemoteSessionUp(sessionCaps, listener);
 
         verify(messageTransformer, timeout(10000).times(2)).toNotification(netconfMessage);
-        verify(facade, times(2)).onNotification(compositeNode);
+        verify(facade, timeout(10000).times(2)).onNotification(compositeNode);
 
         device.onNotification(netconfMessage);
-        verify(messageTransformer, times(3)).toNotification(netconfMessage);
-        verify(facade, times(3)).onNotification(compositeNode);
+        verify(messageTransformer, timeout(10000).times(3)).toNotification(netconfMessage);
+        verify(facade, timeout(10000).times(3)).onNotification(compositeNode);
     }
 
     @Test
index 391bf9c6a42f5302ba05e078041edee50022c6af..001b9a8d3abc411b041d3f3624ea27505722560c 100644 (file)
@@ -8,35 +8,35 @@
 
 package org.opendaylight.controller.sal.connect.netconf.listener;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.same;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.reset;
+import static org.mockito.Mockito.verify;
+import static org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants.RPC_REPLY_KEY;
+import static org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Sets;
+import com.google.common.util.concurrent.ListenableFuture;
 import io.netty.channel.ChannelFuture;
 import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.GenericFutureListener;
-
 import java.io.ByteArrayInputStream;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.UUID;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
-
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.reset;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Matchers.same;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants.RPC_REPLY_KEY;
-import static org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0;
-
 import org.apache.commons.lang3.StringUtils;
 import org.junit.Before;
 import org.junit.Test;
@@ -56,10 +56,6 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-import com.google.common.base.Strings;
-import com.google.common.collect.Sets;
-import com.google.common.util.concurrent.ListenableFuture;
-
 public class NetconfDeviceCommunicatorTest {
 
     @Mock
@@ -129,9 +125,9 @@ public class NetconfDeviceCommunicatorTest {
         verify( mockDevice ).onRemoteSessionUp( netconfSessionCapabilities.capture(), eq( communicator ) );
 
         NetconfSessionCapabilities actualCapabilites = netconfSessionCapabilities.getValue();
-        assertEquals( "containsCapability", true, actualCapabilites.containsCapability(
-                                NetconfMessageTransformUtil.NETCONF_ROLLBACK_ON_ERROR_URI.toString() ) );
-        assertEquals( "containsCapability", true, actualCapabilites.containsCapability( testCapability ) );
+        assertEquals( "containsModuleCapability", true, actualCapabilites.containsNonModuleCapability(
+                NetconfMessageTransformUtil.NETCONF_ROLLBACK_ON_ERROR_URI.toString()) );
+        assertEquals( "containsModuleCapability", false, actualCapabilites.containsNonModuleCapability(testCapability) );
         assertEquals( "getModuleBasedCaps", Sets.newHashSet(
                             QName.create( "urn:opendaylight:params:xml:ns:test", "2014-06-02", "test-module" )),
                       actualCapabilites.getModuleBasedCaps() );
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/listener/NetconfSessionCapabilitiesTest.java b/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/listener/NetconfSessionCapabilitiesTest.java
new file mode 100644 (file)
index 0000000..87947b5
--- /dev/null
@@ -0,0 +1,50 @@
+package org.opendaylight.controller.sal.connect.netconf.listener;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
+import com.google.common.collect.Lists;
+import java.util.List;
+import org.junit.Test;
+import org.junit.matchers.JUnitMatchers;
+import org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil;
+import org.opendaylight.yangtools.yang.common.QName;
+
+public class NetconfSessionCapabilitiesTest {
+
+    @Test
+    public void testMerge() throws Exception {
+        final List<String> caps1 = Lists.newArrayList(
+                "namespace:1?module=module1&revision=2012-12-12",
+                "namespace:2?module=module2&amp;revision=2012-12-12",
+                "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring?module=ietf-netconf-monitoring&amp;revision=2010-10-04",
+                "urn:ietf:params:netconf:base:1.0",
+                "urn:ietf:params:netconf:capability:rollback-on-error:1.0"
+        );
+        final NetconfSessionCapabilities sessionCaps1 = NetconfSessionCapabilities.fromStrings(caps1);
+        assertCaps(sessionCaps1, 2, 3);
+
+        final List<String> caps2 = Lists.newArrayList(
+                "namespace:3?module=module3&revision=2012-12-12",
+                "namespace:4?module=module4&revision=2012-12-12",
+                "randomNonModuleCap"
+        );
+        final NetconfSessionCapabilities sessionCaps2 = NetconfSessionCapabilities.fromStrings(caps2);
+        assertCaps(sessionCaps2, 1, 2);
+
+        final NetconfSessionCapabilities merged = sessionCaps1.replaceModuleCaps(sessionCaps2);
+        assertCaps(merged, 2, 2 + 1 /*Preserved monitoring*/);
+        for (final QName qName : sessionCaps2.getModuleBasedCaps()) {
+            assertThat(merged.getModuleBasedCaps(), JUnitMatchers.hasItem(qName));
+        }
+        assertThat(merged.getModuleBasedCaps(), JUnitMatchers.hasItem(NetconfMessageTransformUtil.IETF_NETCONF_MONITORING));
+
+        assertThat(merged.getNonModuleCaps(), JUnitMatchers.hasItem("urn:ietf:params:netconf:base:1.0"));
+        assertThat(merged.getNonModuleCaps(), JUnitMatchers.hasItem("urn:ietf:params:netconf:capability:rollback-on-error:1.0"));
+    }
+
+    private void assertCaps(final NetconfSessionCapabilities sessionCaps1, final int nonModuleCaps, final int moduleCaps) {
+        assertEquals(nonModuleCaps, sessionCaps1.getNonModuleCaps().size());
+        assertEquals(moduleCaps, sessionCaps1.getModuleBasedCaps().size());
+    }
+}
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/NetconfDeviceWriteOnlyTxTest.java b/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/sal/tx/NetconfDeviceWriteOnlyTxTest.java
new file mode 100644 (file)
index 0000000..a65e426
--- /dev/null
@@ -0,0 +1,79 @@
+package org.opendaylight.controller.sal.connect.netconf.sal.tx;
+
+import static junit.framework.Assert.fail;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil.DISCARD_CHANGES_RPC_CONTENT;
+
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.Futures;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizer;
+import org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil;
+import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+public class NetconfDeviceWriteOnlyTxTest {
+
+    private final RemoteDeviceId id = new RemoteDeviceId("test-mount");
+
+    @Mock
+    private RpcImplementation rpc;
+    @Mock
+    private DataNormalizer normalizer;
+    private YangInstanceIdentifier yangIId;
+
+    @Before
+    public void setUp() throws Exception {
+        MockitoAnnotations.initMocks(this);
+
+        doReturn(Futures.<RpcResult<CompositeNode>>immediateFailedFuture(new IllegalStateException("Failed tx")))
+        .doReturn(Futures.immediateFuture(RpcResultBuilder.<CompositeNode>success().build()))
+                .when(rpc).invokeRpc(any(QName.class), any(CompositeNode.class));
+
+        yangIId = YangInstanceIdentifier.builder().node(QName.create("namespace", "2012-12-12", "name")).build();
+        doReturn(yangIId).when(normalizer).toLegacy(yangIId);
+    }
+
+    @Test
+    public void testDiscardCahnges() {
+        final NetconfDeviceWriteOnlyTx tx = new NetconfDeviceWriteOnlyTx(id, rpc, normalizer, true, true);
+        final CheckedFuture<Void, TransactionCommitFailedException> submitFuture = tx.submit();
+        try {
+            submitFuture.checkedGet();
+        } catch (final TransactionCommitFailedException e) {
+            // verify discard changes was sent
+            verify(rpc).invokeRpc(NetconfMessageTransformUtil.NETCONF_DISCARD_CHANGES_QNAME, DISCARD_CHANGES_RPC_CONTENT);
+            return;
+        }
+
+        fail("Submit should fail");
+    }
+
+
+    @Test
+    public void testDiscardCahngesNotSentWithoutCandidate() {
+        doReturn(Futures.immediateFuture(RpcResultBuilder.<CompositeNode>success().build()))
+        .doReturn(Futures.<RpcResult<CompositeNode>>immediateFailedFuture(new IllegalStateException("Failed tx")))
+                .when(rpc).invokeRpc(any(QName.class), any(CompositeNode.class));
+
+        final NetconfDeviceWriteOnlyTx tx = new NetconfDeviceWriteOnlyTx(id, rpc, normalizer, false, true);
+        tx.delete(LogicalDatastoreType.CONFIGURATION, yangIId);
+        verify(rpc).invokeRpc(eq(NetconfMessageTransformUtil.NETCONF_EDIT_CONFIG_QNAME), any(CompositeNode.class));
+        verifyNoMoreInteractions(rpc);
+    }
+
+}
index 5254c19fcb9d80233b134c18946395b3d16dd269..28e629a92c92fa7b165a390e12e2fd89a15e2ba5 100644 (file)
   <packaging>bundle</packaging>
 
   <dependencies>
+    <dependency>
+      <groupId>com.google.code.findbugs</groupId>
+      <artifactId>jsr305</artifactId>
+      <version>2.0.1</version>
+    </dependency>
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+    </dependency>
     <dependency>
       <groupId>com.google.protobuf</groupId>
       <artifactId>protobuf-java</artifactId>
       <version>2.5.0</version>
     </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>util</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-binding</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-common</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-data-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-data-impl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-model-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-model-util</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-parser-impl</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>xmlunit</groupId>
+      <artifactId>xmlunit</artifactId>
+      <version>1.5</version>
+    </dependency>
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>${slf4j.version}</version>
+      <scope>test</scope>
     </dependency>
       <dependency>
           <groupId>org.opendaylight.yangtools</groupId>
           <groupId>org.opendaylight.yangtools</groupId>
           <artifactId>yang-binding</artifactId>
       </dependency>
+
+      <dependency>
+          <groupId>org.opendaylight.controller</groupId>
+          <artifactId>sal-akka-raft</artifactId>
+          <version>1.1-SNAPSHOT</version>
+      </dependency>
+
       <dependency>
           <groupId>com.google.guava</groupId>
           <artifactId>guava</artifactId>
index c9e586ba1a1438e7d0f949b06e4881ec63bc2697..f0907db6648e974298bb399f0956e719cd6e1552 100755 (executable)
@@ -36,3 +36,6 @@ echo "Done generating Java source files."
 
 #to remove trailing spaces in the code files
 find src/main/java -type f -name '*.java' -exec sed --in-place 's/[[:space:]]\+$//' {} \+
+
+#to remove trailing spaces in the generated code on OSX
+find src/main/java -type f -print0 |xargs -0 perl -pi -e 's/ +$//'
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NodeToNormalizedNodeBuilder.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NodeToNormalizedNodeBuilder.java
new file mode 100644 (file)
index 0000000..ce12080
--- /dev/null
@@ -0,0 +1,846 @@
+package org.opendaylight.controller.cluster.datastore.node;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import org.opendaylight.controller.cluster.datastore.node.utils.NodeIdentifierFactory;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node;
+import org.opendaylight.yangtools.concepts.Identifiable;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
+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.api.schema.NormalizedNodeContainer;
+import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
+import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeContainerBuilder;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.AugmentationTarget;
+import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+/**
+ * NormalizedNodeBuilder is a builder that walks through a tree like structure and constructs a
+ * NormalizedNode from it.
+ * <p/>
+ * A large part of this code has been copied over from a similar class in sal-common-impl which was
+ * originally supposed to convert a CompositeNode to NormalizedNode
+ *
+ * @param <T>
+ */
+public abstract class NodeToNormalizedNodeBuilder<T extends PathArgument>
+    implements Identifiable<T> {
+
+    private final T identifier;
+
+    protected static final Logger logger = LoggerFactory
+        .getLogger(NodeToNormalizedNodeBuilder.class);
+
+    @Override
+    public T getIdentifier() {
+        return identifier;
+    }
+
+    ;
+
+    protected NodeToNormalizedNodeBuilder(final T identifier) {
+        super();
+        this.identifier = identifier;
+
+    }
+
+    /**
+     * @return Should return true if the node that this operation corresponds to is a mixin
+     */
+    public boolean isMixin() {
+        return false;
+    }
+
+
+    /**
+     * @return Should return true if the node that this operation corresponds to has a 'key'
+     * associated with it. This is typically true for a list-item or leaf-list entry in yang
+     */
+    public boolean isKeyedEntry() {
+        return false;
+    }
+
+    protected Set<QName> getQNameIdentifiers() {
+        return Collections.singleton(identifier.getNodeType());
+    }
+
+    public abstract NodeToNormalizedNodeBuilder<?> getChild(
+        final PathArgument child);
+
+    public abstract NodeToNormalizedNodeBuilder<?> getChild(QName child);
+
+    public abstract NormalizedNode<?, ?> normalize(QName nodeType, Node node);
+
+
+
+    private static abstract class SimpleTypeNormalization<T extends PathArgument>
+        extends NodeToNormalizedNodeBuilder<T> {
+
+        protected SimpleTypeNormalization(final T identifier) {
+            super(identifier);
+        }
+
+        @Override
+        public NormalizedNode<?, ?> normalize(final QName nodeType,
+            final Node node) {
+            checkArgument(node != null);
+            return normalizeImpl(nodeType, node);
+        }
+
+        protected abstract NormalizedNode<?, ?> normalizeImpl(QName nodeType,
+            Node node);
+
+        @Override
+        public NodeToNormalizedNodeBuilder<?> getChild(
+            final PathArgument child) {
+            return null;
+        }
+
+        @Override
+        public NodeToNormalizedNodeBuilder<?> getChild(final QName child) {
+            return null;
+        }
+
+        @Override
+        public NormalizedNode<?, ?> createDefault(
+            final PathArgument currentArg) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+    }
+
+
+    private static final class LeafNormalization extends
+        SimpleTypeNormalization<NodeIdentifier> {
+
+        private final LeafSchemaNode schema;
+
+        protected LeafNormalization(final LeafSchemaNode schema, final NodeIdentifier identifier) {
+            super(identifier);
+            this.schema = schema;
+        }
+
+        @Override
+        protected NormalizedNode<?, ?> normalizeImpl(final QName nodeType,
+            final Node node) {
+            Object value = NodeValueCodec.toTypeSafeValue(this.schema, this.schema.getType(), node);
+            return ImmutableNodes.leafNode(nodeType, value);
+
+        }
+
+    }
+
+
+    private static final class LeafListEntryNormalization extends
+        SimpleTypeNormalization<NodeWithValue> {
+
+        private final LeafListSchemaNode schema;
+
+        public LeafListEntryNormalization(final LeafListSchemaNode potential) {
+            super(new NodeWithValue(potential.getQName(), null));
+            this.schema = potential;
+        }
+
+        @Override
+        protected NormalizedNode<?, ?> normalizeImpl(final QName nodeType,
+            final Node node) {
+            final Object data = node.getValue();
+            if (data == null) {
+                Preconditions.checkArgument(false,
+                    "No data available in leaf list entry for " + nodeType);
+            }
+
+            Object value = NodeValueCodec.toTypeSafeValue(this.schema, this.schema.getType(), node);
+
+            NodeWithValue nodeId = new NodeWithValue(nodeType, value);
+            return Builders.leafSetEntryBuilder().withNodeIdentifier(nodeId)
+                .withValue(value).build();
+        }
+
+
+        @Override
+        public boolean isKeyedEntry() {
+            return true;
+        }
+    }
+
+
+    private static abstract class NodeToNormalizationNodeOperation<T extends PathArgument>
+        extends NodeToNormalizedNodeBuilder<T> {
+
+        protected NodeToNormalizationNodeOperation(final T identifier) {
+            super(identifier);
+        }
+
+        @SuppressWarnings({"rawtypes", "unchecked"})
+        @Override
+        public final NormalizedNodeContainer<?, ?, ?> normalize(
+            final QName nodeType, final Node node) {
+            checkArgument(node != null);
+
+            if (!node.getType().equals(AugmentationNode.class.getSimpleName())
+                && !node.getType().equals(ContainerNode.class.getSimpleName())
+                && !node.getType().equals(MapNode.class.getSimpleName())) {
+                checkArgument(nodeType != null);
+            }
+
+            NormalizedNodeContainerBuilder builder = createBuilder(node);
+
+            Set<NodeToNormalizedNodeBuilder<?>> usedMixins = new HashSet<>();
+
+            logNode(node);
+
+            if (node.getChildCount() == 0 && (
+                node.getType().equals(LeafSetEntryNode.class.getSimpleName())
+                    || node.getType().equals(LeafNode.class.getSimpleName()))) {
+                PathArgument childPathArgument =
+                    NodeIdentifierFactory.getArgument(node.getPath());
+
+                final NormalizedNode child;
+                if (childPathArgument instanceof NodeWithValue) {
+                    final NodeWithValue nodeWithValue =
+                        new NodeWithValue(childPathArgument.getNodeType(),
+                            node.getValue());
+                    child =
+                        Builders.leafSetEntryBuilder()
+                            .withNodeIdentifier(nodeWithValue)
+                            .withValue(node.getValue()).build();
+                } else {
+                    child =
+                        ImmutableNodes.leafNode(childPathArgument.getNodeType(),
+                            node.getValue());
+                }
+                builder.addChild(child);
+            }
+
+            final List<Node> children = node.getChildList();
+            for (Node nodeChild : children) {
+
+                PathArgument childPathArgument =
+                    NodeIdentifierFactory.getArgument(nodeChild.getPath());
+
+                QName childNodeType = null;
+                NodeToNormalizedNodeBuilder childOp = null;
+
+                if (childPathArgument instanceof AugmentationIdentifier) {
+                    childOp = getChild(childPathArgument);
+                    checkArgument(childOp instanceof AugmentationNormalization, childPathArgument);
+                } else {
+                    childNodeType = childPathArgument.getNodeType();
+                    childOp = getChild(childNodeType);
+                }
+                // We skip unknown nodes if this node is mixin since
+                // it's nodes and parent nodes are interleaved
+                if (childOp == null && isMixin()) {
+                    continue;
+                } else if (childOp == null) {
+                    logger.error(
+                        "childOp is null and this operation is not a mixin : this = {}",
+                        this.toString());
+                }
+
+                checkArgument(childOp != null,
+                    "Node %s is not allowed inside %s",
+                    childNodeType, getIdentifier());
+
+                if (childOp.isMixin()) {
+                    if (usedMixins.contains(childOp)) {
+                        // We already run / processed that mixin, so to avoid
+                        // duplicate we are
+                        // skipping next nodes.
+                        continue;
+                    }
+                    // builder.addChild(childOp.normalize(nodeType, treeCacheNode));
+                    final NormalizedNode childNode =
+                        childOp.normalize(childNodeType, nodeChild);
+                    if (childNode != null)
+                        builder.addChild(childNode);
+                    usedMixins.add(childOp);
+                } else {
+                    final NormalizedNode childNode =
+                        childOp.normalize(childNodeType, nodeChild);
+                    if (childNode != null)
+                        builder.addChild(childNode);
+                }
+            }
+
+
+            try {
+                return (NormalizedNodeContainer<?, ?, ?>) builder.build();
+            } catch (Exception e) {
+                return null;
+            }
+
+        }
+
+        private void logNode(Node node) {
+            //let us find out the type of the node
+            logger.debug("We got a {} , with identifier {} with {} children",
+                node.getType(), node.getPath(),
+                node.getChildList());
+        }
+
+        @SuppressWarnings("rawtypes")
+        protected abstract NormalizedNodeContainerBuilder createBuilder(
+            final Node node);
+
+    }
+
+
+    private static abstract class DataContainerNormalizationOperation<T extends PathArgument>
+        extends NodeToNormalizationNodeOperation<T> {
+
+        private final DataNodeContainer schema;
+        private final Map<QName, NodeToNormalizedNodeBuilder<?>> byQName;
+        private final Map<PathArgument, NodeToNormalizedNodeBuilder<?>> byArg;
+
+        protected DataContainerNormalizationOperation(final T identifier,
+            final DataNodeContainer schema) {
+            super(identifier);
+            this.schema = schema;
+            this.byArg = new ConcurrentHashMap<>();
+            this.byQName = new ConcurrentHashMap<>();
+        }
+
+        @Override
+        public NodeToNormalizedNodeBuilder<?> getChild(
+            final PathArgument child) {
+            NodeToNormalizedNodeBuilder<?> potential = byArg.get(child);
+            if (potential != null) {
+                return potential;
+            }
+            potential = fromSchema(schema, child);
+            return register(potential);
+        }
+
+        @Override
+        public NodeToNormalizedNodeBuilder<?> getChild(final QName child) {
+            if (child == null) {
+                return null;
+            }
+
+            NodeToNormalizedNodeBuilder<?> potential = byQName.get(child);
+            if (potential != null) {
+                return potential;
+            }
+            potential = fromSchemaAndPathArgument(schema, child);
+            return register(potential);
+        }
+
+        private NodeToNormalizedNodeBuilder<?> register(
+            final NodeToNormalizedNodeBuilder<?> potential) {
+            if (potential != null) {
+                byArg.put(potential.getIdentifier(), potential);
+                for (QName qName : potential.getQNameIdentifiers()) {
+                    byQName.put(qName, potential);
+                }
+            }
+            return potential;
+        }
+
+    }
+
+
+    private static final class ListItemNormalization extends
+        DataContainerNormalizationOperation<NodeIdentifierWithPredicates> {
+
+        private final List<QName> keyDefinition;
+        private final ListSchemaNode schemaNode;
+
+        protected ListItemNormalization(
+            final NodeIdentifierWithPredicates identifier,
+            final ListSchemaNode schema) {
+            super(identifier, schema);
+            this.schemaNode = schema;
+            keyDefinition = schema.getKeyDefinition();
+        }
+
+        @Override
+        protected NormalizedNodeContainerBuilder createBuilder(
+            final Node node) {
+            NodeIdentifierWithPredicates nodeIdentifierWithPredicates =
+                (NodeIdentifierWithPredicates) NodeIdentifierFactory
+                    .createPathArgument(node
+                        .getPath(), schemaNode);
+            return Builders.mapEntryBuilder()
+                .withNodeIdentifier(
+                    nodeIdentifierWithPredicates
+            );
+        }
+
+        @Override
+        public NormalizedNode<?, ?> createDefault(
+            final PathArgument currentArg) {
+            DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode>
+                builder =
+                Builders.mapEntryBuilder().withNodeIdentifier(
+                    (NodeIdentifierWithPredicates) currentArg);
+            for (Entry<QName, Object> keyValue : ((NodeIdentifierWithPredicates) currentArg)
+                .getKeyValues().entrySet()) {
+                if (keyValue.getValue() == null) {
+                    throw new NullPointerException(
+                        "Null value found for path : "
+                            + currentArg);
+                }
+                builder.addChild(Builders.leafBuilder()
+                    //
+                    .withNodeIdentifier(new NodeIdentifier(keyValue.getKey()))
+                    .withValue(keyValue.getValue()).build());
+            }
+            return builder.build();
+        }
+
+
+        @Override
+        public boolean isKeyedEntry() {
+            return true;
+        }
+    }
+
+
+    private static final class ContainerNormalization extends
+        DataContainerNormalizationOperation<NodeIdentifier> {
+
+        protected ContainerNormalization(final ContainerSchemaNode schema) {
+            super(new NodeIdentifier(schema.getQName()), schema);
+        }
+
+        @Override
+        protected NormalizedNodeContainerBuilder createBuilder(
+            final Node node) {
+            return Builders.containerBuilder()
+                .withNodeIdentifier(getIdentifier());
+        }
+
+        @Override
+        public NormalizedNode<?, ?> createDefault(
+            final PathArgument currentArg) {
+            return Builders.containerBuilder()
+                .withNodeIdentifier((NodeIdentifier) currentArg).build();
+        }
+
+    }
+
+
+    private static abstract class MixinNormalizationOp<T extends PathArgument>
+        extends NodeToNormalizationNodeOperation<T> {
+
+        protected MixinNormalizationOp(final T identifier) {
+            super(identifier);
+        }
+
+        @Override
+        public final boolean isMixin() {
+            return true;
+        }
+
+    }
+
+
+    private static final class LeafListMixinNormalization extends
+        MixinNormalizationOp<NodeIdentifier> {
+
+        private final NodeToNormalizedNodeBuilder<?> innerOp;
+
+        public LeafListMixinNormalization(final LeafListSchemaNode potential) {
+            super(new NodeIdentifier(potential.getQName()));
+            innerOp = new LeafListEntryNormalization(potential);
+        }
+
+        @Override
+        protected NormalizedNodeContainerBuilder createBuilder(
+            final Node node) {
+            return Builders.leafSetBuilder()
+                .withNodeIdentifier(getIdentifier());
+        }
+
+        @Override
+        public NormalizedNode<?, ?> createDefault(
+            final PathArgument currentArg) {
+            return Builders.leafSetBuilder().withNodeIdentifier(getIdentifier())
+                .build();
+        }
+
+        @Override
+        public NodeToNormalizedNodeBuilder<?> getChild(
+            final PathArgument child) {
+            if (child instanceof NodeWithValue) {
+                return innerOp;
+            }
+            return null;
+        }
+
+        @Override
+        public NodeToNormalizedNodeBuilder<?> getChild(final QName child) {
+            if (getIdentifier().getNodeType().equals(child)) {
+                return innerOp;
+            }
+            return null;
+        }
+
+    }
+
+
+    private static final class AugmentationNormalization extends
+        MixinNormalizationOp<AugmentationIdentifier> {
+
+        private final Map<QName, NodeToNormalizedNodeBuilder<?>> byQName;
+        private final Map<PathArgument, NodeToNormalizedNodeBuilder<?>> byArg;
+
+        public AugmentationNormalization(final AugmentationSchema augmentation,
+            final DataNodeContainer schema) {
+            super(augmentationIdentifierFrom(augmentation));
+
+            ImmutableMap.Builder<QName, NodeToNormalizedNodeBuilder<?>>
+                byQNameBuilder =
+                ImmutableMap.builder();
+            ImmutableMap.Builder<PathArgument, NodeToNormalizedNodeBuilder<?>>
+                byArgBuilder =
+                ImmutableMap.builder();
+
+            for (DataSchemaNode augNode : augmentation.getChildNodes()) {
+                DataSchemaNode resolvedNode =
+                    schema.getDataChildByName(augNode.getQName());
+                NodeToNormalizedNodeBuilder<?> resolvedOp =
+                    fromDataSchemaNode(resolvedNode);
+                byArgBuilder.put(resolvedOp.getIdentifier(), resolvedOp);
+                for (QName resQName : resolvedOp.getQNameIdentifiers()) {
+                    byQNameBuilder.put(resQName, resolvedOp);
+                }
+            }
+            byQName = byQNameBuilder.build();
+            byArg = byArgBuilder.build();
+
+        }
+
+        @Override
+        public NodeToNormalizedNodeBuilder<?> getChild(
+            final PathArgument child) {
+            return byArg.get(child);
+        }
+
+        @Override
+        public NodeToNormalizedNodeBuilder<?> getChild(final QName child) {
+            return byQName.get(child);
+        }
+
+        @Override
+        protected Set<QName> getQNameIdentifiers() {
+            return getIdentifier().getPossibleChildNames();
+        }
+
+        @SuppressWarnings("rawtypes")
+        @Override
+        protected NormalizedNodeContainerBuilder createBuilder(
+            final Node node) {
+            return Builders.augmentationBuilder()
+                .withNodeIdentifier(getIdentifier());
+        }
+
+        @Override
+        public NormalizedNode<?, ?> createDefault(
+            final PathArgument currentArg) {
+            return Builders.augmentationBuilder()
+                .withNodeIdentifier(getIdentifier())
+                .build();
+        }
+
+    }
+
+
+    private static final class ListMixinNormalization extends
+        MixinNormalizationOp<NodeIdentifier> {
+
+        private final ListItemNormalization innerNode;
+
+        public ListMixinNormalization(final ListSchemaNode list) {
+            super(new NodeIdentifier(list.getQName()));
+            this.innerNode =
+                new ListItemNormalization(new NodeIdentifierWithPredicates(
+                    list.getQName(), Collections.<QName, Object>emptyMap()),
+                    list);
+        }
+
+        @SuppressWarnings("rawtypes")
+        @Override
+        protected NormalizedNodeContainerBuilder createBuilder(
+            final Node node) {
+            return Builders.mapBuilder().withNodeIdentifier(getIdentifier());
+        }
+
+        @Override
+        public NormalizedNode<?, ?> createDefault(
+            final PathArgument currentArg) {
+            return Builders.mapBuilder().withNodeIdentifier(getIdentifier())
+                .build();
+        }
+
+        @Override
+        public NodeToNormalizedNodeBuilder<?> getChild(
+            final PathArgument child) {
+            if (child.getNodeType().equals(getIdentifier().getNodeType())) {
+                return innerNode;
+            }
+            return null;
+        }
+
+        @Override
+        public NodeToNormalizedNodeBuilder<?> getChild(final QName child) {
+            if (getIdentifier().getNodeType().equals(child)) {
+                return innerNode;
+            }
+            return null;
+        }
+
+    }
+
+
+    private static class ChoiceNodeNormalization extends
+        MixinNormalizationOp<NodeIdentifier> {
+
+        private final ImmutableMap<QName, NodeToNormalizedNodeBuilder<?>>
+            byQName;
+        private final ImmutableMap<PathArgument, NodeToNormalizedNodeBuilder<?>>
+            byArg;
+
+        protected ChoiceNodeNormalization(
+            final org.opendaylight.yangtools.yang.model.api.ChoiceNode schema) {
+            super(new NodeIdentifier(schema.getQName()));
+            ImmutableMap.Builder<QName, NodeToNormalizedNodeBuilder<?>>
+                byQNameBuilder =
+                ImmutableMap.builder();
+            ImmutableMap.Builder<PathArgument, NodeToNormalizedNodeBuilder<?>>
+                byArgBuilder =
+                ImmutableMap.builder();
+
+            for (ChoiceCaseNode caze : schema.getCases()) {
+                for (DataSchemaNode cazeChild : caze.getChildNodes()) {
+                    NodeToNormalizedNodeBuilder<?> childOp =
+                        fromDataSchemaNode(cazeChild);
+                    byArgBuilder.put(childOp.getIdentifier(), childOp);
+                    for (QName qname : childOp.getQNameIdentifiers()) {
+                        byQNameBuilder.put(qname, childOp);
+                    }
+                }
+            }
+            byQName = byQNameBuilder.build();
+            byArg = byArgBuilder.build();
+        }
+
+        @Override
+        public NodeToNormalizedNodeBuilder<?> getChild(
+            final PathArgument child) {
+            return byArg.get(child);
+        }
+
+        @Override
+        public NodeToNormalizedNodeBuilder<?> getChild(final QName child) {
+            return byQName.get(child);
+        }
+
+        @Override
+        protected NormalizedNodeContainerBuilder createBuilder(
+            final Node node) {
+            return Builders.choiceBuilder().withNodeIdentifier(getIdentifier());
+        }
+
+        @Override
+        public NormalizedNode<?, ?> createDefault(
+            final PathArgument currentArg) {
+            return Builders.choiceBuilder().withNodeIdentifier(getIdentifier())
+                .build();
+        }
+    }
+
+    /**
+     * Find an appropriate NormalizedNodeBuilder using both the schema and the
+     * Path Argument
+     *
+     * @param schema
+     * @param child
+     * @return
+     */
+    public static NodeToNormalizedNodeBuilder<?> fromSchemaAndPathArgument(
+        final DataNodeContainer schema, final QName child) {
+        DataSchemaNode potential = schema.getDataChildByName(child);
+        if (potential == null) {
+            Iterable<org.opendaylight.yangtools.yang.model.api.ChoiceNode>
+                choices =
+                FluentIterable.from(schema.getChildNodes()).filter(
+                    org.opendaylight.yangtools.yang.model.api.ChoiceNode.class);
+            potential = findChoice(choices, child);
+        }
+        if (potential == null) {
+            if (logger.isTraceEnabled()) {
+                logger.trace("BAD CHILD = {}", child.toString());
+            }
+        }
+
+        checkArgument(potential != null,
+            "Supplied QName %s is not valid according to schema %s", child,
+            schema);
+
+        // If the schema in an instance of DataSchemaNode and the potential
+        // is augmenting something then there is a chance that this may be
+        // and augmentation node
+        if ((schema instanceof DataSchemaNode)
+            && potential.isAugmenting()) {
+
+            AugmentationNormalization augmentation =
+                fromAugmentation(schema, (AugmentationTarget) schema,
+                    potential);
+
+            // If an augmentation normalization (builder) is not found then
+            // we fall through to the regular processing
+            if(augmentation != null){
+                return augmentation;
+            }
+        }
+        return fromDataSchemaNode(potential);
+    }
+
+    /**
+     * Given a bunch of choice nodes and a the name of child find a choice node for that child which
+     * has a non-null value
+     *
+     * @param choices
+     * @param child
+     * @return
+     */
+    private static org.opendaylight.yangtools.yang.model.api.ChoiceNode findChoice(
+        final Iterable<org.opendaylight.yangtools.yang.model.api.ChoiceNode> choices,
+        final QName child) {
+        org.opendaylight.yangtools.yang.model.api.ChoiceNode foundChoice = null;
+        choiceLoop:
+        for (org.opendaylight.yangtools.yang.model.api.ChoiceNode choice : choices) {
+            for (ChoiceCaseNode caze : choice.getCases()) {
+                if (caze.getDataChildByName(child) != null) {
+                    foundChoice = choice;
+                    break choiceLoop;
+                }
+            }
+        }
+        return foundChoice;
+    }
+
+
+    /**
+     * Create an AugmentationIdentifier based on the AugmentationSchema
+     *
+     * @param augmentation
+     * @return
+     */
+    public static AugmentationIdentifier augmentationIdentifierFrom(
+        final AugmentationSchema augmentation) {
+        ImmutableSet.Builder<QName> potentialChildren = ImmutableSet.builder();
+        for (DataSchemaNode child : augmentation.getChildNodes()) {
+            potentialChildren.add(child.getQName());
+        }
+        return new AugmentationIdentifier(potentialChildren.build());
+    }
+
+    /**
+     * Create an AugmentationNormalization based on the schema of the DataContainer, the
+     * AugmentationTarget and the potential schema node
+     *
+     * @param schema
+     * @param augments
+     * @param potential
+     * @return
+     */
+    private static AugmentationNormalization fromAugmentation(
+        final DataNodeContainer schema, final AugmentationTarget augments,
+        final DataSchemaNode potential) {
+        AugmentationSchema augmentation = null;
+        for (AugmentationSchema aug : augments.getAvailableAugmentations()) {
+            DataSchemaNode child = aug.getDataChildByName(potential.getQName());
+            if (child != null) {
+                augmentation = aug;
+                break;
+            }
+
+        }
+        if (augmentation != null) {
+            return new AugmentationNormalization(augmentation, schema);
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * @param schema
+     * @param child
+     * @return
+     */
+    private static NodeToNormalizedNodeBuilder<?> fromSchema(
+        final DataNodeContainer schema, final PathArgument child) {
+        if (child instanceof AugmentationIdentifier) {
+            QName childQName = ((AugmentationIdentifier) child)
+                .getPossibleChildNames().iterator().next();
+
+            return fromSchemaAndPathArgument(schema, childQName);
+        }
+        return fromSchemaAndPathArgument(schema, child.getNodeType());
+    }
+
+    public static NodeToNormalizedNodeBuilder<?> fromDataSchemaNode(
+        final DataSchemaNode potential) {
+        if (potential instanceof ContainerSchemaNode) {
+            return new ContainerNormalization((ContainerSchemaNode) potential);
+        } else if (potential instanceof ListSchemaNode) {
+            return new ListMixinNormalization((ListSchemaNode) potential);
+        } else if (potential instanceof LeafSchemaNode) {
+            return new LeafNormalization((LeafSchemaNode) potential,
+                new NodeIdentifier(potential.getQName()));
+        } else if (potential instanceof org.opendaylight.yangtools.yang.model.api.ChoiceNode) {
+            return new ChoiceNodeNormalization(
+                (org.opendaylight.yangtools.yang.model.api.ChoiceNode) potential);
+        } else if (potential instanceof LeafListSchemaNode) {
+            return new LeafListMixinNormalization(
+                (LeafListSchemaNode) potential);
+        }
+        return null;
+    }
+
+    public static NodeToNormalizedNodeBuilder<?> from(final SchemaContext ctx) {
+        return new ContainerNormalization(ctx);
+    }
+
+    public abstract NormalizedNode<?, ?> createDefault(PathArgument currentArg);
+
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NodeValueCodec.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NodeValueCodec.java
new file mode 100644 (file)
index 0000000..7b6f5c4
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * 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.node;
+
+import org.opendaylight.controller.cluster.datastore.node.utils.QNameFactory;
+import org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.data.api.codec.BitsCodec;
+import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.util.IdentityrefType;
+import org.opendaylight.yangtools.yang.model.util.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.util.Leafref;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class NodeValueCodec {
+    protected static final Logger logger = LoggerFactory
+        .getLogger(NodeValueCodec.class);
+
+    public static Object toTypeSafeValue(DataSchemaNode schema, TypeDefinition type, NormalizedNodeMessages.Node node){
+
+        String value = node.getValue();
+
+        if(schema != null && value != null){
+            TypeDefinition<?> baseType = type;
+
+            while (baseType.getBaseType() != null) {
+                baseType = baseType.getBaseType();
+            }
+
+            TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>> codec =
+                TypeDefinitionAwareCodec.from(type);
+
+            if(codec instanceof BitsCodec){
+                if(value.contains("[]")){
+                    value = "";
+                } else {
+                    value = value.replace("[", "");
+                    value = value.replace("]", "");
+                    value = value.replace(",", " ");
+                }
+            }
+
+            if (codec != null) {
+                return codec.deserialize(value);
+            } else if(baseType instanceof Leafref) {
+                return value;
+            } else if(baseType instanceof IdentityrefType) {
+                return QNameFactory.create(value);
+            } else if(baseType instanceof InstanceIdentifier) {
+                return InstanceIdentifierUtils.fromSerializable(node.getInstanceIdentifierValue());
+            } else {
+                logger.error("Could not figure out how to transform value " + value +  " for schemaType " + type);
+            }
+        }
+
+        return value;
+    }
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodec.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodec.java
new file mode 100644 (file)
index 0000000..fc4b395
--- /dev/null
@@ -0,0 +1,64 @@
+package org.opendaylight.controller.cluster.datastore.node;
+
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.controller.cluster.datastore.node.utils.PathUtils;
+import org.opendaylight.yangtools.yang.common.QName;
+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;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class NormalizedNodeToNodeCodec {
+    private final SchemaContext ctx;
+    private static final Logger logger = LoggerFactory.getLogger(NormalizedNodeToNodeCodec.class);
+
+    public NormalizedNodeToNodeCodec(final SchemaContext ctx){
+        this.ctx = ctx;
+
+    }
+
+    public NormalizedNodeMessages.Container encode(YangInstanceIdentifier id, NormalizedNode node){
+        String parentPath = "";
+
+        if(id != null){
+            parentPath = PathUtils.getParentPath(id.toString());
+        }
+
+
+        NormalizedNodeToProtocolBufferNode encoder = new NormalizedNodeToProtocolBufferNode();
+        encoder.encode(parentPath, node);
+
+        return encoder.getContainer();
+
+
+    }
+
+    public NormalizedNode<?,?> decode(YangInstanceIdentifier id, NormalizedNodeMessages.Node node){
+            NodeToNormalizedNodeBuilder currentOp = NodeToNormalizedNodeBuilder.from(ctx);
+
+            for(YangInstanceIdentifier.PathArgument pathArgument : id.getPathArguments()){
+                currentOp = currentOp.getChild(pathArgument);
+            }
+
+            QName nodeType = null;
+
+            if(id.getPath().size() < 1){
+                nodeType = null;
+            } else {
+                final YangInstanceIdentifier.PathArgument pathArgument = id.getPath().get(id.getPath().size() - 1);
+                if(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier){
+                    nodeType = null;
+                } else {
+                    nodeType = pathArgument.getNodeType();
+                }
+            }
+            if((node != null)&& (!node.getType().isEmpty())){
+               return currentOp.normalize(nodeType, node);
+            } else{
+              return null;
+            }
+    }
+
+
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToProtocolBufferNode.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToProtocolBufferNode.java
new file mode 100644 (file)
index 0000000..fb15312
--- /dev/null
@@ -0,0 +1,254 @@
+package org.opendaylight.controller.cluster.datastore.node;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
+import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
+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.MixinNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
+import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
+
+import java.util.Map;
+
+/**
+ * NormalizedNodeToProtocolBufferNode walks the NormalizedNode tree converting it to the
+ * NormalizedMessage.Node
+ * <p/>
+ * {@link org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode } is a tree like structure that provides a generic structure for a yang data
+ * model
+ */
+public class NormalizedNodeToProtocolBufferNode {
+
+
+    private final Node.Builder builderRoot;
+    private NormalizedNodeMessages.Container container;
+
+    public NormalizedNodeToProtocolBufferNode() {
+
+        builderRoot = Node.newBuilder();
+    }
+
+    public void encode(String parentPath, NormalizedNode<?, ?> normalizedNode) {
+        if (parentPath == null) {
+            parentPath = "";
+        }
+
+        NormalizedNodeMessages.Container.Builder containerBuilder =
+            NormalizedNodeMessages.Container.newBuilder();
+
+        if (normalizedNode != null) {
+
+            navigateNormalizedNode(0, parentPath, normalizedNode, builderRoot);
+            // here we need to put back the Node Tree in Container
+
+            container =
+                containerBuilder.setParentPath(parentPath).setNormalizedNode(
+                    builderRoot.build()).build();
+        } else {
+            //this can happen when an attempt was made to read from datastore and normalized node was null.
+            container = containerBuilder.setParentPath(parentPath).build();
+
+        }
+
+    }
+
+
+    private void navigateDataContainerNode(int level, final String parentPath,
+        final DataContainerNode<?> dataContainerNode,
+        Node.Builder builderParent) {
+
+        String newParentPath =
+            parentPath + "/" + dataContainerNode.getIdentifier().toString();
+        String type = getDataContainerType(dataContainerNode).getSimpleName();
+        builderParent.setPath(dataContainerNode.getIdentifier().toString())
+            .setType(type);
+
+        final Iterable<DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>>
+            value =
+            dataContainerNode.getValue();
+        for (NormalizedNode<?, ?> node : value) {
+            Node.Builder builderChild = Node.newBuilder();
+            if (node instanceof MixinNode
+                && node instanceof NormalizedNodeContainer) {
+
+                navigateNormalizedNodeContainerMixin(level, newParentPath,
+                    (NormalizedNodeContainer<?, ?, ?>) node, builderChild);
+            } else {
+                navigateNormalizedNode(level, newParentPath, node,
+                    builderChild);
+            }
+            builderParent.addChild(builderChild);
+        }
+    }
+
+    private Class getDataContainerType(
+        NormalizedNodeContainer<?, ?, ?> dataContainerNode) {
+        if (dataContainerNode instanceof ChoiceNode) {
+            return ChoiceNode.class;
+        } else if (dataContainerNode instanceof AugmentationNode) {
+            return AugmentationNode.class;
+        } else if (dataContainerNode instanceof ContainerNode) {
+            return ContainerNode.class;
+        } else if (dataContainerNode instanceof MapEntryNode) {
+            return MapEntryNode.class;
+        } else if (dataContainerNode instanceof UnkeyedListEntryNode) {
+            return UnkeyedListEntryNode.class;
+        } else if (dataContainerNode instanceof MapNode) {
+            return MapNode.class;
+        } else if (dataContainerNode instanceof LeafSetNode) {
+            return LeafSetNode.class;
+        }
+        throw new IllegalArgumentException(
+            "could not find the data container node type "
+                + dataContainerNode.toString()
+        );
+    }
+
+    private void navigateNormalizedNodeContainerMixin(int level,
+        final String parentPath,
+        NormalizedNodeContainer<?, ?, ?> node, Node.Builder builderParent) {
+        String newParentPath =
+            parentPath + "/" + node.getIdentifier().toString();
+
+        builderParent.setPath(node.getIdentifier().toString()).setType(
+            this.getDataContainerType(node).getSimpleName());
+        final Iterable<? extends NormalizedNode<?, ?>> value = node.getValue();
+        for (NormalizedNode normalizedNode : value) {
+            // child node builder
+            Node.Builder builderChild = Node.newBuilder();
+            if (normalizedNode instanceof MixinNode
+                && normalizedNode instanceof NormalizedNodeContainer) {
+                navigateNormalizedNodeContainerMixin(level + 1, newParentPath,
+                    (NormalizedNodeContainer) normalizedNode, builderChild);
+            } else {
+                navigateNormalizedNode(level, newParentPath, normalizedNode,
+                    builderChild);
+            }
+            builderParent.addChild(builderChild);
+
+        }
+
+
+
+    }
+
+
+    private void navigateNormalizedNode(int level,
+        String parentPath, NormalizedNode<?, ?> normalizedNode,
+        Node.Builder builderParent) {
+
+        if (normalizedNode instanceof DataContainerNode) {
+
+            final DataContainerNode<?> dataContainerNode =
+                (DataContainerNode) normalizedNode;
+
+            navigateDataContainerNode(level + 1, parentPath, dataContainerNode,
+                builderParent);
+        } else if (normalizedNode instanceof MixinNode
+            && normalizedNode instanceof NormalizedNodeContainer) {
+
+            navigateNormalizedNodeContainerMixin(level, parentPath,
+                (NormalizedNodeContainer<?, ?, ?>) normalizedNode,
+                builderParent);
+        } else {
+            if (normalizedNode instanceof LeafNode) {
+                buildLeafNode(parentPath, normalizedNode, builderParent);
+            } else if (normalizedNode instanceof LeafSetEntryNode) {
+                buildLeafSetEntryNode(parentPath, normalizedNode,
+                    builderParent);
+            }
+
+        }
+
+    }
+
+    private void buildLeafSetEntryNode(String parentPath,
+        NormalizedNode<?, ?> normalizedNode,
+        Node.Builder builderParent) {
+        String path =
+            parentPath + "/" + normalizedNode.getIdentifier().toString();
+        LeafSetEntryNode leafSetEntryNode = (LeafSetEntryNode) normalizedNode;
+        Map<QName, String> attributes = leafSetEntryNode.getAttributes();
+        if (!attributes.isEmpty()) {
+            NormalizedNodeMessages.Attribute.Builder builder = null;
+            for (Map.Entry<QName, String> attribute : attributes.entrySet()) {
+                builder = NormalizedNodeMessages.Attribute.newBuilder();
+
+                builder
+                    .setName(attribute.getKey().toString())
+                    .setValue(normalizedNode.getValue().toString());
+
+                builderParent.addAttributes(builder.build());
+            }
+        }
+        buildNodeValue(normalizedNode, builderParent);
+    }
+
+    private void buildLeafNode(String parentPath,
+        NormalizedNode<?, ?> normalizedNode,
+        Node.Builder builderParent) {
+        Preconditions.checkNotNull(parentPath);
+        Preconditions.checkNotNull(normalizedNode);
+        String path =
+            parentPath + "/" + normalizedNode.getIdentifier().toString();
+        LeafNode leafNode = (LeafNode) normalizedNode;
+        Map<QName, String> attributes = leafNode.getAttributes();
+        if (!attributes.isEmpty()) {
+            NormalizedNodeMessages.Attribute.Builder builder = null;
+            for (Map.Entry<QName, String> attribute : attributes.entrySet()) {
+                builder = NormalizedNodeMessages.Attribute.newBuilder();
+                builder
+                    .setName(attribute.getKey().toString())
+                    .setValue(attribute.getValue().toString());
+
+                builderParent.addAttributes(builder.build());
+            }
+        }
+
+        Object value = normalizedNode.getValue();
+        if (value == null) {
+            builderParent
+                .setPath(normalizedNode.getIdentifier().toString())
+                .setType(LeafNode.class.getSimpleName())
+                .setValueType(String.class.getSimpleName())
+                .setValue("");
+        } else {
+            buildNodeValue(normalizedNode, builderParent);
+        }
+    }
+
+    private void buildNodeValue(NormalizedNode<?, ?> normalizedNode,
+        Node.Builder builderParent) {
+
+        Object value = normalizedNode.getValue();
+
+        builderParent
+            .setPath(normalizedNode.getIdentifier().toString())
+            .setType(LeafNode.class.getSimpleName())
+            .setValueType((value.getClass().getSimpleName()))
+            .setValue(value.toString());
+
+        if(value.getClass().equals(YangInstanceIdentifier.class)){
+            builderParent.setInstanceIdentifierValue(
+                InstanceIdentifierUtils
+                    .toSerializable((YangInstanceIdentifier) value));
+        }
+    }
+
+    public NormalizedNodeMessages.Container getContainer() {
+        return container;
+    }
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/AugmentationIdentifierGenerator.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/AugmentationIdentifierGenerator.java
new file mode 100644 (file)
index 0000000..a34307f
--- /dev/null
@@ -0,0 +1,42 @@
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class AugmentationIdentifierGenerator {
+    private final String id;
+    private static final Pattern pattern = Pattern.compile("AugmentationIdentifier\\Q{\\EchildNames=\\Q[\\E(.*)\\Q]}\\E");
+    private final Matcher matcher;
+    private final boolean doesMatch;
+
+    public AugmentationIdentifierGenerator(String id){
+        this.id = id;
+        matcher = pattern.matcher(this.id);
+        doesMatch = matcher.matches();
+    }
+
+    public boolean matches(){
+        return doesMatch;
+    }
+
+    public YangInstanceIdentifier.AugmentationIdentifier getPathArgument(){
+        Set<QName> childNames = new HashSet<QName>();
+        final String childQNames = matcher.group(1);
+
+        final String[] splitChildQNames = childQNames.split(",");
+
+        for(String name : splitChildQNames){
+            childNames.add(
+                org.opendaylight.controller.cluster.datastore.node.utils.QNameFactory
+                    .create(name.trim()));
+        }
+
+        return new YangInstanceIdentifier.AugmentationIdentifier(null, childNames);
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactory.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactory.java
new file mode 100644 (file)
index 0000000..175e242
--- /dev/null
@@ -0,0 +1,59 @@
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class NodeIdentifierFactory {
+    private static final Map<String, YangInstanceIdentifier.PathArgument> cache = new HashMap<>();
+    public static YangInstanceIdentifier.PathArgument getArgument(String id){
+        YangInstanceIdentifier.PathArgument value = cache.get(id);
+        if(value == null){
+            synchronized (cache){
+                value = cache.get(id);
+                if(value == null) {
+                    value = createPathArgument(id, null);
+                    cache.put(id, value);
+                }
+            }
+        }
+        return value;
+    }
+
+    public static YangInstanceIdentifier.PathArgument getArgument(String id, DataSchemaNode schemaNode){
+        YangInstanceIdentifier.PathArgument value = cache.get(id);
+        if(value == null){
+            synchronized (cache){
+                value = cache.get(id);
+                if(value == null) {
+                    value = createPathArgument(id, schemaNode);
+                    cache.put(id, value);
+                }
+            }
+        }
+        return value;
+    }
+
+    public static YangInstanceIdentifier.PathArgument createPathArgument(String id, DataSchemaNode schemaNode){
+        final NodeIdentifierWithPredicatesGenerator
+            nodeIdentifierWithPredicatesGenerator = new NodeIdentifierWithPredicatesGenerator(id, schemaNode);
+        if(nodeIdentifierWithPredicatesGenerator.matches()){
+            return nodeIdentifierWithPredicatesGenerator.getPathArgument();
+        }
+
+        final NodeIdentifierWithValueGenerator
+            nodeWithValueGenerator = new NodeIdentifierWithValueGenerator(id, schemaNode);
+        if(nodeWithValueGenerator.matches()){
+            return nodeWithValueGenerator.getPathArgument();
+        }
+
+        final AugmentationIdentifierGenerator augmentationIdentifierGenerator = new AugmentationIdentifierGenerator(id);
+        if(augmentationIdentifierGenerator.matches()){
+            return augmentationIdentifierGenerator.getPathArgument();
+        }
+
+        return new NodeIdentifierGenerator(id).getArgument();
+    }
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierGenerator.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierGenerator.java
new file mode 100644 (file)
index 0000000..9edec1e
--- /dev/null
@@ -0,0 +1,18 @@
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+public class NodeIdentifierGenerator {
+    private final String id;
+    private final QName qName;
+
+    public NodeIdentifierGenerator(String id){
+        this.id = id;
+        this.qName = QNameFactory.create(id);
+    }
+
+    public YangInstanceIdentifier.PathArgument getArgument(){
+        return new YangInstanceIdentifier.NodeIdentifier(qName);
+    }
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithPredicatesGenerator.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithPredicatesGenerator.java
new file mode 100644 (file)
index 0000000..4bfcf39
--- /dev/null
@@ -0,0 +1,70 @@
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class NodeIdentifierWithPredicatesGenerator{
+    private final String id;
+    private static final Pattern pattern = Pattern.compile("(.*)\\Q[{\\E(.*)\\Q}]\\E");
+    private final Matcher matcher;
+    private final boolean doesMatch;
+    private final ListSchemaNode listSchemaNode;
+
+    public NodeIdentifierWithPredicatesGenerator(String id, DataSchemaNode schemaNode){
+        this.id = id;
+        matcher = pattern.matcher(this.id);
+        doesMatch = matcher.matches();
+
+        if(schemaNode instanceof  ListSchemaNode){
+            this.listSchemaNode = (ListSchemaNode) schemaNode;
+        } else {
+            this.listSchemaNode = null;
+        }
+    }
+
+
+    public boolean matches(){
+        return doesMatch;
+    }
+
+    public YangInstanceIdentifier.NodeIdentifierWithPredicates getPathArgument(){
+        final String group = matcher.group(2);
+        final String[] keyValues = group.split(",");
+        Map<QName, Object> nameValues = new HashMap<>();
+
+        for(String keyValue : keyValues){
+            int eqIndex = keyValue.lastIndexOf('=');
+            try {
+                final QName key = QNameFactory
+                    .create(keyValue.substring(0, eqIndex));
+                nameValues.put(key, getValue(key, keyValue.substring(eqIndex + 1)));
+            } catch(IllegalArgumentException e){
+                System.out.println("Error processing identifier : " + id);
+                throw e;
+            }
+        }
+
+        return new YangInstanceIdentifier.NodeIdentifierWithPredicates(QNameFactory.create(matcher.group(1)), nameValues);
+    }
+
+
+    private Object getValue(QName key, String value){
+        if(listSchemaNode != null){
+            for(DataSchemaNode node : listSchemaNode.getChildNodes()){
+                if(node instanceof LeafSchemaNode && node.getQName().equals(key)){
+                    return TypeDefinitionAwareCodec.from(LeafSchemaNode.class.cast(node).getType()).deserialize(value);
+                }
+            }
+        }
+        return value;
+    }
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithValueGenerator.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithValueGenerator.java
new file mode 100644 (file)
index 0000000..b2ec564
--- /dev/null
@@ -0,0 +1,48 @@
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class NodeIdentifierWithValueGenerator{
+        private final String id;
+    private final DataSchemaNode schemaNode;
+    private static final Pattern pattern = Pattern.compile("(.*)\\Q[\\E(.*)\\Q]\\E");
+        private final Matcher matcher;
+        private final boolean doesMatch;
+
+        public NodeIdentifierWithValueGenerator(String id, DataSchemaNode schemaNode){
+            this.id = id;
+            this.schemaNode = schemaNode;
+            matcher = pattern.matcher(this.id);
+            doesMatch = matcher.matches();
+        }
+
+        public boolean matches(){
+            return doesMatch;
+        }
+
+        public YangInstanceIdentifier.PathArgument getPathArgument(){
+            final String name = matcher.group(1);
+            final String value = matcher.group(2);
+
+            return new YangInstanceIdentifier.NodeWithValue(
+                QNameFactory.create(name), getValue(value));
+        }
+
+        private Object getValue(String value){
+            if(schemaNode != null){
+                if(schemaNode instanceof LeafListSchemaNode){
+                    return TypeDefinitionAwareCodec
+                        .from(LeafListSchemaNode.class.cast(schemaNode).getType()).deserialize(value);
+
+                }
+            }
+        return value;
+        }
+
+    }
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodeGetter.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodeGetter.java
new file mode 100644 (file)
index 0000000..e82a23d
--- /dev/null
@@ -0,0 +1,28 @@
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+
+public class NormalizedNodeGetter implements
+    NormalizedNodeVisitor {
+    private final String path;
+    NormalizedNode output;
+
+    public NormalizedNodeGetter(String path){
+        Preconditions.checkNotNull(path);
+        this.path = path;
+    }
+
+    @Override
+    public void visitNode(int level, String parentPath, NormalizedNode normalizedNode) {
+        String nodePath = parentPath + "/"+ normalizedNode.getIdentifier().toString();
+
+        if(nodePath.toString().equals(path)){
+            output = normalizedNode;
+        }
+    }
+
+    public NormalizedNode getOutput(){
+        return output;
+    }
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodeNavigator.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodeNavigator.java
new file mode 100644 (file)
index 0000000..4ccc707
--- /dev/null
@@ -0,0 +1,81 @@
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
+import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MixinNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
+
+/**
+ * NormalizedNodeNavigator walks a {@link NormalizedNodeVisitor} through the NormalizedNode
+ *
+ * {@link NormalizedNode } is a tree like structure that provides a generic structure for a yang data model
+ *
+ * For examples of visitors
+ * @see NormalizedNodePrinter
+ *
+ *
+ */
+public class NormalizedNodeNavigator {
+
+  private final org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeVisitor
+      visitor;
+
+  public NormalizedNodeNavigator(
+      org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeVisitor visitor){
+    Preconditions.checkNotNull(visitor, "visitor should not be null");
+    this.visitor = visitor;
+  }
+  public void navigate(String parentPath, NormalizedNode<?,?> normalizedNode){
+    if(parentPath == null){
+      parentPath = "";
+    }
+    navigateNormalizedNode(0, parentPath, normalizedNode);
+  }
+
+  private void navigateDataContainerNode(int level, final String parentPath, final DataContainerNode<?> dataContainerNode){
+    visitor.visitNode(level, parentPath ,dataContainerNode);
+
+    String newParentPath = parentPath + "/" + dataContainerNode.getIdentifier().toString();
+
+    final Iterable<DataContainerChild<? extends YangInstanceIdentifier.PathArgument,?>> value = dataContainerNode.getValue();
+    for(NormalizedNode<?,?> node : value){
+      if(node instanceof MixinNode && node instanceof NormalizedNodeContainer){
+        navigateNormalizedNodeContainerMixin(level, newParentPath, (NormalizedNodeContainer<?, ?, ?>) node);
+      } else {
+        navigateNormalizedNode(level, newParentPath, node);
+      }
+    }
+
+  }
+
+  private void navigateNormalizedNodeContainerMixin(int level, final String parentPath, NormalizedNodeContainer<?, ?, ?> node) {
+    visitor.visitNode(level, parentPath, node);
+
+    String newParentPath = parentPath + "/" + node.getIdentifier().toString();
+
+    final Iterable<? extends NormalizedNode<?, ?>> value = node.getValue();
+    for(NormalizedNode normalizedNode : value){
+      if(normalizedNode instanceof MixinNode && normalizedNode instanceof NormalizedNodeContainer){
+        navigateNormalizedNodeContainerMixin(level + 1, newParentPath, (NormalizedNodeContainer) normalizedNode);
+      } else {
+        navigateNormalizedNode(level, newParentPath, normalizedNode);
+      }
+    }
+
+  }
+
+
+  private void navigateNormalizedNode(int level, String parentPath, NormalizedNode<?,?> normalizedNode){
+    if(normalizedNode instanceof DataContainerNode){
+
+      final DataContainerNode<?> dataContainerNode = (DataContainerNode) normalizedNode;
+
+      navigateDataContainerNode(level + 1, parentPath, dataContainerNode);
+    } else {
+      visitor.visitNode(level+1, parentPath, normalizedNode);
+    }
+  }
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodePrinter.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodePrinter.java
new file mode 100644 (file)
index 0000000..7735a12
--- /dev/null
@@ -0,0 +1,26 @@
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+
+public class NormalizedNodePrinter implements NormalizedNodeVisitor {
+
+    private String spaces(int n){
+        StringBuilder builder = new StringBuilder();
+        for(int i=0;i<n;i++){
+            builder.append(' ');
+        }
+        return builder.toString();
+    }
+
+    @Override
+    public void visitNode(int level, String parentPath, NormalizedNode normalizedNode) {
+        System.out.println(spaces((level) * 4) + normalizedNode.getClass().toString() + ":" + normalizedNode.getIdentifier());
+        if(normalizedNode instanceof LeafNode || normalizedNode instanceof LeafSetEntryNode){
+            System.out.println(spaces((level) * 4) + " parentPath = " + parentPath);
+            System.out.println(spaces((level) * 4) + " key = " + normalizedNode.getClass().toString() + ":" + normalizedNode.getIdentifier());
+            System.out.println(spaces((level) * 4) + " value = " + normalizedNode.getValue());
+        }
+    }
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodeVisitor.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NormalizedNodeVisitor.java
new file mode 100644 (file)
index 0000000..69b00be
--- /dev/null
@@ -0,0 +1,7 @@
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+
+public interface NormalizedNodeVisitor {
+    public void visitNode(int level, String parentPath, NormalizedNode normalizedNode);
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtils.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/PathUtils.java
new file mode 100644 (file)
index 0000000..ba81836
--- /dev/null
@@ -0,0 +1,19 @@
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+public class PathUtils {
+    public static String getParentPath(String currentElementPath){
+        String parentPath = "";
+
+        if(currentElementPath != null){
+            String[] parentPaths = currentElementPath.split("/");
+            if(parentPaths.length > 2){
+                for(int i=0;i<parentPaths.length-1;i++){
+                    if(parentPaths[i].length() > 0){
+                        parentPath += "/" + parentPaths[i];
+                    }
+                }
+            }
+        }
+        return parentPath;
+    }
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/QNameFactory.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/QNameFactory.java
new file mode 100644 (file)
index 0000000..8dba056
--- /dev/null
@@ -0,0 +1,24 @@
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import org.opendaylight.yangtools.yang.common.QName;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class QNameFactory {
+    private static final Map<String, QName> cache = new HashMap<>();
+
+    public static QName create(String name){
+        QName value = cache.get(name);
+        if(value == null){
+            synchronized (cache){
+                value = cache.get(name);
+                if(value == null) {
+                    value = QName.create(name);
+                    cache.put(name, value);
+                }
+            }
+        }
+        return value;
+    }
+}
index 41eb2e6f925551770f0278d93ab3694ab6dc5884..d9a067b573724ef097052cfe89adbf708c87cf08 100644 (file)
@@ -4,16 +4,26 @@ import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
 import org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
+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.codec.xml.XmlDocumentUtils;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.parser.DomToNormalizedNodeParserFactory;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.serializer.DomFromNormalizedNodeSerializerFactory;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
 import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.w3c.dom.Document;
@@ -29,9 +39,10 @@ import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 import java.io.ByteArrayInputStream;
 import java.io.StringWriter;
+import java.util.Collection;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
 
 /*
  * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
@@ -48,142 +59,271 @@ import java.util.Set;
  * @author: syedbahm
  */
 public class EncoderDecoderUtil {
-  static DocumentBuilderFactory factory;
-  static {
-    factory = DocumentBuilderFactory.newInstance();
-    factory.setNamespaceAware(true);
-    factory.setCoalescing(true);
-    factory.setIgnoringElementContentWhitespace(true);
-    factory.setIgnoringComments(true);
-  }
+    static DocumentBuilderFactory factory;
 
-  private static DataSchemaNode findChildNode(Set<DataSchemaNode> children,
-      String name) {
-    List<DataNodeContainer> containers = Lists.newArrayList();
-
-    for (DataSchemaNode dataSchemaNode : children) {
-      if (dataSchemaNode.getQName().getLocalName().equals(name))
-        return dataSchemaNode;
-      if (dataSchemaNode instanceof DataNodeContainer) {
-        containers.add((DataNodeContainer) dataSchemaNode);
-      } else if (dataSchemaNode instanceof ChoiceNode) {
-        containers.addAll(((ChoiceNode) dataSchemaNode).getCases());
-      }
+    private static DomFromNormalizedNodeSerializerFactory serializerFactory =
+        DomFromNormalizedNodeSerializerFactory
+            .getInstance(XmlDocumentUtils.getDocument(),
+                DomUtils.defaultValueCodecProvider());
+
+    private static DomToNormalizedNodeParserFactory parserFactory =
+        DomToNormalizedNodeParserFactory
+            .getInstance(DomUtils.defaultValueCodecProvider());
+
+    static {
+        factory = DocumentBuilderFactory.newInstance();
+        factory.setNamespaceAware(true);
+        factory.setCoalescing(true);
+        factory.setIgnoringElementContentWhitespace(true);
+        factory.setIgnoringComments(true);
     }
 
-    for (DataNodeContainer container : containers) {
-      DataSchemaNode retVal = findChildNode(container.getChildNodes(), name);
-      if (retVal != null) {
-        return retVal;
-      }
+    private static DataSchemaNode findChildNode(Collection<DataSchemaNode> children,
+        String name) {
+        List<DataNodeContainer> containers = Lists.newArrayList();
+
+        for (DataSchemaNode dataSchemaNode : children) {
+            if (dataSchemaNode.getQName().getLocalName().equals(name))
+                return dataSchemaNode;
+            if (dataSchemaNode instanceof DataNodeContainer) {
+                containers.add((DataNodeContainer) dataSchemaNode);
+            } else if (dataSchemaNode instanceof ChoiceNode) {
+                containers.addAll(((ChoiceNode) dataSchemaNode).getCases());
+            }
+        }
+
+        for (DataNodeContainer container : containers) {
+            DataSchemaNode retVal =
+                findChildNode(container.getChildNodes(), name);
+            if (retVal != null) {
+                return retVal;
+            }
+        }
+
+        return null;
     }
 
-    return null;
-  }
+    private static DataSchemaNode getSchemaNode(SchemaContext context,
+        QName qname) {
 
-  private static DataSchemaNode getSchemaNode(SchemaContext context, QName qname) {
+        for (Module module : context
+            .findModuleByNamespace(qname.getNamespace())) {
+            // we will take the first child as the start of the
+            if (module.getChildNodes() != null || !module.getChildNodes()
+                .isEmpty()) {
 
-    for (Module module : context.findModuleByNamespace(qname.getNamespace())) {
-      // we will take the first child as the start of the
-      if (module.getChildNodes() != null || !module.getChildNodes().isEmpty()) {
+                DataSchemaNode found =
+                    findChildNode(module.getChildNodes(), qname.getLocalName());
+                return found;
+            }
+        }
+        return null;
+    }
 
-        DataSchemaNode found =
-            findChildNode(module.getChildNodes(), qname.getLocalName());
-        return found;
-      }
+    private static String toString(Element xml) {
+        try {
+            Transformer transformer =
+                TransformerFactory.newInstance().newTransformer();
+            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+
+            StreamResult result = new StreamResult(new StringWriter());
+            DOMSource source = new DOMSource(xml);
+            transformer.transform(source, result);
+
+            return result.getWriter().toString();
+        } catch (IllegalArgumentException | TransformerFactoryConfigurationError
+            | TransformerException e) {
+            throw new RuntimeException("Unable to serialize xml element " + xml,
+                e);
+        }
     }
-    return null;
-  }
 
-  private static String toString(Element xml) {
+  private static String toString(Iterable<Element> xmlIterable) {
     try {
       Transformer transformer =
           TransformerFactory.newInstance().newTransformer();
       transformer.setOutputProperty(OutputKeys.INDENT, "yes");
 
       StreamResult result = new StreamResult(new StringWriter());
-      DOMSource source = new DOMSource(xml);
-      transformer.transform(source, result);
+      Iterator iterator = xmlIterable.iterator();
+      DOMSource source;
+      if(iterator.hasNext()) {
+        source = new DOMSource((org.w3c.dom.Node) iterator.next());
+        transformer.transform(source, result);
+        transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+      }
 
+      while(iterator.hasNext()) {
+        source = new DOMSource((org.w3c.dom.Node) iterator.next());
+        transformer.transform(source, result);
+      }
+      System.out.println(result.getWriter().toString());
       return result.getWriter().toString();
     } catch (IllegalArgumentException | TransformerFactoryConfigurationError
         | TransformerException e) {
-      throw new RuntimeException("Unable to serialize xml element " + xml, e);
+      throw new RuntimeException("Unable to serialize xml element(s) " + xmlIterable.toString(),
+          e);
     }
   }
 
-  /**
-   * Helps in generation of NormalizedNodeXml message for the supplied NormalizedNode
-   *
-   * @param sc --SchemaContext
-   * @param normalizedNode -- Normalized Node to be encoded
-   * @return SimpleNormalizedNodeMessage.NormalizedNodeXml
-   */
-  public static SimpleNormalizedNodeMessage.NormalizedNodeXml encode(
-      SchemaContext sc, NormalizedNode<?, ?> normalizedNode) {
-    Preconditions.checkArgument(sc != null, "Schema context found null");
-    Preconditions.checkArgument(normalizedNode != null,
-        "normalized node found null");
-    ContainerSchemaNode containerNode =
-        (ContainerSchemaNode) getSchemaNode(sc, normalizedNode.getIdentifier()
-            .getNodeType());
-    Preconditions.checkState(containerNode != null,
-        "Couldn't find schema node for " + normalizedNode.getIdentifier());
-    Iterable<Element> els =
-        DomFromNormalizedNodeSerializerFactory
-            .getInstance(XmlDocumentUtils.getDocument(),
-                DomUtils.defaultValueCodecProvider())
-            .getContainerNodeSerializer()
-            .serialize(containerNode, (ContainerNode) normalizedNode);
-    String xmlString = toString(els.iterator().next());
-    SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder builder =
-        SimpleNormalizedNodeMessage.NormalizedNodeXml.newBuilder();
-    builder.setXmlString(xmlString);
-    builder.setNodeIdentifier(((ContainerNode) normalizedNode).getIdentifier()
-        .getNodeType().toString());
-    return builder.build();
+    private static Iterable<Element> serialize(DataSchemaNode schemaNode, NormalizedNode normalizedNode){
+        if(schemaNode instanceof ContainerSchemaNode){      //1
+            return serializerFactory
+                .getContainerNodeSerializer()
+                .serialize((ContainerSchemaNode) schemaNode,
+                    (ContainerNode) normalizedNode);
+        } else if(schemaNode instanceof ChoiceNode){        //2
+            return serializerFactory
+                .getChoiceNodeSerializer()
+                .serialize((ChoiceNode) schemaNode,
+                    (org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode) normalizedNode);
+        } else if(schemaNode instanceof LeafSchemaNode){    //3
+            return serializerFactory
+                .getLeafNodeSerializer()
+                .serialize((LeafSchemaNode) schemaNode, (LeafNode) normalizedNode);
+        } else if(schemaNode instanceof ListSchemaNode){    //4
+            return serializerFactory
+                .getMapNodeSerializer()
+                .serialize((ListSchemaNode) schemaNode, (MapNode) normalizedNode);
+        } else if(schemaNode instanceof LeafListSchemaNode){    //5
+            return serializerFactory
+                .getLeafSetNodeSerializer()
+                .serialize((LeafListSchemaNode) schemaNode, (LeafSetNode) normalizedNode);
+        } else if(schemaNode instanceof AugmentationSchema){//6
+            return serializerFactory
+                .getAugmentationNodeSerializer()
+                .serialize((AugmentationSchema) schemaNode, (AugmentationNode) normalizedNode);
+        } else if(schemaNode instanceof ListSchemaNode && normalizedNode instanceof LeafSetEntryNode){    //7
+            return serializerFactory
+                .getLeafSetEntryNodeSerializer()
+                .serialize((LeafListSchemaNode) schemaNode, (LeafSetEntryNode) normalizedNode);
+        } else if(schemaNode instanceof ListSchemaNode){    //8
+            return serializerFactory
+                .getMapEntryNodeSerializer()
+                .serialize((ListSchemaNode) schemaNode, (MapEntryNode) normalizedNode);
+        }
 
-  }
 
-  /**
-   * Utilizes the SimpleNormalizedNodeMessage.NormalizedNodeXml to convert into NormalizedNode
-   *
-   * @param sc -- schema context
-   * @param normalizedNodeXml -- containing the normalized Node XML
-   * @return NormalizedNode return
-   * @throws Exception
-   */
-
-  public static NormalizedNode decode(SchemaContext sc,
-      SimpleNormalizedNodeMessage.NormalizedNodeXml normalizedNodeXml)
-      throws Exception {
-    Preconditions.checkArgument(sc != null, "schema context seems to be null");
-    Preconditions.checkArgument(normalizedNodeXml != null,
-        "SimpleNormalizedNodeMessage.NormalizedNodeXml found to be null");
-    QName qname = QName.create(normalizedNodeXml.getNodeIdentifier());
-
-    // here we will try to get back the NormalizedNode
-    ContainerSchemaNode containerSchemaNode =
-        (ContainerSchemaNode) getSchemaNode(sc, qname);
-
-    // now we need to read the XML
-
-    Document doc =
-        factory.newDocumentBuilder().parse(
-            new ByteArrayInputStream(normalizedNodeXml.getXmlString().getBytes(
-                "utf-8")));
-    doc.getDocumentElement().normalize();
-
-    ContainerNode result =
-        DomToNormalizedNodeParserFactory
-            .getInstance(DomUtils.defaultValueCodecProvider())
-            .getContainerNodeParser()
-            .parse(Collections.singletonList(doc.getDocumentElement()),
-                containerSchemaNode);
 
-    return (NormalizedNode) result;
+        throw new UnsupportedOperationException(schemaNode.getClass().toString());
+    }
 
-  }
+    private static NormalizedNode parse(Document doc, DataSchemaNode schemaNode){
+        if(schemaNode instanceof ContainerSchemaNode){
+            return parserFactory
+                .getContainerNodeParser()
+                .parse(Collections.singletonList(doc.getDocumentElement()),
+                    (ContainerSchemaNode) schemaNode);
+
+        } else if(schemaNode instanceof ChoiceNode){
+            return parserFactory
+                .getChoiceNodeParser()
+                .parse(Collections.singletonList(doc.getDocumentElement()),
+                    (ChoiceNode) schemaNode);
+        } else if(schemaNode instanceof LeafNode){
+            return parserFactory
+                .getLeafNodeParser()
+                .parse(Collections.singletonList(doc.getDocumentElement()),
+                    (LeafSchemaNode) schemaNode);
+        } else if(schemaNode instanceof ListSchemaNode){
+            return parserFactory
+                .getMapNodeParser()
+                .parse(Collections.singletonList(doc.getDocumentElement()),
+                    (ListSchemaNode) schemaNode);
+        } else if(schemaNode instanceof LeafListSchemaNode){
+            return parserFactory
+                .getLeafSetNodeParser()
+                .parse(Collections.singletonList(doc.getDocumentElement()),
+                    (LeafListSchemaNode) schemaNode);
+        } else if(schemaNode instanceof AugmentationSchema){
+            return parserFactory
+                .getAugmentationNodeParser()
+                .parse(Collections.singletonList(doc.getDocumentElement()),
+                    (AugmentationSchema) schemaNode);
+        } else if(schemaNode instanceof ListSchemaNode){
+            return parserFactory
+                .getMapEntryNodeParser()
+                .parse(Collections.singletonList(doc.getDocumentElement()),
+                    (ListSchemaNode) schemaNode);
+
+        }
+
+        throw new UnsupportedOperationException(schemaNode.getClass().toString());
+    }
+
+
+    /**
+     * Helps in generation of NormalizedNodeXml message for the supplied NormalizedNode
+     *
+     * @param sc             --SchemaContext
+     * @param normalizedNode -- Normalized Node to be encoded
+     * @return SimpleNormalizedNodeMessage.NormalizedNodeXml
+     */
+    public static SimpleNormalizedNodeMessage.NormalizedNodeXml encode(
+        SchemaContext sc, NormalizedNode<?, ?> normalizedNode) {
+
+        Preconditions.checkArgument(sc != null, "Schema context found null");
+
+        Preconditions.checkArgument(normalizedNode != null,
+            "normalized node found null");
+
+        DataSchemaNode schemaNode = getSchemaNode(sc,
+            normalizedNode.getIdentifier()
+                .getNodeType()
+        );
+
+        Preconditions.checkState(schemaNode != null,
+            "Couldn't find schema node for " + normalizedNode.getIdentifier());
+
+        Iterable<Element> els = serialize(schemaNode, normalizedNode);
+
+        String xmlString = toString(els.iterator().next());
+        SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder builder =
+            SimpleNormalizedNodeMessage.NormalizedNodeXml.newBuilder();
+        builder.setXmlString(xmlString);
+        builder
+            .setNodeIdentifier(normalizedNode.getIdentifier()
+                .getNodeType().toString());
+        return builder.build();
+
+    }
+
+    /**
+     * Utilizes the SimpleNormalizedNodeMessage.NormalizedNodeXml to convert into NormalizedNode
+     *
+     * @param sc                -- schema context
+     * @param normalizedNodeXml -- containing the normalized Node XML
+     * @return NormalizedNode return
+     * @throws Exception
+     */
+
+    public static NormalizedNode decode(SchemaContext sc,
+        SimpleNormalizedNodeMessage.NormalizedNodeXml normalizedNodeXml)
+        throws Exception {
+
+        Preconditions
+            .checkArgument(sc != null, "schema context seems to be null");
+
+        Preconditions.checkArgument(normalizedNodeXml != null,
+            "SimpleNormalizedNodeMessage.NormalizedNodeXml found to be null");
+        QName qname = QName.create(normalizedNodeXml.getNodeIdentifier());
+
+        // here we will try to get back the NormalizedNode
+        DataSchemaNode schemaNode = getSchemaNode(sc, qname);
+
+        // now we need to read the XML
+        Document doc =
+            factory.newDocumentBuilder().parse(
+                new ByteArrayInputStream(
+                    normalizedNodeXml.getXmlString().getBytes(
+                        "utf-8"))
+            );
+
+        doc.getDocumentElement().normalize();
+
+
+        return parse(doc, schemaNode);
+    }
 
 
 
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtils.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtils.java
new file mode 100644 (file)
index 0000000..5b459e7
--- /dev/null
@@ -0,0 +1,277 @@
+package org.opendaylight.controller.cluster.datastore.util;
+
+import org.opendaylight.controller.cluster.datastore.node.utils.NodeIdentifierFactory;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * This class contains utility methods for converting an MD-SAL
+ * YangInstanceIdentifier to and from other representations.
+ * <p>
+ * The representations convered for now are,
+ *
+ * <ul>
+ *     <li>String</li>
+ *     <li>Protocol Buffer</li>
+ * </ul>
+ */
+public class InstanceIdentifierUtils {
+
+    protected static final Logger logger = LoggerFactory
+        .getLogger(InstanceIdentifierUtils.class);
+
+    @Deprecated
+    public static YangInstanceIdentifier from(String path) {
+        String[] ids = path.split("/");
+
+        List<YangInstanceIdentifier.PathArgument> pathArguments =
+            new ArrayList<>();
+        for (String nodeId : ids) {
+            if (!"".equals(nodeId)) {
+                pathArguments
+                    .add(NodeIdentifierFactory.getArgument(nodeId));
+            }
+        }
+        final YangInstanceIdentifier instanceIdentifier =
+            YangInstanceIdentifier.create(pathArguments);
+        return instanceIdentifier;
+    }
+
+
+    /**
+     * Convert an MD-SAL YangInstanceIdentifier into a protocol buffer version of it
+     *
+     * @param path an MD-SAL YangInstanceIdentifier
+     * @return a protocol buffer version of the MD-SAL YangInstanceIdentifier
+     */
+    public static NormalizedNodeMessages.InstanceIdentifier toSerializable(YangInstanceIdentifier path){
+        NormalizedNodeMessages.InstanceIdentifier.Builder builder =
+            NormalizedNodeMessages.InstanceIdentifier.newBuilder();
+
+        try {
+
+            for (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument pathArgument : path
+                .getPathArguments()) {
+
+                String nodeType = "";
+                if(!(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier)){
+                    nodeType = pathArgument.getNodeType().toString();
+                }
+
+                NormalizedNodeMessages.PathArgument serializablePathArgument =
+                    NormalizedNodeMessages.PathArgument.newBuilder()
+                        .setValue(pathArgument.toString())
+                        .setType(pathArgument.getClass().getSimpleName())
+                        .setNodeType(NormalizedNodeMessages.QName.newBuilder()
+                            .setValue(nodeType))
+                        .addAllAttributes(getPathArgumentAttributes(
+                            pathArgument))
+                        .build();
+
+                builder.addArguments(serializablePathArgument);
+            }
+
+        } catch(Exception e){
+            logger.error("An exception occurred", e);
+        }
+        return builder.build();
+    }
+
+
+    /**
+     * Convert a protocol buffer version of the MD-SAL YangInstanceIdentifier into
+     * the MD-SAL version of the YangInstanceIdentifier
+     *
+     * @param path a protocol buffer version of the MD-SAL YangInstanceIdentifier
+     * @return  an MD-SAL YangInstanceIdentifier
+     */
+    public static YangInstanceIdentifier fromSerializable(NormalizedNodeMessages.InstanceIdentifier path){
+
+        List<YangInstanceIdentifier.PathArgument> pathArguments =
+            new ArrayList<>();
+
+        for(NormalizedNodeMessages.PathArgument pathArgument : path.getArgumentsList()){
+
+            pathArguments
+                .add(parsePathArgument(pathArgument));
+
+        }
+
+        final YangInstanceIdentifier instanceIdentifier = YangInstanceIdentifier.create(pathArguments);
+
+        return instanceIdentifier;
+    }
+
+    /**
+     * Take the various attributes of a PathArgument and package them up as
+     * protocol buffer attributes.
+     * <p>
+     *
+     * PathArguments have 4 subtypes and each of the various subtypes have
+     * different attributes
+     * <ul>
+     *     <li>
+     *         NodeIdentifier is the most basic PathArgument. It is used for
+     *         ContainerNode, LeafNode etc and has no attributes
+     *     </li>
+     *     <li>
+     *         NodeWithValue has only a single attribute. It is used for
+     *         LeafListEntryNodes and the attribute it contains is the value
+     *         of the entry
+     *     </li>
+     *     <li>
+     *         NodeIdentifierWithPredicates has a map of attributes.
+     *         It is used to represent a ListItemNode. Each entry
+     *         in the map of attributes represents the key and value of the
+     *         keys in that entry.
+     *     </li>
+     *     <li>
+     *         AugmentationIdentifier has a list of unnamed attributes. Each
+     *         attribute represents the possible children that can go within
+     *         an augmentation entry.
+     *     </li>
+     * </ul>
+     * @param pathArgument
+     * @return
+     */
+    private static Iterable<? extends NormalizedNodeMessages.Attribute> getPathArgumentAttributes(
+        YangInstanceIdentifier.PathArgument pathArgument) {
+        List<NormalizedNodeMessages.Attribute> attributes = new ArrayList<>();
+
+
+
+        if (pathArgument instanceof YangInstanceIdentifier.NodeWithValue) {
+            YangInstanceIdentifier.NodeWithValue identifier
+                = (YangInstanceIdentifier.NodeWithValue) pathArgument;
+
+            NormalizedNodeMessages.Attribute attribute =
+                NormalizedNodeMessages.Attribute.newBuilder()
+                    .setName("name")
+                    .setValue(identifier.getValue().toString())
+                    .setType(identifier.getValue().getClass().getSimpleName())
+                    .build();
+
+            attributes.add(attribute);
+        } else if (pathArgument instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates) {
+            YangInstanceIdentifier.NodeIdentifierWithPredicates identifier
+                = (YangInstanceIdentifier.NodeIdentifierWithPredicates) pathArgument;
+
+            for (QName key : identifier.getKeyValues().keySet()) {
+                Object value = identifier.getKeyValues().get(key);
+                NormalizedNodeMessages.Attribute attribute =
+                    NormalizedNodeMessages.Attribute.newBuilder()
+                        .setName(key.toString())
+                        .setValue(value.toString())
+                        .setType(value.getClass().getSimpleName())
+                        .build();
+
+                attributes.add(attribute);
+
+            }
+
+        } else if(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier) {
+            YangInstanceIdentifier.AugmentationIdentifier identifier
+                = (YangInstanceIdentifier.AugmentationIdentifier) pathArgument;
+
+            for (QName key : identifier.getPossibleChildNames()) {
+                Object value = key;
+                NormalizedNodeMessages.Attribute attribute =
+                    NormalizedNodeMessages.Attribute.newBuilder()
+                        .setName(key.toString())
+                        .setValue(value.toString())
+                        .setType(value.getClass().getSimpleName())
+                        .build();
+
+                attributes.add(attribute);
+
+            }
+        }
+
+        return attributes;
+    }
+
+
+    /**
+     * Parse a protocol buffer PathArgument and return an MD-SAL PathArgument
+     *
+     * @param pathArgument protocol buffer PathArgument
+     * @return MD-SAL PathArgument
+     */
+    private static YangInstanceIdentifier.PathArgument parsePathArgument(NormalizedNodeMessages.PathArgument pathArgument) {
+        if (YangInstanceIdentifier.NodeWithValue.class.getSimpleName().equals(pathArgument.getType())) {
+
+            YangInstanceIdentifier.NodeWithValue nodeWithValue =
+                new YangInstanceIdentifier.NodeWithValue(
+                    QName.create(pathArgument.getNodeType().getValue()),
+                    parseAttribute(pathArgument.getAttributes(0)));
+
+            return nodeWithValue;
+
+        } else if(YangInstanceIdentifier.NodeIdentifierWithPredicates.class.getSimpleName().equals(pathArgument.getType())){
+
+            YangInstanceIdentifier.NodeIdentifierWithPredicates
+                nodeIdentifierWithPredicates =
+                new YangInstanceIdentifier.NodeIdentifierWithPredicates(
+                    QName.create(pathArgument.getNodeType().getValue()), toAttributesMap(pathArgument.getAttributesList()));
+
+            return nodeIdentifierWithPredicates;
+
+        } else if(YangInstanceIdentifier.AugmentationIdentifier.class.getSimpleName().equals(pathArgument.getType())){
+
+            Set<QName> qNameSet = new HashSet<>();
+
+            for(NormalizedNodeMessages.Attribute attribute : pathArgument.getAttributesList()){
+                qNameSet.add(QName.create(attribute.getValue()));
+            }
+
+            return new YangInstanceIdentifier.AugmentationIdentifier(qNameSet);
+        }
+
+        return NodeIdentifierFactory.getArgument(pathArgument.getValue());
+    }
+
+    private static Map<QName, Object> toAttributesMap(
+        List<NormalizedNodeMessages.Attribute> attributesList) {
+
+        Map<QName, Object> map = new HashMap<>();
+
+        for(NormalizedNodeMessages.Attribute attribute : attributesList){
+            String name = attribute.getName();
+            Object value = parseAttribute(attribute);
+
+            map.put(QName.create(name), value);
+        }
+
+        return map;
+    }
+
+    /**
+     * FIXME: This method only covers a subset of values that may go in an InstanceIdentifier
+     *
+     * @param attribute
+     * @return
+     */
+    private static Object parseAttribute(NormalizedNodeMessages.Attribute attribute){
+        if(Short.class.getSimpleName().equals(attribute.getType())) {
+            return Short.parseShort(attribute.getValue());
+        } else if(Long.class.getSimpleName().equals(attribute.getType())){
+            return Long.parseLong(attribute.getValue());
+        } else if(Boolean.class.getSimpleName().equals(attribute.getType())){
+            return Boolean.parseBoolean(attribute.getValue());
+        } else if(Integer.class.getSimpleName().equals(attribute.getType())){
+            return Integer.parseInt(attribute.getValue());
+        }
+
+        return attribute.getValue();
+    }
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/mdsal/CompositeModificationPayload.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/mdsal/CompositeModificationPayload.java
new file mode 100644 (file)
index 0000000..87b246b
--- /dev/null
@@ -0,0 +1,60 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: CompositeModificationPayload.proto
+
+package org.opendaylight.controller.mdsal;
+
+public final class CompositeModificationPayload {
+  private CompositeModificationPayload() {}
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistry registry) {
+    registry.add(org.opendaylight.controller.mdsal.CompositeModificationPayload.modification);
+  }
+  public static final int MODIFICATION_FIELD_NUMBER = 2;
+  /**
+   * <code>extend .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload { ... }</code>
+   */
+  public static final
+    com.google.protobuf.GeneratedMessage.GeneratedExtension<
+      org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
+      org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification> modification = com.google.protobuf.GeneratedMessage
+          .newFileScopedGeneratedExtension(
+        org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.class,
+        org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.getDefaultInstance());
+
+  public static com.google.protobuf.Descriptors.FileDescriptor
+      getDescriptor() {
+    return descriptor;
+  }
+  private static com.google.protobuf.Descriptors.FileDescriptor
+      descriptor;
+  static {
+    java.lang.String[] descriptorData = {
+      "\n\"CompositeModificationPayload.proto\022!or" +
+      "g.opendaylight.controller.mdsal\032\033AppendE" +
+      "ntriesMessages.proto\032\014Common.proto\032\020Pers" +
+      "istent.proto:\242\001\n\014modification\022R.org.open" +
+      "daylight.controller.cluster.raft.AppendE" +
+      "ntries.ReplicatedLogEntry.Payload\030\002 \001(\0132" +
+      "8.org.opendaylight.controller.mdsal.Comp" +
+      "ositeModification"
+    };
+    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+        public com.google.protobuf.ExtensionRegistry assignDescriptors(
+            com.google.protobuf.Descriptors.FileDescriptor root) {
+          descriptor = root;
+          modification.internalInit(descriptor.getExtensions().get(0));
+          return null;
+        }
+      };
+    com.google.protobuf.Descriptors.FileDescriptor
+      .internalBuildGeneratedFileFrom(descriptorData,
+        new com.google.protobuf.Descriptors.FileDescriptor[] {
+          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.getDescriptor(),
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.getDescriptor(),
+          org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.getDescriptor(),
+        }, assigner);
+  }
+
+  // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/cohort3pc/ThreePhaseCommitCohortMessages.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/cohort3pc/ThreePhaseCommitCohortMessages.java
new file mode 100644 (file)
index 0000000..ac0701a
--- /dev/null
@@ -0,0 +1,2700 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: Cohort.proto
+
+package org.opendaylight.controller.protobuff.messages.cohort3pc;
+
+public final class ThreePhaseCommitCohortMessages {
+  private ThreePhaseCommitCohortMessages() {}
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistry registry) {
+  }
+  public interface CanCommitTransactionOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.CanCommitTransaction}
+   */
+  public static final class CanCommitTransaction extends
+      com.google.protobuf.GeneratedMessage
+      implements CanCommitTransactionOrBuilder {
+    // Use CanCommitTransaction.newBuilder() to construct.
+    private CanCommitTransaction(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private CanCommitTransaction(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final CanCommitTransaction defaultInstance;
+    public static CanCommitTransaction getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public CanCommitTransaction getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private CanCommitTransaction(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<CanCommitTransaction> PARSER =
+        new com.google.protobuf.AbstractParser<CanCommitTransaction>() {
+      public CanCommitTransaction parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new CanCommitTransaction(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<CanCommitTransaction> getParserForType() {
+      return PARSER;
+    }
+
+    private void initFields() {
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.CanCommitTransaction}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction build() {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction buildPartial() {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction(this);
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction other) {
+        if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction.getDefaultInstance()) return this;
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CanCommitTransaction)
+    }
+
+    static {
+      defaultInstance = new CanCommitTransaction(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CanCommitTransaction)
+  }
+
+  public interface CanCommitTransactionReplyOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required bool canCommit = 1;
+    /**
+     * <code>required bool canCommit = 1;</code>
+     */
+    boolean hasCanCommit();
+    /**
+     * <code>required bool canCommit = 1;</code>
+     */
+    boolean getCanCommit();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.CanCommitTransactionReply}
+   */
+  public static final class CanCommitTransactionReply extends
+      com.google.protobuf.GeneratedMessage
+      implements CanCommitTransactionReplyOrBuilder {
+    // Use CanCommitTransactionReply.newBuilder() to construct.
+    private CanCommitTransactionReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private CanCommitTransactionReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final CanCommitTransactionReply defaultInstance;
+    public static CanCommitTransactionReply getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public CanCommitTransactionReply getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private CanCommitTransactionReply(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 8: {
+              bitField0_ |= 0x00000001;
+              canCommit_ = input.readBool();
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<CanCommitTransactionReply> PARSER =
+        new com.google.protobuf.AbstractParser<CanCommitTransactionReply>() {
+      public CanCommitTransactionReply parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new CanCommitTransactionReply(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<CanCommitTransactionReply> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required bool canCommit = 1;
+    public static final int CANCOMMIT_FIELD_NUMBER = 1;
+    private boolean canCommit_;
+    /**
+     * <code>required bool canCommit = 1;</code>
+     */
+    public boolean hasCanCommit() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required bool canCommit = 1;</code>
+     */
+    public boolean getCanCommit() {
+      return canCommit_;
+    }
+
+    private void initFields() {
+      canCommit_ = false;
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasCanCommit()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeBool(1, canCommit_);
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBoolSize(1, canCommit_);
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.CanCommitTransactionReply}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReplyOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        canCommit_ = false;
+        bitField0_ = (bitField0_ & ~0x00000001);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply build() {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply buildPartial() {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.canCommit_ = canCommit_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply other) {
+        if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply.getDefaultInstance()) return this;
+        if (other.hasCanCommit()) {
+          setCanCommit(other.getCanCommit());
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasCanCommit()) {
+          
+          return false;
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required bool canCommit = 1;
+      private boolean canCommit_ ;
+      /**
+       * <code>required bool canCommit = 1;</code>
+       */
+      public boolean hasCanCommit() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required bool canCommit = 1;</code>
+       */
+      public boolean getCanCommit() {
+        return canCommit_;
+      }
+      /**
+       * <code>required bool canCommit = 1;</code>
+       */
+      public Builder setCanCommit(boolean value) {
+        bitField0_ |= 0x00000001;
+        canCommit_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required bool canCommit = 1;</code>
+       */
+      public Builder clearCanCommit() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        canCommit_ = false;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CanCommitTransactionReply)
+    }
+
+    static {
+      defaultInstance = new CanCommitTransactionReply(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CanCommitTransactionReply)
+  }
+
+  public interface AbortTransactionOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.AbortTransaction}
+   */
+  public static final class AbortTransaction extends
+      com.google.protobuf.GeneratedMessage
+      implements AbortTransactionOrBuilder {
+    // Use AbortTransaction.newBuilder() to construct.
+    private AbortTransaction(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private AbortTransaction(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final AbortTransaction defaultInstance;
+    public static AbortTransaction getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public AbortTransaction getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private AbortTransaction(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransaction_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransaction_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<AbortTransaction> PARSER =
+        new com.google.protobuf.AbstractParser<AbortTransaction>() {
+      public AbortTransaction parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new AbortTransaction(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<AbortTransaction> getParserForType() {
+      return PARSER;
+    }
+
+    private void initFields() {
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.AbortTransaction}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransaction_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransaction_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransaction_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction build() {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction buildPartial() {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction(this);
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction other) {
+        if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction.getDefaultInstance()) return this;
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.AbortTransaction)
+    }
+
+    static {
+      defaultInstance = new AbortTransaction(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.AbortTransaction)
+  }
+
+  public interface AbortTransactionReplyOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.AbortTransactionReply}
+   */
+  public static final class AbortTransactionReply extends
+      com.google.protobuf.GeneratedMessage
+      implements AbortTransactionReplyOrBuilder {
+    // Use AbortTransactionReply.newBuilder() to construct.
+    private AbortTransactionReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private AbortTransactionReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final AbortTransactionReply defaultInstance;
+    public static AbortTransactionReply getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public AbortTransactionReply getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private AbortTransactionReply(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<AbortTransactionReply> PARSER =
+        new com.google.protobuf.AbstractParser<AbortTransactionReply>() {
+      public AbortTransactionReply parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new AbortTransactionReply(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<AbortTransactionReply> getParserForType() {
+      return PARSER;
+    }
+
+    private void initFields() {
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.AbortTransactionReply}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReplyOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply build() {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply buildPartial() {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply(this);
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply other) {
+        if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply.getDefaultInstance()) return this;
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.AbortTransactionReply)
+    }
+
+    static {
+      defaultInstance = new AbortTransactionReply(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.AbortTransactionReply)
+  }
+
+  public interface CommitTransactionOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.CommitTransaction}
+   */
+  public static final class CommitTransaction extends
+      com.google.protobuf.GeneratedMessage
+      implements CommitTransactionOrBuilder {
+    // Use CommitTransaction.newBuilder() to construct.
+    private CommitTransaction(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private CommitTransaction(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final CommitTransaction defaultInstance;
+    public static CommitTransaction getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public CommitTransaction getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private CommitTransaction(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransaction_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransaction_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<CommitTransaction> PARSER =
+        new com.google.protobuf.AbstractParser<CommitTransaction>() {
+      public CommitTransaction parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new CommitTransaction(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<CommitTransaction> getParserForType() {
+      return PARSER;
+    }
+
+    private void initFields() {
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.CommitTransaction}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransaction_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransaction_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransaction_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction build() {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction buildPartial() {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction(this);
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction other) {
+        if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction.getDefaultInstance()) return this;
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CommitTransaction)
+    }
+
+    static {
+      defaultInstance = new CommitTransaction(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CommitTransaction)
+  }
+
+  public interface CommitTransactionReplyOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.CommitTransactionReply}
+   */
+  public static final class CommitTransactionReply extends
+      com.google.protobuf.GeneratedMessage
+      implements CommitTransactionReplyOrBuilder {
+    // Use CommitTransactionReply.newBuilder() to construct.
+    private CommitTransactionReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private CommitTransactionReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final CommitTransactionReply defaultInstance;
+    public static CommitTransactionReply getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public CommitTransactionReply getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private CommitTransactionReply(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<CommitTransactionReply> PARSER =
+        new com.google.protobuf.AbstractParser<CommitTransactionReply>() {
+      public CommitTransactionReply parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new CommitTransactionReply(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<CommitTransactionReply> getParserForType() {
+      return PARSER;
+    }
+
+    private void initFields() {
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.CommitTransactionReply}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReplyOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply build() {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply buildPartial() {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply(this);
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply other) {
+        if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply.getDefaultInstance()) return this;
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CommitTransactionReply)
+    }
+
+    static {
+      defaultInstance = new CommitTransactionReply(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CommitTransactionReply)
+  }
+
+  public interface PreCommitTransactionOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.PreCommitTransaction}
+   */
+  public static final class PreCommitTransaction extends
+      com.google.protobuf.GeneratedMessage
+      implements PreCommitTransactionOrBuilder {
+    // Use PreCommitTransaction.newBuilder() to construct.
+    private PreCommitTransaction(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private PreCommitTransaction(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final PreCommitTransaction defaultInstance;
+    public static PreCommitTransaction getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public PreCommitTransaction getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private PreCommitTransaction(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<PreCommitTransaction> PARSER =
+        new com.google.protobuf.AbstractParser<PreCommitTransaction>() {
+      public PreCommitTransaction parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new PreCommitTransaction(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<PreCommitTransaction> getParserForType() {
+      return PARSER;
+    }
+
+    private void initFields() {
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.PreCommitTransaction}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction build() {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction buildPartial() {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction(this);
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction other) {
+        if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction.getDefaultInstance()) return this;
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.PreCommitTransaction)
+    }
+
+    static {
+      defaultInstance = new PreCommitTransaction(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.PreCommitTransaction)
+  }
+
+  public interface PreCommitTransactionReplyOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.PreCommitTransactionReply}
+   */
+  public static final class PreCommitTransactionReply extends
+      com.google.protobuf.GeneratedMessage
+      implements PreCommitTransactionReplyOrBuilder {
+    // Use PreCommitTransactionReply.newBuilder() to construct.
+    private PreCommitTransactionReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private PreCommitTransactionReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final PreCommitTransactionReply defaultInstance;
+    public static PreCommitTransactionReply getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public PreCommitTransactionReply getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private PreCommitTransactionReply(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<PreCommitTransactionReply> PARSER =
+        new com.google.protobuf.AbstractParser<PreCommitTransactionReply>() {
+      public PreCommitTransactionReply parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new PreCommitTransactionReply(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<PreCommitTransactionReply> getParserForType() {
+      return PARSER;
+    }
+
+    private void initFields() {
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.PreCommitTransactionReply}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReplyOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply.class, org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply build() {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply buildPartial() {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply(this);
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply other) {
+        if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply.getDefaultInstance()) return this;
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.PreCommitTransactionReply)
+    }
+
+    static {
+      defaultInstance = new PreCommitTransactionReply(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.PreCommitTransactionReply)
+  }
+
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_AbortTransaction_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_AbortTransaction_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_CommitTransaction_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_CommitTransaction_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_fieldAccessorTable;
+
+  public static com.google.protobuf.Descriptors.FileDescriptor
+      getDescriptor() {
+    return descriptor;
+  }
+  private static com.google.protobuf.Descriptors.FileDescriptor
+      descriptor;
+  static {
+    java.lang.String[] descriptorData = {
+      "\n\014Cohort.proto\022!org.opendaylight.control" +
+      "ler.mdsal\"\026\n\024CanCommitTransaction\".\n\031Can" +
+      "CommitTransactionReply\022\021\n\tcanCommit\030\001 \002(" +
+      "\010\"\022\n\020AbortTransaction\"\027\n\025AbortTransactio" +
+      "nReply\"\023\n\021CommitTransaction\"\030\n\026CommitTra" +
+      "nsactionReply\"\026\n\024PreCommitTransaction\"\033\n" +
+      "\031PreCommitTransactionReplyBZ\n8org.openda" +
+      "ylight.controller.protobuff.messages.coh" +
+      "ort3pcB\036ThreePhaseCommitCohortMessages"
+    };
+    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+        public com.google.protobuf.ExtensionRegistry assignDescriptors(
+            com.google.protobuf.Descriptors.FileDescriptor root) {
+          descriptor = root;
+          internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_descriptor =
+            getDescriptor().getMessageTypes().get(0);
+          internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_descriptor,
+              new java.lang.String[] { });
+          internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_descriptor =
+            getDescriptor().getMessageTypes().get(1);
+          internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_descriptor,
+              new java.lang.String[] { "CanCommit", });
+          internal_static_org_opendaylight_controller_mdsal_AbortTransaction_descriptor =
+            getDescriptor().getMessageTypes().get(2);
+          internal_static_org_opendaylight_controller_mdsal_AbortTransaction_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_AbortTransaction_descriptor,
+              new java.lang.String[] { });
+          internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_descriptor =
+            getDescriptor().getMessageTypes().get(3);
+          internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_descriptor,
+              new java.lang.String[] { });
+          internal_static_org_opendaylight_controller_mdsal_CommitTransaction_descriptor =
+            getDescriptor().getMessageTypes().get(4);
+          internal_static_org_opendaylight_controller_mdsal_CommitTransaction_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_CommitTransaction_descriptor,
+              new java.lang.String[] { });
+          internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_descriptor =
+            getDescriptor().getMessageTypes().get(5);
+          internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_descriptor,
+              new java.lang.String[] { });
+          internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_descriptor =
+            getDescriptor().getMessageTypes().get(6);
+          internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_descriptor,
+              new java.lang.String[] { });
+          internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_descriptor =
+            getDescriptor().getMessageTypes().get(7);
+          internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_descriptor,
+              new java.lang.String[] { });
+          return null;
+        }
+      };
+    com.google.protobuf.Descriptors.FileDescriptor
+      .internalBuildGeneratedFileFrom(descriptorData,
+        new com.google.protobuf.Descriptors.FileDescriptor[] {
+        }, assigner);
+  }
+
+  // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/common/NormalizedNodeMessages.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/common/NormalizedNodeMessages.java
new file mode 100644 (file)
index 0000000..81e5b46
--- /dev/null
@@ -0,0 +1,7541 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: Common.proto
+
+package org.opendaylight.controller.protobuff.messages.common;
+
+public final class NormalizedNodeMessages {
+  private NormalizedNodeMessages() {}
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistry registry) {
+  }
+  public interface AttributeOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required string name = 1;
+    /**
+     * <code>required string name = 1;</code>
+     */
+    boolean hasName();
+    /**
+     * <code>required string name = 1;</code>
+     */
+    java.lang.String getName();
+    /**
+     * <code>required string name = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getNameBytes();
+
+    // optional string value = 2;
+    /**
+     * <code>optional string value = 2;</code>
+     */
+    boolean hasValue();
+    /**
+     * <code>optional string value = 2;</code>
+     */
+    java.lang.String getValue();
+    /**
+     * <code>optional string value = 2;</code>
+     */
+    com.google.protobuf.ByteString
+        getValueBytes();
+
+    // optional string type = 3;
+    /**
+     * <code>optional string type = 3;</code>
+     */
+    boolean hasType();
+    /**
+     * <code>optional string type = 3;</code>
+     */
+    java.lang.String getType();
+    /**
+     * <code>optional string type = 3;</code>
+     */
+    com.google.protobuf.ByteString
+        getTypeBytes();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.Attribute}
+   */
+  public static final class Attribute extends
+      com.google.protobuf.GeneratedMessage
+      implements AttributeOrBuilder {
+    // Use Attribute.newBuilder() to construct.
+    private Attribute(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private Attribute(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final Attribute defaultInstance;
+    public static Attribute getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public Attribute getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private Attribute(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              bitField0_ |= 0x00000001;
+              name_ = input.readBytes();
+              break;
+            }
+            case 18: {
+              bitField0_ |= 0x00000002;
+              value_ = input.readBytes();
+              break;
+            }
+            case 26: {
+              bitField0_ |= 0x00000004;
+              type_ = input.readBytes();
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Attribute_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Attribute_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<Attribute> PARSER =
+        new com.google.protobuf.AbstractParser<Attribute>() {
+      public Attribute parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new Attribute(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<Attribute> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required string name = 1;
+    public static final int NAME_FIELD_NUMBER = 1;
+    private java.lang.Object name_;
+    /**
+     * <code>required string name = 1;</code>
+     */
+    public boolean hasName() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required string name = 1;</code>
+     */
+    public java.lang.String getName() {
+      java.lang.Object ref = name_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          name_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string name = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getNameBytes() {
+      java.lang.Object ref = name_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        name_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // optional string value = 2;
+    public static final int VALUE_FIELD_NUMBER = 2;
+    private java.lang.Object value_;
+    /**
+     * <code>optional string value = 2;</code>
+     */
+    public boolean hasValue() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>optional string value = 2;</code>
+     */
+    public java.lang.String getValue() {
+      java.lang.Object ref = value_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          value_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string value = 2;</code>
+     */
+    public com.google.protobuf.ByteString
+        getValueBytes() {
+      java.lang.Object ref = value_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        value_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // optional string type = 3;
+    public static final int TYPE_FIELD_NUMBER = 3;
+    private java.lang.Object type_;
+    /**
+     * <code>optional string type = 3;</code>
+     */
+    public boolean hasType() {
+      return ((bitField0_ & 0x00000004) == 0x00000004);
+    }
+    /**
+     * <code>optional string type = 3;</code>
+     */
+    public java.lang.String getType() {
+      java.lang.Object ref = type_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          type_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string type = 3;</code>
+     */
+    public com.google.protobuf.ByteString
+        getTypeBytes() {
+      java.lang.Object ref = type_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        type_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    private void initFields() {
+      name_ = "";
+      value_ = "";
+      type_ = "";
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasName()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeBytes(1, getNameBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeBytes(2, getValueBytes());
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        output.writeBytes(3, getTypeBytes());
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(1, getNameBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(2, getValueBytes());
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(3, getTypeBytes());
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.Attribute}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Attribute_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Attribute_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        name_ = "";
+        bitField0_ = (bitField0_ & ~0x00000001);
+        value_ = "";
+        bitField0_ = (bitField0_ & ~0x00000002);
+        type_ = "";
+        bitField0_ = (bitField0_ & ~0x00000004);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Attribute_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute build() {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute buildPartial() {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.name_ = name_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.value_ = value_;
+        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+          to_bitField0_ |= 0x00000004;
+        }
+        result.type_ = type_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute other) {
+        if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance()) return this;
+        if (other.hasName()) {
+          bitField0_ |= 0x00000001;
+          name_ = other.name_;
+          onChanged();
+        }
+        if (other.hasValue()) {
+          bitField0_ |= 0x00000002;
+          value_ = other.value_;
+          onChanged();
+        }
+        if (other.hasType()) {
+          bitField0_ |= 0x00000004;
+          type_ = other.type_;
+          onChanged();
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasName()) {
+          
+          return false;
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required string name = 1;
+      private java.lang.Object name_ = "";
+      /**
+       * <code>required string name = 1;</code>
+       */
+      public boolean hasName() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required string name = 1;</code>
+       */
+      public java.lang.String getName() {
+        java.lang.Object ref = name_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          name_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string name = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getNameBytes() {
+        java.lang.Object ref = name_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          name_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string name = 1;</code>
+       */
+      public Builder setName(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        name_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string name = 1;</code>
+       */
+      public Builder clearName() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        name_ = getDefaultInstance().getName();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string name = 1;</code>
+       */
+      public Builder setNameBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        name_ = value;
+        onChanged();
+        return this;
+      }
+
+      // optional string value = 2;
+      private java.lang.Object value_ = "";
+      /**
+       * <code>optional string value = 2;</code>
+       */
+      public boolean hasValue() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>optional string value = 2;</code>
+       */
+      public java.lang.String getValue() {
+        java.lang.Object ref = value_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          value_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string value = 2;</code>
+       */
+      public com.google.protobuf.ByteString
+          getValueBytes() {
+        java.lang.Object ref = value_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          value_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string value = 2;</code>
+       */
+      public Builder setValue(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        value_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string value = 2;</code>
+       */
+      public Builder clearValue() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        value_ = getDefaultInstance().getValue();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string value = 2;</code>
+       */
+      public Builder setValueBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        value_ = value;
+        onChanged();
+        return this;
+      }
+
+      // optional string type = 3;
+      private java.lang.Object type_ = "";
+      /**
+       * <code>optional string type = 3;</code>
+       */
+      public boolean hasType() {
+        return ((bitField0_ & 0x00000004) == 0x00000004);
+      }
+      /**
+       * <code>optional string type = 3;</code>
+       */
+      public java.lang.String getType() {
+        java.lang.Object ref = type_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          type_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string type = 3;</code>
+       */
+      public com.google.protobuf.ByteString
+          getTypeBytes() {
+        java.lang.Object ref = type_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          type_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string type = 3;</code>
+       */
+      public Builder setType(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000004;
+        type_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string type = 3;</code>
+       */
+      public Builder clearType() {
+        bitField0_ = (bitField0_ & ~0x00000004);
+        type_ = getDefaultInstance().getType();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string type = 3;</code>
+       */
+      public Builder setTypeBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000004;
+        type_ = value;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.Attribute)
+    }
+
+    static {
+      defaultInstance = new Attribute(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.Attribute)
+  }
+
+  public interface QNameOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required string value = 1;
+    /**
+     * <code>required string value = 1;</code>
+     */
+    boolean hasValue();
+    /**
+     * <code>required string value = 1;</code>
+     */
+    java.lang.String getValue();
+    /**
+     * <code>required string value = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getValueBytes();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.QName}
+   */
+  public static final class QName extends
+      com.google.protobuf.GeneratedMessage
+      implements QNameOrBuilder {
+    // Use QName.newBuilder() to construct.
+    private QName(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private QName(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final QName defaultInstance;
+    public static QName getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public QName getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private QName(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              bitField0_ |= 0x00000001;
+              value_ = input.readBytes();
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_QName_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_QName_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<QName> PARSER =
+        new com.google.protobuf.AbstractParser<QName>() {
+      public QName parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new QName(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<QName> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required string value = 1;
+    public static final int VALUE_FIELD_NUMBER = 1;
+    private java.lang.Object value_;
+    /**
+     * <code>required string value = 1;</code>
+     */
+    public boolean hasValue() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required string value = 1;</code>
+     */
+    public java.lang.String getValue() {
+      java.lang.Object ref = value_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          value_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string value = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getValueBytes() {
+      java.lang.Object ref = value_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        value_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    private void initFields() {
+      value_ = "";
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasValue()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeBytes(1, getValueBytes());
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(1, getValueBytes());
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.QName}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_QName_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_QName_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        value_ = "";
+        bitField0_ = (bitField0_ & ~0x00000001);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_QName_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName build() {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName buildPartial() {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.value_ = value_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName other) {
+        if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance()) return this;
+        if (other.hasValue()) {
+          bitField0_ |= 0x00000001;
+          value_ = other.value_;
+          onChanged();
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasValue()) {
+          
+          return false;
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required string value = 1;
+      private java.lang.Object value_ = "";
+      /**
+       * <code>required string value = 1;</code>
+       */
+      public boolean hasValue() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required string value = 1;</code>
+       */
+      public java.lang.String getValue() {
+        java.lang.Object ref = value_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          value_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string value = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getValueBytes() {
+        java.lang.Object ref = value_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          value_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string value = 1;</code>
+       */
+      public Builder setValue(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        value_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string value = 1;</code>
+       */
+      public Builder clearValue() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        value_ = getDefaultInstance().getValue();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string value = 1;</code>
+       */
+      public Builder setValueBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        value_ = value;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.QName)
+    }
+
+    static {
+      defaultInstance = new QName(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.QName)
+  }
+
+  public interface PathArgumentOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required string value = 1;
+    /**
+     * <code>required string value = 1;</code>
+     */
+    boolean hasValue();
+    /**
+     * <code>required string value = 1;</code>
+     */
+    java.lang.String getValue();
+    /**
+     * <code>required string value = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getValueBytes();
+
+    // optional string type = 2;
+    /**
+     * <code>optional string type = 2;</code>
+     *
+     * <pre>
+     *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+     * </pre>
+     */
+    boolean hasType();
+    /**
+     * <code>optional string type = 2;</code>
+     *
+     * <pre>
+     *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+     * </pre>
+     */
+    java.lang.String getType();
+    /**
+     * <code>optional string type = 2;</code>
+     *
+     * <pre>
+     *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+     * </pre>
+     */
+    com.google.protobuf.ByteString
+        getTypeBytes();
+
+    // optional .org.opendaylight.controller.mdsal.QName nodeType = 3;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+     */
+    boolean hasNodeType();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName getNodeType();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNodeTypeOrBuilder();
+
+    // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     */
+    java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> 
+        getAttributesList();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index);
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     */
+    int getAttributesCount();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     */
+    java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> 
+        getAttributesOrBuilderList();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder(
+        int index);
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.PathArgument}
+   */
+  public static final class PathArgument extends
+      com.google.protobuf.GeneratedMessage
+      implements PathArgumentOrBuilder {
+    // Use PathArgument.newBuilder() to construct.
+    private PathArgument(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private PathArgument(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final PathArgument defaultInstance;
+    public static PathArgument getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public PathArgument getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private PathArgument(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              bitField0_ |= 0x00000001;
+              value_ = input.readBytes();
+              break;
+            }
+            case 18: {
+              bitField0_ |= 0x00000002;
+              type_ = input.readBytes();
+              break;
+            }
+            case 26: {
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000004) == 0x00000004)) {
+                subBuilder = nodeType_.toBuilder();
+              }
+              nodeType_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(nodeType_);
+                nodeType_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000004;
+              break;
+            }
+            case 34: {
+              if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
+                attributes_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>();
+                mutable_bitField0_ |= 0x00000008;
+              }
+              attributes_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.PARSER, extensionRegistry));
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
+          attributes_ = java.util.Collections.unmodifiableList(attributes_);
+        }
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgument_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<PathArgument> PARSER =
+        new com.google.protobuf.AbstractParser<PathArgument>() {
+      public PathArgument parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new PathArgument(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<PathArgument> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required string value = 1;
+    public static final int VALUE_FIELD_NUMBER = 1;
+    private java.lang.Object value_;
+    /**
+     * <code>required string value = 1;</code>
+     */
+    public boolean hasValue() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required string value = 1;</code>
+     */
+    public java.lang.String getValue() {
+      java.lang.Object ref = value_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          value_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string value = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getValueBytes() {
+      java.lang.Object ref = value_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        value_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // optional string type = 2;
+    public static final int TYPE_FIELD_NUMBER = 2;
+    private java.lang.Object type_;
+    /**
+     * <code>optional string type = 2;</code>
+     *
+     * <pre>
+     *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+     * </pre>
+     */
+    public boolean hasType() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>optional string type = 2;</code>
+     *
+     * <pre>
+     *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+     * </pre>
+     */
+    public java.lang.String getType() {
+      java.lang.Object ref = type_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          type_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string type = 2;</code>
+     *
+     * <pre>
+     *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+     * </pre>
+     */
+    public com.google.protobuf.ByteString
+        getTypeBytes() {
+      java.lang.Object ref = type_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        type_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // optional .org.opendaylight.controller.mdsal.QName nodeType = 3;
+    public static final int NODETYPE_FIELD_NUMBER = 3;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName nodeType_;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+     */
+    public boolean hasNodeType() {
+      return ((bitField0_ & 0x00000004) == 0x00000004);
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName getNodeType() {
+      return nodeType_;
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNodeTypeOrBuilder() {
+      return nodeType_;
+    }
+
+    // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;
+    public static final int ATTRIBUTES_FIELD_NUMBER = 4;
+    private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> attributes_;
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     */
+    public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> getAttributesList() {
+      return attributes_;
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     */
+    public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> 
+        getAttributesOrBuilderList() {
+      return attributes_;
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     */
+    public int getAttributesCount() {
+      return attributes_.size();
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index) {
+      return attributes_.get(index);
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder(
+        int index) {
+      return attributes_.get(index);
+    }
+
+    private void initFields() {
+      value_ = "";
+      type_ = "";
+      nodeType_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+      attributes_ = java.util.Collections.emptyList();
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasValue()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (hasNodeType()) {
+        if (!getNodeType().isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      for (int i = 0; i < getAttributesCount(); i++) {
+        if (!getAttributes(i).isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeBytes(1, getValueBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeBytes(2, getTypeBytes());
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        output.writeMessage(3, nodeType_);
+      }
+      for (int i = 0; i < attributes_.size(); i++) {
+        output.writeMessage(4, attributes_.get(i));
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(1, getValueBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(2, getTypeBytes());
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(3, nodeType_);
+      }
+      for (int i = 0; i < attributes_.size(); i++) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(4, attributes_.get(i));
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.PathArgument}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgument_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getNodeTypeFieldBuilder();
+          getAttributesFieldBuilder();
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        value_ = "";
+        bitField0_ = (bitField0_ & ~0x00000001);
+        type_ = "";
+        bitField0_ = (bitField0_ & ~0x00000002);
+        if (nodeTypeBuilder_ == null) {
+          nodeType_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+        } else {
+          nodeTypeBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000004);
+        if (attributesBuilder_ == null) {
+          attributes_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000008);
+        } else {
+          attributesBuilder_.clear();
+        }
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument build() {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument buildPartial() {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.value_ = value_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.type_ = type_;
+        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+          to_bitField0_ |= 0x00000004;
+        }
+        if (nodeTypeBuilder_ == null) {
+          result.nodeType_ = nodeType_;
+        } else {
+          result.nodeType_ = nodeTypeBuilder_.build();
+        }
+        if (attributesBuilder_ == null) {
+          if (((bitField0_ & 0x00000008) == 0x00000008)) {
+            attributes_ = java.util.Collections.unmodifiableList(attributes_);
+            bitField0_ = (bitField0_ & ~0x00000008);
+          }
+          result.attributes_ = attributes_;
+        } else {
+          result.attributes_ = attributesBuilder_.build();
+        }
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument other) {
+        if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.getDefaultInstance()) return this;
+        if (other.hasValue()) {
+          bitField0_ |= 0x00000001;
+          value_ = other.value_;
+          onChanged();
+        }
+        if (other.hasType()) {
+          bitField0_ |= 0x00000002;
+          type_ = other.type_;
+          onChanged();
+        }
+        if (other.hasNodeType()) {
+          mergeNodeType(other.getNodeType());
+        }
+        if (attributesBuilder_ == null) {
+          if (!other.attributes_.isEmpty()) {
+            if (attributes_.isEmpty()) {
+              attributes_ = other.attributes_;
+              bitField0_ = (bitField0_ & ~0x00000008);
+            } else {
+              ensureAttributesIsMutable();
+              attributes_.addAll(other.attributes_);
+            }
+            onChanged();
+          }
+        } else {
+          if (!other.attributes_.isEmpty()) {
+            if (attributesBuilder_.isEmpty()) {
+              attributesBuilder_.dispose();
+              attributesBuilder_ = null;
+              attributes_ = other.attributes_;
+              bitField0_ = (bitField0_ & ~0x00000008);
+              attributesBuilder_ = 
+                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+                   getAttributesFieldBuilder() : null;
+            } else {
+              attributesBuilder_.addAllMessages(other.attributes_);
+            }
+          }
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasValue()) {
+          
+          return false;
+        }
+        if (hasNodeType()) {
+          if (!getNodeType().isInitialized()) {
+            
+            return false;
+          }
+        }
+        for (int i = 0; i < getAttributesCount(); i++) {
+          if (!getAttributes(i).isInitialized()) {
+            
+            return false;
+          }
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required string value = 1;
+      private java.lang.Object value_ = "";
+      /**
+       * <code>required string value = 1;</code>
+       */
+      public boolean hasValue() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required string value = 1;</code>
+       */
+      public java.lang.String getValue() {
+        java.lang.Object ref = value_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          value_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string value = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getValueBytes() {
+        java.lang.Object ref = value_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          value_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string value = 1;</code>
+       */
+      public Builder setValue(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        value_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string value = 1;</code>
+       */
+      public Builder clearValue() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        value_ = getDefaultInstance().getValue();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string value = 1;</code>
+       */
+      public Builder setValueBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        value_ = value;
+        onChanged();
+        return this;
+      }
+
+      // optional string type = 2;
+      private java.lang.Object type_ = "";
+      /**
+       * <code>optional string type = 2;</code>
+       *
+       * <pre>
+       *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+       * </pre>
+       */
+      public boolean hasType() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>optional string type = 2;</code>
+       *
+       * <pre>
+       *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+       * </pre>
+       */
+      public java.lang.String getType() {
+        java.lang.Object ref = type_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          type_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string type = 2;</code>
+       *
+       * <pre>
+       *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+       * </pre>
+       */
+      public com.google.protobuf.ByteString
+          getTypeBytes() {
+        java.lang.Object ref = type_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          type_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string type = 2;</code>
+       *
+       * <pre>
+       *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+       * </pre>
+       */
+      public Builder setType(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        type_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string type = 2;</code>
+       *
+       * <pre>
+       *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+       * </pre>
+       */
+      public Builder clearType() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        type_ = getDefaultInstance().getType();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string type = 2;</code>
+       *
+       * <pre>
+       *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+       * </pre>
+       */
+      public Builder setTypeBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        type_ = value;
+        onChanged();
+        return this;
+      }
+
+      // optional .org.opendaylight.controller.mdsal.QName nodeType = 3;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName nodeType_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder> nodeTypeBuilder_;
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       */
+      public boolean hasNodeType() {
+        return ((bitField0_ & 0x00000004) == 0x00000004);
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName getNodeType() {
+        if (nodeTypeBuilder_ == null) {
+          return nodeType_;
+        } else {
+          return nodeTypeBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       */
+      public Builder setNodeType(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName value) {
+        if (nodeTypeBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          nodeType_ = value;
+          onChanged();
+        } else {
+          nodeTypeBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000004;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       */
+      public Builder setNodeType(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder builderForValue) {
+        if (nodeTypeBuilder_ == null) {
+          nodeType_ = builderForValue.build();
+          onChanged();
+        } else {
+          nodeTypeBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000004;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       */
+      public Builder mergeNodeType(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName value) {
+        if (nodeTypeBuilder_ == null) {
+          if (((bitField0_ & 0x00000004) == 0x00000004) &&
+              nodeType_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance()) {
+            nodeType_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.newBuilder(nodeType_).mergeFrom(value).buildPartial();
+          } else {
+            nodeType_ = value;
+          }
+          onChanged();
+        } else {
+          nodeTypeBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000004;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       */
+      public Builder clearNodeType() {
+        if (nodeTypeBuilder_ == null) {
+          nodeType_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+          onChanged();
+        } else {
+          nodeTypeBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000004);
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder getNodeTypeBuilder() {
+        bitField0_ |= 0x00000004;
+        onChanged();
+        return getNodeTypeFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNodeTypeOrBuilder() {
+        if (nodeTypeBuilder_ != null) {
+          return nodeTypeBuilder_.getMessageOrBuilder();
+        } else {
+          return nodeType_;
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder> 
+          getNodeTypeFieldBuilder() {
+        if (nodeTypeBuilder_ == null) {
+          nodeTypeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>(
+                  nodeType_,
+                  getParentForChildren(),
+                  isClean());
+          nodeType_ = null;
+        }
+        return nodeTypeBuilder_;
+      }
+
+      // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;
+      private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> attributes_ =
+        java.util.Collections.emptyList();
+      private void ensureAttributesIsMutable() {
+        if (!((bitField0_ & 0x00000008) == 0x00000008)) {
+          attributes_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>(attributes_);
+          bitField0_ |= 0x00000008;
+         }
+      }
+
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> attributesBuilder_;
+
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       */
+      public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> getAttributesList() {
+        if (attributesBuilder_ == null) {
+          return java.util.Collections.unmodifiableList(attributes_);
+        } else {
+          return attributesBuilder_.getMessageList();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       */
+      public int getAttributesCount() {
+        if (attributesBuilder_ == null) {
+          return attributes_.size();
+        } else {
+          return attributesBuilder_.getCount();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index) {
+        if (attributesBuilder_ == null) {
+          return attributes_.get(index);
+        } else {
+          return attributesBuilder_.getMessage(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       */
+      public Builder setAttributes(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) {
+        if (attributesBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureAttributesIsMutable();
+          attributes_.set(index, value);
+          onChanged();
+        } else {
+          attributesBuilder_.setMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       */
+      public Builder setAttributes(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) {
+        if (attributesBuilder_ == null) {
+          ensureAttributesIsMutable();
+          attributes_.set(index, builderForValue.build());
+          onChanged();
+        } else {
+          attributesBuilder_.setMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       */
+      public Builder addAttributes(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) {
+        if (attributesBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureAttributesIsMutable();
+          attributes_.add(value);
+          onChanged();
+        } else {
+          attributesBuilder_.addMessage(value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       */
+      public Builder addAttributes(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) {
+        if (attributesBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureAttributesIsMutable();
+          attributes_.add(index, value);
+          onChanged();
+        } else {
+          attributesBuilder_.addMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       */
+      public Builder addAttributes(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) {
+        if (attributesBuilder_ == null) {
+          ensureAttributesIsMutable();
+          attributes_.add(builderForValue.build());
+          onChanged();
+        } else {
+          attributesBuilder_.addMessage(builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       */
+      public Builder addAttributes(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) {
+        if (attributesBuilder_ == null) {
+          ensureAttributesIsMutable();
+          attributes_.add(index, builderForValue.build());
+          onChanged();
+        } else {
+          attributesBuilder_.addMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       */
+      public Builder addAllAttributes(
+          java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> values) {
+        if (attributesBuilder_ == null) {
+          ensureAttributesIsMutable();
+          super.addAll(values, attributes_);
+          onChanged();
+        } else {
+          attributesBuilder_.addAllMessages(values);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       */
+      public Builder clearAttributes() {
+        if (attributesBuilder_ == null) {
+          attributes_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000008);
+          onChanged();
+        } else {
+          attributesBuilder_.clear();
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       */
+      public Builder removeAttributes(int index) {
+        if (attributesBuilder_ == null) {
+          ensureAttributesIsMutable();
+          attributes_.remove(index);
+          onChanged();
+        } else {
+          attributesBuilder_.remove(index);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder getAttributesBuilder(
+          int index) {
+        return getAttributesFieldBuilder().getBuilder(index);
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder(
+          int index) {
+        if (attributesBuilder_ == null) {
+          return attributes_.get(index);  } else {
+          return attributesBuilder_.getMessageOrBuilder(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       */
+      public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> 
+           getAttributesOrBuilderList() {
+        if (attributesBuilder_ != null) {
+          return attributesBuilder_.getMessageOrBuilderList();
+        } else {
+          return java.util.Collections.unmodifiableList(attributes_);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder addAttributesBuilder() {
+        return getAttributesFieldBuilder().addBuilder(
+            org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder addAttributesBuilder(
+          int index) {
+        return getAttributesFieldBuilder().addBuilder(
+            index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       */
+      public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder> 
+           getAttributesBuilderList() {
+        return getAttributesFieldBuilder().getBuilderList();
+      }
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> 
+          getAttributesFieldBuilder() {
+        if (attributesBuilder_ == null) {
+          attributesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>(
+                  attributes_,
+                  ((bitField0_ & 0x00000008) == 0x00000008),
+                  getParentForChildren(),
+                  isClean());
+          attributes_ = null;
+        }
+        return attributesBuilder_;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.PathArgument)
+    }
+
+    static {
+      defaultInstance = new PathArgument(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.PathArgument)
+  }
+
+  public interface InstanceIdentifierOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+     */
+    java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument> 
+        getArgumentsList();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument getArguments(int index);
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+     */
+    int getArgumentsCount();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+     */
+    java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder> 
+        getArgumentsOrBuilderList();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder getArgumentsOrBuilder(
+        int index);
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.InstanceIdentifier}
+   */
+  public static final class InstanceIdentifier extends
+      com.google.protobuf.GeneratedMessage
+      implements InstanceIdentifierOrBuilder {
+    // Use InstanceIdentifier.newBuilder() to construct.
+    private InstanceIdentifier(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private InstanceIdentifier(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final InstanceIdentifier defaultInstance;
+    public static InstanceIdentifier getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public InstanceIdentifier getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private InstanceIdentifier(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+                arguments_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument>();
+                mutable_bitField0_ |= 0x00000001;
+              }
+              arguments_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.PARSER, extensionRegistry));
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+          arguments_ = java.util.Collections.unmodifiableList(arguments_);
+        }
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<InstanceIdentifier> PARSER =
+        new com.google.protobuf.AbstractParser<InstanceIdentifier>() {
+      public InstanceIdentifier parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new InstanceIdentifier(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<InstanceIdentifier> getParserForType() {
+      return PARSER;
+    }
+
+    // repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;
+    public static final int ARGUMENTS_FIELD_NUMBER = 1;
+    private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument> arguments_;
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+     */
+    public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument> getArgumentsList() {
+      return arguments_;
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+     */
+    public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder> 
+        getArgumentsOrBuilderList() {
+      return arguments_;
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+     */
+    public int getArgumentsCount() {
+      return arguments_.size();
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument getArguments(int index) {
+      return arguments_.get(index);
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder getArgumentsOrBuilder(
+        int index) {
+      return arguments_.get(index);
+    }
+
+    private void initFields() {
+      arguments_ = java.util.Collections.emptyList();
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      for (int i = 0; i < getArgumentsCount(); i++) {
+        if (!getArguments(i).isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      for (int i = 0; i < arguments_.size(); i++) {
+        output.writeMessage(1, arguments_.get(i));
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      for (int i = 0; i < arguments_.size(); i++) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(1, arguments_.get(i));
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.InstanceIdentifier}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getArgumentsFieldBuilder();
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        if (argumentsBuilder_ == null) {
+          arguments_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000001);
+        } else {
+          argumentsBuilder_.clear();
+        }
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier build() {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier buildPartial() {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier(this);
+        int from_bitField0_ = bitField0_;
+        if (argumentsBuilder_ == null) {
+          if (((bitField0_ & 0x00000001) == 0x00000001)) {
+            arguments_ = java.util.Collections.unmodifiableList(arguments_);
+            bitField0_ = (bitField0_ & ~0x00000001);
+          }
+          result.arguments_ = arguments_;
+        } else {
+          result.arguments_ = argumentsBuilder_.build();
+        }
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier other) {
+        if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) return this;
+        if (argumentsBuilder_ == null) {
+          if (!other.arguments_.isEmpty()) {
+            if (arguments_.isEmpty()) {
+              arguments_ = other.arguments_;
+              bitField0_ = (bitField0_ & ~0x00000001);
+            } else {
+              ensureArgumentsIsMutable();
+              arguments_.addAll(other.arguments_);
+            }
+            onChanged();
+          }
+        } else {
+          if (!other.arguments_.isEmpty()) {
+            if (argumentsBuilder_.isEmpty()) {
+              argumentsBuilder_.dispose();
+              argumentsBuilder_ = null;
+              arguments_ = other.arguments_;
+              bitField0_ = (bitField0_ & ~0x00000001);
+              argumentsBuilder_ = 
+                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+                   getArgumentsFieldBuilder() : null;
+            } else {
+              argumentsBuilder_.addAllMessages(other.arguments_);
+            }
+          }
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        for (int i = 0; i < getArgumentsCount(); i++) {
+          if (!getArguments(i).isInitialized()) {
+            
+            return false;
+          }
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;
+      private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument> arguments_ =
+        java.util.Collections.emptyList();
+      private void ensureArgumentsIsMutable() {
+        if (!((bitField0_ & 0x00000001) == 0x00000001)) {
+          arguments_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument>(arguments_);
+          bitField0_ |= 0x00000001;
+         }
+      }
+
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder> argumentsBuilder_;
+
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+       */
+      public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument> getArgumentsList() {
+        if (argumentsBuilder_ == null) {
+          return java.util.Collections.unmodifiableList(arguments_);
+        } else {
+          return argumentsBuilder_.getMessageList();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+       */
+      public int getArgumentsCount() {
+        if (argumentsBuilder_ == null) {
+          return arguments_.size();
+        } else {
+          return argumentsBuilder_.getCount();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument getArguments(int index) {
+        if (argumentsBuilder_ == null) {
+          return arguments_.get(index);
+        } else {
+          return argumentsBuilder_.getMessage(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+       */
+      public Builder setArguments(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument value) {
+        if (argumentsBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureArgumentsIsMutable();
+          arguments_.set(index, value);
+          onChanged();
+        } else {
+          argumentsBuilder_.setMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+       */
+      public Builder setArguments(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder builderForValue) {
+        if (argumentsBuilder_ == null) {
+          ensureArgumentsIsMutable();
+          arguments_.set(index, builderForValue.build());
+          onChanged();
+        } else {
+          argumentsBuilder_.setMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+       */
+      public Builder addArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument value) {
+        if (argumentsBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureArgumentsIsMutable();
+          arguments_.add(value);
+          onChanged();
+        } else {
+          argumentsBuilder_.addMessage(value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+       */
+      public Builder addArguments(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument value) {
+        if (argumentsBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureArgumentsIsMutable();
+          arguments_.add(index, value);
+          onChanged();
+        } else {
+          argumentsBuilder_.addMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+       */
+      public Builder addArguments(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder builderForValue) {
+        if (argumentsBuilder_ == null) {
+          ensureArgumentsIsMutable();
+          arguments_.add(builderForValue.build());
+          onChanged();
+        } else {
+          argumentsBuilder_.addMessage(builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+       */
+      public Builder addArguments(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder builderForValue) {
+        if (argumentsBuilder_ == null) {
+          ensureArgumentsIsMutable();
+          arguments_.add(index, builderForValue.build());
+          onChanged();
+        } else {
+          argumentsBuilder_.addMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+       */
+      public Builder addAllArguments(
+          java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument> values) {
+        if (argumentsBuilder_ == null) {
+          ensureArgumentsIsMutable();
+          super.addAll(values, arguments_);
+          onChanged();
+        } else {
+          argumentsBuilder_.addAllMessages(values);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+       */
+      public Builder clearArguments() {
+        if (argumentsBuilder_ == null) {
+          arguments_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000001);
+          onChanged();
+        } else {
+          argumentsBuilder_.clear();
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+       */
+      public Builder removeArguments(int index) {
+        if (argumentsBuilder_ == null) {
+          ensureArgumentsIsMutable();
+          arguments_.remove(index);
+          onChanged();
+        } else {
+          argumentsBuilder_.remove(index);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder getArgumentsBuilder(
+          int index) {
+        return getArgumentsFieldBuilder().getBuilder(index);
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder getArgumentsOrBuilder(
+          int index) {
+        if (argumentsBuilder_ == null) {
+          return arguments_.get(index);  } else {
+          return argumentsBuilder_.getMessageOrBuilder(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+       */
+      public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder> 
+           getArgumentsOrBuilderList() {
+        if (argumentsBuilder_ != null) {
+          return argumentsBuilder_.getMessageOrBuilderList();
+        } else {
+          return java.util.Collections.unmodifiableList(arguments_);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder addArgumentsBuilder() {
+        return getArgumentsFieldBuilder().addBuilder(
+            org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder addArgumentsBuilder(
+          int index) {
+        return getArgumentsFieldBuilder().addBuilder(
+            index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
+       */
+      public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder> 
+           getArgumentsBuilderList() {
+        return getArgumentsFieldBuilder().getBuilderList();
+      }
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder> 
+          getArgumentsFieldBuilder() {
+        if (argumentsBuilder_ == null) {
+          argumentsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder>(
+                  arguments_,
+                  ((bitField0_ & 0x00000001) == 0x00000001),
+                  getParentForChildren(),
+                  isClean());
+          arguments_ = null;
+        }
+        return argumentsBuilder_;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.InstanceIdentifier)
+    }
+
+    static {
+      defaultInstance = new InstanceIdentifier(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.InstanceIdentifier)
+  }
+
+  public interface NodeOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // optional string path = 1;
+    /**
+     * <code>optional string path = 1;</code>
+     */
+    boolean hasPath();
+    /**
+     * <code>optional string path = 1;</code>
+     */
+    java.lang.String getPath();
+    /**
+     * <code>optional string path = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getPathBytes();
+
+    // optional string type = 2;
+    /**
+     * <code>optional string type = 2;</code>
+     */
+    boolean hasType();
+    /**
+     * <code>optional string type = 2;</code>
+     */
+    java.lang.String getType();
+    /**
+     * <code>optional string type = 2;</code>
+     */
+    com.google.protobuf.ByteString
+        getTypeBytes();
+
+    // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     */
+    java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> 
+        getAttributesList();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index);
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     */
+    int getAttributesCount();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     */
+    java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> 
+        getAttributesOrBuilderList();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder(
+        int index);
+
+    // repeated .org.opendaylight.controller.mdsal.Node child = 4;
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     */
+    java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node> 
+        getChildList();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getChild(int index);
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     */
+    int getChildCount();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     */
+    java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> 
+        getChildOrBuilderList();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getChildOrBuilder(
+        int index);
+
+    // optional string value = 5;
+    /**
+     * <code>optional string value = 5;</code>
+     */
+    boolean hasValue();
+    /**
+     * <code>optional string value = 5;</code>
+     */
+    java.lang.String getValue();
+    /**
+     * <code>optional string value = 5;</code>
+     */
+    com.google.protobuf.ByteString
+        getValueBytes();
+
+    // optional string valueType = 6;
+    /**
+     * <code>optional string valueType = 6;</code>
+     */
+    boolean hasValueType();
+    /**
+     * <code>optional string valueType = 6;</code>
+     */
+    java.lang.String getValueType();
+    /**
+     * <code>optional string valueType = 6;</code>
+     */
+    com.google.protobuf.ByteString
+        getValueTypeBytes();
+
+    // repeated string bitsValue = 7;
+    /**
+     * <code>repeated string bitsValue = 7;</code>
+     */
+    java.util.List<java.lang.String>
+    getBitsValueList();
+    /**
+     * <code>repeated string bitsValue = 7;</code>
+     */
+    int getBitsValueCount();
+    /**
+     * <code>repeated string bitsValue = 7;</code>
+     */
+    java.lang.String getBitsValue(int index);
+    /**
+     * <code>repeated string bitsValue = 7;</code>
+     */
+    com.google.protobuf.ByteString
+        getBitsValueBytes(int index);
+
+    // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+     */
+    boolean hasInstanceIdentifierValue();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.Node}
+   */
+  public static final class Node extends
+      com.google.protobuf.GeneratedMessage
+      implements NodeOrBuilder {
+    // Use Node.newBuilder() to construct.
+    private Node(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private Node(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final Node defaultInstance;
+    public static Node getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public Node getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private Node(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              bitField0_ |= 0x00000001;
+              path_ = input.readBytes();
+              break;
+            }
+            case 18: {
+              bitField0_ |= 0x00000002;
+              type_ = input.readBytes();
+              break;
+            }
+            case 26: {
+              if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
+                attributes_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>();
+                mutable_bitField0_ |= 0x00000004;
+              }
+              attributes_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.PARSER, extensionRegistry));
+              break;
+            }
+            case 34: {
+              if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
+                child_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node>();
+                mutable_bitField0_ |= 0x00000008;
+              }
+              child_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry));
+              break;
+            }
+            case 42: {
+              bitField0_ |= 0x00000004;
+              value_ = input.readBytes();
+              break;
+            }
+            case 50: {
+              bitField0_ |= 0x00000008;
+              valueType_ = input.readBytes();
+              break;
+            }
+            case 58: {
+              if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) {
+                bitsValue_ = new com.google.protobuf.LazyStringArrayList();
+                mutable_bitField0_ |= 0x00000040;
+              }
+              bitsValue_.add(input.readBytes());
+              break;
+            }
+            case 66: {
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000010) == 0x00000010)) {
+                subBuilder = instanceIdentifierValue_.toBuilder();
+              }
+              instanceIdentifierValue_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(instanceIdentifierValue_);
+                instanceIdentifierValue_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000010;
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
+          attributes_ = java.util.Collections.unmodifiableList(attributes_);
+        }
+        if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
+          child_ = java.util.Collections.unmodifiableList(child_);
+        }
+        if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) {
+          bitsValue_ = new com.google.protobuf.UnmodifiableLazyStringList(bitsValue_);
+        }
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<Node> PARSER =
+        new com.google.protobuf.AbstractParser<Node>() {
+      public Node parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new Node(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<Node> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // optional string path = 1;
+    public static final int PATH_FIELD_NUMBER = 1;
+    private java.lang.Object path_;
+    /**
+     * <code>optional string path = 1;</code>
+     */
+    public boolean hasPath() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>optional string path = 1;</code>
+     */
+    public java.lang.String getPath() {
+      java.lang.Object ref = path_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          path_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string path = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getPathBytes() {
+      java.lang.Object ref = path_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        path_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // optional string type = 2;
+    public static final int TYPE_FIELD_NUMBER = 2;
+    private java.lang.Object type_;
+    /**
+     * <code>optional string type = 2;</code>
+     */
+    public boolean hasType() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>optional string type = 2;</code>
+     */
+    public java.lang.String getType() {
+      java.lang.Object ref = type_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          type_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string type = 2;</code>
+     */
+    public com.google.protobuf.ByteString
+        getTypeBytes() {
+      java.lang.Object ref = type_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        type_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;
+    public static final int ATTRIBUTES_FIELD_NUMBER = 3;
+    private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> attributes_;
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     */
+    public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> getAttributesList() {
+      return attributes_;
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     */
+    public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> 
+        getAttributesOrBuilderList() {
+      return attributes_;
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     */
+    public int getAttributesCount() {
+      return attributes_.size();
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index) {
+      return attributes_.get(index);
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder(
+        int index) {
+      return attributes_.get(index);
+    }
+
+    // repeated .org.opendaylight.controller.mdsal.Node child = 4;
+    public static final int CHILD_FIELD_NUMBER = 4;
+    private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node> child_;
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     */
+    public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node> getChildList() {
+      return child_;
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     */
+    public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> 
+        getChildOrBuilderList() {
+      return child_;
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     */
+    public int getChildCount() {
+      return child_.size();
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getChild(int index) {
+      return child_.get(index);
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getChildOrBuilder(
+        int index) {
+      return child_.get(index);
+    }
+
+    // optional string value = 5;
+    public static final int VALUE_FIELD_NUMBER = 5;
+    private java.lang.Object value_;
+    /**
+     * <code>optional string value = 5;</code>
+     */
+    public boolean hasValue() {
+      return ((bitField0_ & 0x00000004) == 0x00000004);
+    }
+    /**
+     * <code>optional string value = 5;</code>
+     */
+    public java.lang.String getValue() {
+      java.lang.Object ref = value_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          value_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string value = 5;</code>
+     */
+    public com.google.protobuf.ByteString
+        getValueBytes() {
+      java.lang.Object ref = value_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        value_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // optional string valueType = 6;
+    public static final int VALUETYPE_FIELD_NUMBER = 6;
+    private java.lang.Object valueType_;
+    /**
+     * <code>optional string valueType = 6;</code>
+     */
+    public boolean hasValueType() {
+      return ((bitField0_ & 0x00000008) == 0x00000008);
+    }
+    /**
+     * <code>optional string valueType = 6;</code>
+     */
+    public java.lang.String getValueType() {
+      java.lang.Object ref = valueType_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          valueType_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string valueType = 6;</code>
+     */
+    public com.google.protobuf.ByteString
+        getValueTypeBytes() {
+      java.lang.Object ref = valueType_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        valueType_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // repeated string bitsValue = 7;
+    public static final int BITSVALUE_FIELD_NUMBER = 7;
+    private com.google.protobuf.LazyStringList bitsValue_;
+    /**
+     * <code>repeated string bitsValue = 7;</code>
+     */
+    public java.util.List<java.lang.String>
+        getBitsValueList() {
+      return bitsValue_;
+    }
+    /**
+     * <code>repeated string bitsValue = 7;</code>
+     */
+    public int getBitsValueCount() {
+      return bitsValue_.size();
+    }
+    /**
+     * <code>repeated string bitsValue = 7;</code>
+     */
+    public java.lang.String getBitsValue(int index) {
+      return bitsValue_.get(index);
+    }
+    /**
+     * <code>repeated string bitsValue = 7;</code>
+     */
+    public com.google.protobuf.ByteString
+        getBitsValueBytes(int index) {
+      return bitsValue_.getByteString(index);
+    }
+
+    // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;
+    public static final int INSTANCEIDENTIFIERVALUE_FIELD_NUMBER = 8;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierValue_;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+     */
+    public boolean hasInstanceIdentifierValue() {
+      return ((bitField0_ & 0x00000010) == 0x00000010);
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue() {
+      return instanceIdentifierValue_;
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder() {
+      return instanceIdentifierValue_;
+    }
+
+    private void initFields() {
+      path_ = "";
+      type_ = "";
+      attributes_ = java.util.Collections.emptyList();
+      child_ = java.util.Collections.emptyList();
+      value_ = "";
+      valueType_ = "";
+      bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+      instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      for (int i = 0; i < getAttributesCount(); i++) {
+        if (!getAttributes(i).isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      for (int i = 0; i < getChildCount(); i++) {
+        if (!getChild(i).isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      if (hasInstanceIdentifierValue()) {
+        if (!getInstanceIdentifierValue().isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeBytes(1, getPathBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeBytes(2, getTypeBytes());
+      }
+      for (int i = 0; i < attributes_.size(); i++) {
+        output.writeMessage(3, attributes_.get(i));
+      }
+      for (int i = 0; i < child_.size(); i++) {
+        output.writeMessage(4, child_.get(i));
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        output.writeBytes(5, getValueBytes());
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        output.writeBytes(6, getValueTypeBytes());
+      }
+      for (int i = 0; i < bitsValue_.size(); i++) {
+        output.writeBytes(7, bitsValue_.getByteString(i));
+      }
+      if (((bitField0_ & 0x00000010) == 0x00000010)) {
+        output.writeMessage(8, instanceIdentifierValue_);
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(1, getPathBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(2, getTypeBytes());
+      }
+      for (int i = 0; i < attributes_.size(); i++) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(3, attributes_.get(i));
+      }
+      for (int i = 0; i < child_.size(); i++) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(4, child_.get(i));
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(5, getValueBytes());
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(6, getValueTypeBytes());
+      }
+      {
+        int dataSize = 0;
+        for (int i = 0; i < bitsValue_.size(); i++) {
+          dataSize += com.google.protobuf.CodedOutputStream
+            .computeBytesSizeNoTag(bitsValue_.getByteString(i));
+        }
+        size += dataSize;
+        size += 1 * getBitsValueList().size();
+      }
+      if (((bitField0_ & 0x00000010) == 0x00000010)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(8, instanceIdentifierValue_);
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.Node}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getAttributesFieldBuilder();
+          getChildFieldBuilder();
+          getInstanceIdentifierValueFieldBuilder();
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        path_ = "";
+        bitField0_ = (bitField0_ & ~0x00000001);
+        type_ = "";
+        bitField0_ = (bitField0_ & ~0x00000002);
+        if (attributesBuilder_ == null) {
+          attributes_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000004);
+        } else {
+          attributesBuilder_.clear();
+        }
+        if (childBuilder_ == null) {
+          child_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000008);
+        } else {
+          childBuilder_.clear();
+        }
+        value_ = "";
+        bitField0_ = (bitField0_ & ~0x00000010);
+        valueType_ = "";
+        bitField0_ = (bitField0_ & ~0x00000020);
+        bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+        bitField0_ = (bitField0_ & ~0x00000040);
+        if (instanceIdentifierValueBuilder_ == null) {
+          instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+        } else {
+          instanceIdentifierValueBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000080);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node build() {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node buildPartial() {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.path_ = path_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.type_ = type_;
+        if (attributesBuilder_ == null) {
+          if (((bitField0_ & 0x00000004) == 0x00000004)) {
+            attributes_ = java.util.Collections.unmodifiableList(attributes_);
+            bitField0_ = (bitField0_ & ~0x00000004);
+          }
+          result.attributes_ = attributes_;
+        } else {
+          result.attributes_ = attributesBuilder_.build();
+        }
+        if (childBuilder_ == null) {
+          if (((bitField0_ & 0x00000008) == 0x00000008)) {
+            child_ = java.util.Collections.unmodifiableList(child_);
+            bitField0_ = (bitField0_ & ~0x00000008);
+          }
+          result.child_ = child_;
+        } else {
+          result.child_ = childBuilder_.build();
+        }
+        if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
+          to_bitField0_ |= 0x00000004;
+        }
+        result.value_ = value_;
+        if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
+          to_bitField0_ |= 0x00000008;
+        }
+        result.valueType_ = valueType_;
+        if (((bitField0_ & 0x00000040) == 0x00000040)) {
+          bitsValue_ = new com.google.protobuf.UnmodifiableLazyStringList(
+              bitsValue_);
+          bitField0_ = (bitField0_ & ~0x00000040);
+        }
+        result.bitsValue_ = bitsValue_;
+        if (((from_bitField0_ & 0x00000080) == 0x00000080)) {
+          to_bitField0_ |= 0x00000010;
+        }
+        if (instanceIdentifierValueBuilder_ == null) {
+          result.instanceIdentifierValue_ = instanceIdentifierValue_;
+        } else {
+          result.instanceIdentifierValue_ = instanceIdentifierValueBuilder_.build();
+        }
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node other) {
+        if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) return this;
+        if (other.hasPath()) {
+          bitField0_ |= 0x00000001;
+          path_ = other.path_;
+          onChanged();
+        }
+        if (other.hasType()) {
+          bitField0_ |= 0x00000002;
+          type_ = other.type_;
+          onChanged();
+        }
+        if (attributesBuilder_ == null) {
+          if (!other.attributes_.isEmpty()) {
+            if (attributes_.isEmpty()) {
+              attributes_ = other.attributes_;
+              bitField0_ = (bitField0_ & ~0x00000004);
+            } else {
+              ensureAttributesIsMutable();
+              attributes_.addAll(other.attributes_);
+            }
+            onChanged();
+          }
+        } else {
+          if (!other.attributes_.isEmpty()) {
+            if (attributesBuilder_.isEmpty()) {
+              attributesBuilder_.dispose();
+              attributesBuilder_ = null;
+              attributes_ = other.attributes_;
+              bitField0_ = (bitField0_ & ~0x00000004);
+              attributesBuilder_ = 
+                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+                   getAttributesFieldBuilder() : null;
+            } else {
+              attributesBuilder_.addAllMessages(other.attributes_);
+            }
+          }
+        }
+        if (childBuilder_ == null) {
+          if (!other.child_.isEmpty()) {
+            if (child_.isEmpty()) {
+              child_ = other.child_;
+              bitField0_ = (bitField0_ & ~0x00000008);
+            } else {
+              ensureChildIsMutable();
+              child_.addAll(other.child_);
+            }
+            onChanged();
+          }
+        } else {
+          if (!other.child_.isEmpty()) {
+            if (childBuilder_.isEmpty()) {
+              childBuilder_.dispose();
+              childBuilder_ = null;
+              child_ = other.child_;
+              bitField0_ = (bitField0_ & ~0x00000008);
+              childBuilder_ = 
+                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+                   getChildFieldBuilder() : null;
+            } else {
+              childBuilder_.addAllMessages(other.child_);
+            }
+          }
+        }
+        if (other.hasValue()) {
+          bitField0_ |= 0x00000010;
+          value_ = other.value_;
+          onChanged();
+        }
+        if (other.hasValueType()) {
+          bitField0_ |= 0x00000020;
+          valueType_ = other.valueType_;
+          onChanged();
+        }
+        if (!other.bitsValue_.isEmpty()) {
+          if (bitsValue_.isEmpty()) {
+            bitsValue_ = other.bitsValue_;
+            bitField0_ = (bitField0_ & ~0x00000040);
+          } else {
+            ensureBitsValueIsMutable();
+            bitsValue_.addAll(other.bitsValue_);
+          }
+          onChanged();
+        }
+        if (other.hasInstanceIdentifierValue()) {
+          mergeInstanceIdentifierValue(other.getInstanceIdentifierValue());
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        for (int i = 0; i < getAttributesCount(); i++) {
+          if (!getAttributes(i).isInitialized()) {
+            
+            return false;
+          }
+        }
+        for (int i = 0; i < getChildCount(); i++) {
+          if (!getChild(i).isInitialized()) {
+            
+            return false;
+          }
+        }
+        if (hasInstanceIdentifierValue()) {
+          if (!getInstanceIdentifierValue().isInitialized()) {
+            
+            return false;
+          }
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // optional string path = 1;
+      private java.lang.Object path_ = "";
+      /**
+       * <code>optional string path = 1;</code>
+       */
+      public boolean hasPath() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>optional string path = 1;</code>
+       */
+      public java.lang.String getPath() {
+        java.lang.Object ref = path_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          path_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string path = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getPathBytes() {
+        java.lang.Object ref = path_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          path_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string path = 1;</code>
+       */
+      public Builder setPath(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        path_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string path = 1;</code>
+       */
+      public Builder clearPath() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        path_ = getDefaultInstance().getPath();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string path = 1;</code>
+       */
+      public Builder setPathBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        path_ = value;
+        onChanged();
+        return this;
+      }
+
+      // optional string type = 2;
+      private java.lang.Object type_ = "";
+      /**
+       * <code>optional string type = 2;</code>
+       */
+      public boolean hasType() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>optional string type = 2;</code>
+       */
+      public java.lang.String getType() {
+        java.lang.Object ref = type_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          type_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string type = 2;</code>
+       */
+      public com.google.protobuf.ByteString
+          getTypeBytes() {
+        java.lang.Object ref = type_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          type_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string type = 2;</code>
+       */
+      public Builder setType(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        type_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string type = 2;</code>
+       */
+      public Builder clearType() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        type_ = getDefaultInstance().getType();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string type = 2;</code>
+       */
+      public Builder setTypeBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        type_ = value;
+        onChanged();
+        return this;
+      }
+
+      // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;
+      private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> attributes_ =
+        java.util.Collections.emptyList();
+      private void ensureAttributesIsMutable() {
+        if (!((bitField0_ & 0x00000004) == 0x00000004)) {
+          attributes_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>(attributes_);
+          bitField0_ |= 0x00000004;
+         }
+      }
+
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> attributesBuilder_;
+
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       */
+      public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> getAttributesList() {
+        if (attributesBuilder_ == null) {
+          return java.util.Collections.unmodifiableList(attributes_);
+        } else {
+          return attributesBuilder_.getMessageList();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       */
+      public int getAttributesCount() {
+        if (attributesBuilder_ == null) {
+          return attributes_.size();
+        } else {
+          return attributesBuilder_.getCount();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index) {
+        if (attributesBuilder_ == null) {
+          return attributes_.get(index);
+        } else {
+          return attributesBuilder_.getMessage(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       */
+      public Builder setAttributes(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) {
+        if (attributesBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureAttributesIsMutable();
+          attributes_.set(index, value);
+          onChanged();
+        } else {
+          attributesBuilder_.setMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       */
+      public Builder setAttributes(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) {
+        if (attributesBuilder_ == null) {
+          ensureAttributesIsMutable();
+          attributes_.set(index, builderForValue.build());
+          onChanged();
+        } else {
+          attributesBuilder_.setMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       */
+      public Builder addAttributes(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) {
+        if (attributesBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureAttributesIsMutable();
+          attributes_.add(value);
+          onChanged();
+        } else {
+          attributesBuilder_.addMessage(value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       */
+      public Builder addAttributes(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) {
+        if (attributesBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureAttributesIsMutable();
+          attributes_.add(index, value);
+          onChanged();
+        } else {
+          attributesBuilder_.addMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       */
+      public Builder addAttributes(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) {
+        if (attributesBuilder_ == null) {
+          ensureAttributesIsMutable();
+          attributes_.add(builderForValue.build());
+          onChanged();
+        } else {
+          attributesBuilder_.addMessage(builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       */
+      public Builder addAttributes(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) {
+        if (attributesBuilder_ == null) {
+          ensureAttributesIsMutable();
+          attributes_.add(index, builderForValue.build());
+          onChanged();
+        } else {
+          attributesBuilder_.addMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       */
+      public Builder addAllAttributes(
+          java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> values) {
+        if (attributesBuilder_ == null) {
+          ensureAttributesIsMutable();
+          super.addAll(values, attributes_);
+          onChanged();
+        } else {
+          attributesBuilder_.addAllMessages(values);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       */
+      public Builder clearAttributes() {
+        if (attributesBuilder_ == null) {
+          attributes_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000004);
+          onChanged();
+        } else {
+          attributesBuilder_.clear();
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       */
+      public Builder removeAttributes(int index) {
+        if (attributesBuilder_ == null) {
+          ensureAttributesIsMutable();
+          attributes_.remove(index);
+          onChanged();
+        } else {
+          attributesBuilder_.remove(index);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder getAttributesBuilder(
+          int index) {
+        return getAttributesFieldBuilder().getBuilder(index);
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder(
+          int index) {
+        if (attributesBuilder_ == null) {
+          return attributes_.get(index);  } else {
+          return attributesBuilder_.getMessageOrBuilder(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       */
+      public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> 
+           getAttributesOrBuilderList() {
+        if (attributesBuilder_ != null) {
+          return attributesBuilder_.getMessageOrBuilderList();
+        } else {
+          return java.util.Collections.unmodifiableList(attributes_);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder addAttributesBuilder() {
+        return getAttributesFieldBuilder().addBuilder(
+            org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder addAttributesBuilder(
+          int index) {
+        return getAttributesFieldBuilder().addBuilder(
+            index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       */
+      public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder> 
+           getAttributesBuilderList() {
+        return getAttributesFieldBuilder().getBuilderList();
+      }
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> 
+          getAttributesFieldBuilder() {
+        if (attributesBuilder_ == null) {
+          attributesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>(
+                  attributes_,
+                  ((bitField0_ & 0x00000004) == 0x00000004),
+                  getParentForChildren(),
+                  isClean());
+          attributes_ = null;
+        }
+        return attributesBuilder_;
+      }
+
+      // repeated .org.opendaylight.controller.mdsal.Node child = 4;
+      private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node> child_ =
+        java.util.Collections.emptyList();
+      private void ensureChildIsMutable() {
+        if (!((bitField0_ & 0x00000008) == 0x00000008)) {
+          child_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node>(child_);
+          bitField0_ |= 0x00000008;
+         }
+      }
+
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> childBuilder_;
+
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       */
+      public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node> getChildList() {
+        if (childBuilder_ == null) {
+          return java.util.Collections.unmodifiableList(child_);
+        } else {
+          return childBuilder_.getMessageList();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       */
+      public int getChildCount() {
+        if (childBuilder_ == null) {
+          return child_.size();
+        } else {
+          return childBuilder_.getCount();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getChild(int index) {
+        if (childBuilder_ == null) {
+          return child_.get(index);
+        } else {
+          return childBuilder_.getMessage(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       */
+      public Builder setChild(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+        if (childBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureChildIsMutable();
+          child_.set(index, value);
+          onChanged();
+        } else {
+          childBuilder_.setMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       */
+      public Builder setChild(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
+        if (childBuilder_ == null) {
+          ensureChildIsMutable();
+          child_.set(index, builderForValue.build());
+          onChanged();
+        } else {
+          childBuilder_.setMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       */
+      public Builder addChild(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+        if (childBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureChildIsMutable();
+          child_.add(value);
+          onChanged();
+        } else {
+          childBuilder_.addMessage(value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       */
+      public Builder addChild(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+        if (childBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureChildIsMutable();
+          child_.add(index, value);
+          onChanged();
+        } else {
+          childBuilder_.addMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       */
+      public Builder addChild(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
+        if (childBuilder_ == null) {
+          ensureChildIsMutable();
+          child_.add(builderForValue.build());
+          onChanged();
+        } else {
+          childBuilder_.addMessage(builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       */
+      public Builder addChild(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
+        if (childBuilder_ == null) {
+          ensureChildIsMutable();
+          child_.add(index, builderForValue.build());
+          onChanged();
+        } else {
+          childBuilder_.addMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       */
+      public Builder addAllChild(
+          java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node> values) {
+        if (childBuilder_ == null) {
+          ensureChildIsMutable();
+          super.addAll(values, child_);
+          onChanged();
+        } else {
+          childBuilder_.addAllMessages(values);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       */
+      public Builder clearChild() {
+        if (childBuilder_ == null) {
+          child_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000008);
+          onChanged();
+        } else {
+          childBuilder_.clear();
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       */
+      public Builder removeChild(int index) {
+        if (childBuilder_ == null) {
+          ensureChildIsMutable();
+          child_.remove(index);
+          onChanged();
+        } else {
+          childBuilder_.remove(index);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getChildBuilder(
+          int index) {
+        return getChildFieldBuilder().getBuilder(index);
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getChildOrBuilder(
+          int index) {
+        if (childBuilder_ == null) {
+          return child_.get(index);  } else {
+          return childBuilder_.getMessageOrBuilder(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       */
+      public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> 
+           getChildOrBuilderList() {
+        if (childBuilder_ != null) {
+          return childBuilder_.getMessageOrBuilderList();
+        } else {
+          return java.util.Collections.unmodifiableList(child_);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder addChildBuilder() {
+        return getChildFieldBuilder().addBuilder(
+            org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder addChildBuilder(
+          int index) {
+        return getChildFieldBuilder().addBuilder(
+            index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       */
+      public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder> 
+           getChildBuilderList() {
+        return getChildFieldBuilder().getBuilderList();
+      }
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> 
+          getChildFieldBuilder() {
+        if (childBuilder_ == null) {
+          childBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
+                  child_,
+                  ((bitField0_ & 0x00000008) == 0x00000008),
+                  getParentForChildren(),
+                  isClean());
+          child_ = null;
+        }
+        return childBuilder_;
+      }
+
+      // optional string value = 5;
+      private java.lang.Object value_ = "";
+      /**
+       * <code>optional string value = 5;</code>
+       */
+      public boolean hasValue() {
+        return ((bitField0_ & 0x00000010) == 0x00000010);
+      }
+      /**
+       * <code>optional string value = 5;</code>
+       */
+      public java.lang.String getValue() {
+        java.lang.Object ref = value_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          value_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string value = 5;</code>
+       */
+      public com.google.protobuf.ByteString
+          getValueBytes() {
+        java.lang.Object ref = value_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          value_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string value = 5;</code>
+       */
+      public Builder setValue(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000010;
+        value_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string value = 5;</code>
+       */
+      public Builder clearValue() {
+        bitField0_ = (bitField0_ & ~0x00000010);
+        value_ = getDefaultInstance().getValue();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string value = 5;</code>
+       */
+      public Builder setValueBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000010;
+        value_ = value;
+        onChanged();
+        return this;
+      }
+
+      // optional string valueType = 6;
+      private java.lang.Object valueType_ = "";
+      /**
+       * <code>optional string valueType = 6;</code>
+       */
+      public boolean hasValueType() {
+        return ((bitField0_ & 0x00000020) == 0x00000020);
+      }
+      /**
+       * <code>optional string valueType = 6;</code>
+       */
+      public java.lang.String getValueType() {
+        java.lang.Object ref = valueType_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          valueType_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string valueType = 6;</code>
+       */
+      public com.google.protobuf.ByteString
+          getValueTypeBytes() {
+        java.lang.Object ref = valueType_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          valueType_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string valueType = 6;</code>
+       */
+      public Builder setValueType(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000020;
+        valueType_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string valueType = 6;</code>
+       */
+      public Builder clearValueType() {
+        bitField0_ = (bitField0_ & ~0x00000020);
+        valueType_ = getDefaultInstance().getValueType();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string valueType = 6;</code>
+       */
+      public Builder setValueTypeBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000020;
+        valueType_ = value;
+        onChanged();
+        return this;
+      }
+
+      // repeated string bitsValue = 7;
+      private com.google.protobuf.LazyStringList bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+      private void ensureBitsValueIsMutable() {
+        if (!((bitField0_ & 0x00000040) == 0x00000040)) {
+          bitsValue_ = new com.google.protobuf.LazyStringArrayList(bitsValue_);
+          bitField0_ |= 0x00000040;
+         }
+      }
+      /**
+       * <code>repeated string bitsValue = 7;</code>
+       */
+      public java.util.List<java.lang.String>
+          getBitsValueList() {
+        return java.util.Collections.unmodifiableList(bitsValue_);
+      }
+      /**
+       * <code>repeated string bitsValue = 7;</code>
+       */
+      public int getBitsValueCount() {
+        return bitsValue_.size();
+      }
+      /**
+       * <code>repeated string bitsValue = 7;</code>
+       */
+      public java.lang.String getBitsValue(int index) {
+        return bitsValue_.get(index);
+      }
+      /**
+       * <code>repeated string bitsValue = 7;</code>
+       */
+      public com.google.protobuf.ByteString
+          getBitsValueBytes(int index) {
+        return bitsValue_.getByteString(index);
+      }
+      /**
+       * <code>repeated string bitsValue = 7;</code>
+       */
+      public Builder setBitsValue(
+          int index, java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  ensureBitsValueIsMutable();
+        bitsValue_.set(index, value);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string bitsValue = 7;</code>
+       */
+      public Builder addBitsValue(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  ensureBitsValueIsMutable();
+        bitsValue_.add(value);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string bitsValue = 7;</code>
+       */
+      public Builder addAllBitsValue(
+          java.lang.Iterable<java.lang.String> values) {
+        ensureBitsValueIsMutable();
+        super.addAll(values, bitsValue_);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string bitsValue = 7;</code>
+       */
+      public Builder clearBitsValue() {
+        bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+        bitField0_ = (bitField0_ & ~0x00000040);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string bitsValue = 7;</code>
+       */
+      public Builder addBitsValueBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  ensureBitsValueIsMutable();
+        bitsValue_.add(value);
+        onChanged();
+        return this;
+      }
+
+      // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierValueBuilder_;
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+       */
+      public boolean hasInstanceIdentifierValue() {
+        return ((bitField0_ & 0x00000080) == 0x00000080);
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue() {
+        if (instanceIdentifierValueBuilder_ == null) {
+          return instanceIdentifierValue_;
+        } else {
+          return instanceIdentifierValueBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+       */
+      public Builder setInstanceIdentifierValue(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (instanceIdentifierValueBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          instanceIdentifierValue_ = value;
+          onChanged();
+        } else {
+          instanceIdentifierValueBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000080;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+       */
+      public Builder setInstanceIdentifierValue(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+        if (instanceIdentifierValueBuilder_ == null) {
+          instanceIdentifierValue_ = builderForValue.build();
+          onChanged();
+        } else {
+          instanceIdentifierValueBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000080;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+       */
+      public Builder mergeInstanceIdentifierValue(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (instanceIdentifierValueBuilder_ == null) {
+          if (((bitField0_ & 0x00000080) == 0x00000080) &&
+              instanceIdentifierValue_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+            instanceIdentifierValue_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierValue_).mergeFrom(value).buildPartial();
+          } else {
+            instanceIdentifierValue_ = value;
+          }
+          onChanged();
+        } else {
+          instanceIdentifierValueBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000080;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+       */
+      public Builder clearInstanceIdentifierValue() {
+        if (instanceIdentifierValueBuilder_ == null) {
+          instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+          onChanged();
+        } else {
+          instanceIdentifierValueBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000080);
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierValueBuilder() {
+        bitField0_ |= 0x00000080;
+        onChanged();
+        return getInstanceIdentifierValueFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder() {
+        if (instanceIdentifierValueBuilder_ != null) {
+          return instanceIdentifierValueBuilder_.getMessageOrBuilder();
+        } else {
+          return instanceIdentifierValue_;
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> 
+          getInstanceIdentifierValueFieldBuilder() {
+        if (instanceIdentifierValueBuilder_ == null) {
+          instanceIdentifierValueBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+                  instanceIdentifierValue_,
+                  getParentForChildren(),
+                  isClean());
+          instanceIdentifierValue_ = null;
+        }
+        return instanceIdentifierValueBuilder_;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.Node)
+    }
+
+    static {
+      defaultInstance = new Node(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.Node)
+  }
+
+  public interface ContainerOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required string parentPath = 1;
+    /**
+     * <code>required string parentPath = 1;</code>
+     */
+    boolean hasParentPath();
+    /**
+     * <code>required string parentPath = 1;</code>
+     */
+    java.lang.String getParentPath();
+    /**
+     * <code>required string parentPath = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getParentPathBytes();
+
+    // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+     */
+    boolean hasNormalizedNode();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.Container}
+   */
+  public static final class Container extends
+      com.google.protobuf.GeneratedMessage
+      implements ContainerOrBuilder {
+    // Use Container.newBuilder() to construct.
+    private Container(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private Container(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final Container defaultInstance;
+    public static Container getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public Container getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private Container(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              bitField0_ |= 0x00000001;
+              parentPath_ = input.readBytes();
+              break;
+            }
+            case 18: {
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000002) == 0x00000002)) {
+                subBuilder = normalizedNode_.toBuilder();
+              }
+              normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(normalizedNode_);
+                normalizedNode_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000002;
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<Container> PARSER =
+        new com.google.protobuf.AbstractParser<Container>() {
+      public Container parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new Container(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<Container> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required string parentPath = 1;
+    public static final int PARENTPATH_FIELD_NUMBER = 1;
+    private java.lang.Object parentPath_;
+    /**
+     * <code>required string parentPath = 1;</code>
+     */
+    public boolean hasParentPath() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required string parentPath = 1;</code>
+     */
+    public java.lang.String getParentPath() {
+      java.lang.Object ref = parentPath_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          parentPath_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string parentPath = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getParentPathBytes() {
+      java.lang.Object ref = parentPath_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        parentPath_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+    public static final int NORMALIZEDNODE_FIELD_NUMBER = 2;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+     */
+    public boolean hasNormalizedNode() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
+      return normalizedNode_;
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
+      return normalizedNode_;
+    }
+
+    private void initFields() {
+      parentPath_ = "";
+      normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasParentPath()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (hasNormalizedNode()) {
+        if (!getNormalizedNode().isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeBytes(1, getParentPathBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeMessage(2, normalizedNode_);
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(1, getParentPathBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(2, normalizedNode_);
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.Container}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.ContainerOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getNormalizedNodeFieldBuilder();
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        parentPath_ = "";
+        bitField0_ = (bitField0_ & ~0x00000001);
+        if (normalizedNodeBuilder_ == null) {
+          normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+        } else {
+          normalizedNodeBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000002);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container build() {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container buildPartial() {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.parentPath_ = parentPath_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        if (normalizedNodeBuilder_ == null) {
+          result.normalizedNode_ = normalizedNode_;
+        } else {
+          result.normalizedNode_ = normalizedNodeBuilder_.build();
+        }
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container other) {
+        if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.getDefaultInstance()) return this;
+        if (other.hasParentPath()) {
+          bitField0_ |= 0x00000001;
+          parentPath_ = other.parentPath_;
+          onChanged();
+        }
+        if (other.hasNormalizedNode()) {
+          mergeNormalizedNode(other.getNormalizedNode());
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasParentPath()) {
+          
+          return false;
+        }
+        if (hasNormalizedNode()) {
+          if (!getNormalizedNode().isInitialized()) {
+            
+            return false;
+          }
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required string parentPath = 1;
+      private java.lang.Object parentPath_ = "";
+      /**
+       * <code>required string parentPath = 1;</code>
+       */
+      public boolean hasParentPath() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required string parentPath = 1;</code>
+       */
+      public java.lang.String getParentPath() {
+        java.lang.Object ref = parentPath_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          parentPath_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string parentPath = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getParentPathBytes() {
+        java.lang.Object ref = parentPath_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          parentPath_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string parentPath = 1;</code>
+       */
+      public Builder setParentPath(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        parentPath_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string parentPath = 1;</code>
+       */
+      public Builder clearParentPath() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        parentPath_ = getDefaultInstance().getParentPath();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string parentPath = 1;</code>
+       */
+      public Builder setParentPathBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        parentPath_ = value;
+        onChanged();
+        return this;
+      }
+
+      // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> normalizedNodeBuilder_;
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public boolean hasNormalizedNode() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
+        if (normalizedNodeBuilder_ == null) {
+          return normalizedNode_;
+        } else {
+          return normalizedNodeBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+        if (normalizedNodeBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          normalizedNode_ = value;
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000002;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public Builder setNormalizedNode(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
+        if (normalizedNodeBuilder_ == null) {
+          normalizedNode_ = builderForValue.build();
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000002;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+        if (normalizedNodeBuilder_ == null) {
+          if (((bitField0_ & 0x00000002) == 0x00000002) &&
+              normalizedNode_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) {
+            normalizedNode_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(normalizedNode_).mergeFrom(value).buildPartial();
+          } else {
+            normalizedNode_ = value;
+          }
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000002;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public Builder clearNormalizedNode() {
+        if (normalizedNodeBuilder_ == null) {
+          normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000002);
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getNormalizedNodeBuilder() {
+        bitField0_ |= 0x00000002;
+        onChanged();
+        return getNormalizedNodeFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
+        if (normalizedNodeBuilder_ != null) {
+          return normalizedNodeBuilder_.getMessageOrBuilder();
+        } else {
+          return normalizedNode_;
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> 
+          getNormalizedNodeFieldBuilder() {
+        if (normalizedNodeBuilder_ == null) {
+          normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
+                  normalizedNode_,
+                  getParentForChildren(),
+                  isClean());
+          normalizedNode_ = null;
+        }
+        return normalizedNodeBuilder_;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.Container)
+    }
+
+    static {
+      defaultInstance = new Container(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.Container)
+  }
+
+  public interface NodeMapEntryOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+     */
+    boolean hasInstanceIdentifierPath();
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPath();
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathOrBuilder();
+
+    // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+     */
+    boolean hasNormalizedNode();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.NodeMapEntry}
+   */
+  public static final class NodeMapEntry extends
+      com.google.protobuf.GeneratedMessage
+      implements NodeMapEntryOrBuilder {
+    // Use NodeMapEntry.newBuilder() to construct.
+    private NodeMapEntry(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private NodeMapEntry(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final NodeMapEntry defaultInstance;
+    public static NodeMapEntry getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public NodeMapEntry getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private NodeMapEntry(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000001) == 0x00000001)) {
+                subBuilder = instanceIdentifierPath_.toBuilder();
+              }
+              instanceIdentifierPath_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(instanceIdentifierPath_);
+                instanceIdentifierPath_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000001;
+              break;
+            }
+            case 18: {
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000002) == 0x00000002)) {
+                subBuilder = normalizedNode_.toBuilder();
+              }
+              normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(normalizedNode_);
+                normalizedNode_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000002;
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<NodeMapEntry> PARSER =
+        new com.google.protobuf.AbstractParser<NodeMapEntry>() {
+      public NodeMapEntry parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new NodeMapEntry(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<NodeMapEntry> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;
+    public static final int INSTANCEIDENTIFIERPATH_FIELD_NUMBER = 1;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPath_;
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+     */
+    public boolean hasInstanceIdentifierPath() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPath() {
+      return instanceIdentifierPath_;
+    }
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathOrBuilder() {
+      return instanceIdentifierPath_;
+    }
+
+    // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+    public static final int NORMALIZEDNODE_FIELD_NUMBER = 2;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+     */
+    public boolean hasNormalizedNode() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
+      return normalizedNode_;
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
+      return normalizedNode_;
+    }
+
+    private void initFields() {
+      instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+      normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasInstanceIdentifierPath()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (!getInstanceIdentifierPath().isInitialized()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (hasNormalizedNode()) {
+        if (!getNormalizedNode().isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeMessage(1, instanceIdentifierPath_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeMessage(2, normalizedNode_);
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(1, instanceIdentifierPath_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(2, normalizedNode_);
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.NodeMapEntry}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getInstanceIdentifierPathFieldBuilder();
+          getNormalizedNodeFieldBuilder();
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        if (instanceIdentifierPathBuilder_ == null) {
+          instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+        } else {
+          instanceIdentifierPathBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000001);
+        if (normalizedNodeBuilder_ == null) {
+          normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+        } else {
+          normalizedNodeBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000002);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry build() {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry buildPartial() {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        if (instanceIdentifierPathBuilder_ == null) {
+          result.instanceIdentifierPath_ = instanceIdentifierPath_;
+        } else {
+          result.instanceIdentifierPath_ = instanceIdentifierPathBuilder_.build();
+        }
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        if (normalizedNodeBuilder_ == null) {
+          result.normalizedNode_ = normalizedNode_;
+        } else {
+          result.normalizedNode_ = normalizedNodeBuilder_.build();
+        }
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry other) {
+        if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.getDefaultInstance()) return this;
+        if (other.hasInstanceIdentifierPath()) {
+          mergeInstanceIdentifierPath(other.getInstanceIdentifierPath());
+        }
+        if (other.hasNormalizedNode()) {
+          mergeNormalizedNode(other.getNormalizedNode());
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasInstanceIdentifierPath()) {
+          
+          return false;
+        }
+        if (!getInstanceIdentifierPath().isInitialized()) {
+          
+          return false;
+        }
+        if (hasNormalizedNode()) {
+          if (!getNormalizedNode().isInitialized()) {
+            
+            return false;
+          }
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierPathBuilder_;
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+       */
+      public boolean hasInstanceIdentifierPath() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPath() {
+        if (instanceIdentifierPathBuilder_ == null) {
+          return instanceIdentifierPath_;
+        } else {
+          return instanceIdentifierPathBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+       */
+      public Builder setInstanceIdentifierPath(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (instanceIdentifierPathBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          instanceIdentifierPath_ = value;
+          onChanged();
+        } else {
+          instanceIdentifierPathBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000001;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+       */
+      public Builder setInstanceIdentifierPath(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+        if (instanceIdentifierPathBuilder_ == null) {
+          instanceIdentifierPath_ = builderForValue.build();
+          onChanged();
+        } else {
+          instanceIdentifierPathBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000001;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+       */
+      public Builder mergeInstanceIdentifierPath(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (instanceIdentifierPathBuilder_ == null) {
+          if (((bitField0_ & 0x00000001) == 0x00000001) &&
+              instanceIdentifierPath_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+            instanceIdentifierPath_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierPath_).mergeFrom(value).buildPartial();
+          } else {
+            instanceIdentifierPath_ = value;
+          }
+          onChanged();
+        } else {
+          instanceIdentifierPathBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000001;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+       */
+      public Builder clearInstanceIdentifierPath() {
+        if (instanceIdentifierPathBuilder_ == null) {
+          instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+          onChanged();
+        } else {
+          instanceIdentifierPathBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000001);
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierPathBuilder() {
+        bitField0_ |= 0x00000001;
+        onChanged();
+        return getInstanceIdentifierPathFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathOrBuilder() {
+        if (instanceIdentifierPathBuilder_ != null) {
+          return instanceIdentifierPathBuilder_.getMessageOrBuilder();
+        } else {
+          return instanceIdentifierPath_;
+        }
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> 
+          getInstanceIdentifierPathFieldBuilder() {
+        if (instanceIdentifierPathBuilder_ == null) {
+          instanceIdentifierPathBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+                  instanceIdentifierPath_,
+                  getParentForChildren(),
+                  isClean());
+          instanceIdentifierPath_ = null;
+        }
+        return instanceIdentifierPathBuilder_;
+      }
+
+      // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> normalizedNodeBuilder_;
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public boolean hasNormalizedNode() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
+        if (normalizedNodeBuilder_ == null) {
+          return normalizedNode_;
+        } else {
+          return normalizedNodeBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+        if (normalizedNodeBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          normalizedNode_ = value;
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000002;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public Builder setNormalizedNode(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
+        if (normalizedNodeBuilder_ == null) {
+          normalizedNode_ = builderForValue.build();
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000002;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+        if (normalizedNodeBuilder_ == null) {
+          if (((bitField0_ & 0x00000002) == 0x00000002) &&
+              normalizedNode_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) {
+            normalizedNode_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(normalizedNode_).mergeFrom(value).buildPartial();
+          } else {
+            normalizedNode_ = value;
+          }
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000002;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public Builder clearNormalizedNode() {
+        if (normalizedNodeBuilder_ == null) {
+          normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000002);
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getNormalizedNodeBuilder() {
+        bitField0_ |= 0x00000002;
+        onChanged();
+        return getNormalizedNodeFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
+        if (normalizedNodeBuilder_ != null) {
+          return normalizedNodeBuilder_.getMessageOrBuilder();
+        } else {
+          return normalizedNode_;
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> 
+          getNormalizedNodeFieldBuilder() {
+        if (normalizedNodeBuilder_ == null) {
+          normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
+                  normalizedNode_,
+                  getParentForChildren(),
+                  isClean());
+          normalizedNode_ = null;
+        }
+        return normalizedNodeBuilder_;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.NodeMapEntry)
+    }
+
+    static {
+      defaultInstance = new NodeMapEntry(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.NodeMapEntry)
+  }
+
+  public interface NodeMapOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+     */
+    java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry> 
+        getMapEntriesList();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry getMapEntries(int index);
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+     */
+    int getMapEntriesCount();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+     */
+    java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder> 
+        getMapEntriesOrBuilderList();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder getMapEntriesOrBuilder(
+        int index);
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.NodeMap}
+   */
+  public static final class NodeMap extends
+      com.google.protobuf.GeneratedMessage
+      implements NodeMapOrBuilder {
+    // Use NodeMap.newBuilder() to construct.
+    private NodeMap(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private NodeMap(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final NodeMap defaultInstance;
+    public static NodeMap getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public NodeMap getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private NodeMap(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+                mapEntries_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry>();
+                mutable_bitField0_ |= 0x00000001;
+              }
+              mapEntries_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.PARSER, extensionRegistry));
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+          mapEntries_ = java.util.Collections.unmodifiableList(mapEntries_);
+        }
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMap_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<NodeMap> PARSER =
+        new com.google.protobuf.AbstractParser<NodeMap>() {
+      public NodeMap parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new NodeMap(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<NodeMap> getParserForType() {
+      return PARSER;
+    }
+
+    // repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;
+    public static final int MAPENTRIES_FIELD_NUMBER = 1;
+    private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry> mapEntries_;
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+     */
+    public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry> getMapEntriesList() {
+      return mapEntries_;
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+     */
+    public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder> 
+        getMapEntriesOrBuilderList() {
+      return mapEntries_;
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+     */
+    public int getMapEntriesCount() {
+      return mapEntries_.size();
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry getMapEntries(int index) {
+      return mapEntries_.get(index);
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder getMapEntriesOrBuilder(
+        int index) {
+      return mapEntries_.get(index);
+    }
+
+    private void initFields() {
+      mapEntries_ = java.util.Collections.emptyList();
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      for (int i = 0; i < getMapEntriesCount(); i++) {
+        if (!getMapEntries(i).isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      for (int i = 0; i < mapEntries_.size(); i++) {
+        output.writeMessage(1, mapEntries_.get(i));
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      for (int i = 0; i < mapEntries_.size(); i++) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(1, mapEntries_.get(i));
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.NodeMap}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMap_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getMapEntriesFieldBuilder();
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        if (mapEntriesBuilder_ == null) {
+          mapEntries_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000001);
+        } else {
+          mapEntriesBuilder_.clear();
+        }
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap build() {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap buildPartial() {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap(this);
+        int from_bitField0_ = bitField0_;
+        if (mapEntriesBuilder_ == null) {
+          if (((bitField0_ & 0x00000001) == 0x00000001)) {
+            mapEntries_ = java.util.Collections.unmodifiableList(mapEntries_);
+            bitField0_ = (bitField0_ & ~0x00000001);
+          }
+          result.mapEntries_ = mapEntries_;
+        } else {
+          result.mapEntries_ = mapEntriesBuilder_.build();
+        }
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap other) {
+        if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance()) return this;
+        if (mapEntriesBuilder_ == null) {
+          if (!other.mapEntries_.isEmpty()) {
+            if (mapEntries_.isEmpty()) {
+              mapEntries_ = other.mapEntries_;
+              bitField0_ = (bitField0_ & ~0x00000001);
+            } else {
+              ensureMapEntriesIsMutable();
+              mapEntries_.addAll(other.mapEntries_);
+            }
+            onChanged();
+          }
+        } else {
+          if (!other.mapEntries_.isEmpty()) {
+            if (mapEntriesBuilder_.isEmpty()) {
+              mapEntriesBuilder_.dispose();
+              mapEntriesBuilder_ = null;
+              mapEntries_ = other.mapEntries_;
+              bitField0_ = (bitField0_ & ~0x00000001);
+              mapEntriesBuilder_ = 
+                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+                   getMapEntriesFieldBuilder() : null;
+            } else {
+              mapEntriesBuilder_.addAllMessages(other.mapEntries_);
+            }
+          }
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        for (int i = 0; i < getMapEntriesCount(); i++) {
+          if (!getMapEntries(i).isInitialized()) {
+            
+            return false;
+          }
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;
+      private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry> mapEntries_ =
+        java.util.Collections.emptyList();
+      private void ensureMapEntriesIsMutable() {
+        if (!((bitField0_ & 0x00000001) == 0x00000001)) {
+          mapEntries_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry>(mapEntries_);
+          bitField0_ |= 0x00000001;
+         }
+      }
+
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder> mapEntriesBuilder_;
+
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+       */
+      public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry> getMapEntriesList() {
+        if (mapEntriesBuilder_ == null) {
+          return java.util.Collections.unmodifiableList(mapEntries_);
+        } else {
+          return mapEntriesBuilder_.getMessageList();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+       */
+      public int getMapEntriesCount() {
+        if (mapEntriesBuilder_ == null) {
+          return mapEntries_.size();
+        } else {
+          return mapEntriesBuilder_.getCount();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry getMapEntries(int index) {
+        if (mapEntriesBuilder_ == null) {
+          return mapEntries_.get(index);
+        } else {
+          return mapEntriesBuilder_.getMessage(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+       */
+      public Builder setMapEntries(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry value) {
+        if (mapEntriesBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureMapEntriesIsMutable();
+          mapEntries_.set(index, value);
+          onChanged();
+        } else {
+          mapEntriesBuilder_.setMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+       */
+      public Builder setMapEntries(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder builderForValue) {
+        if (mapEntriesBuilder_ == null) {
+          ensureMapEntriesIsMutable();
+          mapEntries_.set(index, builderForValue.build());
+          onChanged();
+        } else {
+          mapEntriesBuilder_.setMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+       */
+      public Builder addMapEntries(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry value) {
+        if (mapEntriesBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureMapEntriesIsMutable();
+          mapEntries_.add(value);
+          onChanged();
+        } else {
+          mapEntriesBuilder_.addMessage(value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+       */
+      public Builder addMapEntries(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry value) {
+        if (mapEntriesBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureMapEntriesIsMutable();
+          mapEntries_.add(index, value);
+          onChanged();
+        } else {
+          mapEntriesBuilder_.addMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+       */
+      public Builder addMapEntries(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder builderForValue) {
+        if (mapEntriesBuilder_ == null) {
+          ensureMapEntriesIsMutable();
+          mapEntries_.add(builderForValue.build());
+          onChanged();
+        } else {
+          mapEntriesBuilder_.addMessage(builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+       */
+      public Builder addMapEntries(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder builderForValue) {
+        if (mapEntriesBuilder_ == null) {
+          ensureMapEntriesIsMutable();
+          mapEntries_.add(index, builderForValue.build());
+          onChanged();
+        } else {
+          mapEntriesBuilder_.addMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+       */
+      public Builder addAllMapEntries(
+          java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry> values) {
+        if (mapEntriesBuilder_ == null) {
+          ensureMapEntriesIsMutable();
+          super.addAll(values, mapEntries_);
+          onChanged();
+        } else {
+          mapEntriesBuilder_.addAllMessages(values);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+       */
+      public Builder clearMapEntries() {
+        if (mapEntriesBuilder_ == null) {
+          mapEntries_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000001);
+          onChanged();
+        } else {
+          mapEntriesBuilder_.clear();
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+       */
+      public Builder removeMapEntries(int index) {
+        if (mapEntriesBuilder_ == null) {
+          ensureMapEntriesIsMutable();
+          mapEntries_.remove(index);
+          onChanged();
+        } else {
+          mapEntriesBuilder_.remove(index);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder getMapEntriesBuilder(
+          int index) {
+        return getMapEntriesFieldBuilder().getBuilder(index);
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder getMapEntriesOrBuilder(
+          int index) {
+        if (mapEntriesBuilder_ == null) {
+          return mapEntries_.get(index);  } else {
+          return mapEntriesBuilder_.getMessageOrBuilder(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+       */
+      public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder> 
+           getMapEntriesOrBuilderList() {
+        if (mapEntriesBuilder_ != null) {
+          return mapEntriesBuilder_.getMessageOrBuilderList();
+        } else {
+          return java.util.Collections.unmodifiableList(mapEntries_);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder addMapEntriesBuilder() {
+        return getMapEntriesFieldBuilder().addBuilder(
+            org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder addMapEntriesBuilder(
+          int index) {
+        return getMapEntriesFieldBuilder().addBuilder(
+            index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
+       */
+      public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder> 
+           getMapEntriesBuilderList() {
+        return getMapEntriesFieldBuilder().getBuilderList();
+      }
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder> 
+          getMapEntriesFieldBuilder() {
+        if (mapEntriesBuilder_ == null) {
+          mapEntriesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder>(
+                  mapEntries_,
+                  ((bitField0_ & 0x00000001) == 0x00000001),
+                  getParentForChildren(),
+                  isClean());
+          mapEntries_ = null;
+        }
+        return mapEntriesBuilder_;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.NodeMap)
+    }
+
+    static {
+      defaultInstance = new NodeMap(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.NodeMap)
+  }
+
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_Attribute_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_Attribute_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_QName_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_QName_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_PathArgument_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_Node_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_Node_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_Container_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_Container_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_NodeMap_fieldAccessorTable;
+
+  public static com.google.protobuf.Descriptors.FileDescriptor
+      getDescriptor() {
+    return descriptor;
+  }
+  private static com.google.protobuf.Descriptors.FileDescriptor
+      descriptor;
+  static {
+    java.lang.String[] descriptorData = {
+      "\n\014Common.proto\022!org.opendaylight.control" +
+      "ler.mdsal\"6\n\tAttribute\022\014\n\004name\030\001 \002(\t\022\r\n\005" +
+      "value\030\002 \001(\t\022\014\n\004type\030\003 \001(\t\"\026\n\005QName\022\r\n\005va" +
+      "lue\030\001 \002(\t\"\251\001\n\014PathArgument\022\r\n\005value\030\001 \002(" +
+      "\t\022\014\n\004type\030\002 \001(\t\022:\n\010nodeType\030\003 \001(\0132(.org." +
+      "opendaylight.controller.mdsal.QName\022@\n\na" +
+      "ttributes\030\004 \003(\0132,.org.opendaylight.contr" +
+      "oller.mdsal.Attribute\"X\n\022InstanceIdentif" +
+      "ier\022B\n\targuments\030\001 \003(\0132/.org.opendayligh" +
+      "t.controller.mdsal.PathArgument\"\251\002\n\004Node",
+      "\022\014\n\004path\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022@\n\nattribut" +
+      "es\030\003 \003(\0132,.org.opendaylight.controller.m" +
+      "dsal.Attribute\0226\n\005child\030\004 \003(\0132\'.org.open" +
+      "daylight.controller.mdsal.Node\022\r\n\005value\030" +
+      "\005 \001(\t\022\021\n\tvalueType\030\006 \001(\t\022\021\n\tbitsValue\030\007 " +
+      "\003(\t\022V\n\027instanceIdentifierValue\030\010 \001(\01325.o" +
+      "rg.opendaylight.controller.mdsal.Instanc" +
+      "eIdentifier\"`\n\tContainer\022\022\n\nparentPath\030\001" +
+      " \002(\t\022?\n\016normalizedNode\030\002 \001(\0132\'.org.opend" +
+      "aylight.controller.mdsal.Node\"\246\001\n\014NodeMa",
+      "pEntry\022U\n\026instanceIdentifierPath\030\001 \002(\01325" +
+      ".org.opendaylight.controller.mdsal.Insta" +
+      "nceIdentifier\022?\n\016normalizedNode\030\002 \001(\0132\'." +
+      "org.opendaylight.controller.mdsal.Node\"N" +
+      "\n\007NodeMap\022C\n\nmapEntries\030\001 \003(\0132/.org.open" +
+      "daylight.controller.mdsal.NodeMapEntryBO" +
+      "\n5org.opendaylight.controller.protobuff." +
+      "messages.commonB\026NormalizedNodeMessages"
+    };
+    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+        public com.google.protobuf.ExtensionRegistry assignDescriptors(
+            com.google.protobuf.Descriptors.FileDescriptor root) {
+          descriptor = root;
+          internal_static_org_opendaylight_controller_mdsal_Attribute_descriptor =
+            getDescriptor().getMessageTypes().get(0);
+          internal_static_org_opendaylight_controller_mdsal_Attribute_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_Attribute_descriptor,
+              new java.lang.String[] { "Name", "Value", "Type", });
+          internal_static_org_opendaylight_controller_mdsal_QName_descriptor =
+            getDescriptor().getMessageTypes().get(1);
+          internal_static_org_opendaylight_controller_mdsal_QName_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_QName_descriptor,
+              new java.lang.String[] { "Value", });
+          internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor =
+            getDescriptor().getMessageTypes().get(2);
+          internal_static_org_opendaylight_controller_mdsal_PathArgument_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor,
+              new java.lang.String[] { "Value", "Type", "NodeType", "Attributes", });
+          internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor =
+            getDescriptor().getMessageTypes().get(3);
+          internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor,
+              new java.lang.String[] { "Arguments", });
+          internal_static_org_opendaylight_controller_mdsal_Node_descriptor =
+            getDescriptor().getMessageTypes().get(4);
+          internal_static_org_opendaylight_controller_mdsal_Node_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_Node_descriptor,
+              new java.lang.String[] { "Path", "Type", "Attributes", "Child", "Value", "ValueType", "BitsValue", "InstanceIdentifierValue", });
+          internal_static_org_opendaylight_controller_mdsal_Container_descriptor =
+            getDescriptor().getMessageTypes().get(5);
+          internal_static_org_opendaylight_controller_mdsal_Container_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_Container_descriptor,
+              new java.lang.String[] { "ParentPath", "NormalizedNode", });
+          internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor =
+            getDescriptor().getMessageTypes().get(6);
+          internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor,
+              new java.lang.String[] { "InstanceIdentifierPath", "NormalizedNode", });
+          internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor =
+            getDescriptor().getMessageTypes().get(7);
+          internal_static_org_opendaylight_controller_mdsal_NodeMap_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor,
+              new java.lang.String[] { "MapEntries", });
+          return null;
+        }
+      };
+    com.google.protobuf.Descriptors.FileDescriptor
+      .internalBuildGeneratedFileFrom(descriptorData,
+        new com.google.protobuf.Descriptors.FileDescriptor[] {
+        }, assigner);
+  }
+
+  // @@protoc_insertion_point(outer_class_scope)
+}
index 67ab472d0ce27973757a8c22b1e104bd72550fe2..29e54571d30b6ddbb9392c6f3edbed83f09c5db8 100644 (file)
@@ -159,7 +159,7 @@ public final class SimpleNormalizedNodeMessage {
       if (ref instanceof java.lang.String) {
         return (java.lang.String) ref;
       } else {
-        com.google.protobuf.ByteString bs =
+        com.google.protobuf.ByteString bs = 
             (com.google.protobuf.ByteString) ref;
         java.lang.String s = bs.toStringUtf8();
         if (bs.isValidUtf8()) {
@@ -175,7 +175,7 @@ public final class SimpleNormalizedNodeMessage {
         getNodeIdentifierBytes() {
       java.lang.Object ref = nodeIdentifier_;
       if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b =
+        com.google.protobuf.ByteString b = 
             com.google.protobuf.ByteString.copyFromUtf8(
                 (java.lang.String) ref);
         nodeIdentifier_ = b;
@@ -202,7 +202,7 @@ public final class SimpleNormalizedNodeMessage {
       if (ref instanceof java.lang.String) {
         return (java.lang.String) ref;
       } else {
-        com.google.protobuf.ByteString bs =
+        com.google.protobuf.ByteString bs = 
             (com.google.protobuf.ByteString) ref;
         java.lang.String s = bs.toStringUtf8();
         if (bs.isValidUtf8()) {
@@ -218,7 +218,7 @@ public final class SimpleNormalizedNodeMessage {
         getXmlStringBytes() {
       java.lang.Object ref = xmlString_;
       if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b =
+        com.google.protobuf.ByteString b = 
             com.google.protobuf.ByteString.copyFromUtf8(
                 (java.lang.String) ref);
         xmlString_ = b;
@@ -463,11 +463,11 @@ public final class SimpleNormalizedNodeMessage {
 
       public final boolean isInitialized() {
         if (!hasNodeIdentifier()) {
-
+          
           return false;
         }
         if (!hasXmlString()) {
-
+          
           return false;
         }
         return true;
@@ -521,7 +521,7 @@ public final class SimpleNormalizedNodeMessage {
           getNodeIdentifierBytes() {
         java.lang.Object ref = nodeIdentifier_;
         if (ref instanceof String) {
-          com.google.protobuf.ByteString b =
+          com.google.protobuf.ByteString b = 
               com.google.protobuf.ByteString.copyFromUtf8(
                   (java.lang.String) ref);
           nodeIdentifier_ = b;
@@ -595,7 +595,7 @@ public final class SimpleNormalizedNodeMessage {
           getXmlStringBytes() {
         java.lang.Object ref = xmlString_;
         if (ref instanceof String) {
-          com.google.protobuf.ByteString b =
+          com.google.protobuf.ByteString b = 
               com.google.protobuf.ByteString.copyFromUtf8(
                   (java.lang.String) ref);
           xmlString_ = b;
index 391107e2b7170f315373c00da84c4960867d0ed4..201883476838f3c592f63e47c08fcde5a661b29a 100644 (file)
@@ -11,39 +11,100 @@ public final class DataChangeListenerMessages {
   public interface DataChangedOrBuilder
       extends com.google.protobuf.MessageOrBuilder {
 
-    // repeated string instanceIdentifierPathArguments = 1;
+    // optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
      */
-    java.util.List<java.lang.String>
-    getInstanceIdentifierPathArgumentsList();
+    boolean hasOriginalSubTree();
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
      */
-    int getInstanceIdentifierPathArgumentsCount();
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getOriginalSubTree();
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
      */
-    java.lang.String getInstanceIdentifierPathArguments(int index);
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getOriginalSubTreeOrBuilder();
+
+    // optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
+     */
+    boolean hasUpdatedSubTree();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getUpdatedSubTree();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getUpdatedSubTreeOrBuilder();
+
+    // optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+     */
+    boolean hasOriginalData();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getOriginalData();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getOriginalDataOrBuilder();
+
+    // optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+     */
+    boolean hasUpdatedData();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getUpdatedData();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getUpdatedDataOrBuilder();
+
+    // optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+     */
+    boolean hasCreatedData();
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
      */
-    com.google.protobuf.ByteString
-        getInstanceIdentifierPathArgumentsBytes(int index);
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getCreatedData();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getCreatedDataOrBuilder();
 
-    // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;
+    // repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+     */
+    java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier> 
+        getRemovedPathsList();
     /**
-     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
      */
-    boolean hasNormalizedNodeXml();
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getRemovedPaths(int index);
     /**
-     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
      */
-    org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNodeXml();
+    int getRemovedPathsCount();
     /**
-     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
      */
-    org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeXmlOrBuilder();
+    java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> 
+        getRemovedPathsOrBuilderList();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getRemovedPathsOrBuilder(
+        int index);
   }
   /**
    * Protobuf type {@code org.opendaylight.controller.mdsal.DataChanged}
@@ -97,24 +158,76 @@ public final class DataChangeListenerMessages {
               break;
             }
             case 10: {
-              if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
-                instanceIdentifierPathArguments_ = new com.google.protobuf.LazyStringArrayList();
-                mutable_bitField0_ |= 0x00000001;
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000001) == 0x00000001)) {
+                subBuilder = originalSubTree_.toBuilder();
+              }
+              originalSubTree_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(originalSubTree_);
+                originalSubTree_ = subBuilder.buildPartial();
               }
-              instanceIdentifierPathArguments_.add(input.readBytes());
+              bitField0_ |= 0x00000001;
               break;
             }
             case 18: {
-              org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder subBuilder = null;
-              if (((bitField0_ & 0x00000001) == 0x00000001)) {
-                subBuilder = normalizedNodeXml_.toBuilder();
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000002) == 0x00000002)) {
+                subBuilder = updatedSubTree_.toBuilder();
               }
-              normalizedNodeXml_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.PARSER, extensionRegistry);
+              updatedSubTree_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry);
               if (subBuilder != null) {
-                subBuilder.mergeFrom(normalizedNodeXml_);
-                normalizedNodeXml_ = subBuilder.buildPartial();
+                subBuilder.mergeFrom(updatedSubTree_);
+                updatedSubTree_ = subBuilder.buildPartial();
               }
-              bitField0_ |= 0x00000001;
+              bitField0_ |= 0x00000002;
+              break;
+            }
+            case 26: {
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000004) == 0x00000004)) {
+                subBuilder = originalData_.toBuilder();
+              }
+              originalData_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(originalData_);
+                originalData_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000004;
+              break;
+            }
+            case 34: {
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000008) == 0x00000008)) {
+                subBuilder = updatedData_.toBuilder();
+              }
+              updatedData_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(updatedData_);
+                updatedData_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000008;
+              break;
+            }
+            case 42: {
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000010) == 0x00000010)) {
+                subBuilder = createdData_.toBuilder();
+              }
+              createdData_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(createdData_);
+                createdData_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000010;
+              break;
+            }
+            case 50: {
+              if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
+                removedPaths_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier>();
+                mutable_bitField0_ |= 0x00000020;
+              }
+              removedPaths_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry));
               break;
             }
           }
@@ -125,8 +238,8 @@ public final class DataChangeListenerMessages {
         throw new com.google.protobuf.InvalidProtocolBufferException(
             e.getMessage()).setUnfinishedMessage(this);
       } finally {
-        if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
-          instanceIdentifierPathArguments_ = new com.google.protobuf.UnmodifiableLazyStringList(instanceIdentifierPathArguments_);
+        if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
+          removedPaths_ = java.util.Collections.unmodifiableList(removedPaths_);
         }
         this.unknownFields = unknownFields.build();
         makeExtensionsImmutable();
@@ -160,74 +273,200 @@ public final class DataChangeListenerMessages {
     }
 
     private int bitField0_;
-    // repeated string instanceIdentifierPathArguments = 1;
-    public static final int INSTANCEIDENTIFIERPATHARGUMENTS_FIELD_NUMBER = 1;
-    private com.google.protobuf.LazyStringList instanceIdentifierPathArguments_;
+    // optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;
+    public static final int ORIGINALSUBTREE_FIELD_NUMBER = 1;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node originalSubTree_;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
+     */
+    public boolean hasOriginalSubTree() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getOriginalSubTree() {
+      return originalSubTree_;
+    }
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
      */
-    public java.util.List<java.lang.String>
-        getInstanceIdentifierPathArgumentsList() {
-      return instanceIdentifierPathArguments_;
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getOriginalSubTreeOrBuilder() {
+      return originalSubTree_;
     }
+
+    // optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;
+    public static final int UPDATEDSUBTREE_FIELD_NUMBER = 2;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node updatedSubTree_;
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
      */
-    public int getInstanceIdentifierPathArgumentsCount() {
-      return instanceIdentifierPathArguments_.size();
+    public boolean hasUpdatedSubTree() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
     }
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
      */
-    public java.lang.String getInstanceIdentifierPathArguments(int index) {
-      return instanceIdentifierPathArguments_.get(index);
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getUpdatedSubTree() {
+      return updatedSubTree_;
     }
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
      */
-    public com.google.protobuf.ByteString
-        getInstanceIdentifierPathArgumentsBytes(int index) {
-      return instanceIdentifierPathArguments_.getByteString(index);
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getUpdatedSubTreeOrBuilder() {
+      return updatedSubTree_;
     }
 
-    // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;
-    public static final int NORMALIZEDNODEXML_FIELD_NUMBER = 2;
-    private org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml normalizedNodeXml_;
+    // optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;
+    public static final int ORIGINALDATA_FIELD_NUMBER = 3;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap originalData_;
     /**
-     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+     * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
      */
-    public boolean hasNormalizedNodeXml() {
-      return ((bitField0_ & 0x00000001) == 0x00000001);
+    public boolean hasOriginalData() {
+      return ((bitField0_ & 0x00000004) == 0x00000004);
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getOriginalData() {
+      return originalData_;
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getOriginalDataOrBuilder() {
+      return originalData_;
+    }
+
+    // optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;
+    public static final int UPDATEDDATA_FIELD_NUMBER = 4;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap updatedData_;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+     */
+    public boolean hasUpdatedData() {
+      return ((bitField0_ & 0x00000008) == 0x00000008);
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getUpdatedData() {
+      return updatedData_;
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getUpdatedDataOrBuilder() {
+      return updatedData_;
+    }
+
+    // optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;
+    public static final int CREATEDDATA_FIELD_NUMBER = 5;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap createdData_;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+     */
+    public boolean hasCreatedData() {
+      return ((bitField0_ & 0x00000010) == 0x00000010);
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getCreatedData() {
+      return createdData_;
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getCreatedDataOrBuilder() {
+      return createdData_;
+    }
+
+    // repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;
+    public static final int REMOVEDPATHS_FIELD_NUMBER = 6;
+    private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier> removedPaths_;
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+     */
+    public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier> getRemovedPathsList() {
+      return removedPaths_;
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+     */
+    public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> 
+        getRemovedPathsOrBuilderList() {
+      return removedPaths_;
     }
     /**
-     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
      */
-    public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNodeXml() {
-      return normalizedNodeXml_;
+    public int getRemovedPathsCount() {
+      return removedPaths_.size();
     }
     /**
-     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
      */
-    public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeXmlOrBuilder() {
-      return normalizedNodeXml_;
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getRemovedPaths(int index) {
+      return removedPaths_.get(index);
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getRemovedPathsOrBuilder(
+        int index) {
+      return removedPaths_.get(index);
     }
 
     private void initFields() {
-      instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-      normalizedNodeXml_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+      originalSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+      updatedSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+      originalData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+      updatedData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+      createdData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+      removedPaths_ = java.util.Collections.emptyList();
     }
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
       if (isInitialized != -1) return isInitialized == 1;
 
-      if (!hasNormalizedNodeXml()) {
-        memoizedIsInitialized = 0;
-        return false;
+      if (hasOriginalSubTree()) {
+        if (!getOriginalSubTree().isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      if (hasUpdatedSubTree()) {
+        if (!getUpdatedSubTree().isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      if (hasOriginalData()) {
+        if (!getOriginalData().isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      if (hasUpdatedData()) {
+        if (!getUpdatedData().isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      if (hasCreatedData()) {
+        if (!getCreatedData().isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
       }
-      if (!getNormalizedNodeXml().isInitialized()) {
-        memoizedIsInitialized = 0;
-        return false;
+      for (int i = 0; i < getRemovedPathsCount(); i++) {
+        if (!getRemovedPaths(i).isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
       }
       memoizedIsInitialized = 1;
       return true;
@@ -236,11 +475,23 @@ public final class DataChangeListenerMessages {
     public void writeTo(com.google.protobuf.CodedOutputStream output)
                         throws java.io.IOException {
       getSerializedSize();
-      for (int i = 0; i < instanceIdentifierPathArguments_.size(); i++) {
-        output.writeBytes(1, instanceIdentifierPathArguments_.getByteString(i));
-      }
       if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        output.writeMessage(2, normalizedNodeXml_);
+        output.writeMessage(1, originalSubTree_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeMessage(2, updatedSubTree_);
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        output.writeMessage(3, originalData_);
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        output.writeMessage(4, updatedData_);
+      }
+      if (((bitField0_ & 0x00000010) == 0x00000010)) {
+        output.writeMessage(5, createdData_);
+      }
+      for (int i = 0; i < removedPaths_.size(); i++) {
+        output.writeMessage(6, removedPaths_.get(i));
       }
       getUnknownFields().writeTo(output);
     }
@@ -251,18 +502,29 @@ public final class DataChangeListenerMessages {
       if (size != -1) return size;
 
       size = 0;
-      {
-        int dataSize = 0;
-        for (int i = 0; i < instanceIdentifierPathArguments_.size(); i++) {
-          dataSize += com.google.protobuf.CodedOutputStream
-            .computeBytesSizeNoTag(instanceIdentifierPathArguments_.getByteString(i));
-        }
-        size += dataSize;
-        size += 1 * getInstanceIdentifierPathArgumentsList().size();
-      }
       if (((bitField0_ & 0x00000001) == 0x00000001)) {
         size += com.google.protobuf.CodedOutputStream
-          .computeMessageSize(2, normalizedNodeXml_);
+          .computeMessageSize(1, originalSubTree_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(2, updatedSubTree_);
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(3, originalData_);
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(4, updatedData_);
+      }
+      if (((bitField0_ & 0x00000010) == 0x00000010)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(5, createdData_);
+      }
+      for (int i = 0; i < removedPaths_.size(); i++) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(6, removedPaths_.get(i));
       }
       size += getUnknownFields().getSerializedSize();
       memoizedSerializedSize = size;
@@ -372,7 +634,12 @@ public final class DataChangeListenerMessages {
       }
       private void maybeForceBuilderInitialization() {
         if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
-          getNormalizedNodeXmlFieldBuilder();
+          getOriginalSubTreeFieldBuilder();
+          getUpdatedSubTreeFieldBuilder();
+          getOriginalDataFieldBuilder();
+          getUpdatedDataFieldBuilder();
+          getCreatedDataFieldBuilder();
+          getRemovedPathsFieldBuilder();
         }
       }
       private static Builder create() {
@@ -381,14 +648,42 @@ public final class DataChangeListenerMessages {
 
       public Builder clear() {
         super.clear();
-        instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+        if (originalSubTreeBuilder_ == null) {
+          originalSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+        } else {
+          originalSubTreeBuilder_.clear();
+        }
         bitField0_ = (bitField0_ & ~0x00000001);
-        if (normalizedNodeXmlBuilder_ == null) {
-          normalizedNodeXml_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+        if (updatedSubTreeBuilder_ == null) {
+          updatedSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
         } else {
-          normalizedNodeXmlBuilder_.clear();
+          updatedSubTreeBuilder_.clear();
         }
         bitField0_ = (bitField0_ & ~0x00000002);
+        if (originalDataBuilder_ == null) {
+          originalData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+        } else {
+          originalDataBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000004);
+        if (updatedDataBuilder_ == null) {
+          updatedData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+        } else {
+          updatedDataBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000008);
+        if (createdDataBuilder_ == null) {
+          createdData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+        } else {
+          createdDataBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000010);
+        if (removedPathsBuilder_ == null) {
+          removedPaths_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000020);
+        } else {
+          removedPathsBuilder_.clear();
+        }
         return this;
       }
 
@@ -417,19 +712,54 @@ public final class DataChangeListenerMessages {
         org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged result = new org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged(this);
         int from_bitField0_ = bitField0_;
         int to_bitField0_ = 0;
-        if (((bitField0_ & 0x00000001) == 0x00000001)) {
-          instanceIdentifierPathArguments_ = new com.google.protobuf.UnmodifiableLazyStringList(
-              instanceIdentifierPathArguments_);
-          bitField0_ = (bitField0_ & ~0x00000001);
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        if (originalSubTreeBuilder_ == null) {
+          result.originalSubTree_ = originalSubTree_;
+        } else {
+          result.originalSubTree_ = originalSubTreeBuilder_.build();
         }
-        result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
         if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
-          to_bitField0_ |= 0x00000001;
+          to_bitField0_ |= 0x00000002;
+        }
+        if (updatedSubTreeBuilder_ == null) {
+          result.updatedSubTree_ = updatedSubTree_;
+        } else {
+          result.updatedSubTree_ = updatedSubTreeBuilder_.build();
+        }
+        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+          to_bitField0_ |= 0x00000004;
+        }
+        if (originalDataBuilder_ == null) {
+          result.originalData_ = originalData_;
+        } else {
+          result.originalData_ = originalDataBuilder_.build();
         }
-        if (normalizedNodeXmlBuilder_ == null) {
-          result.normalizedNodeXml_ = normalizedNodeXml_;
+        if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
+          to_bitField0_ |= 0x00000008;
+        }
+        if (updatedDataBuilder_ == null) {
+          result.updatedData_ = updatedData_;
+        } else {
+          result.updatedData_ = updatedDataBuilder_.build();
+        }
+        if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
+          to_bitField0_ |= 0x00000010;
+        }
+        if (createdDataBuilder_ == null) {
+          result.createdData_ = createdData_;
         } else {
-          result.normalizedNodeXml_ = normalizedNodeXmlBuilder_.build();
+          result.createdData_ = createdDataBuilder_.build();
+        }
+        if (removedPathsBuilder_ == null) {
+          if (((bitField0_ & 0x00000020) == 0x00000020)) {
+            removedPaths_ = java.util.Collections.unmodifiableList(removedPaths_);
+            bitField0_ = (bitField0_ & ~0x00000020);
+          }
+          result.removedPaths_ = removedPaths_;
+        } else {
+          result.removedPaths_ = removedPathsBuilder_.build();
         }
         result.bitField0_ = to_bitField0_;
         onBuilt();
@@ -447,31 +777,87 @@ public final class DataChangeListenerMessages {
 
       public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged other) {
         if (other == org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged.getDefaultInstance()) return this;
-        if (!other.instanceIdentifierPathArguments_.isEmpty()) {
-          if (instanceIdentifierPathArguments_.isEmpty()) {
-            instanceIdentifierPathArguments_ = other.instanceIdentifierPathArguments_;
-            bitField0_ = (bitField0_ & ~0x00000001);
-          } else {
-            ensureInstanceIdentifierPathArgumentsIsMutable();
-            instanceIdentifierPathArguments_.addAll(other.instanceIdentifierPathArguments_);
-          }
-          onChanged();
+        if (other.hasOriginalSubTree()) {
+          mergeOriginalSubTree(other.getOriginalSubTree());
+        }
+        if (other.hasUpdatedSubTree()) {
+          mergeUpdatedSubTree(other.getUpdatedSubTree());
+        }
+        if (other.hasOriginalData()) {
+          mergeOriginalData(other.getOriginalData());
         }
-        if (other.hasNormalizedNodeXml()) {
-          mergeNormalizedNodeXml(other.getNormalizedNodeXml());
+        if (other.hasUpdatedData()) {
+          mergeUpdatedData(other.getUpdatedData());
+        }
+        if (other.hasCreatedData()) {
+          mergeCreatedData(other.getCreatedData());
+        }
+        if (removedPathsBuilder_ == null) {
+          if (!other.removedPaths_.isEmpty()) {
+            if (removedPaths_.isEmpty()) {
+              removedPaths_ = other.removedPaths_;
+              bitField0_ = (bitField0_ & ~0x00000020);
+            } else {
+              ensureRemovedPathsIsMutable();
+              removedPaths_.addAll(other.removedPaths_);
+            }
+            onChanged();
+          }
+        } else {
+          if (!other.removedPaths_.isEmpty()) {
+            if (removedPathsBuilder_.isEmpty()) {
+              removedPathsBuilder_.dispose();
+              removedPathsBuilder_ = null;
+              removedPaths_ = other.removedPaths_;
+              bitField0_ = (bitField0_ & ~0x00000020);
+              removedPathsBuilder_ = 
+                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+                   getRemovedPathsFieldBuilder() : null;
+            } else {
+              removedPathsBuilder_.addAllMessages(other.removedPaths_);
+            }
+          }
         }
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
 
       public final boolean isInitialized() {
-        if (!hasNormalizedNodeXml()) {
-
-          return false;
+        if (hasOriginalSubTree()) {
+          if (!getOriginalSubTree().isInitialized()) {
+            
+            return false;
+          }
         }
-        if (!getNormalizedNodeXml().isInitialized()) {
-
-          return false;
+        if (hasUpdatedSubTree()) {
+          if (!getUpdatedSubTree().isInitialized()) {
+            
+            return false;
+          }
+        }
+        if (hasOriginalData()) {
+          if (!getOriginalData().isInitialized()) {
+            
+            return false;
+          }
+        }
+        if (hasUpdatedData()) {
+          if (!getUpdatedData().isInitialized()) {
+            
+            return false;
+          }
+        }
+        if (hasCreatedData()) {
+          if (!getCreatedData().isInitialized()) {
+            
+            return false;
+          }
+        }
+        for (int i = 0; i < getRemovedPathsCount(); i++) {
+          if (!getRemovedPaths(i).isInitialized()) {
+            
+            return false;
+          }
         }
         return true;
       }
@@ -495,214 +881,829 @@ public final class DataChangeListenerMessages {
       }
       private int bitField0_;
 
-      // repeated string instanceIdentifierPathArguments = 1;
-      private com.google.protobuf.LazyStringList instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-      private void ensureInstanceIdentifierPathArgumentsIsMutable() {
-        if (!((bitField0_ & 0x00000001) == 0x00000001)) {
-          instanceIdentifierPathArguments_ = new com.google.protobuf.LazyStringArrayList(instanceIdentifierPathArguments_);
-          bitField0_ |= 0x00000001;
-         }
-      }
+      // optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node originalSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> originalSubTreeBuilder_;
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
        */
-      public java.util.List<java.lang.String>
-          getInstanceIdentifierPathArgumentsList() {
-        return java.util.Collections.unmodifiableList(instanceIdentifierPathArguments_);
+      public boolean hasOriginalSubTree() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
        */
-      public int getInstanceIdentifierPathArgumentsCount() {
-        return instanceIdentifierPathArguments_.size();
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getOriginalSubTree() {
+        if (originalSubTreeBuilder_ == null) {
+          return originalSubTree_;
+        } else {
+          return originalSubTreeBuilder_.getMessage();
+        }
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
        */
-      public java.lang.String getInstanceIdentifierPathArguments(int index) {
-        return instanceIdentifierPathArguments_.get(index);
+      public Builder setOriginalSubTree(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+        if (originalSubTreeBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          originalSubTree_ = value;
+          onChanged();
+        } else {
+          originalSubTreeBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000001;
+        return this;
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
        */
-      public com.google.protobuf.ByteString
-          getInstanceIdentifierPathArgumentsBytes(int index) {
-        return instanceIdentifierPathArguments_.getByteString(index);
+      public Builder setOriginalSubTree(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
+        if (originalSubTreeBuilder_ == null) {
+          originalSubTree_ = builderForValue.build();
+          onChanged();
+        } else {
+          originalSubTreeBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000001;
+        return this;
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
        */
-      public Builder setInstanceIdentifierPathArguments(
-          int index, java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  ensureInstanceIdentifierPathArgumentsIsMutable();
-        instanceIdentifierPathArguments_.set(index, value);
-        onChanged();
+      public Builder mergeOriginalSubTree(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+        if (originalSubTreeBuilder_ == null) {
+          if (((bitField0_ & 0x00000001) == 0x00000001) &&
+              originalSubTree_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) {
+            originalSubTree_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(originalSubTree_).mergeFrom(value).buildPartial();
+          } else {
+            originalSubTree_ = value;
+          }
+          onChanged();
+        } else {
+          originalSubTreeBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000001;
         return this;
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
        */
-      public Builder addInstanceIdentifierPathArguments(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  ensureInstanceIdentifierPathArgumentsIsMutable();
-        instanceIdentifierPathArguments_.add(value);
-        onChanged();
+      public Builder clearOriginalSubTree() {
+        if (originalSubTreeBuilder_ == null) {
+          originalSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+          onChanged();
+        } else {
+          originalSubTreeBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000001);
         return this;
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
        */
-      public Builder addAllInstanceIdentifierPathArguments(
-          java.lang.Iterable<java.lang.String> values) {
-        ensureInstanceIdentifierPathArgumentsIsMutable();
-        super.addAll(values, instanceIdentifierPathArguments_);
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getOriginalSubTreeBuilder() {
+        bitField0_ |= 0x00000001;
         onChanged();
-        return this;
+        return getOriginalSubTreeFieldBuilder().getBuilder();
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
        */
-      public Builder clearInstanceIdentifierPathArguments() {
-        instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-        bitField0_ = (bitField0_ & ~0x00000001);
-        onChanged();
-        return this;
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getOriginalSubTreeOrBuilder() {
+        if (originalSubTreeBuilder_ != null) {
+          return originalSubTreeBuilder_.getMessageOrBuilder();
+        } else {
+          return originalSubTree_;
+        }
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
        */
-      public Builder addInstanceIdentifierPathArgumentsBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  ensureInstanceIdentifierPathArgumentsIsMutable();
-        instanceIdentifierPathArguments_.add(value);
-        onChanged();
-        return this;
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> 
+          getOriginalSubTreeFieldBuilder() {
+        if (originalSubTreeBuilder_ == null) {
+          originalSubTreeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
+                  originalSubTree_,
+                  getParentForChildren(),
+                  isClean());
+          originalSubTree_ = null;
+        }
+        return originalSubTreeBuilder_;
       }
 
-      // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;
-      private org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml normalizedNodeXml_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+      // optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node updatedSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
       private com.google.protobuf.SingleFieldBuilder<
-          org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder> normalizedNodeXmlBuilder_;
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> updatedSubTreeBuilder_;
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
        */
-      public boolean hasNormalizedNodeXml() {
+      public boolean hasUpdatedSubTree() {
         return ((bitField0_ & 0x00000002) == 0x00000002);
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
        */
-      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNodeXml() {
-        if (normalizedNodeXmlBuilder_ == null) {
-          return normalizedNodeXml_;
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getUpdatedSubTree() {
+        if (updatedSubTreeBuilder_ == null) {
+          return updatedSubTree_;
         } else {
-          return normalizedNodeXmlBuilder_.getMessage();
+          return updatedSubTreeBuilder_.getMessage();
         }
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
        */
-      public Builder setNormalizedNodeXml(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml value) {
-        if (normalizedNodeXmlBuilder_ == null) {
+      public Builder setUpdatedSubTree(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+        if (updatedSubTreeBuilder_ == null) {
           if (value == null) {
             throw new NullPointerException();
           }
-          normalizedNodeXml_ = value;
+          updatedSubTree_ = value;
           onChanged();
         } else {
-          normalizedNodeXmlBuilder_.setMessage(value);
+          updatedSubTreeBuilder_.setMessage(value);
         }
         bitField0_ |= 0x00000002;
         return this;
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
        */
-      public Builder setNormalizedNodeXml(
-          org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder builderForValue) {
-        if (normalizedNodeXmlBuilder_ == null) {
-          normalizedNodeXml_ = builderForValue.build();
+      public Builder setUpdatedSubTree(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
+        if (updatedSubTreeBuilder_ == null) {
+          updatedSubTree_ = builderForValue.build();
           onChanged();
         } else {
-          normalizedNodeXmlBuilder_.setMessage(builderForValue.build());
+          updatedSubTreeBuilder_.setMessage(builderForValue.build());
         }
         bitField0_ |= 0x00000002;
         return this;
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
        */
-      public Builder mergeNormalizedNodeXml(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml value) {
-        if (normalizedNodeXmlBuilder_ == null) {
+      public Builder mergeUpdatedSubTree(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+        if (updatedSubTreeBuilder_ == null) {
           if (((bitField0_ & 0x00000002) == 0x00000002) &&
-              normalizedNodeXml_ != org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance()) {
-            normalizedNodeXml_ =
-              org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.newBuilder(normalizedNodeXml_).mergeFrom(value).buildPartial();
+              updatedSubTree_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) {
+            updatedSubTree_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(updatedSubTree_).mergeFrom(value).buildPartial();
           } else {
-            normalizedNodeXml_ = value;
+            updatedSubTree_ = value;
           }
           onChanged();
         } else {
-          normalizedNodeXmlBuilder_.mergeFrom(value);
+          updatedSubTreeBuilder_.mergeFrom(value);
         }
         bitField0_ |= 0x00000002;
         return this;
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
        */
-      public Builder clearNormalizedNodeXml() {
-        if (normalizedNodeXmlBuilder_ == null) {
-          normalizedNodeXml_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+      public Builder clearUpdatedSubTree() {
+        if (updatedSubTreeBuilder_ == null) {
+          updatedSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
           onChanged();
         } else {
-          normalizedNodeXmlBuilder_.clear();
+          updatedSubTreeBuilder_.clear();
         }
         bitField0_ = (bitField0_ & ~0x00000002);
         return this;
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
        */
-      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder getNormalizedNodeXmlBuilder() {
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getUpdatedSubTreeBuilder() {
         bitField0_ |= 0x00000002;
         onChanged();
-        return getNormalizedNodeXmlFieldBuilder().getBuilder();
+        return getUpdatedSubTreeFieldBuilder().getBuilder();
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
        */
-      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeXmlOrBuilder() {
-        if (normalizedNodeXmlBuilder_ != null) {
-          return normalizedNodeXmlBuilder_.getMessageOrBuilder();
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getUpdatedSubTreeOrBuilder() {
+        if (updatedSubTreeBuilder_ != null) {
+          return updatedSubTreeBuilder_.getMessageOrBuilder();
         } else {
-          return normalizedNodeXml_;
+          return updatedSubTree_;
         }
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
        */
       private com.google.protobuf.SingleFieldBuilder<
-          org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder>
-          getNormalizedNodeXmlFieldBuilder() {
-        if (normalizedNodeXmlBuilder_ == null) {
-          normalizedNodeXmlBuilder_ = new com.google.protobuf.SingleFieldBuilder<
-              org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder>(
-                  normalizedNodeXml_,
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> 
+          getUpdatedSubTreeFieldBuilder() {
+        if (updatedSubTreeBuilder_ == null) {
+          updatedSubTreeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
+                  updatedSubTree_,
+                  getParentForChildren(),
+                  isClean());
+          updatedSubTree_ = null;
+        }
+        return updatedSubTreeBuilder_;
+      }
+
+      // optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap originalData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder> originalDataBuilder_;
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+       */
+      public boolean hasOriginalData() {
+        return ((bitField0_ & 0x00000004) == 0x00000004);
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getOriginalData() {
+        if (originalDataBuilder_ == null) {
+          return originalData_;
+        } else {
+          return originalDataBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+       */
+      public Builder setOriginalData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap value) {
+        if (originalDataBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          originalData_ = value;
+          onChanged();
+        } else {
+          originalDataBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000004;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+       */
+      public Builder setOriginalData(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder builderForValue) {
+        if (originalDataBuilder_ == null) {
+          originalData_ = builderForValue.build();
+          onChanged();
+        } else {
+          originalDataBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000004;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+       */
+      public Builder mergeOriginalData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap value) {
+        if (originalDataBuilder_ == null) {
+          if (((bitField0_ & 0x00000004) == 0x00000004) &&
+              originalData_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance()) {
+            originalData_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.newBuilder(originalData_).mergeFrom(value).buildPartial();
+          } else {
+            originalData_ = value;
+          }
+          onChanged();
+        } else {
+          originalDataBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000004;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+       */
+      public Builder clearOriginalData() {
+        if (originalDataBuilder_ == null) {
+          originalData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+          onChanged();
+        } else {
+          originalDataBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000004);
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder getOriginalDataBuilder() {
+        bitField0_ |= 0x00000004;
+        onChanged();
+        return getOriginalDataFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getOriginalDataOrBuilder() {
+        if (originalDataBuilder_ != null) {
+          return originalDataBuilder_.getMessageOrBuilder();
+        } else {
+          return originalData_;
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder> 
+          getOriginalDataFieldBuilder() {
+        if (originalDataBuilder_ == null) {
+          originalDataBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder>(
+                  originalData_,
+                  getParentForChildren(),
+                  isClean());
+          originalData_ = null;
+        }
+        return originalDataBuilder_;
+      }
+
+      // optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap updatedData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder> updatedDataBuilder_;
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+       */
+      public boolean hasUpdatedData() {
+        return ((bitField0_ & 0x00000008) == 0x00000008);
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getUpdatedData() {
+        if (updatedDataBuilder_ == null) {
+          return updatedData_;
+        } else {
+          return updatedDataBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+       */
+      public Builder setUpdatedData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap value) {
+        if (updatedDataBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          updatedData_ = value;
+          onChanged();
+        } else {
+          updatedDataBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000008;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+       */
+      public Builder setUpdatedData(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder builderForValue) {
+        if (updatedDataBuilder_ == null) {
+          updatedData_ = builderForValue.build();
+          onChanged();
+        } else {
+          updatedDataBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000008;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+       */
+      public Builder mergeUpdatedData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap value) {
+        if (updatedDataBuilder_ == null) {
+          if (((bitField0_ & 0x00000008) == 0x00000008) &&
+              updatedData_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance()) {
+            updatedData_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.newBuilder(updatedData_).mergeFrom(value).buildPartial();
+          } else {
+            updatedData_ = value;
+          }
+          onChanged();
+        } else {
+          updatedDataBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000008;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+       */
+      public Builder clearUpdatedData() {
+        if (updatedDataBuilder_ == null) {
+          updatedData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+          onChanged();
+        } else {
+          updatedDataBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000008);
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder getUpdatedDataBuilder() {
+        bitField0_ |= 0x00000008;
+        onChanged();
+        return getUpdatedDataFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getUpdatedDataOrBuilder() {
+        if (updatedDataBuilder_ != null) {
+          return updatedDataBuilder_.getMessageOrBuilder();
+        } else {
+          return updatedData_;
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder> 
+          getUpdatedDataFieldBuilder() {
+        if (updatedDataBuilder_ == null) {
+          updatedDataBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder>(
+                  updatedData_,
+                  getParentForChildren(),
+                  isClean());
+          updatedData_ = null;
+        }
+        return updatedDataBuilder_;
+      }
+
+      // optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap createdData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder> createdDataBuilder_;
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+       */
+      public boolean hasCreatedData() {
+        return ((bitField0_ & 0x00000010) == 0x00000010);
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getCreatedData() {
+        if (createdDataBuilder_ == null) {
+          return createdData_;
+        } else {
+          return createdDataBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+       */
+      public Builder setCreatedData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap value) {
+        if (createdDataBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          createdData_ = value;
+          onChanged();
+        } else {
+          createdDataBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000010;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+       */
+      public Builder setCreatedData(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder builderForValue) {
+        if (createdDataBuilder_ == null) {
+          createdData_ = builderForValue.build();
+          onChanged();
+        } else {
+          createdDataBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000010;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+       */
+      public Builder mergeCreatedData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap value) {
+        if (createdDataBuilder_ == null) {
+          if (((bitField0_ & 0x00000010) == 0x00000010) &&
+              createdData_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance()) {
+            createdData_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.newBuilder(createdData_).mergeFrom(value).buildPartial();
+          } else {
+            createdData_ = value;
+          }
+          onChanged();
+        } else {
+          createdDataBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000010;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+       */
+      public Builder clearCreatedData() {
+        if (createdDataBuilder_ == null) {
+          createdData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance();
+          onChanged();
+        } else {
+          createdDataBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000010);
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder getCreatedDataBuilder() {
+        bitField0_ |= 0x00000010;
+        onChanged();
+        return getCreatedDataFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getCreatedDataOrBuilder() {
+        if (createdDataBuilder_ != null) {
+          return createdDataBuilder_.getMessageOrBuilder();
+        } else {
+          return createdData_;
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder> 
+          getCreatedDataFieldBuilder() {
+        if (createdDataBuilder_ == null) {
+          createdDataBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder>(
+                  createdData_,
+                  getParentForChildren(),
+                  isClean());
+          createdData_ = null;
+        }
+        return createdDataBuilder_;
+      }
+
+      // repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;
+      private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier> removedPaths_ =
+        java.util.Collections.emptyList();
+      private void ensureRemovedPathsIsMutable() {
+        if (!((bitField0_ & 0x00000020) == 0x00000020)) {
+          removedPaths_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier>(removedPaths_);
+          bitField0_ |= 0x00000020;
+         }
+      }
+
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> removedPathsBuilder_;
+
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+       */
+      public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier> getRemovedPathsList() {
+        if (removedPathsBuilder_ == null) {
+          return java.util.Collections.unmodifiableList(removedPaths_);
+        } else {
+          return removedPathsBuilder_.getMessageList();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+       */
+      public int getRemovedPathsCount() {
+        if (removedPathsBuilder_ == null) {
+          return removedPaths_.size();
+        } else {
+          return removedPathsBuilder_.getCount();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getRemovedPaths(int index) {
+        if (removedPathsBuilder_ == null) {
+          return removedPaths_.get(index);
+        } else {
+          return removedPathsBuilder_.getMessage(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+       */
+      public Builder setRemovedPaths(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (removedPathsBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureRemovedPathsIsMutable();
+          removedPaths_.set(index, value);
+          onChanged();
+        } else {
+          removedPathsBuilder_.setMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+       */
+      public Builder setRemovedPaths(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+        if (removedPathsBuilder_ == null) {
+          ensureRemovedPathsIsMutable();
+          removedPaths_.set(index, builderForValue.build());
+          onChanged();
+        } else {
+          removedPathsBuilder_.setMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+       */
+      public Builder addRemovedPaths(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (removedPathsBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureRemovedPathsIsMutable();
+          removedPaths_.add(value);
+          onChanged();
+        } else {
+          removedPathsBuilder_.addMessage(value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+       */
+      public Builder addRemovedPaths(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (removedPathsBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureRemovedPathsIsMutable();
+          removedPaths_.add(index, value);
+          onChanged();
+        } else {
+          removedPathsBuilder_.addMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+       */
+      public Builder addRemovedPaths(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+        if (removedPathsBuilder_ == null) {
+          ensureRemovedPathsIsMutable();
+          removedPaths_.add(builderForValue.build());
+          onChanged();
+        } else {
+          removedPathsBuilder_.addMessage(builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+       */
+      public Builder addRemovedPaths(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+        if (removedPathsBuilder_ == null) {
+          ensureRemovedPathsIsMutable();
+          removedPaths_.add(index, builderForValue.build());
+          onChanged();
+        } else {
+          removedPathsBuilder_.addMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+       */
+      public Builder addAllRemovedPaths(
+          java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier> values) {
+        if (removedPathsBuilder_ == null) {
+          ensureRemovedPathsIsMutable();
+          super.addAll(values, removedPaths_);
+          onChanged();
+        } else {
+          removedPathsBuilder_.addAllMessages(values);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+       */
+      public Builder clearRemovedPaths() {
+        if (removedPathsBuilder_ == null) {
+          removedPaths_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000020);
+          onChanged();
+        } else {
+          removedPathsBuilder_.clear();
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+       */
+      public Builder removeRemovedPaths(int index) {
+        if (removedPathsBuilder_ == null) {
+          ensureRemovedPathsIsMutable();
+          removedPaths_.remove(index);
+          onChanged();
+        } else {
+          removedPathsBuilder_.remove(index);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getRemovedPathsBuilder(
+          int index) {
+        return getRemovedPathsFieldBuilder().getBuilder(index);
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getRemovedPathsOrBuilder(
+          int index) {
+        if (removedPathsBuilder_ == null) {
+          return removedPaths_.get(index);  } else {
+          return removedPathsBuilder_.getMessageOrBuilder(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+       */
+      public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> 
+           getRemovedPathsOrBuilderList() {
+        if (removedPathsBuilder_ != null) {
+          return removedPathsBuilder_.getMessageOrBuilderList();
+        } else {
+          return java.util.Collections.unmodifiableList(removedPaths_);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder addRemovedPathsBuilder() {
+        return getRemovedPathsFieldBuilder().addBuilder(
+            org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder addRemovedPathsBuilder(
+          int index) {
+        return getRemovedPathsFieldBuilder().addBuilder(
+            index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
+       */
+      public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder> 
+           getRemovedPathsBuilderList() {
+        return getRemovedPathsFieldBuilder().getBuilderList();
+      }
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> 
+          getRemovedPathsFieldBuilder() {
+        if (removedPathsBuilder_ == null) {
+          removedPathsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+                  removedPaths_,
+                  ((bitField0_ & 0x00000020) == 0x00000020),
                   getParentForChildren(),
                   isClean());
-          normalizedNodeXml_ = null;
+          removedPaths_ = null;
         }
-        return normalizedNodeXmlBuilder_;
+        return removedPathsBuilder_;
       }
 
       // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.DataChanged)
@@ -1045,14 +2046,21 @@ public final class DataChangeListenerMessages {
   static {
     java.lang.String[] descriptorData = {
       "\n\030DataChangeListener.proto\022!org.opendayl" +
-      "ight.controller.mdsal\032\032SimpleNormalizedN" +
-      "ode.proto\"\207\001\n\013DataChanged\022\'\n\037instanceIde" +
-      "ntifierPathArguments\030\001 \003(\t\022O\n\021normalized" +
-      "NodeXml\030\002 \002(\01324.org.opendaylight.control" +
-      "ler.mdsal.NormalizedNodeXml\"\022\n\020DataChang" +
-      "edReplyBd\nForg.opendaylight.controller.p" +
-      "rotobuff.messages.datachange.notificatio" +
-      "nB\032DataChangeListenerMessages"
+      "ight.controller.mdsal\032\014Common.proto\"\241\003\n\013" +
+      "DataChanged\022@\n\017originalSubTree\030\001 \001(\0132\'.o" +
+      "rg.opendaylight.controller.mdsal.Node\022?\n" +
+      "\016updatedSubTree\030\002 \001(\0132\'.org.opendaylight" +
+      ".controller.mdsal.Node\022@\n\014originalData\030\003" +
+      " \001(\0132*.org.opendaylight.controller.mdsal" +
+      ".NodeMap\022?\n\013updatedData\030\004 \001(\0132*.org.open" +
+      "daylight.controller.mdsal.NodeMap\022?\n\013cre" +
+      "atedData\030\005 \001(\0132*.org.opendaylight.contro",
+      "ller.mdsal.NodeMap\022K\n\014removedPaths\030\006 \003(\013" +
+      "25.org.opendaylight.controller.mdsal.Ins" +
+      "tanceIdentifier\"\022\n\020DataChangedReplyBd\nFo" +
+      "rg.opendaylight.controller.protobuff.mes" +
+      "sages.datachange.notificationB\032DataChang" +
+      "eListenerMessages"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -1064,7 +2072,7 @@ public final class DataChangeListenerMessages {
           internal_static_org_opendaylight_controller_mdsal_DataChanged_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_org_opendaylight_controller_mdsal_DataChanged_descriptor,
-              new java.lang.String[] { "InstanceIdentifierPathArguments", "NormalizedNodeXml", });
+              new java.lang.String[] { "OriginalSubTree", "UpdatedSubTree", "OriginalData", "UpdatedData", "CreatedData", "RemovedPaths", });
           internal_static_org_opendaylight_controller_mdsal_DataChangedReply_descriptor =
             getDescriptor().getMessageTypes().get(1);
           internal_static_org_opendaylight_controller_mdsal_DataChangedReply_fieldAccessorTable = new
@@ -1077,7 +2085,7 @@ public final class DataChangeListenerMessages {
     com.google.protobuf.Descriptors.FileDescriptor
       .internalBuildGeneratedFileFrom(descriptorData,
         new com.google.protobuf.Descriptors.FileDescriptor[] {
-          org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.getDescriptor(),
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.getDescriptor(),
         }, assigner);
   }
 
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/persistent/PersistentMessages.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/persistent/PersistentMessages.java
new file mode 100644 (file)
index 0000000..eaa9001
--- /dev/null
@@ -0,0 +1,1648 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: Persistent.proto
+
+package org.opendaylight.controller.protobuff.messages.persistent;
+
+public final class PersistentMessages {
+  private PersistentMessages() {}
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistry registry) {
+  }
+  public interface ModificationOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required string type = 1;
+    /**
+     * <code>required string type = 1;</code>
+     */
+    boolean hasType();
+    /**
+     * <code>required string type = 1;</code>
+     */
+    java.lang.String getType();
+    /**
+     * <code>required string type = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getTypeBytes();
+
+    // required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+     */
+    boolean hasPath();
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getPath();
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getPathOrBuilder();
+
+    // optional .org.opendaylight.controller.mdsal.Node data = 3;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+     */
+    boolean hasData();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getData();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getDataOrBuilder();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.Modification}
+   */
+  public static final class Modification extends
+      com.google.protobuf.GeneratedMessage
+      implements ModificationOrBuilder {
+    // Use Modification.newBuilder() to construct.
+    private Modification(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private Modification(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final Modification defaultInstance;
+    public static Modification getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public Modification getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private Modification(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              bitField0_ |= 0x00000001;
+              type_ = input.readBytes();
+              break;
+            }
+            case 18: {
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000002) == 0x00000002)) {
+                subBuilder = path_.toBuilder();
+              }
+              path_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(path_);
+                path_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000002;
+              break;
+            }
+            case 26: {
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000004) == 0x00000004)) {
+                subBuilder = data_.toBuilder();
+              }
+              data_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(data_);
+                data_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000004;
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_Modification_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_Modification_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.class, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<Modification> PARSER =
+        new com.google.protobuf.AbstractParser<Modification>() {
+      public Modification parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new Modification(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<Modification> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required string type = 1;
+    public static final int TYPE_FIELD_NUMBER = 1;
+    private java.lang.Object type_;
+    /**
+     * <code>required string type = 1;</code>
+     */
+    public boolean hasType() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required string type = 1;</code>
+     */
+    public java.lang.String getType() {
+      java.lang.Object ref = type_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          type_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string type = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getTypeBytes() {
+      java.lang.Object ref = type_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        type_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;
+    public static final int PATH_FIELD_NUMBER = 2;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier path_;
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+     */
+    public boolean hasPath() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getPath() {
+      return path_;
+    }
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getPathOrBuilder() {
+      return path_;
+    }
+
+    // optional .org.opendaylight.controller.mdsal.Node data = 3;
+    public static final int DATA_FIELD_NUMBER = 3;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node data_;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+     */
+    public boolean hasData() {
+      return ((bitField0_ & 0x00000004) == 0x00000004);
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getData() {
+      return data_;
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getDataOrBuilder() {
+      return data_;
+    }
+
+    private void initFields() {
+      type_ = "";
+      path_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+      data_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasType()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (!hasPath()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (!getPath().isInitialized()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (hasData()) {
+        if (!getData().isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeBytes(1, getTypeBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeMessage(2, path_);
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        output.writeMessage(3, data_);
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(1, getTypeBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(2, path_);
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(3, data_);
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.Modification}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_Modification_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_Modification_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.class, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getPathFieldBuilder();
+          getDataFieldBuilder();
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        type_ = "";
+        bitField0_ = (bitField0_ & ~0x00000001);
+        if (pathBuilder_ == null) {
+          path_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+        } else {
+          pathBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000002);
+        if (dataBuilder_ == null) {
+          data_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+        } else {
+          dataBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000004);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_Modification_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification build() {
+        org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification buildPartial() {
+        org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification result = new org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.type_ = type_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        if (pathBuilder_ == null) {
+          result.path_ = path_;
+        } else {
+          result.path_ = pathBuilder_.build();
+        }
+        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+          to_bitField0_ |= 0x00000004;
+        }
+        if (dataBuilder_ == null) {
+          result.data_ = data_;
+        } else {
+          result.data_ = dataBuilder_.build();
+        }
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification other) {
+        if (other == org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.getDefaultInstance()) return this;
+        if (other.hasType()) {
+          bitField0_ |= 0x00000001;
+          type_ = other.type_;
+          onChanged();
+        }
+        if (other.hasPath()) {
+          mergePath(other.getPath());
+        }
+        if (other.hasData()) {
+          mergeData(other.getData());
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasType()) {
+          
+          return false;
+        }
+        if (!hasPath()) {
+          
+          return false;
+        }
+        if (!getPath().isInitialized()) {
+          
+          return false;
+        }
+        if (hasData()) {
+          if (!getData().isInitialized()) {
+            
+            return false;
+          }
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required string type = 1;
+      private java.lang.Object type_ = "";
+      /**
+       * <code>required string type = 1;</code>
+       */
+      public boolean hasType() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required string type = 1;</code>
+       */
+      public java.lang.String getType() {
+        java.lang.Object ref = type_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          type_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string type = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getTypeBytes() {
+        java.lang.Object ref = type_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          type_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string type = 1;</code>
+       */
+      public Builder setType(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        type_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string type = 1;</code>
+       */
+      public Builder clearType() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        type_ = getDefaultInstance().getType();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string type = 1;</code>
+       */
+      public Builder setTypeBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        type_ = value;
+        onChanged();
+        return this;
+      }
+
+      // required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier path_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> pathBuilder_;
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+       */
+      public boolean hasPath() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getPath() {
+        if (pathBuilder_ == null) {
+          return path_;
+        } else {
+          return pathBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+       */
+      public Builder setPath(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (pathBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          path_ = value;
+          onChanged();
+        } else {
+          pathBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000002;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+       */
+      public Builder setPath(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+        if (pathBuilder_ == null) {
+          path_ = builderForValue.build();
+          onChanged();
+        } else {
+          pathBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000002;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+       */
+      public Builder mergePath(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (pathBuilder_ == null) {
+          if (((bitField0_ & 0x00000002) == 0x00000002) &&
+              path_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+            path_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(path_).mergeFrom(value).buildPartial();
+          } else {
+            path_ = value;
+          }
+          onChanged();
+        } else {
+          pathBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000002;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+       */
+      public Builder clearPath() {
+        if (pathBuilder_ == null) {
+          path_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+          onChanged();
+        } else {
+          pathBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000002);
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getPathBuilder() {
+        bitField0_ |= 0x00000002;
+        onChanged();
+        return getPathFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getPathOrBuilder() {
+        if (pathBuilder_ != null) {
+          return pathBuilder_.getMessageOrBuilder();
+        } else {
+          return path_;
+        }
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> 
+          getPathFieldBuilder() {
+        if (pathBuilder_ == null) {
+          pathBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+                  path_,
+                  getParentForChildren(),
+                  isClean());
+          path_ = null;
+        }
+        return pathBuilder_;
+      }
+
+      // optional .org.opendaylight.controller.mdsal.Node data = 3;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node data_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> dataBuilder_;
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+       */
+      public boolean hasData() {
+        return ((bitField0_ & 0x00000004) == 0x00000004);
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getData() {
+        if (dataBuilder_ == null) {
+          return data_;
+        } else {
+          return dataBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+       */
+      public Builder setData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+        if (dataBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          data_ = value;
+          onChanged();
+        } else {
+          dataBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000004;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+       */
+      public Builder setData(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
+        if (dataBuilder_ == null) {
+          data_ = builderForValue.build();
+          onChanged();
+        } else {
+          dataBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000004;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+       */
+      public Builder mergeData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+        if (dataBuilder_ == null) {
+          if (((bitField0_ & 0x00000004) == 0x00000004) &&
+              data_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) {
+            data_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(data_).mergeFrom(value).buildPartial();
+          } else {
+            data_ = value;
+          }
+          onChanged();
+        } else {
+          dataBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000004;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+       */
+      public Builder clearData() {
+        if (dataBuilder_ == null) {
+          data_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+          onChanged();
+        } else {
+          dataBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000004);
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getDataBuilder() {
+        bitField0_ |= 0x00000004;
+        onChanged();
+        return getDataFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getDataOrBuilder() {
+        if (dataBuilder_ != null) {
+          return dataBuilder_.getMessageOrBuilder();
+        } else {
+          return data_;
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> 
+          getDataFieldBuilder() {
+        if (dataBuilder_ == null) {
+          dataBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
+                  data_,
+                  getParentForChildren(),
+                  isClean());
+          data_ = null;
+        }
+        return dataBuilder_;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.Modification)
+    }
+
+    static {
+      defaultInstance = new Modification(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.Modification)
+  }
+
+  public interface CompositeModificationOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // repeated .org.opendaylight.controller.mdsal.Modification modification = 1;
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+     */
+    java.util.List<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification> 
+        getModificationList();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification getModification(int index);
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+     */
+    int getModificationCount();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+     */
+    java.util.List<? extends org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder> 
+        getModificationOrBuilderList();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder getModificationOrBuilder(
+        int index);
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.CompositeModification}
+   */
+  public static final class CompositeModification extends
+      com.google.protobuf.GeneratedMessage
+      implements CompositeModificationOrBuilder {
+    // Use CompositeModification.newBuilder() to construct.
+    private CompositeModification(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private CompositeModification(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final CompositeModification defaultInstance;
+    public static CompositeModification getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public CompositeModification getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private CompositeModification(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+                modification_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification>();
+                mutable_bitField0_ |= 0x00000001;
+              }
+              modification_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.PARSER, extensionRegistry));
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+          modification_ = java.util.Collections.unmodifiableList(modification_);
+        }
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_CompositeModification_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_CompositeModification_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.class, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<CompositeModification> PARSER =
+        new com.google.protobuf.AbstractParser<CompositeModification>() {
+      public CompositeModification parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new CompositeModification(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<CompositeModification> getParserForType() {
+      return PARSER;
+    }
+
+    // repeated .org.opendaylight.controller.mdsal.Modification modification = 1;
+    public static final int MODIFICATION_FIELD_NUMBER = 1;
+    private java.util.List<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification> modification_;
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+     */
+    public java.util.List<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification> getModificationList() {
+      return modification_;
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+     */
+    public java.util.List<? extends org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder> 
+        getModificationOrBuilderList() {
+      return modification_;
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+     */
+    public int getModificationCount() {
+      return modification_.size();
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification getModification(int index) {
+      return modification_.get(index);
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder getModificationOrBuilder(
+        int index) {
+      return modification_.get(index);
+    }
+
+    private void initFields() {
+      modification_ = java.util.Collections.emptyList();
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      for (int i = 0; i < getModificationCount(); i++) {
+        if (!getModification(i).isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      for (int i = 0; i < modification_.size(); i++) {
+        output.writeMessage(1, modification_.get(i));
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      for (int i = 0; i < modification_.size(); i++) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(1, modification_.get(i));
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.CompositeModification}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModificationOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_CompositeModification_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_CompositeModification_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.class, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getModificationFieldBuilder();
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        if (modificationBuilder_ == null) {
+          modification_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000001);
+        } else {
+          modificationBuilder_.clear();
+        }
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_CompositeModification_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification build() {
+        org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification buildPartial() {
+        org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification result = new org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification(this);
+        int from_bitField0_ = bitField0_;
+        if (modificationBuilder_ == null) {
+          if (((bitField0_ & 0x00000001) == 0x00000001)) {
+            modification_ = java.util.Collections.unmodifiableList(modification_);
+            bitField0_ = (bitField0_ & ~0x00000001);
+          }
+          result.modification_ = modification_;
+        } else {
+          result.modification_ = modificationBuilder_.build();
+        }
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification other) {
+        if (other == org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.getDefaultInstance()) return this;
+        if (modificationBuilder_ == null) {
+          if (!other.modification_.isEmpty()) {
+            if (modification_.isEmpty()) {
+              modification_ = other.modification_;
+              bitField0_ = (bitField0_ & ~0x00000001);
+            } else {
+              ensureModificationIsMutable();
+              modification_.addAll(other.modification_);
+            }
+            onChanged();
+          }
+        } else {
+          if (!other.modification_.isEmpty()) {
+            if (modificationBuilder_.isEmpty()) {
+              modificationBuilder_.dispose();
+              modificationBuilder_ = null;
+              modification_ = other.modification_;
+              bitField0_ = (bitField0_ & ~0x00000001);
+              modificationBuilder_ = 
+                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+                   getModificationFieldBuilder() : null;
+            } else {
+              modificationBuilder_.addAllMessages(other.modification_);
+            }
+          }
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        for (int i = 0; i < getModificationCount(); i++) {
+          if (!getModification(i).isInitialized()) {
+            
+            return false;
+          }
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // repeated .org.opendaylight.controller.mdsal.Modification modification = 1;
+      private java.util.List<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification> modification_ =
+        java.util.Collections.emptyList();
+      private void ensureModificationIsMutable() {
+        if (!((bitField0_ & 0x00000001) == 0x00000001)) {
+          modification_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification>(modification_);
+          bitField0_ |= 0x00000001;
+         }
+      }
+
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder> modificationBuilder_;
+
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+       */
+      public java.util.List<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification> getModificationList() {
+        if (modificationBuilder_ == null) {
+          return java.util.Collections.unmodifiableList(modification_);
+        } else {
+          return modificationBuilder_.getMessageList();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+       */
+      public int getModificationCount() {
+        if (modificationBuilder_ == null) {
+          return modification_.size();
+        } else {
+          return modificationBuilder_.getCount();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification getModification(int index) {
+        if (modificationBuilder_ == null) {
+          return modification_.get(index);
+        } else {
+          return modificationBuilder_.getMessage(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+       */
+      public Builder setModification(
+          int index, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification value) {
+        if (modificationBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureModificationIsMutable();
+          modification_.set(index, value);
+          onChanged();
+        } else {
+          modificationBuilder_.setMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+       */
+      public Builder setModification(
+          int index, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder builderForValue) {
+        if (modificationBuilder_ == null) {
+          ensureModificationIsMutable();
+          modification_.set(index, builderForValue.build());
+          onChanged();
+        } else {
+          modificationBuilder_.setMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+       */
+      public Builder addModification(org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification value) {
+        if (modificationBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureModificationIsMutable();
+          modification_.add(value);
+          onChanged();
+        } else {
+          modificationBuilder_.addMessage(value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+       */
+      public Builder addModification(
+          int index, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification value) {
+        if (modificationBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureModificationIsMutable();
+          modification_.add(index, value);
+          onChanged();
+        } else {
+          modificationBuilder_.addMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+       */
+      public Builder addModification(
+          org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder builderForValue) {
+        if (modificationBuilder_ == null) {
+          ensureModificationIsMutable();
+          modification_.add(builderForValue.build());
+          onChanged();
+        } else {
+          modificationBuilder_.addMessage(builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+       */
+      public Builder addModification(
+          int index, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder builderForValue) {
+        if (modificationBuilder_ == null) {
+          ensureModificationIsMutable();
+          modification_.add(index, builderForValue.build());
+          onChanged();
+        } else {
+          modificationBuilder_.addMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+       */
+      public Builder addAllModification(
+          java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification> values) {
+        if (modificationBuilder_ == null) {
+          ensureModificationIsMutable();
+          super.addAll(values, modification_);
+          onChanged();
+        } else {
+          modificationBuilder_.addAllMessages(values);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+       */
+      public Builder clearModification() {
+        if (modificationBuilder_ == null) {
+          modification_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000001);
+          onChanged();
+        } else {
+          modificationBuilder_.clear();
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+       */
+      public Builder removeModification(int index) {
+        if (modificationBuilder_ == null) {
+          ensureModificationIsMutable();
+          modification_.remove(index);
+          onChanged();
+        } else {
+          modificationBuilder_.remove(index);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder getModificationBuilder(
+          int index) {
+        return getModificationFieldBuilder().getBuilder(index);
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder getModificationOrBuilder(
+          int index) {
+        if (modificationBuilder_ == null) {
+          return modification_.get(index);  } else {
+          return modificationBuilder_.getMessageOrBuilder(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+       */
+      public java.util.List<? extends org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder> 
+           getModificationOrBuilderList() {
+        if (modificationBuilder_ != null) {
+          return modificationBuilder_.getMessageOrBuilderList();
+        } else {
+          return java.util.Collections.unmodifiableList(modification_);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder addModificationBuilder() {
+        return getModificationFieldBuilder().addBuilder(
+            org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder addModificationBuilder(
+          int index) {
+        return getModificationFieldBuilder().addBuilder(
+            index, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
+       */
+      public java.util.List<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder> 
+           getModificationBuilderList() {
+        return getModificationFieldBuilder().getBuilderList();
+      }
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder> 
+          getModificationFieldBuilder() {
+        if (modificationBuilder_ == null) {
+          modificationBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder>(
+                  modification_,
+                  ((bitField0_ & 0x00000001) == 0x00000001),
+                  getParentForChildren(),
+                  isClean());
+          modification_ = null;
+        }
+        return modificationBuilder_;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CompositeModification)
+    }
+
+    static {
+      defaultInstance = new CompositeModification(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CompositeModification)
+  }
+
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_Modification_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_Modification_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_CompositeModification_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_CompositeModification_fieldAccessorTable;
+
+  public static com.google.protobuf.Descriptors.FileDescriptor
+      getDescriptor() {
+    return descriptor;
+  }
+  private static com.google.protobuf.Descriptors.FileDescriptor
+      descriptor;
+  static {
+    java.lang.String[] descriptorData = {
+      "\n\020Persistent.proto\022!org.opendaylight.con" +
+      "troller.mdsal\032\014Common.proto\032\033AppendEntri" +
+      "esMessages.proto\"\230\001\n\014Modification\022\014\n\004typ" +
+      "e\030\001 \002(\t\022C\n\004path\030\002 \002(\01325.org.opendaylight" +
+      ".controller.mdsal.InstanceIdentifier\0225\n\004" +
+      "data\030\003 \001(\0132\'.org.opendaylight.controller" +
+      ".mdsal.Node\"^\n\025CompositeModification\022E\n\014" +
+      "modification\030\001 \003(\0132/.org.opendaylight.co" +
+      "ntroller.mdsal.ModificationBO\n9org.opend" +
+      "aylight.controller.protobuff.messages.pe",
+      "rsistentB\022PersistentMessages"
+    };
+    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
+      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+        public com.google.protobuf.ExtensionRegistry assignDescriptors(
+            com.google.protobuf.Descriptors.FileDescriptor root) {
+          descriptor = root;
+          internal_static_org_opendaylight_controller_mdsal_Modification_descriptor =
+            getDescriptor().getMessageTypes().get(0);
+          internal_static_org_opendaylight_controller_mdsal_Modification_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_Modification_descriptor,
+              new java.lang.String[] { "Type", "Path", "Data", });
+          internal_static_org_opendaylight_controller_mdsal_CompositeModification_descriptor =
+            getDescriptor().getMessageTypes().get(1);
+          internal_static_org_opendaylight_controller_mdsal_CompositeModification_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_CompositeModification_descriptor,
+              new java.lang.String[] { "Modification", });
+          return null;
+        }
+      };
+    com.google.protobuf.Descriptors.FileDescriptor
+      .internalBuildGeneratedFileFrom(descriptorData,
+        new com.google.protobuf.Descriptors.FileDescriptor[] {
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.getDescriptor(),
+          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.getDescriptor(),
+        }, assigner);
+  }
+
+  // @@protoc_insertion_point(outer_class_scope)
+}
index a1906b8ba534f02dd5d9dc840aa3510554a94974..e06dd0d42982d779b8aa40931338b88c528d6069 100644 (file)
@@ -8,28 +8,32 @@ public final class ListenerRegistrationMessages {
   public static void registerAllExtensions(
       com.google.protobuf.ExtensionRegistry registry) {
   }
-  public interface CloseOrBuilder
+  public interface CloseDataChangeListenerRegistrationOrBuilder
       extends com.google.protobuf.MessageOrBuilder {
   }
   /**
-   * Protobuf type {@code org.opendaylight.controller.mdsal.Close}
+   * Protobuf type {@code org.opendaylight.controller.mdsal.CloseDataChangeListenerRegistration}
+   *
+   * <pre>
+   ** used when a listener needs to be unregistered
+   * </pre>
    */
-  public static final class Close extends
+  public static final class CloseDataChangeListenerRegistration extends
       com.google.protobuf.GeneratedMessage
-      implements CloseOrBuilder {
-    // Use Close.newBuilder() to construct.
-    private Close(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      implements CloseDataChangeListenerRegistrationOrBuilder {
+    // Use CloseDataChangeListenerRegistration.newBuilder() to construct.
+    private CloseDataChangeListenerRegistration(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
       this.unknownFields = builder.getUnknownFields();
     }
-    private Close(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+    private CloseDataChangeListenerRegistration(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
 
-    private static final Close defaultInstance;
-    public static Close getDefaultInstance() {
+    private static final CloseDataChangeListenerRegistration defaultInstance;
+    public static CloseDataChangeListenerRegistration getDefaultInstance() {
       return defaultInstance;
     }
 
-    public Close getDefaultInstanceForType() {
+    public CloseDataChangeListenerRegistration getDefaultInstanceForType() {
       return defaultInstance;
     }
 
@@ -39,7 +43,7 @@ public final class ListenerRegistrationMessages {
         getUnknownFields() {
       return this.unknownFields;
     }
-    private Close(
+    private CloseDataChangeListenerRegistration(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
@@ -75,28 +79,28 @@ public final class ListenerRegistrationMessages {
     }
     public static final com.google.protobuf.Descriptors.Descriptor
         getDescriptor() {
-      return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_descriptor;
+      return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_descriptor;
     }
 
     protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
         internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_fieldAccessorTable
+      return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_fieldAccessorTable
           .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.Builder.class);
+              org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration.Builder.class);
     }
 
-    public static com.google.protobuf.Parser<Close> PARSER =
-        new com.google.protobuf.AbstractParser<Close>() {
-      public Close parsePartialFrom(
+    public static com.google.protobuf.Parser<CloseDataChangeListenerRegistration> PARSER =
+        new com.google.protobuf.AbstractParser<CloseDataChangeListenerRegistration>() {
+      public CloseDataChangeListenerRegistration parsePartialFrom(
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws com.google.protobuf.InvalidProtocolBufferException {
-        return new Close(input, extensionRegistry);
+        return new CloseDataChangeListenerRegistration(input, extensionRegistry);
       }
     };
 
     @java.lang.Override
-    public com.google.protobuf.Parser<Close> getParserForType() {
+    public com.google.protobuf.Parser<CloseDataChangeListenerRegistration> getParserForType() {
       return PARSER;
     }
 
@@ -135,53 +139,53 @@ public final class ListenerRegistrationMessages {
       return super.writeReplace();
     }
 
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseFrom(
         com.google.protobuf.ByteString data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseFrom(
         com.google.protobuf.ByteString data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data, extensionRegistry);
     }
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(byte[] data)
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseFrom(byte[] data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseFrom(
         byte[] data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data, extensionRegistry);
     }
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseFrom(
         java.io.InputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
       return PARSER.parseFrom(input, extensionRegistry);
     }
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseDelimitedFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseDelimitedFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseDelimitedFrom(input);
     }
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseDelimitedFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseDelimitedFrom(
         java.io.InputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
       return PARSER.parseDelimitedFrom(input, extensionRegistry);
     }
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseFrom(
         com.google.protobuf.CodedInputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parseFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
@@ -190,7 +194,7 @@ public final class ListenerRegistrationMessages {
 
     public static Builder newBuilder() { return Builder.create(); }
     public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close prototype) {
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration prototype) {
       return newBuilder().mergeFrom(prototype);
     }
     public Builder toBuilder() { return newBuilder(this); }
@@ -202,24 +206,28 @@ public final class ListenerRegistrationMessages {
       return builder;
     }
     /**
-     * Protobuf type {@code org.opendaylight.controller.mdsal.Close}
+     * Protobuf type {@code org.opendaylight.controller.mdsal.CloseDataChangeListenerRegistration}
+     *
+     * <pre>
+     ** used when a listener needs to be unregistered
+     * </pre>
      */
     public static final class Builder extends
         com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseOrBuilder {
+       implements org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
-        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_descriptor;
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_descriptor;
       }
 
       protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
           internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_fieldAccessorTable
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_fieldAccessorTable
             .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.Builder.class);
+                org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration.Builder.class);
       }
 
-      // Construct using org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.newBuilder()
+      // Construct using org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration.newBuilder()
       private Builder() {
         maybeForceBuilderInitialization();
       }
@@ -248,38 +256,38 @@ public final class ListenerRegistrationMessages {
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
-        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_descriptor;
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_descriptor;
       }
 
-      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close getDefaultInstanceForType() {
-        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.getDefaultInstance();
+      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration.getDefaultInstance();
       }
 
-      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close build() {
-        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close result = buildPartial();
+      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration build() {
+        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration result = buildPartial();
         if (!result.isInitialized()) {
           throw newUninitializedMessageException(result);
         }
         return result;
       }
 
-      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close buildPartial() {
-        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close result = new org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close(this);
+      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration buildPartial() {
+        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration result = new org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration(this);
         onBuilt();
         return result;
       }
 
       public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close) {
-          return mergeFrom((org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close)other);
+        if (other instanceof org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration)other);
         } else {
           super.mergeFrom(other);
           return this;
         }
       }
 
-      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close other) {
-        if (other == org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.getDefaultInstance()) return this;
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration other) {
+        if (other == org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration.getDefaultInstance()) return this;
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
@@ -292,11 +300,11 @@ public final class ListenerRegistrationMessages {
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
-        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parsedMessage = null;
+        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration parsedMessage = null;
         try {
           parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
         } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close) e.getUnfinishedMessage();
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistration) e.getUnfinishedMessage();
           throw e;
         } finally {
           if (parsedMessage != null) {
@@ -306,39 +314,43 @@ public final class ListenerRegistrationMessages {
         return this;
       }
 
-      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.Close)
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CloseDataChangeListenerRegistration)
     }
 
     static {
-      defaultInstance = new Close(true);
+      defaultInstance = new CloseDataChangeListenerRegistration(true);
       defaultInstance.initFields();
     }
 
-    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.Close)
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CloseDataChangeListenerRegistration)
   }
 
-  public interface CloseReplyOrBuilder
+  public interface CloseDataChangeListenerRegistrationReplyOrBuilder
       extends com.google.protobuf.MessageOrBuilder {
   }
   /**
-   * Protobuf type {@code org.opendaylight.controller.mdsal.CloseReply}
+   * Protobuf type {@code org.opendaylight.controller.mdsal.CloseDataChangeListenerRegistrationReply}
+   *
+   * <pre>
+   ** reply to the CloseDataChangeListenerRegistration request
+   * </pre>
    */
-  public static final class CloseReply extends
+  public static final class CloseDataChangeListenerRegistrationReply extends
       com.google.protobuf.GeneratedMessage
-      implements CloseReplyOrBuilder {
-    // Use CloseReply.newBuilder() to construct.
-    private CloseReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      implements CloseDataChangeListenerRegistrationReplyOrBuilder {
+    // Use CloseDataChangeListenerRegistrationReply.newBuilder() to construct.
+    private CloseDataChangeListenerRegistrationReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
       this.unknownFields = builder.getUnknownFields();
     }
-    private CloseReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+    private CloseDataChangeListenerRegistrationReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
 
-    private static final CloseReply defaultInstance;
-    public static CloseReply getDefaultInstance() {
+    private static final CloseDataChangeListenerRegistrationReply defaultInstance;
+    public static CloseDataChangeListenerRegistrationReply getDefaultInstance() {
       return defaultInstance;
     }
 
-    public CloseReply getDefaultInstanceForType() {
+    public CloseDataChangeListenerRegistrationReply getDefaultInstanceForType() {
       return defaultInstance;
     }
 
@@ -348,7 +360,7 @@ public final class ListenerRegistrationMessages {
         getUnknownFields() {
       return this.unknownFields;
     }
-    private CloseReply(
+    private CloseDataChangeListenerRegistrationReply(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
@@ -384,28 +396,28 @@ public final class ListenerRegistrationMessages {
     }
     public static final com.google.protobuf.Descriptors.Descriptor
         getDescriptor() {
-      return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor;
+      return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_descriptor;
     }
 
     protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
         internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_fieldAccessorTable
+      return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_fieldAccessorTable
           .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.Builder.class);
+              org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.Builder.class);
     }
 
-    public static com.google.protobuf.Parser<CloseReply> PARSER =
-        new com.google.protobuf.AbstractParser<CloseReply>() {
-      public CloseReply parsePartialFrom(
+    public static com.google.protobuf.Parser<CloseDataChangeListenerRegistrationReply> PARSER =
+        new com.google.protobuf.AbstractParser<CloseDataChangeListenerRegistrationReply>() {
+      public CloseDataChangeListenerRegistrationReply parsePartialFrom(
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws com.google.protobuf.InvalidProtocolBufferException {
-        return new CloseReply(input, extensionRegistry);
+        return new CloseDataChangeListenerRegistrationReply(input, extensionRegistry);
       }
     };
 
     @java.lang.Override
-    public com.google.protobuf.Parser<CloseReply> getParserForType() {
+    public com.google.protobuf.Parser<CloseDataChangeListenerRegistrationReply> getParserForType() {
       return PARSER;
     }
 
@@ -444,53 +456,53 @@ public final class ListenerRegistrationMessages {
       return super.writeReplace();
     }
 
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseFrom(
         com.google.protobuf.ByteString data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseFrom(
         com.google.protobuf.ByteString data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data, extensionRegistry);
     }
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(byte[] data)
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseFrom(byte[] data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseFrom(
         byte[] data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data, extensionRegistry);
     }
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseFrom(
         java.io.InputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
       return PARSER.parseFrom(input, extensionRegistry);
     }
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseDelimitedFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseDelimitedFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseDelimitedFrom(input);
     }
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseDelimitedFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseDelimitedFrom(
         java.io.InputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
       return PARSER.parseDelimitedFrom(input, extensionRegistry);
     }
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseFrom(
         com.google.protobuf.CodedInputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parseFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
@@ -499,7 +511,7 @@ public final class ListenerRegistrationMessages {
 
     public static Builder newBuilder() { return Builder.create(); }
     public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply prototype) {
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply prototype) {
       return newBuilder().mergeFrom(prototype);
     }
     public Builder toBuilder() { return newBuilder(this); }
@@ -511,24 +523,28 @@ public final class ListenerRegistrationMessages {
       return builder;
     }
     /**
-     * Protobuf type {@code org.opendaylight.controller.mdsal.CloseReply}
+     * Protobuf type {@code org.opendaylight.controller.mdsal.CloseDataChangeListenerRegistrationReply}
+     *
+     * <pre>
+     ** reply to the CloseDataChangeListenerRegistration request
+     * </pre>
      */
     public static final class Builder extends
         com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReplyOrBuilder {
+       implements org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReplyOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
-        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor;
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_descriptor;
       }
 
       protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
           internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_fieldAccessorTable
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_fieldAccessorTable
             .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.Builder.class);
+                org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.Builder.class);
       }
 
-      // Construct using org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.newBuilder()
+      // Construct using org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.newBuilder()
       private Builder() {
         maybeForceBuilderInitialization();
       }
@@ -557,38 +573,38 @@ public final class ListenerRegistrationMessages {
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
-        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor;
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_descriptor;
       }
 
-      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply getDefaultInstanceForType() {
-        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.getDefaultInstance();
+      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.getDefaultInstance();
       }
 
-      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply build() {
-        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply result = buildPartial();
+      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply build() {
+        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply result = buildPartial();
         if (!result.isInitialized()) {
           throw newUninitializedMessageException(result);
         }
         return result;
       }
 
-      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply buildPartial() {
-        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply result = new org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply(this);
+      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply buildPartial() {
+        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply result = new org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply(this);
         onBuilt();
         return result;
       }
 
       public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply) {
-          return mergeFrom((org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply)other);
+        if (other instanceof org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply)other);
         } else {
           super.mergeFrom(other);
           return this;
         }
       }
 
-      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply other) {
-        if (other == org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.getDefaultInstance()) return this;
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply other) {
+        if (other == org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.getDefaultInstance()) return this;
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
@@ -601,11 +617,11 @@ public final class ListenerRegistrationMessages {
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
-        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parsedMessage = null;
+        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply parsedMessage = null;
         try {
           parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
         } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply) e.getUnfinishedMessage();
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply) e.getUnfinishedMessage();
           throw e;
         } finally {
           if (parsedMessage != null) {
@@ -615,27 +631,1306 @@ public final class ListenerRegistrationMessages {
         return this;
       }
 
-      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CloseReply)
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CloseDataChangeListenerRegistrationReply)
     }
 
     static {
-      defaultInstance = new CloseReply(true);
+      defaultInstance = new CloseDataChangeListenerRegistrationReply(true);
       defaultInstance.initFields();
     }
 
-    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CloseReply)
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CloseDataChangeListenerRegistrationReply)
+  }
+
+  public interface RegisterChangeListenerOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+     */
+    boolean hasInstanceIdentifierPath();
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPath();
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathOrBuilder();
+
+    // required string dataChangeListenerActorPath = 2;
+    /**
+     * <code>required string dataChangeListenerActorPath = 2;</code>
+     */
+    boolean hasDataChangeListenerActorPath();
+    /**
+     * <code>required string dataChangeListenerActorPath = 2;</code>
+     */
+    java.lang.String getDataChangeListenerActorPath();
+    /**
+     * <code>required string dataChangeListenerActorPath = 2;</code>
+     */
+    com.google.protobuf.ByteString
+        getDataChangeListenerActorPathBytes();
+
+    // required int32 dataChangeScope = 3;
+    /**
+     * <code>required int32 dataChangeScope = 3;</code>
+     */
+    boolean hasDataChangeScope();
+    /**
+     * <code>required int32 dataChangeScope = 3;</code>
+     */
+    int getDataChangeScope();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.RegisterChangeListener}
+   */
+  public static final class RegisterChangeListener extends
+      com.google.protobuf.GeneratedMessage
+      implements RegisterChangeListenerOrBuilder {
+    // Use RegisterChangeListener.newBuilder() to construct.
+    private RegisterChangeListener(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private RegisterChangeListener(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final RegisterChangeListener defaultInstance;
+    public static RegisterChangeListener getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public RegisterChangeListener getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private RegisterChangeListener(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000001) == 0x00000001)) {
+                subBuilder = instanceIdentifierPath_.toBuilder();
+              }
+              instanceIdentifierPath_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(instanceIdentifierPath_);
+                instanceIdentifierPath_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000001;
+              break;
+            }
+            case 18: {
+              bitField0_ |= 0x00000002;
+              dataChangeListenerActorPath_ = input.readBytes();
+              break;
+            }
+            case 24: {
+              bitField0_ |= 0x00000004;
+              dataChangeScope_ = input.readInt32();
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<RegisterChangeListener> PARSER =
+        new com.google.protobuf.AbstractParser<RegisterChangeListener>() {
+      public RegisterChangeListener parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new RegisterChangeListener(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<RegisterChangeListener> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;
+    public static final int INSTANCEIDENTIFIERPATH_FIELD_NUMBER = 1;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPath_;
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+     */
+    public boolean hasInstanceIdentifierPath() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPath() {
+      return instanceIdentifierPath_;
+    }
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathOrBuilder() {
+      return instanceIdentifierPath_;
+    }
+
+    // required string dataChangeListenerActorPath = 2;
+    public static final int DATACHANGELISTENERACTORPATH_FIELD_NUMBER = 2;
+    private java.lang.Object dataChangeListenerActorPath_;
+    /**
+     * <code>required string dataChangeListenerActorPath = 2;</code>
+     */
+    public boolean hasDataChangeListenerActorPath() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>required string dataChangeListenerActorPath = 2;</code>
+     */
+    public java.lang.String getDataChangeListenerActorPath() {
+      java.lang.Object ref = dataChangeListenerActorPath_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          dataChangeListenerActorPath_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string dataChangeListenerActorPath = 2;</code>
+     */
+    public com.google.protobuf.ByteString
+        getDataChangeListenerActorPathBytes() {
+      java.lang.Object ref = dataChangeListenerActorPath_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        dataChangeListenerActorPath_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // required int32 dataChangeScope = 3;
+    public static final int DATACHANGESCOPE_FIELD_NUMBER = 3;
+    private int dataChangeScope_;
+    /**
+     * <code>required int32 dataChangeScope = 3;</code>
+     */
+    public boolean hasDataChangeScope() {
+      return ((bitField0_ & 0x00000004) == 0x00000004);
+    }
+    /**
+     * <code>required int32 dataChangeScope = 3;</code>
+     */
+    public int getDataChangeScope() {
+      return dataChangeScope_;
+    }
+
+    private void initFields() {
+      instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+      dataChangeListenerActorPath_ = "";
+      dataChangeScope_ = 0;
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasInstanceIdentifierPath()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (!hasDataChangeListenerActorPath()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (!hasDataChangeScope()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (!getInstanceIdentifierPath().isInitialized()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeMessage(1, instanceIdentifierPath_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeBytes(2, getDataChangeListenerActorPathBytes());
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        output.writeInt32(3, dataChangeScope_);
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(1, instanceIdentifierPath_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(2, getDataChangeListenerActorPathBytes());
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(3, dataChangeScope_);
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.RegisterChangeListener}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getInstanceIdentifierPathFieldBuilder();
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        if (instanceIdentifierPathBuilder_ == null) {
+          instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+        } else {
+          instanceIdentifierPathBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000001);
+        dataChangeListenerActorPath_ = "";
+        bitField0_ = (bitField0_ & ~0x00000002);
+        dataChangeScope_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000004);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener build() {
+        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener buildPartial() {
+        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener result = new org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        if (instanceIdentifierPathBuilder_ == null) {
+          result.instanceIdentifierPath_ = instanceIdentifierPath_;
+        } else {
+          result.instanceIdentifierPath_ = instanceIdentifierPathBuilder_.build();
+        }
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.dataChangeListenerActorPath_ = dataChangeListenerActorPath_;
+        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+          to_bitField0_ |= 0x00000004;
+        }
+        result.dataChangeScope_ = dataChangeScope_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener other) {
+        if (other == org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener.getDefaultInstance()) return this;
+        if (other.hasInstanceIdentifierPath()) {
+          mergeInstanceIdentifierPath(other.getInstanceIdentifierPath());
+        }
+        if (other.hasDataChangeListenerActorPath()) {
+          bitField0_ |= 0x00000002;
+          dataChangeListenerActorPath_ = other.dataChangeListenerActorPath_;
+          onChanged();
+        }
+        if (other.hasDataChangeScope()) {
+          setDataChangeScope(other.getDataChangeScope());
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasInstanceIdentifierPath()) {
+          
+          return false;
+        }
+        if (!hasDataChangeListenerActorPath()) {
+          
+          return false;
+        }
+        if (!hasDataChangeScope()) {
+          
+          return false;
+        }
+        if (!getInstanceIdentifierPath().isInitialized()) {
+          
+          return false;
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierPathBuilder_;
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+       */
+      public boolean hasInstanceIdentifierPath() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPath() {
+        if (instanceIdentifierPathBuilder_ == null) {
+          return instanceIdentifierPath_;
+        } else {
+          return instanceIdentifierPathBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+       */
+      public Builder setInstanceIdentifierPath(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (instanceIdentifierPathBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          instanceIdentifierPath_ = value;
+          onChanged();
+        } else {
+          instanceIdentifierPathBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000001;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+       */
+      public Builder setInstanceIdentifierPath(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+        if (instanceIdentifierPathBuilder_ == null) {
+          instanceIdentifierPath_ = builderForValue.build();
+          onChanged();
+        } else {
+          instanceIdentifierPathBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000001;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+       */
+      public Builder mergeInstanceIdentifierPath(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (instanceIdentifierPathBuilder_ == null) {
+          if (((bitField0_ & 0x00000001) == 0x00000001) &&
+              instanceIdentifierPath_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+            instanceIdentifierPath_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierPath_).mergeFrom(value).buildPartial();
+          } else {
+            instanceIdentifierPath_ = value;
+          }
+          onChanged();
+        } else {
+          instanceIdentifierPathBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000001;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+       */
+      public Builder clearInstanceIdentifierPath() {
+        if (instanceIdentifierPathBuilder_ == null) {
+          instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+          onChanged();
+        } else {
+          instanceIdentifierPathBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000001);
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierPathBuilder() {
+        bitField0_ |= 0x00000001;
+        onChanged();
+        return getInstanceIdentifierPathFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathOrBuilder() {
+        if (instanceIdentifierPathBuilder_ != null) {
+          return instanceIdentifierPathBuilder_.getMessageOrBuilder();
+        } else {
+          return instanceIdentifierPath_;
+        }
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> 
+          getInstanceIdentifierPathFieldBuilder() {
+        if (instanceIdentifierPathBuilder_ == null) {
+          instanceIdentifierPathBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+                  instanceIdentifierPath_,
+                  getParentForChildren(),
+                  isClean());
+          instanceIdentifierPath_ = null;
+        }
+        return instanceIdentifierPathBuilder_;
+      }
+
+      // required string dataChangeListenerActorPath = 2;
+      private java.lang.Object dataChangeListenerActorPath_ = "";
+      /**
+       * <code>required string dataChangeListenerActorPath = 2;</code>
+       */
+      public boolean hasDataChangeListenerActorPath() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>required string dataChangeListenerActorPath = 2;</code>
+       */
+      public java.lang.String getDataChangeListenerActorPath() {
+        java.lang.Object ref = dataChangeListenerActorPath_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          dataChangeListenerActorPath_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string dataChangeListenerActorPath = 2;</code>
+       */
+      public com.google.protobuf.ByteString
+          getDataChangeListenerActorPathBytes() {
+        java.lang.Object ref = dataChangeListenerActorPath_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          dataChangeListenerActorPath_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string dataChangeListenerActorPath = 2;</code>
+       */
+      public Builder setDataChangeListenerActorPath(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        dataChangeListenerActorPath_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string dataChangeListenerActorPath = 2;</code>
+       */
+      public Builder clearDataChangeListenerActorPath() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        dataChangeListenerActorPath_ = getDefaultInstance().getDataChangeListenerActorPath();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string dataChangeListenerActorPath = 2;</code>
+       */
+      public Builder setDataChangeListenerActorPathBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        dataChangeListenerActorPath_ = value;
+        onChanged();
+        return this;
+      }
+
+      // required int32 dataChangeScope = 3;
+      private int dataChangeScope_ ;
+      /**
+       * <code>required int32 dataChangeScope = 3;</code>
+       */
+      public boolean hasDataChangeScope() {
+        return ((bitField0_ & 0x00000004) == 0x00000004);
+      }
+      /**
+       * <code>required int32 dataChangeScope = 3;</code>
+       */
+      public int getDataChangeScope() {
+        return dataChangeScope_;
+      }
+      /**
+       * <code>required int32 dataChangeScope = 3;</code>
+       */
+      public Builder setDataChangeScope(int value) {
+        bitField0_ |= 0x00000004;
+        dataChangeScope_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required int32 dataChangeScope = 3;</code>
+       */
+      public Builder clearDataChangeScope() {
+        bitField0_ = (bitField0_ & ~0x00000004);
+        dataChangeScope_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.RegisterChangeListener)
+    }
+
+    static {
+      defaultInstance = new RegisterChangeListener(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.RegisterChangeListener)
+  }
+
+  public interface RegisterChangeListenerReplyOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required string listenerRegistrationPath = 1;
+    /**
+     * <code>required string listenerRegistrationPath = 1;</code>
+     */
+    boolean hasListenerRegistrationPath();
+    /**
+     * <code>required string listenerRegistrationPath = 1;</code>
+     */
+    java.lang.String getListenerRegistrationPath();
+    /**
+     * <code>required string listenerRegistrationPath = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getListenerRegistrationPathBytes();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.RegisterChangeListenerReply}
+   *
+   * <pre>
+   **
+   * This is the reply for the RegisterChangeListener message
+   * It contains the listenerRegistration actor path
+   * that can be used to unregister the listener
+   * </pre>
+   */
+  public static final class RegisterChangeListenerReply extends
+      com.google.protobuf.GeneratedMessage
+      implements RegisterChangeListenerReplyOrBuilder {
+    // Use RegisterChangeListenerReply.newBuilder() to construct.
+    private RegisterChangeListenerReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private RegisterChangeListenerReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final RegisterChangeListenerReply defaultInstance;
+    public static RegisterChangeListenerReply getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public RegisterChangeListenerReply getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private RegisterChangeListenerReply(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              bitField0_ |= 0x00000001;
+              listenerRegistrationPath_ = input.readBytes();
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<RegisterChangeListenerReply> PARSER =
+        new com.google.protobuf.AbstractParser<RegisterChangeListenerReply>() {
+      public RegisterChangeListenerReply parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new RegisterChangeListenerReply(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<RegisterChangeListenerReply> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required string listenerRegistrationPath = 1;
+    public static final int LISTENERREGISTRATIONPATH_FIELD_NUMBER = 1;
+    private java.lang.Object listenerRegistrationPath_;
+    /**
+     * <code>required string listenerRegistrationPath = 1;</code>
+     */
+    public boolean hasListenerRegistrationPath() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required string listenerRegistrationPath = 1;</code>
+     */
+    public java.lang.String getListenerRegistrationPath() {
+      java.lang.Object ref = listenerRegistrationPath_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          listenerRegistrationPath_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string listenerRegistrationPath = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getListenerRegistrationPathBytes() {
+      java.lang.Object ref = listenerRegistrationPath_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        listenerRegistrationPath_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    private void initFields() {
+      listenerRegistrationPath_ = "";
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasListenerRegistrationPath()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeBytes(1, getListenerRegistrationPathBytes());
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(1, getListenerRegistrationPathBytes());
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.RegisterChangeListenerReply}
+     *
+     * <pre>
+     **
+     * This is the reply for the RegisterChangeListener message
+     * It contains the listenerRegistration actor path
+     * that can be used to unregister the listener
+     * </pre>
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReplyOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        listenerRegistrationPath_ = "";
+        bitField0_ = (bitField0_ & ~0x00000001);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply build() {
+        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply buildPartial() {
+        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply result = new org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.listenerRegistrationPath_ = listenerRegistrationPath_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply other) {
+        if (other == org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply.getDefaultInstance()) return this;
+        if (other.hasListenerRegistrationPath()) {
+          bitField0_ |= 0x00000001;
+          listenerRegistrationPath_ = other.listenerRegistrationPath_;
+          onChanged();
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasListenerRegistrationPath()) {
+          
+          return false;
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListenerReply) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required string listenerRegistrationPath = 1;
+      private java.lang.Object listenerRegistrationPath_ = "";
+      /**
+       * <code>required string listenerRegistrationPath = 1;</code>
+       */
+      public boolean hasListenerRegistrationPath() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required string listenerRegistrationPath = 1;</code>
+       */
+      public java.lang.String getListenerRegistrationPath() {
+        java.lang.Object ref = listenerRegistrationPath_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          listenerRegistrationPath_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string listenerRegistrationPath = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getListenerRegistrationPathBytes() {
+        java.lang.Object ref = listenerRegistrationPath_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          listenerRegistrationPath_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string listenerRegistrationPath = 1;</code>
+       */
+      public Builder setListenerRegistrationPath(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        listenerRegistrationPath_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string listenerRegistrationPath = 1;</code>
+       */
+      public Builder clearListenerRegistrationPath() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        listenerRegistrationPath_ = getDefaultInstance().getListenerRegistrationPath();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string listenerRegistrationPath = 1;</code>
+       */
+      public Builder setListenerRegistrationPathBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        listenerRegistrationPath_ = value;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.RegisterChangeListenerReply)
+    }
+
+    static {
+      defaultInstance = new RegisterChangeListenerReply(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.RegisterChangeListenerReply)
   }
 
   private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_org_opendaylight_controller_mdsal_Close_descriptor;
+    internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_descriptor;
   private static
     com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_org_opendaylight_controller_mdsal_Close_fieldAccessorTable;
+      internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_fieldAccessorTable;
   private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor;
+    internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_descriptor;
   private static
     com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_org_opendaylight_controller_mdsal_CloseReply_fieldAccessorTable;
+      internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_fieldAccessorTable;
 
   public static com.google.protobuf.Descriptors.FileDescriptor
       getDescriptor() {
@@ -646,34 +1941,55 @@ public final class ListenerRegistrationMessages {
   static {
     java.lang.String[] descriptorData = {
       "\n\032ListenerRegistration.proto\022!org.openda" +
-      "ylight.controller.mdsal\"\007\n\005Close\"\014\n\nClos" +
-      "eReplyB[\n;org.opendaylight.controller.pr" +
-      "otobuff.messages.registrationB\034ListenerR" +
-      "egistrationMessages"
+      "ylight.controller.mdsal\032\014Common.proto\"%\n" +
+      "#CloseDataChangeListenerRegistration\"*\n(" +
+      "CloseDataChangeListenerRegistrationReply" +
+      "\"\255\001\n\026RegisterChangeListener\022U\n\026instanceI" +
+      "dentifierPath\030\001 \002(\01325.org.opendaylight.c" +
+      "ontroller.mdsal.InstanceIdentifier\022#\n\033da" +
+      "taChangeListenerActorPath\030\002 \002(\t\022\027\n\017dataC" +
+      "hangeScope\030\003 \002(\005\"?\n\033RegisterChangeListen" +
+      "erReply\022 \n\030listenerRegistrationPath\030\001 \002(",
+      "\tB[\n;org.opendaylight.controller.protobu" +
+      "ff.messages.registrationB\034ListenerRegist" +
+      "rationMessages"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
         public com.google.protobuf.ExtensionRegistry assignDescriptors(
             com.google.protobuf.Descriptors.FileDescriptor root) {
           descriptor = root;
-          internal_static_org_opendaylight_controller_mdsal_Close_descriptor =
+          internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_descriptor =
             getDescriptor().getMessageTypes().get(0);
-          internal_static_org_opendaylight_controller_mdsal_Close_fieldAccessorTable = new
+          internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_org_opendaylight_controller_mdsal_Close_descriptor,
+              internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistration_descriptor,
               new java.lang.String[] { });
-          internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor =
+          internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_descriptor =
             getDescriptor().getMessageTypes().get(1);
-          internal_static_org_opendaylight_controller_mdsal_CloseReply_fieldAccessorTable = new
+          internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor,
+              internal_static_org_opendaylight_controller_mdsal_CloseDataChangeListenerRegistrationReply_descriptor,
               new java.lang.String[] { });
+          internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_descriptor =
+            getDescriptor().getMessageTypes().get(2);
+          internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_RegisterChangeListener_descriptor,
+              new java.lang.String[] { "InstanceIdentifierPath", "DataChangeListenerActorPath", "DataChangeScope", });
+          internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_descriptor =
+            getDescriptor().getMessageTypes().get(3);
+          internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_RegisterChangeListenerReply_descriptor,
+              new java.lang.String[] { "ListenerRegistrationPath", });
           return null;
         }
       };
     com.google.protobuf.Descriptors.FileDescriptor
       .internalBuildGeneratedFileFrom(descriptorData,
         new com.google.protobuf.Descriptors.FileDescriptor[] {
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.getDescriptor(),
         }, assigner);
   }
 
index 055f18e4d352b50850830bb73c06306730961560..7c2a47e1b0daa740f96acf355b4281f9331ec7f2 100644 (file)
@@ -139,7 +139,7 @@ public final class ShardManagerMessages {
       if (ref instanceof java.lang.String) {
         return (java.lang.String) ref;
       } else {
-        com.google.protobuf.ByteString bs =
+        com.google.protobuf.ByteString bs = 
             (com.google.protobuf.ByteString) ref;
         java.lang.String s = bs.toStringUtf8();
         if (bs.isValidUtf8()) {
@@ -155,7 +155,7 @@ public final class ShardManagerMessages {
         getShardNameBytes() {
       java.lang.Object ref = shardName_;
       if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b =
+        com.google.protobuf.ByteString b = 
             com.google.protobuf.ByteString.copyFromUtf8(
                 (java.lang.String) ref);
         shardName_ = b;
@@ -377,7 +377,7 @@ public final class ShardManagerMessages {
 
       public final boolean isInitialized() {
         if (!hasShardName()) {
-
+          
           return false;
         }
         return true;
@@ -431,7 +431,7 @@ public final class ShardManagerMessages {
           getShardNameBytes() {
         java.lang.Object ref = shardName_;
         if (ref instanceof String) {
-          com.google.protobuf.ByteString b =
+          com.google.protobuf.ByteString b = 
               com.google.protobuf.ByteString.copyFromUtf8(
                   (java.lang.String) ref);
           shardName_ = b;
@@ -489,6 +489,21 @@ public final class ShardManagerMessages {
 
   public interface PrimaryFoundOrBuilder
       extends com.google.protobuf.MessageOrBuilder {
+
+    // required string primaryPath = 1;
+    /**
+     * <code>required string primaryPath = 1;</code>
+     */
+    boolean hasPrimaryPath();
+    /**
+     * <code>required string primaryPath = 1;</code>
+     */
+    java.lang.String getPrimaryPath();
+    /**
+     * <code>required string primaryPath = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getPrimaryPathBytes();
   }
   /**
    * Protobuf type {@code org.opendaylight.controller.mdsal.PrimaryFound}
@@ -523,6 +538,7 @@ public final class ShardManagerMessages {
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       initFields();
+      int mutable_bitField0_ = 0;
       com.google.protobuf.UnknownFieldSet.Builder unknownFields =
           com.google.protobuf.UnknownFieldSet.newBuilder();
       try {
@@ -540,6 +556,11 @@ public final class ShardManagerMessages {
               }
               break;
             }
+            case 10: {
+              bitField0_ |= 0x00000001;
+              primaryPath_ = input.readBytes();
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -579,13 +600,62 @@ public final class ShardManagerMessages {
       return PARSER;
     }
 
+    private int bitField0_;
+    // required string primaryPath = 1;
+    public static final int PRIMARYPATH_FIELD_NUMBER = 1;
+    private java.lang.Object primaryPath_;
+    /**
+     * <code>required string primaryPath = 1;</code>
+     */
+    public boolean hasPrimaryPath() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required string primaryPath = 1;</code>
+     */
+    public java.lang.String getPrimaryPath() {
+      java.lang.Object ref = primaryPath_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          primaryPath_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string primaryPath = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getPrimaryPathBytes() {
+      java.lang.Object ref = primaryPath_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        primaryPath_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
     private void initFields() {
+      primaryPath_ = "";
     }
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
       if (isInitialized != -1) return isInitialized == 1;
 
+      if (!hasPrimaryPath()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
       memoizedIsInitialized = 1;
       return true;
     }
@@ -593,6 +663,9 @@ public final class ShardManagerMessages {
     public void writeTo(com.google.protobuf.CodedOutputStream output)
                         throws java.io.IOException {
       getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeBytes(1, getPrimaryPathBytes());
+      }
       getUnknownFields().writeTo(output);
     }
 
@@ -602,6 +675,10 @@ public final class ShardManagerMessages {
       if (size != -1) return size;
 
       size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(1, getPrimaryPathBytes());
+      }
       size += getUnknownFields().getSerializedSize();
       memoizedSerializedSize = size;
       return size;
@@ -718,6 +795,8 @@ public final class ShardManagerMessages {
 
       public Builder clear() {
         super.clear();
+        primaryPath_ = "";
+        bitField0_ = (bitField0_ & ~0x00000001);
         return this;
       }
 
@@ -744,6 +823,13 @@ public final class ShardManagerMessages {
 
       public org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound buildPartial() {
         org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound result = new org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.primaryPath_ = primaryPath_;
+        result.bitField0_ = to_bitField0_;
         onBuilt();
         return result;
       }
@@ -759,11 +845,20 @@ public final class ShardManagerMessages {
 
       public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound other) {
         if (other == org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound.getDefaultInstance()) return this;
+        if (other.hasPrimaryPath()) {
+          bitField0_ |= 0x00000001;
+          primaryPath_ = other.primaryPath_;
+          onChanged();
+        }
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
 
       public final boolean isInitialized() {
+        if (!hasPrimaryPath()) {
+          
+          return false;
+        }
         return true;
       }
 
@@ -784,6 +879,81 @@ public final class ShardManagerMessages {
         }
         return this;
       }
+      private int bitField0_;
+
+      // required string primaryPath = 1;
+      private java.lang.Object primaryPath_ = "";
+      /**
+       * <code>required string primaryPath = 1;</code>
+       */
+      public boolean hasPrimaryPath() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required string primaryPath = 1;</code>
+       */
+      public java.lang.String getPrimaryPath() {
+        java.lang.Object ref = primaryPath_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          primaryPath_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string primaryPath = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getPrimaryPathBytes() {
+        java.lang.Object ref = primaryPath_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          primaryPath_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string primaryPath = 1;</code>
+       */
+      public Builder setPrimaryPath(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        primaryPath_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string primaryPath = 1;</code>
+       */
+      public Builder clearPrimaryPath() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        primaryPath_ = getDefaultInstance().getPrimaryPath();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string primaryPath = 1;</code>
+       */
+      public Builder setPrimaryPathBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        primaryPath_ = value;
+        onChanged();
+        return this;
+      }
 
       // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.PrimaryFound)
     }
@@ -798,6 +968,21 @@ public final class ShardManagerMessages {
 
   public interface PrimaryNotFoundOrBuilder
       extends com.google.protobuf.MessageOrBuilder {
+
+    // required string shardName = 1;
+    /**
+     * <code>required string shardName = 1;</code>
+     */
+    boolean hasShardName();
+    /**
+     * <code>required string shardName = 1;</code>
+     */
+    java.lang.String getShardName();
+    /**
+     * <code>required string shardName = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getShardNameBytes();
   }
   /**
    * Protobuf type {@code org.opendaylight.controller.mdsal.PrimaryNotFound}
@@ -832,6 +1017,7 @@ public final class ShardManagerMessages {
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       initFields();
+      int mutable_bitField0_ = 0;
       com.google.protobuf.UnknownFieldSet.Builder unknownFields =
           com.google.protobuf.UnknownFieldSet.newBuilder();
       try {
@@ -849,6 +1035,11 @@ public final class ShardManagerMessages {
               }
               break;
             }
+            case 10: {
+              bitField0_ |= 0x00000001;
+              shardName_ = input.readBytes();
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -888,13 +1079,62 @@ public final class ShardManagerMessages {
       return PARSER;
     }
 
+    private int bitField0_;
+    // required string shardName = 1;
+    public static final int SHARDNAME_FIELD_NUMBER = 1;
+    private java.lang.Object shardName_;
+    /**
+     * <code>required string shardName = 1;</code>
+     */
+    public boolean hasShardName() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required string shardName = 1;</code>
+     */
+    public java.lang.String getShardName() {
+      java.lang.Object ref = shardName_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          shardName_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string shardName = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getShardNameBytes() {
+      java.lang.Object ref = shardName_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        shardName_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
     private void initFields() {
+      shardName_ = "";
     }
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
       if (isInitialized != -1) return isInitialized == 1;
 
+      if (!hasShardName()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
       memoizedIsInitialized = 1;
       return true;
     }
@@ -902,6 +1142,9 @@ public final class ShardManagerMessages {
     public void writeTo(com.google.protobuf.CodedOutputStream output)
                         throws java.io.IOException {
       getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeBytes(1, getShardNameBytes());
+      }
       getUnknownFields().writeTo(output);
     }
 
@@ -911,6 +1154,10 @@ public final class ShardManagerMessages {
       if (size != -1) return size;
 
       size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(1, getShardNameBytes());
+      }
       size += getUnknownFields().getSerializedSize();
       memoizedSerializedSize = size;
       return size;
@@ -1027,6 +1274,8 @@ public final class ShardManagerMessages {
 
       public Builder clear() {
         super.clear();
+        shardName_ = "";
+        bitField0_ = (bitField0_ & ~0x00000001);
         return this;
       }
 
@@ -1053,6 +1302,13 @@ public final class ShardManagerMessages {
 
       public org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound buildPartial() {
         org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound result = new org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.shardName_ = shardName_;
+        result.bitField0_ = to_bitField0_;
         onBuilt();
         return result;
       }
@@ -1068,11 +1324,20 @@ public final class ShardManagerMessages {
 
       public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound other) {
         if (other == org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound.getDefaultInstance()) return this;
+        if (other.hasShardName()) {
+          bitField0_ |= 0x00000001;
+          shardName_ = other.shardName_;
+          onChanged();
+        }
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
 
       public final boolean isInitialized() {
+        if (!hasShardName()) {
+          
+          return false;
+        }
         return true;
       }
 
@@ -1093,6 +1358,81 @@ public final class ShardManagerMessages {
         }
         return this;
       }
+      private int bitField0_;
+
+      // required string shardName = 1;
+      private java.lang.Object shardName_ = "";
+      /**
+       * <code>required string shardName = 1;</code>
+       */
+      public boolean hasShardName() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required string shardName = 1;</code>
+       */
+      public java.lang.String getShardName() {
+        java.lang.Object ref = shardName_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          shardName_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string shardName = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getShardNameBytes() {
+        java.lang.Object ref = shardName_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          shardName_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string shardName = 1;</code>
+       */
+      public Builder setShardName(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        shardName_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string shardName = 1;</code>
+       */
+      public Builder clearShardName() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        shardName_ = getDefaultInstance().getShardName();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string shardName = 1;</code>
+       */
+      public Builder setShardNameBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        shardName_ = value;
+        onChanged();
+        return this;
+      }
 
       // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.PrimaryNotFound)
     }
@@ -1131,8 +1471,9 @@ public final class ShardManagerMessages {
     java.lang.String[] descriptorData = {
       "\n\022ShardManager.proto\022!org.opendaylight.c" +
       "ontroller.mdsal\" \n\013FindPrimary\022\021\n\tshardN" +
-      "ame\030\001 \002(\t\"\016\n\014PrimaryFound\"\021\n\017PrimaryNotF" +
-      "oundBL\n4org.opendaylight.controller.prot" +
+      "ame\030\001 \002(\t\"#\n\014PrimaryFound\022\023\n\013primaryPath" +
+      "\030\001 \002(\t\"$\n\017PrimaryNotFound\022\021\n\tshardName\030\001" +
+      " \002(\tBL\n4org.opendaylight.controller.prot" +
       "obuff.messages.shardB\024ShardManagerMessag" +
       "es"
     };
@@ -1152,13 +1493,13 @@ public final class ShardManagerMessages {
           internal_static_org_opendaylight_controller_mdsal_PrimaryFound_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_org_opendaylight_controller_mdsal_PrimaryFound_descriptor,
-              new java.lang.String[] { });
+              new java.lang.String[] { "PrimaryPath", });
           internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_descriptor =
             getDescriptor().getMessageTypes().get(2);
           internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_descriptor,
-              new java.lang.String[] { });
+              new java.lang.String[] { "ShardName", });
           return null;
         }
       };
index 63dd5e7081603aed89168980a5f6ad6bb27de28e..3f354ba40eeea6751b1410c47a5bcf7b39db86a6 100644 (file)
@@ -1066,7 +1066,7 @@ public final class ShardTransactionChainMessages {
       if (ref instanceof java.lang.String) {
         return (java.lang.String) ref;
       } else {
-        com.google.protobuf.ByteString bs =
+        com.google.protobuf.ByteString bs = 
             (com.google.protobuf.ByteString) ref;
         java.lang.String s = bs.toStringUtf8();
         if (bs.isValidUtf8()) {
@@ -1082,7 +1082,7 @@ public final class ShardTransactionChainMessages {
         getTransactionChainPathBytes() {
       java.lang.Object ref = transactionChainPath_;
       if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b =
+        com.google.protobuf.ByteString b = 
             com.google.protobuf.ByteString.copyFromUtf8(
                 (java.lang.String) ref);
         transactionChainPath_ = b;
@@ -1304,7 +1304,7 @@ public final class ShardTransactionChainMessages {
 
       public final boolean isInitialized() {
         if (!hasTransactionChainPath()) {
-
+          
           return false;
         }
         return true;
@@ -1358,7 +1358,7 @@ public final class ShardTransactionChainMessages {
           getTransactionChainPathBytes() {
         java.lang.Object ref = transactionChainPath_;
         if (ref instanceof String) {
-          com.google.protobuf.ByteString b =
+          com.google.protobuf.ByteString b = 
               com.google.protobuf.ByteString.copyFromUtf8(
                   (java.lang.String) ref);
           transactionChainPath_ = b;
index cabcf859da95e63fbc404c9482f4167cf129f522..ee2c70423e14fcaa8775d285f22cd2a8bb02f324 100644 (file)
@@ -628,6 +628,21 @@ public final class ShardTransactionMessages {
 
   public interface CreateTransactionOrBuilder
       extends com.google.protobuf.MessageOrBuilder {
+
+    // required string transactionId = 1;
+    /**
+     * <code>required string transactionId = 1;</code>
+     */
+    boolean hasTransactionId();
+    /**
+     * <code>required string transactionId = 1;</code>
+     */
+    java.lang.String getTransactionId();
+    /**
+     * <code>required string transactionId = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getTransactionIdBytes();
   }
   /**
    * Protobuf type {@code org.opendaylight.controller.mdsal.CreateTransaction}
@@ -662,6 +677,7 @@ public final class ShardTransactionMessages {
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       initFields();
+      int mutable_bitField0_ = 0;
       com.google.protobuf.UnknownFieldSet.Builder unknownFields =
           com.google.protobuf.UnknownFieldSet.newBuilder();
       try {
@@ -679,6 +695,11 @@ public final class ShardTransactionMessages {
               }
               break;
             }
+            case 10: {
+              bitField0_ |= 0x00000001;
+              transactionId_ = input.readBytes();
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -718,13 +739,62 @@ public final class ShardTransactionMessages {
       return PARSER;
     }
 
+    private int bitField0_;
+    // required string transactionId = 1;
+    public static final int TRANSACTIONID_FIELD_NUMBER = 1;
+    private java.lang.Object transactionId_;
+    /**
+     * <code>required string transactionId = 1;</code>
+     */
+    public boolean hasTransactionId() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required string transactionId = 1;</code>
+     */
+    public java.lang.String getTransactionId() {
+      java.lang.Object ref = transactionId_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          transactionId_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string transactionId = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getTransactionIdBytes() {
+      java.lang.Object ref = transactionId_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        transactionId_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
     private void initFields() {
+      transactionId_ = "";
     }
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
       if (isInitialized != -1) return isInitialized == 1;
 
+      if (!hasTransactionId()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
       memoizedIsInitialized = 1;
       return true;
     }
@@ -732,6 +802,9 @@ public final class ShardTransactionMessages {
     public void writeTo(com.google.protobuf.CodedOutputStream output)
                         throws java.io.IOException {
       getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeBytes(1, getTransactionIdBytes());
+      }
       getUnknownFields().writeTo(output);
     }
 
@@ -741,6 +814,10 @@ public final class ShardTransactionMessages {
       if (size != -1) return size;
 
       size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(1, getTransactionIdBytes());
+      }
       size += getUnknownFields().getSerializedSize();
       memoizedSerializedSize = size;
       return size;
@@ -857,6 +934,8 @@ public final class ShardTransactionMessages {
 
       public Builder clear() {
         super.clear();
+        transactionId_ = "";
+        bitField0_ = (bitField0_ & ~0x00000001);
         return this;
       }
 
@@ -883,6 +962,13 @@ public final class ShardTransactionMessages {
 
       public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction buildPartial() {
         org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.transactionId_ = transactionId_;
+        result.bitField0_ = to_bitField0_;
         onBuilt();
         return result;
       }
@@ -898,11 +984,20 @@ public final class ShardTransactionMessages {
 
       public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction other) {
         if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction.getDefaultInstance()) return this;
+        if (other.hasTransactionId()) {
+          bitField0_ |= 0x00000001;
+          transactionId_ = other.transactionId_;
+          onChanged();
+        }
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
 
       public final boolean isInitialized() {
+        if (!hasTransactionId()) {
+          
+          return false;
+        }
         return true;
       }
 
@@ -923,6 +1018,81 @@ public final class ShardTransactionMessages {
         }
         return this;
       }
+      private int bitField0_;
+
+      // required string transactionId = 1;
+      private java.lang.Object transactionId_ = "";
+      /**
+       * <code>required string transactionId = 1;</code>
+       */
+      public boolean hasTransactionId() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required string transactionId = 1;</code>
+       */
+      public java.lang.String getTransactionId() {
+        java.lang.Object ref = transactionId_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          transactionId_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string transactionId = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getTransactionIdBytes() {
+        java.lang.Object ref = transactionId_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          transactionId_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string transactionId = 1;</code>
+       */
+      public Builder setTransactionId(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        transactionId_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string transactionId = 1;</code>
+       */
+      public Builder clearTransactionId() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        transactionId_ = getDefaultInstance().getTransactionId();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string transactionId = 1;</code>
+       */
+      public Builder setTransactionIdBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        transactionId_ = value;
+        onChanged();
+        return this;
+      }
 
       // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CreateTransaction)
     }
@@ -938,20 +1108,35 @@ public final class ShardTransactionMessages {
   public interface CreateTransactionReplyOrBuilder
       extends com.google.protobuf.MessageOrBuilder {
 
-    // required string transactionPath = 1;
+    // required string transactionActorPath = 1;
+    /**
+     * <code>required string transactionActorPath = 1;</code>
+     */
+    boolean hasTransactionActorPath();
+    /**
+     * <code>required string transactionActorPath = 1;</code>
+     */
+    java.lang.String getTransactionActorPath();
+    /**
+     * <code>required string transactionActorPath = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getTransactionActorPathBytes();
+
+    // required string transactionId = 2;
     /**
-     * <code>required string transactionPath = 1;</code>
+     * <code>required string transactionId = 2;</code>
      */
-    boolean hasTransactionPath();
+    boolean hasTransactionId();
     /**
-     * <code>required string transactionPath = 1;</code>
+     * <code>required string transactionId = 2;</code>
      */
-    java.lang.String getTransactionPath();
+    java.lang.String getTransactionId();
     /**
-     * <code>required string transactionPath = 1;</code>
+     * <code>required string transactionId = 2;</code>
      */
     com.google.protobuf.ByteString
-        getTransactionPathBytes();
+        getTransactionIdBytes();
   }
   /**
    * Protobuf type {@code org.opendaylight.controller.mdsal.CreateTransactionReply}
@@ -1006,7 +1191,12 @@ public final class ShardTransactionMessages {
             }
             case 10: {
               bitField0_ |= 0x00000001;
-              transactionPath_ = input.readBytes();
+              transactionActorPath_ = input.readBytes();
+              break;
+            }
+            case 18: {
+              bitField0_ |= 0x00000002;
+              transactionId_ = input.readBytes();
               break;
             }
           }
@@ -1049,43 +1239,86 @@ public final class ShardTransactionMessages {
     }
 
     private int bitField0_;
-    // required string transactionPath = 1;
-    public static final int TRANSACTIONPATH_FIELD_NUMBER = 1;
-    private java.lang.Object transactionPath_;
+    // required string transactionActorPath = 1;
+    public static final int TRANSACTIONACTORPATH_FIELD_NUMBER = 1;
+    private java.lang.Object transactionActorPath_;
     /**
-     * <code>required string transactionPath = 1;</code>
+     * <code>required string transactionActorPath = 1;</code>
      */
-    public boolean hasTransactionPath() {
+    public boolean hasTransactionActorPath() {
       return ((bitField0_ & 0x00000001) == 0x00000001);
     }
     /**
-     * <code>required string transactionPath = 1;</code>
+     * <code>required string transactionActorPath = 1;</code>
+     */
+    public java.lang.String getTransactionActorPath() {
+      java.lang.Object ref = transactionActorPath_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs = 
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          transactionActorPath_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string transactionActorPath = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getTransactionActorPathBytes() {
+      java.lang.Object ref = transactionActorPath_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        transactionActorPath_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // required string transactionId = 2;
+    public static final int TRANSACTIONID_FIELD_NUMBER = 2;
+    private java.lang.Object transactionId_;
+    /**
+     * <code>required string transactionId = 2;</code>
+     */
+    public boolean hasTransactionId() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>required string transactionId = 2;</code>
      */
-    public java.lang.String getTransactionPath() {
-      java.lang.Object ref = transactionPath_;
+    public java.lang.String getTransactionId() {
+      java.lang.Object ref = transactionId_;
       if (ref instanceof java.lang.String) {
         return (java.lang.String) ref;
       } else {
-        com.google.protobuf.ByteString bs =
+        com.google.protobuf.ByteString bs = 
             (com.google.protobuf.ByteString) ref;
         java.lang.String s = bs.toStringUtf8();
         if (bs.isValidUtf8()) {
-          transactionPath_ = s;
+          transactionId_ = s;
         }
         return s;
       }
     }
     /**
-     * <code>required string transactionPath = 1;</code>
+     * <code>required string transactionId = 2;</code>
      */
     public com.google.protobuf.ByteString
-        getTransactionPathBytes() {
-      java.lang.Object ref = transactionPath_;
+        getTransactionIdBytes() {
+      java.lang.Object ref = transactionId_;
       if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b =
+        com.google.protobuf.ByteString b = 
             com.google.protobuf.ByteString.copyFromUtf8(
                 (java.lang.String) ref);
-        transactionPath_ = b;
+        transactionId_ = b;
         return b;
       } else {
         return (com.google.protobuf.ByteString) ref;
@@ -1093,14 +1326,19 @@ public final class ShardTransactionMessages {
     }
 
     private void initFields() {
-      transactionPath_ = "";
+      transactionActorPath_ = "";
+      transactionId_ = "";
     }
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
       if (isInitialized != -1) return isInitialized == 1;
 
-      if (!hasTransactionPath()) {
+      if (!hasTransactionActorPath()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (!hasTransactionId()) {
         memoizedIsInitialized = 0;
         return false;
       }
@@ -1112,7 +1350,10 @@ public final class ShardTransactionMessages {
                         throws java.io.IOException {
       getSerializedSize();
       if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        output.writeBytes(1, getTransactionPathBytes());
+        output.writeBytes(1, getTransactionActorPathBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeBytes(2, getTransactionIdBytes());
       }
       getUnknownFields().writeTo(output);
     }
@@ -1125,7 +1366,11 @@ public final class ShardTransactionMessages {
       size = 0;
       if (((bitField0_ & 0x00000001) == 0x00000001)) {
         size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(1, getTransactionPathBytes());
+          .computeBytesSize(1, getTransactionActorPathBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(2, getTransactionIdBytes());
       }
       size += getUnknownFields().getSerializedSize();
       memoizedSerializedSize = size;
@@ -1243,8 +1488,10 @@ public final class ShardTransactionMessages {
 
       public Builder clear() {
         super.clear();
-        transactionPath_ = "";
+        transactionActorPath_ = "";
         bitField0_ = (bitField0_ & ~0x00000001);
+        transactionId_ = "";
+        bitField0_ = (bitField0_ & ~0x00000002);
         return this;
       }
 
@@ -1276,7 +1523,11 @@ public final class ShardTransactionMessages {
         if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
           to_bitField0_ |= 0x00000001;
         }
-        result.transactionPath_ = transactionPath_;
+        result.transactionActorPath_ = transactionActorPath_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.transactionId_ = transactionId_;
         result.bitField0_ = to_bitField0_;
         onBuilt();
         return result;
@@ -1293,9 +1544,14 @@ public final class ShardTransactionMessages {
 
       public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply other) {
         if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply.getDefaultInstance()) return this;
-        if (other.hasTransactionPath()) {
+        if (other.hasTransactionActorPath()) {
           bitField0_ |= 0x00000001;
-          transactionPath_ = other.transactionPath_;
+          transactionActorPath_ = other.transactionActorPath_;
+          onChanged();
+        }
+        if (other.hasTransactionId()) {
+          bitField0_ |= 0x00000002;
+          transactionId_ = other.transactionId_;
           onChanged();
         }
         this.mergeUnknownFields(other.getUnknownFields());
@@ -1303,8 +1559,12 @@ public final class ShardTransactionMessages {
       }
 
       public final boolean isInitialized() {
-        if (!hasTransactionPath()) {
-
+        if (!hasTransactionActorPath()) {
+          
+          return false;
+        }
+        if (!hasTransactionId()) {
+          
           return false;
         }
         return true;
@@ -1329,76 +1589,150 @@ public final class ShardTransactionMessages {
       }
       private int bitField0_;
 
-      // required string transactionPath = 1;
-      private java.lang.Object transactionPath_ = "";
+      // required string transactionActorPath = 1;
+      private java.lang.Object transactionActorPath_ = "";
       /**
-       * <code>required string transactionPath = 1;</code>
+       * <code>required string transactionActorPath = 1;</code>
        */
-      public boolean hasTransactionPath() {
+      public boolean hasTransactionActorPath() {
         return ((bitField0_ & 0x00000001) == 0x00000001);
       }
       /**
-       * <code>required string transactionPath = 1;</code>
+       * <code>required string transactionActorPath = 1;</code>
        */
-      public java.lang.String getTransactionPath() {
-        java.lang.Object ref = transactionPath_;
+      public java.lang.String getTransactionActorPath() {
+        java.lang.Object ref = transactionActorPath_;
         if (!(ref instanceof java.lang.String)) {
           java.lang.String s = ((com.google.protobuf.ByteString) ref)
               .toStringUtf8();
-          transactionPath_ = s;
+          transactionActorPath_ = s;
           return s;
         } else {
           return (java.lang.String) ref;
         }
       }
       /**
-       * <code>required string transactionPath = 1;</code>
+       * <code>required string transactionActorPath = 1;</code>
        */
       public com.google.protobuf.ByteString
-          getTransactionPathBytes() {
-        java.lang.Object ref = transactionPath_;
+          getTransactionActorPathBytes() {
+        java.lang.Object ref = transactionActorPath_;
         if (ref instanceof String) {
-          com.google.protobuf.ByteString b =
+          com.google.protobuf.ByteString b = 
               com.google.protobuf.ByteString.copyFromUtf8(
                   (java.lang.String) ref);
-          transactionPath_ = b;
+          transactionActorPath_ = b;
           return b;
         } else {
           return (com.google.protobuf.ByteString) ref;
         }
       }
       /**
-       * <code>required string transactionPath = 1;</code>
+       * <code>required string transactionActorPath = 1;</code>
        */
-      public Builder setTransactionPath(
+      public Builder setTransactionActorPath(
           java.lang.String value) {
         if (value == null) {
     throw new NullPointerException();
   }
   bitField0_ |= 0x00000001;
-        transactionPath_ = value;
+        transactionActorPath_ = value;
         onChanged();
         return this;
       }
       /**
-       * <code>required string transactionPath = 1;</code>
+       * <code>required string transactionActorPath = 1;</code>
        */
-      public Builder clearTransactionPath() {
+      public Builder clearTransactionActorPath() {
         bitField0_ = (bitField0_ & ~0x00000001);
-        transactionPath_ = getDefaultInstance().getTransactionPath();
+        transactionActorPath_ = getDefaultInstance().getTransactionActorPath();
         onChanged();
         return this;
       }
       /**
-       * <code>required string transactionPath = 1;</code>
+       * <code>required string transactionActorPath = 1;</code>
        */
-      public Builder setTransactionPathBytes(
+      public Builder setTransactionActorPathBytes(
           com.google.protobuf.ByteString value) {
         if (value == null) {
     throw new NullPointerException();
   }
   bitField0_ |= 0x00000001;
-        transactionPath_ = value;
+        transactionActorPath_ = value;
+        onChanged();
+        return this;
+      }
+
+      // required string transactionId = 2;
+      private java.lang.Object transactionId_ = "";
+      /**
+       * <code>required string transactionId = 2;</code>
+       */
+      public boolean hasTransactionId() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>required string transactionId = 2;</code>
+       */
+      public java.lang.String getTransactionId() {
+        java.lang.Object ref = transactionId_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          transactionId_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string transactionId = 2;</code>
+       */
+      public com.google.protobuf.ByteString
+          getTransactionIdBytes() {
+        java.lang.Object ref = transactionId_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          transactionId_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string transactionId = 2;</code>
+       */
+      public Builder setTransactionId(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        transactionId_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string transactionId = 2;</code>
+       */
+      public Builder clearTransactionId() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        transactionId_ = getDefaultInstance().getTransactionId();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string transactionId = 2;</code>
+       */
+      public Builder setTransactionIdBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        transactionId_ = value;
         onChanged();
         return this;
       }
@@ -1854,7 +2188,7 @@ public final class ShardTransactionMessages {
       if (ref instanceof java.lang.String) {
         return (java.lang.String) ref;
       } else {
-        com.google.protobuf.ByteString bs =
+        com.google.protobuf.ByteString bs = 
             (com.google.protobuf.ByteString) ref;
         java.lang.String s = bs.toStringUtf8();
         if (bs.isValidUtf8()) {
@@ -1870,7 +2204,7 @@ public final class ShardTransactionMessages {
         getActorPathBytes() {
       java.lang.Object ref = actorPath_;
       if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b =
+        com.google.protobuf.ByteString b = 
             com.google.protobuf.ByteString.copyFromUtf8(
                 (java.lang.String) ref);
         actorPath_ = b;
@@ -2092,7 +2426,7 @@ public final class ShardTransactionMessages {
 
       public final boolean isInitialized() {
         if (!hasActorPath()) {
-
+          
           return false;
         }
         return true;
@@ -2146,7 +2480,7 @@ public final class ShardTransactionMessages {
           getActorPathBytes() {
         java.lang.Object ref = actorPath_;
         if (ref instanceof String) {
-          com.google.protobuf.ByteString b =
+          com.google.protobuf.ByteString b = 
               com.google.protobuf.ByteString.copyFromUtf8(
                   (java.lang.String) ref);
           actorPath_ = b;
@@ -2205,25 +2539,19 @@ public final class ShardTransactionMessages {
   public interface DeleteDataOrBuilder
       extends com.google.protobuf.MessageOrBuilder {
 
-    // repeated string instanceIdentifierPathArguments = 1;
-    /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
-     */
-    java.util.List<java.lang.String>
-    getInstanceIdentifierPathArgumentsList();
+    // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
      */
-    int getInstanceIdentifierPathArgumentsCount();
+    boolean hasInstanceIdentifierPathArguments();
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
      */
-    java.lang.String getInstanceIdentifierPathArguments(int index);
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments();
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
      */
-    com.google.protobuf.ByteString
-        getInstanceIdentifierPathArgumentsBytes(int index);
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder();
   }
   /**
    * Protobuf type {@code org.opendaylight.controller.mdsal.DeleteData}
@@ -2277,11 +2605,16 @@ public final class ShardTransactionMessages {
               break;
             }
             case 10: {
-              if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
-                instanceIdentifierPathArguments_ = new com.google.protobuf.LazyStringArrayList();
-                mutable_bitField0_ |= 0x00000001;
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000001) == 0x00000001)) {
+                subBuilder = instanceIdentifierPathArguments_.toBuilder();
+              }
+              instanceIdentifierPathArguments_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(instanceIdentifierPathArguments_);
+                instanceIdentifierPathArguments_ = subBuilder.buildPartial();
               }
-              instanceIdentifierPathArguments_.add(input.readBytes());
+              bitField0_ |= 0x00000001;
               break;
             }
           }
@@ -2292,9 +2625,6 @@ public final class ShardTransactionMessages {
         throw new com.google.protobuf.InvalidProtocolBufferException(
             e.getMessage()).setUnfinishedMessage(this);
       } finally {
-        if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
-          instanceIdentifierPathArguments_ = new com.google.protobuf.UnmodifiableLazyStringList(instanceIdentifierPathArguments_);
-        }
         this.unknownFields = unknownFields.build();
         makeExtensionsImmutable();
       }
@@ -2326,44 +2656,45 @@ public final class ShardTransactionMessages {
       return PARSER;
     }
 
-    // repeated string instanceIdentifierPathArguments = 1;
+    private int bitField0_;
+    // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
     public static final int INSTANCEIDENTIFIERPATHARGUMENTS_FIELD_NUMBER = 1;
-    private com.google.protobuf.LazyStringList instanceIdentifierPathArguments_;
-    /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
-     */
-    public java.util.List<java.lang.String>
-        getInstanceIdentifierPathArgumentsList() {
-      return instanceIdentifierPathArguments_;
-    }
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_;
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
      */
-    public int getInstanceIdentifierPathArgumentsCount() {
-      return instanceIdentifierPathArguments_.size();
+    public boolean hasInstanceIdentifierPathArguments() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
     }
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
      */
-    public java.lang.String getInstanceIdentifierPathArguments(int index) {
-      return instanceIdentifierPathArguments_.get(index);
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() {
+      return instanceIdentifierPathArguments_;
     }
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
      */
-    public com.google.protobuf.ByteString
-        getInstanceIdentifierPathArgumentsBytes(int index) {
-      return instanceIdentifierPathArguments_.getByteString(index);
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() {
+      return instanceIdentifierPathArguments_;
     }
 
     private void initFields() {
-      instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+      instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
     }
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
       if (isInitialized != -1) return isInitialized == 1;
 
+      if (!hasInstanceIdentifierPathArguments()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (!getInstanceIdentifierPathArguments().isInitialized()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
       memoizedIsInitialized = 1;
       return true;
     }
@@ -2371,8 +2702,8 @@ public final class ShardTransactionMessages {
     public void writeTo(com.google.protobuf.CodedOutputStream output)
                         throws java.io.IOException {
       getSerializedSize();
-      for (int i = 0; i < instanceIdentifierPathArguments_.size(); i++) {
-        output.writeBytes(1, instanceIdentifierPathArguments_.getByteString(i));
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeMessage(1, instanceIdentifierPathArguments_);
       }
       getUnknownFields().writeTo(output);
     }
@@ -2383,14 +2714,9 @@ public final class ShardTransactionMessages {
       if (size != -1) return size;
 
       size = 0;
-      {
-        int dataSize = 0;
-        for (int i = 0; i < instanceIdentifierPathArguments_.size(); i++) {
-          dataSize += com.google.protobuf.CodedOutputStream
-            .computeBytesSizeNoTag(instanceIdentifierPathArguments_.getByteString(i));
-        }
-        size += dataSize;
-        size += 1 * getInstanceIdentifierPathArgumentsList().size();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(1, instanceIdentifierPathArguments_);
       }
       size += getUnknownFields().getSerializedSize();
       memoizedSerializedSize = size;
@@ -2500,6 +2826,7 @@ public final class ShardTransactionMessages {
       }
       private void maybeForceBuilderInitialization() {
         if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getInstanceIdentifierPathArgumentsFieldBuilder();
         }
       }
       private static Builder create() {
@@ -2508,7 +2835,11 @@ public final class ShardTransactionMessages {
 
       public Builder clear() {
         super.clear();
-        instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.clear();
+        }
         bitField0_ = (bitField0_ & ~0x00000001);
         return this;
       }
@@ -2537,12 +2868,16 @@ public final class ShardTransactionMessages {
       public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData buildPartial() {
         org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData(this);
         int from_bitField0_ = bitField0_;
-        if (((bitField0_ & 0x00000001) == 0x00000001)) {
-          instanceIdentifierPathArguments_ = new com.google.protobuf.UnmodifiableLazyStringList(
-              instanceIdentifierPathArguments_);
-          bitField0_ = (bitField0_ & ~0x00000001);
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
+        } else {
+          result.instanceIdentifierPathArguments_ = instanceIdentifierPathArgumentsBuilder_.build();
         }
-        result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
+        result.bitField0_ = to_bitField0_;
         onBuilt();
         return result;
       }
@@ -2558,21 +2893,22 @@ public final class ShardTransactionMessages {
 
       public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData other) {
         if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData.getDefaultInstance()) return this;
-        if (!other.instanceIdentifierPathArguments_.isEmpty()) {
-          if (instanceIdentifierPathArguments_.isEmpty()) {
-            instanceIdentifierPathArguments_ = other.instanceIdentifierPathArguments_;
-            bitField0_ = (bitField0_ & ~0x00000001);
-          } else {
-            ensureInstanceIdentifierPathArgumentsIsMutable();
-            instanceIdentifierPathArguments_.addAll(other.instanceIdentifierPathArguments_);
-          }
-          onChanged();
+        if (other.hasInstanceIdentifierPathArguments()) {
+          mergeInstanceIdentifierPathArguments(other.getInstanceIdentifierPathArguments());
         }
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
 
       public final boolean isInitialized() {
+        if (!hasInstanceIdentifierPathArguments()) {
+          
+          return false;
+        }
+        if (!getInstanceIdentifierPathArguments().isInitialized()) {
+          
+          return false;
+        }
         return true;
       }
 
@@ -2595,97 +2931,121 @@ public final class ShardTransactionMessages {
       }
       private int bitField0_;
 
-      // repeated string instanceIdentifierPathArguments = 1;
-      private com.google.protobuf.LazyStringList instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-      private void ensureInstanceIdentifierPathArgumentsIsMutable() {
-        if (!((bitField0_ & 0x00000001) == 0x00000001)) {
-          instanceIdentifierPathArguments_ = new com.google.protobuf.LazyStringArrayList(instanceIdentifierPathArguments_);
-          bitField0_ |= 0x00000001;
-         }
-      }
+      // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierPathArgumentsBuilder_;
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public java.util.List<java.lang.String>
-          getInstanceIdentifierPathArgumentsList() {
-        return java.util.Collections.unmodifiableList(instanceIdentifierPathArguments_);
+      public boolean hasInstanceIdentifierPathArguments() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public int getInstanceIdentifierPathArgumentsCount() {
-        return instanceIdentifierPathArguments_.size();
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          return instanceIdentifierPathArguments_;
+        } else {
+          return instanceIdentifierPathArgumentsBuilder_.getMessage();
+        }
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public java.lang.String getInstanceIdentifierPathArguments(int index) {
-        return instanceIdentifierPathArguments_.get(index);
+      public Builder setInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          instanceIdentifierPathArguments_ = value;
+          onChanged();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000001;
+        return this;
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public com.google.protobuf.ByteString
-          getInstanceIdentifierPathArgumentsBytes(int index) {
-        return instanceIdentifierPathArguments_.getByteString(index);
+      public Builder setInstanceIdentifierPathArguments(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          instanceIdentifierPathArguments_ = builderForValue.build();
+          onChanged();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000001;
+        return this;
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public Builder setInstanceIdentifierPathArguments(
-          int index, java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  ensureInstanceIdentifierPathArgumentsIsMutable();
-        instanceIdentifierPathArguments_.set(index, value);
-        onChanged();
+      public Builder mergeInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          if (((bitField0_ & 0x00000001) == 0x00000001) &&
+              instanceIdentifierPathArguments_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+            instanceIdentifierPathArguments_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierPathArguments_).mergeFrom(value).buildPartial();
+          } else {
+            instanceIdentifierPathArguments_ = value;
+          }
+          onChanged();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000001;
         return this;
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public Builder addInstanceIdentifierPathArguments(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  ensureInstanceIdentifierPathArgumentsIsMutable();
-        instanceIdentifierPathArguments_.add(value);
-        onChanged();
+      public Builder clearInstanceIdentifierPathArguments() {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+          onChanged();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000001);
         return this;
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public Builder addAllInstanceIdentifierPathArguments(
-          java.lang.Iterable<java.lang.String> values) {
-        ensureInstanceIdentifierPathArgumentsIsMutable();
-        super.addAll(values, instanceIdentifierPathArguments_);
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierPathArgumentsBuilder() {
+        bitField0_ |= 0x00000001;
         onChanged();
-        return this;
+        return getInstanceIdentifierPathArgumentsFieldBuilder().getBuilder();
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public Builder clearInstanceIdentifierPathArguments() {
-        instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-        bitField0_ = (bitField0_ & ~0x00000001);
-        onChanged();
-        return this;
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() {
+        if (instanceIdentifierPathArgumentsBuilder_ != null) {
+          return instanceIdentifierPathArgumentsBuilder_.getMessageOrBuilder();
+        } else {
+          return instanceIdentifierPathArguments_;
+        }
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public Builder addInstanceIdentifierPathArgumentsBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  ensureInstanceIdentifierPathArgumentsIsMutable();
-        instanceIdentifierPathArguments_.add(value);
-        onChanged();
-        return this;
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> 
+          getInstanceIdentifierPathArgumentsFieldBuilder() {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          instanceIdentifierPathArgumentsBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+                  instanceIdentifierPathArguments_,
+                  getParentForChildren(),
+                  isClean());
+          instanceIdentifierPathArguments_ = null;
+        }
+        return instanceIdentifierPathArgumentsBuilder_;
       }
 
       // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.DeleteData)
@@ -3011,20 +3371,19 @@ public final class ShardTransactionMessages {
   public interface ReadDataOrBuilder
       extends com.google.protobuf.MessageOrBuilder {
 
-    // required string instanceIdentifierPathArguments = 1;
+    // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
     /**
-     * <code>required string instanceIdentifierPathArguments = 1;</code>
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
      */
     boolean hasInstanceIdentifierPathArguments();
     /**
-     * <code>required string instanceIdentifierPathArguments = 1;</code>
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
      */
-    java.lang.String getInstanceIdentifierPathArguments();
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments();
     /**
-     * <code>required string instanceIdentifierPathArguments = 1;</code>
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
      */
-    com.google.protobuf.ByteString
-        getInstanceIdentifierPathArgumentsBytes();
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder();
   }
   /**
    * Protobuf type {@code org.opendaylight.controller.mdsal.ReadData}
@@ -3078,8 +3437,16 @@ public final class ShardTransactionMessages {
               break;
             }
             case 10: {
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000001) == 0x00000001)) {
+                subBuilder = instanceIdentifierPathArguments_.toBuilder();
+              }
+              instanceIdentifierPathArguments_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(instanceIdentifierPathArguments_);
+                instanceIdentifierPathArguments_ = subBuilder.buildPartial();
+              }
               bitField0_ |= 0x00000001;
-              instanceIdentifierPathArguments_ = input.readBytes();
               break;
             }
           }
@@ -3122,51 +3489,30 @@ public final class ShardTransactionMessages {
     }
 
     private int bitField0_;
-    // required string instanceIdentifierPathArguments = 1;
+    // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
     public static final int INSTANCEIDENTIFIERPATHARGUMENTS_FIELD_NUMBER = 1;
-    private java.lang.Object instanceIdentifierPathArguments_;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_;
     /**
-     * <code>required string instanceIdentifierPathArguments = 1;</code>
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
      */
     public boolean hasInstanceIdentifierPathArguments() {
       return ((bitField0_ & 0x00000001) == 0x00000001);
     }
     /**
-     * <code>required string instanceIdentifierPathArguments = 1;</code>
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
      */
-    public java.lang.String getInstanceIdentifierPathArguments() {
-      java.lang.Object ref = instanceIdentifierPathArguments_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs =
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          instanceIdentifierPathArguments_ = s;
-        }
-        return s;
-      }
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() {
+      return instanceIdentifierPathArguments_;
     }
     /**
-     * <code>required string instanceIdentifierPathArguments = 1;</code>
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
      */
-    public com.google.protobuf.ByteString
-        getInstanceIdentifierPathArgumentsBytes() {
-      java.lang.Object ref = instanceIdentifierPathArguments_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b =
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        instanceIdentifierPathArguments_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() {
+      return instanceIdentifierPathArguments_;
     }
 
     private void initFields() {
-      instanceIdentifierPathArguments_ = "";
+      instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
     }
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
@@ -3177,6 +3523,10 @@ public final class ShardTransactionMessages {
         memoizedIsInitialized = 0;
         return false;
       }
+      if (!getInstanceIdentifierPathArguments().isInitialized()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
       memoizedIsInitialized = 1;
       return true;
     }
@@ -3185,7 +3535,7 @@ public final class ShardTransactionMessages {
                         throws java.io.IOException {
       getSerializedSize();
       if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        output.writeBytes(1, getInstanceIdentifierPathArgumentsBytes());
+        output.writeMessage(1, instanceIdentifierPathArguments_);
       }
       getUnknownFields().writeTo(output);
     }
@@ -3198,7 +3548,7 @@ public final class ShardTransactionMessages {
       size = 0;
       if (((bitField0_ & 0x00000001) == 0x00000001)) {
         size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(1, getInstanceIdentifierPathArgumentsBytes());
+          .computeMessageSize(1, instanceIdentifierPathArguments_);
       }
       size += getUnknownFields().getSerializedSize();
       memoizedSerializedSize = size;
@@ -3308,6 +3658,7 @@ public final class ShardTransactionMessages {
       }
       private void maybeForceBuilderInitialization() {
         if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getInstanceIdentifierPathArgumentsFieldBuilder();
         }
       }
       private static Builder create() {
@@ -3316,7 +3667,11 @@ public final class ShardTransactionMessages {
 
       public Builder clear() {
         super.clear();
-        instanceIdentifierPathArguments_ = "";
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.clear();
+        }
         bitField0_ = (bitField0_ & ~0x00000001);
         return this;
       }
@@ -3349,7 +3704,11 @@ public final class ShardTransactionMessages {
         if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
           to_bitField0_ |= 0x00000001;
         }
-        result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
+        } else {
+          result.instanceIdentifierPathArguments_ = instanceIdentifierPathArgumentsBuilder_.build();
+        }
         result.bitField0_ = to_bitField0_;
         onBuilt();
         return result;
@@ -3367,9 +3726,7 @@ public final class ShardTransactionMessages {
       public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData other) {
         if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData.getDefaultInstance()) return this;
         if (other.hasInstanceIdentifierPathArguments()) {
-          bitField0_ |= 0x00000001;
-          instanceIdentifierPathArguments_ = other.instanceIdentifierPathArguments_;
-          onChanged();
+          mergeInstanceIdentifierPathArguments(other.getInstanceIdentifierPathArguments());
         }
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
@@ -3377,7 +3734,11 @@ public final class ShardTransactionMessages {
 
       public final boolean isInitialized() {
         if (!hasInstanceIdentifierPathArguments()) {
-
+          
+          return false;
+        }
+        if (!getInstanceIdentifierPathArguments().isInitialized()) {
+          
           return false;
         }
         return true;
@@ -3402,78 +3763,121 @@ public final class ShardTransactionMessages {
       }
       private int bitField0_;
 
-      // required string instanceIdentifierPathArguments = 1;
-      private java.lang.Object instanceIdentifierPathArguments_ = "";
+      // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierPathArgumentsBuilder_;
       /**
-       * <code>required string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
       public boolean hasInstanceIdentifierPathArguments() {
         return ((bitField0_ & 0x00000001) == 0x00000001);
       }
       /**
-       * <code>required string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public java.lang.String getInstanceIdentifierPathArguments() {
-        java.lang.Object ref = instanceIdentifierPathArguments_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          instanceIdentifierPathArguments_ = s;
-          return s;
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          return instanceIdentifierPathArguments_;
         } else {
-          return (java.lang.String) ref;
+          return instanceIdentifierPathArgumentsBuilder_.getMessage();
         }
       }
       /**
-       * <code>required string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public com.google.protobuf.ByteString
-          getInstanceIdentifierPathArgumentsBytes() {
-        java.lang.Object ref = instanceIdentifierPathArguments_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b =
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          instanceIdentifierPathArguments_ = b;
-          return b;
+      public Builder setInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          instanceIdentifierPathArguments_ = value;
+          onChanged();
         } else {
-          return (com.google.protobuf.ByteString) ref;
+          instanceIdentifierPathArgumentsBuilder_.setMessage(value);
         }
+        bitField0_ |= 0x00000001;
+        return this;
       }
       /**
-       * <code>required string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
       public Builder setInstanceIdentifierPathArguments(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-        instanceIdentifierPathArguments_ = value;
-        onChanged();
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          instanceIdentifierPathArguments_ = builderForValue.build();
+          onChanged();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000001;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder mergeInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          if (((bitField0_ & 0x00000001) == 0x00000001) &&
+              instanceIdentifierPathArguments_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+            instanceIdentifierPathArguments_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierPathArguments_).mergeFrom(value).buildPartial();
+          } else {
+            instanceIdentifierPathArguments_ = value;
+          }
+          onChanged();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000001;
         return this;
       }
       /**
-       * <code>required string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
       public Builder clearInstanceIdentifierPathArguments() {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+          onChanged();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.clear();
+        }
         bitField0_ = (bitField0_ & ~0x00000001);
-        instanceIdentifierPathArguments_ = getDefaultInstance().getInstanceIdentifierPathArguments();
-        onChanged();
         return this;
       }
       /**
-       * <code>required string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public Builder setInstanceIdentifierPathArgumentsBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-        instanceIdentifierPathArguments_ = value;
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierPathArgumentsBuilder() {
+        bitField0_ |= 0x00000001;
         onChanged();
-        return this;
+        return getInstanceIdentifierPathArgumentsFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() {
+        if (instanceIdentifierPathArgumentsBuilder_ != null) {
+          return instanceIdentifierPathArgumentsBuilder_.getMessageOrBuilder();
+        } else {
+          return instanceIdentifierPathArguments_;
+        }
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> 
+          getInstanceIdentifierPathArgumentsFieldBuilder() {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          instanceIdentifierPathArgumentsBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+                  instanceIdentifierPathArguments_,
+                  getParentForChildren(),
+                  isClean());
+          instanceIdentifierPathArguments_ = null;
+        }
+        return instanceIdentifierPathArgumentsBuilder_;
       }
 
       // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.ReadData)
@@ -3490,19 +3894,19 @@ public final class ShardTransactionMessages {
   public interface ReadDataReplyOrBuilder
       extends com.google.protobuf.MessageOrBuilder {
 
-    // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;
+    // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;
     /**
-     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+     * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
      */
     boolean hasNormalizedNode();
     /**
-     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+     * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
      */
-    org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNode();
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode();
     /**
-     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+     * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
      */
-    org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeOrBuilder();
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder();
   }
   /**
    * Protobuf type {@code org.opendaylight.controller.mdsal.ReadDataReply}
@@ -3556,11 +3960,11 @@ public final class ShardTransactionMessages {
               break;
             }
             case 10: {
-              org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder subBuilder = null;
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null;
               if (((bitField0_ & 0x00000001) == 0x00000001)) {
                 subBuilder = normalizedNode_.toBuilder();
               }
-              normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.PARSER, extensionRegistry);
+              normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry);
               if (subBuilder != null) {
                 subBuilder.mergeFrom(normalizedNode_);
                 normalizedNode_ = subBuilder.buildPartial();
@@ -3608,43 +4012,41 @@ public final class ShardTransactionMessages {
     }
 
     private int bitField0_;
-    // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;
+    // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;
     public static final int NORMALIZEDNODE_FIELD_NUMBER = 1;
-    private org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml normalizedNode_;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_;
     /**
-     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+     * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
      */
     public boolean hasNormalizedNode() {
       return ((bitField0_ & 0x00000001) == 0x00000001);
     }
     /**
-     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+     * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
      */
-    public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNode() {
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
       return normalizedNode_;
     }
     /**
-     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+     * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
      */
-    public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeOrBuilder() {
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
       return normalizedNode_;
     }
 
     private void initFields() {
-      normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+      normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
     }
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
       if (isInitialized != -1) return isInitialized == 1;
 
-      if (!hasNormalizedNode()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      if (!getNormalizedNode().isInitialized()) {
-        memoizedIsInitialized = 0;
-        return false;
+      if (hasNormalizedNode()) {
+        if (!getNormalizedNode().isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
       }
       memoizedIsInitialized = 1;
       return true;
@@ -3787,7 +4189,7 @@ public final class ShardTransactionMessages {
       public Builder clear() {
         super.clear();
         if (normalizedNodeBuilder_ == null) {
-          normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+          normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
         } else {
           normalizedNodeBuilder_.clear();
         }
@@ -3852,13 +4254,11 @@ public final class ShardTransactionMessages {
       }
 
       public final boolean isInitialized() {
-        if (!hasNormalizedNode()) {
-
-          return false;
-        }
-        if (!getNormalizedNode().isInitialized()) {
-
-          return false;
+        if (hasNormalizedNode()) {
+          if (!getNormalizedNode().isInitialized()) {
+            
+            return false;
+          }
         }
         return true;
       }
@@ -3882,20 +4282,20 @@ public final class ShardTransactionMessages {
       }
       private int bitField0_;
 
-      // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;
-      private org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+      // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
       private com.google.protobuf.SingleFieldBuilder<
-          org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder> normalizedNodeBuilder_;
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> normalizedNodeBuilder_;
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
        */
       public boolean hasNormalizedNode() {
         return ((bitField0_ & 0x00000001) == 0x00000001);
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
        */
-      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNode() {
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
         if (normalizedNodeBuilder_ == null) {
           return normalizedNode_;
         } else {
@@ -3903,9 +4303,9 @@ public final class ShardTransactionMessages {
         }
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
        */
-      public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml value) {
+      public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
         if (normalizedNodeBuilder_ == null) {
           if (value == null) {
             throw new NullPointerException();
@@ -3919,10 +4319,10 @@ public final class ShardTransactionMessages {
         return this;
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
        */
       public Builder setNormalizedNode(
-          org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder builderForValue) {
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
         if (normalizedNodeBuilder_ == null) {
           normalizedNode_ = builderForValue.build();
           onChanged();
@@ -3933,14 +4333,14 @@ public final class ShardTransactionMessages {
         return this;
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
        */
-      public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml value) {
+      public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
         if (normalizedNodeBuilder_ == null) {
           if (((bitField0_ & 0x00000001) == 0x00000001) &&
-              normalizedNode_ != org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance()) {
+              normalizedNode_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) {
             normalizedNode_ =
-              org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.newBuilder(normalizedNode_).mergeFrom(value).buildPartial();
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(normalizedNode_).mergeFrom(value).buildPartial();
           } else {
             normalizedNode_ = value;
           }
@@ -3952,11 +4352,11 @@ public final class ShardTransactionMessages {
         return this;
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
        */
       public Builder clearNormalizedNode() {
         if (normalizedNodeBuilder_ == null) {
-          normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+          normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
           onChanged();
         } else {
           normalizedNodeBuilder_.clear();
@@ -3965,17 +4365,17 @@ public final class ShardTransactionMessages {
         return this;
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
        */
-      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder getNormalizedNodeBuilder() {
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getNormalizedNodeBuilder() {
         bitField0_ |= 0x00000001;
         onChanged();
         return getNormalizedNodeFieldBuilder().getBuilder();
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
        */
-      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeOrBuilder() {
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
         if (normalizedNodeBuilder_ != null) {
           return normalizedNodeBuilder_.getMessageOrBuilder();
         } else {
@@ -3983,14 +4383,14 @@ public final class ShardTransactionMessages {
         }
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
        */
       private com.google.protobuf.SingleFieldBuilder<
-          org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder>
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> 
           getNormalizedNodeFieldBuilder() {
         if (normalizedNodeBuilder_ == null) {
           normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
-              org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder>(
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
                   normalizedNode_,
                   getParentForChildren(),
                   isClean());
@@ -4013,39 +4413,33 @@ public final class ShardTransactionMessages {
   public interface WriteDataOrBuilder
       extends com.google.protobuf.MessageOrBuilder {
 
-    // repeated string instanceIdentifierPathArguments = 1;
-    /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
-     */
-    java.util.List<java.lang.String>
-    getInstanceIdentifierPathArgumentsList();
+    // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
      */
-    int getInstanceIdentifierPathArgumentsCount();
+    boolean hasInstanceIdentifierPathArguments();
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
      */
-    java.lang.String getInstanceIdentifierPathArguments(int index);
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments();
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
      */
-    com.google.protobuf.ByteString
-        getInstanceIdentifierPathArgumentsBytes(int index);
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder();
 
-    // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;
+    // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
     /**
-     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+     * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
      */
     boolean hasNormalizedNode();
     /**
-     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+     * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
      */
-    org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNode();
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode();
     /**
-     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+     * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
      */
-    org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeOrBuilder();
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder();
   }
   /**
    * Protobuf type {@code org.opendaylight.controller.mdsal.WriteData}
@@ -4099,24 +4493,29 @@ public final class ShardTransactionMessages {
               break;
             }
             case 10: {
-              if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
-                instanceIdentifierPathArguments_ = new com.google.protobuf.LazyStringArrayList();
-                mutable_bitField0_ |= 0x00000001;
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000001) == 0x00000001)) {
+                subBuilder = instanceIdentifierPathArguments_.toBuilder();
               }
-              instanceIdentifierPathArguments_.add(input.readBytes());
+              instanceIdentifierPathArguments_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(instanceIdentifierPathArguments_);
+                instanceIdentifierPathArguments_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000001;
               break;
             }
             case 18: {
-              org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder subBuilder = null;
-              if (((bitField0_ & 0x00000001) == 0x00000001)) {
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000002) == 0x00000002)) {
                 subBuilder = normalizedNode_.toBuilder();
               }
-              normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.PARSER, extensionRegistry);
+              normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry);
               if (subBuilder != null) {
                 subBuilder.mergeFrom(normalizedNode_);
                 normalizedNode_ = subBuilder.buildPartial();
               }
-              bitField0_ |= 0x00000001;
+              bitField0_ |= 0x00000002;
               break;
             }
           }
@@ -4127,9 +4526,6 @@ public final class ShardTransactionMessages {
         throw new com.google.protobuf.InvalidProtocolBufferException(
             e.getMessage()).setUnfinishedMessage(this);
       } finally {
-        if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
-          instanceIdentifierPathArguments_ = new com.google.protobuf.UnmodifiableLazyStringList(instanceIdentifierPathArguments_);
-        }
         this.unknownFields = unknownFields.build();
         makeExtensionsImmutable();
       }
@@ -4162,71 +4558,71 @@ public final class ShardTransactionMessages {
     }
 
     private int bitField0_;
-    // repeated string instanceIdentifierPathArguments = 1;
+    // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
     public static final int INSTANCEIDENTIFIERPATHARGUMENTS_FIELD_NUMBER = 1;
-    private com.google.protobuf.LazyStringList instanceIdentifierPathArguments_;
-    /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
-     */
-    public java.util.List<java.lang.String>
-        getInstanceIdentifierPathArgumentsList() {
-      return instanceIdentifierPathArguments_;
-    }
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_;
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
      */
-    public int getInstanceIdentifierPathArgumentsCount() {
-      return instanceIdentifierPathArguments_.size();
+    public boolean hasInstanceIdentifierPathArguments() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
     }
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
      */
-    public java.lang.String getInstanceIdentifierPathArguments(int index) {
-      return instanceIdentifierPathArguments_.get(index);
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() {
+      return instanceIdentifierPathArguments_;
     }
     /**
-     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
      */
-    public com.google.protobuf.ByteString
-        getInstanceIdentifierPathArgumentsBytes(int index) {
-      return instanceIdentifierPathArguments_.getByteString(index);
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() {
+      return instanceIdentifierPathArguments_;
     }
 
-    // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;
+    // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
     public static final int NORMALIZEDNODE_FIELD_NUMBER = 2;
-    private org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml normalizedNode_;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_;
     /**
-     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+     * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
      */
     public boolean hasNormalizedNode() {
-      return ((bitField0_ & 0x00000001) == 0x00000001);
+      return ((bitField0_ & 0x00000002) == 0x00000002);
     }
     /**
-     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+     * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
      */
-    public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNode() {
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
       return normalizedNode_;
     }
     /**
-     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+     * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
      */
-    public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeOrBuilder() {
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
       return normalizedNode_;
     }
 
     private void initFields() {
-      instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-      normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+      instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+      normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
     }
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
       if (isInitialized != -1) return isInitialized == 1;
 
+      if (!hasInstanceIdentifierPathArguments()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
       if (!hasNormalizedNode()) {
         memoizedIsInitialized = 0;
         return false;
       }
+      if (!getInstanceIdentifierPathArguments().isInitialized()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
       if (!getNormalizedNode().isInitialized()) {
         memoizedIsInitialized = 0;
         return false;
@@ -4238,10 +4634,10 @@ public final class ShardTransactionMessages {
     public void writeTo(com.google.protobuf.CodedOutputStream output)
                         throws java.io.IOException {
       getSerializedSize();
-      for (int i = 0; i < instanceIdentifierPathArguments_.size(); i++) {
-        output.writeBytes(1, instanceIdentifierPathArguments_.getByteString(i));
-      }
       if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeMessage(1, instanceIdentifierPathArguments_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
         output.writeMessage(2, normalizedNode_);
       }
       getUnknownFields().writeTo(output);
@@ -4253,16 +4649,11 @@ public final class ShardTransactionMessages {
       if (size != -1) return size;
 
       size = 0;
-      {
-        int dataSize = 0;
-        for (int i = 0; i < instanceIdentifierPathArguments_.size(); i++) {
-          dataSize += com.google.protobuf.CodedOutputStream
-            .computeBytesSizeNoTag(instanceIdentifierPathArguments_.getByteString(i));
-        }
-        size += dataSize;
-        size += 1 * getInstanceIdentifierPathArgumentsList().size();
-      }
       if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(1, instanceIdentifierPathArguments_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
         size += com.google.protobuf.CodedOutputStream
           .computeMessageSize(2, normalizedNode_);
       }
@@ -4374,6 +4765,7 @@ public final class ShardTransactionMessages {
       }
       private void maybeForceBuilderInitialization() {
         if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getInstanceIdentifierPathArgumentsFieldBuilder();
           getNormalizedNodeFieldBuilder();
         }
       }
@@ -4383,10 +4775,14 @@ public final class ShardTransactionMessages {
 
       public Builder clear() {
         super.clear();
-        instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.clear();
+        }
         bitField0_ = (bitField0_ & ~0x00000001);
         if (normalizedNodeBuilder_ == null) {
-          normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+          normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
         } else {
           normalizedNodeBuilder_.clear();
         }
@@ -4419,14 +4815,16 @@ public final class ShardTransactionMessages {
         org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData(this);
         int from_bitField0_ = bitField0_;
         int to_bitField0_ = 0;
-        if (((bitField0_ & 0x00000001) == 0x00000001)) {
-          instanceIdentifierPathArguments_ = new com.google.protobuf.UnmodifiableLazyStringList(
-              instanceIdentifierPathArguments_);
-          bitField0_ = (bitField0_ & ~0x00000001);
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
+        } else {
+          result.instanceIdentifierPathArguments_ = instanceIdentifierPathArgumentsBuilder_.build();
         }
-        result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
         if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
-          to_bitField0_ |= 0x00000001;
+          to_bitField0_ |= 0x00000002;
         }
         if (normalizedNodeBuilder_ == null) {
           result.normalizedNode_ = normalizedNode_;
@@ -4449,15 +4847,8 @@ public final class ShardTransactionMessages {
 
       public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData other) {
         if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData.getDefaultInstance()) return this;
-        if (!other.instanceIdentifierPathArguments_.isEmpty()) {
-          if (instanceIdentifierPathArguments_.isEmpty()) {
-            instanceIdentifierPathArguments_ = other.instanceIdentifierPathArguments_;
-            bitField0_ = (bitField0_ & ~0x00000001);
-          } else {
-            ensureInstanceIdentifierPathArgumentsIsMutable();
-            instanceIdentifierPathArguments_.addAll(other.instanceIdentifierPathArguments_);
-          }
-          onChanged();
+        if (other.hasInstanceIdentifierPathArguments()) {
+          mergeInstanceIdentifierPathArguments(other.getInstanceIdentifierPathArguments());
         }
         if (other.hasNormalizedNode()) {
           mergeNormalizedNode(other.getNormalizedNode());
@@ -4467,12 +4858,20 @@ public final class ShardTransactionMessages {
       }
 
       public final boolean isInitialized() {
+        if (!hasInstanceIdentifierPathArguments()) {
+          
+          return false;
+        }
         if (!hasNormalizedNode()) {
-
+          
+          return false;
+        }
+        if (!getInstanceIdentifierPathArguments().isInitialized()) {
+          
           return false;
         }
         if (!getNormalizedNode().isInitialized()) {
-
+          
           return false;
         }
         return true;
@@ -4497,113 +4896,1177 @@ public final class ShardTransactionMessages {
       }
       private int bitField0_;
 
-      // repeated string instanceIdentifierPathArguments = 1;
-      private com.google.protobuf.LazyStringList instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-      private void ensureInstanceIdentifierPathArgumentsIsMutable() {
-        if (!((bitField0_ & 0x00000001) == 0x00000001)) {
-          instanceIdentifierPathArguments_ = new com.google.protobuf.LazyStringArrayList(instanceIdentifierPathArguments_);
-          bitField0_ |= 0x00000001;
-         }
-      }
+      // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierPathArgumentsBuilder_;
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public java.util.List<java.lang.String>
-          getInstanceIdentifierPathArgumentsList() {
-        return java.util.Collections.unmodifiableList(instanceIdentifierPathArguments_);
+      public boolean hasInstanceIdentifierPathArguments() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public int getInstanceIdentifierPathArgumentsCount() {
-        return instanceIdentifierPathArguments_.size();
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          return instanceIdentifierPathArguments_;
+        } else {
+          return instanceIdentifierPathArgumentsBuilder_.getMessage();
+        }
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public java.lang.String getInstanceIdentifierPathArguments(int index) {
-        return instanceIdentifierPathArguments_.get(index);
+      public Builder setInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          instanceIdentifierPathArguments_ = value;
+          onChanged();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000001;
+        return this;
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public com.google.protobuf.ByteString
-          getInstanceIdentifierPathArgumentsBytes(int index) {
-        return instanceIdentifierPathArguments_.getByteString(index);
-      }
+      public Builder setInstanceIdentifierPathArguments(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          instanceIdentifierPathArguments_ = builderForValue.build();
+          onChanged();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000001;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder mergeInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          if (((bitField0_ & 0x00000001) == 0x00000001) &&
+              instanceIdentifierPathArguments_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+            instanceIdentifierPathArguments_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierPathArguments_).mergeFrom(value).buildPartial();
+          } else {
+            instanceIdentifierPathArguments_ = value;
+          }
+          onChanged();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000001;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder clearInstanceIdentifierPathArguments() {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+          onChanged();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000001);
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierPathArgumentsBuilder() {
+        bitField0_ |= 0x00000001;
+        onChanged();
+        return getInstanceIdentifierPathArgumentsFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() {
+        if (instanceIdentifierPathArgumentsBuilder_ != null) {
+          return instanceIdentifierPathArgumentsBuilder_.getMessageOrBuilder();
+        } else {
+          return instanceIdentifierPathArguments_;
+        }
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> 
+          getInstanceIdentifierPathArgumentsFieldBuilder() {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          instanceIdentifierPathArgumentsBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+                  instanceIdentifierPathArguments_,
+                  getParentForChildren(),
+                  isClean());
+          instanceIdentifierPathArguments_ = null;
+        }
+        return instanceIdentifierPathArgumentsBuilder_;
+      }
+
+      // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> normalizedNodeBuilder_;
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public boolean hasNormalizedNode() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
+        if (normalizedNodeBuilder_ == null) {
+          return normalizedNode_;
+        } else {
+          return normalizedNodeBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+        if (normalizedNodeBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          normalizedNode_ = value;
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000002;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public Builder setNormalizedNode(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
+        if (normalizedNodeBuilder_ == null) {
+          normalizedNode_ = builderForValue.build();
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000002;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
+        if (normalizedNodeBuilder_ == null) {
+          if (((bitField0_ & 0x00000002) == 0x00000002) &&
+              normalizedNode_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) {
+            normalizedNode_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(normalizedNode_).mergeFrom(value).buildPartial();
+          } else {
+            normalizedNode_ = value;
+          }
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000002;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public Builder clearNormalizedNode() {
+        if (normalizedNodeBuilder_ == null) {
+          normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000002);
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getNormalizedNodeBuilder() {
+        bitField0_ |= 0x00000002;
+        onChanged();
+        return getNormalizedNodeFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
+        if (normalizedNodeBuilder_ != null) {
+          return normalizedNodeBuilder_.getMessageOrBuilder();
+        } else {
+          return normalizedNode_;
+        }
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> 
+          getNormalizedNodeFieldBuilder() {
+        if (normalizedNodeBuilder_ == null) {
+          normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
+                  normalizedNode_,
+                  getParentForChildren(),
+                  isClean());
+          normalizedNode_ = null;
+        }
+        return normalizedNodeBuilder_;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.WriteData)
+    }
+
+    static {
+      defaultInstance = new WriteData(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.WriteData)
+  }
+
+  public interface WriteDataReplyOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.WriteDataReply}
+   */
+  public static final class WriteDataReply extends
+      com.google.protobuf.GeneratedMessage
+      implements WriteDataReplyOrBuilder {
+    // Use WriteDataReply.newBuilder() to construct.
+    private WriteDataReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private WriteDataReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final WriteDataReply defaultInstance;
+    public static WriteDataReply getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public WriteDataReply getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private WriteDataReply(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<WriteDataReply> PARSER =
+        new com.google.protobuf.AbstractParser<WriteDataReply>() {
+      public WriteDataReply parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new WriteDataReply(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<WriteDataReply> getParserForType() {
+      return PARSER;
+    }
+
+    private void initFields() {
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.WriteDataReply}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReplyOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply build() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply buildPartial() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply(this);
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply other) {
+        if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.getDefaultInstance()) return this;
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.WriteDataReply)
+    }
+
+    static {
+      defaultInstance = new WriteDataReply(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.WriteDataReply)
+  }
+
+  public interface MergeDataOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+     */
+    boolean hasInstanceIdentifierPathArguments();
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments();
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder();
+
+    // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+     */
+    boolean hasNormalizedNode();
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode();
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.MergeData}
+   */
+  public static final class MergeData extends
+      com.google.protobuf.GeneratedMessage
+      implements MergeDataOrBuilder {
+    // Use MergeData.newBuilder() to construct.
+    private MergeData(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private MergeData(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final MergeData defaultInstance;
+    public static MergeData getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public MergeData getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private MergeData(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000001) == 0x00000001)) {
+                subBuilder = instanceIdentifierPathArguments_.toBuilder();
+              }
+              instanceIdentifierPathArguments_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(instanceIdentifierPathArguments_);
+                instanceIdentifierPathArguments_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000001;
+              break;
+            }
+            case 18: {
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000002) == 0x00000002)) {
+                subBuilder = normalizedNode_.toBuilder();
+              }
+              normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(normalizedNode_);
+                normalizedNode_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000002;
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeData_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeData_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<MergeData> PARSER =
+        new com.google.protobuf.AbstractParser<MergeData>() {
+      public MergeData parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new MergeData(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<MergeData> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
+    public static final int INSTANCEIDENTIFIERPATHARGUMENTS_FIELD_NUMBER = 1;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_;
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+     */
+    public boolean hasInstanceIdentifierPathArguments() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() {
+      return instanceIdentifierPathArguments_;
+    }
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() {
+      return instanceIdentifierPathArguments_;
+    }
+
+    // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+    public static final int NORMALIZEDNODE_FIELD_NUMBER = 2;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_;
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+     */
+    public boolean hasNormalizedNode() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
+      return normalizedNode_;
+    }
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
+      return normalizedNode_;
+    }
+
+    private void initFields() {
+      instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+      normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasInstanceIdentifierPathArguments()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (!hasNormalizedNode()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (!getInstanceIdentifierPathArguments().isInitialized()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (!getNormalizedNode().isInitialized()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeMessage(1, instanceIdentifierPathArguments_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeMessage(2, normalizedNode_);
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      if (size != -1) return size;
+
+      size = 0;
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(1, instanceIdentifierPathArguments_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(2, normalizedNode_);
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData prototype) {
+      return newBuilder().mergeFrom(prototype);
+    }
+    public Builder toBuilder() { return newBuilder(this); }
+
+    @java.lang.Override
+    protected Builder newBuilderForType(
+        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+      Builder builder = new Builder(parent);
+      return builder;
+    }
+    /**
+     * Protobuf type {@code org.opendaylight.controller.mdsal.MergeData}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeData_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeData_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getInstanceIdentifierPathArgumentsFieldBuilder();
+          getNormalizedNodeFieldBuilder();
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000001);
+        if (normalizedNodeBuilder_ == null) {
+          normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
+        } else {
+          normalizedNodeBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000002);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeData_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData build() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData buildPartial() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
+        } else {
+          result.instanceIdentifierPathArguments_ = instanceIdentifierPathArgumentsBuilder_.build();
+        }
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        if (normalizedNodeBuilder_ == null) {
+          result.normalizedNode_ = normalizedNode_;
+        } else {
+          result.normalizedNode_ = normalizedNodeBuilder_.build();
+        }
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData other) {
+        if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData.getDefaultInstance()) return this;
+        if (other.hasInstanceIdentifierPathArguments()) {
+          mergeInstanceIdentifierPathArguments(other.getInstanceIdentifierPathArguments());
+        }
+        if (other.hasNormalizedNode()) {
+          mergeNormalizedNode(other.getNormalizedNode());
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasInstanceIdentifierPathArguments()) {
+          
+          return false;
+        }
+        if (!hasNormalizedNode()) {
+          
+          return false;
+        }
+        if (!getInstanceIdentifierPathArguments().isInitialized()) {
+          
+          return false;
+        }
+        if (!getNormalizedNode().isInitialized()) {
+          
+          return false;
+        }
+        return true;
+      }
+
+      public Builder mergeFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws java.io.IOException {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierPathArgumentsBuilder_;
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public Builder setInstanceIdentifierPathArguments(
-          int index, java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  ensureInstanceIdentifierPathArgumentsIsMutable();
-        instanceIdentifierPathArguments_.set(index, value);
-        onChanged();
+      public boolean hasInstanceIdentifierPathArguments() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          return instanceIdentifierPathArguments_;
+        } else {
+          return instanceIdentifierPathArgumentsBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder setInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          instanceIdentifierPathArguments_ = value;
+          onChanged();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000001;
         return this;
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public Builder addInstanceIdentifierPathArguments(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  ensureInstanceIdentifierPathArgumentsIsMutable();
-        instanceIdentifierPathArguments_.add(value);
-        onChanged();
+      public Builder setInstanceIdentifierPathArguments(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          instanceIdentifierPathArguments_ = builderForValue.build();
+          onChanged();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000001;
         return this;
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public Builder addAllInstanceIdentifierPathArguments(
-          java.lang.Iterable<java.lang.String> values) {
-        ensureInstanceIdentifierPathArgumentsIsMutable();
-        super.addAll(values, instanceIdentifierPathArguments_);
-        onChanged();
+      public Builder mergeInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          if (((bitField0_ & 0x00000001) == 0x00000001) &&
+              instanceIdentifierPathArguments_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+            instanceIdentifierPathArguments_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierPathArguments_).mergeFrom(value).buildPartial();
+          } else {
+            instanceIdentifierPathArguments_ = value;
+          }
+          onChanged();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000001;
         return this;
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
       public Builder clearInstanceIdentifierPathArguments() {
-        instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+          onChanged();
+        } else {
+          instanceIdentifierPathArgumentsBuilder_.clear();
+        }
         bitField0_ = (bitField0_ & ~0x00000001);
-        onChanged();
         return this;
       }
       /**
-       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
-      public Builder addInstanceIdentifierPathArgumentsBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  ensureInstanceIdentifierPathArgumentsIsMutable();
-        instanceIdentifierPathArguments_.add(value);
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierPathArgumentsBuilder() {
+        bitField0_ |= 0x00000001;
         onChanged();
-        return this;
+        return getInstanceIdentifierPathArgumentsFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() {
+        if (instanceIdentifierPathArgumentsBuilder_ != null) {
+          return instanceIdentifierPathArgumentsBuilder_.getMessageOrBuilder();
+        } else {
+          return instanceIdentifierPathArguments_;
+        }
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> 
+          getInstanceIdentifierPathArgumentsFieldBuilder() {
+        if (instanceIdentifierPathArgumentsBuilder_ == null) {
+          instanceIdentifierPathArgumentsBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+                  instanceIdentifierPathArguments_,
+                  getParentForChildren(),
+                  isClean());
+          instanceIdentifierPathArguments_ = null;
+        }
+        return instanceIdentifierPathArgumentsBuilder_;
       }
 
-      // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;
-      private org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+      // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
       private com.google.protobuf.SingleFieldBuilder<
-          org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder> normalizedNodeBuilder_;
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> normalizedNodeBuilder_;
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+       * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
        */
       public boolean hasNormalizedNode() {
         return ((bitField0_ & 0x00000002) == 0x00000002);
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+       * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
        */
-      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNode() {
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() {
         if (normalizedNodeBuilder_ == null) {
           return normalizedNode_;
         } else {
@@ -4611,9 +6074,9 @@ public final class ShardTransactionMessages {
         }
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+       * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
        */
-      public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml value) {
+      public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
         if (normalizedNodeBuilder_ == null) {
           if (value == null) {
             throw new NullPointerException();
@@ -4627,10 +6090,10 @@ public final class ShardTransactionMessages {
         return this;
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+       * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
        */
       public Builder setNormalizedNode(
-          org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder builderForValue) {
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
         if (normalizedNodeBuilder_ == null) {
           normalizedNode_ = builderForValue.build();
           onChanged();
@@ -4641,14 +6104,14 @@ public final class ShardTransactionMessages {
         return this;
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+       * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
        */
-      public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml value) {
+      public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
         if (normalizedNodeBuilder_ == null) {
           if (((bitField0_ & 0x00000002) == 0x00000002) &&
-              normalizedNode_ != org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance()) {
+              normalizedNode_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) {
             normalizedNode_ =
-              org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.newBuilder(normalizedNode_).mergeFrom(value).buildPartial();
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(normalizedNode_).mergeFrom(value).buildPartial();
           } else {
             normalizedNode_ = value;
           }
@@ -4660,11 +6123,11 @@ public final class ShardTransactionMessages {
         return this;
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+       * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
        */
       public Builder clearNormalizedNode() {
         if (normalizedNodeBuilder_ == null) {
-          normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+          normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance();
           onChanged();
         } else {
           normalizedNodeBuilder_.clear();
@@ -4673,17 +6136,17 @@ public final class ShardTransactionMessages {
         return this;
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+       * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
        */
-      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder getNormalizedNodeBuilder() {
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getNormalizedNodeBuilder() {
         bitField0_ |= 0x00000002;
         onChanged();
         return getNormalizedNodeFieldBuilder().getBuilder();
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+       * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
        */
-      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeOrBuilder() {
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() {
         if (normalizedNodeBuilder_ != null) {
           return normalizedNodeBuilder_.getMessageOrBuilder();
         } else {
@@ -4691,14 +6154,14 @@ public final class ShardTransactionMessages {
         }
       }
       /**
-       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+       * <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
        */
       private com.google.protobuf.SingleFieldBuilder<
-          org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder>
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> 
           getNormalizedNodeFieldBuilder() {
         if (normalizedNodeBuilder_ == null) {
           normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
-              org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder>(
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
                   normalizedNode_,
                   getParentForChildren(),
                   isClean());
@@ -4707,39 +6170,39 @@ public final class ShardTransactionMessages {
         return normalizedNodeBuilder_;
       }
 
-      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.WriteData)
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.MergeData)
     }
 
     static {
-      defaultInstance = new WriteData(true);
+      defaultInstance = new MergeData(true);
       defaultInstance.initFields();
     }
 
-    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.WriteData)
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.MergeData)
   }
 
-  public interface WriteDataReplyOrBuilder
+  public interface MergeDataReplyOrBuilder
       extends com.google.protobuf.MessageOrBuilder {
   }
   /**
-   * Protobuf type {@code org.opendaylight.controller.mdsal.WriteDataReply}
+   * Protobuf type {@code org.opendaylight.controller.mdsal.MergeDataReply}
    */
-  public static final class WriteDataReply extends
+  public static final class MergeDataReply extends
       com.google.protobuf.GeneratedMessage
-      implements WriteDataReplyOrBuilder {
-    // Use WriteDataReply.newBuilder() to construct.
-    private WriteDataReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      implements MergeDataReplyOrBuilder {
+    // Use MergeDataReply.newBuilder() to construct.
+    private MergeDataReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
       super(builder);
       this.unknownFields = builder.getUnknownFields();
     }
-    private WriteDataReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+    private MergeDataReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
 
-    private static final WriteDataReply defaultInstance;
-    public static WriteDataReply getDefaultInstance() {
+    private static final MergeDataReply defaultInstance;
+    public static MergeDataReply getDefaultInstance() {
       return defaultInstance;
     }
 
-    public WriteDataReply getDefaultInstanceForType() {
+    public MergeDataReply getDefaultInstanceForType() {
       return defaultInstance;
     }
 
@@ -4749,7 +6212,7 @@ public final class ShardTransactionMessages {
         getUnknownFields() {
       return this.unknownFields;
     }
-    private WriteDataReply(
+    private MergeDataReply(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
@@ -4785,28 +6248,28 @@ public final class ShardTransactionMessages {
     }
     public static final com.google.protobuf.Descriptors.Descriptor
         getDescriptor() {
-      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_descriptor;
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeDataReply_descriptor;
     }
 
     protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
         internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_fieldAccessorTable
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeDataReply_fieldAccessorTable
           .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.Builder.class);
+              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply.Builder.class);
     }
 
-    public static com.google.protobuf.Parser<WriteDataReply> PARSER =
-        new com.google.protobuf.AbstractParser<WriteDataReply>() {
-      public WriteDataReply parsePartialFrom(
+    public static com.google.protobuf.Parser<MergeDataReply> PARSER =
+        new com.google.protobuf.AbstractParser<MergeDataReply>() {
+      public MergeDataReply parsePartialFrom(
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws com.google.protobuf.InvalidProtocolBufferException {
-        return new WriteDataReply(input, extensionRegistry);
+        return new MergeDataReply(input, extensionRegistry);
       }
     };
 
     @java.lang.Override
-    public com.google.protobuf.Parser<WriteDataReply> getParserForType() {
+    public com.google.protobuf.Parser<MergeDataReply> getParserForType() {
       return PARSER;
     }
 
@@ -4845,53 +6308,53 @@ public final class ShardTransactionMessages {
       return super.writeReplace();
     }
 
-    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseFrom(
         com.google.protobuf.ByteString data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseFrom(
         com.google.protobuf.ByteString data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data, extensionRegistry);
     }
-    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(byte[] data)
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseFrom(byte[] data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseFrom(
         byte[] data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data, extensionRegistry);
     }
-    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseFrom(
         java.io.InputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
       return PARSER.parseFrom(input, extensionRegistry);
     }
-    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseDelimitedFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseDelimitedFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseDelimitedFrom(input);
     }
-    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseDelimitedFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseDelimitedFrom(
         java.io.InputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
       return PARSER.parseDelimitedFrom(input, extensionRegistry);
     }
-    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseFrom(
         com.google.protobuf.CodedInputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parseFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
@@ -4900,7 +6363,7 @@ public final class ShardTransactionMessages {
 
     public static Builder newBuilder() { return Builder.create(); }
     public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply prototype) {
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply prototype) {
       return newBuilder().mergeFrom(prototype);
     }
     public Builder toBuilder() { return newBuilder(this); }
@@ -4912,24 +6375,24 @@ public final class ShardTransactionMessages {
       return builder;
     }
     /**
-     * Protobuf type {@code org.opendaylight.controller.mdsal.WriteDataReply}
+     * Protobuf type {@code org.opendaylight.controller.mdsal.MergeDataReply}
      */
     public static final class Builder extends
         com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReplyOrBuilder {
+       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReplyOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
-        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_descriptor;
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeDataReply_descriptor;
       }
 
       protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
           internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_fieldAccessorTable
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeDataReply_fieldAccessorTable
             .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.Builder.class);
+                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply.Builder.class);
       }
 
-      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.newBuilder()
+      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply.newBuilder()
       private Builder() {
         maybeForceBuilderInitialization();
       }
@@ -4958,38 +6421,38 @@ public final class ShardTransactionMessages {
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
-        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteDataReply_descriptor;
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_MergeDataReply_descriptor;
       }
 
-      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply getDefaultInstanceForType() {
-        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.getDefaultInstance();
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply.getDefaultInstance();
       }
 
-      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply build() {
-        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply result = buildPartial();
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply build() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply result = buildPartial();
         if (!result.isInitialized()) {
           throw newUninitializedMessageException(result);
         }
         return result;
       }
 
-      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply buildPartial() {
-        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply(this);
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply buildPartial() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply(this);
         onBuilt();
         return result;
       }
 
       public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply) {
-          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply)other);
+        if (other instanceof org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply)other);
         } else {
           super.mergeFrom(other);
           return this;
         }
       }
 
-      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply other) {
-        if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply.getDefaultInstance()) return this;
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply other) {
+        if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply.getDefaultInstance()) return this;
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
@@ -5002,11 +6465,11 @@ public final class ShardTransactionMessages {
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
-        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply parsedMessage = null;
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply parsedMessage = null;
         try {
           parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
         } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataReply) e.getUnfinishedMessage();
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeDataReply) e.getUnfinishedMessage();
           throw e;
         } finally {
           if (parsedMessage != null) {
@@ -5016,15 +6479,15 @@ public final class ShardTransactionMessages {
         return this;
       }
 
-      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.WriteDataReply)
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.MergeDataReply)
     }
 
     static {
-      defaultInstance = new WriteDataReply(true);
+      defaultInstance = new MergeDataReply(true);
       defaultInstance.initFields();
     }
 
-    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.WriteDataReply)
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.MergeDataReply)
   }
 
   private static com.google.protobuf.Descriptors.Descriptor
@@ -5087,6 +6550,16 @@ public final class ShardTransactionMessages {
   private static
     com.google.protobuf.GeneratedMessage.FieldAccessorTable
       internal_static_org_opendaylight_controller_mdsal_WriteDataReply_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_MergeData_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_MergeData_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_MergeDataReply_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_MergeDataReply_fieldAccessorTable;
 
   public static com.google.protobuf.Descriptors.FileDescriptor
       getDescriptor() {
@@ -5097,24 +6570,33 @@ public final class ShardTransactionMessages {
   static {
     java.lang.String[] descriptorData = {
       "\n\026ShardTransaction.proto\022!org.opendaylig" +
-      "ht.controller.mdsal\032\032SimpleNormalizedNod" +
-      "e.proto\"\022\n\020CloseTransaction\"\027\n\025CloseTran" +
-      "sactionReply\"\023\n\021CreateTransaction\"1\n\026Cre" +
-      "ateTransactionReply\022\027\n\017transactionPath\030\001" +
-      " \002(\t\"\022\n\020ReadyTransaction\"*\n\025ReadyTransac" +
-      "tionReply\022\021\n\tactorPath\030\001 \002(\t\"5\n\nDeleteDa" +
-      "ta\022\'\n\037instanceIdentifierPathArguments\030\001 " +
-      "\003(\t\"\021\n\017DeleteDataReply\"3\n\010ReadData\022\'\n\037in" +
-      "stanceIdentifierPathArguments\030\001 \002(\t\"]\n\rR",
-      "eadDataReply\022L\n\016normalizedNode\030\001 \002(\01324.o" +
-      "rg.opendaylight.controller.mdsal.Normali" +
-      "zedNodeXml\"\202\001\n\tWriteData\022\'\n\037instanceIden" +
-      "tifierPathArguments\030\001 \003(\t\022L\n\016normalizedN" +
-      "ode\030\002 \002(\01324.org.opendaylight.controller." +
-      "mdsal.NormalizedNodeXml\"\020\n\016WriteDataRepl" +
-      "yBV\n:org.opendaylight.controller.protobu" +
-      "ff.messages.transactionB\030ShardTransactio" +
-      "nMessages"
+      "ht.controller.mdsal\032\014Common.proto\"\022\n\020Clo" +
+      "seTransaction\"\027\n\025CloseTransactionReply\"*" +
+      "\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" +
+      "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"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -5138,13 +6620,13 @@ 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[] { });
+              new java.lang.String[] { "TransactionId", });
           internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor =
             getDescriptor().getMessageTypes().get(3);
           internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor,
-              new java.lang.String[] { "TransactionPath", });
+              new java.lang.String[] { "TransactionActorPath", "TransactionId", });
           internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_descriptor =
             getDescriptor().getMessageTypes().get(4);
           internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_fieldAccessorTable = new
@@ -5193,13 +6675,25 @@ public final class ShardTransactionMessages {
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_org_opendaylight_controller_mdsal_WriteDataReply_descriptor,
               new java.lang.String[] { });
+          internal_static_org_opendaylight_controller_mdsal_MergeData_descriptor =
+            getDescriptor().getMessageTypes().get(12);
+          internal_static_org_opendaylight_controller_mdsal_MergeData_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_MergeData_descriptor,
+              new java.lang.String[] { "InstanceIdentifierPathArguments", "NormalizedNode", });
+          internal_static_org_opendaylight_controller_mdsal_MergeDataReply_descriptor =
+            getDescriptor().getMessageTypes().get(13);
+          internal_static_org_opendaylight_controller_mdsal_MergeDataReply_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_MergeDataReply_descriptor,
+              new java.lang.String[] { });
           return null;
         }
       };
     com.google.protobuf.Descriptors.FileDescriptor
       .internalBuildGeneratedFileFrom(descriptorData,
         new com.google.protobuf.Descriptors.FileDescriptor[] {
-          org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.getDescriptor(),
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.getDescriptor(),
         }, assigner);
   }
 
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Cohort.proto b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Cohort.proto
new file mode 100644 (file)
index 0000000..dab6413
--- /dev/null
@@ -0,0 +1,37 @@
+package org.opendaylight.controller.mdsal;
+
+option java_package = "org.opendaylight.controller.protobuff.messages.cohort3pc";
+option java_outer_classname = "ThreePhaseCommitCohortMessages";
+
+
+message CanCommitTransaction{
+
+}
+
+message CanCommitTransactionReply{
+  required bool canCommit = 1;
+
+}
+
+message AbortTransaction{
+
+}
+
+message AbortTransactionReply {
+
+}
+
+message CommitTransaction{
+
+}
+
+message CommitTransactionReply{
+
+}
+
+message PreCommitTransaction{
+
+}
+message PreCommitTransactionReply{
+
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Common.proto b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Common.proto
new file mode 100644 (file)
index 0000000..59d78dd
--- /dev/null
@@ -0,0 +1,52 @@
+package org.opendaylight.controller.mdsal;
+
+option java_package = "org.opendaylight.controller.protobuff.messages.common";
+option java_outer_classname = "NormalizedNodeMessages";
+
+
+message Attribute{
+  required string name =1;
+  optional string value=2;
+  optional string type=3;
+}
+
+message QName {
+    required string value=1;
+}
+
+message PathArgument {
+  required string value=1;
+  optional string type=2; //NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+  optional QName nodeType=3;
+  repeated Attribute attributes=4;
+
+}
+
+message InstanceIdentifier {
+  repeated PathArgument arguments=1;
+}
+
+message Node{
+  optional string path = 1;
+  optional string type = 2;
+  repeated Attribute attributes = 3;
+  repeated Node child=4;
+  optional string value = 5;
+  optional string valueType = 6;
+  repeated string bitsValue = 7;
+  optional InstanceIdentifier instanceIdentifierValue = 8;
+}
+
+message Container{
+  required string parentPath =1 ;
+  optional Node normalizedNode=2;
+}
+
+message NodeMapEntry{
+  required InstanceIdentifier instanceIdentifierPath =1;
+  optional Node normalizedNode=2;
+}
+
+message NodeMap{
+repeated NodeMapEntry mapEntries=1;
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/CompositeModificationPayload.proto b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/CompositeModificationPayload.proto
new file mode 100644 (file)
index 0000000..b571cd2
--- /dev/null
@@ -0,0 +1,11 @@
+package org.opendaylight.controller.mdsal;
+
+import "AppendEntriesMessages.proto";
+import "Common.proto";
+import "Persistent.proto";
+
+extend org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload {
+    optional CompositeModification modification=2;
+}
+
+
index f50c36f684366277588b737e57066689f772d705..e4ba800730cda5d5668792613244d8caf906f1c2 100644 (file)
@@ -1,14 +1,19 @@
 package org.opendaylight.controller.mdsal;
 
-import "SimpleNormalizedNode.proto";
+import "Common.proto";
 
 option java_package = "org.opendaylight.controller.protobuff.messages.datachange.notification";
 option java_outer_classname = "DataChangeListenerMessages";
 
-message DataChanged{
-  repeated string instanceIdentifierPathArguments =1 ;
-  required NormalizedNodeXml normalizedNodeXml = 2;
+message DataChanged {
+  optional Node originalSubTree = 1;
+  optional Node updatedSubTree = 2;
+  optional NodeMap originalData =3;
+  optional NodeMap updatedData =4;
+  optional NodeMap createdData =5;
+  repeated InstanceIdentifier removedPaths  =6;
 }
+
 message DataChangedReply{
 
-}
\ No newline at end of file
+}
index 27f3c232e726e2c3ae96d338a727717c4e771e8f..3342a1364abba61a87dae70190859d7908c4e1d0 100644 (file)
@@ -1,13 +1,40 @@
 package org.opendaylight.controller.mdsal;
 
+import "Common.proto";
+
 option java_package = "org.opendaylight.controller.protobuff.messages.registration";
 option java_outer_classname = "ListenerRegistrationMessages";
 
-message Close {
+/** used when a listener needs to be unregistered*/
+message CloseDataChangeListenerRegistration {
+
+}
+/** reply to the CloseDataChangeListenerRegistration request*/
+message CloseDataChangeListenerRegistrationReply{
 
 }
 
-message CloseReply{
+/**
+ * When registering a listener at particular level of tree
+ * identified by instanceIdentifierPath.
+ * dataChangeListenerActorPath is path to actor that will
+ * receive the change event
+ * scope is the data change scope like BASE,ONE and SUBTREE
+ * defined in AsyncDataBroker.DataChangeScope
+ */
+
+message RegisterChangeListener{
+required InstanceIdentifier instanceIdentifierPath=1;
+required string dataChangeListenerActorPath=2;
+required int32 dataChangeScope=3;
+}
+/**
+* This is the reply for the RegisterChangeListener message
+* It contains the listenerRegistration actor path
+* that can be used to unregister the listener
+*/
+message RegisterChangeListenerReply{
+required string listenerRegistrationPath=1;
 
 }
 
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Persistent.proto b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Persistent.proto
new file mode 100644 (file)
index 0000000..8e83449
--- /dev/null
@@ -0,0 +1,20 @@
+package org.opendaylight.controller.mdsal;
+
+import "Common.proto";
+import "AppendEntriesMessages.proto";
+
+option java_package = "org.opendaylight.controller.protobuff.messages.persistent";
+option java_outer_classname = "PersistentMessages";
+
+
+message Modification {
+    required string type=1;
+    required InstanceIdentifier path=2;
+    optional Node data=3;
+}
+
+
+message CompositeModification {
+    repeated Modification modification=1;
+}
+
index c86fde0c72dea6cb2f20f652794c19eb44478b80..abd6fcc109447be6cdb9360f3ac2a12ddef2af7e 100644 (file)
@@ -8,7 +8,9 @@ message FindPrimary {
 }
 
 message PrimaryFound {
+  required string primaryPath =1;
 }
 
 message PrimaryNotFound {
+  required string shardName =1;
 }
index 120913eb66f71ea854487c2f06e68b83ae19229e..9684b7d72f57679ad069f31320bf00f0e989380c 100644 (file)
@@ -1,5 +1,7 @@
 package org.opendaylight.controller.mdsal;
-import "SimpleNormalizedNode.proto";
+
+import "Common.proto";
+
 option java_package = "org.opendaylight.controller.protobuff.messages.transaction";
 option java_outer_classname = "ShardTransactionMessages";
 
@@ -11,11 +13,12 @@ message CloseTransactionReply{
 }
 
 message CreateTransaction{
-
+  required string transactionId = 1;
 }
 
 message CreateTransactionReply{
-required string transactionPath = 1;
+required string transactionActorPath = 1;
+required string transactionId = 2;
 
 }
 
@@ -28,26 +31,36 @@ required string actorPath = 1;
 }
 
 message DeleteData {
-repeated string instanceIdentifierPathArguments = 1;
+required InstanceIdentifier instanceIdentifierPathArguments = 1;
 }
 
 message DeleteDataReply{
 
 }
 message ReadData {
-required string instanceIdentifierPathArguments=1;
+required InstanceIdentifier instanceIdentifierPathArguments=1;
 }
 
 message ReadDataReply{
-  required NormalizedNodeXml normalizedNode=1;
+  optional Node normalizedNode=1;
 }
 
 message WriteData {
- repeated string instanceIdentifierPathArguments = 1;
-required NormalizedNodeXml normalizedNode =2;
+ required InstanceIdentifier instanceIdentifierPathArguments = 1;
+required Node normalizedNode =2;
 
 }
 
 message WriteDataReply{
 
-}
\ No newline at end of file
+}
+
+message MergeData {
+ required InstanceIdentifier instanceIdentifierPathArguments = 1;
+required Node normalizedNode =2;
+
+}
+
+message MergeDataReply{
+
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java
new file mode 100644 (file)
index 0000000..4ccbc97
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ * 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.node;
+
+import junit.framework.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.node.utils.NodeIdentifierFactory;
+import org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeGetter;
+import org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeNavigator;
+import org.opendaylight.controller.cluster.datastore.util.TestModel;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
+public class NormalizedNodeToNodeCodecTest {
+
+
+
+    private SchemaContext schemaContext;
+
+    @Before
+    public void setUp(){
+        schemaContext = TestModel.createTestContext();
+        assertNotNull("Schema context must not be null.", schemaContext);
+    }
+
+    private YangInstanceIdentifier instanceIdentifierFromString(String s){
+
+        String[] ids = s.split("/");
+
+        List<YangInstanceIdentifier.PathArgument> pathArguments = new ArrayList<>();
+        for(String nodeId : ids){
+            if(!"".equals(nodeId)) {
+                pathArguments.add(NodeIdentifierFactory.getArgument(nodeId));
+            }
+        }
+        final YangInstanceIdentifier instanceIdentifier = YangInstanceIdentifier.create(pathArguments);
+        return instanceIdentifier;
+    }
+
+
+    @Test
+    public void testNormalizeNodeAttributesToProtoBuffNode(){
+        final NormalizedNode<?, ?> documentOne = TestModel.createTestContainer();
+        String id = "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test" +
+            "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)outer-list" +
+            "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)outer-list[{(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id=2}]" +
+            "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id";
+
+        NormalizedNodeGetter normalizedNodeGetter = new NormalizedNodeGetter(id);
+        new NormalizedNodeNavigator(normalizedNodeGetter).navigate(
+            YangInstanceIdentifier.builder().build().toString(), documentOne);
+
+        // Validate the value of id can be retrieved from the normalized node
+        NormalizedNode output = normalizedNodeGetter.getOutput();
+        assertNotNull(output);
+
+
+      NormalizedNodeToNodeCodec codec = new NormalizedNodeToNodeCodec(schemaContext);
+      Container container = codec.encode(instanceIdentifierFromString(id),output);
+
+       assertNotNull(container);
+       assertEquals(id, container.getParentPath()+"/"+container.getNormalizedNode().getPath()) ;
+
+      // Decode the normalized node from the ProtocolBuffer form
+      //first get the node representation of normalized node
+      final Node node = container.getNormalizedNode();
+
+      NormalizedNode<?,?> normalizedNode = codec.decode(instanceIdentifierFromString(id),node);
+
+      assertEquals(normalizedNode.getValue().toString(),output.getValue().toString());
+    }
+
+    @Test
+    public void testThatANormalizedNodeToProtoBuffNodeEncodeDecode() throws Exception {
+        final NormalizedNode<?, ?> documentOne = TestModel.createTestContainer();
+
+        final NormalizedNodeToNodeCodec normalizedNodeToNodeCodec = new NormalizedNodeToNodeCodec(schemaContext);
+
+        Container container = normalizedNodeToNodeCodec.encode(YangInstanceIdentifier.builder().build(), documentOne);
+
+
+        final NormalizedNode<?, ?> decode = normalizedNodeToNodeCodec.decode(instanceIdentifierFromString("/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test"),container.getNormalizedNode());
+        assertNotNull(decode != null);
+
+        //let us ensure that the return decode normalized node encode returns same container
+        Container containerResult =  normalizedNodeToNodeCodec.encode(YangInstanceIdentifier.builder().build(), decode);
+
+        assertEquals(container.getParentPath(),containerResult.getParentPath());
+        assertEquals(container.getNormalizedNode().getChildCount(),container.getNormalizedNode().getChildCount());
+
+        Assert.assertEquals(containerResult.getNormalizedNode().getChildCount(),container.getNormalizedNode().getChildCount());
+
+        //check first level children are proper
+        List<Node>childrenResult = containerResult.getNormalizedNode().getChildList();
+        List<Node>childrenOriginal = container.getNormalizedNode().getChildList();
+
+        System.out.println("-------------------------------------------------");
+
+        System.out.println(childrenOriginal.toString());
+
+        System.out.println("-------------------------------------------------");
+
+        System.out.println(childrenResult.toString());
+
+       boolean bFound;
+        for(Node resultChild: childrenResult){
+           bFound = false;
+          for(Node originalChild:childrenOriginal){
+            if(originalChild.getPath().equals(resultChild.getPath())
+                && resultChild.getType().equals(resultChild.getType())){
+               bFound=true;
+               break;
+            }
+          }
+          Assert.assertTrue(bFound);
+        }
+
+    }
+
+    @Test
+    public void addAugmentations(){
+        String stringId = "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test" +
+            "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)augmented-list" +
+            "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)augmented-list[{(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id=1}]";
+
+        YangInstanceIdentifier identifier = instanceIdentifierFromString(stringId);
+
+        MapEntryNode uno = TestModel.createAugmentedListEntry(1, "Uno");
+
+        NormalizedNodeToNodeCodec codec =
+            new NormalizedNodeToNodeCodec(schemaContext);
+
+        Container encode = codec
+            .encode(identifier, uno);
+
+        System.out.println(encode.getNormalizedNode());
+
+        codec.decode(identifier, encode.getNormalizedNode());
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactoryTest.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactoryTest.java
new file mode 100644 (file)
index 0000000..4b0bde8
--- /dev/null
@@ -0,0 +1,20 @@
+package org.opendaylight.controller.cluster.datastore.node.utils;
+
+import junit.framework.Assert;
+import org.junit.Test;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+public class NodeIdentifierFactoryTest {
+
+    @Test
+    public void validateAugmentationIdentifier(){
+        YangInstanceIdentifier.PathArgument argument = NodeIdentifierFactory
+            .getArgument(
+                "AugmentationIdentifier{childNames=[(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics]}");
+
+        Assert.assertTrue(argument instanceof YangInstanceIdentifier.AugmentationIdentifier);
+
+
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java
new file mode 100644 (file)
index 0000000..bb246fb
--- /dev/null
@@ -0,0 +1,141 @@
+package org.opendaylight.controller.cluster.datastore.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+
+public class InstanceIdentifierUtilsTest {
+
+    private static QName TEST_QNAME = QName.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test");
+    private static QName NODE_WITH_VALUE_QNAME = QName.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)value");
+    private static QName NODE_WITH_PREDICATES_QNAME = QName.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)pred");
+    private static QName NAME_QNAME = QName.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)name");
+
+    @Test
+    public void testSerializationOfNodeIdentifier(){
+        YangInstanceIdentifier.PathArgument p1 =
+            new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME);
+
+        List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
+
+        arguments.add(p1);
+
+        YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments);
+
+        NormalizedNodeMessages.InstanceIdentifier instanceIdentifier =
+            InstanceIdentifierUtils.toSerializable(expected);
+
+        YangInstanceIdentifier actual =
+            InstanceIdentifierUtils.fromSerializable(instanceIdentifier);
+
+
+        Assert.assertEquals(expected.getLastPathArgument(),
+            actual.getLastPathArgument());
+
+
+    }
+
+    @Test
+    public void testSerializationOfNodeWithValue(){
+
+        withValue((short) 1);
+        withValue((long) 2);
+        withValue(3);
+        withValue(true);
+
+    }
+
+    private void withValue(Object value){
+        YangInstanceIdentifier.PathArgument p1 =
+            new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME);
+
+        YangInstanceIdentifier.PathArgument p2 =
+            new YangInstanceIdentifier.NodeWithValue(NODE_WITH_VALUE_QNAME, value);
+
+
+        List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
+
+        arguments.add(p1);
+        arguments.add(p2);
+
+        YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments);
+
+        NormalizedNodeMessages.InstanceIdentifier instanceIdentifier =
+            InstanceIdentifierUtils.toSerializable(expected);
+
+        YangInstanceIdentifier actual =
+            InstanceIdentifierUtils.fromSerializable(instanceIdentifier);
+
+
+        Assert.assertEquals(expected.getLastPathArgument(),
+            actual.getLastPathArgument());
+    }
+
+
+    @Test
+    public void testSerializationOfNodeIdentifierWithPredicates(){
+
+        withPredicates((short) 1);
+        withPredicates((long) 2);
+        withPredicates(3);
+        withPredicates(true);
+
+    }
+
+    private void withPredicates(Object value){
+        YangInstanceIdentifier.PathArgument p1 =
+            new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME);
+
+        YangInstanceIdentifier.PathArgument p2 =
+            new YangInstanceIdentifier.NodeIdentifierWithPredicates(NODE_WITH_PREDICATES_QNAME, NAME_QNAME, value);
+
+
+        List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
+
+        arguments.add(p1);
+        arguments.add(p2);
+
+        YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments);
+
+        NormalizedNodeMessages.InstanceIdentifier instanceIdentifier =
+            InstanceIdentifierUtils.toSerializable(expected);
+
+        YangInstanceIdentifier actual =
+            InstanceIdentifierUtils.fromSerializable(instanceIdentifier);
+
+
+        Assert.assertEquals(expected.getLastPathArgument(),
+            actual.getLastPathArgument());
+    }
+
+    @Test
+    public void testAugmentationIdentifier(){
+        YangInstanceIdentifier.PathArgument p1 =
+            new YangInstanceIdentifier.AugmentationIdentifier(new HashSet(Arrays.asList(TEST_QNAME)));
+
+        List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
+
+        arguments.add(p1);
+
+        YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments);
+
+        NormalizedNodeMessages.InstanceIdentifier instanceIdentifier =
+            InstanceIdentifierUtils.toSerializable(expected);
+
+        YangInstanceIdentifier actual =
+            InstanceIdentifierUtils.fromSerializable(instanceIdentifier);
+
+
+        Assert.assertEquals(expected.getLastPathArgument(),
+            actual.getLastPathArgument());
+
+    }
+
+}
index 28e358a06acb99a8c05d54b208fd476d826164f3..fb28704952ac2d6b93a613bf9e4f73dcce011034 100644 (file)
@@ -7,37 +7,16 @@
  */
 package org.opendaylight.controller.cluster.datastore.util;
 
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.net.URI;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
 import org.custommonkey.xmlunit.Diff;
 import org.custommonkey.xmlunit.XMLUnit;
 import org.junit.Test;
 import org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
@@ -65,10 +44,30 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.xml.sax.SAXException;
 
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.net.URI;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 
 /**
@@ -81,423 +80,403 @@ import com.google.common.collect.Sets;
 
 
 public class NormalizedNodeXmlConverterTest {
-  private static final Logger logger = LoggerFactory
-      .getLogger(NormalizedNodeXmlConverterTest.class);
-  public static final String NAMESPACE =
-      "urn:opendaylight:params:xml:ns:yang:controller:test";
-  private static Date revision;
-  private ContainerNode expectedNode;
-  private ContainerSchemaNode containerNode;
-  private String xmlPath;
-
-  static {
-    try {
-      revision = new SimpleDateFormat("yyyy-MM-dd").parse("2014-03-13");
-    } catch (ParseException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public static DataSchemaNode getSchemaNode(final SchemaContext context,
-      final String moduleName, final String childNodeName) {
-    for (Module module : context.getModules()) {
-      if (module.getName().equals(moduleName)) {
-        DataSchemaNode found =
-            findChildNode(module.getChildNodes(), childNodeName);
-        Preconditions.checkState(found != null, "Unable to find %s",
-            childNodeName);
-        return found;
-      }
+    private static final Logger logger = LoggerFactory
+        .getLogger(NormalizedNodeXmlConverterTest.class);
+    public static final String NAMESPACE =
+        "urn:opendaylight:params:xml:ns:yang:controller:test";
+    private static Date revision;
+    private ContainerNode expectedNode;
+    private ContainerSchemaNode containerNode;
+    private String xmlPath;
+
+    static {
+        try {
+            revision = new SimpleDateFormat("yyyy-MM-dd").parse("2014-03-13");
+        } catch (ParseException e) {
+            throw new RuntimeException(e);
+        }
     }
-    throw new IllegalStateException("Unable to find child node "
-        + childNodeName);
-  }
 
-  static DataSchemaNode findChildNode(final Set<DataSchemaNode> children, final String name) {
-    List<DataNodeContainer> containers = Lists.newArrayList();
+    public static DataSchemaNode getSchemaNode(final SchemaContext context,
+        final String moduleName, final String childNodeName) {
+        for (Module module : context.getModules()) {
+            if (module.getName().equals(moduleName)) {
+                DataSchemaNode found =
+                    findChildNode(module.getChildNodes(), childNodeName);
+                Preconditions.checkState(found != null, "Unable to find %s",
+                    childNodeName);
+                return found;
+            }
+        }
+        throw new IllegalStateException("Unable to find child node "
+            + childNodeName);
+    }
 
-    for (DataSchemaNode dataSchemaNode : children) {
-      if (dataSchemaNode.getQName().getLocalName().equals(name)) {
-        return dataSchemaNode;
+    static DataSchemaNode findChildNode(final Collection<DataSchemaNode> children, final String name) {
+        List<DataNodeContainer> containers = Lists.newArrayList();
+
+        for (DataSchemaNode dataSchemaNode : children) {
+            if (dataSchemaNode.getQName().getLocalName().equals(name)) {
+                return dataSchemaNode;
+            }
+            if (dataSchemaNode instanceof DataNodeContainer) {
+                containers.add((DataNodeContainer) dataSchemaNode);
+            } else if (dataSchemaNode instanceof ChoiceNode) {
+                containers.addAll(((ChoiceNode) dataSchemaNode).getCases());
+            }
+        }
+
+        for (DataNodeContainer container : containers) {
+            DataSchemaNode retVal = findChildNode(container.getChildNodes(), name);
+            if (retVal != null) {
+                return retVal;
+            }
+        }
+
+        return null;
     }
-      if (dataSchemaNode instanceof DataNodeContainer) {
-        containers.add((DataNodeContainer) dataSchemaNode);
-      } else if (dataSchemaNode instanceof ChoiceNode) {
-        containers.addAll(((ChoiceNode) dataSchemaNode).getCases());
-      }
+
+    public static YangInstanceIdentifier.NodeIdentifier getNodeIdentifier(
+        final String localName) {
+        return new YangInstanceIdentifier.NodeIdentifier(QName.create(
+            URI.create(NAMESPACE), revision, localName));
     }
 
-    for (DataNodeContainer container : containers) {
-      DataSchemaNode retVal = findChildNode(container.getChildNodes(), name);
-      if (retVal != null) {
-        return retVal;
-      }
+    public static YangInstanceIdentifier.AugmentationIdentifier getAugmentIdentifier(
+        final String... childNames) {
+        Set<QName> qn = Sets.newHashSet();
+
+        for (String childName : childNames) {
+            qn.add(getNodeIdentifier(childName).getNodeType());
+        }
+
+        return new YangInstanceIdentifier.AugmentationIdentifier(qn);
     }
 
-    return null;
-  }
 
-  private static InstanceIdentifier.NodeIdentifier getNodeIdentifier(
-      final String localName) {
-    return new InstanceIdentifier.NodeIdentifier(QName.create(
-        URI.create(NAMESPACE), revision, localName));
-  }
+    public static ContainerNode augmentChoiceExpectedNode() {
+
+        DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> b =
+            Builders.containerBuilder();
+        b.withNodeIdentifier(getNodeIdentifier("container"));
+
+        b.withChild(Builders
+            .choiceBuilder()
+            .withNodeIdentifier(getNodeIdentifier("ch2"))
+            .withChild(
+                Builders.leafBuilder()
+                    .withNodeIdentifier(getNodeIdentifier("c2Leaf")).withValue("2")
+                    .build())
+            .withChild(
+                Builders
+                    .choiceBuilder()
+                    .withNodeIdentifier(getNodeIdentifier("c2DeepChoice"))
+                    .withChild(
+                        Builders
+                            .leafBuilder()
+                            .withNodeIdentifier(
+                                getNodeIdentifier("c2DeepChoiceCase1Leaf2"))
+                            .withValue("2").build()).build()).build());
+
+        b.withChild(Builders
+            .choiceBuilder()
+            .withNodeIdentifier(getNodeIdentifier("ch3"))
+            .withChild(
+                Builders.leafBuilder()
+                    .withNodeIdentifier(getNodeIdentifier("c3Leaf")).withValue("3")
+                    .build()).build());
+
+        b.withChild(Builders
+            .augmentationBuilder()
+            .withNodeIdentifier(getAugmentIdentifier("augLeaf"))
+            .withChild(
+                Builders.leafBuilder()
+                    .withNodeIdentifier(getNodeIdentifier("augLeaf"))
+                    .withValue("augment").build()).build());
+
+        b.withChild(Builders
+            .augmentationBuilder()
+            .withNodeIdentifier(getAugmentIdentifier("ch"))
+            .withChild(
+                Builders
+                    .choiceBuilder()
+                    .withNodeIdentifier(getNodeIdentifier("ch"))
+                    .withChild(
+                        Builders.leafBuilder()
+                            .withNodeIdentifier(getNodeIdentifier("c1Leaf"))
+                            .withValue("1").build())
+                    .withChild(
+                        Builders
+                            .augmentationBuilder()
+                            .withNodeIdentifier(
+                                getAugmentIdentifier("c1Leaf_AnotherAugment",
+                                    "deepChoice"))
+                            .withChild(
+                                Builders
+                                    .leafBuilder()
+                                    .withNodeIdentifier(
+                                        getNodeIdentifier("c1Leaf_AnotherAugment"))
+                                    .withValue("1").build())
+                            .withChild(
+                                Builders
+                                    .choiceBuilder()
+                                    .withNodeIdentifier(
+                                        getNodeIdentifier("deepChoice"))
+                                    .withChild(
+                                        Builders
+                                            .leafBuilder()
+                                            .withNodeIdentifier(
+                                                getNodeIdentifier("deepLeafc1"))
+                                            .withValue("1").build()).build())
+                            .build()).build()).build());
+
+        return b.build();
+    }
 
-  public static InstanceIdentifier.AugmentationIdentifier getAugmentIdentifier(
-      final String... childNames) {
-    Set<QName> qn = Sets.newHashSet();
 
-    for (String childName : childNames) {
-      qn.add(getNodeIdentifier(childName).getNodeType());
+
+    public void init(final String yangPath, final String xmlPath, final ContainerNode expectedNode)
+        throws Exception {
+        SchemaContext schema = parseTestSchema(yangPath);
+        this.xmlPath = xmlPath;
+        this.containerNode =
+            (ContainerSchemaNode) getSchemaNode(schema, "test", "container");
+        this.expectedNode = expectedNode;
     }
 
-    return new InstanceIdentifier.AugmentationIdentifier(qn);
-  }
-
-
-  private static ContainerNode augmentChoiceExpectedNode() {
-
-    DataContainerNodeBuilder<InstanceIdentifier.NodeIdentifier, ContainerNode> b =
-        Builders.containerBuilder();
-    b.withNodeIdentifier(getNodeIdentifier("container"));
-
-    b.withChild(Builders
-        .choiceBuilder()
-        .withNodeIdentifier(getNodeIdentifier("ch2"))
-        .withChild(
-            Builders.leafBuilder()
-                .withNodeIdentifier(getNodeIdentifier("c2Leaf")).withValue("2")
-                .build())
-        .withChild(
-            Builders
-                .choiceBuilder()
-                .withNodeIdentifier(getNodeIdentifier("c2DeepChoice"))
-                .withChild(
-                    Builders
-                        .leafBuilder()
-                        .withNodeIdentifier(
-                            getNodeIdentifier("c2DeepChoiceCase1Leaf2"))
-                        .withValue("2").build()).build()).build());
-
-    b.withChild(Builders
-        .choiceBuilder()
-        .withNodeIdentifier(getNodeIdentifier("ch3"))
-        .withChild(
-            Builders.leafBuilder()
-                .withNodeIdentifier(getNodeIdentifier("c3Leaf")).withValue("3")
-                .build()).build());
-
-    b.withChild(Builders
-        .augmentationBuilder()
-        .withNodeIdentifier(getAugmentIdentifier("augLeaf"))
-        .withChild(
-            Builders.leafBuilder()
-                .withNodeIdentifier(getNodeIdentifier("augLeaf"))
-                .withValue("augment").build()).build());
-
-    b.withChild(Builders
-        .augmentationBuilder()
-        .withNodeIdentifier(getAugmentIdentifier("ch"))
-        .withChild(
-            Builders
-                .choiceBuilder()
-                .withNodeIdentifier(getNodeIdentifier("ch"))
-                .withChild(
-                    Builders.leafBuilder()
-                        .withNodeIdentifier(getNodeIdentifier("c1Leaf"))
-                        .withValue("1").build())
-                .withChild(
-                    Builders
-                        .augmentationBuilder()
-                        .withNodeIdentifier(
-                            getAugmentIdentifier("c1Leaf_AnotherAugment",
-                                "deepChoice"))
-                        .withChild(
-                            Builders
-                                .leafBuilder()
-                                .withNodeIdentifier(
-                                    getNodeIdentifier("c1Leaf_AnotherAugment"))
-                                .withValue("1").build())
-                        .withChild(
-                            Builders
-                                .choiceBuilder()
-                                .withNodeIdentifier(
-                                    getNodeIdentifier("deepChoice"))
-                                .withChild(
-                                    Builders
-                                        .leafBuilder()
-                                        .withNodeIdentifier(
-                                            getNodeIdentifier("deepLeafc1"))
-                                        .withValue("1").build()).build())
-                        .build()).build()).build());
-
-    return b.build();
-  }
-
-
-
-  public void init(final String yangPath, final String xmlPath, final ContainerNode expectedNode)
-      throws Exception {
-    SchemaContext schema = parseTestSchema(yangPath);
-    this.xmlPath = xmlPath;
-    this.containerNode =
-        (ContainerSchemaNode) getSchemaNode(schema, "test", "container");
-    this.expectedNode = expectedNode;
-  }
-
-  SchemaContext parseTestSchema(final String yangPath) throws Exception {
-
-    YangParserImpl yangParserImpl = new YangParserImpl();
-    InputStream stream =
-        NormalizedNodeXmlConverterTest.class.getResourceAsStream(yangPath);
-    ArrayList<InputStream> al = new ArrayList<InputStream>();
-    al.add(stream);
-    Set<Module> modules = yangParserImpl.parseYangModelsFromStreams(al);
-    return yangParserImpl.resolveSchemaContext(modules);
-
-  }
-
-
-  @Test
-  public void testConversionWithAugmentChoice() throws Exception {
-    init("/augment_choice.yang", "/augment_choice.xml",
-        augmentChoiceExpectedNode());
-    Document doc = loadDocument(xmlPath);
-
-    ContainerNode built =
-        DomToNormalizedNodeParserFactory
-            .getInstance(DomUtils.defaultValueCodecProvider())
-            .getContainerNodeParser()
-            .parse(Collections.singletonList(doc.getDocumentElement()),
-                containerNode);
-
-    if (expectedNode != null) {
-        junit.framework.Assert.assertEquals(expectedNode, built);
+    SchemaContext parseTestSchema(final String yangPath) throws Exception {
+
+        YangParserImpl yangParserImpl = new YangParserImpl();
+        InputStream stream =
+            NormalizedNodeXmlConverterTest.class.getResourceAsStream(yangPath);
+        ArrayList<InputStream> al = new ArrayList<InputStream>();
+        al.add(stream);
+        Set<Module> modules = yangParserImpl.parseYangModelsFromStreams(al);
+        return yangParserImpl.resolveSchemaContext(modules);
+
     }
 
-    logger.info("{}", built);
 
-    Iterable<Element> els =
-        DomFromNormalizedNodeSerializerFactory
-            .getInstance(XmlDocumentUtils.getDocument(),
-                DomUtils.defaultValueCodecProvider())
-            .getContainerNodeSerializer().serialize(containerNode, built);
+    @Test
+    public void testConversionWithAugmentChoice() throws Exception {
+        init("/augment_choice.yang", "/augment_choice.xml",
+            augmentChoiceExpectedNode());
+        Document doc = loadDocument(xmlPath);
 
-    Element el = els.iterator().next();
+        ContainerNode built =
+            DomToNormalizedNodeParserFactory
+                .getInstance(DomUtils.defaultValueCodecProvider())
+                .getContainerNodeParser()
+                .parse(Collections.singletonList(doc.getDocumentElement()),
+                    containerNode);
 
-    XMLUnit.setIgnoreWhitespace(true);
-    XMLUnit.setIgnoreComments(true);
+        if (expectedNode != null) {
+            junit.framework.Assert.assertEquals(expectedNode, built);
+        }
 
-    System.out.println(toString(doc.getDocumentElement()));
-    System.out.println(toString(el));
+        logger.info("{}", built);
 
-    new Diff(
-        XMLUnit.buildControlDocument(toString(doc.getDocumentElement())),
-        XMLUnit.buildTestDocument(toString(el))).similar();
-  }
+        Iterable<Element> els =
+            DomFromNormalizedNodeSerializerFactory
+                .getInstance(XmlDocumentUtils.getDocument(),
+                    DomUtils.defaultValueCodecProvider())
+                .getContainerNodeSerializer().serialize(containerNode, built);
 
-  private static ContainerNode listLeafListWithAttributes() {
-    DataContainerNodeBuilder<InstanceIdentifier.NodeIdentifier, ContainerNode> b =
-        Builders.containerBuilder();
-    b.withNodeIdentifier(getNodeIdentifier("container"));
+        Element el = els.iterator().next();
 
-    CollectionNodeBuilder<MapEntryNode, MapNode> listBuilder =
-        Builders.mapBuilder().withNodeIdentifier(getNodeIdentifier("list"));
+        XMLUnit.setIgnoreWhitespace(true);
+        XMLUnit.setIgnoreComments(true);
 
-    Map<QName, Object> predicates = Maps.newHashMap();
-    predicates.put(getNodeIdentifier("uint32InList").getNodeType(), 3L);
+        System.out.println(toString(doc.getDocumentElement()));
+        System.out.println(toString(el));
 
-    DataContainerNodeBuilder<InstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> list1Builder =
-        Builders.mapEntryBuilder().withNodeIdentifier(
-            new InstanceIdentifier.NodeIdentifierWithPredicates(
-                getNodeIdentifier("list").getNodeType(), predicates));
-    NormalizedNodeBuilder<InstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> uint32InListBuilder =
-        Builders.leafBuilder().withNodeIdentifier(
-            getNodeIdentifier("uint32InList"));
+        new Diff(
+            XMLUnit.buildControlDocument(toString(doc.getDocumentElement())),
+            XMLUnit.buildTestDocument(toString(el))).similar();
+    }
 
-    list1Builder.withChild(uint32InListBuilder.withValue(3L).build());
+    private static ContainerNode listLeafListWithAttributes() {
+        DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> b =
+            Builders.containerBuilder();
+        b.withNodeIdentifier(getNodeIdentifier("container"));
 
-    listBuilder.withChild(list1Builder.build());
-    b.withChild(listBuilder.build());
+        CollectionNodeBuilder<MapEntryNode, MapNode> listBuilder =
+            Builders.mapBuilder().withNodeIdentifier(getNodeIdentifier("list"));
 
-    NormalizedNodeBuilder<InstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> booleanBuilder =
-        Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("boolean"));
-    booleanBuilder.withValue(false);
-    b.withChild(booleanBuilder.build());
+        Map<QName, Object> predicates = Maps.newHashMap();
+        predicates.put(getNodeIdentifier("uint32InList").getNodeType(), 3L);
 
-    ListNodeBuilder<Object, LeafSetEntryNode<Object>> leafListBuilder =
-        Builders.leafSetBuilder().withNodeIdentifier(
-            getNodeIdentifier("leafList"));
+        DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> list1Builder =
+            Builders.mapEntryBuilder().withNodeIdentifier(
+                new YangInstanceIdentifier.NodeIdentifierWithPredicates(
+                    getNodeIdentifier("list").getNodeType(), predicates));
+        NormalizedNodeBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> uint32InListBuilder =
+            Builders.leafBuilder().withNodeIdentifier(
+                getNodeIdentifier("uint32InList"));
 
-    NormalizedNodeBuilder<InstanceIdentifier.NodeWithValue, Object, LeafSetEntryNode<Object>> leafList1Builder =
-        Builders.leafSetEntryBuilder().withNodeIdentifier(
-            new InstanceIdentifier.NodeWithValue(getNodeIdentifier("leafList")
-                .getNodeType(), "a"));
+        list1Builder.withChild(uint32InListBuilder.withValue(3L).build());
 
-    leafList1Builder.withValue("a");
+        listBuilder.withChild(list1Builder.build());
+        b.withChild(listBuilder.build());
 
-    leafListBuilder.withChild(leafList1Builder.build());
-    b.withChild(leafListBuilder.build());
+        NormalizedNodeBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> booleanBuilder =
+            Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("boolean"));
+        booleanBuilder.withValue(false);
+        b.withChild(booleanBuilder.build());
 
-    return b.build();
-  }
+        ListNodeBuilder<Object, LeafSetEntryNode<Object>> leafListBuilder =
+            Builders.leafSetBuilder().withNodeIdentifier(
+                getNodeIdentifier("leafList"));
 
+        NormalizedNodeBuilder<YangInstanceIdentifier.NodeWithValue, Object, LeafSetEntryNode<Object>> leafList1Builder =
+            Builders.leafSetEntryBuilder().withNodeIdentifier(
+                new YangInstanceIdentifier.NodeWithValue(getNodeIdentifier("leafList")
+                    .getNodeType(), "a"));
 
-  @Test
-  public void testConversionWithAttributes() throws Exception {
-    init("/test.yang", "/simple_xml_with_attributes.xml",
-        listLeafListWithAttributes());
-    Document doc = loadDocument(xmlPath);
+        leafList1Builder.withValue("a");
 
-    ContainerNode built =
-        DomToNormalizedNodeParserFactory
-            .getInstance(DomUtils.defaultValueCodecProvider())
-            .getContainerNodeParser()
-            .parse(Collections.singletonList(doc.getDocumentElement()),
-                containerNode);
+        leafListBuilder.withChild(leafList1Builder.build());
+        b.withChild(leafListBuilder.build());
 
-    if (expectedNode != null) {
-        junit.framework.Assert.assertEquals(expectedNode, built);
+        return b.build();
     }
 
-    logger.info("{}", built);
 
-    Iterable<Element> els =
-        DomFromNormalizedNodeSerializerFactory
-            .getInstance(XmlDocumentUtils.getDocument(),
-                DomUtils.defaultValueCodecProvider())
-            .getContainerNodeSerializer().serialize(containerNode, built);
+    @Test
+    public void testConversionWithAttributes() throws Exception {
+        init("/test.yang", "/simple_xml_with_attributes.xml",
+            listLeafListWithAttributes());
+        Document doc = loadDocument(xmlPath);
+
+        ContainerNode built =
+            DomToNormalizedNodeParserFactory
+                .getInstance(DomUtils.defaultValueCodecProvider())
+                .getContainerNodeParser()
+                .parse(Collections.singletonList(doc.getDocumentElement()),
+                    containerNode);
 
-    Element el = els.iterator().next();
+        if (expectedNode != null) {
+            junit.framework.Assert.assertEquals(expectedNode, built);
+        }
 
-    XMLUnit.setIgnoreWhitespace(true);
-    XMLUnit.setIgnoreComments(true);
+        logger.info("{}", built);
 
-    System.out.println(toString(doc.getDocumentElement()));
-    System.out.println(toString(el));
+        Iterable<Element> els =
+            DomFromNormalizedNodeSerializerFactory
+                .getInstance(XmlDocumentUtils.getDocument(),
+                    DomUtils.defaultValueCodecProvider())
+                .getContainerNodeSerializer().serialize(containerNode, built);
 
-    new Diff(
-        XMLUnit.buildControlDocument(toString(doc.getDocumentElement())),
-        XMLUnit.buildTestDocument(toString(el))).similar();
-  }
+        Element el = els.iterator().next();
 
+        XMLUnit.setIgnoreWhitespace(true);
+        XMLUnit.setIgnoreComments(true);
 
-  private Document loadDocument(final String xmlPath) throws Exception {
-    InputStream resourceAsStream =
-        NormalizedNodeXmlConverterTest.class.getResourceAsStream(xmlPath);
+        System.out.println(toString(doc.getDocumentElement()));
+        System.out.println(toString(el));
 
-    Document currentConfigElement = readXmlToDocument(resourceAsStream);
-    Preconditions.checkNotNull(currentConfigElement);
-    return currentConfigElement;
-  }
+        new Diff(
+            XMLUnit.buildControlDocument(toString(doc.getDocumentElement())),
+            XMLUnit.buildTestDocument(toString(el))).similar();
+    }
 
-  private static final DocumentBuilderFactory BUILDERFACTORY;
 
-  static {
-    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-    factory.setNamespaceAware(true);
-    factory.setCoalescing(true);
-    factory.setIgnoringElementContentWhitespace(true);
-    factory.setIgnoringComments(true);
-    BUILDERFACTORY = factory;
-  }
+    private Document loadDocument(final String xmlPath) throws Exception {
+        InputStream resourceAsStream =
+            NormalizedNodeXmlConverterTest.class.getResourceAsStream(xmlPath);
 
-  private Document readXmlToDocument(final InputStream xmlContent)
-      throws IOException, SAXException {
-    DocumentBuilder dBuilder;
-    try {
-      dBuilder = BUILDERFACTORY.newDocumentBuilder();
-    } catch (ParserConfigurationException e) {
-      throw new RuntimeException("Failed to parse XML document", e);
+        Document currentConfigElement = readXmlToDocument(resourceAsStream);
+        Preconditions.checkNotNull(currentConfigElement);
+        return currentConfigElement;
     }
-    Document doc = dBuilder.parse(xmlContent);
-
-    doc.getDocumentElement().normalize();
-    return doc;
-  }
-
-  public static String toString(final Element xml) {
-    try {
-      Transformer transformer =
-          TransformerFactory.newInstance().newTransformer();
-      transformer.setOutputProperty(OutputKeys.INDENT, "yes");
-
-      StreamResult result = new StreamResult(new StringWriter());
-      DOMSource source = new DOMSource(xml);
-      transformer.transform(source, result);
-
-      return result.getWriter().toString();
-    } catch (IllegalArgumentException | TransformerFactoryConfigurationError
-        | TransformerException e) {
-      throw new RuntimeException("Unable to serialize xml element " + xml, e);
+
+    private static final DocumentBuilderFactory BUILDERFACTORY;
+
+    static {
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        factory.setNamespaceAware(true);
+        factory.setCoalescing(true);
+        factory.setIgnoringElementContentWhitespace(true);
+        factory.setIgnoringComments(true);
+        BUILDERFACTORY = factory;
+    }
+
+    private Document readXmlToDocument(final InputStream xmlContent)
+        throws IOException, SAXException {
+        DocumentBuilder dBuilder;
+        try {
+            dBuilder = BUILDERFACTORY.newDocumentBuilder();
+        } catch (ParserConfigurationException e) {
+            throw new RuntimeException("Failed to parse XML document", e);
+        }
+        Document doc = dBuilder.parse(xmlContent);
+
+        doc.getDocumentElement().normalize();
+        return doc;
+    }
+
+    public static String toString(final Element xml) {
+        try {
+            Transformer transformer =
+                TransformerFactory.newInstance().newTransformer();
+            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+
+            StreamResult result = new StreamResult(new StringWriter());
+            DOMSource source = new DOMSource(xml);
+            transformer.transform(source, result);
+
+            return result.getWriter().toString();
+        } catch (IllegalArgumentException | TransformerFactoryConfigurationError
+            | TransformerException e) {
+            throw new RuntimeException("Unable to serialize xml element " + xml, e);
+        }
+    }
+
+    @Test
+    public void testConversionToNormalizedXml() throws Exception {
+        SimpleNormalizedNodeMessage.NormalizedNodeXml nnXml =
+            EncoderDecoderUtil.encode(parseTestSchema("/augment_choice.yang"),
+                augmentChoiceExpectedNode());
+        Document expectedDoc = loadDocument("/augment_choice.xml");
+        Document convertedDoc =
+            EncoderDecoderUtil.factory.newDocumentBuilder().parse(
+                new ByteArrayInputStream(nnXml.getXmlString().getBytes("utf-8")));
+        System.out.println(toString(convertedDoc.getDocumentElement()));
+        XMLUnit.setIgnoreWhitespace(true);
+        XMLUnit.setIgnoreComments(true);
+        new Diff(XMLUnit.buildControlDocument(toString(expectedDoc
+            .getDocumentElement())),
+            XMLUnit.buildTestDocument(toString(convertedDoc
+                .getDocumentElement()))).similar();
+        System.out.println(toString(expectedDoc.getDocumentElement()));
+
+    }
+
+
+    @Test
+    public void testConversionFromXmlToNormalizedNode() throws Exception {
+        SimpleNormalizedNodeMessage.NormalizedNodeXml nnXml =
+            EncoderDecoderUtil.encode(parseTestSchema("/test.yang"),
+                listLeafListWithAttributes());
+        Document expectedDoc = loadDocument("/simple_xml_with_attributes.xml");
+        Document convertedDoc =
+            EncoderDecoderUtil.factory.newDocumentBuilder().parse(
+                new ByteArrayInputStream(nnXml.getXmlString().getBytes("utf-8")));
+        System.out.println(toString(convertedDoc.getDocumentElement()));
+        XMLUnit.setIgnoreWhitespace(true);
+        XMLUnit.setIgnoreComments(true);
+        new Diff(XMLUnit.buildControlDocument(toString(expectedDoc
+            .getDocumentElement())),
+            XMLUnit.buildTestDocument(toString(convertedDoc
+                .getDocumentElement()))).similar();
+        System.out.println(toString(expectedDoc.getDocumentElement()));
+
+        // now we will try to convert xml back to normalize node.
+        ContainerNode cn =
+            (ContainerNode) EncoderDecoderUtil.decode(
+                parseTestSchema("/test.yang"), nnXml);
+        junit.framework.Assert.assertEquals(listLeafListWithAttributes(), cn);
+
     }
-  }
 
-  @Test
-  public void testConversionToNormalizedXml() throws Exception {
-    SimpleNormalizedNodeMessage.NormalizedNodeXml nnXml =
-        EncoderDecoderUtil.encode(parseTestSchema("/augment_choice.yang"),
-            augmentChoiceExpectedNode());
-    Document expectedDoc = loadDocument("/augment_choice.xml");
-    Document convertedDoc =
-        EncoderDecoderUtil.factory.newDocumentBuilder().parse(
-            new ByteArrayInputStream(nnXml.getXmlString().getBytes("utf-8")));
-    System.out.println(toString(convertedDoc.getDocumentElement()));
-    XMLUnit.setIgnoreWhitespace(true);
-    XMLUnit.setIgnoreComments(true);
-    new Diff(XMLUnit.buildControlDocument(toString(expectedDoc
-        .getDocumentElement())),
-        XMLUnit.buildTestDocument(toString(convertedDoc
-            .getDocumentElement()))).similar();
-    System.out.println(toString(expectedDoc.getDocumentElement()));
-
-  }
-
-
-  @Test
-  public void testConversionFromXmlToNormalizedNode() throws Exception {
-    SimpleNormalizedNodeMessage.NormalizedNodeXml nnXml =
-        EncoderDecoderUtil.encode(parseTestSchema("/test.yang"),
-            listLeafListWithAttributes());
-    Document expectedDoc = loadDocument("/simple_xml_with_attributes.xml");
-    Document convertedDoc =
-        EncoderDecoderUtil.factory.newDocumentBuilder().parse(
-            new ByteArrayInputStream(nnXml.getXmlString().getBytes("utf-8")));
-    System.out.println(toString(convertedDoc.getDocumentElement()));
-    XMLUnit.setIgnoreWhitespace(true);
-    XMLUnit.setIgnoreComments(true);
-    new Diff(XMLUnit.buildControlDocument(toString(expectedDoc
-        .getDocumentElement())),
-        XMLUnit.buildTestDocument(toString(convertedDoc
-            .getDocumentElement()))).similar();
-    System.out.println(toString(expectedDoc.getDocumentElement()));
-
-    // now we will try to convert xml back to normalize node.
-    ContainerNode cn =
-        (ContainerNode) EncoderDecoderUtil.decode(
-            parseTestSchema("/test.yang"), nnXml);
-    junit.framework.Assert.assertEquals(listLeafListWithAttributes(), cn);
-
-  }
-
-  @Test
-  public void testInMemoryTestModelProtoBuffEncoding() throws Exception {
-
-    SimpleNormalizedNodeMessage.NormalizedNodeXml nnXml =
-        EncoderDecoderUtil.encode(parseTestSchema("/odl-datastore-test.yang"),
-            TestModel.createFamily());
-
-    Document convertedDoc =
-        EncoderDecoderUtil.factory.newDocumentBuilder().parse(
-            new ByteArrayInputStream(nnXml.getXmlString().getBytes("utf-8")));
-    System.out.println(toString(convertedDoc.getDocumentElement()));
-
-    // now we will try to convert xml back to normalize node.
-    ContainerNode cn =
-        (ContainerNode) EncoderDecoderUtil.decode(
-            parseTestSchema("/odl-datastore-test.yang"), nnXml);
-    junit.framework.Assert.assertEquals(TestModel.createFamily(), cn);
-
-
-  }
 }
index 81878ba6162d154a4811e4066c8cb899d019f744..bef4057aa2596b891000698a943864983bb91d51 100644 (file)
@@ -1,7 +1,7 @@
 package org.opendaylight.controller.cluster.datastore.util;
 
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
@@ -17,6 +17,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContaine
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetEntryNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapEntryNodeBuilder;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
@@ -33,340 +34,453 @@ import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.ma
 
 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 AUG_QNAME = QName.create(
-      "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug",
-      "2014-03-13", "name");
-
-  public static final QName DESC_QNAME = QName.create(TEST_QNAME, "desc");
-  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");
-  public static final QName ID_QNAME = QName.create(TEST_QNAME, "id");
-  public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
-  public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
-  private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
-  private static final String DATASTORE_AUG_YANG =
-      "/odl-datastore-augmentation.yang";
-  private static final String DATASTORE_TEST_NOTIFICATION_YANG =
-      "/odl-datastore-test-notification.yang";
-
-
-  public static final InstanceIdentifier TEST_PATH = InstanceIdentifier
-      .of(TEST_QNAME);
-  public static final InstanceIdentifier DESC_PATH = InstanceIdentifier
-      .builder(TEST_PATH).node(DESC_QNAME).build();
-  public static final InstanceIdentifier OUTER_LIST_PATH = InstanceIdentifier
-      .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");
-
-  private static final Integer ONE_ID = 1;
-  private static final Integer TWO_ID = 2;
-  private static final String TWO_ONE_NAME = "one";
-  private static final String TWO_TWO_NAME = "two";
-  private static final String DESC = "Hello there";
-
-  // Family specific constants
-  public static final QName FAMILY_QNAME =
-      QName
-          .create(
-              "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test",
-              "2014-04-15", "family");
-  public static final QName CHILDREN_QNAME = QName.create(FAMILY_QNAME,
-      "children");
-  public static final QName GRAND_CHILDREN_QNAME = QName.create(FAMILY_QNAME,
-      "grand-children");
-  public static final QName CHILD_NUMBER_QNAME = QName.create(FAMILY_QNAME,
-      "child-number");
-  public static final QName CHILD_NAME_QNAME = QName.create(FAMILY_QNAME,
-      "child-name");
-  public static final QName GRAND_CHILD_NUMBER_QNAME = QName.create(
-      FAMILY_QNAME, "grand-child-number");
-  public static final QName GRAND_CHILD_NAME_QNAME = QName.create(FAMILY_QNAME,
-      "grand-child-name");
-
-  public static final InstanceIdentifier FAMILY_PATH = InstanceIdentifier
-      .of(FAMILY_QNAME);
-  public static final InstanceIdentifier FAMILY_DESC_PATH = InstanceIdentifier
-      .builder(FAMILY_PATH).node(DESC_QNAME).build();
-  public static final InstanceIdentifier CHILDREN_PATH = InstanceIdentifier
-      .builder(FAMILY_PATH).node(CHILDREN_QNAME).build();
-
-  private static final Integer FIRST_CHILD_ID = 1;
-  private static final Integer SECOND_CHILD_ID = 2;
-
-  private static final String FIRST_CHILD_NAME = "first child";
-  private static final String SECOND_CHILD_NAME = "second child";
-
-  private static final Integer FIRST_GRAND_CHILD_ID = 1;
-  private static final Integer SECOND_GRAND_CHILD_ID = 2;
-
-  private static final String FIRST_GRAND_CHILD_NAME = "first grand child";
-  private static final String SECOND_GRAND_CHILD_NAME = "second grand child";
-
-  // first child
-  private static final InstanceIdentifier CHILDREN_1_PATH = InstanceIdentifier
-      .builder(CHILDREN_PATH)
-      .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID) //
-      .build();
-  private static final InstanceIdentifier CHILDREN_1_NAME_PATH =
-      InstanceIdentifier.builder(CHILDREN_PATH)
-          .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, FIRST_CHILD_NAME) //
-          .build();
-
-  private static final InstanceIdentifier CHILDREN_2_PATH = InstanceIdentifier
-      .builder(CHILDREN_PATH)
-      .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID) //
-      .build();
-  private static final InstanceIdentifier CHILDREN_2_NAME_PATH =
-      InstanceIdentifier.builder(CHILDREN_PATH)
-          .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, SECOND_CHILD_NAME) //
-          .build();
-
-
-  private static final InstanceIdentifier GRAND_CHILD_1_PATH =
-      InstanceIdentifier.builder(CHILDREN_1_PATH)
-          .node(GRAND_CHILDREN_QNAME)
-          //
-          .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
-              FIRST_GRAND_CHILD_ID) //
-          .build();
-
-  private static final InstanceIdentifier GRAND_CHILD_1_NAME_PATH =
-      InstanceIdentifier.builder(CHILDREN_1_PATH)
-          .node(GRAND_CHILDREN_QNAME)
-          //
-          .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME,
-              FIRST_GRAND_CHILD_NAME) //
-          .build();
-
-  private static final InstanceIdentifier GRAND_CHILD_2_PATH =
-      InstanceIdentifier.builder(CHILDREN_2_PATH)
-          .node(GRAND_CHILDREN_QNAME)
-          //
-          .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
-              SECOND_GRAND_CHILD_ID) //
-          .build();
-
-  private static final InstanceIdentifier GRAND_CHILD_2_NAME_PATH =
-      InstanceIdentifier.builder(CHILDREN_2_PATH)
-          .node(GRAND_CHILDREN_QNAME)
-          //
-          .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME,
-              SECOND_GRAND_CHILD_NAME) //
-          .build();
-
-  private static final InstanceIdentifier DESC_PATH_ID = InstanceIdentifier
-      .builder(DESC_PATH).build();
-  private static final InstanceIdentifier OUTER_LIST_1_PATH =
-      InstanceIdentifier.builder(OUTER_LIST_PATH)
-          .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, ONE_ID) //
-          .build();
-
-  private static final InstanceIdentifier OUTER_LIST_2_PATH =
-      InstanceIdentifier.builder(OUTER_LIST_PATH)
-          .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
-          .build();
-
-  private static final InstanceIdentifier TWO_TWO_PATH = InstanceIdentifier
-      .builder(OUTER_LIST_2_PATH).node(INNER_LIST_QNAME) //
-      .nodeWithKey(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME) //
-      .build();
-
-  private static final InstanceIdentifier TWO_TWO_VALUE_PATH =
-      InstanceIdentifier.builder(TWO_TWO_PATH).node(VALUE_QNAME) //
-          .build();
-
-  private static final MapEntryNode BAR_NODE = mapEntryBuilder(
-      OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
-      .withChild(mapNodeBuilder(INNER_LIST_QNAME) //
-          .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_ONE_NAME)) //
-          .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME)) //
-          .build()) //
-      .build();
-
-  public static final InputStream getDatastoreTestInputStream() {
-    return getInputStream(DATASTORE_TEST_YANG);
-  }
-
-  public static final InputStream getDatastoreAugInputStream() {
-    return getInputStream(DATASTORE_AUG_YANG);
-  }
-
-  public static final InputStream getDatastoreTestNotificationInputStream() {
-    return getInputStream(DATASTORE_TEST_NOTIFICATION_YANG);
-  }
-
-  private static InputStream getInputStream(final String resourceName) {
-    return TestModel.class.getResourceAsStream(resourceName);
-  }
-
-  public static SchemaContext createTestContext() {
-    List<InputStream> inputStreams = new ArrayList<>();
-    inputStreams.add(getDatastoreTestInputStream());
-    inputStreams.add(getDatastoreAugInputStream());
-    inputStreams.add(getDatastoreTestNotificationInputStream());
-
-    YangParserImpl parser = new YangParserImpl();
-    Set<Module> modules = parser.parseYangModelsFromStreams(inputStreams);
-    return parser.resolveSchemaContext(modules);
-  }
-
-  /**
-   * Returns a test document
-   *
-   * <pre>
-   * test
-   *     outer-list
-   *          id 1
-   *     outer-list
-   *          id 2
-   *          inner-list
-   *                  name "one"
-   *          inner-list
-   *                  name "two"
-   *
-   * </pre>
-   *
-   * @return
-   */
-  public static NormalizedNode<?, ?> createDocumentOne(
-      SchemaContext schemaContext) {
-    return ImmutableContainerNodeBuilder
-        .create()
-        .withNodeIdentifier(
-            new InstanceIdentifier.NodeIdentifier(schemaContext.getQName()))
-        .withChild(createTestContainer()).build();
-
-  }
-
-  public static ContainerNode createTestContainer() {
-
-
-    final LeafSetEntryNode<Object> nike =
-        ImmutableLeafSetEntryNodeBuilder
-            .create()
-            .withNodeIdentifier(
-                new InstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME,
-                    "shoe"), "nike")).withValue("nike").build();
-    final LeafSetEntryNode<Object> puma =
-        ImmutableLeafSetEntryNodeBuilder
-            .create()
-            .withNodeIdentifier(
-                new InstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME,
-                    "shoe"), "puma")).withValue("puma").build();
-    final LeafSetNode<Object> shoes =
-        ImmutableLeafSetNodeBuilder
-            .create()
-            .withNodeIdentifier(
-                new InstanceIdentifier.NodeIdentifier(QName.create(TEST_QNAME,
-                    "shoe"))).withChild(nike).withChild(puma).build();
+    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 AUG_NAME_QNAME = QName.create(
+        "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug",
+        "2014-03-13", "name");
+
+    public static final QName AUG_CONT_QNAME = QName.create(
+        "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug",
+        "2014-03-13", "cont");
+
+
+    public static final QName DESC_QNAME = QName.create(TEST_QNAME, "desc");
+    public static final QName POINTER_QNAME =
+        QName.create(TEST_QNAME, "pointer");
+    public static final QName SOME_REF_QNAME =
+        QName.create(TEST_QNAME, "some-ref");
+    public static final QName MYIDENTITY_QNAME =
+        QName.create(TEST_QNAME, "myidentity");
+    public static final QName SWITCH_FEATURES_QNAME =
+        QName.create(TEST_QNAME, "switch-features");
+
+    public static final QName AUGMENTED_LIST_QNAME =
+        QName.create(TEST_QNAME, "augmented-list");
+
+    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");
+    public static final QName ID_QNAME = QName.create(TEST_QNAME, "id");
+    public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
+    public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
+    private static final String DATASTORE_TEST_YANG =
+        "/odl-datastore-test.yang";
+    private static final String DATASTORE_AUG_YANG =
+        "/odl-datastore-augmentation.yang";
+    private static final String DATASTORE_TEST_NOTIFICATION_YANG =
+        "/odl-datastore-test-notification.yang";
+
+
+    public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier
+        .of(TEST_QNAME);
+    public static final YangInstanceIdentifier DESC_PATH = YangInstanceIdentifier
+        .builder(TEST_PATH).node(DESC_QNAME).build();
+    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");
+
+    private static final Integer ONE_ID = 1;
+    private static final Integer TWO_ID = 2;
+    private static final String TWO_ONE_NAME = "one";
+    private static final String TWO_TWO_NAME = "two";
+    private static final String DESC = "Hello there";
+
+    // Family specific constants
+    public static final QName FAMILY_QNAME =
+        QName
+            .create(
+                "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test",
+                "2014-04-17", "family");
+    public static final QName CHILDREN_QNAME = QName.create(FAMILY_QNAME,
+        "children");
+    public static final QName GRAND_CHILDREN_QNAME = QName.create(FAMILY_QNAME,
+        "grand-children");
+    public static final QName CHILD_NUMBER_QNAME = QName.create(FAMILY_QNAME,
+        "child-number");
+    public static final QName CHILD_NAME_QNAME = QName.create(FAMILY_QNAME,
+        "child-name");
+    public static final QName GRAND_CHILD_NUMBER_QNAME = QName.create(
+        FAMILY_QNAME, "grand-child-number");
+    public static final QName GRAND_CHILD_NAME_QNAME =
+        QName.create(FAMILY_QNAME,
+            "grand-child-name");
+
+    public static final YangInstanceIdentifier FAMILY_PATH = YangInstanceIdentifier
+        .of(FAMILY_QNAME);
+    public static final YangInstanceIdentifier FAMILY_DESC_PATH = YangInstanceIdentifier
+        .builder(FAMILY_PATH).node(DESC_QNAME).build();
+    public static final YangInstanceIdentifier CHILDREN_PATH = YangInstanceIdentifier
+        .builder(FAMILY_PATH).node(CHILDREN_QNAME).build();
+
+    private static final Integer FIRST_CHILD_ID = 1;
+    private static final Integer SECOND_CHILD_ID = 2;
+
+    private static final String FIRST_CHILD_NAME = "first child";
+    private static final String SECOND_CHILD_NAME = "second child";
+
+    private static final Integer FIRST_GRAND_CHILD_ID = 1;
+    private static final Integer SECOND_GRAND_CHILD_ID = 2;
+
+    private static final String FIRST_GRAND_CHILD_NAME = "first grand child";
+    private static final String SECOND_GRAND_CHILD_NAME = "second grand child";
+
+    // first child
+    private static final YangInstanceIdentifier CHILDREN_1_PATH = YangInstanceIdentifier
+        .builder(CHILDREN_PATH)
+        .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID) //
+        .build();
+    private static final YangInstanceIdentifier CHILDREN_1_NAME_PATH =
+        YangInstanceIdentifier.builder(CHILDREN_PATH)
+            .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, FIRST_CHILD_NAME) //
+            .build();
+
+    private static final YangInstanceIdentifier CHILDREN_2_PATH = YangInstanceIdentifier
+        .builder(CHILDREN_PATH)
+        .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID) //
+        .build();
+    private static final YangInstanceIdentifier CHILDREN_2_NAME_PATH =
+        YangInstanceIdentifier.builder(CHILDREN_PATH)
+            .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, SECOND_CHILD_NAME) //
+            .build();
 
 
-    final LeafSetEntryNode<Object> five =
-        ImmutableLeafSetEntryNodeBuilder
+    private static final YangInstanceIdentifier GRAND_CHILD_1_PATH =
+        YangInstanceIdentifier.builder(CHILDREN_1_PATH)
+            .node(GRAND_CHILDREN_QNAME)
+                //
+            .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+                FIRST_GRAND_CHILD_ID) //
+            .build();
+
+    private static final YangInstanceIdentifier GRAND_CHILD_1_NAME_PATH =
+        YangInstanceIdentifier.builder(CHILDREN_1_PATH)
+            .node(GRAND_CHILDREN_QNAME)
+                //
+            .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME,
+                FIRST_GRAND_CHILD_NAME) //
+            .build();
+
+    private static final YangInstanceIdentifier GRAND_CHILD_2_PATH =
+        YangInstanceIdentifier.builder(CHILDREN_2_PATH)
+            .node(GRAND_CHILDREN_QNAME)
+                //
+            .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+                SECOND_GRAND_CHILD_ID) //
+            .build();
+
+    private static final YangInstanceIdentifier GRAND_CHILD_2_NAME_PATH =
+        YangInstanceIdentifier.builder(CHILDREN_2_PATH)
+            .node(GRAND_CHILDREN_QNAME)
+                //
+            .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME,
+                SECOND_GRAND_CHILD_NAME) //
+            .build();
+
+    private static final YangInstanceIdentifier DESC_PATH_ID = YangInstanceIdentifier
+        .builder(DESC_PATH).build();
+    private static final YangInstanceIdentifier OUTER_LIST_1_PATH =
+        YangInstanceIdentifier.builder(OUTER_LIST_PATH)
+            .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, ONE_ID) //
+            .build();
+
+    private static final YangInstanceIdentifier OUTER_LIST_2_PATH =
+        YangInstanceIdentifier.builder(OUTER_LIST_PATH)
+            .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
+            .build();
+
+    private static final YangInstanceIdentifier TWO_TWO_PATH = YangInstanceIdentifier
+        .builder(OUTER_LIST_2_PATH).node(INNER_LIST_QNAME) //
+        .nodeWithKey(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME) //
+        .build();
+
+    private static final YangInstanceIdentifier TWO_TWO_VALUE_PATH =
+        YangInstanceIdentifier.builder(TWO_TWO_PATH).node(VALUE_QNAME) //
+            .build();
+
+    private static final MapEntryNode BAR_NODE = mapEntryBuilder(
+        OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
+        .withChild(mapNodeBuilder(INNER_LIST_QNAME) //
+            .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_ONE_NAME)) //
+            .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME)) //
+            .build()) //
+        .build();
+
+    public static final InputStream getDatastoreTestInputStream() {
+        return getInputStream(DATASTORE_TEST_YANG);
+    }
+
+    public static final InputStream getDatastoreAugInputStream() {
+        return getInputStream(DATASTORE_AUG_YANG);
+    }
+
+    public static final InputStream getDatastoreTestNotificationInputStream() {
+        return getInputStream(DATASTORE_TEST_NOTIFICATION_YANG);
+    }
+
+    private static InputStream getInputStream(final String resourceName) {
+        return TestModel.class.getResourceAsStream(resourceName);
+    }
+
+    public static SchemaContext createTestContext() {
+        List<InputStream> inputStreams = new ArrayList<>();
+        inputStreams.add(getDatastoreTestInputStream());
+        inputStreams.add(getDatastoreAugInputStream());
+        inputStreams.add(getDatastoreTestNotificationInputStream());
+
+        YangParserImpl parser = new YangParserImpl();
+        Set<Module> modules = parser.parseYangModelsFromStreams(inputStreams);
+        return parser.resolveSchemaContext(modules);
+    }
+
+    /**
+     * Returns a test document
+     * <p/>
+     * <pre>
+     * test
+     *     outer-list
+     *          id 1
+     *     outer-list
+     *          id 2
+     *          inner-list
+     *                  name "one"
+     *          inner-list
+     *                  name "two"
+     *
+     * </pre>
+     *
+     * @return
+     */
+    public static NormalizedNode<?, ?> createDocumentOne(
+        SchemaContext schemaContext) {
+        return ImmutableContainerNodeBuilder
             .create()
             .withNodeIdentifier(
-                (new InstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME,
-                    "number"), 5))).withValue(5).build();
-    final LeafSetEntryNode<Object> fifteen =
-        ImmutableLeafSetEntryNodeBuilder
+                new YangInstanceIdentifier.NodeIdentifier(schemaContext.getQName()))
+            .withChild(createTestContainer()).build();
+
+    }
+
+    public static ContainerNode createTestContainer() {
+
+
+        // Create a list of shoes
+        // This is to test leaf list entry
+        final LeafSetEntryNode<Object> nike =
+            ImmutableLeafSetEntryNodeBuilder
+                .create()
+                .withNodeIdentifier(
+                    new YangInstanceIdentifier.NodeWithValue(
+                        QName.create(TEST_QNAME,
+                            "shoe"), "nike")
+                ).withValue("nike").build();
+
+        final LeafSetEntryNode<Object> puma =
+            ImmutableLeafSetEntryNodeBuilder
+                .create()
+                .withNodeIdentifier(
+                    new YangInstanceIdentifier.NodeWithValue(
+                        QName.create(TEST_QNAME,
+                            "shoe"), "puma")
+                ).withValue("puma").build();
+
+        final LeafSetNode<Object> shoes =
+            ImmutableLeafSetNodeBuilder
+                .create()
+                .withNodeIdentifier(
+                    new YangInstanceIdentifier.NodeIdentifier(
+                        QName.create(TEST_QNAME,
+                            "shoe"))
+                ).withChild(nike).withChild(puma).build();
+
+
+        // Test a leaf-list where each entry contains an identity
+        final LeafSetEntryNode<Object> cap1 =
+            ImmutableLeafSetEntryNodeBuilder
+                .create()
+                .withNodeIdentifier(
+                    new YangInstanceIdentifier.NodeWithValue(
+                        QName.create(TEST_QNAME,
+                            "capability"), DESC_QNAME)
+                ).withValue(DESC_QNAME).build();
+
+        final LeafSetNode<Object> capabilities =
+            ImmutableLeafSetNodeBuilder
+                .create()
+                .withNodeIdentifier(
+                    new YangInstanceIdentifier.NodeIdentifier(
+                        QName.create(TEST_QNAME,
+                            "capability"))
+                ).withChild(cap1).build();
+
+        ContainerNode switchFeatures = ImmutableContainerNodeBuilder
             .create()
-            .withNodeIdentifier(
-                (new InstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME,
-                    "number"), 15))).withValue(15).build();
-    final LeafSetNode<Object> numbers =
-        ImmutableLeafSetNodeBuilder
+            .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(
+                SWITCH_FEATURES_QNAME))
+            .withChild(capabilities)
+            .build();
+
+        // Create a leaf list with numbers
+        final LeafSetEntryNode<Object> five =
+            ImmutableLeafSetEntryNodeBuilder
+                .create()
+                .withNodeIdentifier(
+                    (new YangInstanceIdentifier.NodeWithValue(
+                        QName.create(TEST_QNAME,
+                            "number"), 5))
+                ).withValue(5).build();
+        final LeafSetEntryNode<Object> fifteen =
+            ImmutableLeafSetEntryNodeBuilder
+                .create()
+                .withNodeIdentifier(
+                    (new YangInstanceIdentifier.NodeWithValue(
+                        QName.create(TEST_QNAME,
+                            "number"), 15))
+                ).withValue(15).build();
+        final LeafSetNode<Object> numbers =
+            ImmutableLeafSetNodeBuilder
+                .create()
+                .withNodeIdentifier(
+                    new YangInstanceIdentifier.NodeIdentifier(
+                        QName.create(TEST_QNAME,
+                            "number"))
+                ).withChild(five).withChild(fifteen).build();
+
+
+        // Create augmentations
+        MapEntryNode mapEntry = createAugmentedListEntry(1, "First Test");
+
+
+        // Create the document
+        return ImmutableContainerNodeBuilder
             .create()
             .withNodeIdentifier(
-                new InstanceIdentifier.NodeIdentifier(QName.create(TEST_QNAME,
-                    "number"))).withChild(five).withChild(fifteen).build();
-
-
-    Set<QName> childAugmentations = new HashSet<>();
-    childAugmentations.add(AUG_QNAME);
-    final InstanceIdentifier.AugmentationIdentifier augmentationIdentifier =
-        new InstanceIdentifier.AugmentationIdentifier(null, childAugmentations);
-    final AugmentationNode augmentationNode =
-        Builders.augmentationBuilder()
-            .withNodeIdentifier(augmentationIdentifier)
-            .withChild(ImmutableNodes.leafNode(AUG_QNAME, "First Test"))
+                new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME))
+            .withChild(ImmutableNodes.leafNode(DESC_QNAME, DESC))
+            .withChild(ImmutableNodes.leafNode(POINTER_QNAME, "pointer"))
+            .withChild(ImmutableNodes.leafNode(SOME_REF_QNAME,
+                YangInstanceIdentifier.builder().build()))
+            .withChild(ImmutableNodes.leafNode(MYIDENTITY_QNAME, DESC_QNAME))
+
+                //.withChild(augmentationNode)
+            .withChild(shoes)
+            .withChild(numbers)
+            .withChild(switchFeatures)
+            .withChild(mapNodeBuilder(AUGMENTED_LIST_QNAME).withChild(mapEntry).build())
+            .withChild(
+                mapNodeBuilder(OUTER_LIST_QNAME)
+                    .withChild(mapEntry(OUTER_LIST_QNAME, ID_QNAME, ONE_ID))
+                    .withChild(BAR_NODE).build()
+            ).build();
+
+    }
+
+    public static MapEntryNode createAugmentedListEntry(int id, String name) {
+
+        Set<QName> childAugmentations = new HashSet<>();
+        childAugmentations.add(AUG_CONT_QNAME);
+
+        ContainerNode augCont = ImmutableContainerNodeBuilder
+            .create()
+            .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(AUG_CONT_QNAME))
+            .withChild(ImmutableNodes.leafNode(AUG_NAME_QNAME, name))
             .build();
-    return ImmutableContainerNodeBuilder
-        .create()
-        .withNodeIdentifier(new InstanceIdentifier.NodeIdentifier(TEST_QNAME))
-        .withChild(ImmutableNodes.leafNode(DESC_QNAME, DESC))
-        .withChild(augmentationNode)
-        .withChild(shoes)
-        .withChild(numbers)
-        .withChild(
-            mapNodeBuilder(OUTER_LIST_QNAME)
-                .withChild(mapEntry(OUTER_LIST_QNAME, ID_QNAME, ONE_ID))
-                .withChild(BAR_NODE).build()).build();
-
-  }
-
-
-  public static ContainerNode createFamily() {
-    final DataContainerNodeAttrBuilder<InstanceIdentifier.NodeIdentifier, ContainerNode> familyContainerBuilder =
-        ImmutableContainerNodeBuilder.create().withNodeIdentifier(
-            new InstanceIdentifier.NodeIdentifier(FAMILY_QNAME));
-
-    final CollectionNodeBuilder<MapEntryNode, MapNode> childrenBuilder =
-        mapNodeBuilder(CHILDREN_QNAME);
-
-    final DataContainerNodeBuilder<InstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> firstChildBuilder =
-        mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID);
-    final DataContainerNodeBuilder<InstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> secondChildBuilder =
-        mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID);
-
-    final DataContainerNodeBuilder<InstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> firstGrandChildBuilder =
-        mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
-            FIRST_GRAND_CHILD_ID);
-    final DataContainerNodeBuilder<InstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> secondGrandChildBuilder =
-        mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
-            SECOND_GRAND_CHILD_ID);
-
-    firstGrandChildBuilder
-        .withChild(
-            ImmutableNodes.leafNode(GRAND_CHILD_NUMBER_QNAME,
-                FIRST_GRAND_CHILD_ID)).withChild(
-        ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
-            FIRST_GRAND_CHILD_NAME));
-
-    secondGrandChildBuilder.withChild(
-        ImmutableNodes
-            .leafNode(GRAND_CHILD_NUMBER_QNAME, SECOND_GRAND_CHILD_ID))
-        .withChild(
-            ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
-                SECOND_GRAND_CHILD_NAME));
 
-    firstChildBuilder
-        .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, FIRST_CHILD_ID))
-        .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, FIRST_CHILD_NAME))
-        .withChild(
-            mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
-                firstGrandChildBuilder.build()).build());
 
+        final YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier =
+            new YangInstanceIdentifier.AugmentationIdentifier(childAugmentations);
 
-    secondChildBuilder
-        .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, SECOND_CHILD_ID))
-        .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, SECOND_CHILD_NAME))
-        .withChild(
-            mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
-                firstGrandChildBuilder.build()).build());
+        final AugmentationNode augmentationNode =
+            Builders.augmentationBuilder()
+                .withNodeIdentifier(augmentationIdentifier)
+                .withChild(augCont)
+                .build();
 
-    childrenBuilder.withChild(firstChildBuilder.build());
-    childrenBuilder.withChild(secondChildBuilder.build());
-
-    return familyContainerBuilder.withChild(childrenBuilder.build()).build();
-  }
+        return ImmutableMapEntryNodeBuilder.create()
+            .withNodeIdentifier(
+                new YangInstanceIdentifier.NodeIdentifierWithPredicates(
+                    AUGMENTED_LIST_QNAME, ID_QNAME, id))
+            .withChild(ImmutableNodes.leafNode(ID_QNAME, id))
+            .withChild(augmentationNode).build();
+    }
+
+
+    public static ContainerNode createFamily() {
+        final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode>
+            familyContainerBuilder =
+            ImmutableContainerNodeBuilder.create().withNodeIdentifier(
+                new YangInstanceIdentifier.NodeIdentifier(FAMILY_QNAME));
+
+        final CollectionNodeBuilder<MapEntryNode, MapNode> childrenBuilder =
+            mapNodeBuilder(CHILDREN_QNAME);
+
+        final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
+            firstChildBuilder =
+            mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID);
+        final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
+            secondChildBuilder =
+            mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME,
+                SECOND_CHILD_ID);
+
+        final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
+            firstGrandChildBuilder =
+            mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+                FIRST_GRAND_CHILD_ID);
+        final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
+            secondGrandChildBuilder =
+            mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+                SECOND_GRAND_CHILD_ID);
+
+        firstGrandChildBuilder
+            .withChild(
+                ImmutableNodes.leafNode(GRAND_CHILD_NUMBER_QNAME,
+                    FIRST_GRAND_CHILD_ID)
+            ).withChild(
+            ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
+                FIRST_GRAND_CHILD_NAME)
+        );
+
+        secondGrandChildBuilder.withChild(
+            ImmutableNodes
+                .leafNode(GRAND_CHILD_NUMBER_QNAME, SECOND_GRAND_CHILD_ID)
+        )
+            .withChild(
+                ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
+                    SECOND_GRAND_CHILD_NAME)
+            );
+
+        firstChildBuilder
+            .withChild(
+                ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, FIRST_CHILD_ID))
+            .withChild(
+                ImmutableNodes.leafNode(CHILD_NAME_QNAME, FIRST_CHILD_NAME))
+            .withChild(
+                mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
+                    firstGrandChildBuilder.build()).build()
+            );
+
+
+        secondChildBuilder
+            .withChild(
+                ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, SECOND_CHILD_ID))
+            .withChild(
+                ImmutableNodes.leafNode(CHILD_NAME_QNAME, SECOND_CHILD_NAME))
+            .withChild(
+                mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
+                    firstGrandChildBuilder.build()).build()
+            );
+
+        childrenBuilder.withChild(firstChildBuilder.build());
+        childrenBuilder.withChild(secondChildBuilder.build());
+
+        return familyContainerBuilder.withChild(childrenBuilder.build())
+            .build();
+    }
 
 }
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessagesTest.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessagesTest.java
new file mode 100644 (file)
index 0000000..2b1ee56
--- /dev/null
@@ -0,0 +1,10 @@
+package org.opendaylight.controller.protobuff.messages.transaction;
+
+/**
+ * @author: syedbahm
+ * Date: 7/7/14
+ */
+public class ShardTransactionMessagesTest {
+
+
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/application.conf b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/application.conf
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-augmentation.yang b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-augmentation.yang
new file mode 100644 (file)
index 0000000..c305572
--- /dev/null
@@ -0,0 +1,21 @@
+module odl-datastore-augmentation {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug";
+    prefix "store-aug";
+
+    import odl-datastore-test {prefix test;revision-date "2014-03-13";}
+
+    revision "2014-03-13" {
+        description "Initial revision.";
+    }
+
+
+    augment "/test:test/test:augmented-list" {
+        container cont {
+            leaf name {
+                type string;
+            }
+        }
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-test-notification.yang b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-test-notification.yang
new file mode 100644 (file)
index 0000000..25cc53a
--- /dev/null
@@ -0,0 +1,33 @@
+module odl-datastore-test-notification {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test";
+    prefix "notification-test-using-family-model";
+
+    revision "2014-04-17" {
+        description "Family structure created on ";
+    }
+
+    container family {
+        leaf desc {
+            type string;
+        }
+        list children {
+            key child-number;
+            leaf child-number {
+                type uint16;
+            }
+            leaf child-name {
+                type string;
+            }
+           list grand-children {
+                key grand-child-number;
+                leaf grand-child-number {
+                    type uint16;
+                }
+                leaf grand-child-name {
+                    type string;
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
index 32ec2777ce2fd6c55c47cb6d3602b6e3c1e380e0..e4eca7b71738df8e06ec7bde21f0344160c68b40 100644 (file)
@@ -1,33 +1,91 @@
 module odl-datastore-test {
     yang-version 1;
-    namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test";
-    prefix "notification-test-using-family-model";
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test";
+    prefix "store-test";
 
-    revision "2014-04-15" {
-        description "Family structure created on ";
+    revision "2014-03-13" {
+        description "Initial revision.";
     }
 
-    container family {
+    identity feature-capability {
+    }
+
+    container test {
         leaf desc {
             type string;
         }
-        list children {
-            key child-number;
-            leaf child-number {
+        list outer-list {
+            key id;
+            leaf id {
                 type uint16;
             }
-            leaf child-name {
-                type string;
-            }
-           list grand-children {
-                key grand-child-number;
-                leaf grand-child-number {
-                    type uint16;
+            choice outer-choice {
+                case one {
+                    leaf one {
+                        type string;
+                    }
+                }
+                case two-three {
+                    leaf two {
+                        type string;
+                    }
+                    leaf three {
+                        type string;
+                    }
+               }
+           }
+           list inner-list {
+                key name;
+                leaf name {
+                    type string;
                 }
-                leaf grand-child-name {
+                leaf value {
                     type string;
                 }
             }
         }
+
+        leaf-list shoe {
+            type string;
+        }
+
+        leaf-list number {
+            type uint8;
+        }
+
+        leaf pointer {
+            type leafref {
+                path "/network-topology/topology/node/termination-point/tp-id";
+            }
+        }
+
+        leaf some-ref {
+            type instance-identifier;
+        }
+
+        leaf myidentity {
+            type identityref {
+                base feature-capability;
+            }
+        }
+
+        container switch-features {
+            leaf-list capability {
+                type identityref {
+                    base feature-capability;
+                }
+
+            }
+        }
+
+        list augmented-list {
+            key id;
+
+            leaf id {
+                type uint8;
+            }
+        }
+
+
     }
-}
\ No newline at end of file
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/pom.xml b/opendaylight/md-sal/sal-remoterpc-connector/pom.xml
new file mode 100644 (file)
index 0000000..ce3bfe9
--- /dev/null
@@ -0,0 +1,203 @@
+<?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>sal-parent</artifactId>
+    <version>1.1-SNAPSHOT</version>
+  </parent>
+  <artifactId>sal-remoterpc-connector</artifactId>
+  <packaging>bundle</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>com.typesafe.akka</groupId>
+      <artifactId>akka-actor_${scala.version}</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>com.typesafe.akka</groupId>
+      <artifactId>akka-cluster_${scala.version}</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>com.typesafe.akka</groupId>
+      <artifactId>akka-remote_${scala.version}</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>com.typesafe.akka</groupId>
+      <artifactId>akka-testkit_${scala.version}</artifactId>
+    </dependency>
+
+    <!-- SAL Dependencies -->
+
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-connector-api</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-common-util</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-core-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>netconf-util</artifactId>
+    </dependency>
+      <dependency>
+          <groupId>org.opendaylight.controller</groupId>
+          <artifactId>sal-core-spi</artifactId>
+      </dependency>
+      <dependency>
+          <groupId>org.opendaylight.controller</groupId>
+          <artifactId>sal-common-impl</artifactId>
+      </dependency>
+    <!-- Yang tools-->
+
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-data-api</artifactId>
+
+    </dependency>
+      <dependency>
+          <groupId>org.opendaylight.yangtools</groupId>
+          <artifactId>yang-model-api</artifactId>
+
+      </dependency>
+
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-data-impl</artifactId>
+
+    </dependency>
+
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-common</artifactId>
+
+    </dependency>
+
+
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.scala-lang</groupId>
+      <artifactId>scala-library</artifactId>
+    </dependency>
+
+    <!-- Test Dependencies -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-all</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>${slf4j.version}</version>
+      <scope>test</scope>
+    </dependency>
+      <dependency>
+          <groupId>org.opendaylight.yangtools</groupId>
+          <artifactId>yang-parser-impl</artifactId>
+          <scope>test</scope>
+      </dependency>
+      <dependency>
+          <groupId>com.google.collections</groupId>
+          <artifactId>google-collections</artifactId>
+          <version>1.0</version>
+          <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>${project.groupId}.${project.artifactId}</Bundle-Name>
+            <Export-package></Export-package>
+            <Private-Package></Private-Package>
+            <Import-Package>!org.jboss.*;!com.jcraft.*;*</Import-Package>
+            <Embed-Dependency>
+                !sal*;
+                !*config-api*;
+                !*testkit*;
+                *protobuf*;
+                akka*;
+                *scala*;
+                *config*;
+                *netty*;
+                *uncommons*;
+            </Embed-Dependency>
+            <Embed-Transitive>true</Embed-Transitive>
+          </instructions>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.opendaylight.yangtools</groupId>
+        <artifactId>yang-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>config</id>
+            <goals>
+              <goal>generate-sources</goal>
+            </goals>
+            <configuration>
+              <codeGenerators>
+                <generator>
+                  <codeGeneratorClass>org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator</codeGeneratorClass>
+                  <outputBaseDir>${jmxGeneratorPath}</outputBaseDir>
+                  <additionalConfiguration>
+                    <namespaceToPackage1>urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang</namespaceToPackage1>
+                  </additionalConfiguration>
+                </generator>
+                <generator>
+                  <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>
+                  <outputBaseDir>${salGeneratorPath}</outputBaseDir>
+                </generator>
+              </codeGenerators>
+              <inspectDependencies>true</inspectDependencies>
+            </configuration>
+          </execution>
+        </executions>
+      </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:Architecture:Clustering</url>
+  </scm>
+</project>
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/config/yang/config/remote_rpc_connector/RemoteRPCBrokerModule.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/config/yang/config/remote_rpc_connector/RemoteRPCBrokerModule.java
new file mode 100644 (file)
index 0000000..9824889
--- /dev/null
@@ -0,0 +1,25 @@
+package org.opendaylight.controller.config.yang.config.remote_rpc_connector;
+
+import org.opendaylight.controller.remote.rpc.RemoteRpcProviderFactory;
+import org.opendaylight.controller.sal.core.api.Broker;
+
+public class RemoteRPCBrokerModule extends org.opendaylight.controller.config.yang.config.remote_rpc_connector.AbstractRemoteRPCBrokerModule {
+  public RemoteRPCBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+    super(identifier, dependencyResolver);
+  }
+
+  public RemoteRPCBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.remote_rpc_connector.RemoteRPCBrokerModule oldModule, java.lang.AutoCloseable oldInstance) {
+    super(identifier, dependencyResolver, oldModule, oldInstance);
+  }
+
+  @Override
+  public void customValidation() {
+     // add custom validation form module attributes here.
+  }
+
+  @Override
+  public java.lang.AutoCloseable createInstance() {
+    Broker broker = getDomBrokerDependency();
+    return RemoteRpcProviderFactory.createInstance(broker);
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/config/yang/config/remote_rpc_connector/RemoteRPCBrokerModuleFactory.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/config/yang/config/remote_rpc_connector/RemoteRPCBrokerModuleFactory.java
new file mode 100644 (file)
index 0000000..330845b
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: remote-rpc-connector yang module local name: remote-rpc-connector
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Jul 07 17:02:25 PDT 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.config.remote_rpc_connector;
+
+
+public class RemoteRPCBrokerModuleFactory extends org.opendaylight.controller.config.yang.config.remote_rpc_connector.AbstractRemoteRPCBrokerModuleFactory {
+
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/AbstractUntypedActor.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/AbstractUntypedActor.java
new file mode 100644 (file)
index 0000000..66593ae
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * 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.remote.rpc;
+
+import akka.actor.UntypedActor;
+import akka.event.Logging;
+import akka.event.LoggingAdapter;
+import org.opendaylight.controller.remote.rpc.messages.Monitor;
+
+public abstract class AbstractUntypedActor extends UntypedActor {
+    protected final LoggingAdapter LOG =
+        Logging.getLogger(getContext().system(), this);
+
+
+    public AbstractUntypedActor(){
+        LOG.debug("Actor created {}", getSelf());
+        getContext().
+            system().
+            actorSelection("user/termination-monitor").
+            tell(new Monitor(getSelf()), getSelf());
+    }
+
+    @Override public void onReceive(Object message) throws Exception {
+        LOG.debug("Received message {}", message);
+        handleReceive(message);
+        LOG.debug("Done handling message {}", message);
+    }
+
+    protected abstract void handleReceive(Object message) throws Exception;
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/ActorSystemFactory.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/ActorSystemFactory.java
new file mode 100644 (file)
index 0000000..4a6124a
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * 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.remote.rpc;
+
+import akka.actor.ActorSystem;
+import akka.actor.Props;
+import com.google.common.base.Function;
+import com.typesafe.config.ConfigFactory;
+
+import javax.annotation.Nullable;
+
+public class ActorSystemFactory {
+    private static final ActorSystem actorSystem = (new Function<Void, ActorSystem>(){
+
+        @Nullable @Override public ActorSystem apply(@Nullable Void aVoid) {
+                ActorSystem system =
+                    ActorSystem.create("opendaylight-rpc", ConfigFactory
+                        .load().getConfig("odl-cluster"));
+                system.actorOf(Props.create(TerminationMonitor.class), "termination-monitor");
+                return system;
+        }
+    }).apply(null);
+
+    public static final ActorSystem getInstance(){
+        return actorSystem;
+    }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcImplementation.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcImplementation.java
new file mode 100644 (file)
index 0000000..d384144
--- /dev/null
@@ -0,0 +1,86 @@
+package org.opendaylight.controller.remote.rpc;
+
+import akka.actor.ActorRef;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import org.opendaylight.controller.remote.rpc.messages.ErrorResponse;
+import org.opendaylight.controller.remote.rpc.messages.InvokeRoutedRpc;
+import org.opendaylight.controller.remote.rpc.messages.InvokeRpc;
+import org.opendaylight.controller.remote.rpc.messages.RpcResponse;
+import org.opendaylight.controller.remote.rpc.utils.ActorUtil;
+import org.opendaylight.controller.remote.rpc.utils.XmlUtils;
+import org.opendaylight.controller.sal.core.api.RoutedRpcDefaultImplementation;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collections;
+import java.util.Set;
+
+public class RemoteRpcImplementation implements RpcImplementation,
+    RoutedRpcDefaultImplementation {
+  private static final Logger LOG = LoggerFactory.getLogger(RemoteRpcImplementation.class);
+  private ActorRef rpcBroker;
+  private SchemaContext schemaContext;
+
+  public RemoteRpcImplementation(ActorRef rpcBroker, SchemaContext schemaContext) {
+    this.rpcBroker = rpcBroker;
+    this.schemaContext = schemaContext;
+  }
+
+  @Override
+  public ListenableFuture<RpcResult<CompositeNode>> invokeRpc(QName rpc, YangInstanceIdentifier identifier, CompositeNode input) {
+    InvokeRoutedRpc rpcMsg = new InvokeRoutedRpc(rpc, identifier, input);
+
+    return executeMsg(rpcMsg);
+  }
+
+  @Override
+  public Set<QName> getSupportedRpcs() {
+    // TODO : check if we need to get this from routing registry
+    return Collections.emptySet();
+  }
+
+  @Override
+  public ListenableFuture<RpcResult<CompositeNode>> invokeRpc(QName rpc, CompositeNode input) {
+    InvokeRpc rpcMsg = new InvokeRpc(rpc, input);
+    return executeMsg(rpcMsg);
+  }
+
+  private ListenableFuture<RpcResult<CompositeNode>> executeMsg(Object rpcMsg) {
+    ListenableFuture<RpcResult<CompositeNode>> listenableFuture = null;
+
+    try {
+      Object response = ActorUtil.executeLocalOperation(rpcBroker, rpcMsg, ActorUtil.ASK_DURATION, ActorUtil.AWAIT_DURATION);
+      if(response instanceof RpcResponse) {
+
+        RpcResponse rpcResponse = (RpcResponse) response;
+        CompositeNode result = XmlUtils.xmlToCompositeNode(rpcResponse.getResultCompositeNode());
+        listenableFuture = Futures.immediateFuture(RpcResultBuilder.success(result).build());
+
+      } else if(response instanceof ErrorResponse) {
+
+        ErrorResponse errorResponse = (ErrorResponse) response;
+        Exception e = errorResponse.getException();
+        final RpcResultBuilder<CompositeNode> failed = RpcResultBuilder.failed();
+        failed.withError(null, null, e.getMessage(), null, null, e.getCause());
+        listenableFuture = Futures.immediateFuture(failed.build());
+
+      }
+    } catch (Exception e) {
+      LOG.error("Error occurred while invoking RPC actor {}", e.toString());
+
+      final RpcResultBuilder<CompositeNode> failed = RpcResultBuilder.failed();
+      failed.withError(null, null, e.getMessage(), null, null, e.getCause());
+      listenableFuture = Futures.immediateFuture(failed.build());
+    }
+
+    return listenableFuture;
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcProvider.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcProvider.java
new file mode 100644 (file)
index 0000000..3df572d
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * 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.remote.rpc;
+
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSystem;
+import org.opendaylight.controller.remote.rpc.messages.UpdateSchemaContext;
+import org.opendaylight.controller.remote.rpc.registry.ClusterWrapper;
+import org.opendaylight.controller.remote.rpc.registry.ClusterWrapperImpl;
+import org.opendaylight.controller.sal.core.api.Broker;
+import org.opendaylight.controller.sal.core.api.Provider;
+import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
+import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collection;
+
+/**
+ * This is the base class which initialize all the actors, listeners and
+ * default RPc implementation so remote invocation of rpcs.
+ */
+public class RemoteRpcProvider implements AutoCloseable, Provider, SchemaContextListener {
+
+  private static final Logger LOG = LoggerFactory.getLogger(RemoteRpcProvider.class);
+
+  private final ActorSystem actorSystem;
+  private final RpcProvisionRegistry rpcProvisionRegistry;
+  private Broker.ProviderSession brokerSession;
+  private SchemaContext schemaContext;
+  private ActorRef rpcManager;
+
+
+  public RemoteRpcProvider(ActorSystem actorSystem, RpcProvisionRegistry rpcProvisionRegistry) {
+    this.actorSystem = actorSystem;
+    this.rpcProvisionRegistry = rpcProvisionRegistry;
+  }
+
+  @Override
+  public void close() throws Exception {
+    this.actorSystem.shutdown();
+  }
+
+  @Override
+  public void onSessionInitiated(Broker.ProviderSession session) {
+    this.brokerSession = session;
+    start();
+  }
+
+  @Override
+  public Collection<ProviderFunctionality> getProviderFunctionality() {
+    return null;
+  }
+
+  private void start() {
+    LOG.info("Starting all rpc listeners and actors.");
+    // Create actor to handle and sync routing table in cluster
+    ClusterWrapper clusterWrapper = new ClusterWrapperImpl(actorSystem);
+    SchemaService schemaService = brokerSession.getService(SchemaService.class);
+    schemaContext = schemaService.getGlobalContext();
+
+    rpcManager = actorSystem.actorOf(RpcManager.props(clusterWrapper, schemaContext, brokerSession, rpcProvisionRegistry), "rpc");
+
+    LOG.debug("Rpc actors are created.");
+  }
+
+
+  @Override
+  public void onGlobalContextUpdated(SchemaContext schemaContext) {
+    this.schemaContext = schemaContext;
+    rpcManager.tell(new UpdateSchemaContext(schemaContext), null);
+
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcProviderFactory.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcProviderFactory.java
new file mode 100644 (file)
index 0000000..4c40ca1
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * 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.remote.rpc;
+
+
+import org.opendaylight.controller.sal.core.api.Broker;
+import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
+
+public class RemoteRpcProviderFactory {
+    public static RemoteRpcProvider createInstance(final Broker broker){
+      RemoteRpcProvider rpcProvider =
+          new RemoteRpcProvider(ActorSystemFactory.getInstance(), (RpcProvisionRegistry) broker);
+      broker.registerProvider(rpcProvider);
+      return rpcProvider;
+    }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RouteIdentifierImpl.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RouteIdentifierImpl.java
new file mode 100644 (file)
index 0000000..85d2138
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * 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.remote.rpc;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.sal.connector.api.RpcRouter;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+
+import java.io.Serializable;
+
+public class RouteIdentifierImpl implements RpcRouter.RouteIdentifier<QName, QName, YangInstanceIdentifier>,Serializable {
+  private static final long serialVersionUID = 1L;
+
+  private final QName context;
+  private final QName type;
+  private final YangInstanceIdentifier route;
+
+  public RouteIdentifierImpl(final QName context, final QName type, final YangInstanceIdentifier route) {
+    Preconditions.checkNotNull(type, "Rpc type should not be null");
+    this.context = context;
+    this.type = type;
+    this.route = route;
+  }
+
+  @Override
+  public QName getContext() {
+    return this.context;
+  }
+
+  @Override
+  public QName getType() {
+    return this.type;
+  }
+
+  @Override
+  public YangInstanceIdentifier getRoute() {
+    return this.route;
+  }
+
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) return true;
+    if (o == null || getClass() != o.getClass()) return false;
+
+    RouteIdentifierImpl that = (RouteIdentifierImpl) o;
+
+    if (context == null){
+      if (that.getContext() != null)  return false;
+    }else
+      if (!context.equals(that.context)) return false;
+
+    if (route == null){
+      if (that.getRoute() != null) return false;
+    }else
+      if (!route.equals(that.route)) return false;
+
+    if (type == null){
+      if (that.getType() != null) return false;
+    }else
+      if (!type.equals(that.type)) return false;
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    int prime = 31;
+    int result = 0;
+    result = prime * result + (context == null ? 0:context.hashCode());
+    result = prime * result + (type    == null ? 0:type.hashCode());
+    result = prime * result + (route   == null ? 0:route.hashCode());
+    return result;
+  }
+
+  @Override
+  public String toString() {
+    return "RouteIdentifierImpl{" +
+        "context=" + context +
+        ", type=" + type +
+        ", route=" + route +
+        '}';
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RoutedRpcListener.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RoutedRpcListener.java
new file mode 100644 (file)
index 0000000..a6eeac0
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * 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.remote.rpc;
+
+
+import akka.actor.ActorRef;
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.md.sal.common.api.routing.RouteChange;
+import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
+import org.opendaylight.controller.remote.rpc.messages.AddRoutedRpc;
+import org.opendaylight.controller.remote.rpc.messages.RemoveRoutedRpc;
+import org.opendaylight.controller.remote.rpc.utils.ActorUtil;
+import org.opendaylight.controller.sal.connector.api.RpcRouter;
+import org.opendaylight.controller.sal.core.api.RpcRoutingContext;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+public class RoutedRpcListener implements RouteChangeListener<RpcRoutingContext, YangInstanceIdentifier>{
+  private static final Logger LOG = LoggerFactory.getLogger(RoutedRpcListener.class);
+  private final ActorRef rpcRegistry;
+  private final String actorPath;
+
+  public RoutedRpcListener(ActorRef rpcRegistry, String actorPath) {
+    Preconditions.checkNotNull(rpcRegistry, "rpc registry actor should not be null");
+    Preconditions.checkNotNull(actorPath, "actor path of rpc broker on current node should not be null");
+
+    this.rpcRegistry = rpcRegistry;
+    this.actorPath = actorPath;
+  }
+
+  @Override
+  public void onRouteChange(RouteChange<RpcRoutingContext, YangInstanceIdentifier> routeChange) {
+    Map<RpcRoutingContext, Set<YangInstanceIdentifier>> announcements = routeChange.getAnnouncements();
+    announce(getRouteIdentifiers(announcements));
+
+    Map<RpcRoutingContext, Set<YangInstanceIdentifier>> removals = routeChange.getRemovals();
+    remove(getRouteIdentifiers(removals));
+  }
+
+  /**
+   *
+   * @param announcements
+   */
+  private void announce(Set<RpcRouter.RouteIdentifier<?, ?, ?>> announcements) {
+    LOG.debug("Announcing [{}]", announcements);
+    AddRoutedRpc addRpcMsg = new AddRoutedRpc(announcements, actorPath);
+    try {
+      ActorUtil.executeLocalOperation(rpcRegistry, addRpcMsg, ActorUtil.LOCAL_ASK_DURATION, ActorUtil.LOCAL_AWAIT_DURATION);
+    } catch (Exception e) {
+      // Just logging it because Akka API throws this exception
+      LOG.error(e.toString());
+    }
+  }
+
+  /**
+   *
+   * @param removals
+   */
+  private void remove(Set<RpcRouter.RouteIdentifier<?, ?, ?>> removals){
+    LOG.debug("Removing [{}]", removals);
+    RemoveRoutedRpc removeRpcMsg = new RemoveRoutedRpc(removals, actorPath);
+    try {
+      ActorUtil.executeLocalOperation(rpcRegistry, removeRpcMsg, ActorUtil.LOCAL_ASK_DURATION, ActorUtil.LOCAL_AWAIT_DURATION);
+    } catch (Exception e) {
+      // Just logging it because Akka API throws this exception
+      LOG.error(e.toString());
+    }
+  }
+
+  /**
+   *
+   * @param changes
+   * @return
+   */
+  private Set<RpcRouter.RouteIdentifier<?, ?, ?>> getRouteIdentifiers(Map<RpcRoutingContext, Set<YangInstanceIdentifier>> changes) {
+    RouteIdentifierImpl routeId = null;
+    Set<RpcRouter.RouteIdentifier<?, ?, ?>> routeIdSet = new HashSet<>();
+
+    for (RpcRoutingContext context : changes.keySet()){
+      for (YangInstanceIdentifier instanceId : changes.get(context)){
+        routeId = new RouteIdentifierImpl(null, context.getRpc(), instanceId);
+        routeIdSet.add(routeId);
+      }
+    }
+    return routeIdSet;
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RpcBroker.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RpcBroker.java
new file mode 100644 (file)
index 0000000..26e8e96
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * 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.remote.rpc;
+
+import akka.actor.ActorRef;
+import akka.actor.Props;
+import akka.japi.Creator;
+import org.opendaylight.controller.remote.rpc.messages.ErrorResponse;
+import org.opendaylight.controller.remote.rpc.messages.ExecuteRpc;
+import org.opendaylight.controller.remote.rpc.messages.GetRoutedRpc;
+import org.opendaylight.controller.remote.rpc.messages.GetRoutedRpcReply;
+import org.opendaylight.controller.remote.rpc.messages.GetRpc;
+import org.opendaylight.controller.remote.rpc.messages.GetRpcReply;
+import org.opendaylight.controller.remote.rpc.messages.InvokeRoutedRpc;
+import org.opendaylight.controller.remote.rpc.messages.InvokeRpc;
+import org.opendaylight.controller.remote.rpc.messages.RpcResponse;
+import org.opendaylight.controller.remote.rpc.utils.ActorUtil;
+import org.opendaylight.controller.remote.rpc.utils.XmlUtils;
+import org.opendaylight.controller.sal.core.api.Broker;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.Future;
+
+/**
+ * Actor to initiate execution of remote RPC on other nodes of the cluster.
+ */
+
+public class RpcBroker extends AbstractUntypedActor {
+
+  private static final Logger LOG = LoggerFactory.getLogger(RpcBroker.class);
+  private final Broker.ProviderSession brokerSession;
+  private final ActorRef rpcRegistry;
+  private SchemaContext schemaContext;
+
+  private RpcBroker(Broker.ProviderSession brokerSession, ActorRef rpcRegistry, SchemaContext schemaContext){
+    this.brokerSession = brokerSession;
+    this.rpcRegistry = rpcRegistry;
+    this.schemaContext = schemaContext;
+  }
+
+  public static Props props(final Broker.ProviderSession brokerSession, final ActorRef rpcRegistry, final SchemaContext schemaContext){
+    return Props.create(new Creator<RpcBroker>(){
+
+      @Override
+      public RpcBroker create() throws Exception {
+        return new RpcBroker(brokerSession, rpcRegistry, schemaContext);
+      }
+    });
+  }
+  @Override
+  protected void handleReceive(Object message) throws Exception {
+    if(message instanceof InvokeRoutedRpc) {
+      invokeRemoteRoutedRpc((InvokeRoutedRpc) message);
+    } else if(message instanceof InvokeRpc) {
+      invokeRemoteRpc((InvokeRpc) message);
+    } else if(message instanceof ExecuteRpc) {
+      executeRpc((ExecuteRpc) message);
+    }
+  }
+
+  private void invokeRemoteRoutedRpc(InvokeRoutedRpc msg) {
+    // Look up the remote actor to execute rpc
+    LOG.debug("Looking up the remote actor for route {}", msg);
+    try {
+      RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, msg.getRpc(), msg.getIdentifier());
+      GetRoutedRpc routedRpcMsg = new GetRoutedRpc(routeId);
+      GetRoutedRpcReply rpcReply = (GetRoutedRpcReply) ActorUtil.executeLocalOperation(rpcRegistry, routedRpcMsg, ActorUtil.LOCAL_ASK_DURATION, ActorUtil.LOCAL_AWAIT_DURATION);
+
+      String remoteActorPath = rpcReply.getRoutePath();
+      if(remoteActorPath == null) {
+        LOG.debug("No remote actor found for rpc execution.");
+
+        getSender().tell(new ErrorResponse(
+          new IllegalStateException("No remote actor found for rpc execution.")), self());
+      } else {
+
+        ExecuteRpc executeMsg = new ExecuteRpc(XmlUtils.inputCompositeNodeToXml(msg.getInput(), schemaContext), msg.getRpc());
+
+        Object operationRes = ActorUtil.executeRemoteOperation(this.context().actorSelection(remoteActorPath),
+            executeMsg, ActorUtil.REMOTE_ASK_DURATION, ActorUtil.REMOTE_AWAIT_DURATION);
+
+        getSender().tell(operationRes, self());
+      }
+    } catch (Exception e) {
+        LOG.error(e.toString());
+        getSender().tell(new ErrorResponse(e), self());
+    }
+  }
+
+  private void invokeRemoteRpc(InvokeRpc msg) {
+    // Look up the remote actor to execute rpc
+    LOG.debug("Looking up the remote actor for route {}", msg);
+    try {
+      RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, msg.getRpc(), null);
+      GetRpc rpcMsg = new GetRpc(routeId);
+      GetRpcReply rpcReply = (GetRpcReply)ActorUtil.executeLocalOperation(rpcRegistry, rpcMsg, ActorUtil.LOCAL_ASK_DURATION, ActorUtil.LOCAL_AWAIT_DURATION);
+      String remoteActorPath = rpcReply.getRoutePath();
+
+      if(remoteActorPath == null) {
+        LOG.debug("No remote actor found for rpc {{}}.", msg.getRpc());
+
+        getSender().tell(new ErrorResponse(
+          new IllegalStateException("No remote actor found for rpc execution of : " + msg.getRpc())), self());
+      } else {
+
+        ExecuteRpc executeMsg = new ExecuteRpc(XmlUtils.inputCompositeNodeToXml(msg.getInput(), schemaContext), msg.getRpc());
+        Object operationRes = ActorUtil.executeRemoteOperation(this.context().actorSelection(remoteActorPath),
+            executeMsg, ActorUtil.REMOTE_ASK_DURATION, ActorUtil.REMOTE_AWAIT_DURATION);
+
+        getSender().tell(operationRes, self());
+      }
+    } catch (Exception e) {
+        LOG.error(e.toString());
+        getSender().tell(new ErrorResponse(e), self());
+    }
+  }
+
+  private void executeRpc(ExecuteRpc msg) {
+    LOG.debug("Executing rpc for rpc {}", msg.getRpc());
+    try {
+      Future<RpcResult<CompositeNode>> rpc = brokerSession.rpc(msg.getRpc(), XmlUtils.inputXmlToCompositeNode(msg.getRpc(), msg.getInputCompositeNode(), schemaContext));
+      RpcResult<CompositeNode> rpcResult = rpc != null ? rpc.get():null;
+      CompositeNode result = rpcResult != null ? rpcResult.getResult() : null;
+      getSender().tell(new RpcResponse(XmlUtils.outputCompositeNodeToXml(result, schemaContext)), self());
+    } catch (Exception e) {
+      LOG.error(e.toString());
+      getSender().tell(new ErrorResponse(e), self());
+    }
+  }
+
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RpcListener.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RpcListener.java
new file mode 100644 (file)
index 0000000..f614990
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * 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.remote.rpc;
+
+
+import akka.actor.ActorRef;
+import org.opendaylight.controller.remote.rpc.messages.AddRpc;
+import org.opendaylight.controller.remote.rpc.messages.RemoveRpc;
+import org.opendaylight.controller.remote.rpc.utils.ActorUtil;
+import org.opendaylight.controller.sal.core.api.RpcRegistrationListener;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RpcListener implements RpcRegistrationListener{
+
+  private static final Logger LOG = LoggerFactory.getLogger(RpcListener.class);
+  private final ActorRef rpcRegistry;
+  private final String actorPath;
+
+  public RpcListener(ActorRef rpcRegistry, String actorPath) {
+    this.rpcRegistry = rpcRegistry;
+    this.actorPath = actorPath;
+  }
+
+  @Override
+  public void onRpcImplementationAdded(QName rpc) {
+    LOG.debug("Adding registration for [{}]", rpc);
+    RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, rpc, null);
+    AddRpc addRpcMsg = new AddRpc(routeId, actorPath);
+    try {
+      ActorUtil.executeLocalOperation(rpcRegistry, addRpcMsg, ActorUtil.LOCAL_ASK_DURATION, ActorUtil.LOCAL_AWAIT_DURATION);
+      LOG.debug("Route added [{}-{}]", routeId, this.actorPath);
+    } catch (Exception e) {
+      // Just logging it because Akka API throws this exception
+      LOG.error(e.toString());
+    }
+
+  }
+
+  @Override
+  public void onRpcImplementationRemoved(QName rpc) {
+    LOG.debug("Removing registration for [{}]", rpc);
+    RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, rpc, null);
+    RemoveRpc removeRpcMsg = new RemoveRpc(routeId);
+    try {
+      ActorUtil.executeLocalOperation(rpcRegistry, removeRpcMsg, ActorUtil.LOCAL_ASK_DURATION, ActorUtil.LOCAL_AWAIT_DURATION);
+    } catch (Exception e) {
+      // Just logging it because Akka API throws this exception
+      LOG.error(e.toString());
+    }
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RpcManager.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RpcManager.java
new file mode 100644 (file)
index 0000000..4925a17
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * 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.remote.rpc;
+
+
+import akka.actor.ActorRef;
+import akka.actor.OneForOneStrategy;
+import akka.actor.Props;
+import akka.actor.SupervisorStrategy;
+import akka.japi.Creator;
+import akka.japi.Function;
+import org.opendaylight.controller.remote.rpc.messages.UpdateSchemaContext;
+import org.opendaylight.controller.remote.rpc.registry.ClusterWrapper;
+import org.opendaylight.controller.remote.rpc.registry.RpcRegistry;
+import org.opendaylight.controller.sal.core.api.Broker;
+import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import scala.concurrent.duration.Duration;
+import java.util.Set;
+
+/**
+ * This class acts as a supervisor, creates all the actors, resumes them, if an exception is thrown.
+ *
+ * It also starts the rpc listeners
+ */
+
+public class RpcManager extends AbstractUntypedActor {
+
+  private static final Logger LOG = LoggerFactory.getLogger(RpcManager.class);
+
+  private SchemaContext schemaContext;
+  private final ClusterWrapper clusterWrapper;
+  private ActorRef rpcBroker;
+  private ActorRef rpcRegistry;
+  private final Broker.ProviderSession brokerSession;
+  private RpcListener rpcListener;
+  private RoutedRpcListener routeChangeListener;
+  private RemoteRpcImplementation rpcImplementation;
+  private final RpcProvisionRegistry rpcProvisionRegistry;
+
+  private RpcManager(ClusterWrapper clusterWrapper, SchemaContext schemaContext,
+                     Broker.ProviderSession brokerSession, RpcProvisionRegistry rpcProvisionRegistry) {
+    this.clusterWrapper = clusterWrapper;
+    this.schemaContext = schemaContext;
+    this.brokerSession = brokerSession;
+    this.rpcProvisionRegistry = rpcProvisionRegistry;
+
+    createRpcActors();
+    startListeners();
+  }
+
+
+  public static Props props(final ClusterWrapper clusterWrapper, final SchemaContext schemaContext,
+                            final Broker.ProviderSession brokerSession, final RpcProvisionRegistry rpcProvisionRegistry) {
+    return Props.create(new Creator<RpcManager>() {
+      @Override
+      public RpcManager create() throws Exception {
+        return new RpcManager(clusterWrapper, schemaContext, brokerSession, rpcProvisionRegistry);
+      }
+    });
+  }
+
+  private void createRpcActors() {
+    LOG.debug("Create rpc registry and broker actors");
+
+    rpcRegistry = getContext().actorOf(RpcRegistry.props(clusterWrapper), "rpc-registry");
+    rpcBroker = getContext().actorOf(RpcBroker.props(brokerSession, rpcRegistry, schemaContext), "rpc-broker");
+  }
+
+  private void startListeners() {
+    LOG.debug("Registers rpc listeners");
+
+    String rpcBrokerPath = clusterWrapper.getAddress().toString() + "/user/rpc/rpc-broker";
+    rpcListener = new RpcListener(rpcRegistry, rpcBrokerPath);
+    routeChangeListener = new RoutedRpcListener(rpcRegistry, rpcBrokerPath);
+    rpcImplementation = new RemoteRpcImplementation(rpcBroker, schemaContext);
+
+    brokerSession.addRpcRegistrationListener(rpcListener);
+    rpcProvisionRegistry.registerRouteChangeListener(routeChangeListener);
+    rpcProvisionRegistry.setRoutedRpcDefaultDelegate(rpcImplementation);
+    announceSupportedRpcs();
+  }
+
+  /**
+   * Add all the locally registered RPCs in the clustered routing table
+   */
+  private void announceSupportedRpcs(){
+    LOG.debug("Adding all supported rpcs to routing table");
+    Set<QName> currentlySupported = brokerSession.getSupportedRpcs();
+    for (QName rpc : currentlySupported) {
+      rpcListener.onRpcImplementationAdded(rpc);
+    }
+  }
+
+
+  @Override
+  protected void handleReceive(Object message) throws Exception {
+    if(message instanceof UpdateSchemaContext) {
+      updateSchemaContext((UpdateSchemaContext) message);
+    }
+
+  }
+
+  private void updateSchemaContext(UpdateSchemaContext message) {
+    this.schemaContext = message.getSchemaContext();
+  }
+
+  @Override
+  public SupervisorStrategy supervisorStrategy() {
+    return new OneForOneStrategy(10, Duration.create("1 minute"),
+        new Function<Throwable, SupervisorStrategy.Directive>() {
+          @Override
+          public SupervisorStrategy.Directive apply(Throwable t) {
+            return SupervisorStrategy.resume();
+          }
+        }
+    );
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/TerminationMonitor.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/TerminationMonitor.java
new file mode 100644 (file)
index 0000000..a90f1e1
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * 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.remote.rpc;
+
+import akka.actor.Terminated;
+import akka.actor.UntypedActor;
+import akka.event.Logging;
+import akka.event.LoggingAdapter;
+import org.opendaylight.controller.remote.rpc.messages.Monitor;
+
+public class TerminationMonitor extends UntypedActor{
+    protected final LoggingAdapter LOG =
+        Logging.getLogger(getContext().system(), this);
+
+    public TerminationMonitor(){
+        LOG.info("Created TerminationMonitor");
+    }
+
+    @Override public void onReceive(Object message) throws Exception {
+        if(message instanceof Terminated){
+            Terminated terminated = (Terminated) message;
+            LOG.debug("Actor terminated : {}", terminated.actor());
+        }else if(message instanceof Monitor){
+          Monitor monitor = (Monitor) message;
+          getContext().watch(monitor.getActorRef());
+        }
+    }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/AddRoutedRpc.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/AddRoutedRpc.java
new file mode 100644 (file)
index 0000000..fd1af2b
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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.remote.rpc.messages;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.sal.connector.api.RpcRouter;
+
+import java.io.Serializable;
+import java.util.Set;
+
+public class AddRoutedRpc implements Serializable {
+
+  private final Set<RpcRouter.RouteIdentifier<?, ?, ?>> announcements;
+  private final String actorPath;
+
+  public AddRoutedRpc(final Set<RpcRouter.RouteIdentifier<?, ?, ?>> announcements, final String actorPath) {
+    Preconditions.checkNotNull(announcements, "Route identifier should not be null");
+    Preconditions.checkNotNull(actorPath, "Actor path should not be null");
+
+    this.announcements = announcements;
+    this.actorPath = actorPath;
+  }
+
+  public Set<RpcRouter.RouteIdentifier<?, ?, ?>> getAnnouncements() {
+    return announcements;
+  }
+
+  public String getActorPath() {
+    return actorPath;
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/AddRpc.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/AddRpc.java
new file mode 100644 (file)
index 0000000..7eaa8f0
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * 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.remote.rpc.messages;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.remote.rpc.RouteIdentifierImpl;
+
+import java.io.Serializable;
+
+public class AddRpc implements Serializable {
+
+  private final RouteIdentifierImpl routeId;
+  private final String actorPath;
+
+  public AddRpc(final RouteIdentifierImpl routeId, final String actorPath) {
+    Preconditions.checkNotNull(routeId, "Route identifier should not be null");
+    Preconditions.checkNotNull(actorPath, "Actor path should not be null");
+
+    this.routeId = routeId;
+    this.actorPath = actorPath;
+  }
+
+  public RouteIdentifierImpl getRouteId() {
+    return routeId;
+  }
+
+  public String getActorPath() {
+    return actorPath;
+  }
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/ErrorResponse.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/ErrorResponse.java
new file mode 100644 (file)
index 0000000..2c26243
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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.remote.rpc.messages;
+
+import com.google.common.base.Preconditions;
+
+import java.io.Serializable;
+
+public class ErrorResponse implements Serializable {
+
+  private final Exception exception;
+
+  public ErrorResponse(final Exception e) {
+    Preconditions.checkNotNull(e, "Exception should be present for error message");
+    this.exception = e;
+  }
+
+  public Exception getException() {
+    return exception;
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/ExecuteRpc.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/ExecuteRpc.java
new file mode 100644 (file)
index 0000000..522dd44
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * 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.remote.rpc.messages;
+
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.yangtools.yang.common.QName;
+
+import java.io.Serializable;
+
+public class ExecuteRpc implements Serializable {
+
+  private final String inputCompositeNode;
+  private final QName rpc;
+
+  public ExecuteRpc(final String inputCompositeNode, final QName rpc) {
+    Preconditions.checkNotNull(inputCompositeNode, "Composite Node input string should be present");
+    Preconditions.checkNotNull(rpc, "rpc Qname should not be null");
+
+    this.inputCompositeNode = inputCompositeNode;
+    this.rpc = rpc;
+  }
+
+  public String getInputCompositeNode() {
+    return inputCompositeNode;
+  }
+
+  public QName getRpc() {
+    return rpc;
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/GetRoutedRpc.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/GetRoutedRpc.java
new file mode 100644 (file)
index 0000000..e8d2262
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * 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.remote.rpc.messages;
+
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.remote.rpc.RouteIdentifierImpl;
+
+import java.io.Serializable;
+
+public class GetRoutedRpc implements Serializable {
+
+  private final RouteIdentifierImpl routeId;
+
+  public GetRoutedRpc(final RouteIdentifierImpl routeId) {
+    Preconditions.checkNotNull(routeId, "route id should not be null");
+    this.routeId = routeId;
+  }
+
+  public RouteIdentifierImpl getRouteId() {
+    return routeId;
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/GetRoutedRpcReply.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/GetRoutedRpcReply.java
new file mode 100644 (file)
index 0000000..d426662
--- /dev/null
@@ -0,0 +1,24 @@
+package org.opendaylight.controller.remote.rpc.messages;
+
+/*
+ * 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
+ */
+
+import java.io.Serializable;
+
+public class GetRoutedRpcReply implements Serializable {
+
+  private final String routePath;
+
+  public GetRoutedRpcReply(final String routePath) {
+    this.routePath = routePath;
+  }
+
+  public String getRoutePath() {
+    return routePath;
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/GetRpc.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/GetRpc.java
new file mode 100644 (file)
index 0000000..c1d4240
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * 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.remote.rpc.messages;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.remote.rpc.RouteIdentifierImpl;
+
+import java.io.Serializable;
+
+public class GetRpc implements Serializable {
+
+  private final RouteIdentifierImpl routeId;
+
+  public GetRpc(final RouteIdentifierImpl routeId) {
+    Preconditions.checkNotNull(routeId, "Route Id should not be null");
+    this.routeId = routeId;
+  }
+
+  public RouteIdentifierImpl getRouteId() {
+    return routeId;
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/GetRpcReply.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/GetRpcReply.java
new file mode 100644 (file)
index 0000000..aaf089d
--- /dev/null
@@ -0,0 +1,24 @@
+package org.opendaylight.controller.remote.rpc.messages;
+
+/*
+ * 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
+ */
+
+import java.io.Serializable;
+
+public class GetRpcReply implements Serializable {
+
+  private final String routePath;
+
+  public GetRpcReply(final String routePath) {
+    this.routePath = routePath;
+  }
+
+  public String getRoutePath() {
+    return routePath;
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/InvokeRoutedRpc.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/InvokeRoutedRpc.java
new file mode 100644 (file)
index 0000000..fd73144
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * 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.remote.rpc.messages;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+import java.io.Serializable;
+
+public class InvokeRoutedRpc implements Serializable {
+
+  private final QName rpc;
+  private final YangInstanceIdentifier identifier;
+  private final CompositeNode input;
+
+  public InvokeRoutedRpc(final QName rpc, final YangInstanceIdentifier identifier, final CompositeNode input) {
+    Preconditions.checkNotNull(rpc, "rpc qname should not be null");
+    Preconditions.checkNotNull(identifier, "instance identifier of routed rpc should not be null");
+    Preconditions.checkNotNull(input, "rpc input should not be null");
+
+    this.rpc = rpc;
+    this.identifier = identifier;
+    this.input = input;
+  }
+
+  public QName getRpc() {
+    return rpc;
+  }
+
+  public YangInstanceIdentifier getIdentifier() {
+    return identifier;
+  }
+
+  public CompositeNode getInput() {
+    return input;
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/InvokeRpc.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/InvokeRpc.java
new file mode 100644 (file)
index 0000000..94b7fe4
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * 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.remote.rpc.messages;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+
+import java.io.Serializable;
+
+public class InvokeRpc implements Serializable {
+
+  private final QName rpc;
+  private final CompositeNode input;
+
+  public InvokeRpc(final QName rpc, final CompositeNode input) {
+    Preconditions.checkNotNull(rpc, "rpc qname should not be null");
+    Preconditions.checkNotNull(input, "rpc input should not be null");
+
+    this.rpc = rpc;
+    this.input = input;
+  }
+
+  public QName getRpc() {
+    return rpc;
+  }
+
+  public CompositeNode getInput() {
+    return input;
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/Monitor.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/Monitor.java
new file mode 100644 (file)
index 0000000..43a31ef
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * 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.remote.rpc.messages;
+
+import akka.actor.ActorRef;
+
+public class Monitor {
+    private final ActorRef actorRef;
+
+    public Monitor(ActorRef actorRef){
+
+        this.actorRef = actorRef;
+    }
+
+    public ActorRef getActorRef() {
+        return actorRef;
+    }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/RemoveRoutedRpc.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/RemoveRoutedRpc.java
new file mode 100644 (file)
index 0000000..b560b8c
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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.remote.rpc.messages;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.sal.connector.api.RpcRouter;
+
+import java.io.Serializable;
+import java.util.Set;
+
+public class RemoveRoutedRpc implements Serializable {
+
+  private final Set<RpcRouter.RouteIdentifier<?, ?, ?>> announcements;
+  private final String actorPath;
+
+  public RemoveRoutedRpc(final Set<RpcRouter.RouteIdentifier<?, ?, ?>> announcements, final String actorPath) {
+    Preconditions.checkNotNull(announcements, "Route identifier should not be null");
+    Preconditions.checkNotNull(actorPath, "Actor path should not be null");
+
+    this.announcements = announcements;
+    this.actorPath = actorPath;
+  }
+
+  public Set<RpcRouter.RouteIdentifier<?, ?, ?>> getAnnouncements() {
+    return announcements;
+  }
+
+  public String getActorPath() {
+    return actorPath;
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/RemoveRpc.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/RemoveRpc.java
new file mode 100644 (file)
index 0000000..289334f
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * 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.remote.rpc.messages;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.remote.rpc.RouteIdentifierImpl;
+
+import java.io.Serializable;
+
+public class RemoveRpc implements Serializable {
+
+  private final RouteIdentifierImpl routeId;
+
+  public RemoveRpc(final RouteIdentifierImpl routeId) {
+    Preconditions.checkNotNull(routeId, "Route Id should not be null");
+
+    this.routeId = routeId;
+  }
+
+  public RouteIdentifierImpl getRouteId() {
+    return routeId;
+  }
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/RoutingTableData.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/RoutingTableData.java
new file mode 100644 (file)
index 0000000..c57a258
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * 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.remote.rpc.messages;
+
+import org.opendaylight.controller.sal.connector.api.RpcRouter;
+
+import java.io.Serializable;
+import java.util.LinkedHashSet;
+import java.util.Map;
+
+public class RoutingTableData implements Serializable {
+  private final Map<RpcRouter.RouteIdentifier<?, ?, ?>, String> rpcMap;
+  private final Map<RpcRouter.RouteIdentifier<?, ?, ?>, LinkedHashSet<String>> routedRpcMap;
+
+  public RoutingTableData(final Map<RpcRouter.RouteIdentifier<?, ?, ?>, String> rpcMap,
+                          final Map<RpcRouter.RouteIdentifier<?, ?, ?>, LinkedHashSet<String>> routedRpcMap) {
+    this.rpcMap = rpcMap;
+    this.routedRpcMap = routedRpcMap;
+  }
+
+  public Map<RpcRouter.RouteIdentifier<?, ?, ?>, String> getRpcMap() {
+    return rpcMap;
+  }
+
+  public Map<RpcRouter.RouteIdentifier<?, ?, ?>, LinkedHashSet<String>> getRoutedRpcMap() {
+    return routedRpcMap;
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/RpcResponse.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/RpcResponse.java
new file mode 100644 (file)
index 0000000..17766f1
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * 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.remote.rpc.messages;
+
+
+
+import java.io.Serializable;
+
+public class RpcResponse implements Serializable {
+  private final String resultCompositeNode;
+
+  public RpcResponse(final String resultCompositeNode) {
+    this.resultCompositeNode = resultCompositeNode;
+  }
+
+  public String getResultCompositeNode() {
+    return resultCompositeNode;
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/UpdateSchemaContext.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/UpdateSchemaContext.java
new file mode 100644 (file)
index 0000000..83fc772
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * 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.remote.rpc.messages;
+
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+public class UpdateSchemaContext {
+
+  private final SchemaContext schemaContext;
+
+  public UpdateSchemaContext(final SchemaContext schemaContext) {
+    this.schemaContext = schemaContext;
+  }
+
+  public SchemaContext getSchemaContext() {
+    return schemaContext;
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/ClusterWrapper.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/ClusterWrapper.java
new file mode 100644 (file)
index 0000000..4ddc2be
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * 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.remote.rpc.registry;
+
+
+import akka.actor.Address;
+import akka.cluster.ClusterEvent;
+
+public interface ClusterWrapper {
+
+  ClusterEvent.CurrentClusterState getState();
+
+  Address getAddress();
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/ClusterWrapperImpl.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/ClusterWrapperImpl.java
new file mode 100644 (file)
index 0000000..89603a1
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * 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.remote.rpc.registry;
+
+
+import akka.actor.ActorSystem;
+import akka.actor.Address;
+import akka.cluster.Cluster;
+import akka.cluster.ClusterEvent;
+
+
+public class ClusterWrapperImpl  implements ClusterWrapper{
+
+  private Cluster cluster;
+
+  public ClusterWrapperImpl(ActorSystem actorSystem) {
+    cluster = Cluster.get(actorSystem);
+  }
+
+  @Override
+  public ClusterEvent.CurrentClusterState getState() {
+    return cluster.state();
+  }
+
+  @Override
+  public Address getAddress() {
+    return cluster.selfAddress();
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RoutingTable.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RoutingTable.java
new file mode 100644 (file)
index 0000000..5e19653
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ * 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.remote.rpc.registry;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableSet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+public class RoutingTable<I, R> {
+
+  private final Logger LOG = LoggerFactory.getLogger(RoutingTable.class);
+
+  private ConcurrentMap<I,R> globalRpcMap = new ConcurrentHashMap<>();
+  private ConcurrentMap<I, LinkedHashSet<R>> routedRpcMap = new ConcurrentHashMap<>();
+
+  public ConcurrentMap<I, R> getGlobalRpcMap() {
+    return globalRpcMap;
+  }
+
+  public ConcurrentMap<I, LinkedHashSet<R>> getRoutedRpcMap() {
+    return routedRpcMap;
+  }
+
+  public R getGlobalRoute(final I routeId) {
+    Preconditions.checkNotNull(routeId, "getGlobalRoute: routeId cannot be null!");
+    return globalRpcMap.get(routeId);
+  }
+
+  public void addGlobalRoute(final I routeId, final R route) {
+    Preconditions.checkNotNull(routeId, "addGlobalRoute: routeId cannot be null!");
+    Preconditions.checkNotNull(route, "addGlobalRoute: route cannot be null!");
+    LOG.debug("addGlobalRoute: adding  a new route with id[{}] and value [{}]", routeId, route);
+    if(globalRpcMap.putIfAbsent(routeId, route) != null) {
+      LOG.debug("A route already exist for route id [{}] ", routeId);
+    }
+  }
+
+  public void removeGlobalRoute(final I routeId) {
+    Preconditions.checkNotNull(routeId, "removeGlobalRoute: routeId cannot be null!");
+    LOG.debug("removeGlobalRoute: removing  a new route with id [{}]", routeId);
+    globalRpcMap.remove(routeId);
+  }
+
+  public Set<R> getRoutedRpc(final I routeId) {
+    Preconditions.checkNotNull(routeId, "getRoutes: routeId cannot be null!");
+    Set<R> routes = routedRpcMap.get(routeId);
+
+    if (routes == null) {
+      return Collections.emptySet();
+    }
+
+    return ImmutableSet.copyOf(routes);
+  }
+
+  public R getLastAddedRoutedRpc(final I routeId) {
+
+    Set<R> routes = getRoutedRpc(routeId);
+
+    if (routes.isEmpty()) {
+      return null;
+    }
+
+    R route = null;
+    Iterator<R> iter = routes.iterator();
+    while (iter.hasNext()) {
+      route = iter.next();
+    }
+
+    return route;
+  }
+
+  public void addRoutedRpc(final I routeId, final R route)   {
+    Preconditions.checkNotNull(routeId, "addRoute: routeId cannot be null");
+    Preconditions.checkNotNull(route, "addRoute: route cannot be null");
+    LOG.debug("addRoute: adding a route with k/v [{}/{}]", routeId, route);
+    threadSafeAdd(routeId, route);
+  }
+
+  public void addRoutedRpcs(final Set<I> routeIds, final R route) {
+    Preconditions.checkNotNull(routeIds, "addRoutes: routeIds must not be null");
+    for (I routeId : routeIds){
+      addRoutedRpc(routeId, route);
+    }
+  }
+
+  public void removeRoute(final I routeId, final R route) {
+    Preconditions.checkNotNull(routeId, "removeRoute: routeId cannot be null!");
+    Preconditions.checkNotNull(route, "removeRoute: route cannot be null!");
+
+    LinkedHashSet<R> routes = routedRpcMap.get(routeId);
+    if (routes == null) {
+      return;
+    }
+    LOG.debug("removeRoute: removing  a new route with k/v [{}/{}]", routeId, route);
+    threadSafeRemove(routeId, route);
+  }
+
+  public void removeRoutes(final Set<I> routeIds, final R route) {
+    Preconditions.checkNotNull(routeIds, "removeRoutes: routeIds must not be null");
+    for (I routeId : routeIds){
+      removeRoute(routeId, route);
+    }
+  }
+
+  /**
+   * This method guarantees that no 2 thread over write each other's changes.
+   * Just so that we dont end up in infinite loop, it tries for 100 times then throw
+   */
+  private void threadSafeAdd(final I routeId, final R route) {
+
+    for (int i=0;i<100;i++){
+
+      LinkedHashSet<R> updatedRoutes = new LinkedHashSet<>();
+      updatedRoutes.add(route);
+      LinkedHashSet<R> oldRoutes = routedRpcMap.putIfAbsent(routeId, updatedRoutes);
+      if (oldRoutes == null) {
+        return;
+      }
+
+      updatedRoutes = new LinkedHashSet<>(oldRoutes);
+      updatedRoutes.add(route);
+
+      if (routedRpcMap.replace(routeId, oldRoutes, updatedRoutes)) {
+        return;
+      }
+    }
+    //the method did not already return means it failed to add route in 100 attempts
+    throw new IllegalStateException("Failed to add route [" + routeId + "]");
+  }
+
+  /**
+   * This method guarantees that no 2 thread over write each other's changes.
+   * Just so that we dont end up in infinite loop, it tries for 100 times then throw
+   */
+  private void threadSafeRemove(final I routeId, final R route) {
+    LinkedHashSet<R> updatedRoutes = null;
+    for (int i=0;i<100;i++){
+      LinkedHashSet<R> oldRoutes = routedRpcMap.get(routeId);
+
+      // if route to be deleted is the only entry in the set then remove routeId from the cache
+      if ((oldRoutes.size() == 1) && oldRoutes.contains(route)){
+        routedRpcMap.remove(routeId);
+        return;
+      }
+
+      // if there are multiple routes for this routeId, remove the route to be deleted only from the set.
+      updatedRoutes = new LinkedHashSet<>(oldRoutes);
+      updatedRoutes.remove(route);
+      if (routedRpcMap.replace(routeId, oldRoutes, updatedRoutes)) {
+        return;
+      }
+
+    }
+    //the method did not already return means it failed to remove route in 100 attempts
+    throw new IllegalStateException("Failed to remove route [" + routeId + "]");
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistry.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistry.java
new file mode 100644 (file)
index 0000000..7cb505a
--- /dev/null
@@ -0,0 +1,202 @@
+/*
+ * 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.remote.rpc.registry;
+
+import akka.actor.ActorSelection;
+import akka.actor.Address;
+import akka.actor.Props;
+import akka.cluster.ClusterEvent;
+import akka.cluster.Member;
+import akka.japi.Creator;
+import org.opendaylight.controller.remote.rpc.AbstractUntypedActor;
+import org.opendaylight.controller.remote.rpc.messages.AddRoutedRpc;
+import org.opendaylight.controller.remote.rpc.messages.AddRpc;
+import org.opendaylight.controller.remote.rpc.messages.GetRoutedRpc;
+import org.opendaylight.controller.remote.rpc.messages.GetRoutedRpcReply;
+import org.opendaylight.controller.remote.rpc.messages.GetRpc;
+import org.opendaylight.controller.remote.rpc.messages.GetRpcReply;
+import org.opendaylight.controller.remote.rpc.messages.RemoveRoutedRpc;
+import org.opendaylight.controller.remote.rpc.messages.RemoveRpc;
+import org.opendaylight.controller.remote.rpc.messages.RoutingTableData;
+import org.opendaylight.controller.sal.connector.api.RpcRouter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import scala.collection.JavaConversions;
+
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * This Actor maintains the routing table state and sync it with other nodes in the cluster.
+ *
+ * A scheduler runs after an interval of time, which pick a random member from the cluster
+ * and send the current state of routing table to the member.
+ *
+ * when a message of routing table data is received, it gets merged with the local routing table
+ * to keep the latest data.
+ */
+
+public class RpcRegistry extends AbstractUntypedActor {
+
+  private static final Logger LOG = LoggerFactory.getLogger(RpcRegistry.class);
+  private RoutingTable<RpcRouter.RouteIdentifier<?, ?, ?>, String> routingTable;
+  private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
+  private final ClusterWrapper clusterWrapper;
+  private final ScheduledFuture<?> syncScheduler;
+
+  private RpcRegistry(ClusterWrapper clusterWrapper){
+    this.routingTable = new RoutingTable<>();
+    this.clusterWrapper = clusterWrapper;
+    this.syncScheduler = scheduler.scheduleAtFixedRate(new SendRoutingTable(), 10, 10, TimeUnit.SECONDS);
+  }
+
+  public static Props props(final ClusterWrapper clusterWrapper){
+    return Props.create(new Creator<RpcRegistry>(){
+
+      @Override
+      public RpcRegistry create() throws Exception {
+        return new RpcRegistry(clusterWrapper);
+      }
+    });
+  }
+
+  @Override
+  protected void handleReceive(Object message) throws Exception {
+    LOG.debug("Received message {}", message);
+    if(message instanceof RoutingTableData) {
+      syncRoutingTable((RoutingTableData) message);
+    } else if(message instanceof GetRoutedRpc) {
+      getRoutedRpc((GetRoutedRpc) message);
+    } else if(message instanceof GetRpc) {
+      getRpc((GetRpc) message);
+    } else if(message instanceof AddRpc) {
+      addRpc((AddRpc) message);
+    } else if(message instanceof RemoveRpc) {
+      removeRpc((RemoveRpc) message);
+    } else if(message instanceof AddRoutedRpc) {
+      addRoutedRpc((AddRoutedRpc) message);
+    } else if(message instanceof RemoveRoutedRpc) {
+      removeRoutedRpc((RemoveRoutedRpc) message);
+    }
+  }
+
+  private void getRoutedRpc(GetRoutedRpc rpcMsg){
+    LOG.debug("Get latest routed Rpc location from routing table {}", rpcMsg);
+    String remoteActorPath = routingTable.getLastAddedRoutedRpc(rpcMsg.getRouteId());
+    GetRoutedRpcReply routedRpcReply = new GetRoutedRpcReply(remoteActorPath);
+
+    getSender().tell(routedRpcReply, self());
+  }
+
+  private void getRpc(GetRpc rpcMsg) {
+    LOG.debug("Get global Rpc location from routing table {}", rpcMsg);
+    String remoteActorPath = routingTable.getGlobalRoute(rpcMsg.getRouteId());
+    GetRpcReply rpcReply = new GetRpcReply(remoteActorPath);
+
+    getSender().tell(rpcReply, self());
+  }
+
+  private void addRpc(AddRpc rpcMsg) {
+    LOG.debug("Add Rpc to routing table {}", rpcMsg);
+    routingTable.addGlobalRoute(rpcMsg.getRouteId(), rpcMsg.getActorPath());
+
+    getSender().tell("Success", self());
+  }
+
+  private void removeRpc(RemoveRpc rpcMsg) {
+    LOG.debug("Removing Rpc to routing table {}", rpcMsg);
+    routingTable.removeGlobalRoute(rpcMsg.getRouteId());
+
+    getSender().tell("Success", self());
+  }
+
+  private void addRoutedRpc(AddRoutedRpc rpcMsg) {
+    routingTable.addRoutedRpcs(rpcMsg.getAnnouncements(), rpcMsg.getActorPath());
+    getSender().tell("Success", self());
+  }
+
+  private void removeRoutedRpc(RemoveRoutedRpc rpcMsg) {
+    routingTable.removeRoutes(rpcMsg.getAnnouncements(), rpcMsg.getActorPath());
+    getSender().tell("Success", self());
+  }
+
+  private void syncRoutingTable(RoutingTableData routingTableData) {
+    LOG.debug("Syncing routing table {}", routingTableData);
+
+    Map<RpcRouter.RouteIdentifier<?, ?, ?>, String> newRpcMap = routingTableData.getRpcMap();
+    Set<RpcRouter.RouteIdentifier<?, ?, ?>> routeIds = newRpcMap.keySet();
+    for(RpcRouter.RouteIdentifier<?, ?, ?> routeId : routeIds) {
+      routingTable.addGlobalRoute(routeId, newRpcMap.get(routeId));
+    }
+
+    Map<RpcRouter.RouteIdentifier<?, ?, ?>, LinkedHashSet<String>> newRoutedRpcMap =
+        routingTableData.getRoutedRpcMap();
+    routeIds = newRoutedRpcMap.keySet();
+
+    for(RpcRouter.RouteIdentifier<?, ?, ?> routeId : routeIds) {
+      Set<String> routeAddresses = newRoutedRpcMap.get(routeId);
+      for(String routeAddress : routeAddresses) {
+        routingTable.addRoutedRpc(routeId, routeAddress);
+      }
+    }
+  }
+
+  private ActorSelection getRandomRegistryActor() {
+    ClusterEvent.CurrentClusterState clusterState = clusterWrapper.getState();
+    ActorSelection actor = null;
+    Set<Member> members = JavaConversions.asJavaSet(clusterState.members());
+    int memberSize = members.size();
+    // Don't select yourself
+    if(memberSize > 1) {
+      Address currentNodeAddress = clusterWrapper.getAddress();
+      int index = new Random().nextInt(memberSize);
+      int i = 0;
+      // keeping previous member, in case when random index member is same as current actor
+      // and current actor member is last in set
+      Member previousMember = null;
+      for(Member member : members){
+        if(i == index-1) {
+          previousMember = member;
+        }
+        if(i == index) {
+          if(!currentNodeAddress.equals(member.address())) {
+            actor = this.context().actorSelection(member.address() + "/user/rpc-registry");
+            break;
+          } else if(index < memberSize-1){ // pick the next element in the set
+            index++;
+          }
+        }
+        i++;
+      }
+      if(actor == null && previousMember != null) {
+        actor = this.context().actorSelection(previousMember.address() + "/user/rpc-registry");
+      }
+    }
+    return actor;
+  }
+
+  private class SendRoutingTable implements Runnable {
+
+    @Override
+    public void run() {
+      RoutingTableData routingTableData =
+          new RoutingTableData(routingTable.getGlobalRpcMap(), routingTable.getRoutedRpcMap());
+      LOG.debug("Sending routing table for sync {}", routingTableData);
+      ActorSelection actor = getRandomRegistryActor();
+      if(actor != null) {
+        actor.tell(routingTableData, self());
+      }
+    }
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/ActorUtil.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/ActorUtil.java
new file mode 100644 (file)
index 0000000..8f60eab
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * 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.remote.rpc.utils;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSelection;
+import akka.util.Timeout;
+import scala.concurrent.Await;
+import scala.concurrent.Future;
+import scala.concurrent.duration.Duration;
+import scala.concurrent.duration.FiniteDuration;
+
+import java.util.concurrent.TimeUnit;
+
+import static akka.pattern.Patterns.ask;
+
+public class ActorUtil {
+  public static final FiniteDuration LOCAL_ASK_DURATION = Duration.create(2, TimeUnit.SECONDS);
+  public static final FiniteDuration REMOTE_ASK_DURATION = Duration.create(15, TimeUnit.SECONDS);
+  public static final FiniteDuration ASK_DURATION = Duration.create(17, TimeUnit.SECONDS);
+  public static final FiniteDuration LOCAL_AWAIT_DURATION = Duration.create(2, TimeUnit.SECONDS);
+  public static final FiniteDuration REMOTE_AWAIT_DURATION = Duration.create(15, TimeUnit.SECONDS);
+  public static final FiniteDuration AWAIT_DURATION = Duration.create(17, TimeUnit.SECONDS);
+
+  /**
+   * Executes an operation on a local actor and wait for it's response
+   * @param actor
+   * @param message
+   * @param askDuration
+   * @param awaitDuration
+   * @return The response of the operation
+   */
+  public static Object executeLocalOperation(ActorRef actor, Object message,
+                                      FiniteDuration askDuration, FiniteDuration awaitDuration) throws Exception{
+    Future<Object> future =
+        ask(actor, message, new Timeout(askDuration));
+
+      return Await.result(future, awaitDuration);
+  }
+
+  /**
+   * Execute an operation on a remote actor and wait for it's response
+   * @param actor
+   * @param message
+   * @param askDuration
+   * @param awaitDuration
+   * @return
+   */
+  public static Object executeRemoteOperation(ActorSelection actor, Object message,
+                                              FiniteDuration askDuration, FiniteDuration awaitDuration) throws Exception{
+    Future<Object> future =
+        ask(actor, message, new Timeout(askDuration));
+      return Await.result(future, awaitDuration);
+  }
+
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/InstanceIdentifierForXmlCodec.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/InstanceIdentifierForXmlCodec.java
new file mode 100644 (file)
index 0000000..92a7fba
--- /dev/null
@@ -0,0 +1,219 @@
+/*
+ * 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.remote.rpc.utils;
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Splitter;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Element;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public final class InstanceIdentifierForXmlCodec {
+  private static final Pattern PREDICATE_PATTERN = Pattern.compile("\\[(.*?)\\]");
+  private static final Splitter SLASH_SPLITTER = Splitter.on('/');
+  private static final Splitter COLON_SPLITTER = Splitter.on(':');
+  private static final Splitter AT_SPLITTER = Splitter.on('@');
+  private static final Logger logger = LoggerFactory.getLogger(InstanceIdentifierForXmlCodec.class);
+
+  private InstanceIdentifierForXmlCodec() {
+    throw new UnsupportedOperationException("Utility class");
+  }
+
+  public static YangInstanceIdentifier deserialize(final Element element, final SchemaContext schemaContext) {
+    Preconditions.checkNotNull(element, "Value of element for deserialization can't be null");
+    Preconditions.checkNotNull(schemaContext,
+        "Schema context for deserialization of instance identifier type can't be null");
+
+    final String valueTrimmed = element.getTextContent().trim();
+    logger.debug("Instance identifier derserialize: splitting the text {} with Slash to find path arguments", valueTrimmed);
+    final Iterator<String> xPathParts = SLASH_SPLITTER.split(valueTrimmed).iterator();
+
+    // must be at least "/pr:node"
+    if (!xPathParts.hasNext() || !xPathParts.next().isEmpty() || !xPathParts.hasNext()) {
+      logger.debug("Instance identifier derserialize: No path argument found for element.");
+      return null;
+    }
+
+    List<PathArgument> result = new ArrayList<>();
+    while (xPathParts.hasNext()) {
+      String xPathPartTrimmed = xPathParts.next().trim();
+
+      PathArgument pathArgument = toPathArgument(xPathPartTrimmed, element, schemaContext);
+      if (pathArgument != null) {
+        result.add(pathArgument);
+      }
+    }
+    return YangInstanceIdentifier.create(result);
+  }
+
+  public static Element serialize(final YangInstanceIdentifier id, final Element element) {
+    Preconditions.checkNotNull(id, "Variable should contain instance of instance identifier and can't be null");
+    Preconditions.checkNotNull(element, "DOM element can't be null");
+
+    final RandomPrefix prefixes = new RandomPrefix();
+    final String str = XmlUtils.encodeIdentifier(prefixes, id);
+
+    for (Entry<URI, String> e: prefixes.getPrefixes()) {
+      element.setAttribute("xmlns:" + e.getValue(), e.getKey().toString());
+    }
+    element.setTextContent(str);
+    return element;
+  }
+
+  private static String getIdAndPrefixAsStr(final String pathPart) {
+    int predicateStartIndex = pathPart.indexOf('[');
+    return predicateStartIndex == -1 ? pathPart : pathPart.substring(0, predicateStartIndex);
+  }
+
+  private static PathArgument toPathArgument(final String xPathArgument, final Element element, final SchemaContext schemaContext) {
+    final QName mainQName = toIdentity(xPathArgument, element, schemaContext);
+
+    // predicates
+    final Matcher matcher = PREDICATE_PATTERN.matcher(xPathArgument);
+    final Map<QName, Object> predicates = new HashMap<>();
+    QName currentQName = mainQName;
+
+    while (matcher.find()) {
+      final String predicateStr = matcher.group(1).trim();
+      final int indexOfEqualityMark = predicateStr.indexOf('=');
+      if (indexOfEqualityMark != -1) {
+        final Object predicateValue = toPredicateValue(predicateStr.substring(indexOfEqualityMark + 1));
+        if (predicateValue == null) {
+          return null;
+        }
+
+        if (predicateStr.charAt(0) != '.') {
+          // target is not a leaf-list
+          currentQName = toIdentity(predicateStr.substring(0, indexOfEqualityMark), element, schemaContext);
+          if (currentQName == null) {
+            return null;
+          }
+        }
+        logger.debug("Instance identifier derserialize: finding predicates of node {}", predicateValue);
+        predicates.put(currentQName, predicateValue);
+      }
+    }
+
+    if (predicates.isEmpty()) {
+      return new YangInstanceIdentifier.NodeIdentifier(mainQName);
+    } else {
+      return new YangInstanceIdentifier.NodeIdentifierWithPredicates(mainQName, predicates);
+    }
+
+  }
+
+  public static QName toIdentity(final String xPathArgument, final Element element, final SchemaContext schemaContext) {
+    final String xPathPartTrimmed = getIdAndPrefixAsStr(xPathArgument).trim();
+    final Iterator<String> it = COLON_SPLITTER.split(xPathPartTrimmed).iterator();
+
+    // Empty string
+    if (!it.hasNext()) {
+      return null;
+    }
+
+    final String prefix = it.next().trim();
+    if (prefix.isEmpty()) {
+      return null;
+    }
+
+    // it is not "prefix:value"
+    if (!it.hasNext()) {
+      return null;
+    }
+
+    final String identifier = it.next().trim();
+    if (identifier.isEmpty()) {
+      return null;
+    }
+
+    URI namespace = null;
+    String namespaceStr = null;
+    try {
+      namespaceStr = element.getAttribute("xmlns:"+prefix);
+      namespace = new URI(namespaceStr);
+    } catch (URISyntaxException e) {
+      throw new IllegalArgumentException("It wasn't possible to convert " + namespaceStr + " to URI object.");
+    } catch (NullPointerException e) {
+      throw new IllegalArgumentException("I wasn't possible to get namespace for prefix " + prefix);
+    }
+
+    Module module = schemaContext.findModuleByNamespaceAndRevision(namespace, null);
+    return QName.create(module.getQNameModule(), identifier);
+  }
+
+  private static String trimIfEndIs(final String str, final char end) {
+    final int l = str.length() - 1;
+    if (str.charAt(l) != end) {
+      return null;
+    }
+
+    return str.substring(1, l);
+  }
+
+  private static Object toPredicateValue(final String predicatedValue) {
+    logger.debug("Instance identifier derserialize: converting the predicate vstring to object {}", predicatedValue);
+    final String predicatedValueTrimmed = predicatedValue.trim();
+    if (predicatedValue.isEmpty()) {
+      return null;
+    }
+    String updatedValue = null;
+    switch (predicatedValueTrimmed.charAt(0)) {
+      case '"':
+        updatedValue =  trimIfEndIs(predicatedValueTrimmed, '"');
+        break;
+      case '\'':
+        updatedValue =  trimIfEndIs(predicatedValueTrimmed, '\'');
+        break;
+      default:
+        updatedValue =  predicatedValueTrimmed;
+    }
+    Iterator<String> it = AT_SPLITTER.split(updatedValue).iterator();
+    // Empty string
+    if (!it.hasNext()) {
+      return null;
+    }
+
+    final String value = it.next().trim();
+    if (value.isEmpty()) {
+      return null;
+    }
+
+    if (!it.hasNext()) {
+      return value;
+    }
+
+    final String type = it.next().trim();
+    if (type.isEmpty()) {
+      return value;
+    }
+    Object predicateObject = null;
+    try {
+      logger.debug("Instance identifier derserialize: converting the predicate value {{}}to correct object type {{}}", value, type);
+      predicateObject = Class.forName(type).getConstructor(String.class).newInstance(value);
+    } catch (Exception e) {
+      logger.error("Could not convert to valid type of value", e);
+    }
+    return predicateObject;
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/RandomPrefix.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/RandomPrefix.java
new file mode 100644 (file)
index 0000000..55cc819
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * 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.remote.rpc.utils;
+
+import org.opendaylight.yangtools.yang.common.QName;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.concurrent.ThreadLocalRandom;
+
+/**
+ * Picked from Yang tools because it was not public class
+ */
+
+final class RandomPrefix {
+    final Map<URI, String> prefixes = new HashMap<>();
+
+    Iterable<Entry<URI, String>> getPrefixes() {
+        return prefixes.entrySet();
+    }
+
+    String encodeQName(final QName qname) {
+        String prefix = prefixes.get(qname.getNamespace());
+        if (prefix == null) {
+            prefix = qname.getPrefix();
+            if (prefix == null || prefix.isEmpty() || prefixes.containsValue(prefix)) {
+                final ThreadLocalRandom random = ThreadLocalRandom.current();
+                do {
+                    final StringBuilder sb = new StringBuilder();
+                    for (int i = 0; i < 4; i++) {
+                        sb.append((char)('a' + random.nextInt(25)));
+                    }
+
+                    prefix = sb.toString();
+                } while (prefixes.containsValue(prefix));
+            }
+
+            prefixes.put(qname.getNamespace(), prefix);
+        }
+
+        return prefix + ':' + qname.getLocalName();
+    }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/XmlDocumentUtils.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/XmlDocumentUtils.java
new file mode 100644 (file)
index 0000000..127aa07
--- /dev/null
@@ -0,0 +1,311 @@
+/*
+ * Copyright (c) 2013 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.remote.rpc.utils;
+
+import com.google.common.base.Function;
+import com.google.common.base.Objects;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.ModifyAction;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
+import org.opendaylight.yangtools.yang.data.impl.SimpleNodeTOImpl;
+import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec;
+import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlCodecProvider;
+import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
+import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaNode;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import javax.activation.UnsupportedDataTypeException;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.dom.DOMResult;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import static com.google.common.base.Preconditions.checkState;
+
+public class XmlDocumentUtils {
+  private static class ElementWithSchemaContext {
+    Element element;
+    SchemaContext schemaContext;
+
+    ElementWithSchemaContext(final Element element,final SchemaContext schemaContext) {
+      this.schemaContext = schemaContext;
+      this.element = element;
+    }
+
+    Element getElement() {
+      return element;
+    }
+
+    SchemaContext getSchemaContext() {
+      return schemaContext;
+    }
+  }
+
+  public static final QName OPERATION_ATTRIBUTE_QNAME = QName.create(URI.create("urn:ietf:params:xml:ns:netconf:base:1.0"), null, "operation");
+  private static final Logger logger = LoggerFactory.getLogger(XmlDocumentUtils.class);
+  private static final XMLOutputFactory FACTORY = XMLOutputFactory.newFactory();
+
+  /**
+   * Converts Data DOM structure to XML Document for specified XML Codec Provider and corresponding
+   * Data Node Container schema. The CompositeNode data parameter enters as root of Data DOM tree and will
+   * be transformed to root in XML Document. Each element of Data DOM tree is compared against specified Data
+   * Node Container Schema and transformed accordingly.
+   *
+   * @param data Data DOM root element
+   * @param schema Data Node Container Schema
+   * @param codecProvider XML Codec Provider
+   * @return new instance of XML Document
+   * @throws javax.activation.UnsupportedDataTypeException
+   */
+  public static Document toDocument(final CompositeNode data, final DataNodeContainer schema, final XmlCodecProvider codecProvider)
+      throws UnsupportedDataTypeException {
+    Preconditions.checkNotNull(data);
+    Preconditions.checkNotNull(schema);
+
+    if (!(schema instanceof ContainerSchemaNode || schema instanceof ListSchemaNode)) {
+      throw new UnsupportedDataTypeException("Schema can be ContainerSchemaNode or ListSchemaNode. Other types are not supported yet.");
+    }
+
+    final DOMResult result = new DOMResult(getDocument());
+    try {
+      final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(result);
+      XmlStreamUtils.create(codecProvider).writeDocument(writer, data, (SchemaNode)schema);
+      writer.close();
+      return (Document)result.getNode();
+    } catch (XMLStreamException e) {
+      logger.error("Failed to serialize data {}", data, e);
+      return null;
+    }
+  }
+
+  public static Document getDocument() {
+    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+    Document doc = null;
+    try {
+      DocumentBuilder bob = dbf.newDocumentBuilder();
+      doc = bob.newDocument();
+    } catch (ParserConfigurationException e) {
+      throw new RuntimeException(e);
+    }
+    return doc;
+  }
+
+
+  public static QName qNameFromElement(final Element xmlElement) {
+    String namespace = xmlElement.getNamespaceURI();
+    String localName = xmlElement.getLocalName();
+    return QName.create(namespace != null ? URI.create(namespace) : null, null, localName);
+  }
+
+  private static Node<?> toNodeWithSchema(final Element xmlElement, final DataSchemaNode schema, final XmlCodecProvider codecProvider,final SchemaContext schemaCtx) {
+    checkQName(xmlElement, schema.getQName());
+    if (schema instanceof DataNodeContainer) {
+      return toCompositeNodeWithSchema(xmlElement, schema.getQName(), (DataNodeContainer) schema, schemaCtx);
+    } else if (schema instanceof LeafSchemaNode) {
+      return toSimpleNodeWithType(xmlElement, (LeafSchemaNode) schema, codecProvider,schemaCtx);
+    } else if (schema instanceof LeafListSchemaNode) {
+      return toSimpleNodeWithType(xmlElement, (LeafListSchemaNode) schema, codecProvider,schemaCtx);
+    }
+    return null;
+  }
+
+
+
+  private static Node<?> toSimpleNodeWithType(final Element xmlElement, final LeafSchemaNode schema,
+                                              final XmlCodecProvider codecProvider,final SchemaContext schemaCtx) {
+    TypeDefinitionAwareCodec<? extends Object, ? extends TypeDefinition<?>> codec = codecProvider.codecFor(schema.getType());
+    String text = xmlElement.getTextContent();
+    Object value = null;
+    if (codec != null) {
+      logger.debug("toSimpleNodeWithType: found codec, deserializing text {}", text);
+      value = codec.deserialize(text);
+    }
+
+    final TypeDefinition<?> baseType = XmlUtils.resolveBaseTypeFrom(schema.getType());
+    if (baseType instanceof org.opendaylight.yangtools.yang.model.util.InstanceIdentifier) {
+      logger.debug("toSimpleNodeWithType: base type of node is instance identifier, deserializing element", xmlElement);
+      value = InstanceIdentifierForXmlCodec.deserialize(xmlElement,schemaCtx);
+
+    } else if(baseType instanceof IdentityrefTypeDefinition){
+      logger.debug("toSimpleNodeWithType: base type of node is IdentityrefTypeDefinition, deserializing element", xmlElement);
+      value = InstanceIdentifierForXmlCodec.toIdentity(xmlElement.getTextContent(), xmlElement, schemaCtx);
+
+    }
+
+    if (value == null) {
+      logger.debug("toSimpleNodeWithType: no type found for element, returning just the text string value of element {}", xmlElement);
+      value = xmlElement.getTextContent();
+    }
+
+    Optional<ModifyAction> modifyAction = getModifyOperationFromAttributes(xmlElement);
+    return new SimpleNodeTOImpl<>(schema.getQName(), null, value, modifyAction.orNull());
+  }
+
+  private static Node<?> toSimpleNodeWithType(final Element xmlElement, final LeafListSchemaNode schema,
+                                              final XmlCodecProvider codecProvider,final SchemaContext schemaCtx) {
+    TypeDefinitionAwareCodec<? extends Object, ? extends TypeDefinition<?>> codec = codecProvider.codecFor(schema.getType());
+    String text = xmlElement.getTextContent();
+    Object value = null;
+    if (codec != null) {
+      logger.debug("toSimpleNodeWithType: found codec, deserializing text {}", text);
+      value = codec.deserialize(text);
+    }
+
+    if (schema.getType() instanceof org.opendaylight.yangtools.yang.model.util.InstanceIdentifier) {
+      logger.debug("toSimpleNodeWithType: base type of node is instance identifier, deserializing element", xmlElement);
+      value = InstanceIdentifierForXmlCodec.deserialize(xmlElement,schemaCtx);
+    }
+
+    if (value == null) {
+      logger.debug("toSimpleNodeWithType: no type found for element, returning just the text string value of element {}", xmlElement);
+      value = xmlElement.getTextContent();
+    }
+
+    Optional<ModifyAction> modifyAction = getModifyOperationFromAttributes(xmlElement);
+    return new SimpleNodeTOImpl<>(schema.getQName(), null, value, modifyAction.orNull());
+  }
+
+  private static Node<?> toCompositeNodeWithSchema(final Element xmlElement, final QName qName, final DataNodeContainer schema,
+                                                   final SchemaContext schemaCtx) {
+    List<Node<?>> values = toDomNodes(xmlElement, Optional.fromNullable(schema.getChildNodes()),schemaCtx);
+    Optional<ModifyAction> modifyAction = getModifyOperationFromAttributes(xmlElement);
+    return ImmutableCompositeNode.create(qName, values, modifyAction.orNull());
+  }
+
+  private static Optional<ModifyAction> getModifyOperationFromAttributes(final Element xmlElement) {
+    Attr attributeNodeNS = xmlElement.getAttributeNodeNS(OPERATION_ATTRIBUTE_QNAME.getNamespace().toString(), OPERATION_ATTRIBUTE_QNAME.getLocalName());
+    if(attributeNodeNS == null) {
+      return Optional.absent();
+    }
+
+    ModifyAction action = ModifyAction.fromXmlValue(attributeNodeNS.getValue());
+    Preconditions.checkArgument(action.isOnElementPermitted(), "Unexpected operation %s on %s", action, xmlElement);
+
+    return Optional.of(action);
+  }
+
+  private static void checkQName(final Element xmlElement, final QName qName) {
+    checkState(Objects.equal(xmlElement.getNamespaceURI(), qName.getNamespace().toString()));
+    checkState(qName.getLocalName().equals(xmlElement.getLocalName()));
+  }
+
+  public static final Optional<DataSchemaNode> findFirstSchema(final QName qname, final Collection<DataSchemaNode> dataSchemaNode) {
+    if (dataSchemaNode != null && !dataSchemaNode.isEmpty() && qname != null) {
+      for (DataSchemaNode dsn : dataSchemaNode) {
+        if (qname.isEqualWithoutRevision(dsn.getQName())) {
+          return Optional.<DataSchemaNode> of(dsn);
+        } else if (dsn instanceof ChoiceNode) {
+          for (ChoiceCaseNode choiceCase : ((ChoiceNode) dsn).getCases()) {
+            Optional<DataSchemaNode> foundDsn = findFirstSchema(qname, choiceCase.getChildNodes());
+            if (foundDsn != null && foundDsn.isPresent()) {
+              return foundDsn;
+            }
+          }
+        }
+      }
+    }
+    return Optional.absent();
+  }
+
+  private static Node<?> toDomNode(Element element) {
+    QName qname = qNameFromElement(element);
+
+    ImmutableList.Builder<Node<?>> values = ImmutableList.<Node<?>> builder();
+    NodeList nodes = element.getChildNodes();
+    boolean isSimpleObject = true;
+    String value = null;
+    for (int i = 0; i < nodes.getLength(); i++) {
+      org.w3c.dom.Node child = nodes.item(i);
+      if (child instanceof Element) {
+        isSimpleObject = false;
+        values.add(toDomNode((Element) child));
+      }
+      if (isSimpleObject && child instanceof org.w3c.dom.Text) {
+        value = element.getTextContent();
+        if (!Strings.isNullOrEmpty(value)) {
+          isSimpleObject = true;
+        }
+      }
+    }
+    if (isSimpleObject) {
+      return new SimpleNodeTOImpl<>(qname, null, value);
+    }
+    return ImmutableCompositeNode.create(qname, values.build());
+  }
+
+  public static List<Node<?>> toDomNodes(final Element element, final Optional<Collection<DataSchemaNode>> context,SchemaContext schemaCtx) {
+    return forEachChild(element.getChildNodes(),schemaCtx, new Function<ElementWithSchemaContext, Optional<Node<?>>>() {
+
+      @Override
+      public Optional<Node<?>> apply(ElementWithSchemaContext input) {
+        if (context.isPresent()) {
+          QName partialQName = qNameFromElement(input.getElement());
+          Optional<DataSchemaNode> schemaNode = XmlDocumentUtils.findFirstSchema(partialQName, context.get());
+          if (schemaNode.isPresent()) {
+            return Optional.<Node<?>> fromNullable(//
+                toNodeWithSchema(input.getElement(), schemaNode.get(), XmlDocumentUtils.defaultValueCodecProvider(),input.getSchemaContext()));
+          }
+        }
+        return Optional.<Node<?>> fromNullable(toDomNode(input.getElement()));
+      }
+
+    });
+
+  }
+
+  private static final <T> List<T> forEachChild(final NodeList nodes, final SchemaContext schemaContext, final Function<ElementWithSchemaContext, Optional<T>> forBody) {
+    final int l = nodes.getLength();
+    if (l == 0) {
+      return ImmutableList.of();
+    }
+
+    final List<T> list = new ArrayList<>(l);
+    for (int i = 0; i < l; i++) {
+      org.w3c.dom.Node child = nodes.item(i);
+      if (child instanceof Element) {
+        Optional<T> result = forBody.apply(new ElementWithSchemaContext((Element) child,schemaContext));
+        if (result.isPresent()) {
+          list.add(result.get());
+        }
+      }
+    }
+    return ImmutableList.copyOf(list);
+  }
+
+  public static final XmlCodecProvider defaultValueCodecProvider() {
+    return XmlUtils.DEFAULT_XML_CODEC_PROVIDER;
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/XmlStreamUtils.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/XmlStreamUtils.java
new file mode 100644 (file)
index 0000000..e4576c4
--- /dev/null
@@ -0,0 +1,249 @@
+/*
+ * 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.remote.rpc.utils;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Preconditions;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.AttributesContainer;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.api.SimpleNode;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec;
+import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlCodecProvider;
+import org.opendaylight.yangtools.yang.data.impl.schema.SchemaUtils;
+import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaNode;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.InstanceIdentifierTypeDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.net.URI;
+import java.util.Map.Entry;
+
+/**
+ * Utility class for bridging JAXP Stream and YANG Data APIs. Note that the definition of this class
+ * by no means final and subject to change as more functionality is centralized here.
+ */
+@Beta
+public class XmlStreamUtils {
+  private static final Logger LOG = LoggerFactory.getLogger(XmlStreamUtils.class);
+  private final XmlCodecProvider codecProvider;
+
+  protected XmlStreamUtils(final XmlCodecProvider codecProvider) {
+    this.codecProvider = Preconditions.checkNotNull(codecProvider);
+  }
+
+  /**
+   * Create a new instance encapsulating a particular codec provider.
+   *
+   * @param codecProvider XML codec provider
+   * @return A new instance
+   */
+  public static XmlStreamUtils create(final XmlCodecProvider codecProvider) {
+    return new XmlStreamUtils(codecProvider);
+  }
+
+  /**
+   * Check if a particular data element can be emitted as an empty element, bypassing value encoding. This
+   * functionality is optional, as valid XML stream is produced even if start/end element is produced unconditionally.
+   *
+   * @param data Data node
+   * @return True if the data node will result in empty element body.
+   */
+  public static boolean isEmptyElement(final Node<?> data) {
+    if (data == null) {
+      return true;
+    }
+
+    if (data instanceof CompositeNode) {
+      return ((CompositeNode) data).getValue().isEmpty();
+    }
+    if (data instanceof SimpleNode) {
+      return data.getValue() == null;
+    }
+
+    // Safe default
+    return false;
+  }
+
+  /**
+   * Write an InstanceIdentifier into the output stream. Calling corresponding {@link javax.xml.stream.XMLStreamWriter#writeStartElement(String)}
+   * and {@link javax.xml.stream.XMLStreamWriter#writeEndElement()} is the responsibility of the caller.
+   *
+   * @param writer XML Stream writer
+   * @param id InstanceIdentifier
+   * @throws javax.xml.stream.XMLStreamException
+   */
+  public static void write(final @Nonnull XMLStreamWriter writer, final @Nonnull YangInstanceIdentifier id) throws XMLStreamException {
+    Preconditions.checkNotNull(writer, "Writer may not be null");
+    Preconditions.checkNotNull(id, "Variable should contain instance of instance identifier and can't be null");
+    LOG.debug("Writing Instance identifier with Random prefix");
+    final RandomPrefix prefixes = new RandomPrefix();
+    final String str = XmlUtils.encodeIdentifier(prefixes, id);
+
+    for (Entry<URI, String> e: prefixes.getPrefixes()) {
+      writer.writeNamespace(e.getValue(), e.getKey().toString());
+    }
+    LOG.debug("Instance identifier with Random prefix is now {}", str);
+    writer.writeCharacters(str);
+  }
+
+  /**
+   * Write a full XML document corresponding to a CompositeNode into an XML stream writer.
+   *
+   * @param writer XML Stream writer
+   * @param data data node
+   * @param schema corresponding schema node, may be null
+   * @throws javax.xml.stream.XMLStreamException if an encoding problem occurs
+   */
+  public void writeDocument(final @Nonnull XMLStreamWriter writer, final @Nonnull CompositeNode data, final @Nullable SchemaNode schema) throws XMLStreamException {
+    // final Boolean repairing = (Boolean) writer.getProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES);
+    // Preconditions.checkArgument(repairing == true, "XML Stream Writer has to be repairing namespaces");
+
+    writer.writeStartDocument();
+    writeElement(writer, data, schema);
+    writer.writeEndDocument();
+    writer.flush();
+  }
+
+
+  /**
+   * Write an element into a XML stream writer. This includes the element start/end tags and
+   * the value of the element.
+   *
+   * @param writer XML Stream writer
+   * @param data data node
+   * @param schema Schema node
+   * @throws javax.xml.stream.XMLStreamException if an encoding problem occurs
+   */
+  public void writeElement(final XMLStreamWriter writer, final @Nonnull Node<?> data, final SchemaNode schema) throws XMLStreamException {
+    final QName qname = data.getNodeType();
+    final String pfx = qname.getPrefix() != null ? qname.getPrefix() : "";
+    final String ns = qname.getNamespace() != null ? qname.getNamespace().toString() : "";
+
+    if (isEmptyElement(data)) {
+      writer.writeEmptyElement(pfx, qname.getLocalName(), ns);
+      return;
+    }
+
+    writer.writeStartElement(pfx, qname.getLocalName(), ns);
+    if (data instanceof AttributesContainer && ((AttributesContainer) data).getAttributes() != null) {
+      for (Entry<QName, String> attribute : ((AttributesContainer) data).getAttributes().entrySet()) {
+        writer.writeAttribute(attribute.getKey().getNamespace().toString(), attribute.getKey().getLocalName(), attribute.getValue());
+      }
+    }
+
+    if (data instanceof SimpleNode<?>) {
+      LOG.debug("writeElement : node is of type SimpleNode");
+      // Simple node
+      if (schema instanceof LeafListSchemaNode) {
+        writeValue(writer, ((LeafListSchemaNode) schema).getType(), data.getValue());
+      } else if (schema instanceof LeafSchemaNode) {
+        writeValue(writer, ((LeafSchemaNode) schema).getType(), data.getValue());
+      } else {
+        Object value = data.getValue();
+        if (value != null) {
+          writer.writeCharacters(String.valueOf(value));
+        }
+      }
+    } else {
+      LOG.debug("writeElement : node is of type CompositeNode");
+      // CompositeNode
+      for (Node<?> child : ((CompositeNode) data).getValue()) {
+        DataSchemaNode childSchema = null;
+        if (schema instanceof DataNodeContainer) {
+          childSchema = SchemaUtils.findFirstSchema(child.getNodeType(), ((DataNodeContainer) schema).getChildNodes()).orNull();
+          if (childSchema == null) {
+            LOG.debug("Probably the data node \"{}\" does not conform to schema", child == null ? "" : child.getNodeType().getLocalName());
+          }
+        }
+
+        writeElement(writer, child, childSchema);
+      }
+    }
+
+    writer.writeEndElement();
+  }
+
+  /**
+   * Write a value into a XML stream writer. This method assumes the start and end of element is
+   * emitted by the caller.
+   *
+   * @param writer XML Stream writer
+   * @param type type definitions
+   * @param value object value
+   * @throws javax.xml.stream.XMLStreamException if an encoding problem occurs
+   */
+  public void writeValue(final @Nonnull XMLStreamWriter writer, final @Nonnull TypeDefinition<?> type, final Object value) throws XMLStreamException {
+    if (value == null) {
+      LOG.debug("Value of {}:{} is null, not encoding it", type.getQName().getNamespace(), type.getQName().getLocalName());
+      return;
+    }
+
+    final TypeDefinition<?> baseType = XmlUtils.resolveBaseTypeFrom(type);
+    if (baseType instanceof IdentityrefTypeDefinition) {
+      write(writer, (IdentityrefTypeDefinition) baseType, value);
+    } else if (baseType instanceof InstanceIdentifierTypeDefinition) {
+      write(writer, (InstanceIdentifierTypeDefinition) baseType, value);
+    } else {
+      final TypeDefinitionAwareCodec<Object, ?> codec = codecProvider.codecFor(baseType);
+      String text;
+      if (codec != null) {
+        try {
+          text = codec.serialize(value);
+        } catch (ClassCastException e) {
+          LOG.error("Provided node value {} did not have type {} required by mapping. Using stream instead.", value, baseType, e);
+          text = String.valueOf(value);
+        }
+      } else {
+        LOG.error("Failed to find codec for {}, falling back to using stream", baseType);
+        text = String.valueOf(value);
+      }
+      writer.writeCharacters(text);
+    }
+  }
+
+  private static void write(final @Nonnull XMLStreamWriter writer, final @Nonnull IdentityrefTypeDefinition type, final @Nonnull Object value) throws XMLStreamException {
+    if (value instanceof QName) {
+      final QName qname = (QName) value;
+      final String prefix;
+      if (qname.getPrefix() != null && !qname.getPrefix().isEmpty()) {
+        prefix = qname.getPrefix();
+      } else {
+        prefix = "x";
+      }
+
+      writer.writeNamespace(prefix, qname.getNamespace().toString());
+      writer.writeCharacters(prefix + ':' + qname.getLocalName());
+    } else {
+      LOG.debug("Value of {}:{} is not a QName but {}", type.getQName().getNamespace(), type.getQName().getLocalName(), value.getClass());
+      writer.writeCharacters(String.valueOf(value));
+    }
+  }
+
+  private static void write(final @Nonnull XMLStreamWriter writer, final @Nonnull InstanceIdentifierTypeDefinition type, final @Nonnull Object value) throws XMLStreamException {
+    if (value instanceof YangInstanceIdentifier) {
+      LOG.debug("Writing InstanceIdentifier object {}", value);
+      write(writer, (YangInstanceIdentifier)value);
+    } else {
+      LOG.debug("Value of {}:{} is not an InstanceIdentifier but {}", type.getQName().getNamespace(), type.getQName().getLocalName(), value.getClass());
+      writer.writeCharacters(String.valueOf(value));
+    }
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/XmlUtils.java b/opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/XmlUtils.java
new file mode 100644 (file)
index 0000000..e07401a
--- /dev/null
@@ -0,0 +1,281 @@
+/*
+ * 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.remote.rpc.utils;
+
+import com.google.common.base.Optional;
+import org.opendaylight.controller.netconf.util.xml.XmlUtil;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.api.SimpleNode;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
+import org.opendaylight.yangtools.yang.data.impl.XmlTreeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec;
+import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlCodecProvider;
+import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
+import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import javax.activation.UnsupportedDataTypeException;
+import javax.annotation.Nonnull;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Common XML-related utility methods, which are not specific to a particular
+ * JAXP API.
+ */
+public class XmlUtils {
+
+  public static final XmlCodecProvider DEFAULT_XML_CODEC_PROVIDER = new XmlCodecProvider() {
+    @Override
+    public TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>> codecFor(final TypeDefinition<?> baseType) {
+      return TypeDefinitionAwareCodec.from(baseType);
+    }
+  };
+
+  private XmlUtils() {
+  }
+
+  private static final String BLANK = "";
+  private static final Logger LOG = LoggerFactory.getLogger(XmlUtils.class);
+
+  /**
+   * Converts the composite node to xml using rpc input schema node
+   * @param cNode
+   * @param schemaContext
+   * @return xml String
+   */
+  public static String inputCompositeNodeToXml(CompositeNode cNode, SchemaContext schemaContext){
+    LOG.debug("Converting input composite node to xml {}", cNode);
+    if (cNode == null) return BLANK;
+
+    if(schemaContext == null) return BLANK;
+
+    Document domTree = null;
+    try {
+      Set<RpcDefinition> rpcs =  schemaContext.getOperations();
+      for(RpcDefinition rpc : rpcs) {
+        if(rpc.getQName().equals(cNode.getNodeType())){
+          LOG.debug("Found the rpc definition from schema context matching with input composite node  {}", rpc.getQName());
+
+          CompositeNode inputContainer = cNode.getFirstCompositeByName(QName.create(cNode.getNodeType(), "input"));
+          domTree = XmlDocumentUtils.toDocument(inputContainer, rpc.getInput(), XmlDocumentUtils.defaultValueCodecProvider());
+
+          LOG.debug("input composite node to document conversion complete, document is   {}", domTree);
+          break;
+        }
+      }
+
+    } catch (UnsupportedDataTypeException e) {
+      LOG.error("Error during translation of CompositeNode to Document", e);
+    }
+    return domTransformer(domTree);
+  }
+
+  /**
+   * Converts the composite node to xml String using rpc output schema node
+   * @param cNode
+   * @param schemaContext
+   * @return xml string
+   */
+  public static String outputCompositeNodeToXml(CompositeNode cNode, SchemaContext schemaContext){
+    LOG.debug("Converting output composite node to xml {}", cNode);
+    if (cNode == null) return BLANK;
+
+    if(schemaContext == null) return BLANK;
+
+    Document domTree = null;
+    try {
+      Set<RpcDefinition> rpcs =  schemaContext.getOperations();
+      for(RpcDefinition rpc : rpcs) {
+        if(rpc.getQName().equals(cNode.getNodeType())){
+          LOG.debug("Found the rpc definition from schema context matching with output composite node  {}", rpc.getQName());
+
+          CompositeNode outputContainer = cNode.getFirstCompositeByName(QName.create(cNode.getNodeType(), "output"));
+          domTree = XmlDocumentUtils.toDocument(outputContainer, rpc.getOutput(), XmlDocumentUtils.defaultValueCodecProvider());
+
+          LOG.debug("output composite node to document conversion complete, document is   {}", domTree);
+          break;
+        }
+      }
+
+    } catch (UnsupportedDataTypeException e) {
+      LOG.error("Error during translation of CompositeNode to Document", e);
+    }
+    return domTransformer(domTree);
+  }
+
+  private static String domTransformer(Document domTree) {
+    StringWriter writer = new StringWriter();
+    try {
+      TransformerFactory tf = TransformerFactory.newInstance();
+      Transformer transformer = tf.newTransformer();
+      transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+      transformer.transform(new DOMSource(domTree), new StreamResult(writer));
+    } catch (TransformerException e) {
+
+      LOG.error("Error during translation of Document to OutputStream", e);
+    }
+    LOG.debug("Document to string conversion complete, xml string is  {} ",  writer.toString());
+
+    return writer.toString();
+  }
+
+  public static CompositeNode xmlToCompositeNode(String xml){
+    if (xml==null || xml.length()==0) return null;
+
+    Node<?> dataTree;
+    try {
+      dataTree = XmlTreeBuilder.buildDataTree(new ByteArrayInputStream(xml.getBytes()));
+    } catch (XMLStreamException e) {
+      LOG.error("Error during building data tree from XML", e);
+      return null;
+    }
+    if (dataTree == null) {
+      LOG.error("data tree is null");
+      return null;
+    }
+    if (dataTree instanceof SimpleNode) {
+      LOG.error("RPC XML was resolved as SimpleNode");
+      return null;
+    }
+    return (CompositeNode) dataTree;
+  }
+
+  /**
+   * Converts the xml to composite node using rpc input schema node
+   * @param rpc
+   * @param xml
+   * @param schemaContext
+   * @return CompositeNode object based on the input, if any of the input parameter is null, a null object is returned
+   */
+  public static CompositeNode inputXmlToCompositeNode(QName rpc, String xml,  SchemaContext schemaContext){
+    LOG.debug("Converting input xml to composite node {}", xml);
+    if (xml==null || xml.length()==0) return null;
+
+    if(rpc == null) return null;
+
+    if(schemaContext == null) return null;
+
+    CompositeNode compositeNode = null;
+    try {
+
+      Document doc = XmlUtil.readXmlToDocument(xml);
+      Set<RpcDefinition> rpcs =  schemaContext.getOperations();
+      for(RpcDefinition rpcDef : rpcs) {
+        if(rpcDef.getQName().equals(rpc)){
+          LOG.debug("found the rpc definition from schema context matching rpc  {}", rpc);
+
+          if(rpcDef.getInput() == null) {
+            LOG.warn("found rpc definition's input is null");
+            return null;
+          }
+
+          QName input = rpcDef.getInput().getQName();
+          NodeList nodeList = doc.getElementsByTagNameNS(input.getNamespace().toString(), "input");
+          if(nodeList == null || nodeList.getLength() < 1) {
+            LOG.warn("xml does not have input entry. {}", xml);
+            return null;
+          }
+          Element xmlData = (Element)nodeList.item(0);
+
+          List<Node<?>> dataNodes = XmlDocumentUtils.toDomNodes(xmlData,
+              Optional.of(rpcDef.getInput().getChildNodes()), schemaContext);
+
+          LOG.debug("Converted xml input to list of nodes  {}", dataNodes);
+
+          final CompositeNodeBuilder<ImmutableCompositeNode> it = ImmutableCompositeNode.builder();
+          it.setQName(input);
+          it.add(ImmutableCompositeNode.create(input, dataNodes));
+          compositeNode = it.toInstance();
+          break;
+        }
+      }
+    } catch (SAXException e) {
+      LOG.error("Error during building data tree from XML", e);
+    } catch (IOException e) {
+      LOG.error("Error during building data tree from XML", e);
+    }
+
+    LOG.debug("Xml to composite node conversion complete {} ", compositeNode);
+    return compositeNode;
+  }
+
+  public static TypeDefinition<?> resolveBaseTypeFrom(final @Nonnull TypeDefinition<?> type) {
+    TypeDefinition<?> superType = type;
+    while (superType.getBaseType() != null) {
+      superType = superType.getBaseType();
+    }
+    return superType;
+  }
+
+  /**
+   * This code is picked from yangtools and modified to add type of instance identifier
+   * output of instance identifier something like below for a flow ref composite node of type instance identifier,
+   * which has path arguments with predicates, whose value is of type java.lang.short
+   * <flow-ref xmlns:bgkj="urn:opendaylight:flow:inventory" xmlns:jdlk="urn:opendaylight:inventory">
+   *   /jdlk:nodes/jdlk:node[jdlk:id='openflow:205558455098190@java.lang.String']
+   *   /bgkj:table[bgkj:id='3@java.lang.Short']
+   *   /bgkj:flow[bgkj:id='156@java.lang.String']
+   * </flow-ref>
+   *
+   */
+
+  public static String encodeIdentifier(final RandomPrefix prefixes, final YangInstanceIdentifier id) {
+    StringBuilder textContent = new StringBuilder();
+    for (PathArgument pathArgument : id.getPathArguments()) {
+      textContent.append('/');
+      textContent.append(prefixes.encodeQName(pathArgument.getNodeType()));
+      if (pathArgument instanceof NodeIdentifierWithPredicates) {
+        Map<QName, Object> predicates = ((NodeIdentifierWithPredicates) pathArgument).getKeyValues();
+
+        for (QName keyValue : predicates.keySet()) {
+          Object value = predicates.get(keyValue);
+          String type = value.getClass().getName();
+          String predicateValue = String.valueOf(value);
+          textContent.append('[');
+          textContent.append(prefixes.encodeQName(keyValue));
+          textContent.append("='");
+          textContent.append(predicateValue);
+          textContent.append("@");
+          textContent.append(type);
+          textContent.append("']");
+        }
+      } else if (pathArgument instanceof NodeWithValue) {
+        textContent.append("[.='");
+        textContent.append(((NodeWithValue) pathArgument).getValue());
+        textContent.append("']");
+      }
+    }
+
+    return textContent.toString();
+  }
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/resources/application.conf b/opendaylight/md-sal/sal-remoterpc-connector/src/main/resources/application.conf
new file mode 100644 (file)
index 0000000..6088dd0
--- /dev/null
@@ -0,0 +1,21 @@
+odl-cluster{
+  akka {
+    actor {
+      provider = "akka.cluster.ClusterActorRefProvider"
+
+    }
+    remote {
+      log-remote-lifecycle-events = off
+      netty.tcp {
+        hostname = "192.168.141.141"
+        port = 2551
+      }
+    }
+
+    cluster {
+      seed-nodes = ["akka.tcp://opendaylight-rpc@192.168.141.141:2551"]
+
+      auto-down-unreachable-after = 10s
+    }
+  }
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/yang/remote-rpc-connector.yang b/opendaylight/md-sal/sal-remoterpc-connector/src/main/yang/remote-rpc-connector.yang
new file mode 100644 (file)
index 0000000..08db5c0
--- /dev/null
@@ -0,0 +1,40 @@
+module remote-rpc-connector {
+       yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:config:remote-rpc-connector";
+    prefix "remote-rpc-connector";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import opendaylight-md-sal-dom {prefix dom;}
+    
+    description
+        "This module contains the base YANG definitions for
+                 the remote routed rpc";
+    revision "2014-07-07" {
+        description
+            "Initial revision";
+    }
+
+    // This is the definition of the service implementation as a module identity.
+    identity remote-rpc-connector {
+      base config:module-type;
+      // Specifies the prefix for generated java classes.
+      config:java-name-prefix RemoteRPCBroker;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case remote-rpc-connector {
+            when "/config:modules/config:module/config:type = 'remote-rpc-connector'";
+            
+            container dom-broker {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity dom:dom-broker-osgi-registry;
+                    }
+                }
+            }
+        }
+    }
+
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RpcBrokerTest.java b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RpcBrokerTest.java
new file mode 100644 (file)
index 0000000..392c1e6
--- /dev/null
@@ -0,0 +1,217 @@
+/*
+ * 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.remote.rpc;
+
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSystem;
+import akka.testkit.JavaTestKit;
+import com.google.common.util.concurrent.Futures;
+import junit.framework.Assert;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.opendaylight.controller.remote.rpc.messages.AddRoutedRpc;
+import org.opendaylight.controller.remote.rpc.messages.AddRpc;
+import org.opendaylight.controller.remote.rpc.messages.ErrorResponse;
+import org.opendaylight.controller.remote.rpc.messages.InvokeRoutedRpc;
+import org.opendaylight.controller.remote.rpc.messages.InvokeRpc;
+import org.opendaylight.controller.remote.rpc.messages.RpcResponse;
+import org.opendaylight.controller.remote.rpc.registry.ClusterWrapper;
+import org.opendaylight.controller.remote.rpc.registry.RpcRegistry;
+import org.opendaylight.controller.sal.common.util.Rpcs;
+import org.opendaylight.controller.sal.connector.api.RpcRouter;
+import org.opendaylight.controller.sal.core.api.Broker;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.ModifyAction;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.Future;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class RpcBrokerTest {
+
+  static ActorSystem system;
+
+
+  @BeforeClass
+  public static void setup() {
+    system = ActorSystem.create();
+  }
+
+  @AfterClass
+  public static void teardown() {
+    JavaTestKit.shutdownActorSystem(system);
+    system = null;
+  }
+
+  @Test
+  public void testInvokeRpcError() throws URISyntaxException {
+    new JavaTestKit(system) {{
+      ActorRef rpcRegistry = system.actorOf(RpcRegistry.props(Mockito.mock(ClusterWrapper.class)));
+      Broker.ProviderSession brokerSession = Mockito.mock(Broker.ProviderSession.class);
+      SchemaContext schemaContext = mock(SchemaContext.class);
+      ActorRef rpcBroker = system.actorOf(RpcBroker.props(brokerSession, rpcRegistry, schemaContext));
+      QName rpc = new QName(new URI("noactor1"), "noactor1");
+      CompositeNode input = new ImmutableCompositeNode(QName.create("ns", "2013-12-09", "no child"), new ArrayList<Node<?>>(), ModifyAction.REPLACE);
+      InvokeRpc invokeMsg = new InvokeRpc(rpc, input);
+      rpcBroker.tell(invokeMsg, getRef());
+
+      Boolean getMsg = new ExpectMsg<Boolean>("ErrorResponse") {
+        protected Boolean match(Object in) {
+          if (in instanceof ErrorResponse) {
+            ErrorResponse reply = (ErrorResponse)in;
+            return reply.getException().getMessage().contains("No remote actor found for rpc execution of :");
+          } else {
+            throw noMatch();
+          }
+        }
+      }.get(); // this extracts the received message
+
+      Assert.assertTrue(getMsg);
+    }};
+  }
+
+  /**
+   * This test method invokes and executes the remote rpc
+   */
+
+  @Test
+  public void testInvokeRpc() throws URISyntaxException {
+    new JavaTestKit(system) {{
+      ActorRef rpcRegistry = system.actorOf(RpcRegistry.props(mock(ClusterWrapper.class)));
+      Broker.ProviderSession brokerSession = mock(Broker.ProviderSession.class);
+      SchemaContext schemaContext = mock(SchemaContext.class);
+      ActorRef rpcBroker = system.actorOf(RpcBroker.props(brokerSession, rpcRegistry, schemaContext));
+      ActorRef rpcBrokerRemote = system.actorOf(RpcBroker.props(brokerSession, rpcRegistry, schemaContext), "actor1");
+      // Add RPC in table
+      QName rpc = new QName(new URI("actor1"), "actor1");
+      RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, rpc, null);
+      final String route = rpcBrokerRemote.path().toString();
+      AddRpc rpcMsg = new AddRpc(routeId, route);
+      rpcRegistry.tell(rpcMsg, getRef());
+      expectMsgEquals(duration("2 second"), "Success");
+
+      // invoke rpc
+      CompositeNode input = new ImmutableCompositeNode(QName.create("ns", "2013-12-09", "child1"), new ArrayList<Node<?>>(), ModifyAction.REPLACE);
+      CompositeNode invokeRpcResult = mock(CompositeNode.class);
+      Collection<RpcError> errors = new ArrayList<>();
+      RpcResult<CompositeNode> result = Rpcs.getRpcResult(true, invokeRpcResult, errors);
+      Future<RpcResult<CompositeNode>> rpcResult = Futures.immediateFuture(result);
+      when(brokerSession.rpc(rpc, input)).thenReturn(rpcResult);
+      InvokeRpc invokeMsg = new InvokeRpc(rpc, input);
+      rpcBroker.tell(invokeMsg, getRef());
+
+      //verify response msg
+      Boolean getMsg = new ExpectMsg<Boolean>("RpcResponse") {
+        protected Boolean match(Object in) {
+          if (in instanceof RpcResponse) {
+            return true;
+          } else {
+            throw noMatch();
+          }
+        }
+      }.get(); // this extracts the received message
+
+      Assert.assertTrue(getMsg);
+    }};
+  }
+
+  @Test
+  public void testInvokeRoutedRpcError() throws URISyntaxException {
+    new JavaTestKit(system) {{
+      ActorRef rpcRegistry = system.actorOf(RpcRegistry.props(Mockito.mock(ClusterWrapper.class)));
+      Broker.ProviderSession brokerSession = Mockito.mock(Broker.ProviderSession.class);
+      SchemaContext schemaContext = mock(SchemaContext.class);
+      ActorRef rpcBroker = system.actorOf(RpcBroker.props(brokerSession, rpcRegistry, schemaContext));
+      QName rpc = new QName(new URI("actor1"), "actor1");
+      CompositeNode input = new ImmutableCompositeNode(QName.create("ns", "2013-12-09", "child1"), new ArrayList<Node<?>>(), ModifyAction.REPLACE);
+      InvokeRoutedRpc invokeMsg = new InvokeRoutedRpc(rpc, YangInstanceIdentifier.create(new YangInstanceIdentifier.NodeIdentifier(rpc)), input);
+      rpcBroker.tell(invokeMsg, getRef());
+
+      Boolean getMsg = new ExpectMsg<Boolean>("ErrorResponse") {
+        protected Boolean match(Object in) {
+          if (in instanceof ErrorResponse) {
+            ErrorResponse reply = (ErrorResponse)in;
+            return "No remote actor found for rpc execution.".equals(reply.getException().getMessage());
+          } else {
+            throw noMatch();
+          }
+        }
+      }.get(); // this extracts the received message
+
+      Assert.assertTrue(getMsg);
+    }};
+  }
+
+  /**
+   * This test method invokes and executes the remote routed rpc
+   */
+
+  @Test
+  public void testInvokeRoutedRpc() throws URISyntaxException {
+    new JavaTestKit(system) {{
+      ActorRef rpcRegistry = system.actorOf(RpcRegistry.props(mock(ClusterWrapper.class)));
+      Broker.ProviderSession brokerSession = mock(Broker.ProviderSession.class);
+      SchemaContext schemaContext = mock(SchemaContext.class);
+      ActorRef rpcBroker = system.actorOf(RpcBroker.props(brokerSession, rpcRegistry, schemaContext));
+      ActorRef rpcBrokerRemote = system.actorOf(RpcBroker.props(brokerSession, rpcRegistry, schemaContext), "actor2");
+      // Add Routed RPC in table
+      QName rpc = new QName(new URI("actor2"), "actor2");
+      YangInstanceIdentifier identifier = YangInstanceIdentifier.create(new YangInstanceIdentifier.NodeIdentifier(rpc));
+      RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, rpc, identifier);
+      final String route = rpcBrokerRemote.path().toString();
+      Set<RpcRouter.RouteIdentifier<?, ?, ?>> routeIds = new HashSet<>();
+      routeIds.add(routeId);
+
+      AddRoutedRpc rpcMsg = new AddRoutedRpc(routeIds, route);
+      rpcRegistry.tell(rpcMsg, getRef());
+      expectMsgEquals(duration("2 second"), "Success");
+
+      // invoke rpc
+      CompositeNode input = new ImmutableCompositeNode(QName.create("ns", "2013-12-09", "child1"), new ArrayList<Node<?>>(), ModifyAction.REPLACE);
+      CompositeNode invokeRpcResult = mock(CompositeNode.class);
+      Collection<RpcError> errors = new ArrayList<>();
+      RpcResult<CompositeNode> result = Rpcs.getRpcResult(true, invokeRpcResult, errors);
+      Future<RpcResult<CompositeNode>> rpcResult = Futures.immediateFuture(result);
+      when(brokerSession.rpc(rpc, input)).thenReturn(rpcResult);
+      InvokeRoutedRpc invokeMsg = new InvokeRoutedRpc(rpc, identifier, input);
+      rpcBroker.tell(invokeMsg, getRef());
+
+      //verify response msg
+      Boolean getMsg = new ExpectMsg<Boolean>("RpcResponse") {
+        protected Boolean match(Object in) {
+          if (in instanceof RpcResponse) {
+            return true;
+          } else {
+            throw noMatch();
+          }
+        }
+      }.get(); // this extracts the received message
+
+      Assert.assertTrue(getMsg);
+    }};
+  }
+
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/RoutingTableTest.java b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/RoutingTableTest.java
new file mode 100644 (file)
index 0000000..129a5a5
--- /dev/null
@@ -0,0 +1,211 @@
+/*
+ * 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.remote.rpc.registry;
+
+import junit.framework.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.remote.rpc.RouteIdentifierImpl;
+import org.opendaylight.controller.sal.connector.api.RpcRouter;
+import org.opendaylight.yangtools.yang.common.QName;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashSet;
+import java.util.Set;
+
+public class RoutingTableTest {
+
+  private RoutingTable<RpcRouter.RouteIdentifier<?, ?, ?>, String> routingTable =
+      new RoutingTable<>();
+
+  @Test
+  public void addGlobalRouteNullRouteIdTest() {
+    try {
+      routingTable.addGlobalRoute(null, null);
+
+      Assert.fail("Null pointer exception was not thrown.");
+    } catch (Exception e) {
+      Assert.assertEquals(NullPointerException.class.getName(), e.getClass().getName());
+      Assert.assertEquals("addGlobalRoute: routeId cannot be null!", e.getMessage());
+    }
+  }
+
+  @Test
+  public void addGlobalRouteNullRouteTest() {
+    try {
+      QName type = new QName(new URI("actor1"), "actor1");
+      RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, type, null);
+      routingTable.addGlobalRoute(routeId, null);
+
+      Assert.fail("Null pointer exception was not thrown.");
+    } catch (Exception e) {
+      Assert.assertEquals(NullPointerException.class.getName(), e.getClass().getName());
+      Assert.assertEquals("addGlobalRoute: route cannot be null!", e.getMessage());
+    }
+  }
+
+  @Test
+  public void getGlobalRouteNullTest() {
+    try {
+      routingTable.getGlobalRoute(null);
+
+      Assert.fail("Null pointer exception was not thrown.");
+    } catch (Exception e) {
+      Assert.assertEquals(NullPointerException.class.getName(), e.getClass().getName());
+      Assert.assertEquals("getGlobalRoute: routeId cannot be null!", e.getMessage());
+    }
+  }
+
+  @Test
+  public void getGlobalRouteTest() throws URISyntaxException {
+    QName type = new QName(new URI("actor1"), "actor1");
+    RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, type, null);
+    String route = "actor1";
+
+    routingTable.addGlobalRoute(routeId, route);
+
+    String returnedRoute = routingTable.getGlobalRoute(routeId);
+
+    Assert.assertEquals(route, returnedRoute);
+
+  }
+
+  @Test
+  public void removeGlobalRouteTest() throws URISyntaxException {
+    QName type = new QName(new URI("actorRemove"), "actorRemove");
+    RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, type, null);
+    String route = "actorRemove";
+
+    routingTable.addGlobalRoute(routeId, route);
+
+    String returnedRoute = routingTable.getGlobalRoute(routeId);
+
+    Assert.assertEquals(route, returnedRoute);
+
+    routingTable.removeGlobalRoute(routeId);
+
+    String deletedRoute = routingTable.getGlobalRoute(routeId);
+
+    Assert.assertNull(deletedRoute);
+  }
+
+  @Test
+  public void addRoutedRpcNullRouteIdTest() {
+    try {
+      routingTable.addRoutedRpc(null, null);
+
+      Assert.fail("Null pointer exception was not thrown.");
+    } catch (Exception e) {
+      Assert.assertEquals(NullPointerException.class.getName(), e.getClass().getName());
+      Assert.assertEquals("addRoute: routeId cannot be null", e.getMessage());
+    }
+  }
+
+  @Test
+  public void addRoutedRpcNullRouteTest() {
+    try {
+      QName type = new QName(new URI("actor1"), "actor1");
+      RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, type, null);
+
+      routingTable.addRoutedRpc(routeId, null);
+
+      Assert.fail("Null pointer exception was not thrown.");
+    } catch (Exception e) {
+      Assert.assertEquals(NullPointerException.class.getName(), e.getClass().getName());
+      Assert.assertEquals("addRoute: route cannot be null", e.getMessage());
+    }
+  }
+
+  @Test
+  public void getRoutedRpcNullTest() {
+    try {
+      routingTable.getRoutedRpc(null);
+
+      Assert.fail("Null pointer exception was not thrown.");
+    } catch (Exception e) {
+      Assert.assertEquals(NullPointerException.class.getName(), e.getClass().getName());
+      Assert.assertEquals("getRoutes: routeId cannot be null!", e.getMessage());
+    }
+  }
+
+  @Test
+  public void getRoutedRpcTest() throws URISyntaxException {
+    QName type = new QName(new URI("actor1"), "actor1");
+    RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, type, null);
+    String route = "actor1";
+
+    routingTable.addRoutedRpc(routeId, route);
+
+    Set<String> routes = routingTable.getRoutedRpc(routeId);
+
+    Assert.assertEquals(1, routes.size());
+    Assert.assertTrue(routes.contains(route));
+
+  }
+
+  @Test
+  public void getLastRoutedRpcTest() throws URISyntaxException {
+    QName type = new QName(new URI("first1"), "first1");
+    RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, type, null);
+    String route = "first1";
+
+    routingTable.addRoutedRpc(routeId, route);
+
+    String route2 = "second1";
+    routingTable.addRoutedRpc(routeId, route2);
+
+    String latest = routingTable.getLastAddedRoutedRpc(routeId);
+    Assert.assertEquals(route2, latest);
+
+  }
+
+  @Test
+  public void removeRoutedRpcTest() throws URISyntaxException {
+    QName type = new QName(new URI("remove"), "remove");
+    RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, type, null);
+    String route = "remove";
+    routingTable.addRoutedRpc(routeId, route);
+
+    String latest = routingTable.getLastAddedRoutedRpc(routeId);
+    Assert.assertEquals(route, latest);
+
+    routingTable.removeRoute(routeId, route);
+    String removed = routingTable.getLastAddedRoutedRpc(routeId);
+    Assert.assertNull(removed);
+  }
+
+  @Test
+  public void removeRoutedRpcsTest() throws URISyntaxException {
+    QName type = new QName(new URI("remove1"), "remove1");
+    RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, type, null);
+
+    QName type2 = new QName(new URI("remove2"), "remove2");
+    RouteIdentifierImpl routeId2 = new RouteIdentifierImpl(null, type2, null);
+
+    Set<RpcRouter.RouteIdentifier<?, ?, ?>> routeIds = new HashSet<>();
+    routeIds.add(routeId);
+    routeIds.add(routeId2);
+    String route = "remove1";
+
+    routingTable.addRoutedRpcs(routeIds, route);
+    String latest1 = routingTable.getLastAddedRoutedRpc(routeId);
+    Assert.assertEquals(route, latest1);
+
+    String latest2 = routingTable.getLastAddedRoutedRpc(routeId2);
+    Assert.assertEquals(route, latest2);
+
+    routingTable.removeRoutes(routeIds, route);
+    String removed1 = routingTable.getLastAddedRoutedRpc(routeId);
+    Assert.assertNull(removed1);
+
+    String removed2 = routingTable.getLastAddedRoutedRpc(routeId2);
+    Assert.assertNull(removed2);
+  }
+
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistryTest.java b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistryTest.java
new file mode 100644 (file)
index 0000000..d011d33
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * 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.remote.rpc.registry;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSystem;
+import akka.testkit.JavaTestKit;
+import junit.framework.Assert;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.opendaylight.controller.remote.rpc.RouteIdentifierImpl;
+import org.opendaylight.controller.remote.rpc.messages.AddRoutedRpc;
+import org.opendaylight.controller.remote.rpc.messages.AddRpc;
+import org.opendaylight.controller.remote.rpc.messages.GetRoutedRpc;
+import org.opendaylight.controller.remote.rpc.messages.GetRoutedRpcReply;
+import org.opendaylight.controller.remote.rpc.messages.GetRpc;
+import org.opendaylight.controller.remote.rpc.messages.GetRpcReply;
+import org.opendaylight.controller.remote.rpc.messages.RemoveRoutedRpc;
+import org.opendaylight.controller.remote.rpc.messages.RemoveRpc;
+import org.opendaylight.controller.sal.connector.api.RpcRouter;
+import org.opendaylight.yangtools.yang.common.QName;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashSet;
+import java.util.Set;
+
+public class RpcRegistryTest {
+
+  static ActorSystem system;
+
+
+  @BeforeClass
+  public static void setup() {
+    system = ActorSystem.create();
+  }
+
+  @AfterClass
+  public static void teardown() {
+    JavaTestKit.shutdownActorSystem(system);
+    system = null;
+  }
+
+  /**
+   This test add, read and remove an entry in global rpc
+   */
+  @Test
+  public void testGlobalRpc() throws URISyntaxException {
+    new JavaTestKit(system) {{
+      ActorRef rpcRegistry = system.actorOf(RpcRegistry.props(Mockito.mock(ClusterWrapper.class)));
+      QName type = new QName(new URI("actor1"), "actor1");
+      RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, type, null);
+      final String route = "actor1";
+
+      AddRpc rpcMsg = new AddRpc(routeId, route);
+      rpcRegistry.tell(rpcMsg, getRef());
+      expectMsgEquals(duration("2 second"), "Success");
+
+      GetRpc getRpc = new GetRpc(routeId);
+      rpcRegistry.tell(getRpc, getRef());
+
+      Boolean getMsg = new ExpectMsg<Boolean>("GetRpcReply") {
+        protected Boolean match(Object in) {
+          if (in instanceof GetRpcReply) {
+            GetRpcReply reply = (GetRpcReply)in;
+            return route.equals(reply.getRoutePath());
+          } else {
+            throw noMatch();
+          }
+        }
+      }.get(); // this extracts the received message
+
+      Assert.assertTrue(getMsg);
+
+      RemoveRpc removeMsg = new RemoveRpc(routeId);
+      rpcRegistry.tell(removeMsg, getRef());
+      expectMsgEquals(duration("2 second"), "Success");
+
+      rpcRegistry.tell(getRpc, getRef());
+
+      Boolean getNullMsg = new ExpectMsg<Boolean>("GetRpcReply") {
+        protected Boolean match(Object in) {
+          if (in instanceof GetRpcReply) {
+            GetRpcReply reply = (GetRpcReply)in;
+            return reply.getRoutePath() == null;
+          } else {
+            throw noMatch();
+          }
+        }
+      }.get();
+      Assert.assertTrue(getNullMsg);
+    }};
+
+  }
+
+  /**
+   This test add, read and remove an entry in routed rpc
+   */
+  @Test
+  public void testRoutedRpc() throws URISyntaxException {
+    new JavaTestKit(system) {{
+      ActorRef rpcRegistry = system.actorOf(RpcRegistry.props(Mockito.mock(ClusterWrapper.class)));
+      QName type = new QName(new URI("actor1"), "actor1");
+      RouteIdentifierImpl routeId = new RouteIdentifierImpl(null, type, null);
+      final String route = "actor1";
+
+      Set<RpcRouter.RouteIdentifier<?, ?, ?>> routeIds = new HashSet<>();
+      routeIds.add(routeId);
+
+      AddRoutedRpc rpcMsg = new AddRoutedRpc(routeIds, route);
+      rpcRegistry.tell(rpcMsg, getRef());
+      expectMsgEquals(duration("2 second"), "Success");
+
+      GetRoutedRpc getRpc = new GetRoutedRpc(routeId);
+      rpcRegistry.tell(getRpc, getRef());
+
+      Boolean getMsg = new ExpectMsg<Boolean>("GetRoutedRpcReply") {
+        protected Boolean match(Object in) {
+          if (in instanceof GetRoutedRpcReply) {
+            GetRoutedRpcReply reply = (GetRoutedRpcReply)in;
+            return route.equals(reply.getRoutePath());
+          } else {
+            throw noMatch();
+          }
+        }
+      }.get(); // this extracts the received message
+
+      Assert.assertTrue(getMsg);
+
+      RemoveRoutedRpc removeMsg = new RemoveRoutedRpc(routeIds, route);
+      rpcRegistry.tell(removeMsg, getRef());
+      expectMsgEquals(duration("2 second"), "Success");
+
+      rpcRegistry.tell(getRpc, getRef());
+
+      Boolean getNullMsg = new ExpectMsg<Boolean>("GetRoutedRpcReply") {
+        protected Boolean match(Object in) {
+          if (in instanceof GetRoutedRpcReply) {
+            GetRoutedRpcReply reply = (GetRoutedRpcReply)in;
+            return reply.getRoutePath() == null;
+          } else {
+            throw noMatch();
+          }
+        }
+      }.get();
+      Assert.assertTrue(getNullMsg);
+    }};
+
+  }
+
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/utils/XmlUtilsTest.java b/opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/utils/XmlUtilsTest.java
new file mode 100644 (file)
index 0000000..a408e1d
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * 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.remote.rpc.utils;
+
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import com.google.common.io.ByteSource;
+import junit.framework.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.ModifyAction;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.api.SimpleNode;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+
+public class XmlUtilsTest {
+
+  private static final DocumentBuilderFactory BUILDERFACTORY;
+
+  static {
+    final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+    factory.setNamespaceAware(true);
+    factory.setCoalescing(true);
+    factory.setIgnoringElementContentWhitespace(true);
+    factory.setIgnoringComments(true);
+    BUILDERFACTORY = factory;
+  }
+
+  private SchemaContext schema;
+  private RpcDefinition testRpc;
+
+  public static final String XML_CONTENT = "<add-flow xmlns=\"urn:opendaylight:controller:rpc:test\"><input xmlns=\"urn:opendaylight:controller:rpc:test\">" +
+      "<id>flowid</id>" +
+      "<flow xmlns:ltha=\"urn:opendaylight:controller:rpc:test\">/ltha:node/ltha:node1[ltha:id='3@java.lang.Short']</flow>" +
+      "</input></add-flow>";
+
+  @Before
+  public void setUp() throws Exception {
+    final ByteSource byteSource = new ByteSource() {
+      @Override
+      public InputStream openStream() throws IOException {
+        return XmlUtilsTest.this.getClass().getResourceAsStream("rpcTest.yang");
+      }
+    };
+    schema = new YangParserImpl().parseSources(Lists.newArrayList(byteSource));
+    final Module rpcTestModule = schema.getModules().iterator().next();
+    testRpc = rpcTestModule.getRpcs().iterator().next();
+  }
+
+  @Test
+  public void testNullInputXmlToComposite() {
+    CompositeNode node = XmlUtils.inputXmlToCompositeNode(testRpc.getQName(), null, schema);
+    Assert.assertNull(node);
+  }
+
+  @Test
+  public void testNullRpcXmlToComposite() {
+    CompositeNode node = XmlUtils.inputXmlToCompositeNode(null, XML_CONTENT, schema);
+    Assert.assertNull(node);
+  }
+
+  @Test
+  public void testInputXmlToCompositeNode() {
+    CompositeNode node = XmlUtils.inputXmlToCompositeNode(testRpc.getQName(), XML_CONTENT, schema);
+    ImmutableList<SimpleNode> input = (ImmutableList)node.getValue().get(0).getValue();
+    SimpleNode firstNode = input.get(0);
+
+    Assert.assertEquals("id", firstNode.getNodeType().getLocalName());
+    Assert.assertEquals("flowid", firstNode.getValue());
+
+    SimpleNode secondNode = input.get(1);
+    Assert.assertEquals("flow", secondNode.getNodeType().getLocalName());
+
+    YangInstanceIdentifier instance = (YangInstanceIdentifier) secondNode.getValue();
+    Iterable<YangInstanceIdentifier.PathArgument> iterable = instance.getPathArguments();
+    Iterator it = iterable.iterator();
+    YangInstanceIdentifier.NodeIdentifier firstPath = (YangInstanceIdentifier.NodeIdentifier) it.next();
+    Assert.assertEquals("node", firstPath.getNodeType().getLocalName());
+    YangInstanceIdentifier.NodeIdentifierWithPredicates secondPath = (YangInstanceIdentifier.NodeIdentifierWithPredicates)it.next();
+    Short value = (Short)secondPath.getKeyValues().values().iterator().next();
+    Short expected = 3;
+    Assert.assertEquals(expected, value);
+  }
+
+  @Test
+  public void testInputCompositeNodeToXML() {
+    CompositeNode input = XmlUtils.inputXmlToCompositeNode(testRpc.getQName(), XML_CONTENT, schema);
+    List<Node<?>> childNodes = new ArrayList();
+    childNodes.add(input);
+    QName rpcQName = schema.getOperations().iterator().next().getQName();
+    CompositeNode node = new ImmutableCompositeNode(rpcQName, input.getValue(), ModifyAction.REPLACE);
+    String xml = XmlUtils.inputCompositeNodeToXml(node, schema);
+    Assert.assertNotNull(xml);
+    Assert.assertTrue(xml.contains("3@java.lang.Short"));
+  }
+
+  @Test
+  public void testNullCompositeNodeToXml(){
+    String xml = XmlUtils.inputCompositeNodeToXml(null, schema);
+    Assert.assertTrue(xml.isEmpty());
+  }
+
+  @Test
+  public void testNullSchemaCompositeNodeToXml(){
+    String xml = XmlUtils.inputCompositeNodeToXml(new ImmutableCompositeNode(QName.create("ns", "2013-12-09", "child1"), new ArrayList<Node<?>>(), ModifyAction.REPLACE), null);
+    Assert.assertTrue(xml.isEmpty());
+  }
+
+
+}
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/test/resources/org/opendaylight/controller/remote/rpc/utils/rpcTest.yang b/opendaylight/md-sal/sal-remoterpc-connector/src/test/resources/org/opendaylight/controller/remote/rpc/utils/rpcTest.yang
new file mode 100644 (file)
index 0000000..5fc564f
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * 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
+ */
+module rpc-test {
+    yang-version 1;
+    namespace "urn:opendaylight:controller:rpc:test";
+    prefix "rpct";
+
+    revision 2014-07-29 {
+       description "rpc test";
+    }
+
+    typedef flow-ref {
+        type instance-identifier;
+    }
+
+    rpc add-flow {
+        input {
+            leaf id {
+                type string;
+            }
+
+            leaf flow {
+                type flow-ref;
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-rest-connector-config/pom.xml b/opendaylight/md-sal/sal-rest-connector-config/pom.xml
new file mode 100644 (file)
index 0000000..6d050cf
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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
+-->
+<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>sal-parent</artifactId>
+    <version>1.1-SNAPSHOT</version>
+  </parent>
+  <artifactId>sal-rest-connector-config</artifactId>
+  <description>Configuration files for sal-rest-connector</description>
+  <packaging>jar</packaging>
+</project>
diff --git a/opendaylight/md-sal/sal-rest-connector-config/src/main/resources/initial/10-rest-connector.xml b/opendaylight/md-sal/sal-rest-connector-config/src/main/resources/initial/10-rest-connector.xml
new file mode 100644 (file)
index 0000000..2fdc8c7
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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
+-->
+<snapshot>
+  <configuration>
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+      <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+        <!-- default OF-switch-connection-provider (port 6633) -->
+        <module>
+          <type xmlns:rest="urn:opendaylight:params:xml:ns:yang:controller:md:sal:rest:connector">rest:rest-connector-impl</type>
+          <name>rest-connector-default-impl</name>
+          <websocket-port>8181</websocket-port>
+          <dom-broker>
+            <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-broker-osgi-registry</type>
+            <name>dom-broker</name>
+          </dom-broker>
+        </module>
+      </modules>
+
+      <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+        <service>
+          <type xmlns:rest="urn:opendaylight:params:xml:ns:yang:controller:md:sal:rest:connector">rest:rest-connector</type>
+          <instance>
+            <name>rest-connector-default</name>
+            <provider>
+              /modules/module[type='rest-connector-impl'][name='rest-connector-default-impl']
+            </provider>
+          </instance>
+        </service>
+      </services>
+    </data>
+  </configuration>
+</snapshot>
index b760263967864947268a3cc34df07e0a309e581b..09fb5b3677538442f154f4ca4a16cbdc4cf05647 100644 (file)
       <groupId>${project.groupId}</groupId>
       <artifactId>sal-core-api</artifactId>
     </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>sal-binding-config</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>config-api</artifactId>
+    </dependency>
     <dependency>
       <groupId>com.google.code.gson</groupId>
       <artifactId>gson</artifactId>
       <groupId>org.opendaylight.yangtools.model</groupId>
       <artifactId>ietf-yang-types-20130715</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools.model</groupId>
+      <artifactId>ietf-inet-types</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
       <artifactId>mockito-all</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-core-spi</artifactId>
+    </dependency>
   </dependencies>
 
   <build>
             <Bundle-Name>MD SAL Restconf Connector</Bundle-Name>
             <Private-Package>org.opendaylight.controller.sal.rest.*,
               org.opendaylight.controller.sal.restconf.rpc.*,
-              org.opendaylight.controller.sal.restconf.impl,</Private-Package>
+              org.opendaylight.controller.sal.restconf.impl,
+              org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.rest.connector.rev140724.*,
+            </Private-Package>
             <Import-Package>*,
             com.sun.jersey.spi.container.servlet</Import-Package>
-            <Bundle-Activator>org.opendaylight.controller.sal.rest.impl.RestconfProvider</Bundle-Activator>
             <Web-ContextPath>/restconf</Web-ContextPath>
           </instructions>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.opendaylight.yangtools</groupId>
+        <artifactId>yang-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>config</id>
+            <goals>
+              <goal>generate-sources</goal>
+            </goals>
+            <configuration>
+              <codeGenerators>
+                <generator>
+                  <codeGeneratorClass>org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator</codeGeneratorClass>
+                  <outputBaseDir>${jmxGeneratorPath}</outputBaseDir>
+                  <additionalConfiguration>
+                    <namespaceToPackage1>urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang</namespaceToPackage1>
+                  </additionalConfiguration>
+                </generator>
+                <generator>
+                  <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>
+                  <outputBaseDir>${salGeneratorPath}</outputBaseDir>
+                </generator>
+              </codeGenerators>
+              <inspectDependencies>true</inspectDependencies>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
   <scm>
diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/rest/connector/RestConnectorModule.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/rest/connector/RestConnectorModule.java
new file mode 100644 (file)
index 0000000..582c657
--- /dev/null
@@ -0,0 +1,30 @@
+package org.opendaylight.controller.config.yang.md.sal.rest.connector;
+
+import org.opendaylight.controller.sal.rest.impl.RestconfProviderImpl;
+
+public class RestConnectorModule extends org.opendaylight.controller.config.yang.md.sal.rest.connector.AbstractRestConnectorModule {
+
+    public RestConnectorModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public RestConnectorModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.md.sal.rest.connector.RestConnectorModule oldModule, java.lang.AutoCloseable oldInstance) {
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    public void customValidation() {
+        // add custom validation form module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        // Create an instance of our provider
+        RestconfProviderImpl instance = new RestconfProviderImpl();
+        // Set its port
+        instance.setWebsocketPort(getWebsocketPort());
+        // Register it with the Broker
+        getDomBrokerDependency().registerProvider(instance);
+        return instance;
+    }
+}
diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/rest/connector/RestConnectorModuleFactory.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/rest/connector/RestConnectorModuleFactory.java
new file mode 100644 (file)
index 0000000..957b08f
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: opendaylight-rest-connector yang module local name: rest-connector-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Fri Jul 25 04:33:31 CDT 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.md.sal.rest.connector;
+
+
+public class RestConnectorModuleFactory extends org.opendaylight.controller.config.yang.md.sal.rest.connector.AbstractRestConnectorModuleFactory {
+
+}
diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestConnector.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestConnector.java
new file mode 100644 (file)
index 0000000..fe45a02
--- /dev/null
@@ -0,0 +1,9 @@
+package org.opendaylight.controller.sal.rest.api;
+
+/*
+ * This is a simple dummy interface to allow us to create instances of RestconfProvider
+ * via the config subsystem.
+ */
+public interface RestConnector {
+
+}
index 4b4cef9f70873b2c34858de93e529d91d0ea7a5e..34aa829b6f5a50e7511583485d33693155d123d8 100644 (file)
@@ -13,6 +13,7 @@ import com.google.common.base.Preconditions;
 import com.google.gson.stream.JsonWriter;
 import java.io.IOException;
 import java.net.URI;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
@@ -26,7 +27,7 @@ import org.opendaylight.controller.sal.restconf.impl.IdentityValuesDTO.Predicate
 import org.opendaylight.controller.sal.restconf.impl.RestCodec;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.Node;
 import org.opendaylight.yangtools.yang.data.api.SimpleNode;
 import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
@@ -83,7 +84,7 @@ class JsonMapper {
 
         final Set<QName> foundLists = new HashSet<>();
 
-        Set<DataSchemaNode> parentSchemaChildNodes = parentSchema == null ? Collections.<DataSchemaNode> emptySet()
+        Collection<DataSchemaNode> parentSchemaChildNodes = parentSchema == null ? Collections.<DataSchemaNode> emptySet()
                 : parentSchema.getChildNodes();
 
         for (Node<?> child : parent.getValue()) {
@@ -170,7 +171,7 @@ class JsonMapper {
         }
     }
 
-    private static DataSchemaNode findFirstSchemaForNode(final Node<?> node, final Set<DataSchemaNode> dataSchemaNode) {
+    private static DataSchemaNode findFirstSchemaForNode(final Node<?> node, final Iterable<DataSchemaNode> dataSchemaNode) {
         for (DataSchemaNode dsn : dataSchemaNode) {
             if (node.getNodeType().equals(dsn.getQName())) {
                 return dsn;
@@ -262,12 +263,12 @@ class JsonMapper {
                 writeStringRepresentation(writer, node, baseType, QName.class);
             }
         } else if (baseType instanceof InstanceIdentifierTypeDefinition) {
-            if (node.getValue() instanceof InstanceIdentifier) {
+            if (node.getValue() instanceof YangInstanceIdentifier) {
                 IdentityValuesDTO valueDTO = (IdentityValuesDTO) RestCodec.from(baseType, mountPoint).serialize(
                         node.getValue());
                 writeIdentityValuesDTOToJson(writer, valueDTO);
             } else {
-                writeStringRepresentation(writer, node, baseType, InstanceIdentifier.class);
+                writeStringRepresentation(writer, node, baseType, YangInstanceIdentifier.class);
             }
         } else if (baseType instanceof DecimalTypeDefinition || baseType instanceof IntegerTypeDefinition
                 || baseType instanceof UnsignedIntegerTypeDefinition) {
diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfProvider.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfProvider.java
deleted file mode 100644 (file)
index 1f1d0eb..0000000
+++ /dev/null
@@ -1,101 +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.rest.impl;
-
-import java.util.Collection;
-import java.util.Collections;
-import org.opendaylight.controller.sal.core.api.Broker;
-import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
-import org.opendaylight.controller.sal.core.api.Provider;
-import org.opendaylight.controller.sal.core.api.data.DataBrokerService;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
-import org.opendaylight.controller.sal.core.api.mount.MountService;
-import org.opendaylight.controller.sal.restconf.impl.BrokerFacade;
-import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
-import org.opendaylight.controller.sal.streams.websockets.WebSocketServer;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-
-public class RestconfProvider implements BundleActivator, Provider, ServiceTrackerCustomizer<Broker, Broker> {
-
-    public final static String NOT_INITALIZED_MSG = "Restconf is not initialized yet. Please try again later";
-
-    private ListenerRegistration<SchemaServiceListener> listenerRegistration;
-    private ServiceTracker<Broker, Broker> brokerServiceTrancker;
-    private BundleContext bundleContext;
-    private Thread webSocketServerThread;
-
-    @Override
-    public void onSessionInitiated(ProviderSession session) {
-        DataBrokerService dataService = session.getService(DataBrokerService.class);
-
-        BrokerFacade.getInstance().setContext(session);
-        BrokerFacade.getInstance().setDataService(dataService);
-
-        SchemaService schemaService = session.getService(SchemaService.class);
-        listenerRegistration = schemaService.registerSchemaServiceListener(ControllerContext.getInstance());
-        ControllerContext.getInstance().setSchemas(schemaService.getGlobalContext());
-        ControllerContext.getInstance().setMountService(session.getService(MountService.class));
-    }
-
-    @Override
-    public void start(BundleContext context) throws Exception {
-        String websocketPortStr = context.getProperty(WebSocketServer.WEBSOCKET_SERVER_CONFIG_PROPERTY);
-        int websocketPort = (websocketPortStr != null && !"".equals(websocketPortStr)) ? Integer
-                .parseInt(websocketPortStr) : WebSocketServer.DEFAULT_PORT;
-        bundleContext = context;
-        webSocketServerThread = new Thread(WebSocketServer.createInstance(websocketPort));
-        webSocketServerThread.setName("Web socket server");
-        webSocketServerThread.start();
-        brokerServiceTrancker = new ServiceTracker<>(context, Broker.class, this);
-        brokerServiceTrancker.open();
-    }
-
-    @Override
-    public void stop(BundleContext context) {
-        if (listenerRegistration != null) {
-            try {
-                listenerRegistration.close();
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-        webSocketServerThread.interrupt();
-        brokerServiceTrancker.close();
-    }
-
-    @Override
-    public Collection<ProviderFunctionality> getProviderFunctionality() {
-        return Collections.emptySet();
-    }
-
-    @Override
-    public Broker addingService(ServiceReference<Broker> reference) {
-        Broker broker = bundleContext.getService(reference);
-        broker.registerProvider(this, bundleContext);
-        return broker;
-    }
-
-    @Override
-    public void modifiedService(ServiceReference<Broker> reference, Broker service) {
-        // NOOP
-    }
-
-    @Override
-    public void removedService(ServiceReference<Broker> reference, Broker service) {
-        bundleContext.ungetService(reference);
-        BrokerFacade.getInstance().setContext(null);
-        BrokerFacade.getInstance().setDataService(null);
-        ControllerContext.getInstance().setSchemas(null);
-    }
-}
diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfProviderImpl.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfProviderImpl.java
new file mode 100644 (file)
index 0000000..559be5a
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * 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.rest.impl;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
+import org.opendaylight.controller.sal.core.api.Provider;
+import org.opendaylight.controller.sal.core.api.data.DataBrokerService;
+import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.controller.sal.core.api.mount.MountService;
+import org.opendaylight.controller.sal.rest.api.RestConnector;
+import org.opendaylight.controller.sal.restconf.impl.BrokerFacade;
+import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
+import org.opendaylight.controller.sal.streams.websockets.WebSocketServer;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
+
+public class RestconfProviderImpl implements Provider, AutoCloseable, RestConnector {
+
+    public final static String NOT_INITALIZED_MSG = "Restconf is not initialized yet. Please try again later";
+
+    private ListenerRegistration<SchemaContextListener> listenerRegistration;
+    private PortNumber port;
+    public void setWebsocketPort(PortNumber port) {
+        this.port = port;
+    }
+
+    private Thread webSocketServerThread;
+
+    @Override
+    public void onSessionInitiated(ProviderSession session) {
+        DataBrokerService dataService = session.getService(DataBrokerService.class);
+
+        BrokerFacade.getInstance().setContext(session);
+        BrokerFacade.getInstance().setDataService(dataService);
+
+        SchemaService schemaService = session.getService(SchemaService.class);
+        listenerRegistration = schemaService.registerSchemaContextListener(ControllerContext.getInstance());
+        ControllerContext.getInstance().setSchemas(schemaService.getGlobalContext());
+        ControllerContext.getInstance().setMountService(session.getService(MountService.class));
+
+        webSocketServerThread = new Thread(WebSocketServer.createInstance(port.getValue().intValue()));
+        webSocketServerThread.setName("Web socket server on port " + port);
+        webSocketServerThread.start();
+    }
+
+    @Override
+    public Collection<ProviderFunctionality> getProviderFunctionality() {
+        return Collections.emptySet();
+    }
+
+    @Override
+    public void close() {
+        if (listenerRegistration != null) {
+            listenerRegistration.close();
+        }
+        webSocketServerThread.interrupt();
+    }
+}
index ead1740ffd8befb557d85688b4a443f7edfd1134..861aaac3d81552957b5798c3b775501d830fadce 100644 (file)
@@ -28,11 +28,11 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNode> {
+public class BrokerFacade implements DataReader<YangInstanceIdentifier, CompositeNode> {
     private final static Logger LOG = LoggerFactory.getLogger(BrokerFacade.class);
 
     private final static BrokerFacade INSTANCE = new BrokerFacade();
@@ -62,7 +62,7 @@ public class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNod
     }
 
     @Override
-    public CompositeNode readConfigurationData(final InstanceIdentifier path) {
+    public CompositeNode readConfigurationData(final YangInstanceIdentifier path) {
         this.checkPreconditions();
 
         LOG.trace("Read Configuration via Restconf: {}", path);
@@ -71,7 +71,7 @@ public class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNod
     }
 
     public CompositeNode readConfigurationDataBehindMountPoint(final MountInstance mountPoint,
-            final InstanceIdentifier path) {
+            final YangInstanceIdentifier path) {
         this.checkPreconditions();
 
         LOG.trace("Read Configuration via Restconf: {}", path);
@@ -80,7 +80,7 @@ public class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNod
     }
 
     @Override
-    public CompositeNode readOperationalData(final InstanceIdentifier path) {
+    public CompositeNode readOperationalData(final YangInstanceIdentifier path) {
         this.checkPreconditions();
 
         BrokerFacade.LOG.trace("Read Operational via Restconf: {}", path);
@@ -89,7 +89,7 @@ public class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNod
     }
 
     public CompositeNode readOperationalDataBehindMountPoint(final MountInstance mountPoint,
-            final InstanceIdentifier path) {
+            final YangInstanceIdentifier path) {
         this.checkPreconditions();
 
         BrokerFacade.LOG.trace("Read Operational via Restconf: {}", path);
@@ -103,7 +103,7 @@ public class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNod
         return context.rpc(type, payload);
     }
 
-    public Future<RpcResult<TransactionStatus>> commitConfigurationDataPut(final InstanceIdentifier path,
+    public Future<RpcResult<TransactionStatus>> commitConfigurationDataPut(final YangInstanceIdentifier path,
             final CompositeNode payload) {
         this.checkPreconditions();
 
@@ -114,7 +114,7 @@ public class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNod
     }
 
     public Future<RpcResult<TransactionStatus>> commitConfigurationDataPutBehindMountPoint(
-            final MountInstance mountPoint, final InstanceIdentifier path, final CompositeNode payload) {
+            final MountInstance mountPoint, final YangInstanceIdentifier path, final CompositeNode payload) {
         this.checkPreconditions();
 
         final DataModificationTransaction transaction = mountPoint.beginTransaction();
@@ -123,7 +123,7 @@ public class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNod
         return transaction.commit();
     }
 
-    public Future<RpcResult<TransactionStatus>> commitConfigurationDataPost(final InstanceIdentifier path,
+    public Future<RpcResult<TransactionStatus>> commitConfigurationDataPost(final YangInstanceIdentifier path,
             final CompositeNode payload) {
         this.checkPreconditions();
 
@@ -143,7 +143,7 @@ public class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNod
     }
 
     public Future<RpcResult<TransactionStatus>> commitConfigurationDataPostBehindMountPoint(
-            final MountInstance mountPoint, final InstanceIdentifier path, final CompositeNode payload) {
+            final MountInstance mountPoint, final YangInstanceIdentifier path, final CompositeNode payload) {
         this.checkPreconditions();
 
         final DataModificationTransaction transaction = mountPoint.beginTransaction();
@@ -161,18 +161,18 @@ public class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNod
         return transaction.commit();
     }
 
-    public Future<RpcResult<TransactionStatus>> commitConfigurationDataDelete(final InstanceIdentifier path) {
+    public Future<RpcResult<TransactionStatus>> commitConfigurationDataDelete(final YangInstanceIdentifier path) {
         this.checkPreconditions();
         return deleteDataAtTarget(path, dataService.beginTransaction());
     }
 
     public Future<RpcResult<TransactionStatus>> commitConfigurationDataDeleteBehindMountPoint(
-            final MountInstance mountPoint, final InstanceIdentifier path) {
+            final MountInstance mountPoint, final YangInstanceIdentifier path) {
         this.checkPreconditions();
         return deleteDataAtTarget(path, mountPoint.beginTransaction());
     }
 
-    private Future<RpcResult<TransactionStatus>> deleteDataAtTarget(final InstanceIdentifier path,
+    private Future<RpcResult<TransactionStatus>> deleteDataAtTarget(final YangInstanceIdentifier path,
             final DataModificationTransaction transaction) {
         LOG.info("Delete Configuration via Restconf: {}", path);
         CompositeNode redDataAtPath = transaction.readConfigurationData(path);
@@ -191,7 +191,7 @@ public class BrokerFacade implements DataReader<InstanceIdentifier, CompositeNod
             return;
         }
 
-        InstanceIdentifier path = listener.getPath();
+        YangInstanceIdentifier path = listener.getPath();
         final ListenerRegistration<DataChangeListener> registration = dataService.registerDataChangeListener(path,
                 listener);
 
index 29672f39d47c4222b297972be5b1dbeef3f1d6fe..f8bcbe3c616ab7910f1d2346543f898c8548cdac 100644 (file)
@@ -9,29 +9,31 @@ package org.opendaylight.controller.sal.restconf.impl;
 
 import com.google.common.base.Function;
 import com.google.common.base.Objects;
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Predicate;
 import com.google.common.base.Splitter;
 import com.google.common.base.Strings;
 import com.google.common.collect.BiMap;
-import com.google.common.collect.FluentIterable;
 import com.google.common.collect.HashBiMap;
+import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Iterables;
+
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URLDecoder;
 import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
-import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicReference;
+
 import javax.ws.rs.core.Response.Status;
+
 import org.opendaylight.controller.sal.core.api.mount.MountInstance;
 import org.opendaylight.controller.sal.core.api.mount.MountService;
 import org.opendaylight.controller.sal.rest.api.Draft02;
@@ -40,11 +42,11 @@ import org.opendaylight.controller.sal.restconf.impl.RestconfError.ErrorTag;
 import org.opendaylight.controller.sal.restconf.impl.RestconfError.ErrorType;
 import org.opendaylight.yangtools.concepts.Codec;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.InstanceIdentifierBuilder;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+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.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
 import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
@@ -81,13 +83,12 @@ public class ControllerContext implements SchemaContextListener {
 
     private static final Splitter SLASH_SPLITTER = Splitter.on('/');
 
-    private static final Splitter COLON_SPLITTER = Splitter.on(':');
-
     private final BiMap<URI, String> uriToModuleName = HashBiMap.<URI, String> create();
 
     private final Map<String, URI> moduleNameToUri = uriToModuleName.inverse();
 
-    private final Map<QName, RpcDefinition> qnameToRpc = new ConcurrentHashMap<>();
+    private final AtomicReference<Map<QName, RpcDefinition>> qnameToRpc =
+            new AtomicReference<>(Collections.<QName, RpcDefinition>emptyMap());
 
     private volatile SchemaContext globalSchema;
     private volatile MountService mountService;
@@ -141,7 +142,7 @@ public class ControllerContext implements SchemaContextListener {
                     ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE);
         }
 
-        InstanceIdentifierBuilder builder = InstanceIdentifier.builder();
+        InstanceIdentifierBuilder builder = YangInstanceIdentifier.builder();
         Module latestModule = this.getLatestModule(globalSchema, startModule);
         InstanceIdWithSchemaNode iiWithSchemaNode = this.collectPathArguments(builder, pathArgs, latestModule, null,
                 toMountPointIdentifier);
@@ -246,7 +247,7 @@ public class ControllerContext implements SchemaContextListener {
                 module.getRevision());
     }
 
-    public DataNodeContainer getDataNodeContainerFor(final InstanceIdentifier path) {
+    public DataNodeContainer getDataNodeContainerFor(final YangInstanceIdentifier path) {
         this.checkPreconditions();
 
         final Iterable<PathArgument> elements = path.getPathArguments();
@@ -258,7 +259,7 @@ public class ControllerContext implements SchemaContextListener {
         for (final PathArgument element : elements) {
             QName _nodeType = element.getNodeType();
             final DataSchemaNode potentialNode = ControllerContext.childByQName(node, _nodeType);
-            if (potentialNode == null || !this.isListOrContainer(potentialNode)) {
+            if (potentialNode == null || !ControllerContext.isListOrContainer(potentialNode)) {
                 return null;
             }
             node = (DataNodeContainer) potentialNode;
@@ -267,7 +268,7 @@ public class ControllerContext implements SchemaContextListener {
         return node;
     }
 
-    public String toFullRestconfIdentifier(final InstanceIdentifier path) {
+    public String toFullRestconfIdentifier(final YangInstanceIdentifier path) {
         this.checkPreconditions();
 
         final Iterable<PathArgument> elements = path.getPathArguments();
@@ -280,7 +281,7 @@ public class ControllerContext implements SchemaContextListener {
         for (final PathArgument element : elements) {
             QName _nodeType = element.getNodeType();
             final DataSchemaNode potentialNode = ControllerContext.childByQName(node, _nodeType);
-            if (!this.isListOrContainer(potentialNode)) {
+            if (!ControllerContext.isListOrContainer(potentialNode)) {
                 return null;
             }
             node = ((DataNodeContainer) potentialNode);
@@ -507,9 +508,9 @@ public class ControllerContext implements SchemaContextListener {
         DataSchemaNode ret = container.getDataChildByName(name);
         if (ret == null) {
             for (final DataSchemaNode node : container.getChildNodes()) {
-                if ((node instanceof ChoiceCaseNode)) {
-                    final ChoiceCaseNode caseNode = ((ChoiceCaseNode) node);
-                    DataSchemaNode childByQName = ControllerContext.childByQName(caseNode, name);
+                if ((node instanceof ChoiceNode)) {
+                    final ChoiceNode choiceNode = ((ChoiceNode) node);
+                    DataSchemaNode childByQName = ControllerContext.childByQName(choiceNode, name);
                     if (childByQName != null) {
                         return childByQName;
                     }
@@ -555,7 +556,7 @@ public class ControllerContext implements SchemaContextListener {
                             ErrorType.APPLICATION, ErrorTag.OPERATION_NOT_SUPPORTED);
                 }
 
-                final InstanceIdentifier partialPath = builder.toInstance();
+                final YangInstanceIdentifier partialPath = builder.toInstance();
                 final MountInstance mount = mountService.getMountPoint(partialPath);
                 if (mount == null) {
                     LOG.debug("Instance identifier to missing mount point: {}", partialPath);
@@ -570,12 +571,12 @@ public class ControllerContext implements SchemaContextListener {
                 }
 
                 if (returnJustMountPoint) {
-                    InstanceIdentifier instance = InstanceIdentifier.builder().toInstance();
+                    YangInstanceIdentifier instance = YangInstanceIdentifier.builder().toInstance();
                     return new InstanceIdWithSchemaNode(instance, mountPointSchema, mount);
                 }
 
                 if (strings.size() == 1) {
-                    InstanceIdentifier instance = InstanceIdentifier.builder().toInstance();
+                    YangInstanceIdentifier instance = YangInstanceIdentifier.builder().toInstance();
                     return new InstanceIdWithSchemaNode(instance, mountPointSchema, mount);
                 }
 
@@ -594,7 +595,7 @@ public class ControllerContext implements SchemaContextListener {
                 }
 
                 List<String> subList = strings.subList(1, strings.size());
-                return this.collectPathArguments(InstanceIdentifier.builder(), subList, moduleBehindMountPoint, mount,
+                return this.collectPathArguments(YangInstanceIdentifier.builder(), subList, moduleBehindMountPoint, mount,
                         returnJustMountPoint);
             }
 
@@ -646,7 +647,7 @@ public class ControllerContext implements SchemaContextListener {
             targetNode = potentialSchemaNodes.iterator().next();
         }
 
-        if (!this.isListOrContainer(targetNode)) {
+        if (!ControllerContext.isListOrContainer(targetNode)) {
             throw new RestconfDocumentedException("URI has bad format. Node \"" + head
                     + "\" must be Container or List yang type.", ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE);
         }
@@ -721,8 +722,6 @@ public class ControllerContext implements SchemaContextListener {
     private void collectInstanceDataNodeContainers(final List<DataSchemaNode> potentialSchemaNodes,
             final DataNodeContainer container, final String name) {
 
-        Set<DataSchemaNode> childNodes = container.getChildNodes();
-
         Predicate<DataSchemaNode> filter = new Predicate<DataSchemaNode>() {
             @Override
             public boolean apply(final DataSchemaNode node) {
@@ -730,7 +729,7 @@ public class ControllerContext implements SchemaContextListener {
             }
         };
 
-        Iterable<DataSchemaNode> nodes = Iterables.filter(childNodes, filter);
+        Iterable<DataSchemaNode> nodes = Iterables.filter(container.getChildNodes(), filter);
 
         // Can't combine this loop with the filter above because the filter is
         // lazily-applied by Iterables.filter.
@@ -792,79 +791,62 @@ public class ControllerContext implements SchemaContextListener {
     }
 
     private static String toModuleName(final String str) {
-        Preconditions.<String> checkNotNull(str);
-        if (str.indexOf(':') != -1) {
-            final Iterable<String> args = COLON_SPLITTER.split(str);
-            if (Iterables.size(args) == 2) {
-                return args.iterator().next();
-            }
+        final int idx = str.indexOf(':');
+        if (idx == -1) {
+            return null;
         }
-        return null;
+
+        // Make sure there is only one occurrence
+        if (str.indexOf(':', idx + 1) != -1) {
+            return null;
+        }
+
+        return str.substring(0, idx);
     }
 
     private static String toNodeName(final String str) {
-        if (str.indexOf(':') != -1) {
-            final Iterable<String> args = COLON_SPLITTER.split(str);
-            if (Iterables.size(args) == 2) {
-                return Iterables.get(args, 1);
-            }
+        final int idx = str.indexOf(':');
+        if (idx == -1) {
+            return str;
         }
-        return str;
+
+        // Make sure there is only one occurrence
+        if (str.indexOf(':', idx + 1) != -1) {
+            return str;
+        }
+
+        return str.substring(idx + 1);
     }
 
     private QName toQName(final String name) {
         final String module = toModuleName(name);
         final String node = toNodeName(name);
-        Set<Module> modules = globalSchema.getModules();
-
-        final Comparator<Module> comparator = new Comparator<Module>() {
-            @Override
-            public int compare(final Module o1, final Module o2) {
-                return o1.getRevision().compareTo(o2.getRevision());
-            }
-        };
-
-        List<Module> sorted = new ArrayList<Module>(modules);
-        Collections.<Module> sort(new ArrayList<Module>(modules), comparator);
-
-        final Function<Module, QName> transform = new Function<Module, QName>() {
-            @Override
-            public QName apply(final Module m) {
-                return QName.create(m.getNamespace(), m.getRevision(), m.getName());
-            }
-        };
-
-        final Predicate<QName> findFirst = new Predicate<QName>() {
-            @Override
-            public boolean apply(final QName qn) {
-                return Objects.equal(module, qn.getLocalName());
-            }
-        };
-
-        Optional<QName> namespace = FluentIterable.from(sorted).transform(transform).firstMatch(findFirst);
-        return namespace.isPresent() ? QName.create(namespace.get(), node) : null;
+        final Module m = globalSchema.findModuleByName(module, null);
+        return m == null ? null : QName.create(m.getQNameModule(), node);
     }
 
-    private boolean isListOrContainer(final DataSchemaNode node) {
+    private static boolean isListOrContainer(final DataSchemaNode node) {
         return node instanceof ListSchemaNode || node instanceof ContainerSchemaNode;
     }
 
     public RpcDefinition getRpcDefinition(final String name) {
         final QName validName = this.toQName(name);
-        return validName == null ? null : this.qnameToRpc.get(validName);
+        return validName == null ? null : this.qnameToRpc.get().get(validName);
     }
 
     @Override
     public void onGlobalContextUpdated(final SchemaContext context) {
         if (context != null) {
-            this.qnameToRpc.clear();
-            this.setGlobalSchema(context);
-            Set<RpcDefinition> _operations = context.getOperations();
-            for (final RpcDefinition operation : _operations) {
-                {
-                    this.qnameToRpc.put(operation.getQName(), operation);
-                }
+            final Collection<RpcDefinition> defs = context.getOperations();
+            final Map<QName, RpcDefinition> newMap = new HashMap<>(defs.size());
+
+            for (final RpcDefinition operation : defs) {
+                newMap.put(operation.getQName(), operation);
             }
+
+            // FIXME: still not completely atomic
+            this.qnameToRpc.set(ImmutableMap.copyOf(newMap));
+            this.setGlobalSchema(context);
         }
     }
 
index 08e0ce1f24dcc5a8a68e0bd3513fb4bad093b030..12c1ba66ecc3df3ad2d5c838a1ee916d85a21f5c 100644 (file)
@@ -8,23 +8,23 @@
 package org.opendaylight.controller.sal.restconf.impl;
 
 import org.opendaylight.controller.sal.core.api.mount.MountInstance;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 
 public class InstanceIdWithSchemaNode {
 
-    private final InstanceIdentifier instanceIdentifier;
+    private final YangInstanceIdentifier instanceIdentifier;
     private final DataSchemaNode schemaNode;
     private final MountInstance mountPoint;
 
-    public InstanceIdWithSchemaNode(InstanceIdentifier instanceIdentifier, DataSchemaNode schemaNode,
+    public InstanceIdWithSchemaNode(YangInstanceIdentifier instanceIdentifier, DataSchemaNode schemaNode,
             MountInstance mountPoint) {
         this.instanceIdentifier = instanceIdentifier;
         this.schemaNode = schemaNode;
         this.mountPoint = mountPoint;
     }
 
-    public InstanceIdentifier getInstanceIdentifier() {
+    public YangInstanceIdentifier getInstanceIdentifier() {
         return instanceIdentifier;
     }
 
index 611fb490907584d4e47bee30686b7244af049140..ff90dd8439582969d8db755c2ae08f4e91129cc5 100644 (file)
@@ -18,11 +18,11 @@ import org.opendaylight.controller.sal.restconf.impl.IdentityValuesDTO.IdentityV
 import org.opendaylight.controller.sal.restconf.impl.IdentityValuesDTO.Predicate;
 import org.opendaylight.yangtools.concepts.Codec;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+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.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.codec.IdentityrefCodec;
 import org.opendaylight.yangtools.yang.data.api.codec.InstanceIdentifierCodec;
 import org.opendaylight.yangtools.yang.data.api.codec.LeafrefCodec;
@@ -207,7 +207,7 @@ public class RestCodec {
         }
 
         @Override
-        public IdentityValuesDTO serialize(final InstanceIdentifier data) {
+        public IdentityValuesDTO serialize(final YangInstanceIdentifier data) {
             IdentityValuesDTO identityValuesDTO = new IdentityValuesDTO();
             for (PathArgument pathArgument : data.getPathArguments()) {
                 IdentityValue identityValue = qNameToIdentityValue(pathArgument.getNodeType());
@@ -227,7 +227,7 @@ public class RestCodec {
         }
 
         @Override
-        public InstanceIdentifier deserialize(final IdentityValuesDTO data) {
+        public YangInstanceIdentifier deserialize(final IdentityValuesDTO data) {
             List<PathArgument> result = new ArrayList<PathArgument>();
             IdentityValue valueWithNamespace = data.getValuesWithNamespaces().get(0);
             Module module = getModuleByNamespace(valueWithNamespace.getNamespace(), mountPoint);
@@ -298,7 +298,7 @@ public class RestCodec {
                 }
             }
 
-            return result.isEmpty() ? null : InstanceIdentifier.create(result);
+            return result.isEmpty() ? null : YangInstanceIdentifier.create(result);
         }
 
         private List<Predicate> keyValuesToPredicateList(final Map<QName, Object> keyValues) {
index bb7547d3302f1d172c1271416c08e0895ac46398..4c005c6ae5e9e109604a1890cd5ee0c5f81d264a 100644 (file)
@@ -50,10 +50,10 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.InstanceIdentifierBuilder;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+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.MutableCompositeNode;
 import org.opendaylight.yangtools.yang.data.api.Node;
 import org.opendaylight.yangtools.yang.data.api.SimpleNode;
@@ -427,12 +427,12 @@ public class RestconfImpl implements RestconfService {
                 rpc.getQName(), "path"));
         final Object pathValue = pathNode == null ? null : pathNode.getValue();
 
-        if (!(pathValue instanceof InstanceIdentifier)) {
+        if (!(pathValue instanceof YangInstanceIdentifier)) {
             throw new RestconfDocumentedException("Instance identifier was not normalized correctly.",
                     ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED);
         }
 
-        final InstanceIdentifier pathIdentifier = ((InstanceIdentifier) pathValue);
+        final YangInstanceIdentifier pathIdentifier = ((YangInstanceIdentifier) pathValue);
         String streamName = null;
         if (!Iterables.isEmpty(pathIdentifier.getPathArguments())) {
             String fullRestconfIdentifier = this.controllerContext.toFullRestconfIdentifier(pathIdentifier);
@@ -490,7 +490,13 @@ public class RestconfImpl implements RestconfService {
         }
 
         final String identifierDecoded = controllerContext.urlPathArgDecode(identifierEncoded);
-        RpcDefinition rpc = controllerContext.getRpcDefinition(identifierDecoded);
+
+        RpcDefinition rpc = null;
+        if (mountPoint == null) {
+            rpc = controllerContext.getRpcDefinition(identifierDecoded);
+        } else {
+            rpc = findRpc(mountPoint.getSchemaContext(), identifierDecoded);
+        }
 
         if (rpc == null) {
             throw new RestconfDocumentedException("RPC does not exist.", ErrorType.RPC, ErrorTag.UNKNOWN_ELEMENT);
@@ -504,6 +510,25 @@ public class RestconfImpl implements RestconfService {
 
     }
 
+    private RpcDefinition findRpc(final SchemaContext schemaContext, final String identifierDecoded) {
+        final String[] splittedIdentifier = identifierDecoded.split(":");
+        if (splittedIdentifier.length != 2) {
+            throw new RestconfDocumentedException(identifierDecoded
+                    + " couldn't be splitted to 2 parts (module:rpc name)", ErrorType.APPLICATION,
+                    ErrorTag.INVALID_VALUE);
+        }
+        for (Module module : schemaContext.getModules()) {
+            if (module.getName().equals(splittedIdentifier[0])) {
+                for (RpcDefinition rpcDefinition : module.getRpcs()) {
+                    if (rpcDefinition.getQName().getLocalName().equals(splittedIdentifier[1])) {
+                        return rpcDefinition;
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
     private StructuredData callRpc(final RpcExecutor rpcExecutor, final CompositeNode payload, boolean prettyPrint) {
         if (rpcExecutor == null) {
             throw new RestconfDocumentedException("RPC does not exist.", ErrorType.RPC, ErrorTag.UNKNOWN_ELEMENT);
@@ -918,17 +943,17 @@ public class RestconfImpl implements RestconfService {
 
     private InstanceIdWithSchemaNode addLastIdentifierFromData(final InstanceIdWithSchemaNode identifierWithSchemaNode,
             final CompositeNode data, final DataSchemaNode schemaOfData) {
-        InstanceIdentifier instanceIdentifier = null;
+        YangInstanceIdentifier instanceIdentifier = null;
         if (identifierWithSchemaNode != null) {
             instanceIdentifier = identifierWithSchemaNode.getInstanceIdentifier();
         }
 
-        final InstanceIdentifier iiOriginal = instanceIdentifier;
+        final YangInstanceIdentifier iiOriginal = instanceIdentifier;
         InstanceIdentifierBuilder iiBuilder = null;
         if (iiOriginal == null) {
-            iiBuilder = InstanceIdentifier.builder();
+            iiBuilder = YangInstanceIdentifier.builder();
         } else {
-            iiBuilder = InstanceIdentifier.builder(iiOriginal);
+            iiBuilder = YangInstanceIdentifier.builder(iiOriginal);
         }
 
         if ((schemaOfData instanceof ListSchemaNode)) {
@@ -938,7 +963,7 @@ public class RestconfImpl implements RestconfService {
             iiBuilder.node(schemaOfData.getQName());
         }
 
-        InstanceIdentifier instance = iiBuilder.toInstance();
+        YangInstanceIdentifier instance = iiBuilder.toInstance();
         MountInstance mountPoint = null;
         if (identifierWithSchemaNode != null) {
             mountPoint = identifierWithSchemaNode.getMountPoint();
index 4c5e3ab5301e0dc1fa4f27507030bc479f49a012..148b33bd6545ffe544418ddc6b393258535c5c9a 100644 (file)
@@ -37,6 +37,8 @@ public abstract class AbstractRpcExecutor implements RpcExecutor {
             throw new RestconfDocumentedException(e.getMessage(), ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE);
         } catch (UnsupportedOperationException e) {
             throw new RestconfDocumentedException(e.getMessage(), ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED);
+        } catch (RestconfDocumentedException e) {
+            throw e;
         } catch (Exception e) {
             throw new RestconfDocumentedException("The operation encountered an unexpected error while executing.", e);
         }
index e526ec13be75fad83ff6c33b95dfe9ba0d809298..2b7b0246e35ac2356ce90f87126d5e4f43076a2c 100644 (file)
@@ -45,10 +45,10 @@ import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -69,7 +69,7 @@ public class ListenerAdapter implements DataChangeListener {
     private final XmlMapper xmlMapper = new XmlMapper();
     private final SimpleDateFormat rfc3339 = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ssZ");
 
-    private final InstanceIdentifier path;
+    private final YangInstanceIdentifier path;
     private ListenerRegistration<DataChangeListener> registration;
     private final String streamName;
     private Set<Channel> subscribers = new ConcurrentSet<>();
@@ -84,7 +84,7 @@ public class ListenerAdapter implements DataChangeListener {
      * @param streamName
      *            The name of the stream.
      */
-    ListenerAdapter(final InstanceIdentifier path, final String streamName) {
+    ListenerAdapter(final YangInstanceIdentifier path, final String streamName) {
         Preconditions.checkNotNull(path);
         Preconditions.checkArgument(streamName != null && !streamName.isEmpty());
         this.path = path;
@@ -95,7 +95,7 @@ public class ListenerAdapter implements DataChangeListener {
     }
 
     @Override
-    public void onDataChanged(final DataChangeEvent<InstanceIdentifier, CompositeNode> change) {
+    public void onDataChanged(final DataChangeEvent<YangInstanceIdentifier, CompositeNode> change) {
         if (!change.getCreatedConfigurationData().isEmpty() || !change.getCreatedOperationalData().isEmpty()
                 || !change.getUpdatedConfigurationData().isEmpty() || !change.getUpdatedOperationalData().isEmpty()
                 || !change.getRemovedConfigurationData().isEmpty() || !change.getRemovedOperationalData().isEmpty()) {
@@ -216,7 +216,7 @@ public class ListenerAdapter implements DataChangeListener {
      *            DataChangeEvent
      * @return Data in printable form.
      */
-    private String prepareXmlFrom(final DataChangeEvent<InstanceIdentifier, CompositeNode> change) {
+    private String prepareXmlFrom(final DataChangeEvent<YangInstanceIdentifier, CompositeNode> change) {
         Document doc = createDocument();
         Element notificationElement = doc.createElementNS("urn:ietf:params:xml:ns:netconf:notification:1.0",
                 "notification");
@@ -287,7 +287,7 @@ public class ListenerAdapter implements DataChangeListener {
      */
     private void addValuesToDataChangedNotificationEventElement(final Document doc,
             final Element dataChangedNotificationEventElement,
-            final DataChangeEvent<InstanceIdentifier, CompositeNode> change) {
+            final DataChangeEvent<YangInstanceIdentifier, CompositeNode> change) {
         addValuesFromDataToElement(doc, change.getCreatedConfigurationData(), dataChangedNotificationEventElement,
                 Store.CONFIG, Operation.CREATED);
         addValuesFromDataToElement(doc, change.getCreatedOperationalData(), dataChangedNotificationEventElement,
@@ -312,7 +312,7 @@ public class ListenerAdapter implements DataChangeListener {
      * @param doc
      *            {@link Document}
      * @param data
-     *            Set of {@link InstanceIdentifier}.
+     *            Set of {@link YangInstanceIdentifier}.
      * @param element
      *            {@link Element}
      * @param store
@@ -320,12 +320,12 @@ public class ListenerAdapter implements DataChangeListener {
      * @param operation
      *            {@link Operation}
      */
-    private void addValuesFromDataToElement(final Document doc, final Set<InstanceIdentifier> data,
+    private void addValuesFromDataToElement(final Document doc, final Set<YangInstanceIdentifier> data,
             final Element element, final Store store, final Operation operation) {
         if (data == null || data.isEmpty()) {
             return;
         }
-        for (InstanceIdentifier path : data) {
+        for (YangInstanceIdentifier path : data) {
             Node node = createDataChangeEventElement(doc, path, null, store, operation);
             element.appendChild(node);
         }
@@ -337,7 +337,7 @@ public class ListenerAdapter implements DataChangeListener {
      * @param doc
      *            {@link Document}
      * @param data
-     *            Map of {@link InstanceIdentifier} and {@link CompositeNode}.
+     *            Map of {@link YangInstanceIdentifier} and {@link CompositeNode}.
      * @param element
      *            {@link Element}
      * @param store
@@ -345,12 +345,12 @@ public class ListenerAdapter implements DataChangeListener {
      * @param operation
      *            {@link Operation}
      */
-    private void addValuesFromDataToElement(final Document doc, final Map<InstanceIdentifier, CompositeNode> data,
+    private void addValuesFromDataToElement(final Document doc, final Map<YangInstanceIdentifier, CompositeNode> data,
             final Element element, final Store store, final Operation operation) {
         if (data == null || data.isEmpty()) {
             return;
         }
-        for (Entry<InstanceIdentifier, CompositeNode> entry : data.entrySet()) {
+        for (Entry<YangInstanceIdentifier, CompositeNode> entry : data.entrySet()) {
             Node node = createDataChangeEventElement(doc, entry.getKey(), entry.getValue(), store, operation);
             element.appendChild(node);
         }
@@ -371,7 +371,7 @@ public class ListenerAdapter implements DataChangeListener {
      *            {@link Operation}
      * @return {@link Node} node represented by changed event element.
      */
-    private Node createDataChangeEventElement(final Document doc, final InstanceIdentifier path,
+    private Node createDataChangeEventElement(final Document doc, final YangInstanceIdentifier path,
             final CompositeNode data, final Store store, final Operation operation) {
         Element dataChangeEventElement = doc.createElement("data-change-event");
 
@@ -407,7 +407,7 @@ public class ListenerAdapter implements DataChangeListener {
      *            {@link CompositeNode}
      * @return Data in XML format.
      */
-    private Node translateToXml(final InstanceIdentifier path, final CompositeNode data) {
+    private Node translateToXml(final YangInstanceIdentifier path, final CompositeNode data) {
         DataNodeContainer schemaNode = ControllerContext.getInstance().getDataNodeContainerFor(path);
         if (schemaNode == null) {
             LOG.info(
@@ -432,10 +432,10 @@ public class ListenerAdapter implements DataChangeListener {
      * @param element
      *            {@link Element}
      */
-    private void addPathAsValueToElement(final InstanceIdentifier path, final Element element) {
+    private void addPathAsValueToElement(final YangInstanceIdentifier path, final Element element) {
         // Map< key = namespace, value = prefix>
         Map<String, String> prefixes = new HashMap<>();
-        InstanceIdentifier instanceIdentifier = path;
+        YangInstanceIdentifier instanceIdentifier = path;
         StringBuilder textContent = new StringBuilder();
 
         // FIXME: BUG-1281: this is duplicated code from yangtools (BUG-1275)
@@ -520,7 +520,7 @@ public class ListenerAdapter implements DataChangeListener {
      *
      * @return Path pointed to data in data store.
      */
-    public InstanceIdentifier getPath() {
+    public YangInstanceIdentifier getPath() {
         return path;
     }
 
index 166c473b9c77d118b14c822bc177a1320b77e0fe..99bd8c5aafa88759847eda70c61d8d10c23923da 100644 (file)
@@ -12,7 +12,7 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
  * {@link Notificator} is responsible to create, remove and find {@link ListenerAdapter} listener.
@@ -20,7 +20,7 @@ import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
 public class Notificator {
 
     private static Map<String, ListenerAdapter> listenersByStreamName = new ConcurrentHashMap<>();
-    private static Map<InstanceIdentifier, ListenerAdapter> listenersByInstanceIdentifier = new ConcurrentHashMap<>();
+    private static Map<YangInstanceIdentifier, ListenerAdapter> listenersByInstanceIdentifier = new ConcurrentHashMap<>();
     private static final Lock lock = new ReentrantLock();
 
     private Notificator() {
@@ -45,37 +45,37 @@ public class Notificator {
     }
 
     /**
-     * Gets {@link ListenerAdapter} listener specified by {@link InstanceIdentifier} path.
+     * Gets {@link ListenerAdapter} listener specified by {@link YangInstanceIdentifier} path.
      *
      * @param path
      *            Path to data in data repository.
      * @return ListenerAdapter
      */
-    public static ListenerAdapter getListenerFor(InstanceIdentifier path) {
+    public static ListenerAdapter getListenerFor(YangInstanceIdentifier path) {
         return listenersByInstanceIdentifier.get(path);
     }
 
     /**
-     * Checks if the listener specified by {@link InstanceIdentifier} path exist.
+     * Checks if the listener specified by {@link YangInstanceIdentifier} path exist.
      *
      * @param path
      *            Path to data in data repository.
      * @return True if the listener exist, false otherwise.
      */
-    public static boolean existListenerFor(InstanceIdentifier path) {
+    public static boolean existListenerFor(YangInstanceIdentifier path) {
         return listenersByInstanceIdentifier.containsKey(path);
     }
 
     /**
-     * Creates new {@link ListenerAdapter} listener from {@link InstanceIdentifier} path and stream name.
+     * Creates new {@link ListenerAdapter} listener from {@link YangInstanceIdentifier} path and stream name.
      *
      * @param path
      *            Path to data in data repository.
      * @param streamName
      *            The name of the stream.
-     * @return New {@link ListenerAdapter} listener from {@link InstanceIdentifier} path and stream name.
+     * @return New {@link ListenerAdapter} listener from {@link YangInstanceIdentifier} path and stream name.
      */
-    public static ListenerAdapter createListener(InstanceIdentifier path, String streamName) {
+    public static ListenerAdapter createListener(YangInstanceIdentifier path, String streamName) {
         ListenerAdapter listener = new ListenerAdapter(path, streamName);
         try {
             lock.lock();
@@ -88,12 +88,12 @@ public class Notificator {
     }
 
     /**
-     * Looks for listener determined by {@link InstanceIdentifier} path and removes it.
+     * Looks for listener determined by {@link YangInstanceIdentifier} path and removes it.
      *
      * @param path
      *            InstanceIdentifier
      */
-    public static void removeListener(InstanceIdentifier path) {
+    public static void removeListener(YangInstanceIdentifier path) {
         ListenerAdapter listener = listenersByInstanceIdentifier.get(path);
         deleteListener(listener);
     }
@@ -114,7 +114,7 @@ public class Notificator {
             result = result.substring(1);
         }
         if (result.endsWith("/")) {
-            result = result.substring(0, result.length());
+            result = result.substring(0, result.length()-1);
         }
         return result;
     }
diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/yang/opendaylight-rest-connector.yang b/opendaylight/md-sal/sal-rest-connector/src/main/yang/opendaylight-rest-connector.yang
new file mode 100644 (file)
index 0000000..a8fc8ff
--- /dev/null
@@ -0,0 +1,47 @@
+module opendaylight-rest-connector {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:rest:connector";
+    prefix "md-sal-rest-connector";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import opendaylight-md-sal-dom {prefix dom; revision-date 2013-10-28;}
+    import opendaylight-md-sal-binding {prefix sal; revision-date 2013-10-28;}
+    import ietf-inet-types {prefix inet; revision-date 2010-09-24;}
+    description
+        "Service definition for Rest Connector";
+    revision "2014-07-24" {
+        description
+            "Initial revision";
+    }
+    
+    identity rest-connector {
+        base "config:service-type";
+        config:java-class "org.opendaylight.controller.sal.rest.api.RestConnector";
+    }
+    
+    identity rest-connector-impl {
+        base config:module-type;
+        config:provided-service rest-connector;
+        config:java-name-prefix RestConnector;
+    }
+    
+    augment "/config:modules/config:module/config:configuration" {
+        case rest-connector-impl {
+            when "/config:modules/config:module/config:type = 'rest-connector-impl'";
+            leaf websocket-port {
+                mandatory true;
+                type inet:port-number;
+            }
+            container dom-broker {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity dom:dom-broker-osgi-registry;
+                    }
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
index f4281c037c40ad1cf8e304879e124368e0ed3c8f..4210944de71a6791ef7426533465f8cd9c900c5e 100644 (file)
@@ -34,7 +34,7 @@ import org.opendaylight.controller.sal.restconf.impl.test.DummyRpcResult;
 import org.opendaylight.controller.sal.restconf.impl.test.TestUtils;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
 import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -65,7 +65,7 @@ public class RestPutListDataTest {
         Builder<TransactionStatus> futureBuilder = new DummyFuture.Builder<TransactionStatus>();
         futureBuilder.rpcResult(new DummyRpcResult.Builder<TransactionStatus>().result(TransactionStatus.COMMITED)
                 .build());
-        when(brokerFacade.commitConfigurationDataPut(any(InstanceIdentifier.class), any(CompositeNode.class)))
+        when(brokerFacade.commitConfigurationDataPut(any(YangInstanceIdentifier.class), any(CompositeNode.class)))
                 .thenReturn(futureBuilder.build());
     }
 
index 656427352aea0da2242910ba5a274b1d500e63f2..73f828c6466a886a2f5d7de7029c590389c5e662 100644 (file)
@@ -43,7 +43,7 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
 
 /**
@@ -72,7 +72,7 @@ public class BrokerFacadeTest {
 
     QName qname = QName.create("node");
 
-    InstanceIdentifier instanceID = InstanceIdentifier.builder().node(qname).toInstance();
+    YangInstanceIdentifier instanceID = YangInstanceIdentifier.builder().node(qname).toInstance();
 
     @Before
     public void setUp() throws Exception {
@@ -188,7 +188,7 @@ public class BrokerFacadeTest {
     public void testCommitConfigurationDataPost() {
         Future<RpcResult<TransactionStatus>> expFuture = Futures.immediateFuture(null);
 
-        Map<InstanceIdentifier, CompositeNode> nodeMap = new ImmutableMap.Builder<InstanceIdentifier, CompositeNode>()
+        Map<YangInstanceIdentifier, CompositeNode> nodeMap = new ImmutableMap.Builder<YangInstanceIdentifier, CompositeNode>()
                 .put(instanceID, dataNode).build();
 
         when(dataBroker.beginTransaction()).thenReturn(mockTransaction);
@@ -224,7 +224,7 @@ public class BrokerFacadeTest {
     public void testCommitConfigurationDataPostBehindMountPoint() {
         Future<RpcResult<TransactionStatus>> expFuture = Futures.immediateFuture(null);
 
-        Map<InstanceIdentifier, CompositeNode> nodeMap = new ImmutableMap.Builder<InstanceIdentifier, CompositeNode>()
+        Map<YangInstanceIdentifier, CompositeNode> nodeMap = new ImmutableMap.Builder<YangInstanceIdentifier, CompositeNode>()
                 .put(instanceID, dataNode).build();
 
         when(mockMountInstance.beginTransaction()).thenReturn(mockTransaction);
@@ -262,7 +262,7 @@ public class BrokerFacadeTest {
         Future<RpcResult<TransactionStatus>> expFuture = Futures.immediateFuture(null);
 
         when(dataBroker.beginTransaction()).thenReturn(mockTransaction);
-        when(mockTransaction.readConfigurationData(any(InstanceIdentifier.class))).thenReturn(
+        when(mockTransaction.readConfigurationData(any(YangInstanceIdentifier.class))).thenReturn(
                 ImmutableCompositeNode.builder().toInstance());
         mockTransaction.removeConfigurationData(instanceID);
         when(mockTransaction.commit()).thenReturn(expFuture);
@@ -282,7 +282,7 @@ public class BrokerFacadeTest {
         Future<RpcResult<TransactionStatus>> expFuture = Futures.immediateFuture(null);
 
         when(mockMountInstance.beginTransaction()).thenReturn(mockTransaction);
-        when(mockTransaction.readConfigurationData(any(InstanceIdentifier.class))).thenReturn(
+        when(mockTransaction.readConfigurationData(any(YangInstanceIdentifier.class))).thenReturn(
                 ImmutableCompositeNode.builder().toInstance());
         mockTransaction.removeConfigurationData(instanceID);
         when(mockTransaction.commit()).thenReturn(expFuture);
index 47171bf2470141bc509d2d96423b676a850826da..79e51681ca127955231057740d021a513d2e89ee 100644 (file)
@@ -32,11 +32,11 @@ import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider;
 import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+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.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.SimpleNode;
 import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
 import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
@@ -189,7 +189,7 @@ public class CnSnToXmlAndJsonInstanceIdentifierTest extends YangAndXmlAndDataSch
 
     }
 
-    private CompositeNode prepareCnSn(final InstanceIdentifier instanceIdentifier) throws URISyntaxException {
+    private CompositeNode prepareCnSn(final YangInstanceIdentifier instanceIdentifier) throws URISyntaxException {
         CompositeNodeBuilder<ImmutableCompositeNode> cont = ImmutableCompositeNode.builder();
         cont.setQName(QName.create("instance:identifier:module", "2014-01-17", "cont"));
 
@@ -207,7 +207,7 @@ public class CnSnToXmlAndJsonInstanceIdentifierTest extends YangAndXmlAndDataSch
         return cont.toInstance();
     }
 
-    private InstanceIdentifier createInstanceIdentifier() throws URISyntaxException {
+    private YangInstanceIdentifier createInstanceIdentifier() throws URISyntaxException {
         List<PathArgument> pathArguments = new ArrayList<>();
         pathArguments.add(new NodeIdentifier(new QName(new URI("instance:identifier:module"), "cont")));
         pathArguments.add(new NodeIdentifier(new QName(new URI("instance:identifier:module"), "cont1")));
@@ -221,16 +221,16 @@ public class CnSnToXmlAndJsonInstanceIdentifierTest extends YangAndXmlAndDataSch
 
         pathArguments.add(new NodeIdentifier(new QName(new URI("augment:augment:module"), "lf112")));
 
-        return InstanceIdentifier.create(pathArguments);
+        return YangInstanceIdentifier.create(pathArguments);
     }
 
-    private InstanceIdentifier createInstanceIdentifierWithLeafList() throws URISyntaxException {
+    private YangInstanceIdentifier createInstanceIdentifierWithLeafList() throws URISyntaxException {
         List<PathArgument> pathArguments = new ArrayList<>();
         pathArguments.add(new NodeIdentifier(new QName(new URI("instance:identifier:module"), "cont")));
         pathArguments.add(new NodeIdentifier(new QName(new URI("instance:identifier:module"), "cont1")));
         pathArguments.add(new NodeWithValue(new QName(new URI("augment:module:leaf:list"), "lflst11"), "lflst11_1"));
 
-        return InstanceIdentifier.create(pathArguments);
+        return YangInstanceIdentifier.create(pathArguments);
     }
 
 }
index 313b766ed3312bad6cb5f74a542e84893226aa54..9aab841546016a5cb09f669c168307b2aaf0f725 100644 (file)
@@ -36,7 +36,6 @@ import javax.ws.rs.core.UriInfo;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
-
 import org.opendaylight.controller.sal.core.api.mount.MountInstance;
 import org.opendaylight.controller.sal.restconf.impl.BrokerFacade;
 import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
@@ -94,7 +93,7 @@ public class InvokeRpcMethodTest {
      * string - first argument).
      */
     @Test
-    public void invokeRpcMtethodTest() {
+    public void invokeRpcMethodTest() {
         ControllerContext contContext = controllerContext;
         try {
             contContext.findModuleNameByNamespace(new URI("invoke:rpc:module"));
@@ -298,6 +297,14 @@ public class InvokeRpcMethodTest {
         assertNotNull(output.getSchema());
     }
 
+    /**
+     *
+     * Tests calling of RestConfImpl method invokeRpc. In the method there is searched rpc in remote schema context.
+     * This rpc is then executed.
+     *
+     * I wasn't able to simulate calling of rpc on remote device therefore this testing method raise method when rpc is
+     * invoked.
+     */
     @Test
     public void testMountedRpcCallNoPayload_Success() throws Exception {
         RpcResult<CompositeNode> rpcResult = RpcResultBuilder.<CompositeNode>success().build();
@@ -313,21 +320,32 @@ public class InvokeRpcMethodTest {
         MountInstance mockMountPoint = mock(MountInstance.class);
         when(mockMountPoint.rpc(eq(cancelToastQName), any(CompositeNode.class))).thenReturn(mockListener);
 
+        when(mockMountPoint.getSchemaContext()).thenReturn(TestUtils.loadSchemaContext("/invoke-rpc"));
+
         InstanceIdWithSchemaNode mockedInstanceId = mock(InstanceIdWithSchemaNode.class);
         when(mockedInstanceId.getMountPoint()).thenReturn(mockMountPoint);
 
         ControllerContext mockedContext = mock(ControllerContext.class);
-        String cancelToastStr = "toaster:cancel-toast";
-        when(mockedContext.urlPathArgDecode(cancelToastStr)).thenReturn(cancelToastStr);
-        when(mockedContext.getRpcDefinition(cancelToastStr)).thenReturn(mockRpc);
+        String rpcNoop = "invoke-rpc-module:rpc-noop";
+        when(mockedContext.urlPathArgDecode(rpcNoop)).thenReturn(rpcNoop);
+        when(mockedContext.getRpcDefinition(rpcNoop)).thenReturn(mockRpc);
         when(
-                mockedContext.toMountPointIdentifier("opendaylight-inventory:nodes/node/"
-                        + "REMOTE_HOST/yang-ext:mount/toaster:cancel-toast")).thenReturn(mockedInstanceId);
+                mockedContext.toMountPointIdentifier(eq("opendaylight-inventory:nodes/node/"
+                        + "REMOTE_HOST/yang-ext:mount/invoke-rpc-module:rpc-noop"))).thenReturn(mockedInstanceId);
 
         restconfImpl.setControllerContext(mockedContext);
-        StructuredData output = restconfImpl.invokeRpc(
-                "opendaylight-inventory:nodes/node/REMOTE_HOST/yang-ext:mount/toaster:cancel-toast", "", uriInfo);
-        assertEquals(null, output);
+        try {
+            restconfImpl.invokeRpc(
+                    "opendaylight-inventory:nodes/node/REMOTE_HOST/yang-ext:mount/invoke-rpc-module:rpc-noop", "",
+                    uriInfo);
+            fail("RestconfDocumentedException wasn't raised");
+        } catch (RestconfDocumentedException e) {
+            List<RestconfError> errors = e.getErrors();
+            assertNotNull(errors);
+            assertEquals(1, errors.size());
+            assertEquals(ErrorType.APPLICATION, errors.iterator().next().getErrorType());
+            assertEquals(ErrorTag.OPERATION_FAILED, errors.iterator().next().getErrorTag());
+        }
 
         // additional validation in the fact that the restconfImpl does not
         // throw an exception.
index d1d2a5babf5bcbd554b1f5612979c59b2c032730..66ced818175e2435cda90e41a854214277c6403b 100644 (file)
@@ -31,7 +31,7 @@ import org.opendaylight.controller.sal.restconf.impl.BrokerFacade;
 import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
 import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
 import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
@@ -71,12 +71,12 @@ public class RestDeleteOperationTest extends JerseyTest {
     public void deleteConfigStatusCodes() throws UnsupportedEncodingException {
         String uri = "/config/test-interface:interfaces";
         Future<RpcResult<TransactionStatus>> dummyFuture = createFuture(TransactionStatus.COMMITED);
-        when(brokerFacade.commitConfigurationDataDelete(any(InstanceIdentifier.class))).thenReturn(dummyFuture);
+        when(brokerFacade.commitConfigurationDataDelete(any(YangInstanceIdentifier.class))).thenReturn(dummyFuture);
         Response response = target(uri).request(MediaType.APPLICATION_XML).delete();
         assertEquals(200, response.getStatus());
 
         dummyFuture = createFuture(TransactionStatus.FAILED);
-        when(brokerFacade.commitConfigurationDataDelete(any(InstanceIdentifier.class))).thenReturn(dummyFuture);
+        when(brokerFacade.commitConfigurationDataDelete(any(YangInstanceIdentifier.class))).thenReturn(dummyFuture);
         response = target(uri).request(MediaType.APPLICATION_XML).delete();
         assertEquals(500, response.getStatus());
     }
index ff4678d36fc507dfdf21794c452308fb71dbc3a1..ac660e32bce0f654e8801a56c723f6ec6736c80c 100644 (file)
@@ -62,8 +62,8 @@ import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
 import org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.Node;
 import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
 import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
@@ -164,11 +164,11 @@ public class RestGetOperationTest extends JerseyTest {
     public void getDataWithUrlMountPoint() throws UnsupportedEncodingException, URISyntaxException {
         when(
                 brokerFacade.readConfigurationDataBehindMountPoint(any(MountInstance.class),
-                        any(InstanceIdentifier.class))).thenReturn(prepareCnDataForMountPointTest());
+                        any(YangInstanceIdentifier.class))).thenReturn(prepareCnDataForMountPointTest());
         MountInstance mountInstance = mock(MountInstance.class);
         when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
         MountService mockMountService = mock(MountService.class);
-        when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+        when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
 
         ControllerContext.getInstance().setMountService(mockMountService);
 
@@ -185,7 +185,7 @@ public class RestGetOperationTest extends JerseyTest {
      * Slashes in URI behind mount point. lst1 element with key GigabitEthernet0%2F0%2F0%2F0 (GigabitEthernet0/0/0/0) is
      * requested via GET HTTP operation. It is tested whether %2F character is replaced with simple / in
      * InstanceIdentifier parameter in method
-     * {@link BrokerFacade#readConfigurationDataBehindMountPoint(MountInstance, InstanceIdentifier)} which is called in
+     * {@link BrokerFacade#readConfigurationDataBehindMountPoint(MountInstance, YangInstanceIdentifier)} which is called in
      * method {@link RestconfImpl#readConfigurationData}
      *
      *
@@ -194,14 +194,14 @@ public class RestGetOperationTest extends JerseyTest {
     @Test
     public void getDataWithSlashesBehindMountPoint() throws UnsupportedEncodingException, URISyntaxException,
             ParseException {
-        InstanceIdentifier awaitedInstanceIdentifier = prepareInstanceIdentifierForList();
+        YangInstanceIdentifier awaitedInstanceIdentifier = prepareInstanceIdentifierForList();
         when(
                 brokerFacade.readConfigurationDataBehindMountPoint(any(MountInstance.class),
                         eq(awaitedInstanceIdentifier))).thenReturn(prepareCnDataForMountPointTest());
         MountInstance mountInstance = mock(MountInstance.class);
         when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
         MountService mockMountService = mock(MountService.class);
-        when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+        when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
 
         ControllerContext.getInstance().setMountService(mockMountService);
 
@@ -209,7 +209,7 @@ public class RestGetOperationTest extends JerseyTest {
         assertEquals(200, get(uri, MediaType.APPLICATION_XML));
     }
 
-    private InstanceIdentifier prepareInstanceIdentifierForList() throws URISyntaxException, ParseException {
+    private YangInstanceIdentifier prepareInstanceIdentifierForList() throws URISyntaxException, ParseException {
         List<PathArgument> parameters = new ArrayList<>();
 
         Date revision = new SimpleDateFormat("yyyy-MM-dd").parse("2014-01-09");
@@ -218,21 +218,21 @@ public class RestGetOperationTest extends JerseyTest {
         QName qNameList = QName.create(uri, revision, "lst1");
         QName qNameKeyList = QName.create(uri, revision, "lf11");
 
-        parameters.add(new InstanceIdentifier.NodeIdentifier(qNameCont));
-        parameters.add(new InstanceIdentifier.NodeIdentifierWithPredicates(qNameList, qNameKeyList,
+        parameters.add(new YangInstanceIdentifier.NodeIdentifier(qNameCont));
+        parameters.add(new YangInstanceIdentifier.NodeIdentifierWithPredicates(qNameList, qNameKeyList,
                 "GigabitEthernet0/0/0/0"));
-        return InstanceIdentifier.create(parameters);
+        return YangInstanceIdentifier.create(parameters);
     }
 
     @Test
     public void getDataMountPointIntoHighestElement() throws UnsupportedEncodingException, URISyntaxException {
         when(
                 brokerFacade.readConfigurationDataBehindMountPoint(any(MountInstance.class),
-                        any(InstanceIdentifier.class))).thenReturn(prepareCnDataForMountPointTest());
+                        any(YangInstanceIdentifier.class))).thenReturn(prepareCnDataForMountPointTest());
         MountInstance mountInstance = mock(MountInstance.class);
         when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
         MountService mockMountService = mock(MountService.class);
-        when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+        when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
 
         ControllerContext.getInstance().setMountService(mockMountService);
 
@@ -364,7 +364,7 @@ public class RestGetOperationTest extends JerseyTest {
         MountInstance mountInstance = mock(MountInstance.class);
         when(mountInstance.getSchemaContext()).thenReturn(schemaContextBehindMountPoint);
         MountService mockMountService = mock(MountService.class);
-        when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+        when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
 
         controllerContext.setMountService(mockMountService);
 
@@ -453,7 +453,7 @@ public class RestGetOperationTest extends JerseyTest {
         MountInstance mountInstance = mock(MountInstance.class);
         when(mountInstance.getSchemaContext()).thenReturn(schemaContextBehindMountPoint);
         MountService mockMountService = mock(MountService.class);
-        when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+        when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
 
         controllerContext.setMountService(mockMountService);
 
@@ -487,7 +487,7 @@ public class RestGetOperationTest extends JerseyTest {
         MountInstance mountInstance = mock(MountInstance.class);
         when(mountInstance.getSchemaContext()).thenReturn(schemaContextBehindMountPoint);
         MountService mockMountService = mock(MountService.class);
-        when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+        when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
 
         controllerContext.setMountService(mockMountService);
 
@@ -644,11 +644,11 @@ public class RestGetOperationTest extends JerseyTest {
     }
 
     private void mockReadOperationalDataMethod() {
-        when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(answerFromGet);
+        when(brokerFacade.readOperationalData(any(YangInstanceIdentifier.class))).thenReturn(answerFromGet);
     }
 
     private void mockReadConfigurationDataMethod() {
-        when(brokerFacade.readConfigurationData(any(InstanceIdentifier.class))).thenReturn(answerFromGet);
+        when(brokerFacade.readConfigurationData(any(YangInstanceIdentifier.class))).thenReturn(answerFromGet);
     }
 
     private static CompositeNode prepareCompositeNodeWithIetfInterfacesInterfacesData() {
@@ -726,7 +726,7 @@ public class RestGetOperationTest extends JerseyTest {
                         toSimpleNodeData(toNestedQName("depth3-leaf2"), "depth3-leaf2-value")),
                 toSimpleNodeData(toNestedQName("depth2-leaf1"), "depth2-leaf1-value")));
 
-        when(brokerFacade.readConfigurationData(any(InstanceIdentifier.class))).thenReturn(depth1Cont);
+        when(brokerFacade.readConfigurationData(any(YangInstanceIdentifier.class))).thenReturn(depth1Cont);
 
         // Test config with depth 1
 
@@ -852,7 +852,7 @@ public class RestGetOperationTest extends JerseyTest {
                         toSimpleNodeData(toNestedQName("depth4-leaf1"), "depth4-leaf1-value")),
                 toSimpleNodeData(toNestedQName("depth3-leaf1"), "depth3-leaf1-value")));
 
-        when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(depth2Cont1);
+        when(brokerFacade.readOperationalData(any(YangInstanceIdentifier.class))).thenReturn(depth2Cont1);
 
         response = target("/operational/nested-module:depth1-cont/depth2-cont1").queryParam("depth", "3")
                 .request("application/xml").get();
index af9dd283594ea3943f9265e5a2ecade495a85e7f..979b58b78a184aacc28ceb82f7bd44f7f3315100 100644 (file)
@@ -55,7 +55,7 @@ import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
@@ -174,12 +174,12 @@ public class RestPostOperationTest extends JerseyTest {
                 rpcResult).build();
         when(
                 brokerFacade.commitConfigurationDataPostBehindMountPoint(any(MountInstance.class),
-                        any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
+                        any(YangInstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
 
         MountInstance mountInstance = mock(MountInstance.class);
         when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
         MountService mockMountService = mock(MountService.class);
-        when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+        when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
 
         ControllerContext.getInstance().setMountService(mockMountService);
 
@@ -217,7 +217,7 @@ public class RestPostOperationTest extends JerseyTest {
             dummyFuture = new DummyFuture.Builder<TransactionStatus>().build();
         }
 
-        when(brokerFacade.commitConfigurationDataPost(any(InstanceIdentifier.class), any(CompositeNode.class)))
+        when(brokerFacade.commitConfigurationDataPost(any(YangInstanceIdentifier.class), any(CompositeNode.class)))
                 .thenReturn(dummyFuture);
     }
 
@@ -229,10 +229,10 @@ public class RestPostOperationTest extends JerseyTest {
         Future<RpcResult<TransactionStatus>> dummyFuture = new DummyFuture.Builder<TransactionStatus>().rpcResult(
                 rpcResult).build();
 
-        when(brokerFacade.commitConfigurationDataPost(any(InstanceIdentifier.class), any(CompositeNode.class)))
+        when(brokerFacade.commitConfigurationDataPost(any(YangInstanceIdentifier.class), any(CompositeNode.class)))
                 .thenReturn(dummyFuture);
 
-        ArgumentCaptor<InstanceIdentifier> instanceIdCaptor = ArgumentCaptor.forClass(InstanceIdentifier.class);
+        ArgumentCaptor<YangInstanceIdentifier> instanceIdCaptor = ArgumentCaptor.forClass(YangInstanceIdentifier.class);
         ArgumentCaptor<CompositeNode> compNodeCaptor = ArgumentCaptor.forClass(CompositeNode.class);
 
         String URI_1 = "/config";
@@ -253,7 +253,7 @@ public class RestPostOperationTest extends JerseyTest {
     public void createConfigurationDataNullTest() throws UnsupportedEncodingException {
         initMocking();
 
-        when(brokerFacade.commitConfigurationDataPost(any(InstanceIdentifier.class), any(CompositeNode.class)))
+        when(brokerFacade.commitConfigurationDataPost(any(YangInstanceIdentifier.class), any(CompositeNode.class)))
                 .thenReturn(null);
 
         String URI_1 = "/config";
index 44b5f491d66ff71f1ca2ea53196f5c4db7536f8c..5d837f42bd27dd58233aaed07546f1b2fb5e2f06 100644 (file)
@@ -39,7 +39,7 @@ import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
 import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 public class RestPutOperationTest extends JerseyTest {
@@ -123,12 +123,12 @@ public class RestPutOperationTest extends JerseyTest {
                 rpcResult).build();
         when(
                 brokerFacade.commitConfigurationDataPutBehindMountPoint(any(MountInstance.class),
-                        any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
+                        any(YangInstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
 
         MountInstance mountInstance = mock(MountInstance.class);
         when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
         MountService mockMountService = mock(MountService.class);
-        when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+        when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
 
         ControllerContext.getInstance().setMountService(mockMountService);
 
@@ -147,12 +147,12 @@ public class RestPutOperationTest extends JerseyTest {
                 rpcResult).build();
         when(
                 brokerFacade.commitConfigurationDataPutBehindMountPoint(any(MountInstance.class),
-                        any(InstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
+                        any(YangInstanceIdentifier.class), any(CompositeNode.class))).thenReturn(dummyFuture);
 
         MountInstance mountInstance = mock(MountInstance.class);
         when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
         MountService mockMountService = mock(MountService.class);
-        when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+        when(mockMountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
 
         ControllerContext.getInstance().setMountService(mockMountService);
 
@@ -169,7 +169,7 @@ public class RestPutOperationTest extends JerseyTest {
                 .build();
         Future<RpcResult<TransactionStatus>> dummyFuture = new DummyFuture.Builder<TransactionStatus>().rpcResult(
                 rpcResult).build();
-        when(brokerFacade.commitConfigurationDataPut(any(InstanceIdentifier.class), any(CompositeNode.class)))
+        when(brokerFacade.commitConfigurationDataPut(any(YangInstanceIdentifier.class), any(CompositeNode.class)))
                 .thenReturn(dummyFuture);
     }
 
index 3794815c894fe1c4cb727a97e423d265c8e6587c..236712b45499a70df1b1e69b7c19e3d094dc561b 100644 (file)
@@ -24,7 +24,7 @@ import org.opendaylight.controller.sal.restconf.impl.BrokerFacade;
 import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
 import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
@@ -58,7 +58,7 @@ public class RestconfImplTest {
         CompositeNode loadedCompositeNode = TestUtils.readInputToCnSn("/parts/ietf-interfaces_interfaces.xml",
                 XmlToCompositeNodeProvider.INSTANCE);
         BrokerFacade brokerFacade = mock(BrokerFacade.class);
-        when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(loadedCompositeNode);
+        when(brokerFacade.readOperationalData(any(YangInstanceIdentifier.class))).thenReturn(loadedCompositeNode);
         assertEquals(loadedCompositeNode, brokerFacade.readOperationalData(null));
     }
 
index ed1529540dc4fedde6fa803b909b5827e1241c79..67d98f6b558db0a0915928ff869d2a0f123a5b45 100644 (file)
@@ -51,7 +51,7 @@ import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
 import org.opendaylight.controller.sal.restconf.impl.StructuredData;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -229,7 +229,7 @@ public final class TestUtils {
 
         controllerContext.setSchemas(TestUtils.loadSchemaContext(modules));
 
-        when(mockedBrokerFacade.commitConfigurationDataPut(any(InstanceIdentifier.class), any(CompositeNode.class)))
+        when(mockedBrokerFacade.commitConfigurationDataPut(any(YangInstanceIdentifier.class), any(CompositeNode.class)))
                 .thenReturn(
                         new DummyFuture.Builder().rpcResult(
                                 new DummyRpcResult.Builder<TransactionStatus>().result(TransactionStatus.COMMITED)
index 18703040ee89ef6c7fff33bb57d9ced739aa6d0f..655aba267fb5574a94e352fcedd3e4727c923a73 100644 (file)
@@ -28,7 +28,7 @@ import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
 import org.opendaylight.controller.sal.restconf.impl.InstanceIdWithSchemaNode;
 import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
 import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -168,6 +168,6 @@ public class URITest {
         } else {
             when(mountInstance.getSchemaContext()).thenReturn(null);
         }
-        when(mountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+        when(mountService.getMountPoint(any(YangInstanceIdentifier.class))).thenReturn(mountInstance);
     }
 }
index 0799fdcff875b02ba6fb134c8f63f593660109d2..f4e869f99f49ebf42e482ca0c67f88dff0a6c285 100644 (file)
@@ -22,10 +22,10 @@ import org.opendaylight.controller.sal.rest.impl.JsonToCompositeNodeProvider;
 import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.SimpleNode;
 
 public class XmlAndJsonToCnSnInstanceIdentifierTest extends YangAndXmlAndDataSchemaLoader {
@@ -70,9 +70,9 @@ public class XmlAndJsonToCnSnInstanceIdentifierTest extends YangAndXmlAndDataSch
     private void verifyLeafListPredicate(CompositeNode cnSn) throws URISyntaxException {
         SimpleNode<?> lf11 = getSnWithInstanceIdentifierWhenLeafList(cnSn);
         Object value = lf11.getValue();
-        assertTrue(value instanceof InstanceIdentifier);
+        assertTrue(value instanceof YangInstanceIdentifier);
 
-        InstanceIdentifier instanceIdentifier = (InstanceIdentifier) value;
+        YangInstanceIdentifier instanceIdentifier = (YangInstanceIdentifier) value;
         List<PathArgument> pathArguments = instanceIdentifier.getPath();
         assertEquals(3, pathArguments.size());
         String revisionDate = "2014-01-17";
@@ -91,9 +91,9 @@ public class XmlAndJsonToCnSnInstanceIdentifierTest extends YangAndXmlAndDataSch
     private void verifyListPredicate(CompositeNode cnSn) throws URISyntaxException {
         SimpleNode<?> lf111 = getSnWithInstanceIdentifierWhenList(cnSn);
         Object value = lf111.getValue();
-        assertTrue(value instanceof InstanceIdentifier);
+        assertTrue(value instanceof YangInstanceIdentifier);
 
-        InstanceIdentifier instanceIdentifier = (InstanceIdentifier) value;
+        YangInstanceIdentifier instanceIdentifier = (YangInstanceIdentifier) value;
         List<PathArgument> pathArguments = instanceIdentifier.getPath();
         assertEquals(4, pathArguments.size());
         String revisionDate = "2014-01-17";
index ba06645354fb67ec215db9c67914a9367a7be43c..208c2164d506530f00b0cfd0a000325da447390e 100644 (file)
@@ -16,5 +16,8 @@ module invoke-rpc-module {
         }
     }
   }  
-  
+
+  rpc rpc-noop {
+  }
+
 }
\ No newline at end of file
index 31f4253318f146e95c2a0923f3f08d3e14cc4a2d..9a1816b90e88f333417a6c62d335c67b7f04739f 100644 (file)
@@ -16,7 +16,7 @@ import org.opendaylight.controller.sal.core.api.Broker;
 import org.opendaylight.controller.sal.core.api.Provider;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionService.MountProvisionListener;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
 import org.opendaylight.controller.sal.rest.doc.impl.ApiDocGenerator;
 import org.opendaylight.controller.sal.rest.doc.mountpoints.MountPointSwagger;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
index 68d31de8da35688737e927689d5f55a9085de2e9..5ba8b26bc1eb6bb69ac0d5e3564dbbfe5f8c27cf 100644 (file)
@@ -14,6 +14,7 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Date;
@@ -161,7 +162,7 @@ public class BaseYangSwaggerGenerator {
 
         List<Api> apis = new ArrayList<Api>();
 
-        Set<DataSchemaNode> dataSchemaNodes = m.getChildNodes();
+        Collection<DataSchemaNode> dataSchemaNodes = m.getChildNodes();
         _logger.debug("child nodes size [{}]", dataSchemaNodes.size());
         for (DataSchemaNode node : dataSchemaNodes) {
             if ((node instanceof ListSchemaNode) || (node instanceof ContainerSchemaNode)) {
@@ -240,9 +241,8 @@ public class BaseYangSwaggerGenerator {
         apis.add(api);
         if ((node instanceof ListSchemaNode) || (node instanceof ContainerSchemaNode)) {
             DataNodeContainer schemaNode = (DataNodeContainer) node;
-            Set<DataSchemaNode> dataSchemaNodes = schemaNode.getChildNodes();
 
-            for (DataSchemaNode childNode : dataSchemaNodes) {
+            for (DataSchemaNode childNode : schemaNode.getChildNodes()) {
                 // We don't support going to leaf nodes today. Only lists and
                 // containers.
                 if (childNode instanceof ListSchemaNode || childNode instanceof ContainerSchemaNode) {
index 8bac0d211e71cb2d88969c72d9b3f21a9fb00919..95bb1a094371db4f17d38c310c0043b07006c5c3 100644 (file)
@@ -126,9 +126,8 @@ public class ModelGenerator {
             JSONException {
 
         String moduleName = module.getName();
-        Set<DataSchemaNode> childNodes = module.getChildNodes();
 
-        for (DataSchemaNode childNode : childNodes) {
+        for (DataSchemaNode childNode : module.getChildNodes()) {
             JSONObject configModuleJSON = null;
             JSONObject operationalModuleJSON = null;
 
@@ -271,13 +270,12 @@ public class ModelGenerator {
         String containerDescription = container.getDescription();
         moduleJSON.put(DESCRIPTION_KEY, containerDescription);
 
-        Set<DataSchemaNode> containerChildren = container.getChildNodes();
-        JSONObject properties = processChildren(containerChildren, moduleName, models, isConfig);
+        JSONObject properties = processChildren(container.getChildNodes(), moduleName, models, isConfig);
         moduleJSON.put(PROPERTIES_KEY, properties);
         return moduleJSON;
     }
 
-    private JSONObject processChildren(Set<DataSchemaNode> nodes, String moduleName,
+    private JSONObject processChildren(Iterable<DataSchemaNode> nodes, String moduleName,
             JSONObject models) throws JSONException, IOException {
         return processChildren(nodes, moduleName, models, null);
     }
@@ -292,7 +290,7 @@ public class ModelGenerator {
      * @throws JSONException
      * @throws IOException
      */
-    private JSONObject processChildren(Set<DataSchemaNode> nodes, String moduleName,
+    private JSONObject processChildren(Iterable<DataSchemaNode> nodes, String moduleName,
             JSONObject models, Boolean isConfig) throws JSONException, IOException {
 
         JSONObject properties = new JSONObject();
@@ -418,11 +416,10 @@ public class ModelGenerator {
     private JSONObject processListSchemaNode(ListSchemaNode listNode, String moduleName,
             JSONObject models, Boolean isConfig) throws JSONException, IOException {
 
-        Set<DataSchemaNode> listChildren = listNode.getChildNodes();
         String fileName = (BooleanUtils.isNotFalse(isConfig)?OperationBuilder.CONFIG:OperationBuilder.OPERATIONAL) +
                                                                 listNode.getQName().getLocalName();
 
-        JSONObject childSchemaProperties = processChildren(listChildren, moduleName, models);
+        JSONObject childSchemaProperties = processChildren(listNode.getChildNodes(), moduleName, models);
         JSONObject childSchema = getSchemaTemplate();
         childSchema.put(TYPE_KEY, OBJECT_TYPE);
         childSchema.put(PROPERTIES_KEY, childSchemaProperties);
index fcabb088f4decbac32df1ba08648cb3d2d18fdf9..29ada12c6f8737a3d61fc5e68abde7cece17fad1 100644 (file)
@@ -23,7 +23,7 @@ import javax.ws.rs.core.UriInfo;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionService.MountProvisionListener;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
 import org.opendaylight.controller.sal.rest.doc.impl.BaseYangSwaggerGenerator;
 import org.opendaylight.controller.sal.rest.doc.swagger.Api;
 import org.opendaylight.controller.sal.rest.doc.swagger.ApiDeclaration;
@@ -31,9 +31,9 @@ import org.opendaylight.controller.sal.rest.doc.swagger.Operation;
 import org.opendaylight.controller.sal.rest.doc.swagger.Resource;
 import org.opendaylight.controller.sal.rest.doc.swagger.ResourceList;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
@@ -43,14 +43,14 @@ public class MountPointSwagger extends BaseYangSwaggerGenerator implements Mount
     private static final String DATASTORES_LABEL = "Datastores";
 
     private MountProvisionService mountService;
-    private final Map<InstanceIdentifier, Long> instanceIdToLongId = new TreeMap<>(
-            new Comparator<InstanceIdentifier>() {
+    private final Map<YangInstanceIdentifier, Long> instanceIdToLongId = new TreeMap<>(
+            new Comparator<YangInstanceIdentifier>() {
                 @Override
-                public int compare(final InstanceIdentifier o1, final InstanceIdentifier o2) {
+                public int compare(final YangInstanceIdentifier o1, final YangInstanceIdentifier o2) {
                     return o1.toString().compareToIgnoreCase(o2.toString());
                 }
             });
-    private final Map<Long, InstanceIdentifier> longIdToInstanceId = new HashMap<>();
+    private final Map<Long, YangInstanceIdentifier> longIdToInstanceId = new HashMap<>();
     private final Object lock = new Object();
 
     private final AtomicLong idKey = new AtomicLong(0);
@@ -62,7 +62,7 @@ public class MountPointSwagger extends BaseYangSwaggerGenerator implements Mount
         Map<String, Long> urlToId = new HashMap<>();
         synchronized (lock) {
             SchemaContext context = globalSchema.getGlobalContext();
-            for (Entry<InstanceIdentifier, Long> entry : instanceIdToLongId.entrySet()) {
+            for (Entry<YangInstanceIdentifier, Long> entry : instanceIdToLongId.entrySet()) {
                 String modName = findModuleName(entry.getKey(), context);
                 urlToId.put(generateUrlPrefixFromInstanceID(entry.getKey(), modName),
                         entry.getValue());
@@ -75,7 +75,7 @@ public class MountPointSwagger extends BaseYangSwaggerGenerator implements Mount
         this.globalSchema = globalSchema;
     }
 
-    private String findModuleName(final InstanceIdentifier id, final SchemaContext context) {
+    private String findModuleName(final YangInstanceIdentifier id, final SchemaContext context) {
         PathArgument rootQName = id.getPathArguments().iterator().next();
         for (Module mod : context.getModules()) {
             if (mod.getDataChildByName(rootQName.getNodeType()) != null) {
@@ -85,7 +85,7 @@ public class MountPointSwagger extends BaseYangSwaggerGenerator implements Mount
         return null;
     }
 
-    private String generateUrlPrefixFromInstanceID(final InstanceIdentifier key, final String moduleName) {
+    private String generateUrlPrefixFromInstanceID(final YangInstanceIdentifier key, final String moduleName) {
         StringBuilder builder = new StringBuilder();
         if (moduleName != null) {
             builder.append(moduleName);
@@ -101,7 +101,7 @@ public class MountPointSwagger extends BaseYangSwaggerGenerator implements Mount
                 builder.append('/');
             }
             builder.append(name);
-            if (arg instanceof InstanceIdentifier.NodeIdentifierWithPredicates) {
+            if (arg instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates) {
                 NodeIdentifierWithPredicates nodeId = (NodeIdentifierWithPredicates) arg;
                 for (Entry<QName, Object> entry : nodeId.getKeyValues().entrySet()) {
                     builder.append('/').append(entry.getValue());
@@ -112,13 +112,13 @@ public class MountPointSwagger extends BaseYangSwaggerGenerator implements Mount
         return builder.append('/').toString();
     }
 
-    private String getYangMountUrl(final InstanceIdentifier key) {
+    private String getYangMountUrl(final YangInstanceIdentifier key) {
         String modName = findModuleName(key, globalSchema.getGlobalContext());
         return generateUrlPrefixFromInstanceID(key, modName) + "yang-ext:mount/";
     }
 
     public ResourceList getResourceList(final UriInfo uriInfo, final Long id) {
-        InstanceIdentifier iid = getInstanceId(id);
+        YangInstanceIdentifier iid = getInstanceId(id);
         if (iid == null) {
             return null; // indicating not found.
         }
@@ -138,15 +138,15 @@ public class MountPointSwagger extends BaseYangSwaggerGenerator implements Mount
         return list;
     }
 
-    private InstanceIdentifier getInstanceId(final Long id) {
-        InstanceIdentifier instanceId;
+    private YangInstanceIdentifier getInstanceId(final Long id) {
+        YangInstanceIdentifier instanceId;
         synchronized (lock) {
             instanceId = longIdToInstanceId.get(id);
         }
         return instanceId;
     }
 
-    private SchemaContext getSchemaContext(final InstanceIdentifier id) {
+    private SchemaContext getSchemaContext(final YangInstanceIdentifier id) {
 
         if (id == null) {
             return null;
@@ -165,7 +165,7 @@ public class MountPointSwagger extends BaseYangSwaggerGenerator implements Mount
     }
 
     public ApiDeclaration getMountPointApi(final UriInfo uriInfo, final Long id, final String module, final String revision) {
-        InstanceIdentifier iid = getInstanceId(id);
+        YangInstanceIdentifier iid = getInstanceId(id);
         SchemaContext context = getSchemaContext(iid);
         String urlPrefix = getYangMountUrl(iid);
         if (context == null) {
@@ -211,7 +211,7 @@ public class MountPointSwagger extends BaseYangSwaggerGenerator implements Mount
     }
 
     @Override
-    public void onMountPointCreated(final InstanceIdentifier path) {
+    public void onMountPointCreated(final YangInstanceIdentifier path) {
         synchronized (lock) {
             Long idLong = idKey.incrementAndGet();
             instanceIdToLongId.put(path, idLong);
@@ -220,7 +220,7 @@ public class MountPointSwagger extends BaseYangSwaggerGenerator implements Mount
     }
 
     @Override
-    public void onMountPointRemoved(final InstanceIdentifier path) {
+    public void onMountPointRemoved(final YangInstanceIdentifier path) {
         synchronized (lock) {
             Long id = instanceIdToLongId.remove(path);
             longIdToInstanceId.remove(id);
index a2e29398a3a68ffe0723b8c8fbfa96d8acb5e84b..bba8ed9ca6fcf557bb972af2d3c55c68bf1f3f13 100644 (file)
@@ -32,13 +32,13 @@ import org.opendaylight.controller.sal.rest.doc.swagger.Operation;
 import org.opendaylight.controller.sal.rest.doc.swagger.Resource;
 import org.opendaylight.controller.sal.rest.doc.swagger.ResourceList;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 public class MountPointSwaggerTest {
 
     private static final String HTTP_URL = "http://localhost/path";
-    private static final InstanceIdentifier instanceId = InstanceIdentifier.builder()
+    private static final YangInstanceIdentifier instanceId = YangInstanceIdentifier.builder()
             .node(QName.create("nodes"))
             .nodeWithKey(QName.create("node"), QName.create("id"), "123").build();
     private static final String INSTANCE_URL = "nodes/node/123/";
index 6f31a7ec76ac6e365429faefbf035b93764731cc..d123456262a2c7359aa052599e9fd98b6c78a265 100644 (file)
@@ -20,7 +20,7 @@ import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.binding.api.NotificationService;
 import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
-import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.NotificationListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -33,7 +33,7 @@ public class L2SwitchProvider extends AbstractBindingAwareConsumer
 
   private final static Logger _logger = LoggerFactory.getLogger(L2SwitchProvider.class);
 
-  private Registration<NotificationListener> listenerRegistration;
+  private ListenerRegistration<NotificationListener> listenerRegistration;
   private AddressTracker addressTracker;
   private TopologyLinkDataChangeHandler topologyLinkDataChangeHandler;
 
index 88281bd59369858f8818adfa75b741e4d4fea367..8d67fb4ed09371394dc10cc9b9d8105f860d16db 100644 (file)
@@ -16,7 +16,7 @@ import org.opendaylight.controller.sample.kitchen.api.KitchenService;
 import org.opendaylight.controller.sample.kitchen.impl.KitchenServiceImpl;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToastType;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterService;
-import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.NotificationListener;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
@@ -50,7 +50,7 @@ public final class KitchenServiceModule extends AbstractKitchenServiceModule {
 
         final KitchenServiceImpl kitchenService = new KitchenServiceImpl(toasterService);
 
-        final Registration<NotificationListener> toasterListenerReg =
+        final ListenerRegistration<NotificationListener> toasterListenerReg =
                 getNotificationServiceDependency().registerNotificationListener( kitchenService );
 
         final KitchenServiceRuntimeRegistration runtimeReg =
index add46bd162fc5644a0f4a5bf13fed72e5ad0a6d2..edf7388a769a662a0ea7848694501c08a864ac0a 100644 (file)
@@ -64,31 +64,15 @@ final class FlowStatsTracker extends AbstractListeningStatsTracker<FlowAndStatis
     protected FlowStatsEntry updateSingleStat(final DataModificationTransaction trans, final FlowAndStatisticsMapList map) {
         short tableId = map.getTableId();
 
-        FlowBuilder flowBuilder = new FlowBuilder();
-
         FlowStatisticsDataBuilder flowStatisticsData = new FlowStatisticsDataBuilder();
 
-        FlowBuilder flow = new FlowBuilder();
-        flow.setContainerName(map.getContainerName());
-        flow.setBufferId(map.getBufferId());
-        flow.setCookie(map.getCookie());
-        flow.setCookieMask(map.getCookieMask());
-        flow.setFlags(map.getFlags());
-        flow.setFlowName(map.getFlowName());
-        flow.setHardTimeout(map.getHardTimeout());
-        if(map.getFlowId() != null)
+        FlowBuilder flow = new FlowBuilder(map);
+        if(map.getFlowId() != null) {
             flow.setId(new FlowId(map.getFlowId().getValue()));
-        flow.setIdleTimeout(map.getIdleTimeout());
-        flow.setInstallHw(map.isInstallHw());
-        flow.setInstructions(map.getInstructions());
-        if(map.getFlowId()!= null)
+        }
+        if(map.getFlowId()!= null) {
             flow.setKey(new FlowKey(new FlowId(map.getKey().getFlowId().getValue())));
-        flow.setMatch(map.getMatch());
-        flow.setOutGroup(map.getOutGroup());
-        flow.setOutPort(map.getOutPort());
-        flow.setPriority(map.getPriority());
-        flow.setStrict(map.isStrict());
-        flow.setTableId(tableId);
+        }
 
         Flow flowRule = flow.build();
 
@@ -105,22 +89,6 @@ final class FlowStatsTracker extends AbstractListeningStatsTracker<FlowAndStatis
         flowStatistics.setByteCount(flowStats.getByteCount());
         flowStatistics.setPacketCount(flowStats.getPacketCount());
         flowStatistics.setDuration(flowStats.getDuration());
-        flowStatistics.setContainerName(map.getContainerName());
-        flowStatistics.setBufferId(map.getBufferId());
-        flowStatistics.setCookie(map.getCookie());
-        flowStatistics.setCookieMask(map.getCookieMask());
-        flowStatistics.setFlags(map.getFlags());
-        flowStatistics.setFlowName(map.getFlowName());
-        flowStatistics.setHardTimeout(map.getHardTimeout());
-        flowStatistics.setIdleTimeout(map.getIdleTimeout());
-        flowStatistics.setInstallHw(map.isInstallHw());
-        flowStatistics.setInstructions(map.getInstructions());
-        flowStatistics.setMatch(map.getMatch());
-        flowStatistics.setOutGroup(map.getOutGroup());
-        flowStatistics.setOutPort(map.getOutPort());
-        flowStatistics.setPriority(map.getPriority());
-        flowStatistics.setStrict(map.isStrict());
-        flowStatistics.setTableId(tableId);
 
         flowStatisticsData.setFlowStatistics(flowStatistics.build());
 
@@ -143,13 +111,12 @@ final class FlowStatsTracker extends AbstractListeningStatsTracker<FlowAndStatis
                             .augmentation(FlowCapableNode.class)
                             .child(Table.class, new TableKey(tableId))
                             .child(Flow.class,existingFlow.getKey()).toInstance();
-                    flowBuilder.setKey(existingFlow.getKey());
-                    flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
+                    flow.setKey(existingFlow.getKey());
+                    flow.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
                     logger.debug("Found matching flow in the datastore, augmenting statistics");
                     // Update entry with timestamp of latest response
-                    flow.setKey(existingFlow.getKey());
                     FlowStatsEntry flowStatsEntry = new FlowStatsEntry(tableId,flow.build());
-                    trans.putOperationalData(flowRef, flowBuilder.build());
+                    trans.putOperationalData(flowRef, flow.build());
                     return flowStatsEntry;
                 }
             }
@@ -168,13 +135,12 @@ final class FlowStatsTracker extends AbstractListeningStatsTracker<FlowAndStatis
                                 .augmentation(FlowCapableNode.class)
                                 .child(Table.class, new TableKey(tableId))
                                 .child(Flow.class,existingFlow.getKey()).toInstance();
-                        flowBuilder.setKey(existingFlow.getKey());
-                        flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
+                        flow.setKey(existingFlow.getKey());
+                        flow.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
                         logger.debug("Found matching unaccounted flow in the operational datastore, augmenting statistics");
                         // Update entry with timestamp of latest response
-                        flow.setKey(existingFlow.getKey());
                         FlowStatsEntry flowStatsEntry = new FlowStatsEntry(tableId,flow.build());
-                        trans.putOperationalData(flowRef, flowBuilder.build());
+                        trans.putOperationalData(flowRef, flow.build());
                         return flowStatsEntry;
                     }
                 }
@@ -187,15 +153,15 @@ final class FlowStatsTracker extends AbstractListeningStatsTracker<FlowAndStatis
         InstanceIdentifier<Flow> flowRef = getNodeIdentifierBuilder().augmentation(FlowCapableNode.class)
                     .child(Table.class, new TableKey(tableId))
                     .child(Flow.class,newFlowKey).toInstance();
-        flowBuilder.setKey(newFlowKey);
-        flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
+        flow.setKey(newFlowKey);
+        flow.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
         logger.debug("Flow {} is not present in config data store, augmenting statistics as an unaccounted flow",
-                    flowBuilder.build());
+                    flow.build());
 
         // Update entry with timestamp of latest response
         flow.setKey(newFlowKey);
         FlowStatsEntry flowStatsEntry = new FlowStatsEntry(tableId,flow.build());
-        trans.putOperationalData(flowRef, flowBuilder.build());
+        trans.putOperationalData(flowRef, flow.build());
         return flowStatsEntry;
     }
 
index b96d2be47e11b5f66fda9bc2d4df156e1b08c421..8c9b60e43f0b7dc373b3365039ab950f86df6bfc 100644 (file)
@@ -28,7 +28,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.OpendaylightQueueStatisticsService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.NotificationListener;
 import org.slf4j.Logger;
@@ -76,7 +75,7 @@ public class StatisticsProvider implements AutoCloseable {
 
     private final StatisticsListener updateCommiter = new StatisticsListener(StatisticsProvider.this);
 
-    private Registration<NotificationListener> listenerRegistration;
+    private ListenerRegistration<NotificationListener> listenerRegistration;
 
     private ListenerRegistration<DataChangeListener> flowCapableTrackerRegistration;
 
index b219722ba864eb6a5b306171038112e5a2f2ebf9..91db6e264b63518f48f9326882ea994ebb9a3bd4 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.md.controller.topology.lldp;
 
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
-import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.NotificationListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -19,7 +19,7 @@ public class LLDPDiscoveryProvider implements AutoCloseable {
     private DataProviderService dataService;
     private NotificationProviderService notificationService;
     private final LLDPDiscoveryListener commiter = new LLDPDiscoveryListener(LLDPDiscoveryProvider.this);
-    private Registration<NotificationListener> listenerRegistration;
+    private ListenerRegistration<NotificationListener> listenerRegistration;
 
     public DataProviderService getDataService() {
         return this.dataService;
@@ -38,7 +38,7 @@ public class LLDPDiscoveryProvider implements AutoCloseable {
     }
 
     public void start() {
-        Registration<NotificationListener> registerNotificationListener = this.getNotificationService().registerNotificationListener(this.commiter);
+        ListenerRegistration<NotificationListener> registerNotificationListener = this.getNotificationService().registerNotificationListener(this.commiter);
         this.listenerRegistration = registerNotificationListener;
         LLDPLinkAger.getInstance().setManager(this);
         LOG.info("LLDPDiscoveryListener Started.");
index d656bda932f2251e18ea7f71f6c19500115456d3..a87971bc6bc0e1d6a294c30a08dfb73cf81484be 100644 (file)
@@ -19,7 +19,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
 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.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.NotificationListener;
 import org.osgi.framework.BundleContext;
@@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
 
 public class FlowCapableTopologyProvider extends AbstractBindingAwareProvider implements AutoCloseable {
     private final static Logger LOG = LoggerFactory.getLogger(FlowCapableTopologyProvider.class);
-    private Registration<NotificationListener> listenerRegistration;
+    private ListenerRegistration<NotificationListener> listenerRegistration;
     private Thread thread;
 
     /**
index a2b8e0bfdf6b97a5cc4cdf1e361084e6be0d1078..104bf4df94c86dfe8b5bb44674020feb0f1c5ecb 100644 (file)
@@ -45,6 +45,6 @@ public class SimpleIdentityRefAttributeWritingStrategy extends SimpleAttributeWr
         QName qName = QName.create(value);
         String identityValue = qName.getLocalName();
         String identityNamespace = qName.getNamespace().toString();
-        return XmlUtil.createTextElementWithNamespacedContent(doc, key, PREFIX, identityNamespace, identityValue);
+        return XmlUtil.createTextElementWithNamespacedContent(doc, key, PREFIX, identityNamespace, identityValue, namespace);
     }
 }
index 66d0d4da4673e16650bea4e6a46b864847b160e6..42afb160a8a8ea5efb8811427256c70ae2c4b023 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.controller.netconf.cli.commands.output;
 import com.google.common.base.Preconditions;
 import java.util.Collections;
 import java.util.Iterator;
-import java.util.Set;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 
@@ -20,9 +19,9 @@ import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 public class OutputDefinition implements Iterable<DataSchemaNode> {
 
     public static final OutputDefinition EMPTY_OUTPUT = new OutputDefinition(Collections.<DataSchemaNode>emptySet());
-    private final Set<DataSchemaNode> childNodes;
+    private final Iterable<DataSchemaNode> childNodes;
 
-    public OutputDefinition(final Set<DataSchemaNode> childNodes) {
+    public OutputDefinition(final Iterable<DataSchemaNode> childNodes) {
         this.childNodes = childNodes;
     }
 
index 4ba3478365caa3becba45cdae8f19f39c5adb285..a05a169c991fc71fa5259729c15df6ce883426cb 100644 (file)
@@ -1,3 +1,4 @@
+
 /*
  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
  *
@@ -9,7 +10,6 @@ package org.opendaylight.controller.netconf.cli.reader.impl;
 
 import com.google.common.base.Optional;
 import com.google.common.collect.Lists;
-import java.util.List;
 import jline.console.completer.Completer;
 import org.opendaylight.controller.netconf.cli.io.BaseConsoleContext;
 import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
@@ -19,6 +19,8 @@ import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 
+import java.util.List;
+
 class LeafListEntryReader extends BasicDataHolderReader<LeafListSchemaNode> implements
         GenericListEntryReader<LeafListSchemaNode> {
 
index 62845ad1291d86eba5d313fe4ec2d77d2a3b042b..1ca902f7399f0c0b69ec98bf5e2e3e298d3f4074 100644 (file)
@@ -11,7 +11,7 @@ import com.google.common.base.Preconditions;
 import java.util.Collections;
 import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.ChoiceNodeBaseSerializer;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher;
@@ -68,4 +68,4 @@ final class ChoiceNodeCliSerializer extends ChoiceNodeBaseSerializer<String> {
     protected NodeSerializerDispatcher<String> getNodeDispatcher() {
         return dispatcher;
     }
-}
\ No newline at end of file
+}
index cab07afe6c36778e02938d3d63b604fba4ab0f1c..a62af7651eb74e7b009d302af1c577ac9fc121cf 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.controller.netconf.cli.writer.impl;
 
 import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
+import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode;
 import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
@@ -20,6 +21,7 @@ import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlCodecProvider;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.FromNormalizedNodeSerializer;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.FromNormalizedNodeSerializerFactory;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher;
+import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
@@ -100,4 +102,9 @@ public final class CliOutputFromNormalizedNodeSerializerFactory implements FromN
         return mapNodeSerializer;
     }
 
+    @Override
+    public FromNormalizedNodeSerializer<String, AnyXmlNode, AnyXmlSchemaNode> getAnyXmlNodeSerializer() {
+        throw new UnsupportedOperationException();
+    }
+
 }
\ No newline at end of file
index 08abd47f251f319870eb285d66d1daa5fa48123e..566829d178483305a7a41d420f8ba751a6ed71fb 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.netconf.cli.writer.impl;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Iterables;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
@@ -35,7 +35,7 @@ public class NodeCliSerializerDispatcher implements NodeSerializerDispatcher<Str
 
     @Override
     public final Iterable<String> dispatchChildElement(final Object childSchema,
-            final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+            final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
         if (dataContainerChild instanceof ContainerNode) {
             return onContainerNode(childSchema, dataContainerChild);
         } else if (dataContainerChild instanceof LeafNode<?>) {
@@ -55,14 +55,14 @@ public class NodeCliSerializerDispatcher implements NodeSerializerDispatcher<Str
     }
 
     private Iterable<String> onAugmentationSchema(final Object childSchema,
-            final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+            final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
         checkSchemaCompatibility(childSchema, AugmentationSchema.class, dataContainerChild);
         return factory.getAugmentationNodeSerializer().serialize((AugmentationSchema) childSchema,
                 (AugmentationNode) dataContainerChild);
     }
 
     private Iterable<String> onChoiceNode(final Object childSchema,
-            final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+            final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
         checkSchemaCompatibility(childSchema, org.opendaylight.yangtools.yang.model.api.ChoiceNode.class,
                 dataContainerChild);
         return factory.getChoiceNodeSerializer().serialize(
@@ -70,20 +70,20 @@ public class NodeCliSerializerDispatcher implements NodeSerializerDispatcher<Str
     }
 
     private Iterable<String> onListNode(final Object childSchema,
-            final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+            final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
         checkSchemaCompatibility(childSchema, ListSchemaNode.class, dataContainerChild);
         return factory.getMapNodeSerializer().serialize((ListSchemaNode) childSchema, (MapNode) dataContainerChild);
     }
 
     private Iterable<String> onLeafListNode(final Object childSchema,
-            final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+            final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
         checkSchemaCompatibility(childSchema, LeafListSchemaNode.class, dataContainerChild);
         return factory.getLeafSetNodeSerializer().serialize((LeafListSchemaNode) childSchema,
                 (LeafSetNode<?>) dataContainerChild);
     }
 
     private Iterable<String> onLeafNode(final Object childSchema,
-            final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+            final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
         checkSchemaCompatibility(childSchema, LeafSchemaNode.class, dataContainerChild);
         final Iterable<String> elements = factory.getLeafNodeSerializer().serialize((LeafSchemaNode) childSchema,
                 (LeafNode<?>) dataContainerChild);
@@ -92,7 +92,7 @@ public class NodeCliSerializerDispatcher implements NodeSerializerDispatcher<Str
     }
 
     private static void checkOnlyOneSerializedElement(final Iterable<?> elements,
-            final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+            final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
         final int size = Iterables.size(elements);
         Preconditions.checkArgument(size == 1,
                 "Unexpected count of elements for entry serialized from: %s, should be 1, was: %s", dataContainerChild,
@@ -100,7 +100,7 @@ public class NodeCliSerializerDispatcher implements NodeSerializerDispatcher<Str
     }
 
     private Iterable<String> onContainerNode(final Object childSchema,
-            final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+            final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
         checkSchemaCompatibility(childSchema, ContainerSchemaNode.class, dataContainerChild);
 
         final Iterable<String> elements = factory.getContainerNodeSerializer().serialize(
@@ -110,9 +110,9 @@ public class NodeCliSerializerDispatcher implements NodeSerializerDispatcher<Str
     }
 
     private static void checkSchemaCompatibility(final Object childSchema, final Class<?> containerSchemaNodeClass,
-            final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+            final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild) {
         Preconditions.checkArgument(containerSchemaNodeClass.isAssignableFrom(childSchema.getClass()),
                 "Incompatible schema: %s with node: %s, expected: %s", childSchema, dataContainerChild,
                 containerSchemaNodeClass);
     }
-}
\ No newline at end of file
+}
index eef9a39a2778a7754c4ec98eede4d42b37fb1fb4..c101db9ef8406342c502fe2e276e203791970662 100644 (file)
@@ -13,7 +13,7 @@ import java.util.List;
 import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
 import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
 import org.opendaylight.controller.netconf.cli.writer.WriteException;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 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;
@@ -91,4 +91,4 @@ public class NormalizedNodeWriter extends AbstractWriter<DataSchemaNode> {
         return null;
     }
 
-}
\ No newline at end of file
+}
index 8780925eb185b97493cfc7557620f2846604ecd4..4e3a66b7ec5f7edfe0399bcab74e6a1843ed0449 100644 (file)
@@ -224,11 +224,17 @@ public final class XmlElement {
         });
     }
 
+    /**
+     *
+     * @param tagName tag name without prefix
+     * @return
+     */
     public List<XmlElement> getChildElements(final String tagName) {
         return getChildElementsInternal(new ElementFilteringStrategy() {
             @Override
             public boolean accept(Element e) {
-                return e.getTagName().equals(tagName);
+                // localName returns pure localName without prefix
+                return e.getLocalName().equals(tagName);
             }
         });
     }
index 01b1c8d5642368cfcfb76249ffd163037616134a..9e227ee05d6d9839c1f547ec5b53f1ff5b9f9a67 100644 (file)
@@ -124,8 +124,14 @@ public final class XmlUtil {
     public static Element createTextElementWithNamespacedContent(Document document, String qName, String prefix,
                                                                  String namespace, String contentWithoutPrefix) {
 
+       return createTextElementWithNamespacedContent(document, qName, prefix, namespace, contentWithoutPrefix, Optional.<String>absent());
+    }
+
+    public static Element createTextElementWithNamespacedContent(Document document, String qName, String prefix,
+                                                                 String namespace, String contentWithoutPrefix, Optional<String> namespaceURI) {
+
         String content = createPrefixedValue(XmlNetconfConstants.PREFIX, contentWithoutPrefix);
-        Element element = createTextElement(document, qName, content, Optional.<String>absent());
+        Element element = createTextElement(document, qName, content, namespaceURI);
         String prefixedNamespaceAttr = createPrefixedValue(XMLNS_ATTRIBUTE_KEY, prefix);
         element.setAttributeNS(XMLNS_URI, prefixedNamespaceAttr, namespace);
         return element;
index 840029006be5b16a4d394bae0d6daa0b5efd65a5..1f10b395137c498b3e542e974545132332e84be4 100644 (file)
@@ -75,7 +75,7 @@ public class NeutronSubnet extends ConfigurationObject implements Serializable,
      */
     List<NeutronPort> myPorts;
 
-    boolean gatewayIPAssigned;
+    Boolean gatewayIPAssigned;
 
     public NeutronSubnet() {
         myPorts = new ArrayList<NeutronPort>();
@@ -299,7 +299,7 @@ public class NeutronSubnet extends ConfigurationObject implements Serializable,
             try {
                 SubnetUtils util = new SubnetUtils(cidr);
                 SubnetInfo info = util.getInfo();
-                if (gatewayIP == null) {
+                if (gatewayIP == null || ("").equals(gatewayIP)) {
                     gatewayIP = info.getLowAddress();
                 }
                 if (allocationPools.size() < 1) {
@@ -460,6 +460,10 @@ public class NeutronSubnet extends ConfigurationObject implements Serializable,
         gatewayIPAssigned = false;
     }
 
+    public Boolean getGatewayIPAllocated() {
+        return gatewayIPAssigned;
+    }
+
     @Override
     public String toString() {
         return "NeutronSubnet [subnetUUID=" + subnetUUID + ", networkUUID=" + networkUUID + ", name=" + name
index a2d2dac112e932d7578698bd1eccf54f54942f50..cbc1f0c328e58be31f53304c657ed050f746ffe1 100644 (file)
@@ -91,7 +91,6 @@
               javax.ws.rs.core,
               javax.xml.bind,
               javax.xml.bind.annotation,
-              org.objectweb.asm,
               org.opendaylight.controller.sal.utils,
               org.opendaylight.controller.sal.core,
               org.opendaylight.controller.sal.authorization,
index 17b2fcfcf9ef43437903f499dc4da2aceb61983b..806e853b3604ec7848e08176aaf7f8d8e8f3996f 100644 (file)
@@ -422,7 +422,9 @@ public class NeutronRoutersNorthbound {
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronRouterAware service = (INeutronRouterAware) instance;
-                service.canAttachInterface(target, input);
+                int status = service.canAttachInterface(target, input);
+                if (status < 200 || status > 299)
+                    return Response.status(status).build();
             }
         }
 
@@ -498,7 +500,9 @@ public class NeutronRoutersNorthbound {
             if (instances != null) {
                 for (Object instance : instances) {
                     INeutronRouterAware service = (INeutronRouterAware) instance;
-                    service.canDetachInterface(target, input);
+                    int status = service.canDetachInterface(target, input);
+                    if (status < 200 || status > 299)
+                        return Response.status(status).build();
                 }
             }
 
diff --git a/pom.xml b/pom.xml
index 242ab8eb89fce53b5ee7396b02790df9e96b781b..8bebd2aa61050f0d8058d82f312ac572ec44bf86 100644 (file)
--- a/pom.xml
+++ b/pom.xml
     <module>opendaylight/commons/filter-valve</module>
 
     <!-- Karaf Distribution -->
-    <module>features/base</module>
-    <module>features/controller</module>
-    <module>features/adsal</module>
-    <module>features/extras</module>
     <module>opendaylight/dummy-console</module>
     <module>opendaylight/karaf-branding</module>
     <module>opendaylight/distribution/opendaylight-karaf</module>