Merge "Add BGPCEP logging configuration"
authorTony Tkacik <ttkacik@cisco.com>
Thu, 10 Jul 2014 08:42:25 +0000 (08:42 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 10 Jul 2014 08:42:25 +0000 (08:42 +0000)
297 files changed:
features/adsal/pom.xml [new file with mode: 0644]
features/adsal/src/main/resources/features.xml [new file with mode: 0644]
features/extras/pom.xml [new file with mode: 0644]
features/extras/src/main/resources/features.xml [new file with mode: 0644]
opendaylight/commons/opendaylight/pom.xml
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/AbstractDispatcher.java
opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/pom.xml
opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__-impl.yang
opendaylight/config/config-module-archetype/src/main/resources/archetype-resources/src/main/yang/__module-name__.yang
opendaylight/config/config-util/pom.xml
opendaylight/config/feature/src/main/resources/features.xml
opendaylight/config/pom.xml
opendaylight/distribution/opendaylight-karaf/pom.xml
opendaylight/distribution/opendaylight/pom.xml
opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini
opendaylight/distribution/opendaylight/src/main/resources/configuration/initial/01-md-sal.xml
opendaylight/distribution/opendaylight/src/main/resources/functions.sh [new file with mode: 0644]
opendaylight/distribution/opendaylight/src/main/resources/run.bat
opendaylight/distribution/opendaylight/src/main/resources/run.sh
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FromSalConversionsUtils.java
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/NodeMapping.java
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ToSalConversionsUtils.java
opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/NodeMappingTest.java
opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/TestFromSalConversionsUtils.java
opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/TestToSalConversionsUtils.java
opendaylight/md-sal/model/model-flow-base/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/flow/types/port/rev130925/PortNumberBuilder.java [new file with mode: 0644]
opendaylight/md-sal/model/model-flow-management/pom.xml [deleted file]
opendaylight/md-sal/model/model-flow-management/src/main/yang/flow-management.yang [deleted file]
opendaylight/md-sal/model/model-flow-management/src/main/yang/group-management.yang [deleted file]
opendaylight/md-sal/model/model-flow-management/src/main/yang/meter-management.yang [deleted file]
opendaylight/md-sal/model/model-flow-management/src/main/yang/port-management.yang [deleted file]
opendaylight/md-sal/model/model-flow-management/src/main/yang/queue-management.yang [deleted file]
opendaylight/md-sal/model/model-flow-management/src/main/yang/table-management.yang [deleted file]
opendaylight/md-sal/model/model-flow-service/src/main/yang/node-errors.yang
opendaylight/md-sal/model/pom.xml
opendaylight/md-sal/pom.xml
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/BindingAwareConsumer.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/BindingAwareProvider.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationListener.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationProviderService.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationService.java
opendaylight/md-sal/sal-binding-broker/pom.xml
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/AbstractWriteTransaction.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/sal/binding/codegen/impl/BrokerImplClassLoader.java [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RuntimeCodeGenerator.xtend
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/DataModificationTracker.java [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/package-info.java [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/DelegateProxy.java [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/remote/RouteChangeListener.java [deleted file]
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/WriteTransactionTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/RuntimeCodeGeneratorTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/compat/MultipleAugmentationPutsTest.java [moved from opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/MultipleAugmentationPutsTest.java with 99% similarity]
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/compat/UnionSerializationTest.java [moved from opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/UnionSerializationTest.java with 97% similarity]
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/compat/package-info.java [moved from opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/CompositeNodeUtils.java with 72% similarity]
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java
opendaylight/md-sal/sal-binding-dom-it/pom.xml
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/ConcurrentImplicitCreateTest.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/md/sal/binding/data/WildcardedDataChangeListenerTest.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/DOMCodecBug02Test.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/FlagsSerializationTest.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/bugfix/WriteParentListenAugmentTest.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/WriteParentReadChildTest.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/package-info.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/BrokerIntegrationTest.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/DOMRpcServiceTestBugfix560.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-it/src/main/java/org/opendaylight/controller/test/sal/binding/it/TestHelper.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataChangeEvent.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/notify/NotificationPublishService.java
opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/ToSalPropertyClassUtils.java [deleted file]
opendaylight/md-sal/sal-distributed-datastore/pom.xml
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractUntypedActor.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ActorSystemFactory.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 [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ListenerProxy.java with 60% similarity]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistration.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxy.java [new file with mode: 0644]
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 [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ListenerRegistration.java [deleted file]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ListenerRegistrationProxy.java [deleted file]
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/TerminationMonitor.java [new file with mode: 0644]
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 [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/exceptions/TimeoutException.java [moved from opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/Constants.java with 62% similarity]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseDataChangeListenerRegistration.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseListenerRegistrationReply.java with 88% similarity]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseDataChangeListenerRegistrationReply.java [moved from opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/RpcRegistrationNullPointer.java with 72% similarity]
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/CreateTransactionReply.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChanged.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChangedReply.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseListenerRegistration.java with 90% similarity]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/Monitor.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/NonPersistent.java [new file with mode: 0644]
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/config/yang/config/distributed_datastore_provider/DistributedConfigDataStoreProviderModule.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedConfigDataStoreProviderModuleFactory.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedDataStoreProviderModuleFactory.java with 52% similarity]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedDataStoreProviderModule.java [deleted file]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedOperationalDataStoreProviderModule.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedOperationalDataStoreProviderModuleFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/resources/application.conf [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/yang/distributed-datastore-provider.yang
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/DataChangeListenerProxyTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxyTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationTest.java [moved from opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ListenerRegistrationTest.java with 82% similarity]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java [new file with mode: 0644]
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/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 [new file with mode: 0644]
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/utils/TestUtils.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/SchemaAwareRpcBroker.java
opendaylight/md-sal/sal-inmemory-datastore/pom.xml
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/ResolveDataChangeEventsTask.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/AbstractDataChangeListenerTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DatastoreTestTask.java [new file with mode: 0644]
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DefaultDataChangeListenerTestSuite.java [new file with mode: 0644]
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDataStoreTest.java
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/RootScopeSubtreeTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeBaseTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeOneTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeSubtreeTest.java [new file with mode: 0644]
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/schema/mapping/NetconfMessageTransformer.java
opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/NetconfToNotificationTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/test/resources/notification-payload.xml [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/test/resources/schemas/user-notification.yang [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/README-FIRST
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/transaction/ShardTransactionMessages.java [deleted file]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/util/EncoderDecoderUtil.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/common/SimpleNormalizedNodeMessage.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/datachange/notification/DataChangeListenerMessages.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/registration/ListenerRegistrationMessages.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/registration/ListenerRegistrationMessages.java with 68% similarity]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/shard/ShardManagerMessages.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/shard/ShardManagerMessages.java with 72% similarity]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionChainMessages.java [moved from opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/transaction/ShardTransactionChainMessages.java with 70% similarity]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessages.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/DataChangeListener.proto [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ListenerRegistration.proto
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/main/resources/ShardTransactionChain.proto
opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/SimpleNormalizedNode.proto [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/messages/ShardManagerMessagesTest.java [deleted file]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/NormalizedNodeXmlConverterTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/TestModel.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/protobuff/messages/ShardManagerMessagesTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/augment_choice.xml [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/augment_choice.yang [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-test.yang [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/simple_xml_with_attributes.xml [new file with mode: 0644]
opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/test.yang [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfService.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/gson/JsonParser.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonToCompositeNodeProvider.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonToCompositeNodeReader.java [moved from opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonReader.java with 86% similarity]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfProvider.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToJsonProvider.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/StructuredDataToXmlProvider.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlToCompositeNodeProvider.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlToCompositeNodeReader.java [moved from opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlReader.java with 88% similarity]
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/impl/StructuredData.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/websockets/WebSocketServer.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonNotExistingLeafTypeTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonWithAugmentTest.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/MediaTypesTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/MultipleEqualNamesForDataNodesTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/TestUtils.java
opendaylight/md-sal/sal-rest-connector/src/test/resources/equal-data-node-names/equal-name-data-for-container.json [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/equal-data-node-names/equal-name-data-for-container.xml [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/equal-data-node-names/equal-name-data-for-leaf.json [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/equal-data-node-names/equal-name-data-for-leaf.xml [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/equal-data-node-names/yang/equal-data-node-names.yang [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/test/resources/json-to-cnsn/empty-data1.json
opendaylight/md-sal/sal-rest-connector/src/test/resources/multiple-nodes/multiple-nodes.yang [new file with mode: 0644]
opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/ModelGenerator.java
opendaylight/md-sal/sal-test-model/pom.xml [new file with mode: 0644]
opendaylight/md-sal/sal-test-model/src/main/yang/opendaylight-mdsal-list-test.yang [new file with mode: 0644]
opendaylight/md-sal/sal-test-model/src/main/yang/opendaylight-sal-test-store.yang [moved from opendaylight/md-sal/sal-binding-dom-it/src/main/yang/opendaylight-sal-test-store.yang with 100% similarity]
opendaylight/md-sal/sal-test-model/src/main/yang/opendaylight-test-rpc-service.yang [new file with mode: 0644]
opendaylight/md-sal/samples/toaster-consumer/pom.xml
opendaylight/md-sal/samples/toaster-consumer/src/main/java/org/opendaylight/controller/config/yang/config/kitchen_service/impl/KitchenServiceModule.java
opendaylight/md-sal/samples/toaster-consumer/src/main/java/org/opendaylight/controller/sample/kitchen/api/KitchenService.java
opendaylight/md-sal/samples/toaster-consumer/src/main/java/org/opendaylight/controller/sample/kitchen/impl/KitchenServiceImpl.java
opendaylight/md-sal/samples/toaster-it/src/test/java/org/opendaylight/controller/sample/toaster/it/ToasterTest.java
opendaylight/md-sal/samples/toaster-it/src/test/resources/logback.xml
opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/OpendaylightToaster.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsRequestScheduler.java
opendaylight/netconf/config-netconf-connector/pom.xml
opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/osgi/TestingExceptionHandler.java
opendaylight/netconf/netconf-cli/.gitignore [new file with mode: 0644]
opendaylight/netconf/netconf-cli/README [new file with mode: 0644]
opendaylight/netconf/netconf-cli/README_ODL [new file with mode: 0644]
opendaylight/netconf/netconf-cli/pom.xml [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/Cli.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/CommandArgHandlerRegistry.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/Main.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/NetconfDeviceConnectionHandler.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/NetconfDeviceConnectionManager.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/SchemaContextRegistry.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/AbstractCommand.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/Command.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/CommandConstants.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/CommandDispatcher.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/CommandInvocationException.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/input/Input.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/input/InputDefinition.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/local/Close.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/local/Connect.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/local/Disconnect.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/local/Help.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/output/Output.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/output/OutputDefinition.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/remote/RemoteCommand.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/io/BaseConsoleContext.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/io/ConsoleContext.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/io/ConsoleIO.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/io/ConsoleIOImpl.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/io/IOUtil.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/AbstractReader.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/GenericListEntryReader.java [moved from opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/remote/RemoteRpcRouter.java with 51% similarity]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/Reader.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/ReadingException.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/custom/ConfigReader.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/custom/EditContentReader.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/custom/FilterReader.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/custom/PasswordReader.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/AnyXmlReader.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/BasicDataHolderReader.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/ChoiceReader.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/ContainerReader.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/DecisionReader.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/GenericListReader.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/GenericReader.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/LeafListEntryReader.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/LeafReader.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/ListEntryReader.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/SeparatedNodes.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/UnionTypeReader.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/OutFormatter.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/WriteException.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/Writer.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/custom/DataWriter.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/AbstractWriter.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/AugmentationNodeCliSerializer.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/ChoiceNodeCliSerializer.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/CliOutputFromNormalizedNodeSerializerFactory.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/CompositeNodeWriter.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/ContainerNodeCliSerializer.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/LeafNodeCliSerializer.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/LeafSetEntryNodeCliSerializer.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/LeafSetNodeCliSerializer.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/MapEntryNodeCliSerializer.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/MapNodeCliSerializer.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NodeCliSerializerDispatcher.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NormalizedNodeWriter.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/resources/logback.xml [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/resources/schema/common/ietf-inet-types.yang [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/resources/schema/common/netconf-cli-ext.yang [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/resources/schema/local/netconf-cli.yang [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/main/resources/schema/remote/ietf-netconf.yang [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/test/java/org/opendaylight/controller/netconf/cli/ConsoleIOTestImpl.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/test/java/org/opendaylight/controller/netconf/cli/NetconfCliTest.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/test/java/org/opendaylight/controller/netconf/cli/ValueForMessages.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/test/java/org/opendaylight/controller/netconf/cli/io/IOUtilTest.java [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/test/resources/schema-context/ietf-inet-types.yang [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/test/resources/schema-context/ietf-netconf.yang [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/test/resources/schema-context/model1.yang [new file with mode: 0644]
opendaylight/netconf/netconf-cli/src/test/resources/schema-context/model2.yang [new file with mode: 0644]
opendaylight/netconf/pom.xml
pom.xml

diff --git a/features/adsal/pom.xml b/features/adsal/pom.xml
new file mode 100644 (file)
index 0000000..0ccb17a
--- /dev/null
@@ -0,0 +1,73 @@
+<?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-adsal</artifactId>
+  <version>${sal.version}</version>
+  <packaging>pom</packaging>
+  <name>Features :: AD-SAL Features</name>
+  <description>AD-SAL Features POM</description>
+  <properties>
+    <features.file>features.xml</features.file>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>base-features</artifactId>
+      <version>${project.parent.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>
+</project>
diff --git a/features/adsal/src/main/resources/features.xml b/features/adsal/src/main/resources/features.xml
new file mode 100644 (file)
index 0000000..f955315
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<features name="adsal-${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-adsal-all" description="OpenDaylight AD-SAL All Features" version="${sal.version}">
+      <feature version="${sal.version}">odl-adsal-core</feature>
+      <feature version="${sal.networkconfiguration.version}">odl-adsal-networkconfiguration</feature>
+      <feature version="${sal.connection.version}">odl-adsal-connection</feature>
+      <feature version="${clustering.services.version}">odl-adsal-clustering</feature>
+      <feature version="${configuration.version}">odl-adsal-configuration</feature>
+   </feature>
+   <feature name="odl-adsal-core" description="OpenDaylight :: AD-SAL :: Core" version="${sal.version}">
+      <feature>base-felix-dm</feature>
+      <feature>base-dummy-console</feature>
+      <feature version="${project.version}">odl-adsal-thirdparty</feature>
+      <bundle start="true" start-level="35">mvn:org.apache.commons/commons-lang3/${commons.lang3.version}</bundle>
+  <!--    <bundle>mvn:org.osgi/org.osgi.compendium/${osgi.compendium.version}</bundle> -->
+      <bundle>mvn:org.opendaylight.controller/sal/${sal.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/sal.implementation/${sal.implementation.version}</bundle>
+   </feature>
+   <feature name="odl-adsal-networkconfiguration" description="OpenDaylight :: AD-SAL :: Network Configuration" version="${sal.networkconfiguration.version}">
+      <bundle>mvn:org.opendaylight.controller/sal.networkconfiguration/${sal.networkconfiguration.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/sal.networkconfiguration.implementation/${sal.networkconfiguration.version}</bundle>
+   </feature>
+   <feature name="odl-adsal-connection" description="OpenDaylight :: AD-SAL :: Connection" version="${sal.connection.version}">
+      <feature>odl-adsal-core</feature>
+      <bundle>mvn:org.opendaylight.controller/sal.connection/${sal.connection.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/sal.connection.implementation/${sal.connection.version}</bundle>
+   </feature>
+   <feature name="odl-adsal-clustering" description="OpenDaylight :: AD-SAL :: Clustering" version="${clustering.services.version}">
+      <feature>transaction</feature>
+      <feature>base-felix-dm</feature>
+      <feature>base-eclipselink-persistence</feature>
+      <feature version="${sal.version}">odl-adsal-core</feature>
+      <bundle>mvn:org.opendaylight.controller/clustering.services/${clustering.services.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/clustering.services-implementation/${clustering.services_implementation.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/clustering.stub/${clustering.stub.version}</bundle>
+   </feature>
+   <feature name="odl-adsal-configuration" description="OpenDaylight :: AD-SAL :: Configuration" version="${configuration.version}">
+      <feature version="${sal.version}">odl-adsal-core</feature>
+      <feature version="${clustering.services.version}">odl-adsal-clustering</feature>
+      <bundle>mvn:org.opendaylight.controller/configuration/${configuration.version}</bundle>
+      <bundle>mvn:org.opendaylight.controller/configuration.implementation/${configuration.implementation.version}</bundle>
+   </feature>
+   <feature name="odl-adsal-thirdparty" description="OpenDaylight :: AD-SAL :: Third-Party Depenencies" version="${project.version}">
+      <bundle>mvn:org.opendaylight.controller/logging.bridge/${logging.bridge.version}</bundle>
+   </feature>
+</features>
diff --git a/features/extras/pom.xml b/features/extras/pom.xml
new file mode 100644 (file)
index 0000000..4563190
--- /dev/null
@@ -0,0 +1,81 @@
+<?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>extras-features</artifactId>
+  <packaging>kar</packaging>
+  <name>${project.artifactId}</name>
+  <description>Base Features POM</description>
+  <properties>
+    <features.file>features.xml</features.file>
+    <netty3.version>3.9.2.Final</netty3.version>
+  </properties>
+  <build>
+    <resources>
+      <resource>
+        <filtering>true</filtering>
+        <directory>src/main/resources</directory>
+      </resource>
+    </resources>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.karaf.tooling</groupId>
+        <artifactId>karaf-maven-plugin</artifactId>
+        <version>${karaf.version}</version>
+        <extensions>true</extensions>
+        <executions>
+          <execution>
+            <id>features-create-kar</id>
+            <goals>
+              <goal>features-create-kar</goal>
+            </goals>
+            <configuration>
+              <featuresFile>${project.build.directory}/classes/${features.file}</featuresFile>
+            </configuration>
+          </execution>
+        </executions>
+        <!-- There is no useful configuration for the kar mojo. The features-generate-descriptor mojo configuration may be useful -->
+      </plugin>
+      <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/extras/src/main/resources/features.xml b/features/extras/src/main/resources/features.xml
new file mode 100644 (file)
index 0000000..3be66d9
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<features name="extras-features-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.0.0">
+
+   <feature name="osgi-compendium" description="OSGi compendium feature" version="${osgi.version}" resolver="(obr)">
+      <bundle start-level="10">mvn:org.osgi/org.osgi.compendium/${osgi.compendium.version}</bundle>
+   </feature>
+
+   <feature name="odl-extras-scala" description="Scala Runtime for OpenDaylight" version="${scala.version}" resolver="(obr)" start-level="10">
+      <bundle>mvn:org.scala-lang/scala-library/${scala.version}.${scala.micro.version}</bundle>
+      <bundle>mvn:org.scala-lang/scala-reflect/${scala.version}.${scala.micro.version}</bundle>
+   </feature>
+
+   <feature name="odl-extras-akka-system" description="Akka Actor Framework System Bundles" version="${akka.version}" resolver="(obr)" start-level="15">
+      <feature version="${scala.version}">odl-extras-scala</feature>
+      <bundle dependency="true">mvn:com.typesafe/config/${typesafe.config.version}</bundle>
+      <bundle dependency="true">mvn:com.typesafe.akka/akka-actor_${scala.version}/${akka.version}</bundle>
+      <bundle dependency="true">mvn:com.typesafe.akka/akka-slf4j_${scala.version}/${akka.version}</bundle>
+      <bundle>mvn:com.typesafe.akka/akka-osgi_${scala.version}/${akka.version}</bundle>
+   </feature>
+
+   <feature name="odl-extras-akka-clustering" description="Akka Clustering Support" version="${akka.version}" resolver="(obr)" start-level="20">
+      <feature version="${akka.version}">odl-extras-akka-system</feature>
+      <bundle dependency="true">wrap:mvn:org.uncommons.maths/uncommons-maths/${uncommons.maths.version}</bundle>
+      <bundle dependency="true">mvn:com.google.protobuf/protobuf-java/${protobuf.version}</bundle>
+      <bundle dependency="true">wrap:mvn:io.netty/netty/${netty3.version}</bundle>
+      <bundle>mvn:com.typesafe.akka/akka-remote_${scala.version}/${akka.version}</bundle>
+      <bundle>mvn:com.typesafe.akka/akka-cluster_${scala.version}/${akka.version}</bundle>
+   </feature>
+
+   <feature name='odl-extras-leveldb' description='LevelDB feature' version='0.7' resolver='(obr)'>
+      <bundle start-level="20">wrap:mvn:org.iq80.leveldb/leveldb/${leveldb.version}</bundle>
+      <bundle start-level="20">wrap:mvn:org.fusesource.leveldbjni/leveldbjni-all/${leveldbjni.version}</bundle>
+   </feature>
+</features>
index de8caa0e6747179c4f893c64a9c508ed7b80247d..bf84183b75b755b9099374d3d2365432a9621288 100644 (file)
@@ -18,7 +18,7 @@
 
   <properties>
 
-    <akka.version>2.3.2</akka.version>
+    <akka.version>2.3.4</akka.version>
     <aopalliance.version>1.0.0</aopalliance.version>
     <appauth.version>0.4.2-SNAPSHOT</appauth.version>
     <archetype-app-northbound>0.0.1-SNAPSHOT</archetype-app-northbound>
@@ -43,7 +43,6 @@
     <commons.catalina.ha>7.0.32.v201211201952</commons.catalina.ha>
     <commons.catalina.tribes>7.0.32.v201211201952</commons.catalina.tribes>
     <commons.checkstyle.version>0.0.3-SNAPSHOT</commons.checkstyle.version>
-    <commons.codec.version>1.7</commons.codec.version>
     <commons.coyote>7.0.32.v201211201952</commons.coyote>
     <commons.el>7.0.32.v201211081135</commons.el>
     <commons.fileupload.version>1.2.2</commons.fileupload.version>
@@ -63,6 +62,7 @@
     <compiler.version>2.3.2</compiler.version>
     <commons.httpclient.version>0.1.2-SNAPSHOT</commons.httpclient.version>
     <concepts.version>0.5.2-SNAPSHOT</concepts.version>
+    <concurrentlinkedhashmap.version>1.4</concurrentlinkedhashmap.version>
     <config.version>0.2.5-SNAPSHOT</config.version>
     <configuration.implementation.version>0.4.3-SNAPSHOT</configuration.implementation.version>
     <configuration.version>0.4.3-SNAPSHOT</configuration.version>
     <karaf.branding.version>1.0.0-SNAPSHOT</karaf.branding.version>
     <karaf.shell.version>3.0.0</karaf.shell.version>
     <karaf.version>3.0.1</karaf.version>
+    <leveldb.version>0.7</leveldb.version>
+    <leveldbjni.version>1.8</leveldbjni.version>
     <lifecycle.mapping.version>1.0.0</lifecycle.mapping.version>
     <logback.version>1.0.9</logback.version>
     <logging.bridge.version>0.4.2-SNAPSHOT</logging.bridge.version>
     <maven.plugin.api.version>3.0.5</maven.plugin.api.version>
+    <mimepull.version>1.9.4</mimepull.version>
     <mdsal.version>1.1-SNAPSHOT</mdsal.version>
     <netconf.version>0.2.5-SNAPSHOT</netconf.version>
     <networkconfig.bridgedomain.northbound.version>0.0.3-SNAPSHOT</networkconfig.bridgedomain.northbound.version>
     <northbound.jolokia.version>1.4.2-SNAPSHOT</northbound.jolokia.version>
     <opendaylight-l2-types.version>2013.08.27.4-SNAPSHOT</opendaylight-l2-types.version>
     <osgi-brandfragment.web.version>0.0.2-SNAPSHOT</osgi-brandfragment.web.version>
+    <parboiled.version>1.1.6</parboiled.version>
+    <parboiled.scala.version>1.1.6</parboiled.scala.version>
     <propertymavenplugin.version>1.0-alpha-2</propertymavenplugin.version>
+    <protobuf.version>2.5.0</protobuf.version>
     <protocol-framework.version>0.5.0-SNAPSHOT</protocol-framework.version>
     <protocol_plugins.openflow.version>0.4.2-SNAPSHOT</protocol_plugins.openflow.version>
     <protocol_plugins.stub.version>0.4.2-SNAPSHOT</protocol_plugins.stub.version>
     <samples.loadbalancer.northbound.version>0.4.2-SNAPSHOT</samples.loadbalancer.northbound.version>
     <samples.simpleforwarding.version>0.4.2-SNAPSHOT</samples.simpleforwarding.version>
     <sanitytest.version>0.4.2-SNAPSHOT</sanitytest.version>
-    <scala.version>2.11</scala.version>
+    <scala.version>2.10</scala.version>
+    <scala.micro.version>4</scala.micro.version>
     <security.version>0.4.2-SNAPSHOT</security.version>
+    <shapeless.version>1.2.4</shapeless.version>
     <sitedeploy>dav:http://nexus.opendaylight.org/content/sites/site</sitedeploy>
     <sonar.branch>${user.name}-private-view</sonar.branch>
     <sonar.host.url>https://sonar.opendaylight.org/</sonar.host.url>
     <!-- Sonar properties using jacoco to retrieve integration test results -->
     <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
     <sonar.language>java</sonar.language>
+    <sonar.skippedModules>org.openflow.openflowj,net.sf.jung2,org.opendaylight.controller.protobuff.messages</sonar.skippedModules>
+    <spifly.version>1.0.0</spifly.version>
+    <spring-osgi.version>1.2.1</spring-osgi.version>
+    <spring-security-karaf.version>3.1.4.RELEASE</spring-security-karaf.version>
+    <spring-security.version>3.1.3.RELEASE</spring-security.version>
+    <spring.version>3.1.3.RELEASE</spring.version>
     <sonar.skippedModules>org.openflow.openflowj,net.sf.jung2</sonar.skippedModules>
     <statistics.northbound.version>0.4.2-SNAPSHOT</statistics.northbound.version>
     <statisticsmanager.implementation.version>0.4.2-SNAPSHOT</statisticsmanager.implementation.version>
     <topology.web.version>0.4.2-SNAPSHOT</topology.web.version>
     <topologymanager.version>0.4.2-SNAPSHOT</topologymanager.version>
     <troubleshoot.web.version>0.4.2-SNAPSHOT</troubleshoot.web.version>
+    <typesafe.config.version>1.2.0</typesafe.config.version>
+    <uncommons.maths.version>1.2.2</uncommons.maths.version>
     <usermanager.implementation.version>0.4.2-SNAPSHOT</usermanager.implementation.version>
     <usermanager.northbound.version>0.0.2-SNAPSHOT</usermanager.northbound.version>
     <usermanager.version>0.4.2-SNAPSHOT</usermanager.version>
index 249513006987eb334b4cd4f4084ce0d08c752713..a62bd7da06501b355c41f36230dbf30a982d61fa 100644 (file)
@@ -12,6 +12,7 @@ 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.ChannelFuture;
 import io.netty.channel.ChannelInitializer;
 import io.netty.channel.ChannelOption;
@@ -113,6 +114,7 @@ public abstract class AbstractDispatcher<S extends ProtocolSession<?>, L extends
             // makes no sense for LocalServer and produces warning
             b.childOption(ChannelOption.SO_KEEPALIVE, true);
         }
+        b.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
         customizeBootstrap(b);
 
         if (b.group() == null) {
index 6ddb1306c559633193b2d6e897ad09d9499ee7f1..ae041f45852fd484e2f3a51cf80059211bc36294 100644 (file)
@@ -20,6 +20,7 @@
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>config-api</artifactId>
+            <version>${config.version}</version>
         </dependency>
     </dependencies>
 
index b6e2efcd457653f6414ac381eb80018b0e4249f8..7429f4d57431c9922d9a33ef5e8053ef1cfd174f 100644 (file)
@@ -8,7 +8,7 @@
     <relativePath>..</relativePath>
   </parent>
   <artifactId>config-util</artifactId>
-  <packaging>jar</packaging>
+  <packaging>bundle</packaging>
   <name>${project.artifactId}</name>
 
   <dependencies>
           <threadCount>1</threadCount>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <configuration>
+          <instructions>
+            <Export-Package>org.opendaylight.controller.config.util</Export-Package>
+          </instructions>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 
index 81972c366105a7ecdee940fdec8b6e184bbb7215..a84a74305fa5f480f5d6599f8553fb00c7bac4c3 100644 (file)
@@ -1,27 +1,28 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <features name="config-${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='config-all' version='${project.version}'>
-        <feature version='${project.version}'>odl-config-subsystem</feature>
-    </feature>
+          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='config-all' version='${project.version}'>
+    <feature version='${project.version}'>odl-config-subsystem</feature>
+  </feature>
 
-    <feature name='odl-config-subsystem' version='${project.version}'>
-        <feature version='${yangtools.version}'>yangtools-concepts</feature>
-        <feature version='${yangtools.version}'>yangtools-binding</feature>
-        <feature version='${yangtools.version}'>yangtools-binding-generator</feature>
-        <feature version='${mdsal.version}'>odl-mdsal-commons</feature>
-        <bundle>mvn:org.opendaylight.controller/config-api/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.controller/config-manager/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.controller/yang-jmx-generator/${project.version}</bundle>
-        <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/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:org.javassist/javassist/${javassist.version}</bundle>
-    </feature>
+  <feature name='odl-config-subsystem' version='${project.version}'>
+    <feature version='${yangtools.version}'>yangtools-concepts</feature>
+    <feature version='${yangtools.version}'>yangtools-binding</feature>
+    <feature version='${yangtools.version}'>yangtools-binding-generator</feature>
+    <feature version='${mdsal.version}'>odl-mdsal-commons</feature>
+    <bundle>mvn:org.opendaylight.controller/config-api/${project.version}</bundle>
+    <bundle>mvn:org.opendaylight.controller/config-util/${project.version}</bundle>
+    <bundle>mvn:org.opendaylight.controller/config-manager/${project.version}</bundle>
+    <bundle>mvn:org.opendaylight.controller/yang-jmx-generator/${project.version}</bundle>
+    <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/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:org.javassist/javassist/${javassist.version}</bundle>
+  </feature>
 </features>
\ No newline at end of file
index 76fbd7f6e55c057e6248fed354da9c8f801da2bb..a8a4c87a4eaa9f28a3e6656390bb27accbdd1f67 100644 (file)
@@ -1,5 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
 <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>
 
index 8a23a6b5e60e64a6baaf20fd9d7d9712894f57dd..221bfa78e8972822b43894cd039b306456839e3b 100644 (file)
       <version>${karaf.version}</version>
       <type>kar</type>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>base-features</artifactId>
+      <version>${project.version}</version>
+      <type>kar</type>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>karaf.branding</artifactId>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>base-features</artifactId>
+      <version>${project.parent.version}</version>
+      <classifier>features</classifier>
+      <type>xml</type>
+      <scope>runtime</scope>
+    </dependency>
+    <!-- scope is compile so all features (there is only one) are installed
+            into startup.properties and the feature repo itself is not installed -->
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>extras-features</artifactId>
       <version>${project.version}</version>
       <type>kar</type>
       <scope>runtime</scope>
       <type>xml</type>
       <scope>runtime</scope>
     </dependency>
-    <!--<dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>base-features</artifactId>
-      <version>${project.version}</version>
-      <classifier>features</classifier>
-      <type>xml</type>
-      <scope>runtime</scope>
-    </dependency>-->
-    <!-- <dependency>
+    <dependency>
       <groupId>org.opendaylight.controller</groupId>
-      <artifactId>controller-features</artifactId>
-      <version>${project.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>mdsal-features</artifactId>
index ef3b5f4fd99e79a3449fcb5846cac80f6271b332..d238ee75cc1f0bd8df7bb52931c4499917f56db9 100644 (file)
           <groupId>org.opendaylight.controller</groupId>
           <artifactId>config-manager</artifactId>
         </dependency>
+        <dependency>
+          <groupId>org.opendaylight.controller</groupId>
+          <artifactId>config-util</artifactId>
+        </dependency>
         <dependency>
           <groupId>org.opendaylight.controller</groupId>
           <artifactId>config-netconf-connector</artifactId>
           <groupId>org.opendaylight.controller.model</groupId>
           <artifactId>model-flow-base</artifactId>
         </dependency>
-        <dependency>
-          <groupId>org.opendaylight.controller.model</groupId>
-          <artifactId>model-flow-management</artifactId>
-        </dependency>
         <dependency>
           <groupId>org.opendaylight.controller.model</groupId>
           <artifactId>model-flow-service</artifactId>
index f05afbb346f7f157162b313981874c4d3d6bdd40..b2fc3cb386ffa4525fb42dd3fae685c7b6a39e97 100644 (file)
@@ -113,8 +113,8 @@ org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true
 ovsdb.listenPort=6640
 
 # ovsdb creates Openflow nodes/bridges. This configuration configures the bridge's Openflow version.
-# default Openflow version = 1.0, we also support 1.3.
-ovsdb.of.version=1.3
+# default Openflow version = 1.3, we also support 1.0.
+ovsdb.of.version=1.3
 
 # TLS configuration
 # To enable TLS, set secureChannelEnabled=true and specify the location of controller Java KeyStore and TrustStore files.
@@ -149,3 +149,6 @@ hosttracker.keyscheme=IP
 lisp.mappingOverwrite = true
 # Enable the Solicit-Map-Request (SMR) mechanism
 lisp.smr = false
+
+#RESTConf websocket listen port (default is 8181)
+restconf.websocket.port=8181
index afeddbfaabc6283fa9352cc543e23db43310871e..38df344f858641d60d4913e0dc251efc6427d64d 100644 (file)
                     </schema-service>
                 </module>
 
+                <!-- DISTRIBUTED_DATA_STORE -->
+                <!-- Enable the following modules if you want to use the Distributed Data Store instead of the InMemoryDataStore -->
+                <!--
+                <module>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:distributed-datastore-provider">prefix:distributed-operational-datastore-provider</type>
+                    <name>distributed-operational-store-module</name>
+                    <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>
+
+                <module>
+                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:distributed-datastore-provider">prefix:distributed-config-datastore-provider</type>
+                    <name>distributed-config-store-module</name>
+                    <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>
+                -->
+
                 <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>
@@ -59,7 +81,6 @@
                         <name>yang-schema-service</name>
                     </schema-service>
                 </module>
-
                 <!--
                      Tree-based in-memory data store. This is the data store which is currently
                      recommended for single-node deployments.
                    <config-data-store>
                         <type xmlns:config-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:config-dom-store">config-dom-store-spi:config-dom-datastore</type>
                         <name>config-store-service</name>
+                        <!-- DISTRIBUTED_DATA_STORE -->
+                        <!--
+                        <name>distributed-config-store-service</name>
+                        -->
                     </config-data-store>
 
                     <operational-data-store>
                         <type xmlns:operational-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:operational-dom-store">operational-dom-store-spi:operational-dom-datastore</type>
                         <name>operational-store-service</name>
+                        <!-- DISTRIBUTED_DATA_STORE -->
+                        <!--
+                        <name>distributed-operational-store-service</name>
+                        -->
+
                     </operational-data-store>
                 </module>
                 <module>
                             <provider>/modules/module[type='schema-service-singleton'][name='yang-schema-service']</provider>
                         </instance>
                     </service>
+
+                <!-- DISTRIBUTED_DATA_STORE -->
+                <!-- Enable the following if you want to use the Distributed Data Store instead of the InMemory Data Store -->
+                <!-- Note that you MUST delete the InMemoryDataStore related services which provide config-dom-datastore and operational-dom-datastore -->
+                <!--
+                <service>
+                    <type xmlns:config-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:config-dom-store">config-dom-store-spi:config-dom-datastore</type>
+                    <instance>
+                        <name>distributed-config-store-service</name>
+                        <provider>/modules/module[type='distributed-config-datastore-provider'][name='distributed-config-store-module']</provider>
+                    </instance>
+                </service>
+                <service>
+                    <type xmlns:operational-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:operational-dom-store">operational-dom-store-spi:operational-dom-datastore</type>
+                    <instance>
+                        <name>distributed-operational-store-service</name>
+                        <provider>/modules/module[type='distributed-operational-datastore-provider'][name='distributed-operational-store-module']</provider>
+                    </instance>
+                </service>
+                -->
+
+                <!-- DISTRIBUTED_DATA_STORE -->
+                <!-- Delete the following two services (config-store-service and operational-store-service) if you want to use the distributed data store instead -->
                 <service>
                     <type xmlns:config-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:config-dom-store">config-dom-store-spi:config-dom-datastore</type>
                     <instance>
diff --git a/opendaylight/distribution/opendaylight/src/main/resources/functions.sh b/opendaylight/distribution/opendaylight/src/main/resources/functions.sh
new file mode 100644 (file)
index 0000000..21dd4c1
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# Function harvestHelp searches in run.sh part for line starting with "##<name command>".
+# Next lines starting with "#<text>" will be printed without first char # (=help content).
+# Help content has to end with "##" on new line.
+# Example:
+##foo
+#   Foo is world wide used synnonym for bar.
+##
+function harvestHelp() {
+    key="$1"
+    if [ -z "${key}" ]; then
+         key='HELP'
+    fi
+    echo
+    sed -rn "/^##${key}$/,/^##/ p" $0 | sed -r '1 d; $ d; s/^#/  /'
+    grep "##${key}" $0 > /dev/null
+}
index 72ccd02707ba7f5c76f064e5a16767a42f5fd37f..ce13e3396862a042a37aeb89dad5b3ca66d59094 100644 (file)
@@ -14,6 +14,7 @@ SET jvmMaxMemory=
 SET extraJVMOpts=
 SET consoleOpts=-console -consoleLog
 SET PID=
+SET JAVA_H=%JAVA_HOME%\bin\jps.exe
 
 :LOOP
 IF "%~1" NEQ "" (
@@ -61,7 +62,7 @@ IF "%~1" NEQ "" (
        GOTO :LOOP
     )
     IF "!CARG!"=="-status" (
-       for /F "TOKENS=1" %%G in ('%JAVA_HOME%\bin\jps.exe -lvV ^| find /I "opendaylight"') do (
+       for /F "TOKENS=1" %%G in ('""!JAVA_H!" -lvV ^| find /I "opendaylight""') do (
            set PID=%%G
        )
        if "!PID!" NEQ "" (
@@ -72,7 +73,7 @@ IF "%~1" NEQ "" (
        GOTO :EOF
     )
     IF "!CARG!"=="-stop" (
-       for /F "TOKENS=1" %%G in ('%JAVA_HOME%\bin\jps.exe -lvV ^| find /I "opendaylight"') do (
+       for /F "TOKENS=1" %%G in ('""!JAVA_H!" -lvV ^| find /I "opendaylight""') do (
            set PID=%%G
        )
        if "!PID!" NEQ "" (
@@ -89,18 +90,23 @@ IF "%~1" NEQ "" (
        GOTO :LOOP
     )
     IF "!CARG:~0,2!"=="-D" (
-       SET extraJVMOpts=%extraJVMOpts% !CARG!
+       SET extraJVMOpts=!extraJVMOpts! !CARG!
        SHIFT
        GOTO :LOOP
     )
     IF "!CARG:~0,2!"=="-X" (
-       SET extraJVMOpts=%extraJVMOpts% !CARG!
+       SET extraJVMOpts=!extraJVMOpts! !CARG!
        SHIFT
        GOTO :LOOP
     )
     IF "!CARG!"=="-help" (
-        ECHO "Usage: %0 [-jmx] [-jmxport <num>] [-debug] [-debugsuspend] [-debugport <num>] [-start] [-consoleport <num>]] [-stop] [-status] [-console] [-help] [<other args will automatically be used for the JVM>]"
-        ECHO Note: Enclose any JVM or System properties within double quotes.
+        SHIFT
+        SET CARG=%2
+        IF "!CARG!" NEQ "" (
+             CALL:!CARG!
+        ) ELSE (
+              CALL:helper
+         )
         GOTO :EOF
     )
 
@@ -110,28 +116,24 @@ IF "%~1" NEQ "" (
 
 IF "%debugEnabled%" NEQ "" (
     REM ECHO "DEBUG enabled"
-    SET extraJVMOpts=%extraJVMOpts% -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=%debugport%
+    SET extraJVMOpts=!extraJVMOpts! -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=%debugport%
 )
+
 IF "%debugSuspended%" NEQ "" (
     REM ECHO "DEBUG enabled suspended"
-    SET extraJVMOpts=%extraJVMOpts% -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=%debugport%
+    SET extraJVMOpts=!extraJVMOpts! -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=%debugport%
 )
 
 IF "%jvmMaxMemory%"=="" (
     SET jvmMaxMemory=-Xmx1G
-    ECHO *****************************************************************
-    ECHO JVM maximum memory was not defined. Setting maximum memory to 1G.
-    ECHO To define the maximum memory, specify the -Xmx setting on the
-    ECHO command line.
-    ECHO                    e.g. run.bat -Xmx1G
-    ECHO *****************************************************************"
+    ECHO Setting maximum memory to 1G.
 )
 
-SET extraJVMOpts=%extraJVMOpts%  %jvmMaxMemory%
+SET extraJVMOpts=!extraJVMOpts!  %jvmMaxMemory%
 
 IF "%jmxEnabled%" NEQ "" (
     REM ECHO "JMX enabled "
-    SET extraJVMOpts=%extraJVMOpts% -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=%jmxport% -Dcom.sun.management.jmxremote
+    SET extraJVMOpts=!extraJVMOpts! -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=%jmxport% -Dcom.sun.management.jmxremote
 )
 IF "%startEnabled%" NEQ "" (
     REM ECHO "START enabled "
@@ -139,7 +141,7 @@ IF "%startEnabled%" NEQ "" (
 )
 
 REM       Check if controller is already running
-for /F "TOKENS=1" %%G in ('%JAVA_HOME%\bin\jps.exe -lvV ^| find /I "opendaylight"') do (
+for /F "TOKENS=1" %%G in ('""!JAVA_H!" -lvV ^| find /I "opendaylight""') do (
     SET PID=%%G
 )
 if "!PID!" NEQ "" (
@@ -154,16 +156,125 @@ SET cp="%basedir%lib\org.eclipse.osgi-3.8.1.v20120830-144521.jar;%basedir%lib\or
 REM       Now set framework classpath
 SET fwcp="file:\%basedir%lib\org.eclipse.osgi-3.8.1.v20120830-144521.jar,file:\%basedir%lib\org.eclipse.virgo.kernel.equinox.extensions-3.6.0.RELEASE.jar,file:\%basedir%lib\org.eclipse.equinox.launcher-1.3.0.v20120522-1813.jar"
 
-SET RUN_CMD="%JAVA_HOME%\bin\java.exe" -Dopendaylight.controller %extraJVMOpts% -Djava.io.tmpdir="%basedir%work\tmp" -Djava.awt.headless=true -Dosgi.install.area=%basedir% -Dosgi.configuration.area="%basedir%configuration" -Dosgi.frameworkClassPath=%fwcp% -Dosgi.framework="file:\%basedir%lib\org.eclipse.osgi-3.8.1.v20120830-144521.jar" -classpath %cp% org.eclipse.equinox.launcher.Main %consoleOpts%
+SET RUN_CMD="%JAVA_HOME%\bin\java.exe" -Dopendaylight.controller !extraJVMOpts! -Djava.io.tmpdir="%basedir%work\tmp" -Djava.awt.headless=true -Dosgi.install.area=%basedir% -Dosgi.configuration.area="%basedir%configuration" -Dosgi.frameworkClassPath=%fwcp% -Dosgi.framework="file:\%basedir%lib\org.eclipse.osgi-3.8.1.v20120830-144521.jar" -classpath %cp% org.eclipse.equinox.launcher.Main %consoleOpts%
 
-ECHO %RUN_CMD%
+ECHO !RUN_CMD!
 
 if "%startEnabled%" NEQ "" (
-    START /B cmd /C CALL %RUN_CMD% > %basedir%\logs\controller.out 2>&1
+    START /B cmd /C CALL !RUN_CMD! > %basedir%\logs\controller.out 2>&1
     ECHO Running controller in the background.
+    EXIT /B 1
 ) else (
-    %RUN_CMD%
+    !RUN_CMD!
     EXIT /B %ERRORLEVEL%
 )
 
+:helper
+echo. For more information on a specific command, type -help command-name.
+echo.
+echo   jmx              ^[-jmx^]
+echo   jmxport          ^[-jmxport ^<num^>^] - DEFAULT is 1088
+echo   debug            ^[-debug^]
+echo   debugsuspend     ^[-debugsuspend^]
+echo   debugport        ^[-debugport ^<num^>^] - DEFAULT is 8000
+echo   start            ^[-start ^[^<console port^>^]^] - DEFAULT port is 2400
+echo   stop             ^[-stop^]
+echo   status           ^[-status^]
+echo   console          ^[-console^]
+echo   agentpath        ^[-agentpath:^<path to lib^>^]
+exit/B 1
+
+:debugsuspend
+ECHO.
+ECHO. debugsuspend     ^[-debugsuspend^]
+ECHO.
+ECHO. This command sets suspend on true in runjdwp in extra JVM options. If its true, VMStartEvent has a suspendPolicy of SUSPEND_ALL. If its false, VMStartEvent has a suspendPolicy of SUSPEND_NONE.
+ECHO.
+EXIT /B 1
+
+:debugport
+ECHO.
+ECHO. debugport        ^[-debugport ^<num^>^] - DEFAULT is 8000
+ECHO.
+ECHO. Set address for settings in runjdwp in extra JVM options.
+ECHO. The address is transport address for the connection.
+ECHO. The address has to be in the range ^[1024,65535^]. If the option was not call, port will be set to default value.
+ECHO.
+EXIT /B 1
+
+:jmxport
+ECHO.
+ECHO. jmxport          ^[-jmxport ^<num^>^] - DEFAULT is 1088
+ECHO.
+ECHO.    Set jmx port for com.sun.management.jmxremote.port in JMX support. Port has to be in the range ^[1024,65535^]. If this option was not call, port will be set to default value.
+ECHO.
+EXIT /B 1
+
+:debug
+ECHO.
+ECHO. debug            [-debug]
+ECHO.
+ECHO. Run ODL controller with -Xdebug and -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=^$^{debugport^}
+ECHO.
+ECHO.    -Xdebug enables debugging capabilities in the JVM which are used by the Java Virtual Machine Tools Interface (JVMTI). JVMTI is a low-level debugging interface used by debuggers and profiling tools.
+ECHO.
+ECHO.    -Xrunjdwp option loads the JPDA reference implementation of JDWP. This library resides in the target VM and uses JVMDI and JNI to interact with it. It uses a transport and the JDWP protocol to communicate with a separate debugger application.
+ECHO.
+ECHO. settings for -Xrunjdwp:
+ECHO.            transport -  name of the transport to use in connecting to debugger application
+ECHO.            server    -  if 'y', listen for a debugger application to attach; otherwise, attach to the debugger application at the specified address
+ECHO.                      -  if 'y' and no address is specified, choose a transport address at which to listen for a debugger application, and print the address to the standard output stream
+ECHO.            suspend   -  if 'y', VMStartEvent has a suspend Policy of SUSPEND_ALL
+ECHO.                      -  if 'n', VMStartEvent has a suspend policy of SUSPEND_NONE
+ECHO.            address   -  transport address for the connection
+ECHO.                      -  if server=n, attempt to attach to debugger application at this address
+ECHO.          -  if server=y, listen for a connection at this address
+ECHO.
+EXIT /B 1
+
+:jmx
+ECHO.
+ECHO. jmx              [-jmx]
+ECHO.
+ECHO. Add JMX support. With settings for extra JVM options: -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=^$^{jmxport^} -Dcom.sun.management.jmxremote
+ECHO. jmxport can by set with option -jmxport ^<num^>. Default num for the option is 1088.
+ECHO.
+EXIT /B 1
+
+:stop
+ECHO.
+ECHO. stop             ^[-stop^]
+ECHO.
+ECHO. If a controller is running, the command stop controller. Pid will be clean.
+ECHO.
+EXIT /B 1
+
+:status
+ECHO.
+ECHO. status           ^[-status^]
+ECHO.
+ECHO. Find out whether a controller is running and print it.
+ECHO.
+EXIT /B 1
+
+:start
+ECHO.
+ECHO. start            ^[-start ^[^<console port^>^]^]
+ECHO.
+ECHO.    If controller is not running, the command with argument^(for set port, where controller has start^) will start new controller on a port. The port has to be in the range ^[1024,65535^]. If this option was not call, port will be set to default value. Pid will be create.
+EXIT /B 1
+
+:console
+ECHO.
+ECHO. console          [-console]
+ECHO.     Default option.
+EXIT /B 1
+
+:agentpath
+ECHO.
+ECHO. agentpath        ^[-agentpath:^<path to lib^>^]
+ECHO.
+ECHO.    Agentpath option passes path to agent to jvm in order to load native agent library, e.g. yourkit profiler agent.
+EXIT /B 1
+
 
index 1e903d06503c286d7a0e8b41556c826eb5d6d105..13be2336b6db94304d944b78ba912530bee25c5f 100755 (executable)
@@ -1,5 +1,20 @@
 #!/bin/bash
 
+##HELP
+# For more information on a specific command, type -help command-name.
+#
+#   jmx              [-jmx]
+#   jmxport          [-jmxport <num>] - DEFAULT is 1088
+#   debug            [-debug]
+#   debugsuspend     [-debugsuspend]
+#   debugport        [-debugport <num>] - DEFAULT is 8000
+#   start            [-start [<console port>]] - DEFAULT port is 2400
+#   stop             [-stop]
+#   status           [-status]
+#   console          [-console]
+#   agentpath        [-agentpath:<path to lib>]
+##
+
 platform='unknown'
 unamestr=`uname`
 if [[ "$unamestr" == 'Linux' ]]; then
@@ -58,11 +73,6 @@ else
     datadir=${ODL_DATADIR}
 fi
 
-function usage {
-    echo "Usage: $0 [-jmx] [-jmxport <num>] [-debug] [-debugsuspend] [-debugport <num>] [-start [<console port>]] [-stop] [-status] [-console] [-help] [-agentpath:<path to lib>] [<other args will automatically be used for the JVM>]"
-    exit 1
-}
-
 if [ -z ${TMP} ]; then
     pidfile="/tmp/opendaylight.PID"
 else
@@ -82,13 +92,15 @@ stopdaemon=0
 statusdaemon=0
 consolestart=1
 dohelp=0
-jvmMaxMemory=""
+jvmMaxMemory="-Xmx1G"
 extraJVMOpts=""
 agentPath=""
 unknown_option=0
+helper=""
 while true ; do
     case "$1" in
         -debug) debug=1; shift ;;
+        -help) dohelp=1; shift;  helper=$1; break ;;
         -jmx) startjmx=1; shift ;;
         -debugsuspend) debugsuspend=1; shift ;;
         -debugport) shift; debugportread="$1"; if [[ "${debugportread}" =~ ^[0-9]+$ ]] ; then debugport=${debugportread}; shift; else echo "-debugport expects a number but was not found"; exit -1; fi;;
@@ -97,37 +109,39 @@ while true ; do
         -stop) stopdaemon=1; shift ;;
         -status) statusdaemon=1; shift ;;
         -console) shift ;;
-        -help) dohelp=1; shift;;
         -Xmx*) jvmMaxMemory="$1"; shift;;
         -D*) extraJVMOpts="${extraJVMOpts} $1"; shift;;
         -X*) extraJVMOpts="${extraJVMOpts} $1"; shift;;
         -agentpath:*) agentPath="$1"; shift;;
         "") break ;;
-        *) echo "Unknown option $1"; unknown_option=1; shift ;;
+        *) echo "Unknown option $1"; unknown_option=1; break ;;
     esac
 done
 
-# Unknown Options and help
+
+
 if [ "${unknown_option}" -eq 1 ]; then
-    usage
+    echo "Use -help for more information."
+    exit 1
 fi
 
-if [ "${dohelp}" -eq 1 ]; then
-    usage
-fi
 
-if [ "${jvmMaxMemory}" == "" ]; then
-    jvmMaxMemory="-Xmx1G"
-    echo "*****************************************************************"
-    echo "JVM maximum memory was not defined. Setting maximum memory to 1G."
-    echo "To define the maximum memory, specify the -Xmx setting on the"
-    echo "command line. "
-    echo "        e.g. ./run.sh -Xmx1G"
-    echo "*****************************************************************"
+if [ "${dohelp}" -eq 1 ]; then
+    . ${basedir}/functions.sh
+    harvestHelp ${helper}
+    echo -e '\nFor other information type -help.\n'
+    exit 1
 fi
 
 extraJVMOpts="${extraJVMOpts} ${jvmMaxMemory}"
 
+##debugport
+#debugport        [-debugport <num>] - DEFAULT is 8000
+#
+#    Set address for settings in runjdwp in extra JVM options.
+#    The address is transport address for the connection.
+#    The address has to be in the range [1024,65535]. If this option was not call, port will be set to default value.
+##
 # Validate debug port
 if [[ "${debugport}" -lt 1024 ]] || [[ "${debugport}" -gt 65535 ]]; then
     echo "Debug Port not in the range [1024,65535] ${debugport}"
@@ -140,19 +154,51 @@ if [[ "${daemonport}" -lt 1024 ]] || [[ "${daemonport}" -gt 65535 ]]; then
     exit -1
 fi
 
+##jmxport
+#jmxport          [-jmxport <num>] - DEFAULT is 1088
+#
+#    Set jmx port for com.sun.management.jmxremote.port in JMX support. Port has to be in the range [1024,65535]. If this option was not call, port will be set to default value.
+##
 # Validate jmx port
 if [[ "${jmxport}" -lt 1024 ]] || [[ "${jmxport}" -gt 65535 ]]; then
     echo "JMX Port not in the range [1024,65535] value is ${jmxport}"
     exit -1
 fi
+##debug
+#debug            [-debug]
+#
+#Run ODL controller with -Xdebug and -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=\${debugport}
+#-Xdebug enables debugging capabilities in the JVM which are used by the Java Virtual Machine Tools Interface (JVMTI). JVMTI is a low-level debugging interface used by debuggers and profiling tools.
+#-Xrunjdwp option loads the JPDA reference implementation of JDWP. This library resides in the target VM and uses JVMDI and JNI to interact with it. It uses a transport and the JDWP protocol to
+#communicate with a separate debugger application.
+#settings for -Xrunjdwp:
+#            transport -  name of the transport to use in connecting to debugger application
+#            server    -  if “y”, listen for a debugger application to attach; otherwise, attach to the debugger application at the specified address
+#                      -  if “y” and no address is specified, choose a transport address at which to listen for a debugger application, and print the address to the standard output stream
+#            suspend   -  if “y”, VMStartEvent has a suspend Policy of SUSPEND_ALL
+#                      -  if “n”, VMStartEvent has a suspend policy of SUSPEND_NONE
+#            address   -  transport address for the connection
+#                      -  if server=n, attempt to attach to debugger application at this address
+#          -  if server=y, listen for a connection at this address
+##
 
+##debugsuspend
+#debugsuspend     [-debugsuspend]
+#
+#This command sets suspend on true in runjdwp in extra JVM options. If its true, VMStartEvent has a suspendPolicy of SUSPEND_ALL. If its false, VMStartEvent has a suspendPolicy of SUSPEND_NONE.
+##
 # Debug options
 if [ "${debugsuspend}" -eq 1 ]; then
     extraJVMOpts="${extraJVMOpts} -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${debugport}"
 elif [ "${debug}" -eq 1 ]; then
     extraJVMOpts="${extraJVMOpts} -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=${debugport}"
 fi
-
+##jmx
+#jmx              [-jmx]
+#
+#Add JMX support. With settings for extra JVM options: -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=\${jmxport} -Dcom.sun.management.jmxremote
+#jmxport can by set with command -jmxport <num>. Default num for the option is 1088.
+##
 # Add JMX support
 if [ "${startjmx}" -eq 1 ]; then
     extraJVMOpts="${extraJVMOpts} -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=${jmxport} -Dcom.sun.management.jmxremote"
@@ -182,6 +228,11 @@ FWCLASSPATH=${FWCLASSPATH},file:${basedir}/lib/org.eclipse.equinox.launcher-1.3.
 
 cd $basedir
 
+##stop
+#stop             [-stop]
+#
+#If a controller is running, the command stop controller. Pid will be clean.
+##
 if [ "${stopdaemon}" -eq 1 ]; then
     if [ -e "${pidfile}" ]; then
         daemonpid=`cat "${pidfile}"`
@@ -195,6 +246,11 @@ if [ "${stopdaemon}" -eq 1 ]; then
     fi
 fi
 
+##status
+#status           [-status]
+#
+#Find out whether a controller is running and print it.
+##
 if [ "${statusdaemon}" -eq 1 ]; then
     if [ -e "${pidfile}" ]; then
         daemonpid=`cat "${pidfile}"`
@@ -219,6 +275,22 @@ bdir=`echo "${basedir}" | sed 's/ /\\ /g'`
 confarea=`echo "${datadir}" | sed 's/ /\\ /g'`
 fwclasspath=`echo "${FWCLASSPATH}" | sed 's/ /\\ /g'`
 
+##start
+#start            [-start [<console port>]]
+#
+#    If controller is not running, the command with argument(for set port, where controller has start) will start new controller on a port. The port has to be in the range [1024,65535]. If this option was not call, port will be set to default value. Pid will be create.
+##
+##console
+#console          [-console]
+#
+#    Default option.
+##
+##agentpath
+#agentpath        [-agentpath:<path to lib>]
+#
+#   Agentpath option passes path to agent to jvm in order to load native agent library, e.g. yourkit profiler agent.
+##
+echo "JVM maximum memory was set to ${jvmMaxMemory}."
 if [ "${startdaemon}" -eq 1 ]; then
     if [ -e "${pidfile}" ]; then
         echo "Another instance of controller running, check with $0 -status"
index 36045cabf4bfefc672d3edde8001a75deba46385..1b648dc98c36c0c6e05bfce6740b294dd730e8b8 100644 (file)
@@ -103,7 +103,8 @@ public class FromSalConversionsUtils {
     private static NodeConnectorId inPortMatch(Match sourceMatch) {
         MatchField inPort = sourceMatch.getField(MatchType.IN_PORT);
         if(inPort != null && inPort.getValue() != null && (inPort.getValue() instanceof NodeConnector)) {
-            return new NodeConnectorId(((NodeConnector) inPort.getValue()).getNodeConnectorIdAsString());
+            NodeConnector port = (NodeConnector)inPort.getValue();
+            return (NodeConnectorId)MDFlowMapping.toUri(port);
         }
         return null;
     }
@@ -203,9 +204,11 @@ public class FromSalConversionsUtils {
         MatchField vlan = sourceMatch.getField(MatchType.DL_VLAN);
         if (vlan != null && vlan.getValue() != null) {
             VlanIdBuilder vlanIDBuilder = new VlanIdBuilder();
+            short vid = (short)vlan.getValue();
+            boolean present = (vid != MatchType.DL_VLAN_NONE);
             vlanIDBuilder.setVlanId(new VlanId((NetUtils
-                    .getUnsignedShort((short) vlan.getValue()))));
-            vlanIDBuilder.setVlanIdPresent(true);
+                    .getUnsignedShort(vid))));
+            vlanIDBuilder.setVlanIdPresent(present);
             vlanMatchBuild.setVlanId(vlanIDBuilder.build());
         }
 
index a700c86b9c5c00f41a3ade60a650298adfc5883d..02964c6d5531553d23abaa0cce39dfae1db30881 100644 (file)
@@ -11,6 +11,7 @@ import java.math.BigInteger;
 import java.util.Date;
 import java.util.HashSet;
 import java.util.List;
+
 import org.opendaylight.controller.sal.common.util.Arguments;
 import org.opendaylight.controller.sal.core.AdvertisedBandwidth;
 import org.opendaylight.controller.sal.core.Bandwidth;
@@ -61,6 +62,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Objects;
 import com.google.common.base.Preconditions;
 
@@ -94,13 +96,14 @@ public final class NodeMapping {
 
     /**
      * @param adNodeId
-     * @return
+     * @return nodeId as long
      */
-    private static Long openflowFullNodeIdToLong(String adNodeId) {
+    @VisibleForTesting
+    public static Long openflowFullNodeIdToLong(String adNodeId) {
         if (adNodeId == null) {
             return null;
         }
-        return Long.valueOf(adNodeId.replaceFirst("^.*:", ""));
+        return new BigInteger(adNodeId.replaceFirst("^.*:", "")).longValue();
     }
 
     public static NodeId toNodeId(final InstanceIdentifier<?> id) {
index 7bbf7f10e0c2be3c8246849d468fdbc0a8be5996..58cfb20650930f82f5768fa9f96bbcd1e287ad14 100644 (file)
@@ -430,13 +430,17 @@ public class ToSalConversionsUtils {
         if (vlanMatch != null) {
             VlanId vlanId = vlanMatch.getVlanId();
             if (vlanId != null) {
-                org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId vlanIdInner = vlanId
-                        .getVlanId();
-                if (vlanIdInner != null) {
-                    Integer vlanValue = vlanIdInner.getValue();
-                    if (vlanValue != null) {
-                        target.setField(DL_VLAN, vlanValue.shortValue());
+                if (Boolean.TRUE.equals(vlanId.isVlanIdPresent())) {
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId vlanIdInner = vlanId
+                            .getVlanId();
+                    if (vlanIdInner != null) {
+                        Integer vlanValue = vlanIdInner.getValue();
+                        if (vlanValue != null) {
+                            target.setField(DL_VLAN, vlanValue.shortValue());
+                        }
                     }
+                } else {
+                    target.setField(DL_VLAN, MatchType.DL_VLAN_NONE);
                 }
             }
             VlanPcp vlanPcp = vlanMatch.getVlanPcp();
index 8a23ebc933b54359ed7f4dc0d5b4786c05a17d21..cef7ae7a427672b8276411b2e1ace77f66dc04fd 100644 (file)
@@ -174,6 +174,18 @@ public class NodeMappingTest {
         Assert.assertEquals("openflow:1", observedNodeConnectorId);
     }
 
+    /**
+     * Test method for
+     * {@link org.opendaylight.controller.sal.compatibility.NodeMapping#openflowFullNodeIdToLong(String)}
+     * .
+     * @throws ConstructionException
+     */
+    @Test
+    public void testOpenflowFullNodeIdToLong() throws ConstructionException {
+        Assert.assertEquals(42L, NodeMapping.openflowFullNodeIdToLong("42").longValue());
+        Assert.assertEquals(0xCC4E241C4A000000L, NodeMapping.openflowFullNodeIdToLong("14721743935839928320").longValue());
+    }
+
     /**
      * @param nodeId
      * @param portId
index 5d5a409445a4708bf3b04472ded1e3bac89be496..b6e611bf1155087e4faf965e148443e34692308b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013-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,
@@ -41,6 +41,11 @@ import org.opendaylight.controller.sal.action.SetVlanPcp;
 import org.opendaylight.controller.sal.action.SwPath;
 import org.opendaylight.controller.sal.compatibility.MDFlowMapping;
 import org.opendaylight.controller.sal.compatibility.ToSalConversionsUtils;
+import org.opendaylight.controller.sal.core.ConstructionException;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.core.Node.NodeIDType;
+import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.core.NodeConnector.NodeConnectorIDType;
 import org.opendaylight.controller.sal.flowprogrammer.Flow;
 import org.opendaylight.controller.sal.match.Match;
 import org.opendaylight.controller.sal.match.MatchType;
@@ -79,11 +84,11 @@ import com.google.common.net.InetAddresses;
 
 public class TestFromSalConversionsUtils {
     private enum MtchType {
-        other, ipv4, ipv6, arp, sctp, tcp, udp
+        other, untagged, ipv4, ipv6, arp, sctp, tcp, udp
     }
 
     @Test
-    public void testFromSalConversion() {
+    public void testFromSalConversion() throws ConstructionException {
 
         Flow salFlow = prepareSalFlowCommon();
         NodeFlow odNodeFlow = MDFlowMapping.flowAdded(salFlow);
@@ -93,6 +98,9 @@ public class TestFromSalConversionsUtils {
         odNodeFlow = MDFlowMapping.flowAdded(prepareSalMatch(salFlow, MtchType.other));
         checkOdMatch(odNodeFlow.getMatch(), MtchType.other);
 
+        odNodeFlow = MDFlowMapping.flowAdded(prepareSalMatch(salFlow, MtchType.untagged));
+        checkOdMatch(odNodeFlow.getMatch(), MtchType.untagged);
+
         odNodeFlow = MDFlowMapping.flowAdded(prepareSalMatch(salFlow, MtchType.arp));
         checkOdMatch(odNodeFlow.getMatch(), MtchType.arp);
 
@@ -160,15 +168,26 @@ public class TestFromSalConversionsUtils {
             assertNotNull("Ipv6 wasn't found", ipv6Found);
             break;
         case other:
+            assertEquals("Incoming port is wrong.", "openflow:12345:10", match.getInPort().getValue());
             assertEquals("Source MAC address is wrong.", "ff:ee:dd:cc:bb:aa", match.getEthernetMatch()
                     .getEthernetSource().getAddress().getValue());
             assertEquals("Destinatio MAC address is wrong.", "ff:ee:dd:cc:bb:aa", match.getEthernetMatch()
                     .getEthernetDestination().getAddress().getValue());
+            assertEquals("Vlan ID is not present.", Boolean.TRUE, match.getVlanMatch().getVlanId().isVlanIdPresent());
             assertEquals("Vlan ID is wrong.", (Integer) 0xfff, match.getVlanMatch().getVlanId().getVlanId().getValue());
             assertEquals("Vlan ID priority is wrong.", (short) 0x7, (short) match.getVlanMatch().getVlanPcp()
                     .getValue());
             assertEquals("DCSP is wrong.", (short) 0x3f, (short) match.getIpMatch().getIpDscp().getValue());
             break;
+        case untagged:
+            assertEquals("Source MAC address is wrong.", "ff:ee:dd:cc:bb:aa", match.getEthernetMatch()
+                    .getEthernetSource().getAddress().getValue());
+            assertEquals("Destinatio MAC address is wrong.", "ff:ee:dd:cc:bb:aa", match.getEthernetMatch()
+                    .getEthernetDestination().getAddress().getValue());
+            assertEquals("Vlan ID is present.", Boolean.FALSE, match.getVlanMatch().getVlanId().isVlanIdPresent());
+            assertEquals("Vlan ID is wrong.", Integer.valueOf(0), match.getVlanMatch().getVlanId().getVlanId().getValue());
+            assertEquals("DCSP is wrong.", (short) 0x3f, (short) match.getIpMatch().getIpDscp().getValue());
+            break;
         case sctp:
             boolean sctpFound = false;
             assertEquals("Wrong protocol", CRUDP, match.getIpMatch().getIpProtocol().byteValue());
@@ -334,7 +353,7 @@ public class TestFromSalConversionsUtils {
         return salFlow;
     }
 
-    private Flow prepareSalMatch(Flow salFlow, MtchType mt) {
+    private Flow prepareSalMatch(Flow salFlow, MtchType mt) throws ConstructionException {
         Match salMatch = new Match();
         switch (mt) {
         case arp:
@@ -355,12 +374,21 @@ public class TestFromSalConversionsUtils {
             salMatch.setField(MatchType.NW_DST, InetAddresses.forString("2001:0db8:85a3:0000:0000:8a2e:0370:7336"));
             break;
         case other:
+            Node node = new Node(NodeIDType.OPENFLOW, 12345L);
+            NodeConnector port = new NodeConnector(NodeConnectorIDType.OPENFLOW, Short.valueOf((short)10), node);
+            salMatch.setField(MatchType.IN_PORT, port);
             salMatch.setField(MatchType.DL_SRC, new byte[]{(byte )0xff,(byte )0xee,(byte )0xdd,(byte )0xcc,(byte )0xbb,(byte )0xaa});
             salMatch.setField(MatchType.DL_DST, new byte[]{(byte )0xff,(byte )0xee,(byte )0xdd,(byte )0xcc,(byte )0xbb,(byte )0xaa});
             salMatch.setField(MatchType.DL_VLAN, (short) 0xfff);
             salMatch.setField(MatchType.DL_VLAN_PR, (byte) 0x7);
             salMatch.setField(MatchType.NW_TOS, (byte) 0x3f);
             break;
+        case untagged:
+            salMatch.setField(MatchType.DL_SRC, new byte[]{(byte )0xff,(byte )0xee,(byte )0xdd,(byte )0xcc,(byte )0xbb,(byte )0xaa});
+            salMatch.setField(MatchType.DL_DST, new byte[]{(byte )0xff,(byte )0xee,(byte )0xdd,(byte )0xcc,(byte )0xbb,(byte )0xaa});
+            salMatch.setField(MatchType.DL_VLAN, MatchType.DL_VLAN_NONE);
+            salMatch.setField(MatchType.NW_TOS, (byte) 0x3f);
+            break;
         case sctp:
             salMatch.setField(MatchType.NW_PROTO, CRUDP);
             salMatch.setField(MatchType.TP_SRC, (short) 0xffff);
index 0157bc0c6415835b8ed52a7add015d707d57a6d8..7601a7d9cf67ba543d50d8e49b3fb0d6bbe1ae82 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013-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,
@@ -50,6 +50,7 @@ import org.opendaylight.controller.sal.core.ConstructionException;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.Node.NodeIDType;
 import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.core.NodeConnector.NodeConnectorIDType;
 import org.opendaylight.controller.sal.flowprogrammer.Flow;
 import org.opendaylight.controller.sal.match.MatchType;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;
@@ -118,6 +119,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instru
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
@@ -151,7 +153,7 @@ public class TestToSalConversionsUtils {
     // prefix:
     // od|Od = Open Daylight
     private enum MtchType {
-        other, ipv4, ipv6, arp, sctp, tcp, udp
+        other, untagged, ipv4, ipv6, arp, sctp, tcp, udp
     }
 
     @Test
@@ -164,6 +166,9 @@ public class TestToSalConversionsUtils {
         Flow salFlow = ToSalConversionsUtils.toFlow(prepareOdFlow(odNodeFlowBuilder, MtchType.other), node);
         checkSalMatch(salFlow.getMatch(), MtchType.other);
 
+        salFlow = ToSalConversionsUtils.toFlow(prepareOdFlow(odNodeFlowBuilder, MtchType.untagged), node);
+        checkSalMatch(salFlow.getMatch(), MtchType.untagged);
+
         salFlow = ToSalConversionsUtils.toFlow(prepareOdFlow(odNodeFlowBuilder, MtchType.ipv4), node);
         checkSalMatch(salFlow.getMatch(), MtchType.ipv4);
 
@@ -196,7 +201,7 @@ public class TestToSalConversionsUtils {
         Assert.assertEquals("OF|1@OF|00:00:00:00:00:00:00:2a", nodeConnector.toString());
     }
 
-    private void checkSalMatch(org.opendaylight.controller.sal.match.Match match, MtchType mt) {
+    private void checkSalMatch(org.opendaylight.controller.sal.match.Match match, MtchType mt) throws ConstructionException {
         switch (mt) {
         case other:
             /*assertNotNull("DL_DST isn't equal.", "3C:A9:F4:00:E0:C8",
@@ -204,12 +209,21 @@ public class TestToSalConversionsUtils {
             assertEquals("DL_SRC isn't equal.", "24:77:03:7C:C5:F1",
                     new String((byte[]) match.getField(MatchType.DL_SRC).getValue()));
             */
+            Node node = new Node(NodeIDType.OPENFLOW, 12L);
+            NodeConnector port = new NodeConnector(NodeConnectorIDType.OPENFLOW, Short.valueOf((short)345), node);
+            assertEquals("IN_PORT isn't equal.", port, match.getField(MatchType.IN_PORT).getValue());
             assertEquals("DL_TYPE isn't equal.", (short) 0xffff, (short) match.getField(MatchType.DL_TYPE).getValue());
             assertEquals("NW_TOS isn't equal.", (byte) 0x33, (byte) match.getField(MatchType.NW_TOS).getValue());
             assertEquals("NW_PROTO isn't equal.", (byte) 0x3f, (byte) match.getField(MatchType.NW_PROTO).getValue());
             assertEquals("DL_VLAN isn't equal.", (short) 0xfff, (short) match.getField(MatchType.DL_VLAN).getValue());
             assertEquals("DL_VLAN_PR isn't equal.", (byte) 0x7, (byte) match.getField(MatchType.DL_VLAN_PR).getValue());
             break;
+        case untagged:
+            assertEquals("DL_TYPE isn't equal.", (short) 0xffff, (short) match.getField(MatchType.DL_TYPE).getValue());
+            assertEquals("NW_TOS isn't equal.", (byte) 0x33, (byte) match.getField(MatchType.NW_TOS).getValue());
+            assertEquals("NW_PROTO isn't equal.", (byte) 0x3f, (byte) match.getField(MatchType.NW_PROTO).getValue());
+            assertEquals("DL_VLAN isn't equal.", MatchType.DL_VLAN_NONE, (short) match.getField(MatchType.DL_VLAN).getValue());
+            break;
         case arp:
             /*
             assertEquals("DL_SRC isn't equal.", "22:44:66:88:AA:CC",
@@ -578,10 +592,16 @@ public class TestToSalConversionsUtils {
         MatchBuilder odMatchBuilder = new MatchBuilder();
         switch (mt) {
         case other:
+            odMatchBuilder.setInPort(new NodeConnectorId("openflow:12:345"));
             odMatchBuilder.setEthernetMatch(prepEthernetMatch());
             odMatchBuilder.setIpMatch(prepIpMatch());
             odMatchBuilder.setVlanMatch(prepVlanMatch());
             break;
+        case untagged:
+            odMatchBuilder.setEthernetMatch(prepEthernetMatch());
+            odMatchBuilder.setIpMatch(prepIpMatch());
+            odMatchBuilder.setVlanMatch(prepVlanNoneMatch());
+            break;
         case ipv4:
             odMatchBuilder.setLayer3Match(prepLayer3MatchIpv4());
             break;
@@ -664,11 +684,20 @@ public class TestToSalConversionsUtils {
         VlanMatchBuilder vlanMatchBuilder = new VlanMatchBuilder();
 
         VlanIdBuilder vlanIdBuilder = new VlanIdBuilder().setVlanId(new VlanId(0xfff));
-        vlanMatchBuilder.setVlanId(vlanIdBuilder.build());
+        vlanMatchBuilder.setVlanId(vlanIdBuilder.setVlanIdPresent(true).build());
         vlanMatchBuilder.setVlanPcp(new VlanPcp((short) 0x7));
 
         return vlanMatchBuilder.build();
+    }
+
+    private VlanMatch prepVlanNoneMatch() {
+        VlanMatchBuilder vlanMatchBuilder = new VlanMatchBuilder();
 
+        VlanIdBuilder vlanIdBuilder = new VlanIdBuilder().
+            setVlanIdPresent(false);
+        vlanMatchBuilder.setVlanId(vlanIdBuilder.build());
+
+        return vlanMatchBuilder.build();
     }
 
     private IpMatch prepIpMatch() {
diff --git a/opendaylight/md-sal/model/model-flow-base/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/flow/types/port/rev130925/PortNumberBuilder.java b/opendaylight/md-sal/model/model-flow-base/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/flow/types/port/rev130925/PortNumberBuilder.java
new file mode 100644 (file)
index 0000000..ff78a74
--- /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.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.CommonPort.PortNumber;
+
+
+public class PortNumberBuilder {
+
+    public static PortNumber getDefaultInstance(java.lang.String defaultValue) {
+        try {
+            long uint32 = Long.parseLong(defaultValue);
+            return new PortNumber(uint32);
+        } catch(NumberFormatException e){
+            return new PortNumber(defaultValue);
+        }
+    }
+
+}
diff --git a/opendaylight/md-sal/model/model-flow-management/pom.xml b/opendaylight/md-sal/model/model-flow-management/pom.xml
deleted file mode 100644 (file)
index 64f1158..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
-  <modelVersion>4.0.0</modelVersion>
-
-  <parent>
-    <groupId>org.opendaylight.controller.model</groupId>
-    <artifactId>model-parent</artifactId>
-    <version>1.1-SNAPSHOT</version>
-  </parent>
-  <artifactId>model-flow-management</artifactId>
-  <packaging>bundle</packaging>
-
-  <dependencies>
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>model-flow-base</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>model-inventory</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.yangtools.model</groupId>
-      <artifactId>opendaylight-l2-types</artifactId>
-    </dependency>
-  </dependencies>
-  <scm>
-    <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
-    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
-    <tag>HEAD</tag>
-    <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
-  </scm>
-</project>
diff --git a/opendaylight/md-sal/model/model-flow-management/src/main/yang/flow-management.yang b/opendaylight/md-sal/model/model-flow-management/src/main/yang/flow-management.yang
deleted file mode 100644 (file)
index b8579bc..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-module flow-management {
-    namespace "urn:opendaylight:flow:config";
-    prefix flow-cfg;
-
-    import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}
-    import opendaylight-flow-types {prefix flow;}
-
-    revision "2013-08-19" {
-        description "Initial revision of flow service";
-    }
-
-
-    grouping flow-entry {
-        leaf node {
-            type inv:node-ref;
-        }
-        uses flow:flow;
-    }
-
-    container flows {
-        list flow {
-            key "node id"; 
-
-            leaf id {
-                type uint32;
-            }
-            uses flow-entry;
-        }
-    }
-}
diff --git a/opendaylight/md-sal/model/model-flow-management/src/main/yang/group-management.yang b/opendaylight/md-sal/model/model-flow-management/src/main/yang/group-management.yang
deleted file mode 100644 (file)
index 814c7e4..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-module group-management {
-    namespace "urn:opendaylight:group:config";
-    prefix group-cfg;
-
-    import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}  
-    import opendaylight-group-types {prefix group;}
-
-    revision "2013-10-24" {
-        description "Initial revision of group service";
-    }
-
-    grouping group-entry {
-        leaf node {
-            type inv:node-ref;
-        }
-        uses group:group;
-    }   
-     
-    container groups {
-        list group {
-            key "id node"; 
-                        
-            leaf id {
-                type uint32;
-            }                       
-            
-            uses group-entry;
-        }
-    }    
-}
diff --git a/opendaylight/md-sal/model/model-flow-management/src/main/yang/meter-management.yang b/opendaylight/md-sal/model/model-flow-management/src/main/yang/meter-management.yang
deleted file mode 100644 (file)
index 6d86c50..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-module meter-management {
-    namespace "urn:opendaylight:meter:config";
-    prefix meter-cfg;
-
-    import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}  
-    import opendaylight-meter-types {prefix meter;}
-
-    revision "2013-10-24" {
-        description "Initial revision of meter service";
-    }
-
-    grouping meter-entry {
-        leaf node {
-            type inv:node-ref;
-        }
-        uses meter:meter;
-    }   
-     
-    container meters {
-        list meter {
-            key "id node"; 
-                        
-            leaf id {
-                type uint32;
-            }                    
-            
-            uses meter-entry;
-        }
-    }    
-}
diff --git a/opendaylight/md-sal/model/model-flow-management/src/main/yang/port-management.yang b/opendaylight/md-sal/model/model-flow-management/src/main/yang/port-management.yang
deleted file mode 100644 (file)
index 77483de..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-module port-management {
-    namespace "urn:opendaylight:port:config";
-    prefix port-cfg;
-
-    import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}    
-    import opendaylight-port-types {prefix port;}
-
-    revision "2013-10-24" {
-        description "Initial revision of port service";
-    }
-
-    grouping port-entry {
-        leaf node {
-            type inv:node-ref;
-        }
-        uses port:port-mod;
-    }   
-     
-    container ports {
-        list port {
-            key "id node"; 
-                        
-            leaf id {
-                type uint32;
-            }                       
-            
-            uses port-entry;
-        }
-    }    
-}
diff --git a/opendaylight/md-sal/model/model-flow-management/src/main/yang/queue-management.yang b/opendaylight/md-sal/model/model-flow-management/src/main/yang/queue-management.yang
deleted file mode 100644 (file)
index c8a7fbb..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-module queue-management {
-    namespace "urn:opendaylight:queue:config";
-    prefix queue-cfg;
-
-    import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}      
-     
-    import opendaylight-queue-types {prefix queue; revision-date "2013-09-25";}
-
-   
-    revision "2013-10-24" {
-        description "Initial revision of queue service";
-    }
-
-    grouping queue-entry {
-        leaf node {
-            type inv:node-connector-ref;
-           
-        }
-        uses queue:queue-config-request;
-    }   
-     
-    container queues {
-        list queue {
-            key "id node"; 
-                        
-            leaf id {
-                type uint32;
-            }                       
-            
-            uses queue-entry;
-        }
-    }    
-}
diff --git a/opendaylight/md-sal/model/model-flow-management/src/main/yang/table-management.yang b/opendaylight/md-sal/model/model-flow-management/src/main/yang/table-management.yang
deleted file mode 100644 (file)
index 06edb04..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-module table-management {
-    namespace "urn:opendaylight:table:config";
-    prefix table-cfg;
-    
-    import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}
-    import opendaylight-table-types {prefix table;}
-
-    revision "2013-10-24" {
-        description "Initial revision of table service";
-    }
-
-    grouping table-entry {
-    
-        leaf node {
-            type inv:node-ref;
-        }
-        
-        uses table:table-features;
-    }   
-     
-    container tables {
-        list table {
-            key "id node"; 
-                        
-            leaf id {
-                type uint32;
-            }                    
-            
-            uses table-entry;
-        }
-    }    
-}
index a8eec2693615a55ab49ffd6d566ef8e503bffd72..69db856b73b172fa7f2bd966b5ba6f29984a54ca 100644 (file)
@@ -73,7 +73,6 @@ module node-error {
             uses tr:transaction-metadata;
             uses flow:base-node-error-notification;
             uses flow:node-error-reference;
-            uses flow:node-error-reference;
         }
 
     notification group-mod-error-notification {
index 12b5f766254c933221217d0962f399139a436781..5e6a86745c0ae09b9bd200a5d49f495aafeba276 100644 (file)
@@ -17,7 +17,6 @@
     <module>model-flow-base</module>
     <module>model-flow-service</module>
     <module>model-flow-statistics</module>
-    <module>model-flow-management</module>
     <module>model-topology</module>
   </modules>
 
index 24dcfad02bf46b4e610aa1ad0bac0f76d9070671..d3f6d2d005a93ce5ffa0c30cddd8190976bc6309 100644 (file)
     <!--sal-protocolbuffer-encoding-->
     <module>sal-protocolbuffer-encoding</module>
 
-      <!--  Karaf feature -->
-      <module>feature</module>
+    <!--  Karaf feature -->
+    <module>feature</module>
 
+    <!-- Yang Test Models for MD-SAL -->
+    <module>sal-test-model</module>
   </modules>
 
   <build>
index 4327451d2126fa51b6a3a7767e0c2fbd0781703c..bcbd6879d037d12a27c2781ab46f02887c571dff 100644 (file)
@@ -10,17 +10,64 @@ package org.opendaylight.controller.sal.binding.api;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
 
 /**
- *
- * Defines the component of controller and supplies additional metadata. A
- * component of the controller or application supplies a concrete implementation
- * of this interface.
- *
- * A user-implemented component (application) which facilitates the SAL and SAL
- * services to access infrastructure services or providers' functionality.
- *
- *
- *
- */
+*
+* A developer implemented component that gets registered with the Broker.
+*
+* Semantically, a consumer may:
+*
+* <ol>
+*   <li>Subscribe for Notifications </li>
+*   <li>Invoke RPCs</li>
+*   <li>Read from either the operational or config data tree</li>
+*   <li>Write to the config data tree</li>
+* </ol>
+* If you need to:
+* <ol>
+*   <li> Emit Notifications</li>
+*   <li> Provide the implementation of RPCs </li>
+*   <li> Write to the operational data tree </li>
+* </ol>
+*
+* Consider using a BindingAwareProvider
+*
+* Examples:
+*
+* To get a NotificationService:
+*
+* {code
+* public void onSessionInitiated(ProviderContext session) {
+*      NotificationProviderService notificationService = session.getSALService(NotificationProviderService.class);
+*      notificationService.publish(notification)
+* }
+* where notification is an instance of a modeled Notification.
+* For more information on sending notifications via the NotificationProviderService
+* @see org.opendaylight.controller.sal.binding.api.NotificationProviderService
+*
+*
+* A consumer can *invoke* and RPC ( ie, call foo(fooArgs)) but it cannot register an RPC
+* implementation with the MD-SAL that others can invoke(call).
+* To get an invokable RPC:
+*
+* {code
+* public void onSessionInitiated(ProviderContext session) {
+*    MyService rpcFlowSalService = session.getRpcService(MyService.class);
+* }
+*
+* Where MyService.class is a Service interface generated from a yang model with RPCs modeled in it.  The returned
+* rpcFlowSalService can be used like any other object by invoking its methods.  Note, nothing special needs to be done
+* for RoutedRPCs.  They just work.
+*
+* To get a DataBroker to allow access to the data tree:
+*
+* {code
+* public void onSessionInitiated(final ProviderContext session) {
+*      DataBroker databroker = session.getSALService(BindingDataBroker.class);
+* }
+* }
+* @see org.opendaylight.controller.md.sal.common.api.data.BindingDataBroker
+* for more info on using the DataBroker.
+*
+*/
 public interface BindingAwareConsumer {
 
     /**
index 0812e5f53c3d9193cbafaae8acabaaa06be3b880..cb26cad2f392cacc01757cd6c8bdff1b29920cad 100644 (file)
@@ -15,37 +15,131 @@ import org.opendaylight.yangtools.yang.binding.RpcService;
 
 /**
  *
- * Defines the component of controller and supplies additional metadata. A
- * component of the controller or application supplies a concrete implementation
- * of this interface.
+ * A developer implemented component that gets registered with the Broker.
  *
+ * Semantically, a provider may:
+ *
+ * <ol>
+ *   <li> Emit Notifications</li>
+ *   <li> Provide the implementation of RPCs </li>
+ *   <li> Write to the operational data tree </li>
+ * </ol>
+ *
+ * If a class is not doing at least one of those three, consider using
+ * a BindingAwareConsumer instead:
+ * @see org.opendaylight.controller.sal.binding.api.BindingAwareConsumer
+ *
+ * <p>
+ *
+ *In addition, a BindingAwareProvider can in pursuit of its goals:
+ *
+ * <ol>
+ *   <li>Subscribe for Notifications </li>
+ *   <li>Invoke RPCs</li>
+ *   <li>Read from either the operational or config data tree</li>
+ *   <li>Write to the config data tree</li>
+ * </ol>
+ * (All of the above are things a Consumer can also do).
+ *
+ *<p>
+ *
+ * Examples:
+ *
+ *<p>
+ *
+ * To get a NotificationService:
+ *
+ * {code
+ * public void onSessionInitiated(ProviderContext session) {
+ *      NotificationProviderService notificationService = session.getSALService(NotificationProviderService.class);
+ * }
+ * For more information on sending notifications via the NotificationProviderService
+ * @see org.opendaylight.controller.sal.binding.api.NotificationProviderService
+ *
+ * To register an RPC implementation:
+ *
+ * {code
+ * public void onSessionInitiated(ProviderContext session) {
+ *    RpcRegistration<MyService> registration = session.addRpcImplementation(MyService.class, myImplementationInstance);
+ * }
+ *
+ * <p>
+ *
+ * Where MyService.class is a Service interface generated from a yang model with RPCs modeled in it and myImplementationInstance
+ * is an instance of a class that implements MyService.
+ *
+ * To register a Routed RPC Implementation:
+ * {code
+ * public void onSessionInitiated(ProviderContext session) {
+ *   RoutedRpcRegistration<SalFlowService> flowRegistration = session.addRoutedRpcImplementation(SalFlowService.class, salFlowServiceImplementationInstance);
+     flowRegistration.registerPath(NodeContext.class, nodeInstanceId);
+ * }
+ * }
+ *
+ * Where SalFlowService.class is a Service interface generated from a yang model with RPCs modeled in it and salFlowServiceImplementationInstance is an instance
+ * of a class that implements SalFlowService.
  * <p>
- * A user-implemented component (application) which facilitates the SAL and SAL
- * services to access infrastructure services and to provide functionality to
- * {@link Consumer}s and other providers.
+ * The line:
+ * {code
+ * flowRegistration.registerPath(NodeContext.class, nodeInstanceId);
+ * }
+ * Is indicating that the RPC implementation is registered to handle RPC invocations that have their NodeContext pointing to the node with instance id nodeInstanceId.
+ * This bears a bit of further explanation.  RoutedRPCs can be 'routed' to an implementation based upon 'context'.  'context' is a pointer (instanceId) to some place
+ * in the data tree.  In this example, the 'context' is a pointer to a Node.  In this way, a provider can register its ability to provide a service for a particular
+ * Node, but not *all* Nodes.  The Broker routes the RPC by 'context' to the correct implementation, without the caller having to do extra work.  Because of this when
+ * a RoutedRPC is registered, it needs to also be able to indicate for which 'contexts' it is providing an implementation.
+ *
+ * An example of a Routed RPC would be an updateFlow(node, flow) that would be routed based on node to the provider which had registered to provide
+ * it *for that node*.
+ *
+ *<p>
  *
+ * To get a DataBroker to allow access to the data tree:
+ *
+ * {code
+ * public void onSessionInitiated(final ProviderContext session) {
+ *      DataBroker databroker = session.getSALService(BindingDataBroker.class);
+ * }
+ * }
+ * @see org.opendaylight.controller.md.sal.common.api.data.BindingDataBroker
+ * for more info on using the DataBroker.
  *
  */
 public interface BindingAwareProvider {
 
     /**
-     * Returns a set of provided implementations of YANG modules and their rpcs.
+     * @deprecated
      *
+     * This interface was originally intended to solve problems of how to get Implementations
+     * of functionality from a provider, but that is no longer necessary because the Provider
+     * Registers RPCs in onSessionInitiated.
      *
-     * @return Set of provided implementation of YANG modules and their Rpcs
+     * Recommend:
+     * {code
+     * public Collection<? extends RpcService> getImplementations() {
+     *   return Collections.emptySet();
+     * }
+     * }
      */
+    @Deprecated
     Collection<? extends RpcService> getImplementations();
 
     /**
-     * Gets a set of implementations of provider functionality to be registered
-     * into system during the provider registration to the SAL.
+     * @deprecated
      *
-     * <p>
-     * This method is invoked by {@link Broker#registerProvider(Provider)} to
-     * learn the initial provided functionality
+     * This interface was originally intended to solve problems of how to get Functionality
+     *  a provider could provide, but that is no longer necessary because the Provider
+     * Registers RPCs in onSessionInitiated.
+     *
+     * Recommend:
+     * {code
+     * public Collection<? extends ProviderFunctionality> getFunctionality() {
+     *   return Collections.emptySet();
+     * }
+     * }
      *
-     * @return Set of provider's functionality.
      */
+    @Deprecated
     Collection<? extends ProviderFunctionality> getFunctionality();
 
     /**
@@ -58,12 +152,38 @@ public interface BindingAwareProvider {
      *
      *
      */
+    @Deprecated
     public interface ProviderFunctionality {
 
     }
-
+    /**
+     * Callback signaling initialization of the consumer session to the SAL.
+     *
+     * The consumer MUST use the session for all communication with SAL or
+     * retrieving SAL infrastructure services.
+     *
+     * This method is invoked by
+     * {@link BindingAwareBroker#registerProvider(BindingAwareProvider)}
+     *
+     * @param session Unique session between consumer and SAL.
+     */
     void onSessionInitiated(ProviderContext session);
 
+    /*
+     * @deprecated
+     *
+     * A provider was at one point considered an extension of a consumer, thus this
+     * call.  It is deprecated and the @see org.opendaylight.controller.sal.binding.api.BindingAwareConsumer#onSessionInitiated
+     * used, or you should simply use {@link #onSessionInitiated(ProviderContext)}
+     *
+     * Recommend:
+     * {code
+     * public final void onSessionInitialized(ConsumerContext session) {
+     *   // NOOP - as method is deprecated
+     * }
+     * }
+     */
+    @Deprecated
     void onSessionInitialized(ConsumerContext session);
 
 }
index 9429d3f8fa33372dedbbc8b0a00201db695d99a9..be8e0cefc1a3115329ed3391d99bbc8a38810dcd 100644 (file)
@@ -12,20 +12,20 @@ import java.util.EventListener;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
 /**
- * Interface implemented by objects interested in some sort of Notification. This
- * class acts as a base interface for specific listeners which usually are a type
+ * Interface for a generic listener that is interested in receiving YANG modeled notifications.
+ * This interface acts as a base interface for specific listeners which usually are a type
  * capture of this interface.
  *
- * @param <T> Notification type
+ * @param <T> the interested notification type
  */
 public interface NotificationListener<T extends Notification> extends EventListener {
     /**
-     * Invoked to deliver the notification. Note that this method may be invoked
-     * from a shared thread pool, so implementations SHOULD NOT perform CPU-intensive
-     * operations and they definitely MUST NOT invoke any potentially blocking
-     * operations.
+     * Invoked to deliver a notification.
+     * <p>
+     * Note that this method may be invoked from a shared thread pool, so implementations SHOULD NOT
+     * perform CPU-intensive operations and MUST NOT invoke any potentially blocking operations.
      *
-     * @param notification Notification being delivered.
+     * @param notification the notification.
      */
     void onNotification(T notification);
 }
index b94695b83d437e31194e1e862da479b787ba8d80..00db80c19f7fd3fc9399dd303df74f7987eb2ce7 100644 (file)
@@ -14,29 +14,62 @@ import org.opendaylight.controller.md.sal.common.api.notify.NotificationPublishS
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
+/**
+ * Interface for a notification service that provides publish/subscribe capabilities for YANG
+ * modeled notifications. This interface is a combination of the {@link NotificationService} and
+ * {@link NotificationPublishService} interfaces.
+ */
 public interface NotificationProviderService extends NotificationService, NotificationPublishService<Notification> {
+
     /**
-     * Publishes a notification.
-     *
-     * @param Notification
-     *            notification to publish.
-     *
+     * {@inheritDoc}
      */
     @Override
-    void publish(Notification notification);
+    public void publish(Notification notification);
 
     /**
-     * Publishes a notification, listener calls are done in provided executor.
-     *
+     * {@inheritDoc}
      */
     @Override
-    void publish(Notification notification, ExecutorService service);
+    void publish(Notification notification, ExecutorService executor);
 
+    /**
+     * Registers a listener to be notified about notification subscriptions. This
+     * enables a component to know when there is a notification listener subscribed
+     * for a particular notification type.
+     * <p>
+     * On registration of this listener, the
+     * {@link NotificationInterestListener#onNotificationSubscribtion(Class)} method
+     * will be invoked for every notification type that currently has a notification listener
+     * subscribed.
+     *
+     * @param interestListener the listener that will be notified when subscriptions
+     *                         for new notification types occur.
+     * @return a {@link ListenerRegistration} instance that should be used to unregister the listener
+     *         by invoking the {@link ListenerRegistration#close()} method when no longer needed.
+     */
     ListenerRegistration<NotificationInterestListener> registerInterestListener(
             NotificationInterestListener interestListener);
 
+    /**
+     * Interface for a listener interested in being notified about notification subscriptions.
+     */
     public interface NotificationInterestListener extends EventListener {
 
+        /**
+         * Callback that is invoked when a notification listener subscribes for a
+         * particular notification type.
+         * <p>
+         * This method is only called for the first subscription that occurs for a
+         * particular notification type. Subsequent subscriptions for the same
+         * notification type do not trigger invocation of this method.
+         * <p>
+         * <b>Note:</b>This callback is delivered from thread not owned by this listener,
+         * all processing should be as fast as possible and implementations should
+         * not do any blocking calls or block this thread.
+         *
+         * @param notificationType the notification type for the subscription that occurred.
+         */
         void onNotificationSubscribtion(Class<? extends Notification> notificationType);
     }
 }
index 46e372aea652e29439408da9b6d1ccc963e86acc..335f55bcbbade9ce84898eafee05ff146ef2d382 100644 (file)
@@ -10,24 +10,108 @@ package org.opendaylight.controller.sal.binding.api;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
+/**
+ * Notification broker which allows clients to subscribe for and publish YANG-modeled notifications.
+ *
+ *<p>
+ * Two styles of listeners are supported:
+ * <ul>
+ * <li>Generic listener</li>
+ * <li>Dispatch listener - listener, which implements <code>{ModelName}Listener</code> interface,
+ * which has dispatch methods for each defined notification. Methods are invoked based on notification type (class).
+ * </li>
+ *
+ * <h3>Generic Listener</h3>
+ * <p>
+ * A generic listener implements the {@link NotificationListener} interface which has one callback method
+ * <code>onNotification</code> that is invoked for any notification type the listener is subscribed to.
+ * <p>
+ * A generic listener is subscribed using the {@link #registerNotificationListener(Class, NotificationListener)}
+ * method by which you specify the type of notification to receive. A generic listener may be registered for
+ * multiple notification types via multiple subscriptions.
+ * <p>
+ * Generic listeners allow for a more flexible approach, allowing you to subscribe for just
+ * one type of notification from a YANG model. You could also have a general subscription
+ * for all notification in the system via
+ * <pre>
+ *   service.registerNotificationListener(Notification.class, listener);
+ * </pre>
+ *
+ * <h3>Dispatch Listener</h3>
+ * <p>
+ * A dispatch listener implements a YANG-generated module interface <code>{ModuleName}Listener</code>
+ * which handles all the notifications defined in the YANG model. Each notification type translates to
+ * a specific method of the form <code>on{NotificationType}</code> on the generated interface.
+ * The generated interface also extends the
+ * {@link org.opendaylight.yangtools.yang.binding.NotificationListener} interface and implementations
+ * are registered using {@link #registerNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener)}
+ * method.
+ *
+ * <h5>Dispatch Listener Example</h5>
+ * <p>
+ * Lets assume we have following YANG model:
+ *
+ * <pre>
+ * module example {
+ *      ...
+ *
+ *      notification start {
+ *          ...
+ *      }
+ *
+ *      notification stop {
+ *           ...
+ *      }
+ * }
+ * </pre>
+ *
+ * The generated interface will be:
+ * <pre>
+ *  public interface ExampleListener extends NotificationListener {
+ *      void onStart(Start notification);
+ *      void onStop(Stop notification);
+ *  }
+ * </pre>
+ * The following defines an implementation of the generated interface:
+ * <pre>
+ *  public class MyExampleListener implements ExampleListener {
+ *      public void onStart(Start notification) {
+ *          // do something
+ *      }
+ *
+ *      public void onStop(Stop notification) {
+ *          // do something
+ *      }
+ *  }
+ * </pre>
+ * The implementation is registered as follows:
+ * <pre>
+ *  MyExampleListener listener = new MyExampleListener();
+ *  ListenerRegistration<NotificationListener> reg = service.registerNotificationListener( listener );
+ * </pre>
+ * The <code>onStart</code> method will be invoked when someone publishes a <code>Start</code> notification and
+ * the <code>onStop</code> method will be invoked when someone publishes a <code>Stop</code> notification.
+ */
 public interface NotificationService extends BindingAwareService {
     /**
-     * Register a generic listener for specified notification type only.
+     * Registers a generic listener implementation for a specified notification type.
      *
-     * @param notificationType
-     * @param listener
-     * @return Registration for listener. To unregister listener invoke {@link ListenerRegistration#close()} method.
+     * @param notificationType the YANG-generated interface of the notification type.
+     * @param listener the listener implementation that will receive notifications.
+     * @return a {@link ListenerRegistration} instance that should be used to unregister the listener
+     *         by invoking the {@link ListenerRegistration#close()} method when no longer needed.
      */
     <T extends Notification> ListenerRegistration<NotificationListener<T>> registerNotificationListener(
             Class<T> notificationType, NotificationListener<T> listener);
 
     /**
-     * Register a listener which implements generated notification interfaces derived from
+     * Registers a listener which implements a YANG-generated notification interface derived from
      * {@link org.opendaylight.yangtools.yang.binding.NotificationListener}.
-     * Listener is registered for all notifications present in implemented interfaces.
+     * The listener is registered for all notifications present in the implemented interface.
      *
-     * @param listener
-     * @return Registration for listener. To unregister listener invoke {@link ListenerRegistration#close()} method.
+     * @param listener the listener implementation that will receive notifications.
+     * @return a {@link ListenerRegistration} instance that should be used to unregister the listener
+     *         by invoking the {@link ListenerRegistration#close()} method when no longer needed.
      */
     ListenerRegistration<org.opendaylight.yangtools.yang.binding.NotificationListener> registerNotificationListener(
             org.opendaylight.yangtools.yang.binding.NotificationListener listener);
index 35b186db6aeeaf5ed53ee8a7e43bf5d9e4fb1b82..8e286391deb31fb1d81ad56be4b69e8c509df229 100644 (file)
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-simple</artifactId>
-      <version>${slf4j.version}</version>
       <scope>test</scope>
     </dependency>
   </dependencies>
index b109f89ff61adfb016b9eaa5e86818b0ec6b6965..58d78a85dcee79f3eeff39640663dc82533f3aca 100644 (file)
@@ -187,7 +187,7 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
 
         private Map<InstanceIdentifier<?>, DataObject> createdCache;
         private Map<InstanceIdentifier<?>, DataObject> updatedCache;
-        private Map<InstanceIdentifier<?>, ? extends DataObject> originalCache;
+        private Map<InstanceIdentifier<?>, DataObject> originalCache;
         private Set<InstanceIdentifier<?>> removedCache;
         private Optional<DataObject> originalDataCache;
         private Optional<DataObject> updatedDataCache;
@@ -225,7 +225,7 @@ public abstract class AbstractForwardedDataBroker implements Delegator<DOMDataBr
         }
 
         @Override
-        public Map<InstanceIdentifier<?>, ? extends DataObject> getOriginalData() {
+        public Map<InstanceIdentifier<?>, DataObject> getOriginalData() {
             if (originalCache == null) {
                 originalCache = Collections.unmodifiableMap(toBinding(domEvent.getOriginalData()));
             }
index 5ce66874b129ce3684cca1638a4308646165d058..9eceeb1e436b96fd1e063e8b79e3a96bcaf54c94 100644 (file)
@@ -7,18 +7,23 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
+import java.util.Collections;
 import java.util.Map.Entry;
 
 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.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.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Optional;
+import com.google.common.collect.Iterables;
 import com.google.common.util.concurrent.ListenableFuture;
 
 /**
@@ -38,15 +43,76 @@ public class AbstractWriteTransaction<T extends DOMDataWriteTransaction> extends
 
     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()
+       final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> normalized = getCodec()
                 .toNormalizedNode(path, data);
+        ensureListParentIfNeeded(store,path,normalized);
         getDelegate().put(store, normalized.getKey(), normalized.getValue());
     }
 
+
+    /**
+     *
+     * Ensures list parent if item is list, otherwise noop.
+     *
+     * <p>
+     * One of properties of binding specification is that it is imposible
+     * to represent list as a whole and thus it is impossible to write
+     * empty variation of MapNode without creating parent node, with
+     * empty list.
+     *
+     * <p>
+     * This actually makes writes such as
+     * <pre>
+     * put("Nodes", new NodesBuilder().build());
+     * put("Nodes/Node[key]", new NodeBuilder().setKey("key").build());
+     * </pre>
+     * To result in three DOM operations:
+     * <pre>
+     * put("/nodes",domNodes);
+     * merge("/nodes/node",domNodeList);
+     * put("/nodes/node/node[key]",domNode);
+     * </pre>
+     *
+     *
+     * In order to allow that to be inserted if necessary, if we know
+     * item is list item, we will try to merge empty MapNode or OrderedNodeMap
+     * to ensure list exists.
+     *
+     * @param store Data Store type
+     * @param path Path to data (Binding Aware)
+     * @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) {
+        if(Identifiable.class.isAssignableFrom(path.getTargetType())) {
+            org.opendaylight.yangtools.yang.data.api.InstanceIdentifier parentMapPath = getParent(normalized.getKey()).get();
+            NormalizedNode<?, ?> emptyParent = getCodec().getDefaultNodeFor(parentMapPath);
+            getDelegate().merge(store, parentMapPath, emptyParent);
+        }
+
+    }
+
+    // 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) {
+
+        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)));
+        } else if(parentPathSize == 0) {
+            return Optional.of(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.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());
     }
 
index 6b519955accd308109657dcb44823e4bca3d595d..8723fdf82a931b846482914fd5e85e69e8c10cf1 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.controller.md.sal.binding.impl;
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
 import java.util.AbstractMap.SimpleEntry;
+import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map.Entry;
@@ -470,4 +471,24 @@ public class BindingToNormalizedNodeCodec implements SchemaContextListener {
             return Optional.absent();
         }
     }
+
+    /**
+     * Returns an default object according to YANG schema for supplied path.
+     *
+     * @param path DOM Path
+     * @return Node with defaults set on.
+     */
+    public NormalizedNode<?, ?> getDefaultNodeFor(final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier path) {
+        Iterator<PathArgument> iterator = path.getPathArguments().iterator();
+        DataNormalizationOperation<?> currentOp = legacyToNormalized.getRootOperation();
+        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);
+            }
+        }
+        return currentOp.createDefault(path.getLastPathArgument());
+    }
 }
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/BrokerImplClassLoader.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/BrokerImplClassLoader.java
deleted file mode 100644 (file)
index fdd9350..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.impl;
-
-public class BrokerImplClassLoader extends ClassLoader {
-    private final ClassLoader spiClassLoader;
-
-    public BrokerImplClassLoader(final ClassLoader model, final ClassLoader spi) {
-        super(model);
-        this.spiClassLoader = spi;
-    }
-
-    @Override
-    public Class<? extends Object> loadClass(final String name) throws ClassNotFoundException {
-        try {
-            return super.loadClass(name);
-        } catch (ClassNotFoundException e) {
-            return this.spiClassLoader.loadClass(name);
-        }
-    }
-}
index 00c9f1eb91a14f7f1df97a73bc871cac9e918058..834eb4f5fb357b65ae7ed90b6e986ea7c2474a0e 100644 (file)
@@ -82,6 +82,12 @@ class RuntimeCodeGenerator extends AbstractRuntimeCodeGenerator {
                         val rpcMeta = metadata.getRpcMethod(name);
                         val bodyTmp = '''
                         {
+                            if($1 == null) {
+                                throw new IllegalArgumentException("RPC input must not be null and must contain a value for field «rpcMeta.inputRouteGetter.name»");
+                            }
+                            if($1.«rpcMeta.inputRouteGetter.name»() == null) {
+                                throw new IllegalArgumentException("Field «rpcMeta.inputRouteGetter.name» must not be null");
+                            }
                             final «InstanceIdentifier.name» identifier = $1.«rpcMeta.inputRouteGetter.name»()«IF rpcMeta.
                             routeEncapsulated».getValue()«ENDIF»;
                             «supertype.name» instance = («supertype.name») «rpcMeta.context.routingTableField».get(identifier);
index d2472669fa39def5ae4862fb86be2fea5fa7b067..6e4b2d8d99b69c2f417fd96a6532c404e37b8b0d 100644 (file)
@@ -57,10 +57,14 @@ import org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.core.api.Provider;
 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.data.DataModificationTransaction;
 import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
 import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService;
+import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
+import org.opendaylight.yangtools.concepts.CompositeObjectRegistration.CompositeObjectRegistrationBuilder;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.Augmentable;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
@@ -83,6 +87,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Function;
+import com.google.common.base.Optional;
 import com.google.common.collect.FluentIterable;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.ImmutableSet.Builder;
@@ -321,7 +326,10 @@ public class BindingIndependentConnector implements //
     public void startRpcForwarding() {
         if (biRpcRegistry != null && baRpcRegistry instanceof RouteChangePublisher<?, ?>) {
             checkState(!rpcForwarding, "Connector is already forwarding RPCs");
-            domToBindingRpcManager = baRpcRegistry.registerRouteChangeListener(new DomToBindingRpcForwardingManager());
+            final DomToBindingRpcForwardingManager biFwdManager = new DomToBindingRpcForwardingManager();
+
+            domToBindingRpcManager = baRpcRegistry.registerRouteChangeListener(biFwdManager);
+            biRpcRegistry.addRpcRegistrationListener(biFwdManager);
             if (baRpcRegistry instanceof RpcProviderRegistryImpl) {
                 baRpcRegistryImpl = (RpcProviderRegistryImpl) baRpcRegistry;
                 baRpcRegistryImpl.registerRouterInstantiationListener(domToBindingRpcManager.getInstance());
@@ -486,7 +494,7 @@ public class BindingIndependentConnector implements //
         public void onRegister(
                 final DataCommitHandlerRegistration<InstanceIdentifier<? extends DataObject>, DataObject> registration) {
 
-            org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath = mappingService.toDataDom(registration
+            mappingService.toDataDom(registration
                     .getPath());
 
         }
@@ -528,7 +536,7 @@ public class BindingIndependentConnector implements //
      */
     private class DomToBindingRpcForwardingManager implements
             RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>, RouterInstantiationListener,
-            GlobalRpcRegistrationListener {
+            GlobalRpcRegistrationListener, RpcRegistrationListener {
 
         private final Map<Class<? extends RpcService>, DomToBindingRpcForwarder> forwarders = new WeakHashMap<>();
         private RpcProviderRegistryImpl registryImpl;
@@ -543,7 +551,7 @@ public class BindingIndependentConnector implements //
 
         @Override
         public void onGlobalRpcRegistered(final Class<? extends RpcService> cls) {
-            getRpcForwarder(cls, null);
+            getRpcForwarder(cls, null).registerToDOMBroker();
         }
 
         @Override
@@ -588,31 +596,41 @@ public class BindingIndependentConnector implements //
             return potential;
         }
 
+        @Override
+        public void onRpcImplementationAdded(final QName name) {
+
+            final Optional<Class<? extends RpcService>> rpcInterface = mappingService.getRpcServiceClassFor(
+                    name.getNamespace().toString(), name.getFormattedRevision());
+            if (rpcInterface.isPresent()) {
+                getRpcForwarder(rpcInterface.get(), null).registerToBindingBroker();
+            }
+        }
+
+        @Override
+        public void onRpcImplementationRemoved(final QName name) {
+
+        }
     }
 
     private class DomToBindingRpcForwarder implements RpcImplementation, InvocationHandler {
 
         private final Set<QName> supportedRpcs;
         private final WeakReference<Class<? extends RpcService>> rpcServiceType;
-        private final Set<org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration> registrations;
+        private Set<org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration> registrations;
         private final Map<QName, RpcInvocationStrategy> strategiesByQName = new HashMap<>();
         private final WeakHashMap<Method, RpcInvocationStrategy> strategiesByMethod = new WeakHashMap<>();
+        private final RpcService proxy;
+        private ObjectRegistration<?> forwarderRegistration;
+        private boolean registrationInProgress = false;
 
         public DomToBindingRpcForwarder(final Class<? extends RpcService> service) {
             this.rpcServiceType = new WeakReference<Class<? extends RpcService>>(service);
             this.supportedRpcs = mappingService.getRpcQNamesFor(service);
-            try {
-                for (QName rpc : supportedRpcs) {
-                    RpcInvocationStrategy strategy = createInvocationStrategy(rpc, service);
-                    strategiesByMethod.put(strategy.targetMethod, strategy);
-                    strategiesByQName.put(rpc, strategy);
-                    biRpcRegistry.addRpcImplementation(rpc, this);
-                }
 
-            } catch (Exception e) {
-                LOG.error("Could not forward Rpcs of type {}", service.getName(), e);
-            }
-            registrations = ImmutableSet.of();
+            Class<?> cls = rpcServiceType.get();
+            ClassLoader clsLoader = cls.getClassLoader();
+            proxy =(RpcService) Proxy.newProxyInstance(clsLoader, new Class<?>[] { cls }, this);
+            createStrategies();
         }
 
         /**
@@ -622,16 +640,12 @@ public class BindingIndependentConnector implements //
          * @param context
          */
         public DomToBindingRpcForwarder(final Class<? extends RpcService> service,
-                final Class<? extends BaseIdentity> context) {
-            this.rpcServiceType = new WeakReference<Class<? extends RpcService>>(service);
-            this.supportedRpcs = mappingService.getRpcQNamesFor(service);
+                                        final Class<? extends BaseIdentity> context) {
+            this(service);
             Builder<RoutedRpcRegistration> registrationsBuilder = ImmutableSet
                     .<org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration> builder();
             try {
                 for (QName rpc : supportedRpcs) {
-                    RpcInvocationStrategy strategy = createInvocationStrategy(rpc, service);
-                    strategiesByMethod.put(strategy.targetMethod, strategy);
-                    strategiesByQName.put(rpc, strategy);
                     registrationsBuilder.add(biRpcRegistry.addRoutedRpcImplementation(rpc, this));
                 }
                 createDefaultDomForwarder();
@@ -641,6 +655,48 @@ public class BindingIndependentConnector implements //
             registrations = registrationsBuilder.build();
         }
 
+
+
+        private void createStrategies() {
+            try {
+                for (QName rpc : supportedRpcs) {
+                    RpcInvocationStrategy strategy = createInvocationStrategy(rpc, rpcServiceType.get());
+                    strategiesByMethod.put(strategy.targetMethod, strategy);
+                    strategiesByQName.put(rpc, strategy);
+                }
+            } catch (Exception e) {
+                LOG.error("Could not forward Rpcs of type {}", rpcServiceType.get(), e);
+            }
+
+        }
+
+        /**
+         * Registers RPC Forwarder to DOM Broker,
+         * this means Binding Aware Broker has implementation of RPC
+         * which is registered to it.
+         *
+         * If RPC Forwarder was previously registered to DOM Broker
+         * or to Bidning Broker this method is noop to prevent
+         * creating forwarding loop.
+         *
+         */
+        public void registerToDOMBroker() {
+            if(!registrationInProgress && forwarderRegistration == null) {
+                registrationInProgress = true;
+                CompositeObjectRegistrationBuilder<DomToBindingRpcForwarder> builder = CompositeObjectRegistration.builderFor(this);
+                try {
+                    for (QName rpc : supportedRpcs) {
+                        builder.add(biRpcRegistry.addRpcImplementation(rpc, this));
+                    }
+                } catch (Exception e) {
+                    LOG.error("Could not forward Rpcs of type {}", rpcServiceType.get(), e);
+                }
+                this.forwarderRegistration = builder.toInstance();
+                registrationInProgress = false;
+            }
+        }
+
+
         public void registerPaths(final Class<? extends BaseIdentity> context,
                 final Class<? extends RpcService> service, final Set<InstanceIdentifier<?>> set) {
             QName ctx = BindingReflections.findQName(context);
@@ -737,6 +793,29 @@ public class BindingIndependentConnector implements //
 
             });
         }
+
+        /**
+         * Registers RPC Forwarder to Binding Broker,
+         * this means DOM Broekr has implementation of RPC
+         * which is registered to it.
+         *
+         * If RPC Forwarder was previously registered to DOM Broker
+         * or to Bidning Broker this method is noop to prevent
+         * creating forwarding loop.
+         *
+         */
+        public void registerToBindingBroker() {
+            if(!registrationInProgress && forwarderRegistration == null) {
+               try {
+                   registrationInProgress = true;
+                   this.forwarderRegistration = baRpcRegistry.addRpcImplementation((Class)rpcServiceType.get(), proxy);
+               } catch (Exception e) {
+                   LOG.error("Unable to forward RPCs for {}",rpcServiceType.get(),e);
+               } finally {
+                   registrationInProgress = false;
+               }
+            }
+        }
     }
 
     public boolean isRpcForwarding() {
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/DataModificationTracker.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/DataModificationTracker.java
deleted file mode 100644 (file)
index 8278b36..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.binding.impl.connect.dom;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
-import org.opendaylight.yangtools.concepts.Path;
-
-public final class DataModificationTracker<P extends Path<P>,D> {
-    ConcurrentMap<Object, DataModification<P,D>> trackedTransactions = new ConcurrentHashMap<>();
-
-    public void startTrackingModification(DataModification<P,D> modification) {
-        trackedTransactions.putIfAbsent(modification.getIdentifier(), modification);
-    }
-
-    public boolean containsIdentifier(Object identifier) {
-        return trackedTransactions.containsKey(identifier);
-    }
-}
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/package-info.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/package-info.java
deleted file mode 100644 (file)
index e5f26b9..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
-  * 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.impl;
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/DelegateProxy.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/DelegateProxy.java
deleted file mode 100644 (file)
index d22335e..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * 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.spi;
-
-public interface DelegateProxy<T> {
-
-    void setDelegate(T delegate);
-    T getDelegate();
-}
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/remote/RouteChangeListener.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/remote/RouteChangeListener.java
deleted file mode 100644 (file)
index 9e66fb8..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.binding.spi.remote;
-
-import java.util.EventListener;
-
-import org.opendaylight.controller.md.sal.common.api.routing.RouteChange;
-import org.opendaylight.yangtools.yang.binding.BaseIdentity;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public interface RouteChangeListener extends EventListener {
-
-    void onRouteChange(RouteChange<Class<? extends BaseIdentity>, InstanceIdentifier<?>> change);
-
-}
diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/WriteTransactionTest.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/WriteTransactionTest.java
new file mode 100644 (file)
index 0000000..ad6e1a7
--- /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.md.sal.binding.impl.test;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.concurrent.ExecutionException;
+
+import org.junit.Test;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+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.sal.binding.test.AbstractDataServiceTest;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
+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.inventory.rev130819.nodes.NodeKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+
+public class WriteTransactionTest extends AbstractDataServiceTest {
+
+    private DataBroker dataBroker;
+
+    private static final InstanceIdentifier<Nodes> NODES_PATH = InstanceIdentifier.create(Nodes.class);
+
+    private static final NodeKey NODE_KEY = new NodeKey(new NodeId("foo"));
+
+    private static final InstanceIdentifier<Node> NODE_PATH = NODES_PATH.child(Node.class, NODE_KEY);
+
+    @Override
+    public void setUp() {
+        super.setUp();
+
+        dataBroker = testContext.getDataBroker();
+    }
+
+    @Test
+    public void test() throws InterruptedException, ExecutionException {
+        WriteTransaction writeTx = dataBroker.newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.OPERATIONAL, NODES_PATH, new NodesBuilder().build());
+        writeTx.put(LogicalDatastoreType.OPERATIONAL, NODE_PATH, new NodeBuilder().setKey(NODE_KEY).build());
+        assertEquals(TransactionStatus.COMMITED, writeTx.commit().get().getResult());
+    }
+
+}
index e6cd1aa1ad638716b474fa9570c7d3ace3d767a1..9ba65339710b50c5e3a1e453fa5b5ff3805484f3 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.controller.sal.binding.test;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 
@@ -154,6 +155,31 @@ public class RuntimeCodeGeneratorTest {
 
         // We should have call to instance 1
         verify(service[1]).simple(instance_1_input[0]);
+
+        /*
+         * Generated RPC service should throw illegalArgumentException
+         * with message if rpc input is null.
+         */
+        try {
+            product.getInvocationProxy().simple(null);
+            fail("Generated RPC router should throw IllegalArgumentException on null input");
+        } catch (IllegalArgumentException e){
+            assertNotNull(e.getMessage());
+        }
+
+
+        /*
+         * Generated RPC service should throw illegalArgumentException
+         * with message if rpc route is null.
+         */
+        try {
+            SimpleInput withoutValue = new SimpleInputImpl(null);
+            product.getInvocationProxy().simple(withoutValue);
+            fail("Generated RPC router should throw IllegalArgumentException on null value for route");
+        } catch (IllegalArgumentException e){
+            assertNotNull(e.getMessage());
+        }
+
     }
 
     private InstanceIdentifier<?>[][] identifiers(final int serviceSize, final int instancesPerService) {
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.sal.binding.test.bugfix;
+package org.opendaylight.controller.sal.binding.test.compat;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.sal.binding.test.bugfix;
+package org.opendaylight.controller.sal.binding.test.compat;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -5,8 +5,9 @@
  * 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.impl.connect.dom;
-
-public class CompositeNodeUtils {
-
-}
+/**
+ *
+ * Test suite targeting legacy Data APIs
+ *
+ */
+package org.opendaylight.controller.sal.binding.test.compat;
\ No newline at end of file
index 1ea56381ef1cf9a4b248d2be2795d6c290f81c0d..8ba709ad30c461e5b69c50b0d34c9b2d78579fbb 100644 (file)
@@ -17,7 +17,9 @@ import java.util.concurrent.Future;
 
 import javassist.ClassPool;
 
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.impl.ForwardedBackwardsCompatibleDataBroker;
+import org.opendaylight.controller.md.sal.binding.impl.ForwardedBindingDataBroker;
 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.broker.impl.DOMDataBrokerImpl;
@@ -112,6 +114,8 @@ public class BindingTestContext implements AutoCloseable {
 
     private final MockSchemaService mockSchemaService = new MockSchemaService();
 
+    private DataBroker dataBroker;
+
 
 
     public DOMDataBroker getDomAsyncDataBroker() {
@@ -150,6 +154,12 @@ public class BindingTestContext implements AutoCloseable {
         biDataLegacyBroker = biDataImpl;
     }
 
+    public void startNewDataBroker() {
+        checkState(executor != null, "Executor needs to be set");
+        checkState(newDOMDataBroker != null, "DOM Data Broker must be set");
+        dataBroker = new ForwardedBindingDataBroker(newDOMDataBroker, mappingServiceImpl, mockSchemaService);
+    }
+
     public void startNewDomDataBroker() {
         checkState(executor != null, "Executor needs to be set");
         InMemoryDOMDataStore operStore = new InMemoryDOMDataStore("OPER", executor);
@@ -312,11 +322,12 @@ public class BindingTestContext implements AutoCloseable {
 
     public void start() {
         startNewDomDataBroker();
+
         startDomBroker();
         startDomMountPoint();
         startBindingToDomMappingService();
+        startNewDataBroker();
         startNewBindingDataBroker();
-
         startBindingNotificationBroker();
         startBindingBroker();
 
@@ -418,5 +429,9 @@ public class BindingTestContext implements AutoCloseable {
         return biMountImpl;
     }
 
+    public DataBroker getDataBroker() {
+        return dataBroker;
+    }
+
 
 }
index fd5c5be18dc787c2bc6ae2237df3ce848b930ee7..42d5cfff65e755e29ef2f9198fb6478eabf783d6 100644 (file)
       <artifactId>pax-exam-container-native</artifactId>
       <scope>test</scope>
     </dependency>
-
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-simple</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-parser-impl</artifactId>
+      <scope>test</scope>
+    </dependency>
+      <dependency>
+          <groupId>org.opendaylight.controller</groupId>
+          <artifactId>sal-test-model</artifactId>
+          <version>1.1-SNAPSHOT</version>
+      </dependency>
   </dependencies>
   <build>
     <plugins>
           </execution>
         </executions>
       </plugin>
-      <plugin>
-        <groupId>org.opendaylight.yangtools</groupId>
-        <artifactId>yang-maven-plugin</artifactId>
-        <executions>
-          <execution>
-            <goals>
-              <goal>generate-sources</goal>
-            </goals>
-            <configuration>
-              <codeGenerators>
-                <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>
index c5dbdcecae747b7f4930b0f0f1119ec753f941e3..aefc53b124335b5801910faaed56adca6be32d46 100644 (file)
@@ -25,6 +25,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.N
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
+/*
+ * FIXME: THis test should be moved to sal-binding-broker and rewriten
+ * to use new DataBroker API
+ */
+@SuppressWarnings("deprecation")
 public class ConcurrentImplicitCreateTest extends AbstractDataServiceTest {
 
     private static final NodeKey NODE_FOO_KEY = new NodeKey(new NodeId("foo"));
index 667887ac805f3c8ea538df89da2d22d147b62ade..cd68559ae5304eb721771981069c312333b33868 100644 (file)
@@ -50,12 +50,10 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.util.concurrent.ListenableFuture;
 
 /*
- * 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
+ * FIXME: THis test should be moved to sal-binding-broker and rewriten
+ * to use new DataBroker API
  */
+@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
@@ -171,7 +169,6 @@ public class ListProcessingAndOrderingTest extends AbstractDataServiceTest {
         assertEquals(TransactionStatus.COMMITED,result.getResult());
     }
 
-    @SuppressWarnings("deprecation")
     private void assertXmlRepresentation(final InstanceIdentifier<?> containerPath, final String... childNameValues) {
 
         org.opendaylight.yangtools.yang.data.api.InstanceIdentifier domPath = testContext.getBindingToDomMappingService().toDataDom(containerPath);
index 6b4cc5779806288d4f0cf26116d2ef3f7ca10ba1..2b5171369bb31a7195b029c1377201c76ba24849 100644 (file)
@@ -43,12 +43,10 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import com.google.common.util.concurrent.SettableFuture;
 
 /*
- * 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
+ * FIXME: THis test should be moved to compat test-suite and rewriten
+ * to use sal-test-model
  */
+@SuppressWarnings("deprecation")
 public class WildcardedDataChangeListenerTest extends AbstractDataServiceTest {
 
     private static final NodeKey NODE_0_KEY = new NodeKey(new NodeId("test:0"));
index 471935248506b9cf4c3cdf53d37e8ad43568b33b..0c767f61850e0102a6f8534d753b542064edfaaa 100644 (file)
@@ -14,7 +14,6 @@ import static org.junit.Assert.assertNull;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import java.util.Map;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -49,49 +48,29 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 
-import com.google.common.collect.ImmutableMap;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
 
+@SuppressWarnings("deprecation")
 public class DOMCodecBug01Test extends AbstractDataServiceTest {
 
-    private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
-    private static final QName FLOW_ID_QNAME = QName.create(Flow.QNAME, "id");
-    private static final QName FLOW_NODE_QNAME = QName.create(Flow.QNAME, "node");
     private static final long FLOW_ID = 1234;
     private static final String NODE_ID = "node:1";
 
     private static final NodeKey NODE_KEY = new NodeKey(new NodeId(NODE_ID));
 
-    private static final Map<QName, Object> NODE_KEY_BI = Collections.<QName, Object> singletonMap(NODE_ID_QNAME,
-            NODE_ID);
-
     private static final InstanceIdentifier<Node> NODE_INSTANCE_ID_BA = InstanceIdentifier.builder(Nodes.class) //
             .child(Node.class, NODE_KEY).toInstance();
 
-    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier NODE_INSTANCE_ID_BI = //
-    org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
-            .node(Nodes.QNAME) //
-            .nodeWithKey(Node.QNAME, NODE_KEY_BI) //
-            .toInstance();
     private static final NodeRef NODE_REF = new NodeRef(NODE_INSTANCE_ID_BA);
 
     private static final FlowKey FLOW_KEY = new FlowKey(FLOW_ID, NODE_REF);
 
-    private static final Map<QName, Object> FLOW_KEY_BI = //
-    ImmutableMap.<QName, Object> of(FLOW_ID_QNAME, FLOW_ID, FLOW_NODE_QNAME, NODE_INSTANCE_ID_BI);
-
-    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier FLOW_INSTANCE_ID_BI = //
-    org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
-            .node(Flows.QNAME) //
-            .nodeWithKey(Flow.QNAME, FLOW_KEY_BI) //
-            .toInstance();
     private static final InstanceIdentifier<? extends DataObject> FLOW_INSTANCE_ID_BA = //
     InstanceIdentifier.builder(Flows.class) //
             .child(Flow.class, FLOW_KEY) //
index bc6f567c2bd01fd3346cc0c8d9769fd20f9cfdc8..75d48612b831be05ad4a36ed244c2a6a1ff3db10 100644 (file)
@@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
 import java.util.Collections;
-import java.util.Map;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -22,47 +21,21 @@ import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
 import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
 import org.opendaylight.controller.sal.binding.test.util.BindingBrokerTestFactory;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
 
+@SuppressWarnings("deprecation")
 public class DOMCodecBug02Test extends AbstractDataServiceTest {
 
-    private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
-    private static final String NODE_ID = "node:1";
-
-    private static final NodeKey NODE_KEY = new NodeKey(new NodeId(NODE_ID));
-
-    private static final Map<QName, Object> NODE_KEY_BI = Collections.<QName, Object> singletonMap(NODE_ID_QNAME,
-            NODE_ID);
-
     private static final InstanceIdentifier<Nodes> NODES_INSTANCE_ID_BA = InstanceIdentifier.builder(Nodes.class) //
             .toInstance();
 
-    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier NODES_INSTANCE_ID_BI = //
-    org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
-            .node(Nodes.QNAME) //
-            .toInstance();
-
-    private static final InstanceIdentifier<Node> NODE_INSTANCE_ID_BA = InstanceIdentifier.builder(Nodes.class) //
-            .child(Node.class, NODE_KEY).toInstance();
-
-    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier NODE_INSTANCE_ID_BI = //
-    org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
-            .node(Nodes.QNAME) //
-            .nodeWithKey(Node.QNAME, NODE_KEY_BI) //
-            .toInstance();
-    private static final NodeRef NODE_REF = new NodeRef(NODE_INSTANCE_ID_BA);
-
     /**
      * This test is ignored, till found out better way to test generation of
      * classes without leaking of instances from previous run
index ccbd52fc77ea27711c19c934fb2109a3991343d6..dd8eaa7d5f6f821a54c9694c7469e0b96e0d9d49 100644 (file)
@@ -46,6 +46,7 @@ import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 
 import com.google.common.util.concurrent.SettableFuture;
 
+@SuppressWarnings("deprecation")
 public class DOMCodecBug03Test extends AbstractDataServiceTest implements DataChangeListener {
 
     private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
index c1eba3ee257abeb7bb864a810e8bad3b676ad529..fb5fd1fa6c8f438b120078d1d995ca839dc6b5a7 100644 (file)
@@ -24,12 +24,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 import com.google.common.util.concurrent.SettableFuture;
 
+@SuppressWarnings("deprecation")
 public class DeleteNestedAugmentationListenParentTest extends AbstractDataServiceTest {
 
     private static final NodeKey NODE_KEY = new NodeKey(new NodeId("foo"));
@@ -38,11 +38,6 @@ public class DeleteNestedAugmentationListenParentTest extends AbstractDataServic
 
     private static final FlowKey FLOW_KEY = new FlowKey(new FlowId("100"));
 
-    private static final InstanceIdentifier<FlowCapableNode> LISTENER_PATH = InstanceIdentifier.builder(Nodes.class) //
-            .child(Node.class)
-            .augmentation(FlowCapableNode.class).build();
-
-
     private static final InstanceIdentifier<FlowCapableNode> NODE_AUGMENT_PATH = InstanceIdentifier.builder(Nodes.class)
             .child(Node.class,NODE_KEY)
             .augmentation(FlowCapableNode.class)
@@ -63,7 +58,7 @@ public class DeleteNestedAugmentationListenParentTest extends AbstractDataServic
 
         final SettableFuture<DataChangeEvent<InstanceIdentifier<?>, DataObject>> event = SettableFuture.create();
 
-        ListenerRegistration<DataChangeListener> listenerReg = baDataService.registerDataChangeListener(FLOW_PATH, new DataChangeListener() {
+        baDataService.registerDataChangeListener(FLOW_PATH, new DataChangeListener() {
 
             @Override
             public void onDataChanged(final DataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
index 30c7af705f2ccba4a25e3b1d19f8261e3439386a..7143352c1f9c8ec625b4f29e93912d30db815414 100644 (file)
@@ -14,7 +14,6 @@ import static org.junit.Assert.assertNull;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import java.util.Map;
 
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
@@ -39,7 +38,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instru
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
@@ -54,11 +52,9 @@ import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 
 import com.google.common.collect.ImmutableSet;
 
+@SuppressWarnings("deprecation")
 public class FlagsSerializationTest extends AbstractDataServiceTest {
 
-    private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
-    private static final QName FLOW_ID_QNAME = QName.create(Flow.QNAME, "id");
-    private static final QName FLOW_NODE_QNAME = QName.create(Flow.QNAME, "node");
     private static final String FLOW_ID = "1234";
     private static final short TABLE_ID = (short)0;
     private static final String NODE_ID = "node:1";
@@ -67,27 +63,9 @@ public class FlagsSerializationTest extends AbstractDataServiceTest {
     private static final FlowKey FLOW_KEY = new FlowKey(new FlowId(FLOW_ID));
     private static final TableKey TABLE_KEY = new TableKey(TABLE_ID);
 
-    private static final Map<QName, Object> NODE_KEY_BI = Collections.<QName, Object> singletonMap(NODE_ID_QNAME,
-            NODE_ID);
-
     private static final InstanceIdentifier<Node> NODE_INSTANCE_ID_BA = InstanceIdentifier.builder(Nodes.class) //
             .child(Node.class, NODE_KEY).toInstance();
 
-    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier NODE_INSTANCE_ID_BI = //
-    org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
-            .node(Nodes.QNAME) //
-            .nodeWithKey(Node.QNAME, NODE_KEY_BI) //
-            .toInstance();
-    private static final NodeRef NODE_REF = new NodeRef(NODE_INSTANCE_ID_BA);
-
-
-
-//    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier FLOW_INSTANCE_ID_BI = //
-//    org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
-//
-//            .node(Flows.QNAME) //
-//            .nodeWithKey(Flow.QNAME, FLOW_KEY_BI) //
-//            .toInstance();
     private static final InstanceIdentifier<? extends DataObject> FLOW_INSTANCE_ID_BA = //
             NODE_INSTANCE_ID_BA.builder() //
             .augmentation(FlowCapableNode.class)
@@ -113,15 +91,13 @@ public class FlagsSerializationTest extends AbstractDataServiceTest {
         ImmutableSet<String> domAllTrueFlags = ImmutableSet.<String>of("CHECK_OVERLAP","NO_BYT_COUNTS", "NO_PKT_COUNTS", "RESET_COUNTS", "SEND_FLOW_REM");
         testFlags(allTrueFlags,domAllTrueFlags);
 
-        FlowModFlags nullFlags = null;
-        ImmutableSet<String> domNullFlags = null;
         testFlags(null,null);
 
 
 
     }
 
-    private void testFlags(FlowModFlags flagsToTest, ImmutableSet<String> domFlags) throws Exception {
+    private void testFlags(final FlowModFlags flagsToTest, final ImmutableSet<String> domFlags) throws Exception {
         Flow flow = createFlow(flagsToTest);
         assertNotNull(flow);
 
@@ -145,7 +121,7 @@ public class FlagsSerializationTest extends AbstractDataServiceTest {
 
     }
 
-    private Flow createFlow(FlowModFlags flagsToTest) throws Exception {
+    private Flow createFlow(final FlowModFlags flagsToTest) throws Exception {
 
         DataModificationTransaction modification = baDataService.beginTransaction();
 
index 7f1632081490003aa8921b14a8c37c6941df4c29..33a4399cb513519ead16e0c16b9e81d57f13e0a7 100644 (file)
@@ -27,7 +27,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.Fl
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.flow.node.SupportedActions;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
@@ -45,6 +44,7 @@ import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 
 import com.google.common.util.concurrent.SettableFuture;
 
+@SuppressWarnings("deprecation")
 public class PutAugmentationTest extends AbstractDataServiceTest implements DataChangeListener {
 
     private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
@@ -62,12 +62,6 @@ public class PutAugmentationTest extends AbstractDataServiceTest implements Data
             NODES_INSTANCE_ID_BA.builder() //
             .child(Node.class, NODE_KEY).toInstance();
 
-    private static final InstanceIdentifier<SupportedActions> SUPPORTED_ACTIONS_INSTANCE_ID_BA = //
-            NODES_INSTANCE_ID_BA.builder() //
-            .child(Node.class, NODE_KEY) //
-            .augmentation(FlowCapableNode.class) //
-            .child(SupportedActions.class).toInstance();
-
     private static final InstanceIdentifier<FlowCapableNode> ALL_FLOW_CAPABLE_NODES = //
             NODES_INSTANCE_ID_BA.builder() //
             .child(Node.class) //
@@ -79,15 +73,6 @@ public class PutAugmentationTest extends AbstractDataServiceTest implements Data
             .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() //
-            .node(Nodes.QNAME) //
-            .nodeWithKey(Node.QNAME, NODE_KEY_BI) //
-            .node(SUPPORTED_ACTIONS_QNAME) //
-            .toInstance();
     private static final InstanceIdentifier<FlowCapableNode> FLOW_AUGMENTATION_PATH =
             NODE_INSTANCE_ID_BA.builder() //
             .augmentation(FlowCapableNode.class) //
@@ -231,31 +216,11 @@ public class PutAugmentationTest extends AbstractDataServiceTest implements Data
         assertNull(node);
     }
 
-    private void verifyNodes(final Nodes nodes, final Node original) {
-        assertNotNull(nodes);
-        assertNotNull(nodes.getNode());
-        assertEquals(1, nodes.getNode().size());
-        Node readedNode = nodes.getNode().get(0);
-        assertEquals(original.getId(), readedNode.getId());
-        assertEquals(original.getKey(), readedNode.getKey());
-
-        FlowCapableNode fnu = original.getAugmentation(FlowCapableNode.class);
-        FlowCapableNode readedAugment = readedNode.getAugmentation(FlowCapableNode.class);
-        assertNotNull(fnu);
-        assertEquals(fnu.getDescription(), readedAugment.getDescription());
-        assertEquals(fnu.getSerialNumber(), readedAugment.getSerialNumber());
-
-    }
-
     private void assertBindingIndependentVersion(final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier nodeId) {
         CompositeNode node = biDataService.readOperationalData(nodeId);
         assertNotNull(node);
     }
 
-    private Nodes checkForNodes() {
-        return (Nodes) baDataService.readOperationalData(NODES_INSTANCE_ID_BA);
-    }
-
     @Override
     public void onDataChanged(final DataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
         lastReceivedChangeEvent.set(change);
index cb31885f02673685342d35796d81e7bb3c38fa71..b09ba39a65e120f20c51801f2a699552f91132eb 100644 (file)
@@ -31,6 +31,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 import com.google.common.util.concurrent.SettableFuture;
 
+@SuppressWarnings("deprecation")
 public class WriteParentListenAugmentTest extends AbstractDataServiceTest {
 
     private static final String NODE_ID = "node:1";
index f7b81a44e9e2b685860b7269425c2630911b817b..ad02d9a6f6df31239c108352294a595452d43f7e 100644 (file)
@@ -40,6 +40,7 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 
 import com.google.common.collect.ImmutableList;
 
+@SuppressWarnings("deprecation")
 public class WriteParentReadChildTest extends AbstractDataServiceTest {
 
     private static final String FLOW_ID = "1234";
diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/package-info.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/package-info.java
new file mode 100644 (file)
index 0000000..84559d5
--- /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
+ */
+/**
+ * This testsuite test Hydrogen-level API and regression for most of it,
+ *
+ * FIXME: this testsuite needs to be refactored to use new DataBroker API,
+ * moved to sal-binding-broker-impl and uses models only from sal-test-model.
+ *
+ */
+package org.opendaylight.controller.sal.binding.test.bugfix;
\ No newline at end of file
index 6d0226849f3a81a02b143046ea8d092cfd755b5b..481a7ddfa2c42863b3cb17b17826d0a5748fa778 100644 (file)
@@ -11,16 +11,12 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
-
 import java.util.concurrent.Future;
 
-
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-
 import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
@@ -31,6 +27,8 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
+// FIXME: Migrate to use new Data Broker APIs
+@SuppressWarnings("deprecation")
 public class BrokerIntegrationTest extends AbstractDataServiceTest {
 
     @Test
@@ -105,14 +103,14 @@ public class BrokerIntegrationTest extends AbstractDataServiceTest {
         assertNull(readedData2);
     }
 
-    private static NodeRef createNodeRef(String string) {
+    private static NodeRef createNodeRef(final String string) {
         NodeKey key = new NodeKey(new NodeId(string));
         InstanceIdentifier<Node> path = InstanceIdentifier.builder(Nodes.class).child(Node.class, key)
                 .toInstance();
         return new NodeRef(path);
     }
 
-    private static Node createNode(String string) {
+    private static Node createNode(final String string) {
         NodeBuilder ret = new NodeBuilder();
         ret.setId(new NodeId(string));
         ret.setKey(new NodeKey(ret.getId()));
index 422b9ccee5c4cc9e1048d2812fe784d7a9a08075..ae54896c6d0faa75b40d105319e4c7b3c8b3dc1c 100644 (file)
@@ -45,7 +45,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instru
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
@@ -63,13 +62,14 @@ import org.slf4j.LoggerFactory;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.util.concurrent.SettableFuture;
 
+// FIXME: Migrate to use new Data Broker APIs
+@SuppressWarnings("deprecation")
 public class ChangeOriginatedInDomBrokerTest extends AbstractDataServiceTest {
 
     private static final Logger LOG = LoggerFactory.getLogger(ChangeOriginatedInDomBrokerTest.class);
 
     private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
     private static final QName FLOW_ID_QNAME = QName.create(Flow.QNAME, "id");
-    private static final QName FLOW_NODE_QNAME = QName.create(Flow.QNAME, "node");
     private static final QName TABLE_ID_QNAME = QName.create(Table.QNAME, "id");
 
     private static final String NODE_ID = "node:1";
@@ -87,13 +87,6 @@ public class ChangeOriginatedInDomBrokerTest extends AbstractDataServiceTest {
     private static final InstanceIdentifier<Node> NODE_INSTANCE_ID_BA = InstanceIdentifier.builder(Nodes.class) //
             .child(Node.class, NODE_KEY).toInstance();
 
-    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier NODE_INSTANCE_ID_BI = //
-    org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
-            .node(Nodes.QNAME) //
-            .nodeWithKey(Node.QNAME, NODE_KEY_BI) //
-            .toInstance();
-    private static final NodeRef NODE_REF = new NodeRef(NODE_INSTANCE_ID_BA);
-
     private static final Map<QName, Object> FLOW_KEY_BI = //
     ImmutableMap.<QName, Object> of(FLOW_ID_QNAME, FLOW_ID.getValue());
 
index 94570510ab0cd4d3c0fefe41ccd61e5670bf56d9..804fcc9fbe8bb4983b10e1120467e4ae03f50bf5 100644 (file)
@@ -24,15 +24,12 @@ import org.opendaylight.controller.sal.binding.test.util.BindingTestContext;
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupStatistics;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatistics;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
@@ -43,13 +40,10 @@ import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
 
 import com.google.common.util.concurrent.MoreExecutors;
 
+@SuppressWarnings("deprecation")
 public class CrossBrokerMountPointTest {
 
     private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
-    private static final QName FLOW_ID_QNAME = QName.create(Flow.QNAME, "id");
-    private static final QName FLOW_NODE_QNAME = QName.create(Flow.QNAME, "node");
-    private static final QName TABLE_ID_QNAME = QName.create(Table.QNAME, "id");
-
     private static final String NODE_ID = "node:1";
 
     private static final NodeKey NODE_KEY = new NodeKey(new NodeId(NODE_ID));
@@ -83,8 +77,6 @@ public class CrossBrokerMountPointTest {
             .nodeWithKey(QName.create(FlowCapableNode.QNAME, "group"), QName.create(FlowCapableNode.QNAME, "group-id"),
                     0L).node(AUGMENTED_GROUP_STATISTICS).toInstance();
 
-    private static final NodeRef NODE_REF = new NodeRef(NODE_INSTANCE_ID_BA);
-
     private BindingTestContext testContext;
     private MountProviderService bindingMountPointService;
     private MountProvisionService domMountPointService;
@@ -123,13 +115,13 @@ public class CrossBrokerMountPointTest {
         DataReader<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> simpleReader = new DataReader<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode>() {
 
             @Override
-            public CompositeNode readConfigurationData(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier arg0) {
+            public CompositeNode readConfigurationData(final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier arg0) {
                 return null;
             }
 
 
             @Override
-            public CompositeNode readOperationalData(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier arg0) {
+            public CompositeNode readOperationalData(final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier arg0) {
                 if (arg0.equals(GROUP_STATISTICS_ID_BI)) {
                     ImmutableCompositeNode data = ImmutableCompositeNode
                             .builder()
diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/DOMRpcServiceTestBugfix560.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/DOMRpcServiceTestBugfix560.java
new file mode 100644 (file)
index 0000000..c87b936
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.sal.binding.test.connect.dom;
+
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
+
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.sal.binding.api.mount.MountProviderInstance;
+import org.opendaylight.controller.sal.binding.api.mount.MountProviderService;
+import org.opendaylight.controller.sal.binding.test.util.BindingBrokerTestFactory;
+import org.opendaylight.controller.sal.binding.test.util.BindingTestContext;
+import org.opendaylight.controller.sal.common.util.Rpcs;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.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.bi.ba.rpcservice.rev140701.RockTheHouseInputBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
+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.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
+import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
+
+/**
+ * Test case for reported bug 560
+ *
+ * @author Lukas Sedlak
+ * @see <a
+ *      href="https://bugs.opendaylight.org/show_bug.cgi?id=560">https://bugs.opendaylight.org/show_bug.cgi?id=560</a>
+ */
+public class DOMRpcServiceTestBugfix560 {
+
+    private final static String RPC_SERVICE_NAMESPACE = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:test:bi:ba:rpcservice";
+    private final static String REVISION_DATE = "2014-07-01";
+    private final static QName RPC_NAME = QName.create(RPC_SERVICE_NAMESPACE,
+            REVISION_DATE, "rock-the-house");
+
+    private static final NodeId MOUNT_NODE = new NodeId("id");
+    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 BindingTestContext testContext;
+    private MountProvisionService domMountPointService;
+    private MountProviderService bindingMountPointService;
+    private SchemaContext schemaContext;
+
+    /**
+     * @throws java.lang.Exception
+     */
+    @Before
+    public void setUp() throws Exception {
+        BindingBrokerTestFactory testFactory = new BindingBrokerTestFactory();
+        testFactory.setExecutor(MoreExecutors.sameThreadExecutor());
+        testFactory.setStartWithParsedSchema(true);
+        testContext = testFactory.getTestContext();
+
+        testContext.start();
+        domMountPointService = testContext.getDomMountProviderService();
+        bindingMountPointService = testContext.getBindingMountProviderService();
+        assertNotNull(domMountPointService);
+
+        final YangContextParser parser = new YangParserImpl();
+        final InputStream moduleStream = BindingReflections.getModuleInfo(
+                OpendaylightTestRpcServiceService.class)
+                .getModuleSourceStream();
+
+        assertNotNull(moduleStream);
+        List<InputStream> rpcModels = Collections.singletonList(moduleStream);
+        @SuppressWarnings("deprecation")
+        Set<Module> modules = parser.parseYangModelsFromStreams(rpcModels);
+        @SuppressWarnings("deprecation")
+        SchemaContext mountSchemaContext = parser.resolveSchemaContext(modules);
+        schemaContext = mountSchemaContext;
+    }
+
+    private static org.opendaylight.yangtools.yang.data.api.InstanceIdentifier createBINodeIdentifier(
+            final NodeId mountNode) {
+        return org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+                .builder().node(Nodes.QNAME)
+                .nodeWithKey(Node.QNAME, NODE_ID_QNAME, mountNode.getValue())
+                .toInstance();
+    }
+
+    private static InstanceIdentifier<Node> createBANodeIdentifier(
+            final NodeId mountNode) {
+        return InstanceIdentifier.builder(Nodes.class)
+                .child(Node.class, new NodeKey(mountNode)).toInstance();
+    }
+
+    @SuppressWarnings("deprecation")
+    @Test
+    public void test() throws ExecutionException, InterruptedException {
+        // FIXME: This is made to only make sure instance identifier codec
+        // for path is instantiated.
+        testContext.getBindingDataBroker().readOperationalData(BA_MOUNT_ID);
+        final MountProvisionInstance mountPoint = domMountPointService
+                .createMountPoint(BI_MOUNT_ID);
+        mountPoint.setSchemaContext(schemaContext);
+        assertNotNull(mountPoint);
+
+        mountPoint.addRpcImplementation(RPC_NAME, new RpcImplementation() {
+
+            @Override
+            public ListenableFuture<RpcResult<CompositeNode>> invokeRpc(
+                    final QName rpc, final CompositeNode input) {
+
+                return Futures.immediateFuture(Rpcs
+                        .<CompositeNode> getRpcResult(true));
+            }
+
+            @Override
+            public Set<QName> getSupportedRpcs() {
+                return ImmutableSet.of(RPC_NAME);
+            }
+        });
+
+        final Set<QName> biSupportedRpcs = mountPoint.getSupportedRpcs();
+        assertNotNull(biSupportedRpcs);
+        assertTrue(!biSupportedRpcs.isEmpty());
+
+        MountProviderInstance mountInstance = bindingMountPointService
+                .getMountPoint(BA_MOUNT_ID);
+        assertNotNull(mountInstance);
+        final OpendaylightTestRpcServiceService rpcService = mountInstance
+                .getRpcService(OpendaylightTestRpcServiceService.class);
+        assertNotNull(rpcService);
+
+        try {
+            Future<RpcResult<Void>> result = rpcService
+                    .rockTheHouse(new RockTheHouseInputBuilder().build());
+            assertTrue(result.get().isSuccessful());
+        } catch (IllegalStateException ex) {
+            fail("OpendaylightTestRpcServiceService class doesn't contain rockTheHouse method!");
+        }
+    }
+
+    /**
+     * @throws java.lang.Exception
+     */
+    @After
+    public void teardown() throws Exception {
+        testContext.close();
+    }
+}
index 5ede600d9777917a0df963c01b5a08128057f722..c389618f2eb829f2dedb12ec58b0b365f7654ff0 100644 (file)
@@ -54,6 +54,7 @@ public class TestHelper {
                 mavenBundle("io.netty", "netty-transport").versionAsInProject(), //
 
                 mavenBundle(CONTROLLER, "config-manager").versionAsInProject(), // //
+                mavenBundle(CONTROLLER, "config-util").versionAsInProject(), // //
                 mavenBundle("commons-io", "commons-io").versionAsInProject(), //
                 mavenBundle(CONTROLLER, "config-manager").versionAsInProject(), //
                 mavenBundle(CONTROLLER, "yang-jmx-generator").versionAsInProject(), //
index 29c9bae31f76e2b1a1269116c2b3438cfa572172..ac4a0ffc331226504b47b5f1cf45b996b0522b5c 100644 (file)
@@ -101,7 +101,7 @@ public interface AsyncDataChangeEvent<P extends Path<P>, D> extends Immutable {
      *
      * @return map of paths and original state of updated and removed objects.
      */
-    Map<P, ? extends D> getOriginalData();
+    Map<P, D> getOriginalData();
 
     /**
      * Returns an immutable stable view of data state, which captures the state of
index f5f03a106b36119b188ca489924d514f88b12f00..bb866f276e713151ccf18b0e57e589c65633647f 100644 (file)
@@ -9,9 +9,63 @@ package org.opendaylight.controller.md.sal.common.api.notify;
 
 import java.util.concurrent.ExecutorService;
 
+/**
+ * Interface for publishing YANG-modeled notifications.
+ * <p>
+ * Users of this interface can publish any YANG-modeled notification which will
+ * be delivered to all subscribed listeners.
+ * <p>
+ * Prefered way of publishing of notifications is done by invoking {@link #publish(Object)}.
+ *
+ * <p>You may consider using {@link #publish(Object, ExecutorService)} if and only if
+ * your use-case requires customized  execution policy or run-to-completion
+ * inside process.
+ *
+ * <p>
+ * The metadata required to deliver a notification to the correct listeners is
+ * extracted from the published notification.
+ *
+ *
+ * FIXME: Consider clarification of execution/delivery policy, how it will be
+ * affected by Actor model and cluster-wide notifications.
+ *
+ * @param <N>
+ *            the type of notifications
+ */
 public interface NotificationPublishService<N> {
 
+    /**
+     * Publishes a notification and notifies subscribed listeners. All listener
+     * notifications are done via a default executor.
+     * <p>
+     * <b>Note:</b> This call will block when the default executor is saturated
+     * and the notification queue for this executor is full.
+     *
+     * @param notification
+     *            the notification to publish.
+     */
     void publish(N notification);
 
-    void publish(N notification,ExecutorService executor);
+    /**
+     * Publishes a notification and notifies subscribed listeners. All listener
+     * notifications are done via the provided executor.
+     * <p>
+     * <b>Note:</b> Use only if ineccessary. Consider using
+     * {@link #publish(Object)} for most use-cases.
+     *
+     * <p>
+     * By using this method you could customize execution policy of listeners present
+     * inside process (e.g. using  single-threaded executor or even same-thread executor
+     * delivery.
+     *
+     * <p>
+     * This executor is used only for inside-process notification deliveries.
+     *
+     * @param notification
+     *            the notification to publish.
+     * @param executor
+     *            the executor that will be used to deliver notifications to
+     *            subscribed listeners.
+     */
+    void publish(N notification, ExecutorService executor);
 }
diff --git a/opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/ToSalPropertyClassUtils.java b/opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/ToSalPropertyClassUtils.java
deleted file mode 100644 (file)
index 3894fbe..0000000
+++ /dev/null
@@ -1,76 +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.compability;
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
-
-public class ToSalPropertyClassUtils {
-    public static Bandwidth salAdvertisedBandwidthFrom(NodeConnector nodeConnector) {
-        FlowCapableNodeConnector flowCapNodeConn = nodeConnector.getAugmentation(FlowCapableNodeConnector.class);
-        PortFeatures portFeatures = flowCapNodeConn.getAdvertisedFeatures();
-        return new AdvertisedBandwidth(resolveBandwidth(portFeatures));
-    }
-
-    public static Bandwidth salPeerBandwidthFrom(NodeConnector nodeConnector) {
-        FlowCapableNodeConnector flowCapNodeConn = nodeConnector.getAugmentation(FlowCapableNodeConnector.class);
-        PortFeatures portFeatures = flowCapNodeConn.getPeerFeatures();
-        return new PeerBandwidth(resolveBandwidth(portFeatures));
-    }
-
-    public static Bandwidth salSupportedBandwidthFrom(NodeConnector nodeConnector) {
-        FlowCapableNodeConnector flowCapNodeConn = nodeConnector.getAugmentation(FlowCapableNodeConnector.class);
-        PortFeatures portFeatures = flowCapNodeConn.getSupported();
-        return new SupportedBandwidth(resolveBandwidth(portFeatures));
-    }
-
-    public static MacAddress salMacAddressFrom(NodeConnector nodeConnector) {
-        FlowCapableNodeConnector flowCapNodeConn = nodeConnector.getAugmentation(FlowCapableNodeConnector.class);
-        String hwAddress = flowCapNodeConn.getHardwareAddress().getValue();
-        return new MacAddress(bytesFrom(hwAddress));
-    }
-
-
-    public static Name salNameFrom(NodeConnector nodeConnector) {
-        FlowCapableNodeConnector flowCapNodeConn = nodeConnector.getAugmentation(FlowCapableNodeConnector.class);
-        return new Name(flowCapNodeConn.getName());
-    }
-
-
-
-    private static byte[] bytesFrom(String hwAddress) {
-        String[] mac = hwAddress.split(":");
-        byte[] macAddress = new byte[6]; // mac.length == 6 bytes
-        for (int i = 0; i < mac.length; i++) {
-            macAddress[i] = Integer.decode("0x" + mac[i]).byteValue();
-        }
-        return macAddress;
-    }
-
-    private static long resolveBandwidth(PortFeatures portFeatures) {
-        if (portFeatures.is_1tbFd()) {
-            return Bandwidth.BW1Tbps;
-        } else if (portFeatures.is_100gbFd()) {
-            return Bandwidth.BW100Gbps;
-        } else if (portFeatures.is_40gbFd()) {
-            return Bandwidth.BW40Gbps;
-        } else if (portFeatures.is_10gbFd()) {
-            return Bandwidth.BW10Gbps;
-        } else if (portFeatures.is_1gbHd() || portFeatures.is_1gbFd()) {
-            return Bandwidth.BW1Gbps;
-        } else if (portFeatures.is_100mbHd() || portFeatures.is_100mbFd()) {
-            return Bandwidth.BW100Mbps;
-        } else if (portFeatures.is_10mbHd() || portFeatures.is_10mbFd()) {
-            return Bandwidth.BW10Mbps;
-        } else {
-            return Bandwidth.BWUNK;
-        }
-    }
-
-}
index ea686d966ffa63b60e1cf3cb839db2f2eb034f1e..5152363ab2640e1dc1a612612bdcb0129e64692a 100644 (file)
       <artifactId>sal-binding-config</artifactId>
     </dependency>
 
-    <!--
-      Adding a temporary dependency on the sal-broker-impl so that we can use InMemoryDOMDataStore
+      <dependency>
+          <groupId>org.opendaylight.yangtools</groupId>
+          <artifactId>yang-data-api</artifactId>
+      </dependency>
+
+      <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-data-impl</artifactId>
+      </dependency>
 
-      InMemoryDOMDataStore needs to be moved into its own module and be wired up using config subsystem before
-      this bundle can use it
-    -->
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
-      <artifactId>sal-broker-impl</artifactId>
+      <artifactId>sal-inmemory-datastore</artifactId>
+      <version>1.1-SNAPSHOT</version>
     </dependency>
 
     <dependency>
       <version>${slf4j.version}</version>
       <scope>test</scope>
     </dependency>
+
   </dependencies>
 
   <build>
             <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
             <Export-package></Export-package>
             <Private-Package></Private-Package>
+            <Import-Package>!*snappy;!org.jboss.*;*</Import-Package>
+            <Embed-Dependency>
+                !sal*;
+                !*config-api*;
+                !*testkit*;
+                akka*;
+                *leveldb*;
+                *config*;
+                *hawt*;
+                *protobuf*;
+                *netty*;
+                *uncommons*;
+                *scala*;
+            </Embed-Dependency>
+            <Embed-Transitive>true</Embed-Transitive>
           </instructions>
         </configuration>
       </plugin>
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractUntypedActor.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractUntypedActor.java
new file mode 100644 (file)
index 0000000..0f10258
--- /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.cluster.datastore;
+
+import akka.actor.UntypedActor;
+import akka.event.Logging;
+import akka.event.LoggingAdapter;
+import org.opendaylight.controller.cluster.datastore.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-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ActorSystemFactory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ActorSystemFactory.java
new file mode 100644 (file)
index 0000000..baf04fe
--- /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.cluster.datastore;
+
+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-cluster", ConfigFactory
+                        .load().getConfig("ODLCluster"));
+                system.actorOf(Props.create(TerminationMonitor.class), "termination-monitor");
+                return system;
+        }
+    }).apply(null);
+
+    public static final ActorSystem getInstance(){
+        return actorSystem;
+    }
+}
index ba09d0402530921667915eae11103302cfcfb2ea..fd4f9f75b5bd801aaa1fd9484c3e0b01a8d522ae 100644 (file)
@@ -9,19 +9,41 @@
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.Props;
-import akka.actor.UntypedActor;
 import akka.japi.Creator;
+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.schema.NormalizedNode;
 
-public class DataChangeListener extends UntypedActor {
-    @Override public void onReceive(Object message) throws Exception {
-        throw new UnsupportedOperationException("onReceive");
+public class DataChangeListener extends AbstractUntypedActor {
+    private final AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> listener;
+
+    public DataChangeListener(
+        AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> listener) {
+        this.listener = listener;
+    }
+
+    @Override public void handleReceive(Object message) throws Exception {
+        if(message instanceof DataChanged){
+            DataChanged reply = (DataChanged) message;
+            AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>>
+                change = reply.getChange();
+            this.listener.onDataChanged(change);
+
+            if(getSender() != null){
+                getSender().tell(new DataChangedReply(), getSelf());
+            }
+
+        }
     }
 
-    public static Props props() {
+    public static Props props(final AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> listener) {
         return Props.create(new Creator<DataChangeListener>() {
             @Override
             public DataChangeListener create() throws Exception {
-                return new DataChangeListener();
+                return new DataChangeListener(listener);
             }
 
         });
@@ -9,20 +9,24 @@
 package org.opendaylight.controller.cluster.datastore;
 
 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.schema.NormalizedNode;
 
-public class ListenerProxy implements AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>{
-    private final ActorSelection listenerRegistrationActor;
+/**
+ * DataChangeListenerProxy represents a single remote DataChangeListener
+ */
+public class DataChangeListenerProxy implements AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>{
+    private final ActorSelection dataChangeListenerActor;
 
-    public ListenerProxy(ActorSelection listenerRegistrationActor) {
-        this.listenerRegistrationActor = listenerRegistrationActor;
+    public DataChangeListenerProxy(ActorSelection dataChangeListenerActor) {
+        this.dataChangeListenerActor = dataChangeListenerActor;
     }
 
     @Override public void onDataChanged(
         AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
-        throw new UnsupportedOperationException("onDataChanged");
+        dataChangeListenerActor.tell(new DataChanged(change), null);
     }
 }
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistration.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistration.java
new file mode 100644 (file)
index 0000000..dca9735
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * 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.PoisonPill;
+import akka.actor.Props;
+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.schema.NormalizedNode;
+
+public class DataChangeListenerRegistration extends AbstractUntypedActor {
+
+    private final org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>>
+        registration;
+
+    public DataChangeListenerRegistration(
+        org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> registration) {
+        this.registration = registration;
+    }
+
+    @Override
+    public void handleReceive(Object message) throws Exception {
+        if (message instanceof CloseDataChangeListenerRegistration) {
+            closeListenerRegistration(
+                (CloseDataChangeListenerRegistration) message);
+        }
+    }
+
+    public static Props props(
+        final org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> registration) {
+        return Props.create(new Creator<DataChangeListenerRegistration>() {
+
+            @Override
+            public DataChangeListenerRegistration create() throws Exception {
+                return new DataChangeListenerRegistration(registration);
+            }
+        });
+    }
+
+    private void closeListenerRegistration(
+        CloseDataChangeListenerRegistration message) {
+        registration.close();
+        getSender()
+            .tell(new CloseDataChangeListenerRegistrationReply(), getSelf());
+        getSelf().tell(PoisonPill.getInstance(), getSelf());
+    }
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxy.java
new file mode 100644 (file)
index 0000000..83737cf
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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.ActorSelection;
+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.schema.NormalizedNode;
+
+/**
+ * ListenerRegistrationProxy acts as a proxy for a ListenerRegistration that was done on a remote shard
+ * <p>
+ * Registering a DataChangeListener on the Data Store creates a new instance of the ListenerRegistrationProxy
+ * The ListenerRegistrationProxy talks to a remote ListenerRegistration actor.
+ * </p>
+ */
+public class DataChangeListenerRegistrationProxy implements ListenerRegistration {
+    private final ActorSelection listenerRegistrationActor;
+    private final AsyncDataChangeListener listener;
+    private final ActorRef dataChangeListenerActor;
+
+    public <L extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>>
+    DataChangeListenerRegistrationProxy(
+        ActorSelection listenerRegistrationActor,
+        L listener, ActorRef dataChangeListenerActor) {
+        this.listenerRegistrationActor = listenerRegistrationActor;
+        this.listener = listener;
+        this.dataChangeListenerActor = dataChangeListenerActor;
+    }
+
+    @Override
+    public Object getInstance() {
+        return listener;
+    }
+
+    @Override
+    public void close() {
+        listenerRegistrationActor.tell(new CloseDataChangeListenerRegistration(), null);
+        dataChangeListenerActor.tell(PoisonPill.getInstance(), null);
+    }
+}
index f64c6f1a8669888726f30bfe4099aa628365ccbb..4401104a85971c77c1b9a9333c727348f5398656 100644 (file)
@@ -29,10 +29,13 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
 /**
  *
  */
-public class DistributedDataStore implements DOMStore, SchemaContextListener {
+public class DistributedDataStore implements DOMStore, SchemaContextListener, AutoCloseable {
 
     private static final Logger
         LOG = LoggerFactory.getLogger(DistributedDataStore.class);
@@ -41,8 +44,20 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener {
     private final String type;
     private final ActorContext actorContext;
 
+
+    /**
+     * Executor used to run FutureTask's
+     *
+     * This is typically used when we need to make a request to an actor and
+     * wait for it's response and the consumer needs to be provided a Future.
+     *
+     * FIXME : Make the thread pool configurable
+     */
+    private final ExecutorService executor =
+        Executors.newFixedThreadPool(10);
+
     public DistributedDataStore(ActorSystem actorSystem, String type) {
-        this(new ActorContext(actorSystem, actorSystem.actorOf(ShardManager.props(type))), type);
+        this(new ActorContext(actorSystem, actorSystem.actorOf(ShardManager.props(type), "shardmanager-" + type)), type);
     }
 
     public DistributedDataStore(ActorContext actorContext, String type) {
@@ -56,40 +71,51 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener {
         InstanceIdentifier path, L listener,
         AsyncDataBroker.DataChangeScope scope) {
 
-        ActorRef dataChangeListenerActor = actorContext.getActorSystem().actorOf(DataChangeListener.props());
+        ActorRef dataChangeListenerActor = actorContext.getActorSystem().actorOf(
+            DataChangeListener.props(listener));
 
         Object result = actorContext.executeShardOperation(Shard.DEFAULT_NAME,
             new RegisterChangeListener(path, dataChangeListenerActor.path(),
                 AsyncDataBroker.DataChangeScope.BASE),
-            ActorContext.ASK_DURATION);
+            ActorContext.ASK_DURATION
+        );
 
         RegisterChangeListenerReply reply = (RegisterChangeListenerReply) result;
-        return new ListenerRegistrationProxy(reply.getListenerRegistrationPath());
+        return new DataChangeListenerRegistrationProxy(actorContext.actorSelection(reply.getListenerRegistrationPath()), listener, dataChangeListenerActor);
     }
 
 
 
     @Override
     public DOMStoreTransactionChain createTransactionChain() {
-        return new TransactionChainProxy(actorContext);
+        return new TransactionChainProxy(actorContext, executor);
     }
 
     @Override
     public DOMStoreReadTransaction newReadOnlyTransaction() {
-        return new TransactionProxy(actorContext, TransactionProxy.TransactionType.READ_ONLY);
+        return new TransactionProxy(actorContext, TransactionProxy.TransactionType.READ_ONLY,
+            executor);
     }
 
     @Override
     public DOMStoreWriteTransaction newWriteOnlyTransaction() {
-        return new TransactionProxy(actorContext, TransactionProxy.TransactionType.WRITE_ONLY);
+        return new TransactionProxy(actorContext, TransactionProxy.TransactionType.WRITE_ONLY,
+            executor);
     }
 
     @Override
     public DOMStoreReadWriteTransaction newReadWriteTransaction() {
-        return new TransactionProxy(actorContext, TransactionProxy.TransactionType.READ_WRITE);
+        return new TransactionProxy(actorContext, TransactionProxy.TransactionType.READ_WRITE,
+            executor);
     }
 
     @Override public void onGlobalContextUpdated(SchemaContext schemaContext) {
-        actorContext.getShardManager().tell(new UpdateSchemaContext(schemaContext), null);
+        actorContext.getShardManager().tell(
+            new UpdateSchemaContext(schemaContext), null);
+    }
+
+    @Override public void close() throws Exception {
+        actorContext.shutdown();
+
     }
 }
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreFactory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreFactory.java
new file mode 100644 (file)
index 0000000..f19cb92
--- /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.datastore;
+
+import org.opendaylight.controller.sal.core.api.model.SchemaService;
+
+public class DistributedDataStoreFactory {
+    public static DistributedDataStore createInstance(String name, SchemaService schemaService){
+        final DistributedDataStore dataStore =
+            new DistributedDataStore(ActorSystemFactory.getInstance(), name);
+        schemaService
+            .registerSchemaServiceListener(dataStore);
+        return dataStore;
+
+    }
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ListenerRegistration.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ListenerRegistration.java
deleted file mode 100644 (file)
index fda429f..0000000
+++ /dev/null
@@ -1,49 +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.cluster.datastore;
-
-import akka.actor.Props;
-import akka.actor.UntypedActor;
-import akka.japi.Creator;
-import org.opendaylight.controller.cluster.datastore.messages.CloseListenerRegistration;
-import org.opendaylight.controller.cluster.datastore.messages.CloseListenerRegistrationReply;
-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.schema.NormalizedNode;
-
-public class ListenerRegistration extends UntypedActor{
-
-  private final org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> registration;
-
-  public ListenerRegistration(org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> registration) {
-    this.registration = registration;
-  }
-
-  @Override
-  public void onReceive(Object message) throws Exception {
-    if(message instanceof CloseListenerRegistration){
-      closeListenerRegistration((CloseListenerRegistration) message);
-    }
-  }
-
-  public static Props props(final org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> registration){
-    return Props.create(new Creator<ListenerRegistration>(){
-
-      @Override
-      public ListenerRegistration create() throws Exception {
-        return new ListenerRegistration(registration);
-      }
-    });
-  }
-
-  private void closeListenerRegistration(CloseListenerRegistration message){
-    registration.close();
-    getSender().tell(new CloseListenerRegistrationReply(), getSelf());
-  }
-}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ListenerRegistrationProxy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ListenerRegistrationProxy.java
deleted file mode 100644 (file)
index a548a88..0000000
+++ /dev/null
@@ -1,37 +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.cluster.datastore;
-
-import akka.actor.ActorPath;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-
-/**
- * ListenerRegistrationProxy acts as a proxy for a ListenerRegistration that was done on a remote shard
- *
- * Registering a DataChangeListener on the Data Store creates a new instance of the ListenerRegistrationProxy
- * The ListenerRegistrationProxy talks to a remote ListenerRegistration actor.
- */
-public class ListenerRegistrationProxy implements ListenerRegistration {
-    private final ActorPath listenerRegistrationPath;
-
-    public ListenerRegistrationProxy(ActorPath listenerRegistrationPath) {
-
-        this.listenerRegistrationPath = listenerRegistrationPath;
-    }
-
-    @Override
-    public Object getInstance() {
-        throw new UnsupportedOperationException("getInstance");
-    }
-
-    @Override
-    public void close() {
-        throw new UnsupportedOperationException("close");
-    }
-}
index 5b4f7ef8989711dffdf4cdd8fbe7d483165f23a7..3425608d235ddce1555dac19f6bc3e985b65f7f9 100644 (file)
@@ -20,15 +20,19 @@ 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.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.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.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;
@@ -60,7 +64,17 @@ public class Shard extends UntypedProcessor {
     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) {
+
+        String setting = System.getProperty("shard.persistent");
+        this.persistent = !"false".equals(setting);
+
+        log.info("Creating shard : {} persistent : {}", name , persistent);
+
         store = new InMemoryDOMDataStore(name, storeExecutor);
     }
 
@@ -75,8 +89,11 @@ public class Shard extends UntypedProcessor {
         });
     }
 
+
     @Override
     public void onReceive(Object message) throws Exception {
+        log.debug("Received message {}", message);
+
         if (message instanceof CreateTransactionChain) {
             createTransactionChain();
         } else if (message instanceof RegisterChangeListener) {
@@ -86,12 +103,25 @@ public class Shard extends UntypedProcessor {
         } else if (message instanceof ForwardedCommitTransaction) {
             handleForwardedCommit((ForwardedCommitTransaction) message);
         } else if (message instanceof Persistent) {
-            commit((Persistent) message);
+            commit((Modification) ((Persistent) message).payload());
+        } else if (message instanceof CreateTransaction) {
+            createTransaction((CreateTransaction) message);
+        } else if(message instanceof NonPersistent){
+            commit((Modification) ((NonPersistent) message).payload());
         }
     }
 
-    private void commit(Persistent message) {
-        Modification modification = (Modification) message.payload();
+    private void createTransaction(CreateTransaction createTransaction) {
+        DOMStoreReadWriteTransaction transaction =
+            store.newReadWriteTransaction();
+        ActorRef transactionActor = getContext().actorOf(
+            ShardTransaction.props(transaction, getSelf()), "shard-" + createTransaction.getTransactionId());
+        getSender()
+            .tell(new CreateTransactionReply(transactionActor.path(), createTransaction.getTransactionId()),
+                getSelf());
+    }
+
+    private void commit(Modification modification) {
         DOMStoreThreePhaseCommitCohort cohort =
             modificationToCohort.remove(modification);
         if (cohort == null) {
@@ -109,6 +139,7 @@ public class Shard extends UntypedProcessor {
                     future.get();
                     sender.tell(new CommitTransactionReply(), self);
                 } catch (InterruptedException | ExecutionException e) {
+                    // FIXME : Handle this properly
                     log.error(e, "An exception happened when committing");
                 }
             }
@@ -116,11 +147,15 @@ public class Shard extends UntypedProcessor {
     }
 
     private void handleForwardedCommit(ForwardedCommitTransaction message) {
-        log.info("received forwarded transaction");
         modificationToCohort
             .put(message.getModification(), message.getCohort());
-        getSelf().forward(Persistent.create(message.getModification()),
-            getContext());
+        if(persistent) {
+            getSelf().forward(Persistent.create(message.getModification()),
+                getContext());
+        } else {
+            getSelf().forward(NonPersistent.create(message.getModification()),
+                getContext());
+        }
     }
 
     private void updateSchemaContext(UpdateSchemaContext message) {
@@ -130,18 +165,19 @@ public class Shard extends UntypedProcessor {
     private void registerChangeListener(
         RegisterChangeListener registerChangeListener) {
 
-        ActorSelection listenerRegistrationActor = getContext()
+        ActorSelection dataChangeListenerPath = getContext()
             .system().actorSelection(registerChangeListener.getDataChangeListenerPath());
 
         AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>
-            listener = new ListenerProxy(listenerRegistrationActor);
+            listener = new DataChangeListenerProxy(dataChangeListenerPath);
 
         org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>>
             registration =
             store.registerChangeListener(registerChangeListener.getPath(),
                 listener, registerChangeListener.getScope());
         ActorRef listenerRegistration =
-            getContext().actorOf(ListenerRegistration.props(registration));
+            getContext().actorOf(
+                DataChangeListenerRegistration.props(registration));
         getSender()
             .tell(new RegisterChangeListenerReply(listenerRegistration.path()),
                 getSelf());
index 4e2369d3758596bd1217670f8f3ec5a2438db36d..250ef49e6f0b73ca33ad0a41eb36c661b9560038 100644 (file)
@@ -12,7 +12,6 @@ import akka.actor.ActorPath;
 import akka.actor.ActorRef;
 import akka.actor.Address;
 import akka.actor.Props;
-import akka.actor.UntypedActor;
 import akka.event.Logging;
 import akka.event.LoggingAdapter;
 import akka.japi.Creator;
@@ -48,7 +47,7 @@ import java.util.Map;
  * <li> When a local shard replica comes alive
  * </p>
  */
-public class ShardManager extends UntypedActor {
+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<>();
@@ -69,7 +68,7 @@ public class ShardManager extends UntypedActor {
    *             configuration or operational
    */
   private ShardManager(String type){
-    ActorRef actor = getContext().actorOf(Shard.props(Shard.DEFAULT_NAME + "-" + type));
+    ActorRef actor = getContext().actorOf(Shard.props("shard-" + Shard.DEFAULT_NAME + "-" + type), "shard-" + Shard.DEFAULT_NAME + "-" + type);
     defaultShardPath = actor.path();
   }
 
@@ -84,7 +83,7 @@ public class ShardManager extends UntypedActor {
   }
 
   @Override
-  public void onReceive(Object message) throws Exception {
+  public void handleReceive(Object message) throws Exception {
     if (message instanceof FindPrimary) {
       FindPrimary msg = ((FindPrimary) message);
       String shardName = msg.getShardName();
index 75744cad5b920b942efda865d0fa6ed29c41f3d7..e3d1e2d9d42e4968f4b81ca0ea33d40c2b7b07f7 100644 (file)
@@ -9,8 +9,8 @@
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorRef;
+import akka.actor.PoisonPill;
 import akka.actor.Props;
-import akka.actor.UntypedActor;
 import akka.event.Logging;
 import akka.event.LoggingAdapter;
 import akka.japi.Creator;
@@ -36,6 +36,7 @@ import org.opendaylight.controller.cluster.datastore.modification.MutableComposi
 import org.opendaylight.controller.cluster.datastore.modification.WriteModification;
 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.schema.NormalizedNode;
 
@@ -43,16 +44,16 @@ import java.util.concurrent.ExecutionException;
 
 /**
  * The ShardTransaction Actor represents a remote transaction
- *<p>
+ * <p>
  * The ShardTransaction Actor delegates all actions to DOMDataReadWriteTransaction
- *</p>
- *<p>
+ * </p>
+ * <p>
  * Even though the DOMStore and the DOMStoreTransactionChain implement multiple types of transactions
  * the ShardTransaction Actor only works with read-write transactions. This is just to keep the logic simple. At this
  * time there are no known advantages for creating a read-only or write-only transaction which may change over time
  * at which point we can optimize things in the distributed store as well.
- *</p>
- *<p>
+ * </p>
+ * <p>
  * Handles Messages <br/>
  * ---------------- <br/>
  * <li> {@link org.opendaylight.controller.cluster.datastore.messages.ReadData}
@@ -63,125 +64,164 @@ import java.util.concurrent.ExecutionException;
  * <li> {@link org.opendaylight.controller.cluster.datastore.messages.CloseTransaction}
  * </p>
  */
-public class ShardTransaction extends UntypedActor {
-
-  private final ActorRef shardActor;
-
-  private final DOMStoreReadWriteTransaction transaction;
-
-  private final MutableCompositeModification modification = new MutableCompositeModification();
-
-  private final LoggingAdapter log = Logging.getLogger(getContext().system(), this);
-
-  public ShardTransaction(DOMStoreReadWriteTransaction transaction, ActorRef shardActor) {
-    this.transaction = transaction;
-    this.shardActor = shardActor;
-  }
-
-
-  public static Props props(final DOMStoreReadWriteTransaction transaction, final ActorRef shardActor){
-    return Props.create(new Creator<ShardTransaction>(){
-
-      @Override
-      public ShardTransaction create() throws Exception {
-        return new ShardTransaction(transaction, shardActor);
-      }
-    });
-  }
-
-  @Override
-  public void onReceive(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);
-    } else if(message instanceof GetCompositedModification){
-      // This is here for testing only
-      getSender().tell(new GetCompositeModificationReply(new ImmutableCompositeModification(modification)), getSelf());
+public class ShardTransaction extends AbstractUntypedActor {
+
+    private final ActorRef shardActor;
+
+    // FIXME : see below
+    // If transactionChain is not null then this transaction is part of a
+    // transactionChain. Not really clear as to what that buys us
+    private final DOMStoreTransactionChain transactionChain;
+
+    private final DOMStoreReadWriteTransaction transaction;
+
+    private final MutableCompositeModification modification =
+        new MutableCompositeModification();
+
+    private final LoggingAdapter log =
+        Logging.getLogger(getContext().system(), this);
+
+    public ShardTransaction(DOMStoreReadWriteTransaction transaction,
+        ActorRef shardActor) {
+        this(null, transaction, shardActor);
     }
-  }
-
-  private void readData(ReadData message) {
-    final ActorRef sender = getSender();
-    final ActorRef self = getSelf();
-    final InstanceIdentifier path = message.getPath();
-    final ListenableFuture<Optional<NormalizedNode<?, ?>>> future = transaction.read(path);
-
-    future.addListener(new Runnable() {
-      @Override
-      public void run() {
-        try {
-          Optional<NormalizedNode<?, ?>> optional = future.get();
-          if(optional.isPresent()){
-            sender.tell(new ReadDataReply(optional.get()), self);
-          } else {
-            //TODO : Need to decide what to do here
-          }
-        } catch (InterruptedException | ExecutionException e) {
-          log.error(e, "An exception happened when reading data from path : " + path.toString());
-        }
 
-      }
-    }, getContext().dispatcher());
-  }
+    public ShardTransaction(DOMStoreTransactionChain transactionChain, DOMStoreReadWriteTransaction transaction,
+        ActorRef shardActor) {
+        this.transactionChain = transactionChain;
+        this.transaction = transaction;
+        this.shardActor = shardActor;
+    }
 
 
-  private void writeData(WriteData message){
-    modification.addModification(new WriteModification(message.getPath(), message.getData()));
-    transaction.write(message.getPath(), message.getData());
-    getSender().tell(new WriteDataReply(), getSelf());
-  }
 
-  private void mergeData(MergeData message){
-    modification.addModification(new MergeModification(message.getPath(), message.getData()));
-    transaction.merge(message.getPath(), message.getData());
-    getSender().tell(new MergeDataReply(), getSelf());
-  }
+    public static Props props(final DOMStoreReadWriteTransaction transaction,
+        final ActorRef shardActor) {
+        return Props.create(new Creator<ShardTransaction>() {
 
-  private void deleteData(DeleteData message){
-    modification.addModification(new DeleteModification(message.getPath()));
-    transaction.delete(message.getPath());
-    getSender().tell(new DeleteDataReply(), getSelf());
-  }
+            @Override
+            public ShardTransaction create() throws Exception {
+                return new ShardTransaction(transaction, shardActor);
+            }
+        });
+    }
 
-  private void readyTransaction(ReadyTransaction message){
-    DOMStoreThreePhaseCommitCohort cohort = transaction.ready();
-    ActorRef cohortActor = getContext().actorOf(ThreePhaseCommitCohort.props(cohort, shardActor, modification));
-    getSender().tell(new ReadyTransactionReply(cohortActor.path()), getSelf());
+    public static Props props(final DOMStoreTransactionChain transactionChain, final DOMStoreReadWriteTransaction transaction,
+        final ActorRef shardActor) {
+        return Props.create(new Creator<ShardTransaction>() {
 
-  }
+            @Override
+            public ShardTransaction create() throws Exception {
+                return new ShardTransaction(transactionChain, transaction, shardActor);
+            }
+        });
+    }
 
-  private void closeTransaction(CloseTransaction message){
-    transaction.close();
-    getSender().tell(new CloseTransactionReply(), getSelf());
-  }
 
+    @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);
+        } else if (message instanceof GetCompositedModification) {
+            // This is here for testing only
+            getSender().tell(new GetCompositeModificationReply(
+                new ImmutableCompositeModification(modification)), getSelf());
+        }
+    }
 
-  // These classes are in here for test purposes only
+    private void readData(ReadData message) {
+        final ActorRef sender = getSender();
+        final ActorRef self = getSelf();
+        final InstanceIdentifier path = message.getPath();
+        final ListenableFuture<Optional<NormalizedNode<?, ?>>> future =
+            transaction.read(path);
+
+        future.addListener(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    Optional<NormalizedNode<?, ?>> optional = future.get();
+                    if (optional.isPresent()) {
+                        sender.tell(new ReadDataReply(optional.get()), self);
+                    } else {
+                        sender.tell(new ReadDataReply(null), self);
+                    }
+                } catch (InterruptedException | ExecutionException e) {
+                    log.error(e,
+                        "An exception happened when reading data from path : "
+                            + path.toString());
+                }
+
+            }
+        }, getContext().dispatcher());
+    }
 
-  static class GetCompositedModification {
 
-  }
+    private void writeData(WriteData message) {
+        modification.addModification(
+            new WriteModification(message.getPath(), message.getData()));
+        transaction.write(message.getPath(), message.getData());
+        getSender().tell(new WriteDataReply(), getSelf());
+    }
 
-  static class GetCompositeModificationReply {
-    private final CompositeModification modification;
+    private void mergeData(MergeData message) {
+        modification.addModification(
+            new MergeModification(message.getPath(), message.getData()));
+        transaction.merge(message.getPath(), message.getData());
+        getSender().tell(new MergeDataReply(), getSelf());
+    }
 
+    private void deleteData(DeleteData message) {
+        modification.addModification(new DeleteModification(message.getPath()));
+        transaction.delete(message.getPath());
+        getSender().tell(new DeleteDataReply(), getSelf());
+    }
+
+    private void readyTransaction(ReadyTransaction message) {
+        DOMStoreThreePhaseCommitCohort cohort = transaction.ready();
+        ActorRef cohortActor = getContext().actorOf(
+            ThreePhaseCommitCohort.props(cohort, shardActor, modification), "cohort");
+        getSender()
+            .tell(new ReadyTransactionReply(cohortActor.path()), getSelf());
+
+    }
+
+    private void closeTransaction(CloseTransaction message) {
+        transaction.close();
+        getSender().tell(new CloseTransactionReply(), getSelf());
+        getSelf().tell(PoisonPill.getInstance(), getSelf());
+    }
+
+
+    // These classes are in here for test purposes only
+
+
+    static class GetCompositedModification {
 
-    GetCompositeModificationReply(CompositeModification modification) {
-      this.modification = modification;
     }
 
 
-    public CompositeModification getModification() {
-      return modification;
+    static class GetCompositeModificationReply {
+        private final CompositeModification modification;
+
+
+        GetCompositeModificationReply(CompositeModification modification) {
+            this.modification = modification;
+        }
+
+
+        public CompositeModification getModification() {
+            return modification;
+        }
     }
-  }
 }
index 79aaa86b28baaa71f161dceca0d56f59528d94a1..1092e9a793d82443b2bda82eeb81fbebb7360675 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorRef;
 import akka.actor.Props;
-import akka.actor.UntypedActor;
 import akka.japi.Creator;
 import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChain;
 import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChainReply;
@@ -22,33 +21,42 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
 /**
  * The ShardTransactionChain Actor represents a remote TransactionChain
  */
-public class ShardTransactionChain extends UntypedActor{
-
-  private final DOMStoreTransactionChain chain;
-
-  public ShardTransactionChain(DOMStoreTransactionChain chain) {
-    this.chain = chain;
-  }
-
-  @Override
-  public void onReceive(Object message) throws Exception {
-    if(message instanceof CreateTransaction){
-      DOMStoreReadWriteTransaction transaction = chain.newReadWriteTransaction();
-      ActorRef transactionActor = getContext().actorOf(ShardTransaction.props(transaction, getContext().parent()));
-      getSender().tell(new CreateTransactionReply(transactionActor.path()), getSelf());
-    } else if (message instanceof CloseTransactionChain){
-      chain.close();
-      getSender().tell(new CloseTransactionChainReply(), getSelf());
+public class ShardTransactionChain extends AbstractUntypedActor {
+
+    private final DOMStoreTransactionChain chain;
+
+    public ShardTransactionChain(DOMStoreTransactionChain chain) {
+        this.chain = chain;
     }
-  }
 
-  public static Props props(final DOMStoreTransactionChain chain){
-    return Props.create(new Creator<ShardTransactionChain>(){
+    @Override
+    public void handleReceive(Object message) throws Exception {
+        if (message instanceof CreateTransaction) {
+            CreateTransaction createTransaction = (CreateTransaction) message;
+            createTransaction(createTransaction);
+        } else if (message instanceof CloseTransactionChain) {
+            chain.close();
+            getSender().tell(new CloseTransactionChainReply(), getSelf());
+        }
+    }
 
-      @Override
-      public ShardTransactionChain create() throws Exception {
-        return new ShardTransactionChain(chain);
-      }
-    });
-  }
+    private void createTransaction(CreateTransaction createTransaction) {
+        DOMStoreReadWriteTransaction transaction =
+            chain.newReadWriteTransaction();
+        ActorRef transactionActor = getContext().actorOf(ShardTransaction
+            .props(chain, transaction, getContext().parent()), "shard-" + createTransaction.getTransactionId());
+        getSender()
+            .tell(new CreateTransactionReply(transactionActor.path(), createTransaction.getTransactionId()),
+                getSelf());
+    }
+
+    public static Props props(final DOMStoreTransactionChain chain) {
+        return Props.create(new Creator<ShardTransactionChain>() {
+
+            @Override
+            public ShardTransactionChain create() throws Exception {
+                return new ShardTransactionChain(chain);
+            }
+        });
+    }
 }
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TerminationMonitor.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TerminationMonitor.java
new file mode 100644 (file)
index 0000000..e6ac7f8
--- /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.datastore;
+
+import akka.actor.Terminated;
+import akka.actor.UntypedActor;
+import akka.event.Logging;
+import akka.event.LoggingAdapter;
+import org.opendaylight.controller.cluster.datastore.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());
+        }
+    }
+}
index 61baf1ab64421e04f76d52ec684709ca33f38d25..060c9d6b509ab26f481a59c492da753ab70a2400 100644 (file)
@@ -9,8 +9,8 @@
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorRef;
+import akka.actor.PoisonPill;
 import akka.actor.Props;
-import akka.actor.UntypedActor;
 import akka.event.Logging;
 import akka.event.LoggingAdapter;
 import akka.japi.Creator;
@@ -28,101 +28,110 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCoh
 
 import java.util.concurrent.ExecutionException;
 
-public class ThreePhaseCommitCohort extends UntypedActor{
-  private final DOMStoreThreePhaseCommitCohort cohort;
-  private final ActorRef shardActor;
-  private final CompositeModification modification;
-
-  public ThreePhaseCommitCohort(DOMStoreThreePhaseCommitCohort cohort, ActorRef shardActor, CompositeModification modification) {
-    this.cohort = cohort;
-    this.shardActor = shardActor;
-    this.modification = modification;
-  }
-
-  private final LoggingAdapter log = Logging.getLogger(getContext().system(), this);
-
-  public static Props props(final DOMStoreThreePhaseCommitCohort cohort, final ActorRef shardActor, final CompositeModification modification) {
-    return Props.create(new Creator<ThreePhaseCommitCohort>(){
-      @Override
-      public ThreePhaseCommitCohort create() throws Exception {
-        return new ThreePhaseCommitCohort(cohort, shardActor, modification);
-      }
-    });
-  }
-
-  @Override
-  public void onReceive(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);
+public class ThreePhaseCommitCohort extends AbstractUntypedActor {
+    private final DOMStoreThreePhaseCommitCohort cohort;
+    private final ActorRef shardActor;
+    private final CompositeModification modification;
+
+    public ThreePhaseCommitCohort(DOMStoreThreePhaseCommitCohort cohort,
+        ActorRef shardActor, CompositeModification modification) {
+
+        this.cohort = cohort;
+        this.shardActor = shardActor;
+        this.modification = modification;
     }
-  }
-
-  private void abort(AbortTransaction message) {
-    final ListenableFuture<Void> future = cohort.abort();
-    final ActorRef sender = getSender();
-    final ActorRef self = getSelf();
-
-    future.addListener(new Runnable() {
-      @Override
-      public void run() {
-        try {
-          future.get();
-          sender.tell(new AbortTransactionReply(), self);
-        } catch (InterruptedException | ExecutionException e) {
-          log.error(e, "An exception happened when aborting");
-        }
-      }
-    }, getContext().dispatcher());
-  }
-
-  private void commit(CommitTransaction message) {
-    // Forward the commit to the shard
-    log.info("Commit transaction now + " + shardActor);
-    shardActor.forward(new ForwardedCommitTransaction(cohort, modification), getContext());
-
-  }
-
-  private void preCommit(PreCommitTransaction message) {
-    final ListenableFuture<Void> future = cohort.preCommit();
-    final ActorRef sender = getSender();
-    final ActorRef self = getSelf();
-
-    future.addListener(new Runnable() {
-      @Override
-      public void run() {
-        try {
-          future.get();
-          sender.tell(new PreCommitTransactionReply(), self);
-        } catch (InterruptedException | ExecutionException e) {
-          log.error(e, "An exception happened when preCommitting");
-        }
-      }
-    }, getContext().dispatcher());
-
-  }
-
-  private void canCommit(CanCommitTransaction message) {
-    final ListenableFuture<Boolean> future = cohort.canCommit();
-    final ActorRef sender = getSender();
-    final ActorRef self = getSelf();
-
-    future.addListener(new Runnable() {
-      @Override
-      public void run() {
-        try {
-          Boolean canCommit = future.get();
-          sender.tell(new CanCommitTransactionReply(canCommit), self);
-        } catch (InterruptedException | ExecutionException e) {
-          log.error(e, "An exception happened when aborting");
+
+    private final LoggingAdapter log =
+        Logging.getLogger(getContext().system(), this);
+
+    public static Props props(final DOMStoreThreePhaseCommitCohort cohort,
+        final ActorRef shardActor, final CompositeModification modification) {
+        return Props.create(new Creator<ThreePhaseCommitCohort>() {
+            @Override
+            public ThreePhaseCommitCohort create() throws Exception {
+                return new ThreePhaseCommitCohort(cohort, shardActor,
+                    modification);
+            }
+        });
+    }
+
+
+    @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);
         }
-      }
-    }, getContext().dispatcher());
+    }
+
+    private void abort(AbortTransaction message) {
+        final ListenableFuture<Void> future = cohort.abort();
+        final ActorRef sender = getSender();
+        final ActorRef self = getSelf();
+
+        future.addListener(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    future.get();
+                    sender.tell(new AbortTransactionReply(), self);
+                } catch (InterruptedException | ExecutionException e) {
+                    log.error(e, "An exception happened when aborting");
+                }
+            }
+        }, getContext().dispatcher());
+    }
+
+    private void commit(CommitTransaction message) {
+        // Forward the commit to the shard
+        log.debug("Forward commit transaction to Shard {} ", shardActor);
+        shardActor.forward(new ForwardedCommitTransaction(cohort, modification),
+            getContext());
+
+        getContext().parent().tell(PoisonPill.getInstance(), getSelf());
+
+    }
 
-  }
+    private void preCommit(PreCommitTransaction message) {
+        final ListenableFuture<Void> future = cohort.preCommit();
+        final ActorRef sender = getSender();
+        final ActorRef self = getSelf();
+
+        future.addListener(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    future.get();
+                    sender.tell(new PreCommitTransactionReply(), self);
+                } catch (InterruptedException | ExecutionException e) {
+                    log.error(e, "An exception happened when preCommitting");
+                }
+            }
+        }, getContext().dispatcher());
+
+    }
+
+    private void canCommit(CanCommitTransaction message) {
+        final ListenableFuture<Boolean> future = cohort.canCommit();
+        final ActorRef sender = getSender();
+        final ActorRef self = getSelf();
+
+        future.addListener(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    Boolean canCommit = future.get();
+                    sender.tell(new CanCommitTransactionReply(canCommit), self);
+                } catch (InterruptedException | ExecutionException e) {
+                    log.error(e, "An exception happened when aborting");
+                }
+            }
+        }, getContext().dispatcher());
+
+    }
 }
index 197b3b70cefa292e3829b776560b4cd2ae99967f..279ecba40977e1293a9fbad090cd1a0dfddff2a4 100644 (file)
@@ -9,11 +9,27 @@
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorPath;
+import akka.actor.ActorSelection;
 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.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;
+import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.Collections;
 import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
 
 /**
  * ThreePhaseCommitCohortProxy represents a set of remote cohort proxies
@@ -21,27 +37,114 @@ import java.util.List;
 public class ThreePhaseCommitCohortProxy implements
     DOMStoreThreePhaseCommitCohort{
 
+    private static final Logger
+        LOG = LoggerFactory.getLogger(DistributedDataStore.class);
+
+    private final ActorContext actorContext;
     private final List<ActorPath> cohortPaths;
+    private final ExecutorService executor;
+    private final String transactionId;
+
 
-    public ThreePhaseCommitCohortProxy(List<ActorPath> cohortPaths) {
+    public ThreePhaseCommitCohortProxy(ActorContext actorContext,
+        List<ActorPath> cohortPaths,
+        String transactionId,
+        ExecutorService executor) {
 
+        this.actorContext = actorContext;
         this.cohortPaths = cohortPaths;
+        this.transactionId = transactionId;
+        this.executor = executor;
     }
 
     @Override public ListenableFuture<Boolean> canCommit() {
-        throw new UnsupportedOperationException("canCommit");
+        Callable<Boolean> call = new Callable() {
+
+            @Override public Boolean call() throws Exception {
+            for(ActorPath actorPath : cohortPaths){
+                ActorSelection cohort = actorContext.actorSelection(actorPath);
+
+                try {
+                    Object response =
+                        actorContext.executeRemoteOperation(cohort,
+                            new CanCommitTransaction(),
+                            ActorContext.ASK_DURATION);
+
+                    if (response instanceof CanCommitTransactionReply) {
+                        CanCommitTransactionReply reply =
+                            (CanCommitTransactionReply) response;
+                        if (!reply.getCanCommit()) {
+                            return false;
+                        }
+                    }
+                } catch(RuntimeException e){
+                    LOG.error("Unexpected Exception", e);
+                    return false;
+                }
+
+
+            }
+            return true;
+            }
+        };
+
+        ListenableFutureTask<Boolean>
+            future = ListenableFutureTask.create(call);
+
+        executor.submit(future);
+
+        return future;
     }
 
     @Override public ListenableFuture<Void> preCommit() {
-        throw new UnsupportedOperationException("preCommit");
+        return voidOperation(new PreCommitTransaction(), PreCommitTransactionReply.class);
     }
 
     @Override public ListenableFuture<Void> abort() {
-        throw new UnsupportedOperationException("abort");
+        return voidOperation(new AbortTransaction(), AbortTransactionReply.class);
     }
 
     @Override public ListenableFuture<Void> commit() {
-        throw new UnsupportedOperationException("commit");
+        return voidOperation(new CommitTransaction(), CommitTransactionReply.class);
+    }
+
+    private ListenableFuture<Void> voidOperation(final Object message, final Class expectedResponseClass){
+        Callable<Void> call = new Callable<Void>() {
+
+            @Override public Void call() throws Exception {
+                for(ActorPath actorPath : cohortPaths){
+                    ActorSelection cohort = actorContext.actorSelection(actorPath);
+
+                    try {
+                        Object response =
+                            actorContext.executeRemoteOperation(cohort,
+                                message,
+                                ActorContext.ASK_DURATION);
+
+                        if (response != null && !response.getClass()
+                            .equals(expectedResponseClass)) {
+                            throw new RuntimeException(
+                                String.format(
+                                    "did not get the expected response \n\t\t expected : %s \n\t\t actual   : %s",
+                                    expectedResponseClass.toString(),
+                                    response.getClass().toString())
+                            );
+                        }
+                    } catch(TimeoutException e){
+                        LOG.error(String.format("A timeout occurred when processing operation : %s", message));
+                    }
+                }
+                return null;
+            }
+        };
+
+        ListenableFutureTask<Void>
+            future = ListenableFutureTask.create(call);
+
+        executor.submit(future);
+
+        return future;
+
     }
 
     public List<ActorPath> getCohortPaths() {
index 837ffc1b51dd8c5b2a80a3cf2f71a1076406648d..71b61ffaa0bbfd81121b87ee616e3cce2e71ac07 100644 (file)
@@ -14,36 +14,41 @@ 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 java.util.concurrent.ExecutorService;
+
 /**
  * TransactionChainProxy acts as a proxy for a DOMStoreTransactionChain created on a remote shard
  */
 public class TransactionChainProxy implements DOMStoreTransactionChain{
     private final ActorContext actorContext;
+    private final ExecutorService transactionExecutor;
 
-    public TransactionChainProxy(ActorContext actorContext) {
+    public TransactionChainProxy(ActorContext actorContext, ExecutorService transactionExecutor) {
         this.actorContext = actorContext;
+        this.transactionExecutor = transactionExecutor;
     }
 
     @Override
     public DOMStoreReadTransaction newReadOnlyTransaction() {
         return new TransactionProxy(actorContext,
-            TransactionProxy.TransactionType.READ_ONLY);
+            TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
     }
 
     @Override
     public DOMStoreReadWriteTransaction newReadWriteTransaction() {
         return new TransactionProxy(actorContext,
-            TransactionProxy.TransactionType.WRITE_ONLY);
+            TransactionProxy.TransactionType.WRITE_ONLY, transactionExecutor);
     }
 
     @Override
     public DOMStoreWriteTransaction newWriteOnlyTransaction() {
         return new TransactionProxy(actorContext,
-            TransactionProxy.TransactionType.READ_WRITE);
+            TransactionProxy.TransactionType.READ_WRITE, transactionExecutor);
     }
 
     @Override
     public void close() {
+        // FIXME : The problem here is don't know which shard the transaction chain is to be created on ???
         throw new UnsupportedOperationException("close - not sure what to do here?");
     }
 }
index 32bb7d0951964975b850c8a1a685ce7d95c03f47..74245c42592ca3d6743d0aef3b48bb2e6ace2b45 100644 (file)
@@ -34,7 +34,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Callable;
-import java.util.concurrent.Executors;
+import java.util.concurrent.ExecutorService;
 import java.util.concurrent.atomic.AtomicLong;
 
 /**
@@ -50,7 +50,6 @@ import java.util.concurrent.atomic.AtomicLong;
  * </p>
  */
 public class TransactionProxy implements DOMStoreReadWriteTransaction {
-
     public enum TransactionType {
         READ_ONLY,
         WRITE_ONLY,
@@ -59,20 +58,24 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction {
 
     private static final AtomicLong counter = new AtomicLong();
 
-    private final TransactionType readOnly;
+    private final TransactionType transactionType;
     private final ActorContext actorContext;
     private final Map<String, ActorSelection> remoteTransactionPaths = new HashMap<>();
     private final String identifier;
+    private final ExecutorService executor;
 
     public TransactionProxy(
         ActorContext actorContext,
-        TransactionType readOnly) {
+        TransactionType transactionType,
+        ExecutorService executor
+        ) {
 
-        this.identifier = "transaction-" + counter.getAndIncrement();
-        this.readOnly = readOnly;
+        this.identifier = "txn-" + counter.getAndIncrement();
+        this.transactionType = transactionType;
         this.actorContext = actorContext;
+        this.executor = executor;
 
-        Object response = actorContext.executeShardOperation(Shard.DEFAULT_NAME, new CreateTransaction(), ActorContext.ASK_DURATION);
+        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()));
@@ -91,6 +94,9 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction {
                         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());
                 }
@@ -102,8 +108,7 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction {
         ListenableFutureTask<Optional<NormalizedNode<?, ?>>>
             future = ListenableFutureTask.create(call);
 
-        //FIXME : Use a thread pool here
-        Executors.newSingleThreadExecutor().submit(future);
+        executor.submit(future);
 
         return future;
     }
@@ -142,7 +147,7 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction {
             }
         }
 
-        return new ThreePhaseCommitCohortProxy(cohortPaths);
+        return new ThreePhaseCommitCohortProxy(actorContext, cohortPaths, identifier, executor);
     }
 
     @Override
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/exceptions/PrimaryNotFoundException.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/exceptions/PrimaryNotFoundException.java
new file mode 100644 (file)
index 0000000..5a131ad
--- /dev/null
@@ -0,0 +1,12 @@
+/*
+ * 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.exceptions;
+
+public class PrimaryNotFoundException extends RuntimeException {
+}
@@ -5,8 +5,11 @@
  * 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.impl.connect.dom;
 
-public class Constants {
-    public static final Class<byte[]> BYTES_CLASS = byte[].class;
+package org.opendaylight.controller.cluster.datastore.exceptions;
+
+public class TimeoutException extends RuntimeException {
+    public TimeoutException(Exception e){
+        super(e);
+    }
 }
@@ -5,11 +5,8 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.sal.binding.test.bugfix;
-
-public class RpcRegistrationNullPointer {
-
-
 
+package org.opendaylight.controller.cluster.datastore.messages;
 
+public class CloseDataChangeListenerRegistrationReply {
 }
index e0cdd3cc2b6876ff1e34a155b9e4f18336f0de7a..611064169655185fe0423bfc879b751d625a538b 100644 (file)
@@ -9,5 +9,14 @@
 package org.opendaylight.controller.cluster.datastore.messages;
 
 public class CreateTransaction {
+    private final String transactionId;
 
+    public CreateTransaction(String transactionId){
+
+        this.transactionId = transactionId;
+    }
+
+    public String getTransactionId() {
+        return transactionId;
+    }
 }
index 4faf9d370d56a4dc4bb3edf97de469fb33f95362..46b7194c84c1f13b9503623d43ad1e2aef7a50aa 100644 (file)
@@ -11,13 +11,20 @@ package org.opendaylight.controller.cluster.datastore.messages;
 import akka.actor.ActorPath;
 
 public class CreateTransactionReply {
-  private final ActorPath transactionPath;
+    private final ActorPath transactionPath;
+    private final String transactionId;
 
-  public CreateTransactionReply(ActorPath transactionPath) {
-    this.transactionPath = transactionPath;
-  }
+    public CreateTransactionReply(ActorPath transactionPath,
+        String transactionId) {
+        this.transactionPath = transactionPath;
+        this.transactionId = transactionId;
+    }
 
-  public ActorPath getTransactionPath() {
-    return transactionPath;
-  }
+    public ActorPath getTransactionPath() {
+        return transactionPath;
+    }
+
+    public String getTransactionId() {
+        return transactionId;
+    }
 }
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChanged.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChanged.java
new file mode 100644 (file)
index 0000000..c55dae5
--- /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;
+
+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.schema.NormalizedNode;
+
+public class DataChanged {
+    private final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>>
+        change;
+
+    public DataChanged(
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
+        this.change = change;
+    }
+
+    public AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> getChange() {
+        return change;
+    }
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/Monitor.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/Monitor.java
new file mode 100644 (file)
index 0000000..567f14a
--- /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.cluster.datastore.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-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/NonPersistent.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/NonPersistent.java
new file mode 100644 (file)
index 0000000..a779ed0
--- /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.messages;
+
+/**
+ * A NonPersistent message is to be used when we want to trigger state update
+ * for an actor without actually persisting the data to disk. This could be
+ * useful for test purposes.
+ */
+public class NonPersistent {
+    private final Object payload;
+
+    public NonPersistent(Object payload){
+        this.payload = payload;
+    }
+
+    public Object payload() {
+        return payload;
+    }
+
+    public static NonPersistent create(Object payload){
+        return new NonPersistent(payload);
+    }
+}
index ba4d4de6bfaeed985bf1e70c626c4a3bd365a0b1..c97e07db6d60c867c9f4c1687c9495ae9722a3c9 100644 (file)
@@ -12,7 +12,10 @@ import akka.actor.ActorPath;
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
 import akka.actor.ActorSystem;
+import akka.actor.PoisonPill;
 import akka.util.Timeout;
+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.slf4j.Logger;
@@ -81,7 +84,7 @@ public class ActorContext {
 
             return actorSystem.actorSelection(found.getPrimaryPath());
         }
-        throw new RuntimeException("primary was not found");
+        throw new PrimaryNotFoundException();
     }
 
     /**
@@ -99,7 +102,7 @@ public class ActorContext {
         try {
             return Await.result(future, AWAIT_DURATION);
         } catch (Exception e) {
-            throw new RuntimeException(e);
+            throw new TimeoutException(e);
         }
     }
 
@@ -118,7 +121,7 @@ public class ActorContext {
         try {
             return Await.result(future, AWAIT_DURATION);
         } catch (Exception e) {
-            throw new RuntimeException(e);
+            throw new TimeoutException(e);
         }
     }
 
@@ -131,7 +134,8 @@ public class ActorContext {
      * @param shardName
      * @param message
      * @param duration
-     * @throws java.lang.RuntimeException when a primary is not found or if the message to the remote shard fails or times out
+     * @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
      */
@@ -141,4 +145,8 @@ public class ActorContext {
         return executeRemoteOperation(primary, message, duration);
     }
 
+    public void shutdown() {
+        shardManager.tell(PoisonPill.getInstance(), null);
+        actorSystem.shutdown();
+    }
 }
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedConfigDataStoreProviderModule.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedConfigDataStoreProviderModule.java
new file mode 100644 (file)
index 0000000..039446b
--- /dev/null
@@ -0,0 +1,32 @@
+package org.opendaylight.controller.config.yang.config.distributed_datastore_provider;
+
+import org.opendaylight.controller.cluster.datastore.DistributedDataStoreFactory;
+
+public class DistributedConfigDataStoreProviderModule extends
+    org.opendaylight.controller.config.yang.config.distributed_datastore_provider.AbstractDistributedConfigDataStoreProviderModule {
+    public DistributedConfigDataStoreProviderModule(
+        org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+        org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public DistributedConfigDataStoreProviderModule(
+        org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+        org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+        org.opendaylight.controller.config.yang.config.distributed_datastore_provider.DistributedConfigDataStoreProviderModule 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() {
+        return DistributedDataStoreFactory
+            .createInstance("config", getSchemaServiceDependency());
+    }
+
+}
@@ -1,13 +1,13 @@
 /*
 * Generated file
 *
-* Generated from: yang module name: distributed-datastore-provider yang module local name: distributed-datastore-provider
+* Generated from: yang module name: distributed-datastore-provider yang module local name: distributed-config-datastore-provider
 * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Thu Jun 12 15:23:43 PDT 2014
+* Generated at: Tue Jun 24 17:14:50 PDT 2014
 *
 * Do not modify this file unless it is present under src/main directory
 */
 package org.opendaylight.controller.config.yang.config.distributed_datastore_provider;
-public class DistributedDataStoreProviderModuleFactory extends org.opendaylight.controller.config.yang.config.distributed_datastore_provider.AbstractDistributedDataStoreProviderModuleFactory {
+public class DistributedConfigDataStoreProviderModuleFactory extends org.opendaylight.controller.config.yang.config.distributed_datastore_provider.AbstractDistributedConfigDataStoreProviderModuleFactory {
 
 }
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedDataStoreProviderModule.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedDataStoreProviderModule.java
deleted file mode 100644 (file)
index 3a78f93..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.opendaylight.controller.config.yang.config.distributed_datastore_provider;
-
-import akka.actor.ActorSystem;
-import org.opendaylight.controller.cluster.datastore.DistributedDataStore;
-
-public class DistributedDataStoreProviderModule extends org.opendaylight.controller.config.yang.config.distributed_datastore_provider.AbstractDistributedDataStoreProviderModule {
-  public DistributedDataStoreProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-    super(identifier, dependencyResolver);
-  }
-
-  public DistributedDataStoreProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.distributed_datastore_provider.DistributedDataStoreProviderModule 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() {
-    ActorSystem actorSystem = ActorSystem.create("opendaylight-cluster");
-    final DistributedDataStore configurationStore = new DistributedDataStore(actorSystem, "config");
-    final DistributedDataStore operationalStore = new DistributedDataStore(actorSystem, "operational");
-
-    final class AutoCloseableDistributedDataStore implements AutoCloseable {
-
-      @Override
-      public void close() throws Exception {
-      }
-    }
-
-    return new AutoCloseableDistributedDataStore();
-  }
-
-}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedOperationalDataStoreProviderModule.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedOperationalDataStoreProviderModule.java
new file mode 100644 (file)
index 0000000..1a06629
--- /dev/null
@@ -0,0 +1,32 @@
+package org.opendaylight.controller.config.yang.config.distributed_datastore_provider;
+
+import org.opendaylight.controller.cluster.datastore.DistributedDataStoreFactory;
+
+public class DistributedOperationalDataStoreProviderModule extends
+    org.opendaylight.controller.config.yang.config.distributed_datastore_provider.AbstractDistributedOperationalDataStoreProviderModule {
+    public DistributedOperationalDataStoreProviderModule(
+        org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+        org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public DistributedOperationalDataStoreProviderModule(
+        org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+        org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+        org.opendaylight.controller.config.yang.config.distributed_datastore_provider.DistributedOperationalDataStoreProviderModule 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() {
+        return DistributedDataStoreFactory
+            .createInstance("operational", getSchemaServiceDependency());
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedOperationalDataStoreProviderModuleFactory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedOperationalDataStoreProviderModuleFactory.java
new file mode 100644 (file)
index 0000000..c9965fe
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: distributed-datastore-provider yang module local name: distributed-operational-datastore-provider
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Tue Jun 24 17:14:50 PDT 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.config.distributed_datastore_provider;
+public class DistributedOperationalDataStoreProviderModuleFactory extends org.opendaylight.controller.config.yang.config.distributed_datastore_provider.AbstractDistributedOperationalDataStoreProviderModuleFactory {
+
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/resources/application.conf b/opendaylight/md-sal/sal-distributed-datastore/src/main/resources/application.conf
new file mode 100644 (file)
index 0000000..b56c26b
--- /dev/null
@@ -0,0 +1,3 @@
+ODLCluster{
+
+}
\ No newline at end of file
index 0471bc806e00d65e973432b4faa7dea90e593516..5d3758986c40fc8858005aad29cf74f85c9af857 100644 (file)
@@ -7,6 +7,9 @@ module distributed-datastore-provider {
 
     import config { prefix config; revision-date 2013-04-05; }
     import rpc-context { prefix rpcx; revision-date 2013-06-17; }
+    import opendaylight-config-dom-datastore {prefix config-dom-store-spi;}
+    import opendaylight-operational-dom-datastore {prefix operational-dom-store-spi;}
+    import opendaylight-md-sal-dom {prefix sal;}
 
     description
         "This module contains the base YANG definitions for
@@ -18,17 +21,48 @@ module distributed-datastore-provider {
     }
 
     // This is the definition of the service implementation as a module identity.
-    identity distributed-datastore-provider {
+    identity distributed-config-datastore-provider {
             base config:module-type;
-
+            config:provided-service config-dom-store-spi:config-dom-datastore;
             // Specifies the prefix for generated java classes.
-            config:java-name-prefix DistributedDataStoreProvider;
+            config:java-name-prefix DistributedConfigDataStoreProvider;
     }
 
+     // This is the definition of the service implementation as a module identity.
+     identity distributed-operational-datastore-provider {
+                base config:module-type;
+                config:provided-service operational-dom-store-spi:operational-dom-datastore;
+                // Specifies the prefix for generated java classes.
+                config:java-name-prefix DistributedOperationalDataStoreProvider;
+     }
+
     // Augments the 'configuration' choice node under modules/module.
     augment "/config:modules/config:module/config:configuration" {
-        case distributed-datastore-provider {
-            when "/config:modules/config:module/config:type = 'distributed-datastore-provider'";
+        case distributed-config-datastore-provider {
+            when "/config:modules/config:module/config:type = 'distributed-config-datastore-provider'";
+            container schema-service {
+                          uses config:service-ref {
+                               refine type {
+                                      mandatory false;
+                                      config:required-identity sal:schema-service;
+                                }
+                          }
+                        }
         }
     }
+
+    // Augments the 'configuration' choice node under modules/module.
+        augment "/config:modules/config:module/config:configuration" {
+            case distributed-operational-datastore-provider {
+                when "/config:modules/config:module/config:type = 'distributed-operational-datastore-provider'";
+                container schema-service {
+                              uses config:service-ref {
+                                   refine type {
+                                          mandatory false;
+                                          config:required-identity sal:schema-service;
+                                    }
+                              }
+                            }
+            }
+        }
 }
index 45ef32f7ad798ad15a0840c1c7860bf61f34913d..214b3e9d3d989d73d0cd618db937a0fa6bcfdcb6 100644 (file)
@@ -14,21 +14,22 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 
 public abstract class AbstractActorTest {
-  private static ActorSystem system;
+    private static ActorSystem system;
 
-  @BeforeClass
-  public static void setUpClass(){
-    system = ActorSystem.create("test");
-  }
+    @BeforeClass
+    public static void setUpClass() {
+        System.setProperty("shard.persistent", "false");
+        system = ActorSystem.create("test");
+    }
 
-  @AfterClass
-  public static void tearDownClass(){
-    JavaTestKit.shutdownActorSystem(system);
-    system = null;
-  }
+    @AfterClass
+    public static void tearDownClass() {
+        JavaTestKit.shutdownActorSystem(system);
+        system = null;
+    }
 
-  protected ActorSystem getSystem(){
-    return system;
-  }
+    protected ActorSystem getSystem() {
+        return system;
+    }
 
 }
index 8c3ec82a54eb7c50d195675cffc122b6ed13d546..dfefc5ed579b36163f882485f38f577b53832b8e 100644 (file)
@@ -12,6 +12,7 @@ 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;
@@ -30,11 +31,14 @@ import org.opendaylight.controller.cluster.datastore.messages.WriteData;
 import org.opendaylight.controller.cluster.datastore.messages.WriteDataReply;
 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import scala.concurrent.Await;
+import scala.concurrent.Future;
+import scala.concurrent.duration.FiniteDuration;
 
 public class BasicIntegrationTest extends AbstractActorTest {
 
     @Test
-    public void integrationTest() {
+    public void integrationTest() throws Exception{
         // This test will
         // - create a Shard
         // - initiate a transaction
@@ -57,7 +61,7 @@ public class BasicIntegrationTest extends AbstractActorTest {
                     shard.tell(new CreateTransactionChain(), getRef());
 
                     final ActorSelection transactionChain =
-                        new ExpectMsg<ActorSelection>("match hint") {
+                        new ExpectMsg<ActorSelection>("CreateTransactionChainReply") {
                             protected ActorSelection match(Object in) {
                                 if (in instanceof CreateTransactionChainReply) {
                                     ActorPath transactionChainPath =
@@ -73,10 +77,10 @@ public class BasicIntegrationTest extends AbstractActorTest {
 
                     Assert.assertNotNull(transactionChain);
 
-                    transactionChain.tell(new CreateTransaction(), getRef());
+                    transactionChain.tell(new CreateTransaction("txn-1"), getRef());
 
                     final ActorSelection transaction =
-                        new ExpectMsg<ActorSelection>("match hint") {
+                        new ExpectMsg<ActorSelection>("CreateTransactionReply") {
                             protected ActorSelection match(Object in) {
                                 if (in instanceof CreateTransactionReply) {
                                     ActorPath transactionPath =
@@ -92,11 +96,14 @@ 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);
+
                     transaction.tell(new WriteData(TestModel.TEST_PATH,
                         ImmutableNodes.containerNode(TestModel.TEST_QNAME)),
                         getRef());
 
-                    Boolean writeDone = new ExpectMsg<Boolean>("match hint") {
+                    Boolean writeDone = new ExpectMsg<Boolean>("WriteDataReply") {
                         protected Boolean match(Object in) {
                             if (in instanceof WriteDataReply) {
                                 return true;
@@ -111,7 +118,7 @@ public class BasicIntegrationTest extends AbstractActorTest {
                     transaction.tell(new ReadyTransaction(), getRef());
 
                     final ActorSelection cohort =
-                        new ExpectMsg<ActorSelection>("match hint") {
+                        new ExpectMsg<ActorSelection>("ReadyTransactionReply") {
                             protected ActorSelection match(Object in) {
                                 if (in instanceof ReadyTransactionReply) {
                                     ActorPath cohortPath =
@@ -127,10 +134,13 @@ 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);
+
                     cohort.tell(new PreCommitTransaction(), getRef());
 
                     Boolean preCommitDone =
-                        new ExpectMsg<Boolean>("match hint") {
+                        new ExpectMsg<Boolean>("PreCommitTransactionReply") {
                             protected Boolean match(Object in) {
                                 if (in instanceof PreCommitTransactionReply) {
                                     return true;
@@ -142,10 +152,41 @@ 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);
+
+
+                    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>("match hint") {
+                        new ExpectMsg<Boolean>("CommitTransactionReply") {
                             protected Boolean match(Object in) {
                                 if (in instanceof CommitTransactionReply) {
                                     return true;
@@ -161,7 +202,25 @@ public class BasicIntegrationTest extends AbstractActorTest {
 
 
             };
-        }};
+        }
+
+            private ActorRef watchActor(ActorSelection actor) {
+                Future<ActorRef> future = actor
+                    .resolveOne(FiniteDuration.apply(100, "milliseconds"));
+
+                try {
+                    ActorRef actorRef = Await.result(future,
+                        FiniteDuration.apply(100, "milliseconds"));
+
+                    watch(actorRef);
+
+                    return actorRef;
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+
+            }
+        };
 
 
     }
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxyTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxyTest.java
new file mode 100644 (file)
index 0000000..a8409a6
--- /dev/null
@@ -0,0 +1,81 @@
+package org.opendaylight.controller.cluster.datastore;
+
+import akka.actor.ActorRef;
+import akka.actor.Props;
+import junit.framework.Assert;
+import org.junit.Test;
+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.md.sal.common.api.data.AsyncDataChangeEvent;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+
+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<?,?>> {
+
+        @Override
+        public Map<InstanceIdentifier, NormalizedNode<?, ?>> getCreatedData() {
+            throw new UnsupportedOperationException("getCreatedData");
+        }
+
+        @Override
+        public Map<InstanceIdentifier, NormalizedNode<?, ?>> getUpdatedData() {
+            throw new UnsupportedOperationException("getUpdatedData");
+        }
+
+        @Override public Set<InstanceIdentifier> getRemovedPaths() {
+            throw new UnsupportedOperationException("getRemovedPaths");
+        }
+
+        @Override
+        public Map<InstanceIdentifier, ? extends NormalizedNode<?, ?>> getOriginalData() {
+            throw new UnsupportedOperationException("getOriginalData");
+        }
+
+        @Override public NormalizedNode<?, ?> getOriginalSubtree() {
+            throw new UnsupportedOperationException("getOriginalSubtree");
+        }
+
+        @Override public NormalizedNode<?, ?> getUpdatedSubtree() {
+            throw new UnsupportedOperationException("getUpdatedSubtree");
+        }
+    }
+
+    @Test
+    public void testOnDataChanged() throws Exception {
+        final Props props = Props.create(MessageCollectorActor.class);
+        final ActorRef actorRef = getSystem().actorOf(props);
+
+        DataChangeListenerProxy dataChangeListenerProxy =
+            new DataChangeListenerProxy(
+                getSystem().actorSelection(actorRef.path()));
+
+        dataChangeListenerProxy.onDataChanged(new MockDataChangeEvent());
+
+        //Check if it was received by the remote actor
+        ActorContext
+            testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)));
+        Object messages = testContext
+            .executeLocalOperation(actorRef, "messages",
+                ActorContext.ASK_DURATION);
+
+        Assert.assertNotNull(messages);
+
+        Assert.assertTrue(messages instanceof List);
+
+        List<Object> listMessages = (List<Object>) messages;
+
+        Assert.assertEquals(1, listMessages.size());
+
+        Assert.assertTrue(listMessages.get(0) instanceof DataChanged);
+
+    }
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxyTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxyTest.java
new file mode 100644 (file)
index 0000000..33b5d95
--- /dev/null
@@ -0,0 +1,76 @@
+package org.opendaylight.controller.cluster.datastore;
+
+import akka.actor.ActorRef;
+import akka.actor.Props;
+import junit.framework.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.messages.CloseDataChangeListenerRegistration;
+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.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.schema.NormalizedNode;
+
+import java.util.List;
+
+public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest{
+
+    private ActorRef dataChangeListenerActor = getSystem().actorOf(Props.create(DoNothingActor.class));
+
+    private static class MockDataChangeListener implements
+        AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> {
+
+        @Override public void onDataChanged(
+            AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
+            throw new UnsupportedOperationException("onDataChanged");
+        }
+    }
+
+    @Test
+    public void testGetInstance() throws Exception {
+        final Props props = Props.create(MessageCollectorActor.class);
+        final ActorRef actorRef = getSystem().actorOf(props);
+
+        MockDataChangeListener listener =
+            new MockDataChangeListener();
+        DataChangeListenerRegistrationProxy proxy =
+            new DataChangeListenerRegistrationProxy(
+                getSystem().actorSelection(actorRef.path()),
+                listener, dataChangeListenerActor);
+
+        Assert.assertEquals(listener, proxy.getInstance());
+
+    }
+
+    @Test
+    public void testClose() throws Exception {
+        final Props props = Props.create(MessageCollectorActor.class);
+        final ActorRef actorRef = getSystem().actorOf(props);
+
+        DataChangeListenerRegistrationProxy proxy =
+            new DataChangeListenerRegistrationProxy(
+                getSystem().actorSelection(actorRef.path()),
+                new MockDataChangeListener(), dataChangeListenerActor);
+
+        proxy.close();
+
+        //Check if it was received by the remote actor
+        ActorContext
+            testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)));
+        Object messages = testContext
+            .executeLocalOperation(actorRef, "messages",
+                ActorContext.ASK_DURATION);
+
+        Assert.assertNotNull(messages);
+
+        Assert.assertTrue(messages instanceof List);
+
+        List<Object> listMessages = (List<Object>) messages;
+
+        Assert.assertEquals(1, listMessages.size());
+
+        Assert.assertTrue(listMessages.get(0) instanceof CloseDataChangeListenerRegistration);
+    }
+}
@@ -6,8 +6,8 @@ import akka.testkit.JavaTestKit;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
 import org.junit.Test;
-import org.opendaylight.controller.cluster.datastore.messages.CloseListenerRegistration;
-import org.opendaylight.controller.cluster.datastore.messages.CloseListenerRegistrationReply;
+import org.opendaylight.controller.cluster.datastore.messages.CloseDataChangeListenerRegistration;
+import org.opendaylight.controller.cluster.datastore.messages.CloseDataChangeListenerRegistrationReply;
 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;
@@ -18,7 +18,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 import static org.junit.Assert.assertEquals;
 
-public class ListenerRegistrationTest extends AbstractActorTest {
+public class DataChangeListenerRegistrationTest extends AbstractActorTest {
   private static ListeningExecutorService storeExecutor = MoreExecutors.listeningDecorator(MoreExecutors.sameThreadExecutor());
 
   private static final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", storeExecutor);
@@ -31,18 +31,20 @@ public class ListenerRegistrationTest extends AbstractActorTest {
   @Test
   public void testOnReceiveCloseListenerRegistration() throws Exception {
     new JavaTestKit(getSystem()) {{
-      final Props props = ListenerRegistration.props(store.registerChangeListener(TestModel.TEST_PATH, noOpDataChangeListener(), AsyncDataBroker.DataChangeScope.BASE));
+      final Props props = DataChangeListenerRegistration.props(store
+          .registerChangeListener(TestModel.TEST_PATH, noOpDataChangeListener(),
+              AsyncDataBroker.DataChangeScope.BASE));
       final ActorRef subject = getSystem().actorOf(props, "testCloseListenerRegistration");
 
       new Within(duration("1 seconds")) {
         protected void run() {
 
-          subject.tell(new CloseListenerRegistration(), getRef());
+          subject.tell(new CloseDataChangeListenerRegistration(), 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 CloseListenerRegistrationReply) {
+              if (in instanceof CloseDataChangeListenerRegistrationReply) {
                 return "match";
               } else {
                 throw noMatch();
@@ -69,4 +71,4 @@ public class ListenerRegistrationTest extends AbstractActorTest {
     };
   }
 
-}
\ No newline at end of file
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerTest.java
new file mode 100644 (file)
index 0000000..6f0816b
--- /dev/null
@@ -0,0 +1,102 @@
+package org.opendaylight.controller.cluster.datastore;
+
+import akka.actor.ActorRef;
+import akka.actor.Props;
+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.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.schema.NormalizedNode;
+
+import java.util.Map;
+import java.util.Set;
+
+import static org.junit.Assert.assertTrue;
+
+public class DataChangeListenerTest extends AbstractActorTest {
+
+    private static class MockDataChangedEvent implements AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> {
+
+        @Override
+        public Map<InstanceIdentifier, NormalizedNode<?, ?>> getCreatedData() {
+            throw new UnsupportedOperationException("getCreatedData");
+        }
+
+        @Override
+        public Map<InstanceIdentifier, NormalizedNode<?, ?>> getUpdatedData() {
+            throw new UnsupportedOperationException("getUpdatedData");
+        }
+
+        @Override public Set<InstanceIdentifier> getRemovedPaths() {
+            throw new UnsupportedOperationException("getRemovedPaths");
+        }
+
+        @Override
+        public Map<InstanceIdentifier, ? extends NormalizedNode<?, ?>> getOriginalData() {
+            throw new UnsupportedOperationException("getOriginalData");
+        }
+
+        @Override public NormalizedNode<?, ?> getOriginalSubtree() {
+            throw new UnsupportedOperationException("getOriginalSubtree");
+        }
+
+        @Override public NormalizedNode<?, ?> getUpdatedSubtree() {
+            throw new UnsupportedOperationException("getUpdatedSubtree");
+        }
+    }
+
+    private class MockDataChangeListener implements AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> {
+        private boolean gotIt = false;
+
+        @Override public void onDataChanged(
+            AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
+            gotIt = true;
+        }
+
+        public boolean gotIt() {
+            return gotIt;
+        }
+    }
+
+    @Test
+    public void testDataChanged(){
+        new JavaTestKit(getSystem()) {{
+            final MockDataChangeListener listener = new MockDataChangeListener();
+            final Props props = DataChangeListener.props(listener);
+            final ActorRef subject =
+                getSystem().actorOf(props, "testDataChanged");
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    subject.tell(
+                        new DataChanged(new MockDataChangedEvent()),
+                        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;
+                                return true;
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get(); // this extracts the received message
+
+                    assertTrue(out);
+                    assertTrue(listener.gotIt());
+                    // Will wait for the rest of the 3 seconds
+                    expectNoMsg();
+                }
+
+
+            };
+        }};
+    }
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java
new file mode 100644 (file)
index 0000000..f400e74
--- /dev/null
@@ -0,0 +1,54 @@
+package org.opendaylight.controller.cluster.datastore;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.ListenableFuture;
+import org.junit.Test;
+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 static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+
+public class DistributedDataStoreIntegrationTest extends AbstractActorTest {
+
+    @Test
+    public void integrationTest() throws Exception {
+        DistributedDataStore distributedDataStore =
+            new DistributedDataStore(getSystem(), "config");
+
+        distributedDataStore.onGlobalContextUpdated(TestModel.createTestContext());
+
+        DOMStoreReadWriteTransaction transaction =
+            distributedDataStore.newReadWriteTransaction();
+
+        transaction.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
+
+        ListenableFuture<Optional<NormalizedNode<?, ?>>> future =
+            transaction.read(TestModel.TEST_PATH);
+
+        Optional<NormalizedNode<?, ?>> optional = future.get();
+
+        NormalizedNode<?, ?> normalizedNode = optional.get();
+
+        assertEquals(TestModel.TEST_QNAME, normalizedNode.getNodeType());
+
+        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 3a74a4ca7656dc01ae650d011595335474297de1..5f82b40140eb11074c03419121ebd511c08d59e4 100644 (file)
@@ -39,7 +39,7 @@ 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()));
+            new CreateTransactionReply(doNothingActorRef.path(), "txn-1 "));
     }
 
     @org.junit.After
index 48365fa1a06a90c87131ab6bda0e71db78595ee6..ed447e004fd9b91a7ad7da1561fdb83bf3cbb2d7 100644 (file)
@@ -4,8 +4,10 @@ import akka.actor.ActorRef;
 import akka.actor.Props;
 import akka.testkit.JavaTestKit;
 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.RegisterChangeListener;
 import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListenerReply;
 import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext;
@@ -16,85 +18,142 @@ import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListene
 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-public class ShardTest extends AbstractActorTest{
-  @Test
-  public void testOnReceiveCreateTransactionChain() throws Exception {
-    new JavaTestKit(getSystem()) {{
-      final Props props = Shard.props("config");
-      final ActorRef subject = getSystem().actorOf(props, "testCreateTransactionChain");
-
-      new Within(duration("1 seconds")) {
-        protected void run() {
-
-          subject.tell(new CreateTransactionChain(), 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) {
-                CreateTransactionChainReply reply = (CreateTransactionChainReply) in;
-                return reply.getTransactionChainPath().toString();
-              } else {
-                throw noMatch();
-              }
-            }
-          }.get(); // this extracts the received message
-
-          assertTrue(out.matches("akka:\\/\\/test\\/user\\/testCreateTransactionChain\\/\\$.*"));
-          // Will wait for the rest of the 3 seconds
-          expectNoMsg();
-        }
-
-
-      };
-    }};
-  }
-
-  @Test
-  public void testOnReceiveRegisterListener() throws Exception {
-    new JavaTestKit(getSystem()) {{
-      final Props props = Shard.props("config");
-      final ActorRef subject = getSystem().actorOf(props, "testRegisterChangeListener");
-
-      new Within(duration("1 seconds")) {
-        protected void run() {
-
-          subject.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
-
-          subject.tell(new RegisterChangeListener(TestModel.TEST_PATH, getRef().path() , AsyncDataBroker.DataChangeScope.BASE), getRef());
+public class ShardTest extends AbstractActorTest {
+    @Test
+    public void testOnReceiveCreateTransactionChain() throws Exception {
+        new JavaTestKit(getSystem()) {{
+            final Props props = Shard.props("config");
+            final ActorRef subject =
+                getSystem().actorOf(props, "testCreateTransactionChain");
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    subject.tell(new CreateTransactionChain(), 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) {
+                                CreateTransactionChainReply reply =
+                                    (CreateTransactionChainReply) in;
+                                return reply.getTransactionChainPath()
+                                    .toString();
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get(); // this extracts the received message
+
+                    assertEquals("Unexpected transaction path " + out,
+                        "akka://test/user/testCreateTransactionChain/$a",
+                        out);
+
+                    expectNoMsg();
+                }
+
+
+            };
+        }};
+    }
+
+    @Test
+    public void testOnReceiveRegisterListener() throws Exception {
+        new JavaTestKit(getSystem()) {{
+            final Props props = Shard.props("config");
+            final ActorRef subject =
+                getSystem().actorOf(props, "testRegisterChangeListener");
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    subject.tell(
+                        new UpdateSchemaContext(TestModel.createTestContext()),
+                        getRef());
+
+                    subject.tell(new RegisterChangeListener(TestModel.TEST_PATH,
+                        getRef().path(), AsyncDataBroker.DataChangeScope.BASE),
+                        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) {
+                                RegisterChangeListenerReply reply =
+                                    (RegisterChangeListenerReply) in;
+                                return reply.getListenerRegistrationPath()
+                                    .toString();
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get(); // this extracts the received message
+
+                    assertTrue(out.matches(
+                        "akka:\\/\\/test\\/user\\/testRegisterChangeListener\\/\\$.*"));
+                    // Will wait for the rest of the 3 seconds
+                    expectNoMsg();
+                }
+
+
+            };
+        }};
+    }
+
+    @Test
+    public void testCreateTransaction(){
+        new JavaTestKit(getSystem()) {{
+            final Props props = Shard.props("config");
+            final ActorRef subject =
+                getSystem().actorOf(props, "testCreateTransaction");
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    subject.tell(
+                        new UpdateSchemaContext(TestModel.createTestContext()),
+                        getRef());
+
+                    subject.tell(new CreateTransaction("txn-1"),
+                        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) {
+                                CreateTransactionReply reply =
+                                    (CreateTransactionReply) in;
+                                return reply.getTransactionPath()
+                                    .toString();
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get(); // this extracts the received message
+
+                    assertEquals("Unexpected transaction path " + out,
+                        "akka://test/user/testCreateTransaction/shard-txn-1",
+                        out);
+                    expectNoMsg();
+                }
+
+
+            };
+        }};
+    }
+
+
+
+    private AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> noOpDataChangeListener() {
+        return new AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>() {
+            @Override
+            public void onDataChanged(
+                AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
 
-          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) {
-                RegisterChangeListenerReply reply = (RegisterChangeListenerReply) in;
-                return reply.getListenerRegistrationPath().toString();
-              } else {
-                throw noMatch();
-              }
             }
-          }.get(); // this extracts the received message
-
-          assertTrue(out.matches("akka:\\/\\/test\\/user\\/testRegisterChangeListener\\/\\$.*"));
-          // Will wait for the rest of the 3 seconds
-          expectNoMsg();
-        }
-
-
-      };
-    }};
-  }
-
-
-
-  private  AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> noOpDataChangeListener(){
-    return new AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>() {
-      @Override
-      public void onDataChanged(AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
-
-      }
-    };
-  }
+        };
+    }
 }
index bc3a1046566b2259012916c85e70ae933d921b3d..b07cbfd87ce268e3707064d81c2c5596af683af5 100644 (file)
@@ -14,7 +14,6 @@ import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 
 public class ShardTransactionChainTest extends AbstractActorTest {
 
@@ -34,7 +33,7 @@ public class ShardTransactionChainTest extends AbstractActorTest {
       new Within(duration("1 seconds")) {
         protected void run() {
 
-          subject.tell(new CreateTransaction(), getRef());
+          subject.tell(new CreateTransaction("txn-1"), getRef());
 
           final String out = new ExpectMsg<String>("match hint") {
             // do not put code outside this method, will run afterwards
@@ -47,8 +46,11 @@ public class ShardTransactionChainTest extends AbstractActorTest {
             }
           }.get(); // this extracts the received message
 
-          assertTrue(out.matches("akka:\\/\\/test\\/user\\/testCreateTransaction\\/\\$.*"));
-          // Will wait for the rest of the 3 seconds
+            assertEquals("Unexpected transaction path " + out,
+                "akka://test/user/testCreateTransaction/shard-txn-1",
+                out);
+
+            // Will wait for the rest of the 3 seconds
           expectNoMsg();
         }
 
@@ -88,4 +90,4 @@ public class ShardTransactionChainTest extends AbstractActorTest {
       };
     }};
   }
-}
\ No newline at end of file
+}
index 9116f24c92971b3f0491b6de52d07eff01d84645..2d9ae93d9ee1d044b2809996b88d1183c16672f8 100644 (file)
@@ -2,6 +2,7 @@ package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorRef;
 import akka.actor.Props;
+import akka.actor.Terminated;
 import akka.testkit.JavaTestKit;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
@@ -32,246 +33,326 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 public class ShardTransactionTest extends AbstractActorTest {
-  private static ListeningExecutorService storeExecutor = MoreExecutors.listeningDecorator(MoreExecutors.sameThreadExecutor());
+    private static ListeningExecutorService storeExecutor =
+        MoreExecutors.listeningDecorator(MoreExecutors.sameThreadExecutor());
+
+    private static final InMemoryDOMDataStore store =
+        new InMemoryDOMDataStore("OPER", storeExecutor);
+
+    static {
+        store.onGlobalContextUpdated(TestModel.createTestContext());
+    }
+
+    @Test
+    public void testOnReceiveReadData() throws Exception {
+        new JavaTestKit(getSystem()) {{
+            final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+            final Props props =
+                ShardTransaction.props(store.newReadWriteTransaction(), shard);
+            final ActorRef subject = getSystem().actorOf(props, "testReadData");
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    subject.tell(
+                        new ReadData(InstanceIdentifier.builder().build()),
+                        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) {
+                                    return "match";
+                                }
+                                return null;
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get(); // this extracts the received message
+
+                    assertEquals("match", out);
+
+                    expectNoMsg();
+                }
+
+
+            };
+        }};
+    }
+
+    @Test
+    public void testOnReceiveReadDataWhenDataNotFound() throws Exception {
+        new JavaTestKit(getSystem()) {{
+            final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+            final Props props =
+                ShardTransaction.props(store.newReadWriteTransaction(), shard);
+            final ActorRef subject = getSystem().actorOf(props, "testReadDataWhenDataNotFound");
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    subject.tell(
+                        new ReadData(TestModel.TEST_PATH),
+                        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) {
+                                    return "match";
+                                }
+                                return null;
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get(); // this extracts the received message
+
+                    assertEquals("match", out);
+
+                    expectNoMsg();
+                }
+
+
+            };
+        }};
+    }
+
+    private void assertModification(final ActorRef subject,
+        final Class<? extends Modification> modificationType) {
+        new JavaTestKit(getSystem()) {{
+            new Within(duration("1 seconds")) {
+                protected void run() {
+                    subject
+                        .tell(new ShardTransaction.GetCompositedModification(),
+                            getRef());
+
+                    final CompositeModification compositeModification =
+                        new ExpectMsg<CompositeModification>("match hint") {
+                            // do not put code outside this method, will run afterwards
+                            protected CompositeModification match(Object in) {
+                                if (in instanceof ShardTransaction.GetCompositeModificationReply) {
+                                    return ((ShardTransaction.GetCompositeModificationReply) in)
+                                        .getModification();
+                                } else {
+                                    throw noMatch();
+                                }
+                            }
+                        }.get(); // this extracts the received message
+
+                    assertTrue(
+                        compositeModification.getModifications().size() == 1);
+                    assertEquals(modificationType,
+                        compositeModification.getModifications().get(0)
+                            .getClass());
+
+                }
+            };
+        }};
+    }
+
+    @Test
+    public void testOnReceiveWriteData() throws Exception {
+        new JavaTestKit(getSystem()) {{
+            final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+            final Props props =
+                ShardTransaction.props(store.newReadWriteTransaction(), shard);
+            final ActorRef subject =
+                getSystem().actorOf(props, "testWriteData");
+
+            new Within(duration("1 seconds")) {
+                protected void run() {
+
+                    subject.tell(new WriteData(TestModel.TEST_PATH,
+                        ImmutableNodes.containerNode(TestModel.TEST_QNAME)),
+                        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) {
+                                return "match";
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get(); // this extracts the received message
+
+                    assertEquals("match", out);
+
+                    assertModification(subject, WriteModification.class);
+                    expectNoMsg();
+                }
+
 
-  private static final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", storeExecutor);
+            };
+        }};
+    }
 
-  static {
-    store.onGlobalContextUpdated(TestModel.createTestContext());
-  }
+    @Test
+    public void testOnReceiveMergeData() throws Exception {
+        new JavaTestKit(getSystem()) {{
+            final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+            final Props props =
+                ShardTransaction.props(store.newReadWriteTransaction(), shard);
+            final ActorRef subject =
+                getSystem().actorOf(props, "testMergeData");
 
-  @Test
-  public void testOnReceiveReadData() throws Exception {
-    new JavaTestKit(getSystem()) {{
-      final ActorRef shard = getSystem().actorOf(Shard.props("config"));
-      final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard);
-      final ActorRef subject = getSystem().actorOf(props, "testReadData");
+            new Within(duration("1 seconds")) {
+                protected void run() {
 
-      new Within(duration("1 seconds")) {
-        protected void run() {
+                    subject.tell(new MergeData(TestModel.TEST_PATH,
+                        ImmutableNodes.containerNode(TestModel.TEST_QNAME)),
+                        getRef());
 
-          subject.tell(new ReadData(InstanceIdentifier.builder().build()), 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 MergeDataReply) {
+                                return "match";
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get(); // this extracts the received message
 
-          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) {
-                  return "match";
+                    assertEquals("match", out);
+
+                    assertModification(subject, MergeModification.class);
+
+                    expectNoMsg();
                 }
-                return null;
-              } else {
-                throw noMatch();
-              }
-            }
-          }.get(); // this extracts the received message
-
-          assertEquals("match", out);
-
-          expectNoMsg();
-        }
-
-
-      };
-    }};
-  }
-
-  private void assertModification(final ActorRef subject, final Class<? extends Modification> modificationType){
-    new JavaTestKit(getSystem()) {{
-      new Within(duration("1 seconds")) {
-        protected void run() {
-          subject.tell(new ShardTransaction.GetCompositedModification(), getRef());
-
-          final CompositeModification compositeModification = new ExpectMsg<CompositeModification>("match hint") {
-            // do not put code outside this method, will run afterwards
-            protected CompositeModification match(Object in) {
-              if (in instanceof ShardTransaction.GetCompositeModificationReply) {
-                return ((ShardTransaction.GetCompositeModificationReply) in).getModification();
-              } else {
-                throw noMatch();
-              }
-            }
-          }.get(); // this extracts the received message
-
-          assertTrue(compositeModification.getModifications().size() == 1);
-          assertEquals(modificationType, compositeModification.getModifications().get(0).getClass());
-
-        }
-      };
-    }};
-  }
-
-  @Test
-  public void testOnReceiveWriteData() throws Exception {
-    new JavaTestKit(getSystem()) {{
-      final ActorRef shard = getSystem().actorOf(Shard.props("config"));
-      final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard);
-      final ActorRef subject = getSystem().actorOf(props, "testWriteData");
-
-      new Within(duration("1 seconds")) {
-        protected void run() {
-
-          subject.tell(new WriteData(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME)), 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) {
-                return "match";
-              } else {
-                throw noMatch();
-              }
-            }
-          }.get(); // this extracts the received message
-
-          assertEquals("match", out);
-
-          assertModification(subject, WriteModification.class);
-          expectNoMsg();
-        }
-
-
-      };
-    }};
-  }
-
-  @Test
-  public void testOnReceiveMergeData() throws Exception {
-    new JavaTestKit(getSystem()) {{
-      final ActorRef shard = getSystem().actorOf(Shard.props("config"));
-      final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard);
-      final ActorRef subject = getSystem().actorOf(props, "testMergeData");
-
-      new Within(duration("1 seconds")) {
-        protected void run() {
-
-          subject.tell(new MergeData(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME)), 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 MergeDataReply) {
-                return "match";
-              } else {
-                throw noMatch();
-              }
-            }
-          }.get(); // this extracts the received message
-
-          assertEquals("match", out);
-
-          assertModification(subject, MergeModification.class);
-
-          expectNoMsg();
-        }
-
-
-      };
-    }};
-  }
-
-  @Test
-  public void testOnReceiveDeleteData() throws Exception {
-    new JavaTestKit(getSystem()) {{
-      final ActorRef shard = getSystem().actorOf(Shard.props("config"));
-      final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard);
-      final ActorRef subject = getSystem().actorOf(props, "testDeleteData");
 
-      new Within(duration("1 seconds")) {
-        protected void run() {
 
-          subject.tell(new DeleteData(TestModel.TEST_PATH), 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) {
-                return "match";
-              } else {
-                throw noMatch();
-              }
-            }
-          }.get(); // this extracts the received message
+    @Test
+    public void testOnReceiveDeleteData() throws Exception {
+        new JavaTestKit(getSystem()) {{
+            final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+            final Props props =
+                ShardTransaction.props(store.newReadWriteTransaction(), shard);
+            final ActorRef subject =
+                getSystem().actorOf(props, "testDeleteData");
 
-          assertEquals("match", out);
+            new Within(duration("1 seconds")) {
+                protected void run() {
 
-          assertModification(subject, DeleteModification.class);
-          expectNoMsg();
-        }
+                    subject.tell(new DeleteData(TestModel.TEST_PATH), 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) {
+                                return "match";
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get(); // this extracts the received message
 
-      };
-    }};
-  }
+                    assertEquals("match", out);
 
+                    assertModification(subject, DeleteModification.class);
+                    expectNoMsg();
+                }
 
-  @Test
-  public void testOnReceiveReadyTransaction() throws Exception {
-    new JavaTestKit(getSystem()) {{
-      final ActorRef shard = getSystem().actorOf(Shard.props("config"));
-      final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard);
-      final ActorRef subject = getSystem().actorOf(props, "testReadyTransaction");
 
-      new Within(duration("1 seconds")) {
-        protected void run() {
+            };
+        }};
+    }
 
-          subject.tell(new ReadyTransaction(), 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) {
-                return "match";
-              } else {
-                throw noMatch();
-              }
-            }
-          }.get(); // this extracts the received message
+    @Test
+    public void testOnReceiveReadyTransaction() throws Exception {
+        new JavaTestKit(getSystem()) {{
+            final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+            final Props props =
+                ShardTransaction.props(store.newReadWriteTransaction(), shard);
+            final ActorRef subject =
+                getSystem().actorOf(props, "testReadyTransaction");
 
-          assertEquals("match", out);
+            new Within(duration("1 seconds")) {
+                protected void run() {
 
-          expectNoMsg();
-        }
+                    subject.tell(new ReadyTransaction(), 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) {
+                                return "match";
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get(); // this extracts the received message
 
-      };
-    }};
+                    assertEquals("match", out);
+
+                    expectNoMsg();
+                }
 
-  }
 
-  @Test
-  public void testOnReceiveCloseTransaction() throws Exception {
-    new JavaTestKit(getSystem()) {{
-      final ActorRef shard = getSystem().actorOf(Shard.props("config"));
-      final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard);
-      final ActorRef subject = getSystem().actorOf(props, "testCloseTransaction");
+            };
+        }};
 
-      new Within(duration("1 seconds")) {
-        protected void run() {
+    }
 
-          subject.tell(new CloseTransaction(), getRef());
+    @Test
+    public void testOnReceiveCloseTransaction() throws Exception {
+        new JavaTestKit(getSystem()) {{
+            final ActorRef shard = getSystem().actorOf(Shard.props("config"));
+            final Props props =
+                ShardTransaction.props(store.newReadWriteTransaction(), shard);
+            final ActorRef subject =
+                getSystem().actorOf(props, "testCloseTransaction");
 
-          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) {
-                return "match";
-              } else {
-                throw noMatch();
-              }
-            }
-          }.get(); // this extracts the received message
+            watch(subject);
 
-          assertEquals("match", out);
+            new Within(duration("2 seconds")) {
+                protected void run() {
 
-          expectNoMsg();
-        }
+                    subject.tell(new CloseTransaction(), 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) {
+                                return "match";
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get(); // this extracts the received message
 
-      };
-    }};
+                    assertEquals("match", out);
+
+                    final String termination = new ExpectMsg<String>("match hint") {
+                        // do not put code outside this method, will run afterwards
+                        protected String match(Object in) {
+                            if (in instanceof Terminated) {
+                                return "match";
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get(); // this extracts the received message
+
+
+                    expectNoMsg();
+                }
 
-  }
 
+            };
+        }};
 
-}
\ No newline at end of file
+    }
+}
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java
new file mode 100644 (file)
index 0000000..8ff785c
--- /dev/null
@@ -0,0 +1,85 @@
+package org.opendaylight.controller.cluster.datastore;
+
+import akka.actor.ActorRef;
+import akka.actor.Props;
+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.AbortTransactionReply;
+import org.opendaylight.controller.cluster.datastore.messages.CanCommitTransactionReply;
+import org.opendaylight.controller.cluster.datastore.messages.CommitTransactionReply;
+import org.opendaylight.controller.cluster.datastore.messages.PreCommitTransactionReply;
+import org.opendaylight.controller.cluster.datastore.utils.MessageCollectorActor;
+import org.opendaylight.controller.cluster.datastore.utils.MockActorContext;
+
+import java.util.Arrays;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import static org.junit.Assert.assertNotNull;
+
+public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest {
+
+    private ThreePhaseCommitCohortProxy proxy;
+    private Props props;
+    private ActorRef actorRef;
+    private MockActorContext actorContext;
+    private ExecutorService executor = Executors.newSingleThreadExecutor();
+
+    @Before
+    public void setUp(){
+        props = Props.create(MessageCollectorActor.class);
+        actorRef = getSystem().actorOf(props);
+        actorContext = new MockActorContext(this.getSystem());
+
+        proxy =
+            new ThreePhaseCommitCohortProxy(actorContext,
+                Arrays.asList(actorRef.path()), "txn-1", executor);
+
+    }
+
+    @Test
+    public void testCanCommit() throws Exception {
+        actorContext.setExecuteRemoteOperationResponse(new CanCommitTransactionReply(true));
+
+        ListenableFuture<Boolean> future = proxy.canCommit();
+
+        Assert.assertTrue(future.get().booleanValue());
+
+    }
+
+    @Test
+    public void testPreCommit() throws Exception {
+        actorContext.setExecuteRemoteOperationResponse(new PreCommitTransactionReply());
+
+        ListenableFuture<Void> future = proxy.preCommit();
+
+        future.get();
+
+    }
+
+    @Test
+    public void testAbort() throws Exception {
+        actorContext.setExecuteRemoteOperationResponse(new AbortTransactionReply());
+
+        ListenableFuture<Void> future = proxy.abort();
+
+        future.get();
+
+    }
+
+    @Test
+    public void testCommit() throws Exception {
+        actorContext.setExecuteRemoteOperationResponse(new CommitTransactionReply());
+
+        ListenableFuture<Void> future = proxy.commit();
+
+        future.get();
+    }
+
+    @Test
+    public void testGetCohortPaths() throws Exception {
+        assertNotNull(proxy.getCohortPaths());
+    }
+}
index 6d057a4dbeeffdfc7892a798f62fb539b7ffc4fc..a8df49f5ca4514ceb9ea1dfc25809cf789647150 100644 (file)
@@ -23,21 +23,26 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 
 import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 public class TransactionProxyTest extends AbstractActorTest {
 
+    private ExecutorService transactionExecutor =
+        Executors.newSingleThreadExecutor();
+
     @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.setExecuteShardOperationResponse(new CreateTransactionReply(actorRef.path()));
+        actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef));
         actorContext.setExecuteRemoteOperationResponse("message");
 
         TransactionProxy transactionProxy =
             new TransactionProxy(actorContext,
-                TransactionProxy.TransactionType.READ_ONLY);
+                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
 
 
         ListenableFuture<Optional<NormalizedNode<?, ?>>> read =
@@ -57,18 +62,49 @@ public class TransactionProxyTest extends AbstractActorTest {
         Assert.assertTrue(normalizedNodeOptional.isPresent());
     }
 
+    @Test
+    public void testReadWhenANullIsReturned() throws Exception {
+        final Props props = Props.create(DoNothingActor.class);
+        final ActorRef actorRef = getSystem().actorOf(props);
+
+        final MockActorContext actorContext = new MockActorContext(this.getSystem());
+        actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef));
+        actorContext.setExecuteRemoteOperationResponse("message");
+
+        TransactionProxy transactionProxy =
+            new TransactionProxy(actorContext,
+                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
+
+
+        ListenableFuture<Optional<NormalizedNode<?, ?>>> read =
+            transactionProxy.read(TestModel.TEST_PATH);
+
+        Optional<NormalizedNode<?, ?>> normalizedNodeOptional = read.get();
+
+        Assert.assertFalse(normalizedNodeOptional.isPresent());
+
+        actorContext.setExecuteRemoteOperationResponse(new ReadDataReply(
+            null));
+
+        read = transactionProxy.read(TestModel.TEST_PATH);
+
+        normalizedNodeOptional = read.get();
+
+        Assert.assertFalse(normalizedNodeOptional.isPresent());
+    }
+
     @Test
     public void testWrite() throws Exception {
         final Props props = Props.create(MessageCollectorActor.class);
         final ActorRef actorRef = getSystem().actorOf(props);
 
         final MockActorContext actorContext = new MockActorContext(this.getSystem());
-        actorContext.setExecuteShardOperationResponse(new CreateTransactionReply(actorRef.path()));
+        actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef));
         actorContext.setExecuteRemoteOperationResponse("message");
 
         TransactionProxy transactionProxy =
             new TransactionProxy(actorContext,
-                TransactionProxy.TransactionType.READ_ONLY);
+                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
 
         transactionProxy.write(TestModel.TEST_PATH,
             ImmutableNodes.containerNode(TestModel.NAME_QNAME));
@@ -95,12 +131,12 @@ public class TransactionProxyTest extends AbstractActorTest {
         final ActorRef actorRef = getSystem().actorOf(props);
 
         final MockActorContext actorContext = new MockActorContext(this.getSystem());
-        actorContext.setExecuteShardOperationResponse(new CreateTransactionReply(actorRef.path()));
+        actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef));
         actorContext.setExecuteRemoteOperationResponse("message");
 
         TransactionProxy transactionProxy =
             new TransactionProxy(actorContext,
-                TransactionProxy.TransactionType.READ_ONLY);
+                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
 
         transactionProxy.merge(TestModel.TEST_PATH,
             ImmutableNodes.containerNode(TestModel.NAME_QNAME));
@@ -127,12 +163,12 @@ public class TransactionProxyTest extends AbstractActorTest {
         final ActorRef actorRef = getSystem().actorOf(props);
 
         final MockActorContext actorContext = new MockActorContext(this.getSystem());
-        actorContext.setExecuteShardOperationResponse(new CreateTransactionReply(actorRef.path()));
+        actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef));
         actorContext.setExecuteRemoteOperationResponse("message");
 
         TransactionProxy transactionProxy =
             new TransactionProxy(actorContext,
-                TransactionProxy.TransactionType.READ_ONLY);
+                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
 
         transactionProxy.delete(TestModel.TEST_PATH);
 
@@ -158,12 +194,12 @@ public class TransactionProxyTest extends AbstractActorTest {
         final ActorRef doNothingActorRef = getSystem().actorOf(props);
 
         final MockActorContext actorContext = new MockActorContext(this.getSystem());
-        actorContext.setExecuteShardOperationResponse(new CreateTransactionReply(doNothingActorRef.path()));
+        actorContext.setExecuteShardOperationResponse(createTransactionReply(doNothingActorRef));
         actorContext.setExecuteRemoteOperationResponse(new ReadyTransactionReply(doNothingActorRef.path()));
 
         TransactionProxy transactionProxy =
             new TransactionProxy(actorContext,
-                TransactionProxy.TransactionType.READ_ONLY);
+                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
 
 
         DOMStoreThreePhaseCommitCohort ready = transactionProxy.ready();
@@ -182,12 +218,11 @@ public class TransactionProxyTest extends AbstractActorTest {
         final ActorRef doNothingActorRef = getSystem().actorOf(props);
 
         final MockActorContext actorContext = new MockActorContext(this.getSystem());
-        actorContext.setExecuteShardOperationResponse(
-            new CreateTransactionReply(doNothingActorRef.path()));
+        actorContext.setExecuteShardOperationResponse( createTransactionReply(doNothingActorRef) );
 
         TransactionProxy transactionProxy =
             new TransactionProxy(actorContext,
-                TransactionProxy.TransactionType.READ_ONLY);
+                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
 
         Assert.assertNotNull(transactionProxy.getIdentifier());
     }
@@ -198,12 +233,12 @@ public class TransactionProxyTest extends AbstractActorTest {
         final ActorRef actorRef = getSystem().actorOf(props);
 
         final MockActorContext actorContext = new MockActorContext(this.getSystem());
-        actorContext.setExecuteShardOperationResponse(new CreateTransactionReply(actorRef.path()));
+        actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef));
         actorContext.setExecuteRemoteOperationResponse("message");
 
         TransactionProxy transactionProxy =
             new TransactionProxy(actorContext,
-                TransactionProxy.TransactionType.READ_ONLY);
+                TransactionProxy.TransactionType.READ_ONLY, transactionExecutor);
 
         transactionProxy.close();
 
@@ -222,4 +257,8 @@ public class TransactionProxyTest extends AbstractActorTest {
 
         Assert.assertTrue(listMessages.get(0) instanceof CloseTransaction);
     }
+
+    private CreateTransactionReply createTransactionReply(ActorRef actorRef){
+        return new CreateTransactionReply(actorRef.path(), "txn-1");
+    }
 }
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/TestUtils.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/TestUtils.java
new file mode 100644 (file)
index 0000000..bb881d5
--- /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.datastore.utils;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSystem;
+import akka.actor.Props;
+import junit.framework.Assert;
+
+import java.util.List;
+
+public class TestUtils {
+
+    public static void assertFirstSentMessage(ActorSystem actorSystem, ActorRef actorRef, Class clazz){
+        ActorContext testContext = new ActorContext(actorSystem, actorSystem.actorOf(
+            Props.create(DoNothingActor.class)));
+        Object messages = testContext
+            .executeLocalOperation(actorRef, "messages",
+                ActorContext.ASK_DURATION);
+
+        Assert.assertNotNull(messages);
+
+        Assert.assertTrue(messages instanceof List);
+
+        List<Object> listMessages = (List<Object>) messages;
+
+        Assert.assertEquals(1, listMessages.size());
+
+        Assert.assertTrue(listMessages.get(0).getClass().equals(clazz));
+    }
+}
index 8fc6fe229500ecc39506fcc5b215b82cfdd9cb5e..32139308b11230b806467f95d078c1608077a1f6 100644 (file)
@@ -14,6 +14,7 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
+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.md.sal.common.impl.routing.RoutingUtils;
@@ -140,17 +141,34 @@ public class SchemaAwareRpcBroker implements RpcRouter, Identifiable<String>, Ro
         RpcDefinition definition = findRpcDefinition(rpcType);
         checkArgument(!isRoutedRpc(definition), "RPC Type must not be routed.");
         GlobalRpcRegistration reg = new GlobalRpcRegistration(rpcType, implementation, this);
-        implementations.putIfAbsent(rpcType, implementation);
+        final RpcImplementation previous = implementations.putIfAbsent(rpcType, implementation);
+        Preconditions.checkState(previous == null, "Rpc %s is already registered.",rpcType);
+        notifyRpcAdded(rpcType);
         return reg;
     }
 
+    private void notifyRpcAdded(QName rpcType) {
+        for (ListenerRegistration<RpcRegistrationListener> listener : rpcRegistrationListeners) {
+            try {
+                listener.getInstance().onRpcImplementationAdded(rpcType);
+            } catch (Exception ex) {
+                LOG.error("Unhandled exception during invoking listener {}", listener.getInstance(), ex);
+            }
+
+        }
+    }
+
     private boolean isRoutedRpc(RpcDefinition definition) {
         return getRoutingStrategy(definition) instanceof RoutedRpcStrategy;
     }
 
     @Override
     public ListenerRegistration<RpcRegistrationListener> addRpcRegistrationListener(RpcRegistrationListener listener) {
-        return rpcRegistrationListeners.register(listener);
+        ListenerRegistration<RpcRegistrationListener> reg = rpcRegistrationListeners.register(listener);
+        for (QName impl : implementations.keySet()) {
+            listener.onRpcImplementationAdded(impl);
+        }
+        return reg;
     }
 
     @Override
index dadef821eb349e048d8395f6ab1c24cb39eb89b4..906847426c6087d9b486de7aeb3237f28f971a7f 100644 (file)
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-simple</artifactId>
-      <version>${slf4j.version}</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>binding-generator-impl</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-test-model</artifactId>
+      <scope>test</scope>
+      <version>${project.version}</version>
+    </dependency>
   </dependencies>
 
   <build>
index af479743aa12a824a0e7610e057b7bbdd299e448..743ddd1ae069f6f1435c51fa7eb5fe709650fbc3 100644 (file)
@@ -30,7 +30,7 @@ public final class DOMImmutableDataChangeEvent implements
 
     private final NormalizedNode<?, ?> original;
     private final NormalizedNode<?, ?> updated;
-    private final Map<InstanceIdentifier, ? extends NormalizedNode<?, ?>> originalData;
+    private final Map<InstanceIdentifier, NormalizedNode<?, ?>> originalData;
     private final Map<InstanceIdentifier, NormalizedNode<?, ?>> createdData;
     private final Map<InstanceIdentifier, NormalizedNode<?, ?>> updatedData;
     private final Set<InstanceIdentifier> removedPaths;
@@ -67,7 +67,7 @@ public final class DOMImmutableDataChangeEvent implements
     }
 
     @Override
-    public Map<InstanceIdentifier, ? extends NormalizedNode<?, ?>> getOriginalData() {
+    public Map<InstanceIdentifier, NormalizedNode<?, ?>> getOriginalData() {
         return originalData;
     }
 
index 71a3534c811448d6f941f6166e145021db0653d7..b679de54d63ad7697381768eeba6bb7a044c85ac 100644 (file)
@@ -7,12 +7,17 @@
  */
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Multimap;
+import static org.opendaylight.controller.md.sal.dom.store.impl.DOMImmutableDataChangeEvent.builder;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.concurrent.Callable;
+
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
 import org.opendaylight.controller.md.sal.dom.store.impl.DOMImmutableDataChangeEvent.Builder;
 import org.opendaylight.controller.md.sal.dom.store.impl.DOMImmutableDataChangeEvent.SimpleEventFactory;
@@ -32,16 +37,12 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.concurrent.Callable;
-
-import static org.opendaylight.controller.md.sal.dom.store.impl.DOMImmutableDataChangeEvent.builder;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Multimap;
 
 /**
  * Resolve Data Change Events based on modifications and listeners
@@ -438,17 +439,19 @@ final class ResolveDataChangeEventsTask implements Callable<Iterable<ChangeListe
         Builder subtree = builder(DataChangeScope.SUBTREE).
                 setBefore(modification.getDataBefore().get()).
                 setAfter(modification.getDataAfter().get());
-
+        boolean oneModified = false;
         for (DataTreeCandidateNode childMod : modification.getChildNodes()) {
             PathArgument childId = childMod.getIdentifier();
             InstanceIdentifier childPath = path.node(childId);
             Collection<ListenerTree.Node> childListeners = getListenerChildrenWildcarded(listeners, childId);
 
+
             switch (childMod.getModificationType()) {
             case WRITE:
             case MERGE:
             case DELETE:
                 one.merge(resolveAnyChangeEvent(childPath, childListeners, childMod));
+                oneModified = true;
                 break;
             case SUBTREE_MODIFIED:
                 subtree.merge(resolveSubtreeChangeEvent(childPath, childListeners, childMod));
@@ -458,11 +461,20 @@ final class ResolveDataChangeEventsTask implements Callable<Iterable<ChangeListe
                 break;
             }
         }
-        DOMImmutableDataChangeEvent oneChangeEvent = one.build();
-        subtree.merge(oneChangeEvent);
+        final DOMImmutableDataChangeEvent oneChangeEvent;
+        if(oneModified) {
+            one.addUpdated(path, modification.getDataBefore().get(), modification.getDataAfter().get());
+            oneChangeEvent = one.build();
+            subtree.merge(oneChangeEvent);
+        } else {
+            oneChangeEvent = null;
+            subtree.addUpdated(path, modification.getDataBefore().get(), modification.getDataAfter().get());
+        }
         DOMImmutableDataChangeEvent subtreeEvent = subtree.build();
         if (!listeners.isEmpty()) {
-            addPartialTask(listeners, oneChangeEvent);
+            if(oneChangeEvent != null) {
+                addPartialTask(listeners, oneChangeEvent);
+            }
             addPartialTask(listeners, subtreeEvent);
         }
         return subtreeEvent;
diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/AbstractDataChangeListenerTest.java b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/AbstractDataChangeListenerTest.java
new file mode 100644 (file)
index 0000000..4d2d078
--- /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.md.sal.dom.store.impl;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.opendaylight.controller.md.sal.dom.store.impl.DatastoreTestTask.WriteTransactionCustomizer;
+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.TwoLevelList;
+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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.two.level.list.top.level.list.NestedList;
+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.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.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
+import org.opendaylight.yangtools.yang.data.api.schema.OrderedMapNode;
+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.model.api.SchemaContext;
+
+import com.google.common.util.concurrent.MoreExecutors;
+
+public abstract class AbstractDataChangeListenerTest {
+
+    protected static final InstanceIdentifier TOP_LEVEL = InstanceIdentifier
+            .of(Top.QNAME);
+    private static final QName NAME_QNAME = QName.create(Top.QNAME, "name");
+    protected static final String FOO = "foo";
+    protected static final String BAR = "bar";
+    protected static final String BAZ = "baz";
+
+    private InMemoryDOMDataStore datastore;
+    private SchemaContext schemaContext;
+
+    @Before
+    public final void setup() throws Exception {
+        YangModuleInfo moduleInfo = BindingReflections
+                .getModuleInfo(TwoLevelList.class);
+        ModuleInfoBackedContext context = ModuleInfoBackedContext.create();
+        context.registerModuleInfo(moduleInfo);
+        schemaContext = context.tryToCreateSchemaContext().get();
+        datastore = new InMemoryDOMDataStore("TEST",
+                MoreExecutors.sameThreadExecutor());
+        datastore.onGlobalContextUpdated(schemaContext);
+    }
+
+    public final DatastoreTestTask newTestTask() {
+        return new DatastoreTestTask(datastore).cleanup(DatastoreTestTask
+                .simpleDelete(TOP_LEVEL));
+    }
+
+
+    public static final InstanceIdentifier 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) {
+        return TOP_LEVEL.node(TopLevelList.QNAME).node(
+                new NodeIdentifierWithPredicates(TopLevelList.QNAME,
+                        NAME_QNAME, topName));
+    }
+
+    protected static DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> top() {
+        return Builders.containerBuilder().withNodeIdentifier(
+                new NodeIdentifier(Top.QNAME));
+    }
+
+
+
+    protected static void assertEmpty(final Collection<?> set) {
+        Assert.assertTrue(set.isEmpty());
+    }
+
+    protected static void assertEmpty(final Map<?,?> set) {
+        Assert.assertTrue(set.isEmpty());
+    }
+
+    protected static <K> void assertContains(final Collection<K> set, final K... values) {
+        for (K key : values) {
+            Assert.assertTrue(set.contains(key));
+        }
+
+    }
+
+    protected static <K> void assertNotContains(final Collection<K> set, final K... values) {
+        for (K key : values) {
+            Assert.assertFalse(set.contains(key));
+        }
+    }
+
+    protected static <K> void assertContains(final Map<K,?> map, final K... values) {
+        for (K key : values) {
+            Assert.assertTrue(map.containsKey(key));
+        }
+    }
+
+    protected static <K> void assertNotContains(final Map<K,?> map, final K... values) {
+        for (K key : values) {
+            Assert.assertFalse(map.containsKey(key));
+        }
+    }
+
+    protected static CollectionNodeBuilder<MapEntryNode, MapNode> topLevelMap() {
+        return ImmutableNodes.mapNodeBuilder(TopLevelList.QNAME);
+    }
+
+    protected static CollectionNodeBuilder<MapEntryNode, OrderedMapNode> nestedMap() {
+        return Builders.orderedMapBuilder().withNodeIdentifier(new NodeIdentifier(NestedList.QNAME));
+    }
+
+    public static DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> topLevelList(
+            final String key) {
+        return ImmutableNodes.mapEntryBuilder(TopLevelList.QNAME, NAME_QNAME,
+                key);
+    }
+
+    public static DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> nestedList(
+            final String key) {
+        return ImmutableNodes
+                .mapEntryBuilder(NestedList.QNAME, NAME_QNAME, key);
+    }
+
+    public static final WriteTransactionCustomizer writeOneTopMultipleNested(
+            final String topName, final String... nestedName) {
+        CollectionNodeBuilder<MapEntryNode, OrderedMapNode> nestedMapBuilder = nestedMap();
+        for (String nestedItem : nestedName) {
+            nestedMapBuilder.addChild(nestedList(nestedItem).build());
+        }
+
+        final ContainerNode data = top().addChild(
+                topLevelMap().addChild(
+                        topLevelList(topName)
+                                .addChild(nestedMapBuilder.build()).build())
+                        .build()).build();
+
+        return DatastoreTestTask.simpleWrite(TOP_LEVEL, data);
+    }
+
+    public static final  WriteTransactionCustomizer deleteNested(final String topName,
+            final String nestedName) {
+        return DatastoreTestTask.simpleDelete(path(topName, nestedName));
+    }
+}
diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DatastoreTestTask.java b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DatastoreTestTask.java
new file mode 100644 (file)
index 0000000..8ac93b1
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * 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.store.impl;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.ExecutionException;
+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.controller.md.sal.common.api.data.AsyncDataChangeListener;
+import org.opendaylight.controller.sal.core.spi.data.DOMStore;
+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.schema.NormalizedNode;
+
+import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.SettableFuture;
+
+public class DatastoreTestTask {
+
+    private final DOMStore store;
+    private AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> changeListener;
+
+    private WriteTransactionCustomizer setup;
+    private WriteTransactionCustomizer write;
+    private ReadTransactionVerifier read;
+    private WriteTransactionCustomizer cleanup;
+    private InstanceIdentifier changePath;
+    private DataChangeScope changeScope;
+    private boolean postSetup = false;
+    private final ChangeEventListener internalListener;
+
+    public DatastoreTestTask(final DOMStore datastore) {
+        this.store = datastore;
+        internalListener = new ChangeEventListener();
+    }
+
+    public DatastoreTestTask changeListener(final InstanceIdentifier path, final DataChangeScope scope,
+            final AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> changeListener) {
+        this.changeListener = changeListener;
+        this.changePath = path;
+        this.changeScope = scope;
+        return this;
+    }
+
+    public DatastoreTestTask changeListener(final InstanceIdentifier path, final DataChangeScope scope) {
+        this.changePath = path;
+        this.changeScope = scope;
+        return this;
+    }
+
+    public DatastoreTestTask setup(final WriteTransactionCustomizer setup) {
+        this.setup = setup;
+        return this;
+    }
+
+    public DatastoreTestTask test(final WriteTransactionCustomizer write) {
+        this.write = write;
+        return this;
+    }
+
+    public DatastoreTestTask read(final ReadTransactionVerifier read) {
+        this.read = read;
+        return this;
+    }
+
+    public DatastoreTestTask cleanup(final WriteTransactionCustomizer cleanup) {
+        this.cleanup = cleanup;
+        return this;
+    }
+
+    public void run() throws InterruptedException, ExecutionException {
+        if (setup != null) {
+            execute(setup);
+        }
+        ListenerRegistration<ChangeEventListener> registration = null;
+        if (changePath != null) {
+            registration = store.registerChangeListener(changePath, internalListener, changeScope);
+        }
+
+        Preconditions.checkState(write != null, "Write Transaction must be set.");
+        postSetup = true;
+        execute(write);
+        if (registration != null) {
+            registration.close();
+        }
+        if (changeListener != null) {
+            changeListener.onDataChanged(internalListener.receivedChange.get());
+        }
+        if (read != null) {
+            read.verify(store.newReadOnlyTransaction());
+        }
+        if (cleanup != null) {
+            execute(cleanup);
+        }
+    }
+
+    public Future<AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>>> getChangeEvent() {
+        return internalListener.receivedChange;
+    }
+
+    private void execute(final WriteTransactionCustomizer writeCustomizer) throws InterruptedException,
+            ExecutionException {
+        DOMStoreReadWriteTransaction tx = store.newReadWriteTransaction();
+        writeCustomizer.customize(tx);
+        DOMStoreThreePhaseCommitCohort cohort = tx.ready();
+        assertTrue(cohort.canCommit().get());
+        cohort.preCommit().get();
+        cohort.commit().get();
+    }
+
+    public interface WriteTransactionCustomizer {
+        public void customize(DOMStoreReadWriteTransaction tx);
+    }
+
+    public interface ReadTransactionVerifier {
+        public void verify(DOMStoreReadTransaction tx);
+    }
+
+    private final class ChangeEventListener implements
+            AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>> {
+
+        protected final SettableFuture<AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>>> receivedChange = SettableFuture
+                .create();
+
+        @Override
+        public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
+            if (postSetup) {
+                receivedChange.set(change);
+            }
+        }
+    }
+
+    public static final WriteTransactionCustomizer simpleWrite(final InstanceIdentifier path,
+            final NormalizedNode<?, ?> data) {
+        return new WriteTransactionCustomizer() {
+
+            @Override
+            public void customize(final DOMStoreReadWriteTransaction tx) {
+                tx.write(path, data);
+            }
+        };
+    }
+
+    public static final WriteTransactionCustomizer simpleMerge(final InstanceIdentifier path,
+            final NormalizedNode<?, ?> data) {
+        return new WriteTransactionCustomizer() {
+
+            @Override
+            public void customize(final DOMStoreReadWriteTransaction tx) {
+                tx.merge(path, data);
+            }
+        };
+    }
+
+    public static final WriteTransactionCustomizer simpleDelete(final InstanceIdentifier path) {
+        return new WriteTransactionCustomizer() {
+            @Override
+            public void customize(final DOMStoreReadWriteTransaction tx) {
+                tx.delete(path);
+            }
+        };
+    }
+}
diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DefaultDataChangeListenerTestSuite.java b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DefaultDataChangeListenerTestSuite.java
new file mode 100644 (file)
index 0000000..54d2043
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * 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.store.impl;
+
+import java.util.concurrent.ExecutionException;
+
+import org.junit.Test;
+import org.opendaylight.controller.md.sal.dom.store.impl.DatastoreTestTask.WriteTransactionCustomizer;
+import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
+
+public abstract class DefaultDataChangeListenerTestSuite extends AbstractDataChangeListenerTest {
+
+    protected static final String FOO_SIBLING = "foo-sibling";
+
+    abstract protected void customizeTask(DatastoreTestTask task);
+
+    @Test
+    public final void putTopLevelOneNested() throws InterruptedException, ExecutionException {
+
+        DatastoreTestTask task = newTestTask().test(writeOneTopMultipleNested(FOO, BAR));
+        customizeTask(task);
+        task.run();
+        putTopLevelOneNested(task);
+    }
+
+    @Test
+    public final void existingTopWriteSibling() throws InterruptedException, ExecutionException {
+        DatastoreTestTask task = newTestTask().setup(writeOneTopMultipleNested(FOO)).test(
+                new WriteTransactionCustomizer() {
+                    @Override
+                    public void customize(final DOMStoreReadWriteTransaction tx) {
+                        tx.write(path(FOO_SIBLING), topLevelList(FOO_SIBLING).build());
+                    }
+                });
+        customizeTask(task);
+        task.run();
+        existingTopWriteSibling(task);
+    }
+
+    protected abstract void existingTopWriteSibling(DatastoreTestTask task) throws InterruptedException, ExecutionException;
+
+
+    @Test
+    public final void existingTopWriteTwoNested() throws InterruptedException, ExecutionException {
+        DatastoreTestTask task = newTestTask().setup(writeOneTopMultipleNested(FOO)).test(
+                new WriteTransactionCustomizer() {
+                    @Override
+                    public void customize(final DOMStoreReadWriteTransaction tx) {
+                        tx.write(path(FOO,BAR), nestedList(BAR).build());
+                        tx.write(path(FOO,BAZ), nestedList(BAZ).build());
+                    }
+                });
+        customizeTask(task);
+        task.run();
+        existingTopWriteTwoNested(task);
+    }
+
+    protected abstract void existingTopWriteTwoNested(DatastoreTestTask task) throws InterruptedException, ExecutionException;
+
+
+    @Test
+    public final void existingOneNestedWriteAdditionalNested() throws InterruptedException, ExecutionException {
+        DatastoreTestTask task = newTestTask().setup(writeOneTopMultipleNested(FOO, BAR)).test(
+                new WriteTransactionCustomizer() {
+                    @Override
+                    public void customize(final DOMStoreReadWriteTransaction tx) {
+                        tx.write(path(FOO,BAZ), nestedList(BAZ).build());
+                    }
+                });
+        customizeTask(task);
+        task.run();
+        existingOneNestedWriteAdditionalNested(task);
+    }
+
+    protected abstract void existingOneNestedWriteAdditionalNested(DatastoreTestTask task) throws InterruptedException, ExecutionException;
+
+    protected abstract void putTopLevelOneNested(DatastoreTestTask task) throws InterruptedException,
+            ExecutionException;
+
+    @Test
+    public final void replaceTopLevelNestedChanged() throws InterruptedException, ExecutionException {
+        DatastoreTestTask task = newTestTask().setup(writeOneTopMultipleNested(FOO, BAR)).test(
+                writeOneTopMultipleNested(FOO, BAZ));
+        customizeTask(task);
+        task.run();
+        replaceTopLevelNestedChanged(task);
+    }
+
+    protected abstract void replaceTopLevelNestedChanged(DatastoreTestTask task) throws InterruptedException,
+            ExecutionException;
+
+    @Test
+    public final void putTopLevelWithTwoNested() throws InterruptedException, ExecutionException {
+
+        DatastoreTestTask task = newTestTask().test(writeOneTopMultipleNested(FOO, BAR, BAZ));
+        customizeTask(task);
+        task.run();
+        putTopLevelWithTwoNested(task);
+    }
+
+    protected abstract void putTopLevelWithTwoNested(DatastoreTestTask task) throws InterruptedException,
+            ExecutionException;
+
+    @Test
+    public final void twoNestedExistsOneIsDeleted() throws InterruptedException, ExecutionException {
+
+        DatastoreTestTask task = newTestTask().setup(writeOneTopMultipleNested(FOO, BAR, BAZ)).test(
+                deleteNested(FOO, BAZ));
+        customizeTask(task);
+        task.run();
+        twoNestedExistsOneIsDeleted(task);
+    }
+
+    protected abstract void twoNestedExistsOneIsDeleted(DatastoreTestTask task) throws InterruptedException,
+            ExecutionException;
+
+    @Test
+    public final void nestedListExistsRootDeleted() throws InterruptedException, ExecutionException {
+
+        DatastoreTestTask task = newTestTask().cleanup(null).setup(writeOneTopMultipleNested(FOO, BAR, BAZ))
+                .test(DatastoreTestTask.simpleDelete(TOP_LEVEL));
+        customizeTask(task);
+        task.run();
+        nestedListExistsRootDeleted(task);
+    }
+
+    protected abstract void nestedListExistsRootDeleted(DatastoreTestTask task) throws InterruptedException,
+            ExecutionException;
+}
index 369a7da138731dd6149d4b426096af7cc2a553dc..96369dea5fabc7d3ce25272f5e0cceaf5291a0c6 100644 (file)
@@ -1,8 +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.md.sal.dom.store.impl;
 
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.MoreExecutors;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.ExecutionException;
+
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -14,11 +24,9 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
-import java.util.concurrent.ExecutionException;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 
 
 public class InMemoryDataStoreTest {
@@ -237,7 +245,7 @@ public class InMemoryDataStoreTest {
   /**
    * Reads /test from readTx Read should return container.
    */
-  private static Optional<NormalizedNode<?, ?>> assertTestContainerExists(DOMStoreReadTransaction readTx)
+  private static Optional<NormalizedNode<?, ?>> assertTestContainerExists(final DOMStoreReadTransaction readTx)
       throws InterruptedException, ExecutionException {
 
     ListenableFuture<Optional<NormalizedNode<?, ?>>> writeTxContainer = readTx.read(TestModel.TEST_PATH);
diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/RootScopeSubtreeTest.java b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/RootScopeSubtreeTest.java
new file mode 100644 (file)
index 0000000..ef2a474
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * 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.store.impl;
+
+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.schema.NormalizedNode;
+
+public class RootScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
+
+    @Override
+    protected void customizeTask(final DatastoreTestTask task) {
+        task.changeListener(TOP_LEVEL, DataChangeScope.SUBTREE);
+    }
+
+    @Override
+    public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertContains(change.getCreatedData(), TOP_LEVEL, path(FOO), path(FOO, BAR));
+        assertEmpty(change.getUpdatedData());
+        assertEmpty(change.getRemovedPaths());
+    }
+
+    @Override
+    public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
+            ExecutionException {
+
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertContains(change.getCreatedData(), path(FOO, BAZ));
+        assertContains(change.getUpdatedData(), TOP_LEVEL, path(FOO));
+        assertContains(change.getRemovedPaths(), path(FOO, BAR));
+    }
+
+    @Override
+    protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws InterruptedException,
+            ExecutionException {
+
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertContains(change.getCreatedData(), TOP_LEVEL, path(FOO), path(FOO, BAR), path(FOO, BAZ));
+        assertEmpty(change.getUpdatedData());
+        assertEmpty(change.getRemovedPaths());
+    }
+
+    @Override
+    protected void twoNestedExistsOneIsDeleted(final DatastoreTestTask task) throws InterruptedException,
+            ExecutionException {
+
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertEmpty(change.getCreatedData());
+        assertContains(change.getUpdatedData(), TOP_LEVEL, path(FOO));
+        assertContains(change.getRemovedPaths(), path(FOO, BAZ));
+    }
+
+    @Override
+    protected void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
+            ExecutionException {
+
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertEmpty(change.getCreatedData());
+        assertEmpty(change.getUpdatedData());
+        assertContains(change.getRemovedPaths(), TOP_LEVEL, path(FOO), path(FOO, BAR), path(FOO, BAZ));
+    }
+
+    @Override
+    protected void existingOneNestedWriteAdditionalNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertContains(change.getCreatedData(), path(FOO,BAZ));
+        assertNotContains(change.getCreatedData(), path(FOO,BAR));
+        assertContains(change.getUpdatedData(), TOP_LEVEL, path(FOO));
+        assertEmpty(change.getRemovedPaths());
+    }
+
+    @Override
+    protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertContains(change.getCreatedData(), path(FOO,BAR),path(FOO,BAZ));
+        assertContains(change.getUpdatedData(), TOP_LEVEL, path(FOO));
+        assertNotContains(change.getUpdatedData(), path(FOO,BAR));
+        assertEmpty(change.getRemovedPaths());
+    }
+
+    @Override
+    protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertContains(change.getCreatedData(), path(FOO_SIBLING));
+        assertContains(change.getUpdatedData(), TOP_LEVEL);
+        assertNotContains(change.getUpdatedData(), path(FOO));
+        assertEmpty(change.getRemovedPaths());
+    }
+}
diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeBaseTest.java b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeBaseTest.java
new file mode 100644 (file)
index 0000000..4c1a860
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+ * 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.store.impl;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.concurrent.ExecutionException;
+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.schema.NormalizedNode;
+
+public class WildcardedScopeBaseTest extends DefaultDataChangeListenerTestSuite {
+
+    private static final InstanceIdentifier TOP_LEVEL_LIST_ALL = TOP_LEVEL.node(TopLevelList.QNAME).node(
+            TopLevelList.QNAME);
+
+    @Override
+    protected void customizeTask(final DatastoreTestTask task) {
+        task.changeListener(TOP_LEVEL_LIST_ALL, DataChangeScope.BASE);
+    }
+
+    @Override
+    public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertNotNull(change);
+
+        assertNotContains(change.getCreatedData(), TOP_LEVEL);
+        assertContains(change.getCreatedData(), path(FOO), path(FOO, BAR));
+
+        assertEmpty(change.getUpdatedData());
+        assertEmpty(change.getRemovedPaths());
+
+    }
+
+    @Override
+    public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
+            ExecutionException {
+
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        assertNotNull(change);
+
+        assertContains(change.getCreatedData(), path(FOO, BAZ));
+        assertContains(change.getUpdatedData(), path(FOO));
+        assertNotContains(change.getUpdatedData(), TOP_LEVEL);
+        assertContains(change.getRemovedPaths(), path(FOO, BAR));
+
+    }
+
+    @Override
+    protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws InterruptedException,
+            ExecutionException {
+
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        assertNotNull(change);
+        assertFalse(change.getCreatedData().isEmpty());
+
+        assertContains(change.getCreatedData(), path(FOO), path(FOO, BAR), path(FOO, BAZ));
+        assertNotContains(change.getCreatedData(), TOP_LEVEL);
+        assertEmpty(change.getUpdatedData());
+        assertEmpty(change.getRemovedPaths());
+
+    }
+
+    @Override
+    protected void twoNestedExistsOneIsDeleted(final DatastoreTestTask task) throws InterruptedException,
+            ExecutionException {
+
+        Future<?> future = task.getChangeEvent();
+        /*
+         * Base listener should be notified only and only if actual node changed its state,
+         * since deletion of child, did not result in change of node we are listening
+         * for, we should not be getting data change event
+         * and this means settable future containing receivedDataChangeEvent is not done.
+         *
+         */
+        assertFalse(future.isDone());
+    }
+
+    @Override
+    public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
+            ExecutionException {
+
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertEmpty(change.getCreatedData());
+        assertEmpty(change.getUpdatedData());
+
+        assertNotContains(change.getUpdatedData(), TOP_LEVEL);
+        assertContains(change.getRemovedPaths(), path(FOO),path(FOO, BAZ),path(FOO,BAR));
+    }
+
+    @Override
+    protected void existingOneNestedWriteAdditionalNested(final DatastoreTestTask task) {
+        Future<?> future = task.getChangeEvent();
+        /*
+         * One listener should be notified only and only if actual node changed its state,
+         * since deletion of nested child (in this case /nested-list/nested-list[foo],
+         * did not result in change of node we are listening
+         * for, we should not be getting data change event
+         * and this means settable future containing receivedDataChangeEvent is not done.
+         *
+         */
+        assertFalse(future.isDone());
+    }
+
+    @Override
+    protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+        Future<?> future = task.getChangeEvent();
+        /*
+         * One listener should be notified only and only if actual node changed its state,
+         * since deletion of nested child (in this case /nested-list/nested-list[foo],
+         * did not result in change of node we are listening
+         * for, we should not be getting data change event
+         * and this means settable future containing receivedDataChangeEvent is not done.
+         *
+         */
+        assertFalse(future.isDone());
+    }
+
+    @Override
+    protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertContains(change.getCreatedData(), path(FOO_SIBLING));
+        assertNotContains(change.getUpdatedData(), path(FOO), TOP_LEVEL);
+        assertEmpty(change.getRemovedPaths());
+    }
+}
diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeOneTest.java b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeOneTest.java
new file mode 100644 (file)
index 0000000..1f2cb22
--- /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.md.sal.dom.store.impl;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.concurrent.ExecutionException;
+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.schema.NormalizedNode;
+
+public class WildcardedScopeOneTest extends DefaultDataChangeListenerTestSuite {
+
+    private static final InstanceIdentifier TOP_LEVEL_LIST_ALL = TOP_LEVEL.node(TopLevelList.QNAME).node(
+            TopLevelList.QNAME);
+
+    @Override
+    protected void customizeTask(final DatastoreTestTask task) {
+        task.changeListener(TOP_LEVEL_LIST_ALL, DataChangeScope.ONE);
+    }
+
+    @Override
+    public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertNotNull(change);
+
+        assertNotContains(change.getCreatedData(), TOP_LEVEL);
+        assertContains(change.getCreatedData(), path(FOO), path(FOO, BAR));
+
+        assertEmpty(change.getUpdatedData());
+        assertEmpty(change.getRemovedPaths());
+
+    }
+
+    @Override
+    public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
+            ExecutionException {
+
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        assertNotNull(change);
+
+        assertContains(change.getCreatedData(), path(FOO, BAZ));
+        assertContains(change.getUpdatedData(), path(FOO));
+        assertNotContains(change.getUpdatedData(), TOP_LEVEL);
+        assertContains(change.getRemovedPaths(), path(FOO, BAR));
+
+    }
+
+    @Override
+    protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws InterruptedException,
+            ExecutionException {
+
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        assertNotNull(change);
+        assertFalse(change.getCreatedData().isEmpty());
+
+        assertContains(change.getCreatedData(), path(FOO), path(FOO, BAR), path(FOO, BAZ));
+        assertNotContains(change.getCreatedData(), TOP_LEVEL);
+        assertEmpty(change.getUpdatedData());
+        assertEmpty(change.getRemovedPaths());
+
+    }
+
+    @Override
+    protected void twoNestedExistsOneIsDeleted(final DatastoreTestTask task) throws InterruptedException,
+            ExecutionException {
+
+        Future<?> future = task.getChangeEvent();
+        /*
+         * One listener should be notified only and only if actual node changed its state,
+         * since deletion of nested child (in this case /nested-list/nested-list[foo],
+         * did not result in change of node we are listening
+         * for, we should not be getting data change event
+         * and this means settable future containing receivedDataChangeEvent is not done.
+         *
+         */
+        assertFalse(future.isDone());
+    }
+
+    @Override
+    public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
+            ExecutionException {
+
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertEmpty(change.getCreatedData());
+        assertEmpty(change.getUpdatedData());
+
+        assertNotContains(change.getUpdatedData(), TOP_LEVEL);
+        assertContains(change.getRemovedPaths(), path(FOO),path(FOO, BAZ),path(FOO,BAR));
+    }
+
+    @Override
+    protected void existingOneNestedWriteAdditionalNested(final DatastoreTestTask task) {
+        Future<?> future = task.getChangeEvent();
+        /*
+         * One listener should be notified only and only if actual node changed its state,
+         * since deletion of nested child (in this case /nested-list/nested-list[foo],
+         * did not result in change of node we are listening
+         * for, we should not be getting data change event
+         * and this means settable future containing receivedDataChangeEvent is not done.
+         *
+         */
+        assertFalse(future.isDone());
+    }
+
+    @Override
+    protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+        Future<?> future = task.getChangeEvent();
+        /*
+         * One listener should be notified only and only if actual node changed its state,
+         * since deletion of nested child (in this case /nested-list/nested-list[foo],
+         * did not result in change of node we are listening
+         * for, we should not be getting data change event
+         * and this means settable future containing receivedDataChangeEvent is not done.
+         *
+         */
+        assertFalse(future.isDone());
+    }
+
+    @Override
+    protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertContains(change.getCreatedData(), path(FOO_SIBLING));
+        assertNotContains(change.getUpdatedData(),path(FOO), TOP_LEVEL);
+        assertEmpty(change.getRemovedPaths());
+    }
+}
diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeSubtreeTest.java b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/WildcardedScopeSubtreeTest.java
new file mode 100644 (file)
index 0000000..0102048
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * 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.store.impl;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+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.schema.NormalizedNode;
+
+public class WildcardedScopeSubtreeTest extends DefaultDataChangeListenerTestSuite {
+
+    private static final InstanceIdentifier TOP_LEVEL_LIST_ALL = TOP_LEVEL.node(TopLevelList.QNAME).node(
+            TopLevelList.QNAME);
+
+    @Override
+    protected void customizeTask(final DatastoreTestTask task) {
+        task.changeListener(TOP_LEVEL_LIST_ALL, DataChangeScope.SUBTREE);
+    }
+
+    @Override
+    public void putTopLevelOneNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertNotContains(change.getCreatedData(), TOP_LEVEL);
+        assertContains(change.getCreatedData(), path(FOO), path(FOO, BAR));
+        assertEmpty(change.getUpdatedData());
+        assertEmpty(change.getRemovedPaths());
+
+    }
+
+    @Override
+    public void replaceTopLevelNestedChanged(final DatastoreTestTask task) throws InterruptedException,
+            ExecutionException {
+
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        assertNotNull(change);
+
+        assertContains(change.getCreatedData(), path(FOO, BAZ));
+        assertContains(change.getUpdatedData(), path(FOO));
+        assertNotContains(change.getUpdatedData(), TOP_LEVEL);
+        assertContains(change.getRemovedPaths(), path(FOO, BAR));
+
+    }
+
+    @Override
+    protected void putTopLevelWithTwoNested(final DatastoreTestTask task) throws InterruptedException,
+            ExecutionException {
+
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        assertNotNull(change);
+        assertFalse(change.getCreatedData().isEmpty());
+
+        assertContains(change.getCreatedData(), path(FOO), path(FOO, BAR), path(FOO, BAZ));
+        assertNotContains(change.getCreatedData(), TOP_LEVEL);
+        assertEmpty(change.getUpdatedData());
+        assertEmpty(change.getRemovedPaths());
+
+    }
+
+    @Override
+    protected void twoNestedExistsOneIsDeleted(final DatastoreTestTask task) throws InterruptedException,
+            ExecutionException {
+
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+        assertNotNull(change);
+        assertTrue(change.getCreatedData().isEmpty());
+        assertContains(change.getUpdatedData(), path(FOO));
+        assertNotContains(change.getUpdatedData(), TOP_LEVEL);
+        assertContains(change.getRemovedPaths(),path(FOO, BAZ));
+    }
+
+    @Override
+    public void nestedListExistsRootDeleted(final DatastoreTestTask task) throws InterruptedException,
+            ExecutionException {
+
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertEmpty(change.getCreatedData());
+        assertEmpty(change.getUpdatedData());
+
+        assertNotContains(change.getUpdatedData(), TOP_LEVEL);
+        assertContains(change.getRemovedPaths(), path(FOO),path(FOO, BAZ),path(FOO,BAR));
+    }
+
+    @Override
+    protected void existingOneNestedWriteAdditionalNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertContains(change.getCreatedData(), path(FOO,BAZ));
+        assertNotContains(change.getCreatedData(), path(FOO,BAR));
+        assertContains(change.getUpdatedData(), path(FOO));
+        assertNotContains(change.getUpdatedData(), TOP_LEVEL);
+        assertEmpty(change.getRemovedPaths());
+    }
+
+    @Override
+    protected void existingTopWriteTwoNested(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertContains(change.getCreatedData(), path(FOO,BAR),path(FOO,BAZ));
+        assertContains(change.getUpdatedData(), path(FOO));
+        assertNotContains(change.getUpdatedData(), TOP_LEVEL, path(FOO,BAR));
+        assertEmpty(change.getRemovedPaths());
+    }
+
+    @Override
+    protected void existingTopWriteSibling(final DatastoreTestTask task) throws InterruptedException, ExecutionException {
+        AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change = task.getChangeEvent().get();
+
+        assertContains(change.getCreatedData(), path(FOO_SIBLING));
+        assertNotContains(change.getUpdatedData(), path(FOO), TOP_LEVEL);
+        assertEmpty(change.getRemovedPaths());
+    }
+}
index 4da727f5c24e56e37c4e11acd6150d9afded1cd8..9fa68eeea6f87c7f1a4cb4634b0759a61cc2f83e 100644 (file)
@@ -22,6 +22,7 @@ import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;
 import org.opendaylight.controller.netconf.client.NetconfClientDispatcher;
 import org.opendaylight.controller.netconf.client.NetconfClientSession;
 import org.opendaylight.controller.netconf.client.NetconfClientSessionListener;
+import org.opendaylight.controller.netconf.client.conf.NetconfClientConfiguration;
 import org.opendaylight.controller.netconf.client.conf.NetconfReconnectingClientConfiguration;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
 import org.opendaylight.controller.netconf.util.xml.XmlUtil;
@@ -82,8 +83,12 @@ public class NetconfDeviceCommunicator implements NetconfClientSessionListener,
     }
 
     public void initializeRemoteConnection(final NetconfClientDispatcher dispatch,
-                                           final NetconfReconnectingClientConfiguration config) {
-        dispatch.createReconnectingClient(config);
+                                           final NetconfClientConfiguration config) {
+        if(config instanceof NetconfReconnectingClientConfiguration) {
+            dispatch.createReconnectingClient((NetconfReconnectingClientConfiguration) config);
+        }
+
+        dispatch.createClient(config);
     }
 
     private void tearDown( String reason ) {
index 21f94474f893a4b2c4dde263a477cc6336ce39d8..f9e6239bed3dd4ed03cceacbfb0cb8fde1228bd9 100644 (file)
@@ -55,7 +55,7 @@ public class NetconfMessageTransformer implements MessageTransformer<NetconfMess
     private static CompositeNode toNotification(final NetconfMessage message, final SchemaContext ctx) {
         final Set<NotificationDefinition> notifications = ctx.getNotifications();
         final Document document = message.getDocument();
-        return XmlDocumentUtils.notificationToDomNodes(document, Optional.fromNullable(notifications));
+        return XmlDocumentUtils.notificationToDomNodes(document, Optional.fromNullable(notifications), ctx);
     }
 
     @Override
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/NetconfToNotificationTest.java b/opendaylight/md-sal/sal-netconf-connector/src/test/java/org/opendaylight/controller/sal/connect/netconf/NetconfToNotificationTest.java
new file mode 100644 (file)
index 0000000..521a55d
--- /dev/null
@@ -0,0 +1,64 @@
+package org.opendaylight.controller.sal.connect.netconf;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.netconf.api.NetconfMessage;
+import org.opendaylight.controller.netconf.util.xml.XmlUtil;
+import org.opendaylight.controller.sal.connect.netconf.schema.mapping.NetconfMessageTransformer;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
+import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+import org.w3c.dom.Document;
+
+/**
+ * @author Lukas Sedlak <lsedlak@cisco.com>
+ */
+public class NetconfToNotificationTest {
+
+    NetconfMessageTransformer messageTransformer;
+
+    NetconfMessage userNotification;
+
+    @Before
+    public void setup() throws Exception {
+        final List<InputStream> modelsToParse = Collections.singletonList(getClass().getResourceAsStream("/schemas/user-notification.yang"));
+        final YangContextParser parser = new YangParserImpl();
+        final Set<Module> modules = parser.parseYangModelsFromStreams(modelsToParse);
+        assertTrue(!modules.isEmpty());
+        final SchemaContext schemaContext = parser.resolveSchemaContext(modules);
+        assertNotNull(schemaContext);
+
+        messageTransformer = new NetconfMessageTransformer();
+        messageTransformer.onGlobalContextUpdated(schemaContext);
+
+        final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        factory.setNamespaceAware(true);
+        InputStream notifyPayloadStream = getClass().getResourceAsStream("/notification-payload.xml");
+        assertNotNull(notifyPayloadStream);
+
+        final Document doc = XmlUtil.readXmlToDocument(notifyPayloadStream);
+        assertNotNull(doc);
+        userNotification = new NetconfMessage(doc);
+    }
+
+    @Test
+    public void test() throws Exception {
+        final CompositeNode root = messageTransformer.toNotification(userNotification);
+
+        assertNotNull(root);
+        assertEquals(6, root.size());
+        assertEquals("user-visited-page", root.getKey().getLocalName());
+    }
+}
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/test/resources/notification-payload.xml b/opendaylight/md-sal/sal-netconf-connector/src/test/resources/notification-payload.xml
new file mode 100644 (file)
index 0000000..837fcc1
--- /dev/null
@@ -0,0 +1,14 @@
+<notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
+<eventTime>2014-07-08T11:20:48UTC</eventTime>
+<user-visited-page xmlns="org:opendaylight:notification:test:ns:yang:user-notification">
+  <ui:incoming-user xmlns:ui="org:opendaylight:notification:test:ns:yang:user-notification">ui:public-user</ui:incoming-user>
+  <ip-address>172.23.29.104</ip-address>
+  <mac>00:11:00:ff:dd:02</mac>
+  <browser-id>Chrome 35.0.1916.153 m</browser-id>
+  <region>
+    <name>Slovakia</name>
+    <time-zone>UTC/GMT+2</time-zone>
+  </region>
+  <visiting-date>2014-07-08 11:20:48</visiting-date>
+</user-visited-page>
+</notification>
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/test/resources/schemas/user-notification.yang b/opendaylight/md-sal/sal-netconf-connector/src/test/resources/schemas/user-notification.yang
new file mode 100644 (file)
index 0000000..50d2206
--- /dev/null
@@ -0,0 +1,56 @@
+module user-notification {
+    yang-version 1;
+    namespace "org:opendaylight:notification:test:ns:yang:user-notification";
+    prefix "user";
+
+    organization "Cisco Systems";
+    contact "Lukas Sedlak";
+    description "Test model for testing notifications";
+
+    revision "2014-07-08" {
+        description "Initial revision";
+    }
+
+    identity user-identity {
+        description "Identity of user incoming to Web Page";
+    }
+
+    identity public-user {
+        base user-identity;
+        description "Identity of random public non-registered user";
+    }
+
+    notification user-visited-page {
+        leaf incoming-user {
+            type identityref {
+                base "user-identity";
+            }
+        }
+
+        leaf ip-address {
+            type string;
+        }
+
+        leaf mac {
+            type string;
+        }
+
+        leaf browser-id {
+            type string;
+        }
+
+        container region {
+            leaf name {
+                type string;
+            }
+
+            leaf time-zone {
+                type string;
+            }
+        }
+
+        leaf visiting-date {
+            type string;
+        }
+    }
+}
\ No newline at end of file
index 778d8c6162c988bb282d5995e7d3e3ab5615ba43..d0be2cbcbb02cdc4310f130aa25c8e4f25fd386b 100644 (file)
@@ -20,4 +20,9 @@ machine
 
  protoc --proto_path=src/main/resources --java_out=src/main/java src/main/resources/*.proto
 
-5. Run mvn clean install and resolve any trailing spaces issues & build the .jar
+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.
index 671a9441d8733f25449d6542687c529c38d49068..5254c19fcb9d80233b134c18946395b3d16dd269 100644 (file)
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+      <dependency>
+          <groupId>org.opendaylight.yangtools</groupId>
+          <artifactId>util</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-binding</artifactId>
+      </dependency>
+      <dependency>
+          <groupId>com.google.guava</groupId>
+          <artifactId>guava</artifactId>
+      </dependency>
+      <dependency>
+          <groupId>junit</groupId>
+          <artifactId>junit</artifactId>
+          <scope>test</scope>
+      </dependency>
+
+      <dependency>
+          <groupId>xmlunit</groupId>
+          <artifactId>xmlunit</artifactId>
+          <version>1.5</version>
+      </dependency>
+
+      <dependency>
+          <groupId>org.opendaylight.yangtools</groupId>
+          <artifactId>yang-parser-impl</artifactId>
+      </dependency>
+      <dependency>
+          <groupId>commons-lang</groupId>
+          <artifactId>commons-lang</artifactId>
+      </dependency>
+      <dependency>
+          <groupId>org.slf4j</groupId>
+          <artifactId>slf4j-simple</artifactId>
+          <version>${slf4j.version}</version>
+          <scope>test</scope>
+      </dependency>
+      <dependency>
+          <groupId>com.google.code.findbugs</groupId>
+          <artifactId>jsr305</artifactId>
+          <version>2.0.1</version>
+      </dependency>
   </dependencies>
 
 </project>
index 72e2c87ecba11018079e9d2c95c844e0bdbfd188..c9e586ba1a1438e7d0f949b06e4881ec63bc2697 100755 (executable)
 # or run command
 #       protoc --proto_path=src/main/resources --java_out=src/main/java src/main/resources/*.proto
 #
-#5. Run mvn clean install and resolve any trailing spaces issues & build the .jar
+#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
 
-echo "Done generating Java source files."
\ No newline at end of file
+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:]]\+$//' {} \+
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/transaction/ShardTransactionMessages.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/transaction/ShardTransactionMessages.java
deleted file mode 100644 (file)
index 3a226db..0000000
+++ /dev/null
@@ -1,3606 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: ShardTransactionMessages.proto
-
-package org.opendaylight.controller.cluster.datastore.transaction;
-
-public final class ShardTransactionMessages {
-  private ShardTransactionMessages() {}
-  public static void registerAllExtensions(
-      com.google.protobuf.ExtensionRegistry registry) {
-  }
-  public interface CloseTransactionOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
-  }
-  /**
-   * Protobuf type {@code org.opendaylight.controller.mdsal.CloseTransaction}
-   */
-  public static final class CloseTransaction extends
-      com.google.protobuf.GeneratedMessage
-      implements CloseTransactionOrBuilder {
-    // Use CloseTransaction.newBuilder() to construct.
-    private CloseTransaction(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
-      super(builder);
-      this.unknownFields = builder.getUnknownFields();
-    }
-    private CloseTransaction(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-    private static final CloseTransaction defaultInstance;
-    public static CloseTransaction getDefaultInstance() {
-      return defaultInstance;
-    }
-
-    public CloseTransaction getDefaultInstanceForType() {
-      return defaultInstance;
-    }
-
-    private final com.google.protobuf.UnknownFieldSet unknownFields;
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-        getUnknownFields() {
-      return this.unknownFields;
-    }
-    private CloseTransaction(
-        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.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransaction_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransaction_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction.Builder.class);
-    }
-
-    public static com.google.protobuf.Parser<CloseTransaction> PARSER =
-        new com.google.protobuf.AbstractParser<CloseTransaction>() {
-      public CloseTransaction parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return new CloseTransaction(input, extensionRegistry);
-      }
-    };
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<CloseTransaction> 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.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction 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.datastore.transaction.ShardTransactionMessages.CloseTransaction parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction 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.datastore.transaction.ShardTransactionMessages.CloseTransaction parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction 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.datastore.transaction.ShardTransactionMessages.CloseTransaction parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction 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.datastore.transaction.ShardTransactionMessages.CloseTransaction 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.CloseTransaction}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransaction_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransaction_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction.Builder.class);
-      }
-
-      // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction.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.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransaction_descriptor;
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction.getDefaultInstance();
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction build() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction buildPartial() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction(this);
-        onBuilt();
-        return result;
-      }
-
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction) {
-          return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction other) {
-        if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction.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.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction) e.getUnfinishedMessage();
-          throw e;
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-
-      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CloseTransaction)
-    }
-
-    static {
-      defaultInstance = new CloseTransaction(true);
-      defaultInstance.initFields();
-    }
-
-    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CloseTransaction)
-  }
-
-  public interface CloseTransactionReplyOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
-  }
-  /**
-   * Protobuf type {@code org.opendaylight.controller.mdsal.CloseTransactionReply}
-   */
-  public static final class CloseTransactionReply extends
-      com.google.protobuf.GeneratedMessage
-      implements CloseTransactionReplyOrBuilder {
-    // Use CloseTransactionReply.newBuilder() to construct.
-    private CloseTransactionReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
-      super(builder);
-      this.unknownFields = builder.getUnknownFields();
-    }
-    private CloseTransactionReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-    private static final CloseTransactionReply defaultInstance;
-    public static CloseTransactionReply getDefaultInstance() {
-      return defaultInstance;
-    }
-
-    public CloseTransactionReply getDefaultInstanceForType() {
-      return defaultInstance;
-    }
-
-    private final com.google.protobuf.UnknownFieldSet unknownFields;
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-        getUnknownFields() {
-      return this.unknownFields;
-    }
-    private CloseTransactionReply(
-        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.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply.Builder.class);
-    }
-
-    public static com.google.protobuf.Parser<CloseTransactionReply> PARSER =
-        new com.google.protobuf.AbstractParser<CloseTransactionReply>() {
-      public CloseTransactionReply parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return new CloseTransactionReply(input, extensionRegistry);
-      }
-    };
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<CloseTransactionReply> 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.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply 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.datastore.transaction.ShardTransactionMessages.CloseTransactionReply parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply 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.datastore.transaction.ShardTransactionMessages.CloseTransactionReply parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply 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.datastore.transaction.ShardTransactionMessages.CloseTransactionReply parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply 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.datastore.transaction.ShardTransactionMessages.CloseTransactionReply 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.CloseTransactionReply}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReplyOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply.Builder.class);
-      }
-
-      // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply.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.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_descriptor;
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply.getDefaultInstance();
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply build() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply buildPartial() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply(this);
-        onBuilt();
-        return result;
-      }
-
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply) {
-          return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply other) {
-        if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply.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.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply) e.getUnfinishedMessage();
-          throw e;
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-
-      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CloseTransactionReply)
-    }
-
-    static {
-      defaultInstance = new CloseTransactionReply(true);
-      defaultInstance.initFields();
-    }
-
-    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CloseTransactionReply)
-  }
-
-  public interface CreateTransactionOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
-  }
-  /**
-   * Protobuf type {@code org.opendaylight.controller.mdsal.CreateTransaction}
-   */
-  public static final class CreateTransaction extends
-      com.google.protobuf.GeneratedMessage
-      implements CreateTransactionOrBuilder {
-    // Use CreateTransaction.newBuilder() to construct.
-    private CreateTransaction(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
-      super(builder);
-      this.unknownFields = builder.getUnknownFields();
-    }
-    private CreateTransaction(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-    private static final CreateTransaction defaultInstance;
-    public static CreateTransaction getDefaultInstance() {
-      return defaultInstance;
-    }
-
-    public CreateTransaction getDefaultInstanceForType() {
-      return defaultInstance;
-    }
-
-    private final com.google.protobuf.UnknownFieldSet unknownFields;
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-        getUnknownFields() {
-      return this.unknownFields;
-    }
-    private CreateTransaction(
-        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.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransaction_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransaction_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction.Builder.class);
-    }
-
-    public static com.google.protobuf.Parser<CreateTransaction> PARSER =
-        new com.google.protobuf.AbstractParser<CreateTransaction>() {
-      public CreateTransaction parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return new CreateTransaction(input, extensionRegistry);
-      }
-    };
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<CreateTransaction> 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.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction 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.datastore.transaction.ShardTransactionMessages.CreateTransaction parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction 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.datastore.transaction.ShardTransactionMessages.CreateTransaction parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction 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.datastore.transaction.ShardTransactionMessages.CreateTransaction parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction 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.datastore.transaction.ShardTransactionMessages.CreateTransaction 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.CreateTransaction}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransaction_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransaction_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction.Builder.class);
-      }
-
-      // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction.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.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransaction_descriptor;
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction.getDefaultInstance();
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction build() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction buildPartial() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction(this);
-        onBuilt();
-        return result;
-      }
-
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction) {
-          return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction other) {
-        if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction.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.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction) e.getUnfinishedMessage();
-          throw e;
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-
-      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CreateTransaction)
-    }
-
-    static {
-      defaultInstance = new CreateTransaction(true);
-      defaultInstance.initFields();
-    }
-
-    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CreateTransaction)
-  }
-
-  public interface CreateTransactionReplyOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
-
-    // required string transactionPath = 1;
-    /**
-     * <code>required string transactionPath = 1;</code>
-     */
-    boolean hasTransactionPath();
-    /**
-     * <code>required string transactionPath = 1;</code>
-     */
-    java.lang.String getTransactionPath();
-    /**
-     * <code>required string transactionPath = 1;</code>
-     */
-    com.google.protobuf.ByteString
-        getTransactionPathBytes();
-  }
-  /**
-   * Protobuf type {@code org.opendaylight.controller.mdsal.CreateTransactionReply}
-   */
-  public static final class CreateTransactionReply extends
-      com.google.protobuf.GeneratedMessage
-      implements CreateTransactionReplyOrBuilder {
-    // Use CreateTransactionReply.newBuilder() to construct.
-    private CreateTransactionReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
-      super(builder);
-      this.unknownFields = builder.getUnknownFields();
-    }
-    private CreateTransactionReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-    private static final CreateTransactionReply defaultInstance;
-    public static CreateTransactionReply getDefaultInstance() {
-      return defaultInstance;
-    }
-
-    public CreateTransactionReply getDefaultInstanceForType() {
-      return defaultInstance;
-    }
-
-    private final com.google.protobuf.UnknownFieldSet unknownFields;
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-        getUnknownFields() {
-      return this.unknownFields;
-    }
-    private CreateTransactionReply(
-        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;
-              transactionPath_ = 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.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply.Builder.class);
-    }
-
-    public static com.google.protobuf.Parser<CreateTransactionReply> PARSER =
-        new com.google.protobuf.AbstractParser<CreateTransactionReply>() {
-      public CreateTransactionReply parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return new CreateTransactionReply(input, extensionRegistry);
-      }
-    };
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<CreateTransactionReply> getParserForType() {
-      return PARSER;
-    }
-
-    private int bitField0_;
-    // required string transactionPath = 1;
-    public static final int TRANSACTIONPATH_FIELD_NUMBER = 1;
-    private java.lang.Object transactionPath_;
-    /**
-     * <code>required string transactionPath = 1;</code>
-     */
-    public boolean hasTransactionPath() {
-      return ((bitField0_ & 0x00000001) == 0x00000001);
-    }
-    /**
-     * <code>required string transactionPath = 1;</code>
-     */
-    public java.lang.String getTransactionPath() {
-      java.lang.Object ref = transactionPath_;
-      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()) {
-          transactionPath_ = s;
-        }
-        return s;
-      }
-    }
-    /**
-     * <code>required string transactionPath = 1;</code>
-     */
-    public com.google.protobuf.ByteString
-        getTransactionPathBytes() {
-      java.lang.Object ref = transactionPath_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b =
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        transactionPath_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    private void initFields() {
-      transactionPath_ = "";
-    }
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
-
-      if (!hasTransactionPath()) {
-        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, getTransactionPathBytes());
-      }
-      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, getTransactionPathBytes());
-      }
-      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.datastore.transaction.ShardTransactionMessages.CreateTransactionReply parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply 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.datastore.transaction.ShardTransactionMessages.CreateTransactionReply parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply 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.datastore.transaction.ShardTransactionMessages.CreateTransactionReply parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply 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.datastore.transaction.ShardTransactionMessages.CreateTransactionReply parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply 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.datastore.transaction.ShardTransactionMessages.CreateTransactionReply 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.CreateTransactionReply}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReplyOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply.Builder.class);
-      }
-
-      // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply.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();
-        transactionPath_ = "";
-        bitField0_ = (bitField0_ & ~0x00000001);
-        return this;
-      }
-
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor;
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply.getDefaultInstance();
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply build() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply buildPartial() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply(this);
-        int from_bitField0_ = bitField0_;
-        int to_bitField0_ = 0;
-        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
-          to_bitField0_ |= 0x00000001;
-        }
-        result.transactionPath_ = transactionPath_;
-        result.bitField0_ = to_bitField0_;
-        onBuilt();
-        return result;
-      }
-
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply) {
-          return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply other) {
-        if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply.getDefaultInstance()) return this;
-        if (other.hasTransactionPath()) {
-          bitField0_ |= 0x00000001;
-          transactionPath_ = other.transactionPath_;
-          onChanged();
-        }
-        this.mergeUnknownFields(other.getUnknownFields());
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        if (!hasTransactionPath()) {
-
-          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.datastore.transaction.ShardTransactionMessages.CreateTransactionReply parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply) e.getUnfinishedMessage();
-          throw e;
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-      private int bitField0_;
-
-      // required string transactionPath = 1;
-      private java.lang.Object transactionPath_ = "";
-      /**
-       * <code>required string transactionPath = 1;</code>
-       */
-      public boolean hasTransactionPath() {
-        return ((bitField0_ & 0x00000001) == 0x00000001);
-      }
-      /**
-       * <code>required string transactionPath = 1;</code>
-       */
-      public java.lang.String getTransactionPath() {
-        java.lang.Object ref = transactionPath_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          transactionPath_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>required string transactionPath = 1;</code>
-       */
-      public com.google.protobuf.ByteString
-          getTransactionPathBytes() {
-        java.lang.Object ref = transactionPath_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b =
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          transactionPath_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>required string transactionPath = 1;</code>
-       */
-      public Builder setTransactionPath(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-        transactionPath_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required string transactionPath = 1;</code>
-       */
-      public Builder clearTransactionPath() {
-        bitField0_ = (bitField0_ & ~0x00000001);
-        transactionPath_ = getDefaultInstance().getTransactionPath();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required string transactionPath = 1;</code>
-       */
-      public Builder setTransactionPathBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-        transactionPath_ = value;
-        onChanged();
-        return this;
-      }
-
-      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CreateTransactionReply)
-    }
-
-    static {
-      defaultInstance = new CreateTransactionReply(true);
-      defaultInstance.initFields();
-    }
-
-    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CreateTransactionReply)
-  }
-
-  public interface ReadyTransactionOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
-  }
-  /**
-   * Protobuf type {@code org.opendaylight.controller.mdsal.ReadyTransaction}
-   */
-  public static final class ReadyTransaction extends
-      com.google.protobuf.GeneratedMessage
-      implements ReadyTransactionOrBuilder {
-    // Use ReadyTransaction.newBuilder() to construct.
-    private ReadyTransaction(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
-      super(builder);
-      this.unknownFields = builder.getUnknownFields();
-    }
-    private ReadyTransaction(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-    private static final ReadyTransaction defaultInstance;
-    public static ReadyTransaction getDefaultInstance() {
-      return defaultInstance;
-    }
-
-    public ReadyTransaction getDefaultInstanceForType() {
-      return defaultInstance;
-    }
-
-    private final com.google.protobuf.UnknownFieldSet unknownFields;
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-        getUnknownFields() {
-      return this.unknownFields;
-    }
-    private ReadyTransaction(
-        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.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction.Builder.class);
-    }
-
-    public static com.google.protobuf.Parser<ReadyTransaction> PARSER =
-        new com.google.protobuf.AbstractParser<ReadyTransaction>() {
-      public ReadyTransaction parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return new ReadyTransaction(input, extensionRegistry);
-      }
-    };
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<ReadyTransaction> 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.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction 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.datastore.transaction.ShardTransactionMessages.ReadyTransaction parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction 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.datastore.transaction.ShardTransactionMessages.ReadyTransaction parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction 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.datastore.transaction.ShardTransactionMessages.ReadyTransaction parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction 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.datastore.transaction.ShardTransactionMessages.ReadyTransaction 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.ReadyTransaction}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction.Builder.class);
-      }
-
-      // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction.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.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_descriptor;
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction.getDefaultInstance();
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction build() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction buildPartial() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction(this);
-        onBuilt();
-        return result;
-      }
-
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction) {
-          return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction other) {
-        if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction.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.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction) e.getUnfinishedMessage();
-          throw e;
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-
-      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.ReadyTransaction)
-    }
-
-    static {
-      defaultInstance = new ReadyTransaction(true);
-      defaultInstance.initFields();
-    }
-
-    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.ReadyTransaction)
-  }
-
-  public interface ReadyTransactionReplyOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
-
-    // required string actorPath = 1;
-    /**
-     * <code>required string actorPath = 1;</code>
-     */
-    boolean hasActorPath();
-    /**
-     * <code>required string actorPath = 1;</code>
-     */
-    java.lang.String getActorPath();
-    /**
-     * <code>required string actorPath = 1;</code>
-     */
-    com.google.protobuf.ByteString
-        getActorPathBytes();
-  }
-  /**
-   * Protobuf type {@code org.opendaylight.controller.mdsal.ReadyTransactionReply}
-   */
-  public static final class ReadyTransactionReply extends
-      com.google.protobuf.GeneratedMessage
-      implements ReadyTransactionReplyOrBuilder {
-    // Use ReadyTransactionReply.newBuilder() to construct.
-    private ReadyTransactionReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
-      super(builder);
-      this.unknownFields = builder.getUnknownFields();
-    }
-    private ReadyTransactionReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-    private static final ReadyTransactionReply defaultInstance;
-    public static ReadyTransactionReply getDefaultInstance() {
-      return defaultInstance;
-    }
-
-    public ReadyTransactionReply getDefaultInstanceForType() {
-      return defaultInstance;
-    }
-
-    private final com.google.protobuf.UnknownFieldSet unknownFields;
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-        getUnknownFields() {
-      return this.unknownFields;
-    }
-    private ReadyTransactionReply(
-        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;
-              actorPath_ = 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.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply.Builder.class);
-    }
-
-    public static com.google.protobuf.Parser<ReadyTransactionReply> PARSER =
-        new com.google.protobuf.AbstractParser<ReadyTransactionReply>() {
-      public ReadyTransactionReply parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return new ReadyTransactionReply(input, extensionRegistry);
-      }
-    };
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<ReadyTransactionReply> getParserForType() {
-      return PARSER;
-    }
-
-    private int bitField0_;
-    // required string actorPath = 1;
-    public static final int ACTORPATH_FIELD_NUMBER = 1;
-    private java.lang.Object actorPath_;
-    /**
-     * <code>required string actorPath = 1;</code>
-     */
-    public boolean hasActorPath() {
-      return ((bitField0_ & 0x00000001) == 0x00000001);
-    }
-    /**
-     * <code>required string actorPath = 1;</code>
-     */
-    public java.lang.String getActorPath() {
-      java.lang.Object ref = actorPath_;
-      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()) {
-          actorPath_ = s;
-        }
-        return s;
-      }
-    }
-    /**
-     * <code>required string actorPath = 1;</code>
-     */
-    public com.google.protobuf.ByteString
-        getActorPathBytes() {
-      java.lang.Object ref = actorPath_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b =
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        actorPath_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    private void initFields() {
-      actorPath_ = "";
-    }
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
-
-      if (!hasActorPath()) {
-        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, getActorPathBytes());
-      }
-      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, getActorPathBytes());
-      }
-      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.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply 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.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply 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.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply 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.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply 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.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply 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.ReadyTransactionReply}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReplyOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply.Builder.class);
-      }
-
-      // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply.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();
-        actorPath_ = "";
-        bitField0_ = (bitField0_ & ~0x00000001);
-        return this;
-      }
-
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_descriptor;
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply.getDefaultInstance();
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply build() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply buildPartial() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply(this);
-        int from_bitField0_ = bitField0_;
-        int to_bitField0_ = 0;
-        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
-          to_bitField0_ |= 0x00000001;
-        }
-        result.actorPath_ = actorPath_;
-        result.bitField0_ = to_bitField0_;
-        onBuilt();
-        return result;
-      }
-
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply) {
-          return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply other) {
-        if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply.getDefaultInstance()) return this;
-        if (other.hasActorPath()) {
-          bitField0_ |= 0x00000001;
-          actorPath_ = other.actorPath_;
-          onChanged();
-        }
-        this.mergeUnknownFields(other.getUnknownFields());
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        if (!hasActorPath()) {
-
-          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.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply) e.getUnfinishedMessage();
-          throw e;
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-      private int bitField0_;
-
-      // required string actorPath = 1;
-      private java.lang.Object actorPath_ = "";
-      /**
-       * <code>required string actorPath = 1;</code>
-       */
-      public boolean hasActorPath() {
-        return ((bitField0_ & 0x00000001) == 0x00000001);
-      }
-      /**
-       * <code>required string actorPath = 1;</code>
-       */
-      public java.lang.String getActorPath() {
-        java.lang.Object ref = actorPath_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          actorPath_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>required string actorPath = 1;</code>
-       */
-      public com.google.protobuf.ByteString
-          getActorPathBytes() {
-        java.lang.Object ref = actorPath_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b =
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          actorPath_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>required string actorPath = 1;</code>
-       */
-      public Builder setActorPath(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-        actorPath_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required string actorPath = 1;</code>
-       */
-      public Builder clearActorPath() {
-        bitField0_ = (bitField0_ & ~0x00000001);
-        actorPath_ = getDefaultInstance().getActorPath();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required string actorPath = 1;</code>
-       */
-      public Builder setActorPathBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-        actorPath_ = value;
-        onChanged();
-        return this;
-      }
-
-      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.ReadyTransactionReply)
-    }
-
-    static {
-      defaultInstance = new ReadyTransactionReply(true);
-      defaultInstance.initFields();
-    }
-
-    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.ReadyTransactionReply)
-  }
-
-  public interface DeleteDataOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
-
-    // required string instanceIdentifierPath = 1;
-    /**
-     * <code>required string instanceIdentifierPath = 1;</code>
-     */
-    boolean hasInstanceIdentifierPath();
-    /**
-     * <code>required string instanceIdentifierPath = 1;</code>
-     */
-    java.lang.String getInstanceIdentifierPath();
-    /**
-     * <code>required string instanceIdentifierPath = 1;</code>
-     */
-    com.google.protobuf.ByteString
-        getInstanceIdentifierPathBytes();
-  }
-  /**
-   * Protobuf type {@code org.opendaylight.controller.mdsal.DeleteData}
-   */
-  public static final class DeleteData extends
-      com.google.protobuf.GeneratedMessage
-      implements DeleteDataOrBuilder {
-    // Use DeleteData.newBuilder() to construct.
-    private DeleteData(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
-      super(builder);
-      this.unknownFields = builder.getUnknownFields();
-    }
-    private DeleteData(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-    private static final DeleteData defaultInstance;
-    public static DeleteData getDefaultInstance() {
-      return defaultInstance;
-    }
-
-    public DeleteData getDefaultInstanceForType() {
-      return defaultInstance;
-    }
-
-    private final com.google.protobuf.UnknownFieldSet unknownFields;
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-        getUnknownFields() {
-      return this.unknownFields;
-    }
-    private DeleteData(
-        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;
-              instanceIdentifierPath_ = 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.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteData_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteData_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData.Builder.class);
-    }
-
-    public static com.google.protobuf.Parser<DeleteData> PARSER =
-        new com.google.protobuf.AbstractParser<DeleteData>() {
-      public DeleteData parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return new DeleteData(input, extensionRegistry);
-      }
-    };
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<DeleteData> getParserForType() {
-      return PARSER;
-    }
-
-    private int bitField0_;
-    // required string instanceIdentifierPath = 1;
-    public static final int INSTANCEIDENTIFIERPATH_FIELD_NUMBER = 1;
-    private java.lang.Object instanceIdentifierPath_;
-    /**
-     * <code>required string instanceIdentifierPath = 1;</code>
-     */
-    public boolean hasInstanceIdentifierPath() {
-      return ((bitField0_ & 0x00000001) == 0x00000001);
-    }
-    /**
-     * <code>required string instanceIdentifierPath = 1;</code>
-     */
-    public java.lang.String getInstanceIdentifierPath() {
-      java.lang.Object ref = instanceIdentifierPath_;
-      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()) {
-          instanceIdentifierPath_ = s;
-        }
-        return s;
-      }
-    }
-    /**
-     * <code>required string instanceIdentifierPath = 1;</code>
-     */
-    public com.google.protobuf.ByteString
-        getInstanceIdentifierPathBytes() {
-      java.lang.Object ref = instanceIdentifierPath_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b =
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        instanceIdentifierPath_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    private void initFields() {
-      instanceIdentifierPath_ = "";
-    }
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
-
-      if (!hasInstanceIdentifierPath()) {
-        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, getInstanceIdentifierPathBytes());
-      }
-      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, getInstanceIdentifierPathBytes());
-      }
-      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.datastore.transaction.ShardTransactionMessages.DeleteData parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData 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.datastore.transaction.ShardTransactionMessages.DeleteData parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData 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.datastore.transaction.ShardTransactionMessages.DeleteData parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData 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.datastore.transaction.ShardTransactionMessages.DeleteData parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData 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.datastore.transaction.ShardTransactionMessages.DeleteData 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.DeleteData}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteData_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteData_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData.Builder.class);
-      }
-
-      // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData.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();
-        instanceIdentifierPath_ = "";
-        bitField0_ = (bitField0_ & ~0x00000001);
-        return this;
-      }
-
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteData_descriptor;
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData.getDefaultInstance();
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData build() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData buildPartial() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData(this);
-        int from_bitField0_ = bitField0_;
-        int to_bitField0_ = 0;
-        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
-          to_bitField0_ |= 0x00000001;
-        }
-        result.instanceIdentifierPath_ = instanceIdentifierPath_;
-        result.bitField0_ = to_bitField0_;
-        onBuilt();
-        return result;
-      }
-
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData) {
-          return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData other) {
-        if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData.getDefaultInstance()) return this;
-        if (other.hasInstanceIdentifierPath()) {
-          bitField0_ |= 0x00000001;
-          instanceIdentifierPath_ = other.instanceIdentifierPath_;
-          onChanged();
-        }
-        this.mergeUnknownFields(other.getUnknownFields());
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        if (!hasInstanceIdentifierPath()) {
-
-          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.datastore.transaction.ShardTransactionMessages.DeleteData parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData) e.getUnfinishedMessage();
-          throw e;
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-      private int bitField0_;
-
-      // required string instanceIdentifierPath = 1;
-      private java.lang.Object instanceIdentifierPath_ = "";
-      /**
-       * <code>required string instanceIdentifierPath = 1;</code>
-       */
-      public boolean hasInstanceIdentifierPath() {
-        return ((bitField0_ & 0x00000001) == 0x00000001);
-      }
-      /**
-       * <code>required string instanceIdentifierPath = 1;</code>
-       */
-      public java.lang.String getInstanceIdentifierPath() {
-        java.lang.Object ref = instanceIdentifierPath_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          instanceIdentifierPath_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>required string instanceIdentifierPath = 1;</code>
-       */
-      public com.google.protobuf.ByteString
-          getInstanceIdentifierPathBytes() {
-        java.lang.Object ref = instanceIdentifierPath_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b =
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          instanceIdentifierPath_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>required string instanceIdentifierPath = 1;</code>
-       */
-      public Builder setInstanceIdentifierPath(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-        instanceIdentifierPath_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required string instanceIdentifierPath = 1;</code>
-       */
-      public Builder clearInstanceIdentifierPath() {
-        bitField0_ = (bitField0_ & ~0x00000001);
-        instanceIdentifierPath_ = getDefaultInstance().getInstanceIdentifierPath();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required string instanceIdentifierPath = 1;</code>
-       */
-      public Builder setInstanceIdentifierPathBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-        instanceIdentifierPath_ = value;
-        onChanged();
-        return this;
-      }
-
-      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.DeleteData)
-    }
-
-    static {
-      defaultInstance = new DeleteData(true);
-      defaultInstance.initFields();
-    }
-
-    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.DeleteData)
-  }
-
-  public interface DeleteDataReplyOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
-  }
-  /**
-   * Protobuf type {@code org.opendaylight.controller.mdsal.DeleteDataReply}
-   */
-  public static final class DeleteDataReply extends
-      com.google.protobuf.GeneratedMessage
-      implements DeleteDataReplyOrBuilder {
-    // Use DeleteDataReply.newBuilder() to construct.
-    private DeleteDataReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
-      super(builder);
-      this.unknownFields = builder.getUnknownFields();
-    }
-    private DeleteDataReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-    private static final DeleteDataReply defaultInstance;
-    public static DeleteDataReply getDefaultInstance() {
-      return defaultInstance;
-    }
-
-    public DeleteDataReply getDefaultInstanceForType() {
-      return defaultInstance;
-    }
-
-    private final com.google.protobuf.UnknownFieldSet unknownFields;
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-        getUnknownFields() {
-      return this.unknownFields;
-    }
-    private DeleteDataReply(
-        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.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply.Builder.class);
-    }
-
-    public static com.google.protobuf.Parser<DeleteDataReply> PARSER =
-        new com.google.protobuf.AbstractParser<DeleteDataReply>() {
-      public DeleteDataReply parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return new DeleteDataReply(input, extensionRegistry);
-      }
-    };
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<DeleteDataReply> 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.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply 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.datastore.transaction.ShardTransactionMessages.DeleteDataReply parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply 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.datastore.transaction.ShardTransactionMessages.DeleteDataReply parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply 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.datastore.transaction.ShardTransactionMessages.DeleteDataReply parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply 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.datastore.transaction.ShardTransactionMessages.DeleteDataReply 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.DeleteDataReply}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReplyOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply.Builder.class);
-      }
-
-      // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply.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.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_descriptor;
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply.getDefaultInstance();
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply build() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply buildPartial() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply(this);
-        onBuilt();
-        return result;
-      }
-
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply) {
-          return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply other) {
-        if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply.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.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply) e.getUnfinishedMessage();
-          throw e;
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-
-      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.DeleteDataReply)
-    }
-
-    static {
-      defaultInstance = new DeleteDataReply(true);
-      defaultInstance.initFields();
-    }
-
-    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.DeleteDataReply)
-  }
-
-  public interface ReadDataOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
-
-    // required string intanceIdentifier = 1;
-    /**
-     * <code>required string intanceIdentifier = 1;</code>
-     */
-    boolean hasIntanceIdentifier();
-    /**
-     * <code>required string intanceIdentifier = 1;</code>
-     */
-    java.lang.String getIntanceIdentifier();
-    /**
-     * <code>required string intanceIdentifier = 1;</code>
-     */
-    com.google.protobuf.ByteString
-        getIntanceIdentifierBytes();
-  }
-  /**
-   * Protobuf type {@code org.opendaylight.controller.mdsal.ReadData}
-   */
-  public static final class ReadData extends
-      com.google.protobuf.GeneratedMessage
-      implements ReadDataOrBuilder {
-    // Use ReadData.newBuilder() to construct.
-    private ReadData(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
-      super(builder);
-      this.unknownFields = builder.getUnknownFields();
-    }
-    private ReadData(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-    private static final ReadData defaultInstance;
-    public static ReadData getDefaultInstance() {
-      return defaultInstance;
-    }
-
-    public ReadData getDefaultInstanceForType() {
-      return defaultInstance;
-    }
-
-    private final com.google.protobuf.UnknownFieldSet unknownFields;
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-        getUnknownFields() {
-      return this.unknownFields;
-    }
-    private ReadData(
-        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;
-              intanceIdentifier_ = 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.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadData_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadData_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData.Builder.class);
-    }
-
-    public static com.google.protobuf.Parser<ReadData> PARSER =
-        new com.google.protobuf.AbstractParser<ReadData>() {
-      public ReadData parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return new ReadData(input, extensionRegistry);
-      }
-    };
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<ReadData> getParserForType() {
-      return PARSER;
-    }
-
-    private int bitField0_;
-    // required string intanceIdentifier = 1;
-    public static final int INTANCEIDENTIFIER_FIELD_NUMBER = 1;
-    private java.lang.Object intanceIdentifier_;
-    /**
-     * <code>required string intanceIdentifier = 1;</code>
-     */
-    public boolean hasIntanceIdentifier() {
-      return ((bitField0_ & 0x00000001) == 0x00000001);
-    }
-    /**
-     * <code>required string intanceIdentifier = 1;</code>
-     */
-    public java.lang.String getIntanceIdentifier() {
-      java.lang.Object ref = intanceIdentifier_;
-      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()) {
-          intanceIdentifier_ = s;
-        }
-        return s;
-      }
-    }
-    /**
-     * <code>required string intanceIdentifier = 1;</code>
-     */
-    public com.google.protobuf.ByteString
-        getIntanceIdentifierBytes() {
-      java.lang.Object ref = intanceIdentifier_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b =
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        intanceIdentifier_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    private void initFields() {
-      intanceIdentifier_ = "";
-    }
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
-
-      if (!hasIntanceIdentifier()) {
-        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, getIntanceIdentifierBytes());
-      }
-      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, getIntanceIdentifierBytes());
-      }
-      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.datastore.transaction.ShardTransactionMessages.ReadData parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData 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.datastore.transaction.ShardTransactionMessages.ReadData parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData 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.datastore.transaction.ShardTransactionMessages.ReadData parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData 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.datastore.transaction.ShardTransactionMessages.ReadData parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData 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.datastore.transaction.ShardTransactionMessages.ReadData 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.ReadData}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadDataOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadData_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadData_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData.Builder.class);
-      }
-
-      // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData.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();
-        intanceIdentifier_ = "";
-        bitField0_ = (bitField0_ & ~0x00000001);
-        return this;
-      }
-
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadData_descriptor;
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData.getDefaultInstance();
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData build() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData buildPartial() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData(this);
-        int from_bitField0_ = bitField0_;
-        int to_bitField0_ = 0;
-        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
-          to_bitField0_ |= 0x00000001;
-        }
-        result.intanceIdentifier_ = intanceIdentifier_;
-        result.bitField0_ = to_bitField0_;
-        onBuilt();
-        return result;
-      }
-
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData) {
-          return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData other) {
-        if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData.getDefaultInstance()) return this;
-        if (other.hasIntanceIdentifier()) {
-          bitField0_ |= 0x00000001;
-          intanceIdentifier_ = other.intanceIdentifier_;
-          onChanged();
-        }
-        this.mergeUnknownFields(other.getUnknownFields());
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        if (!hasIntanceIdentifier()) {
-          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.datastore.transaction.ShardTransactionMessages.ReadData parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData) e.getUnfinishedMessage();
-          throw e;
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-      private int bitField0_;
-
-      // required string intanceIdentifier = 1;
-      private java.lang.Object intanceIdentifier_ = "";
-      /**
-       * <code>required string intanceIdentifier = 1;</code>
-       */
-      public boolean hasIntanceIdentifier() {
-        return ((bitField0_ & 0x00000001) == 0x00000001);
-      }
-      /**
-       * <code>required string intanceIdentifier = 1;</code>
-       */
-      public java.lang.String getIntanceIdentifier() {
-        java.lang.Object ref = intanceIdentifier_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          intanceIdentifier_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>required string intanceIdentifier = 1;</code>
-       */
-      public com.google.protobuf.ByteString
-          getIntanceIdentifierBytes() {
-        java.lang.Object ref = intanceIdentifier_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b =
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          intanceIdentifier_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>required string intanceIdentifier = 1;</code>
-       */
-      public Builder setIntanceIdentifier(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-        intanceIdentifier_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required string intanceIdentifier = 1;</code>
-       */
-      public Builder clearIntanceIdentifier() {
-        bitField0_ = (bitField0_ & ~0x00000001);
-        intanceIdentifier_ = getDefaultInstance().getIntanceIdentifier();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>required string intanceIdentifier = 1;</code>
-       */
-      public Builder setIntanceIdentifierBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000001;
-        intanceIdentifier_ = value;
-        onChanged();
-        return this;
-      }
-
-      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.ReadData)
-    }
-
-    static {
-      defaultInstance = new ReadData(true);
-      defaultInstance.initFields();
-    }
-
-    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.ReadData)
-  }
-
-  private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_org_opendaylight_controller_mdsal_CloseTransaction_descriptor;
-  private static
-    com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_org_opendaylight_controller_mdsal_CloseTransaction_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_descriptor;
-  private static
-    com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_org_opendaylight_controller_mdsal_CreateTransaction_descriptor;
-  private static
-    com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_org_opendaylight_controller_mdsal_CreateTransaction_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor;
-  private static
-    com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_descriptor;
-  private static
-    com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_descriptor;
-  private static
-    com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_org_opendaylight_controller_mdsal_DeleteData_descriptor;
-  private static
-    com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_org_opendaylight_controller_mdsal_DeleteData_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_descriptor;
-  private static
-    com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_fieldAccessorTable;
-  private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_org_opendaylight_controller_mdsal_ReadData_descriptor;
-  private static
-    com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_org_opendaylight_controller_mdsal_ReadData_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\036ShardTransactionMessages.proto\022!org.op" +
-      "endaylight.controller.mdsal\"\022\n\020CloseTran" +
-      "saction\"\027\n\025CloseTransactionReply\"\023\n\021Crea" +
-      "teTransaction\"1\n\026CreateTransactionReply\022" +
-      "\027\n\017transactionPath\030\001 \002(\t\"\022\n\020ReadyTransac" +
-      "tion\"*\n\025ReadyTransactionReply\022\021\n\tactorPa" +
-      "th\030\001 \002(\t\",\n\nDeleteData\022\036\n\026instanceIdenti" +
-      "fierPath\030\001 \002(\t\"\021\n\017DeleteDataReply\"%\n\010Rea" +
-      "dData\022\031\n\021intanceIdentifier\030\001 \002(\tBU\n9org." +
-      "opendaylight.controller.cluster.datastor",
-      "e.transactionB\030ShardTransactionMessages"
-    };
-    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_CloseTransaction_descriptor =
-            getDescriptor().getMessageTypes().get(0);
-          internal_static_org_opendaylight_controller_mdsal_CloseTransaction_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_org_opendaylight_controller_mdsal_CloseTransaction_descriptor,
-              new java.lang.String[] { });
-          internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_descriptor =
-            getDescriptor().getMessageTypes().get(1);
-          internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_descriptor,
-              new java.lang.String[] { });
-          internal_static_org_opendaylight_controller_mdsal_CreateTransaction_descriptor =
-            getDescriptor().getMessageTypes().get(2);
-          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[] { });
-          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", });
-          internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_descriptor =
-            getDescriptor().getMessageTypes().get(4);
-          internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_descriptor,
-              new java.lang.String[] { });
-          internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_descriptor =
-            getDescriptor().getMessageTypes().get(5);
-          internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_descriptor,
-              new java.lang.String[] { "ActorPath", });
-          internal_static_org_opendaylight_controller_mdsal_DeleteData_descriptor =
-            getDescriptor().getMessageTypes().get(6);
-          internal_static_org_opendaylight_controller_mdsal_DeleteData_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_org_opendaylight_controller_mdsal_DeleteData_descriptor,
-              new java.lang.String[] { "InstanceIdentifierPath", });
-          internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_descriptor =
-            getDescriptor().getMessageTypes().get(7);
-          internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_descriptor,
-              new java.lang.String[] { });
-          internal_static_org_opendaylight_controller_mdsal_ReadData_descriptor =
-            getDescriptor().getMessageTypes().get(8);
-          internal_static_org_opendaylight_controller_mdsal_ReadData_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_org_opendaylight_controller_mdsal_ReadData_descriptor,
-              new java.lang.String[] { "IntanceIdentifier", });
-          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/cluster/datastore/util/EncoderDecoderUtil.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/util/EncoderDecoderUtil.java
new file mode 100644 (file)
index 0000000..41eb2e6
--- /dev/null
@@ -0,0 +1,190 @@
+package org.opendaylight.controller.cluster.datastore.util;
+
+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.ContainerNode;
+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.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.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+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.StringWriter;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+/*
+ * 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
+ */
+/*
+ *
+ * <code>EncoderDecoderUtil</code> helps in wrapping the NormalizedNode into a SimpleNormalizedNode
+ * protobuf message containing the XML representation of the NormalizeNode
+ *
+ * @author: syedbahm
+ */
+public class EncoderDecoderUtil {
+  static DocumentBuilderFactory factory;
+  static {
+    factory = DocumentBuilderFactory.newInstance();
+    factory.setNamespaceAware(true);
+    factory.setCoalescing(true);
+    factory.setIgnoringElementContentWhitespace(true);
+    factory.setIgnoringComments(true);
+  }
+
+  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());
+      }
+    }
+
+    for (DataNodeContainer container : containers) {
+      DataSchemaNode retVal = findChildNode(container.getChildNodes(), name);
+      if (retVal != null) {
+        return retVal;
+      }
+    }
+
+    return null;
+  }
+
+  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()) {
+
+        DataSchemaNode found =
+            findChildNode(module.getChildNodes(), qname.getLocalName());
+        return found;
+      }
+    }
+    return null;
+  }
+
+  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);
+    }
+  }
+
+  /**
+   * 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();
+
+  }
+
+  /**
+   * 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;
+
+  }
+
+
+
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/common/SimpleNormalizedNodeMessage.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/common/SimpleNormalizedNodeMessage.java
new file mode 100644 (file)
index 0000000..67ab472
--- /dev/null
@@ -0,0 +1,696 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: SimpleNormalizedNode.proto
+
+package org.opendaylight.controller.protobuff.messages.common;
+
+public final class SimpleNormalizedNodeMessage {
+  private SimpleNormalizedNodeMessage() {}
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistry registry) {
+  }
+  public interface NormalizedNodeXmlOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required string nodeIdentifier = 1;
+    /**
+     * <code>required string nodeIdentifier = 1;</code>
+     */
+    boolean hasNodeIdentifier();
+    /**
+     * <code>required string nodeIdentifier = 1;</code>
+     */
+    java.lang.String getNodeIdentifier();
+    /**
+     * <code>required string nodeIdentifier = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getNodeIdentifierBytes();
+
+    // required string xmlString = 2;
+    /**
+     * <code>required string xmlString = 2;</code>
+     */
+    boolean hasXmlString();
+    /**
+     * <code>required string xmlString = 2;</code>
+     */
+    java.lang.String getXmlString();
+    /**
+     * <code>required string xmlString = 2;</code>
+     */
+    com.google.protobuf.ByteString
+        getXmlStringBytes();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.NormalizedNodeXml}
+   */
+  public static final class NormalizedNodeXml extends
+      com.google.protobuf.GeneratedMessage
+      implements NormalizedNodeXmlOrBuilder {
+    // Use NormalizedNodeXml.newBuilder() to construct.
+    private NormalizedNodeXml(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private NormalizedNodeXml(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final NormalizedNodeXml defaultInstance;
+    public static NormalizedNodeXml getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public NormalizedNodeXml getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private NormalizedNodeXml(
+        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;
+              nodeIdentifier_ = input.readBytes();
+              break;
+            }
+            case 18: {
+              bitField0_ |= 0x00000002;
+              xmlString_ = 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.SimpleNormalizedNodeMessage.internal_static_org_opendaylight_controller_mdsal_NormalizedNodeXml_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.internal_static_org_opendaylight_controller_mdsal_NormalizedNodeXml_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.class, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<NormalizedNodeXml> PARSER =
+        new com.google.protobuf.AbstractParser<NormalizedNodeXml>() {
+      public NormalizedNodeXml parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new NormalizedNodeXml(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<NormalizedNodeXml> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required string nodeIdentifier = 1;
+    public static final int NODEIDENTIFIER_FIELD_NUMBER = 1;
+    private java.lang.Object nodeIdentifier_;
+    /**
+     * <code>required string nodeIdentifier = 1;</code>
+     */
+    public boolean hasNodeIdentifier() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required string nodeIdentifier = 1;</code>
+     */
+    public java.lang.String getNodeIdentifier() {
+      java.lang.Object ref = nodeIdentifier_;
+      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()) {
+          nodeIdentifier_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string nodeIdentifier = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getNodeIdentifierBytes() {
+      java.lang.Object ref = nodeIdentifier_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b =
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        nodeIdentifier_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // required string xmlString = 2;
+    public static final int XMLSTRING_FIELD_NUMBER = 2;
+    private java.lang.Object xmlString_;
+    /**
+     * <code>required string xmlString = 2;</code>
+     */
+    public boolean hasXmlString() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>required string xmlString = 2;</code>
+     */
+    public java.lang.String getXmlString() {
+      java.lang.Object ref = xmlString_;
+      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()) {
+          xmlString_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string xmlString = 2;</code>
+     */
+    public com.google.protobuf.ByteString
+        getXmlStringBytes() {
+      java.lang.Object ref = xmlString_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b =
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        xmlString_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    private void initFields() {
+      nodeIdentifier_ = "";
+      xmlString_ = "";
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasNodeIdentifier()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (!hasXmlString()) {
+        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, getNodeIdentifierBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeBytes(2, getXmlStringBytes());
+      }
+      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, getNodeIdentifierBytes());
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(2, getXmlStringBytes());
+      }
+      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.SimpleNormalizedNodeMessage.NormalizedNodeXml parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml 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.SimpleNormalizedNodeMessage.NormalizedNodeXml parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml 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.SimpleNormalizedNodeMessage.NormalizedNodeXml parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml 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.SimpleNormalizedNodeMessage.NormalizedNodeXml parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml 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.SimpleNormalizedNodeMessage.NormalizedNodeXml parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml 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.SimpleNormalizedNodeMessage.NormalizedNodeXml 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.NormalizedNodeXml}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.internal_static_org_opendaylight_controller_mdsal_NormalizedNodeXml_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.internal_static_org_opendaylight_controller_mdsal_NormalizedNodeXml_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.class, org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.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();
+        nodeIdentifier_ = "";
+        bitField0_ = (bitField0_ & ~0x00000001);
+        xmlString_ = "";
+        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.SimpleNormalizedNodeMessage.internal_static_org_opendaylight_controller_mdsal_NormalizedNodeXml_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml build() {
+        org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml buildPartial() {
+        org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml result = new org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.nodeIdentifier_ = nodeIdentifier_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.xmlString_ = xmlString_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml other) {
+        if (other == org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance()) return this;
+        if (other.hasNodeIdentifier()) {
+          bitField0_ |= 0x00000001;
+          nodeIdentifier_ = other.nodeIdentifier_;
+          onChanged();
+        }
+        if (other.hasXmlString()) {
+          bitField0_ |= 0x00000002;
+          xmlString_ = other.xmlString_;
+          onChanged();
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasNodeIdentifier()) {
+
+          return false;
+        }
+        if (!hasXmlString()) {
+
+          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.SimpleNormalizedNodeMessage.NormalizedNodeXml parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required string nodeIdentifier = 1;
+      private java.lang.Object nodeIdentifier_ = "";
+      /**
+       * <code>required string nodeIdentifier = 1;</code>
+       */
+      public boolean hasNodeIdentifier() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required string nodeIdentifier = 1;</code>
+       */
+      public java.lang.String getNodeIdentifier() {
+        java.lang.Object ref = nodeIdentifier_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          nodeIdentifier_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string nodeIdentifier = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getNodeIdentifierBytes() {
+        java.lang.Object ref = nodeIdentifier_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b =
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          nodeIdentifier_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string nodeIdentifier = 1;</code>
+       */
+      public Builder setNodeIdentifier(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        nodeIdentifier_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string nodeIdentifier = 1;</code>
+       */
+      public Builder clearNodeIdentifier() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        nodeIdentifier_ = getDefaultInstance().getNodeIdentifier();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string nodeIdentifier = 1;</code>
+       */
+      public Builder setNodeIdentifierBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        nodeIdentifier_ = value;
+        onChanged();
+        return this;
+      }
+
+      // required string xmlString = 2;
+      private java.lang.Object xmlString_ = "";
+      /**
+       * <code>required string xmlString = 2;</code>
+       */
+      public boolean hasXmlString() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>required string xmlString = 2;</code>
+       */
+      public java.lang.String getXmlString() {
+        java.lang.Object ref = xmlString_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          xmlString_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string xmlString = 2;</code>
+       */
+      public com.google.protobuf.ByteString
+          getXmlStringBytes() {
+        java.lang.Object ref = xmlString_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b =
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          xmlString_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string xmlString = 2;</code>
+       */
+      public Builder setXmlString(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        xmlString_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string xmlString = 2;</code>
+       */
+      public Builder clearXmlString() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        xmlString_ = getDefaultInstance().getXmlString();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string xmlString = 2;</code>
+       */
+      public Builder setXmlStringBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        xmlString_ = value;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.NormalizedNodeXml)
+    }
+
+    static {
+      defaultInstance = new NormalizedNodeXml(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.NormalizedNodeXml)
+  }
+
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_NormalizedNodeXml_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_NormalizedNodeXml_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\032SimpleNormalizedNode.proto\022!org.openda" +
+      "ylight.controller.mdsal\">\n\021NormalizedNod" +
+      "eXml\022\026\n\016nodeIdentifier\030\001 \002(\t\022\021\n\txmlStrin" +
+      "g\030\002 \002(\tBT\n5org.opendaylight.controller.p" +
+      "rotobuff.messages.commonB\033SimpleNormaliz" +
+      "edNodeMessage"
+    };
+    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_NormalizedNodeXml_descriptor =
+            getDescriptor().getMessageTypes().get(0);
+          internal_static_org_opendaylight_controller_mdsal_NormalizedNodeXml_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_NormalizedNodeXml_descriptor,
+              new java.lang.String[] { "NodeIdentifier", "XmlString", });
+          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/datachange/notification/DataChangeListenerMessages.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/datachange/notification/DataChangeListenerMessages.java
new file mode 100644 (file)
index 0000000..391107e
--- /dev/null
@@ -0,0 +1,1085 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: DataChangeListener.proto
+
+package org.opendaylight.controller.protobuff.messages.datachange.notification;
+
+public final class DataChangeListenerMessages {
+  private DataChangeListenerMessages() {}
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistry registry) {
+  }
+  public interface DataChangedOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // repeated string instanceIdentifierPathArguments = 1;
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    java.util.List<java.lang.String>
+    getInstanceIdentifierPathArgumentsList();
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    int getInstanceIdentifierPathArgumentsCount();
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    java.lang.String getInstanceIdentifierPathArguments(int index);
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getInstanceIdentifierPathArgumentsBytes(int index);
+
+    // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+     */
+    boolean hasNormalizedNodeXml();
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNodeXml();
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeXmlOrBuilder();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.DataChanged}
+   */
+  public static final class DataChanged extends
+      com.google.protobuf.GeneratedMessage
+      implements DataChangedOrBuilder {
+    // Use DataChanged.newBuilder() to construct.
+    private DataChanged(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private DataChanged(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final DataChanged defaultInstance;
+    public static DataChanged getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public DataChanged getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private DataChanged(
+        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)) {
+                instanceIdentifierPathArguments_ = new com.google.protobuf.LazyStringArrayList();
+                mutable_bitField0_ |= 0x00000001;
+              }
+              instanceIdentifierPathArguments_.add(input.readBytes());
+              break;
+            }
+            case 18: {
+              org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000001) == 0x00000001)) {
+                subBuilder = normalizedNodeXml_.toBuilder();
+              }
+              normalizedNodeXml_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(normalizedNodeXml_);
+                normalizedNodeXml_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000001;
+              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)) {
+          instanceIdentifierPathArguments_ = new com.google.protobuf.UnmodifiableLazyStringList(instanceIdentifierPathArguments_);
+        }
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.internal_static_org_opendaylight_controller_mdsal_DataChanged_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.internal_static_org_opendaylight_controller_mdsal_DataChanged_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged.class, org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<DataChanged> PARSER =
+        new com.google.protobuf.AbstractParser<DataChanged>() {
+      public DataChanged parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new DataChanged(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<DataChanged> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // repeated string 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_;
+    }
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    public int getInstanceIdentifierPathArgumentsCount() {
+      return instanceIdentifierPathArguments_.size();
+    }
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    public java.lang.String getInstanceIdentifierPathArguments(int index) {
+      return instanceIdentifierPathArguments_.get(index);
+    }
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getInstanceIdentifierPathArgumentsBytes(int index) {
+      return instanceIdentifierPathArguments_.getByteString(index);
+    }
+
+    // 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_;
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+     */
+    public boolean hasNormalizedNodeXml() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNodeXml() {
+      return normalizedNodeXml_;
+    }
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeXmlOrBuilder() {
+      return normalizedNodeXml_;
+    }
+
+    private void initFields() {
+      instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+      normalizedNodeXml_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasNormalizedNodeXml()) {
+        memoizedIsInitialized = 0;
+        return false;
+      }
+      if (!getNormalizedNodeXml().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 < instanceIdentifierPathArguments_.size(); i++) {
+        output.writeBytes(1, instanceIdentifierPathArguments_.getByteString(i));
+      }
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeMessage(2, normalizedNodeXml_);
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      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_);
+      }
+      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.datachange.notification.DataChangeListenerMessages.DataChanged parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged 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.datachange.notification.DataChangeListenerMessages.DataChanged parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged 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.datachange.notification.DataChangeListenerMessages.DataChanged parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged 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.datachange.notification.DataChangeListenerMessages.DataChanged parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged 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.datachange.notification.DataChangeListenerMessages.DataChanged parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged 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.datachange.notification.DataChangeListenerMessages.DataChanged 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.DataChanged}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.internal_static_org_opendaylight_controller_mdsal_DataChanged_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.internal_static_org_opendaylight_controller_mdsal_DataChanged_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged.class, org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getNormalizedNodeXmlFieldBuilder();
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+        bitField0_ = (bitField0_ & ~0x00000001);
+        if (normalizedNodeXmlBuilder_ == null) {
+          normalizedNodeXml_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+        } else {
+          normalizedNodeXmlBuilder_.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.datachange.notification.DataChangeListenerMessages.internal_static_org_opendaylight_controller_mdsal_DataChanged_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged build() {
+        org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged buildPartial() {
+        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);
+        }
+        result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        if (normalizedNodeXmlBuilder_ == null) {
+          result.normalizedNodeXml_ = normalizedNodeXml_;
+        } else {
+          result.normalizedNodeXml_ = normalizedNodeXmlBuilder_.build();
+        }
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      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.hasNormalizedNodeXml()) {
+          mergeNormalizedNodeXml(other.getNormalizedNodeXml());
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasNormalizedNodeXml()) {
+
+          return false;
+        }
+        if (!getNormalizedNodeXml().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.datachange.notification.DataChangeListenerMessages.DataChanged parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      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;
+         }
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public java.util.List<java.lang.String>
+          getInstanceIdentifierPathArgumentsList() {
+        return java.util.Collections.unmodifiableList(instanceIdentifierPathArguments_);
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public int getInstanceIdentifierPathArgumentsCount() {
+        return instanceIdentifierPathArguments_.size();
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public java.lang.String getInstanceIdentifierPathArguments(int index) {
+        return instanceIdentifierPathArguments_.get(index);
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getInstanceIdentifierPathArgumentsBytes(int index) {
+        return instanceIdentifierPathArguments_.getByteString(index);
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder setInstanceIdentifierPathArguments(
+          int index, java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  ensureInstanceIdentifierPathArgumentsIsMutable();
+        instanceIdentifierPathArguments_.set(index, value);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder addInstanceIdentifierPathArguments(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  ensureInstanceIdentifierPathArgumentsIsMutable();
+        instanceIdentifierPathArguments_.add(value);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder addAllInstanceIdentifierPathArguments(
+          java.lang.Iterable<java.lang.String> values) {
+        ensureInstanceIdentifierPathArgumentsIsMutable();
+        super.addAll(values, instanceIdentifierPathArguments_);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder clearInstanceIdentifierPathArguments() {
+        instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+        bitField0_ = (bitField0_ & ~0x00000001);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder addInstanceIdentifierPathArgumentsBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  ensureInstanceIdentifierPathArgumentsIsMutable();
+        instanceIdentifierPathArguments_.add(value);
+        onChanged();
+        return this;
+      }
+
+      // 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();
+      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_;
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+       */
+      public boolean hasNormalizedNodeXml() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNodeXml() {
+        if (normalizedNodeXmlBuilder_ == null) {
+          return normalizedNodeXml_;
+        } else {
+          return normalizedNodeXmlBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+       */
+      public Builder setNormalizedNodeXml(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml value) {
+        if (normalizedNodeXmlBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          normalizedNodeXml_ = value;
+          onChanged();
+        } else {
+          normalizedNodeXmlBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000002;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+       */
+      public Builder setNormalizedNodeXml(
+          org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder builderForValue) {
+        if (normalizedNodeXmlBuilder_ == null) {
+          normalizedNodeXml_ = builderForValue.build();
+          onChanged();
+        } else {
+          normalizedNodeXmlBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000002;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+       */
+      public Builder mergeNormalizedNodeXml(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml value) {
+        if (normalizedNodeXmlBuilder_ == 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();
+          } else {
+            normalizedNodeXml_ = value;
+          }
+          onChanged();
+        } else {
+          normalizedNodeXmlBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000002;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+       */
+      public Builder clearNormalizedNodeXml() {
+        if (normalizedNodeXmlBuilder_ == null) {
+          normalizedNodeXml_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+          onChanged();
+        } else {
+          normalizedNodeXmlBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000002);
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder getNormalizedNodeXmlBuilder() {
+        bitField0_ |= 0x00000002;
+        onChanged();
+        return getNormalizedNodeXmlFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 2;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeXmlOrBuilder() {
+        if (normalizedNodeXmlBuilder_ != null) {
+          return normalizedNodeXmlBuilder_.getMessageOrBuilder();
+        } else {
+          return normalizedNodeXml_;
+        }
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNodeXml = 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_,
+                  getParentForChildren(),
+                  isClean());
+          normalizedNodeXml_ = null;
+        }
+        return normalizedNodeXmlBuilder_;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.DataChanged)
+    }
+
+    static {
+      defaultInstance = new DataChanged(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.DataChanged)
+  }
+
+  public interface DataChangedReplyOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.DataChangedReply}
+   */
+  public static final class DataChangedReply extends
+      com.google.protobuf.GeneratedMessage
+      implements DataChangedReplyOrBuilder {
+    // Use DataChangedReply.newBuilder() to construct.
+    private DataChangedReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private DataChangedReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final DataChangedReply defaultInstance;
+    public static DataChangedReply getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public DataChangedReply getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private DataChangedReply(
+        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.datachange.notification.DataChangeListenerMessages.internal_static_org_opendaylight_controller_mdsal_DataChangedReply_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.internal_static_org_opendaylight_controller_mdsal_DataChangedReply_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply.class, org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<DataChangedReply> PARSER =
+        new com.google.protobuf.AbstractParser<DataChangedReply>() {
+      public DataChangedReply parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new DataChangedReply(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<DataChangedReply> 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.datachange.notification.DataChangeListenerMessages.DataChangedReply parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply 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.datachange.notification.DataChangeListenerMessages.DataChangedReply parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply 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.datachange.notification.DataChangeListenerMessages.DataChangedReply parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply 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.datachange.notification.DataChangeListenerMessages.DataChangedReply parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply 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.datachange.notification.DataChangeListenerMessages.DataChangedReply parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply 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.datachange.notification.DataChangeListenerMessages.DataChangedReply 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.DataChangedReply}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReplyOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.internal_static_org_opendaylight_controller_mdsal_DataChangedReply_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.internal_static_org_opendaylight_controller_mdsal_DataChangedReply_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply.class, org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply.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.datachange.notification.DataChangeListenerMessages.internal_static_org_opendaylight_controller_mdsal_DataChangedReply_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply build() {
+        org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply buildPartial() {
+        org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply result = new org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply(this);
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply other) {
+        if (other == org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply.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.datachange.notification.DataChangeListenerMessages.DataChangedReply parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChangedReply) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.DataChangedReply)
+    }
+
+    static {
+      defaultInstance = new DataChangedReply(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.DataChangedReply)
+  }
+
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_DataChanged_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_DataChanged_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_DataChangedReply_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_DataChangedReply_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\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"
+    };
+    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_DataChanged_descriptor =
+            getDescriptor().getMessageTypes().get(0);
+          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", });
+          internal_static_org_opendaylight_controller_mdsal_DataChangedReply_descriptor =
+            getDescriptor().getMessageTypes().get(1);
+          internal_static_org_opendaylight_controller_mdsal_DataChangedReply_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_DataChangedReply_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(),
+        }, assigner);
+  }
+
+  // @@protoc_insertion_point(outer_class_scope)
+}
@@ -1,7 +1,7 @@
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: ListenerRegistration.proto
 
-package org.opendaylight.controller.cluster.datastore.registration;
+package org.opendaylight.controller.protobuff.messages.registration;
 
 public final class ListenerRegistrationMessages {
   private ListenerRegistrationMessages() {}
@@ -75,14 +75,14 @@ public final class ListenerRegistrationMessages {
     }
     public static final com.google.protobuf.Descriptors.Descriptor
         getDescriptor() {
-      return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_descriptor;
+      return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_descriptor;
     }
 
     protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
         internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_fieldAccessorTable
+      return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_fieldAccessorTable
           .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close.class, org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close.Builder.class);
+              org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.Builder.class);
     }
 
     public static com.google.protobuf.Parser<Close> PARSER =
@@ -135,53 +135,53 @@ public final class ListenerRegistrationMessages {
       return super.writeReplace();
     }
 
-    public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(
         com.google.protobuf.ByteString data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close 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.datastore.registration.ListenerRegistrationMessages.Close parseFrom(byte[] data)
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(byte[] data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(
         byte[] data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data, extensionRegistry);
     }
-    public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parseFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close 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.datastore.registration.ListenerRegistrationMessages.Close parseDelimitedFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseDelimitedFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseDelimitedFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parseDelimitedFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close 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.datastore.registration.ListenerRegistrationMessages.Close parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(
         com.google.protobuf.CodedInputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parseFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
@@ -190,7 +190,7 @@ public final class ListenerRegistrationMessages {
 
     public static Builder newBuilder() { return Builder.create(); }
     public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close prototype) {
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close prototype) {
       return newBuilder().mergeFrom(prototype);
     }
     public Builder toBuilder() { return newBuilder(this); }
@@ -206,20 +206,20 @@ public final class ListenerRegistrationMessages {
      */
     public static final class Builder extends
         com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseOrBuilder {
+       implements org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
-        return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_descriptor;
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_descriptor;
       }
 
       protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
           internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_fieldAccessorTable
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_fieldAccessorTable
             .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close.class, org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close.Builder.class);
+                org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.Builder.class);
       }
 
-      // Construct using org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close.newBuilder()
+      // Construct using org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.newBuilder()
       private Builder() {
         maybeForceBuilderInitialization();
       }
@@ -248,38 +248,38 @@ public final class ListenerRegistrationMessages {
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
-        return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_descriptor;
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_descriptor;
       }
 
-      public org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close.getDefaultInstance();
+      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close.getDefaultInstance();
       }
 
-      public org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close build() {
-        org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close result = buildPartial();
+      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close build() {
+        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close result = buildPartial();
         if (!result.isInitialized()) {
           throw newUninitializedMessageException(result);
         }
         return result;
       }
 
-      public org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close buildPartial() {
-        org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close result = new org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close(this);
+      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);
         onBuilt();
         return result;
       }
 
       public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close) {
-          return mergeFrom((org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close)other);
+        if (other instanceof org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close)other);
         } else {
           super.mergeFrom(other);
           return this;
         }
       }
 
-      public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close other) {
-        if (other == org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close.getDefaultInstance()) 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;
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
@@ -292,11 +292,11 @@ public final class ListenerRegistrationMessages {
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
-        org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parsedMessage = null;
+        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close parsedMessage = null;
         try {
           parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
         } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close) e.getUnfinishedMessage();
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.Close) e.getUnfinishedMessage();
           throw e;
         } finally {
           if (parsedMessage != null) {
@@ -384,14 +384,14 @@ public final class ListenerRegistrationMessages {
     }
     public static final com.google.protobuf.Descriptors.Descriptor
         getDescriptor() {
-      return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor;
+      return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor;
     }
 
     protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
         internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_fieldAccessorTable
+      return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_fieldAccessorTable
           .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply.class, org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply.Builder.class);
+              org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.Builder.class);
     }
 
     public static com.google.protobuf.Parser<CloseReply> PARSER =
@@ -444,53 +444,53 @@ public final class ListenerRegistrationMessages {
       return super.writeReplace();
     }
 
-    public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(
         com.google.protobuf.ByteString data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply 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.datastore.registration.ListenerRegistrationMessages.CloseReply parseFrom(byte[] data)
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(byte[] data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(
         byte[] data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data, extensionRegistry);
     }
-    public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parseFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply 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.datastore.registration.ListenerRegistrationMessages.CloseReply parseDelimitedFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseDelimitedFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseDelimitedFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parseDelimitedFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply 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.datastore.registration.ListenerRegistrationMessages.CloseReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(
         com.google.protobuf.CodedInputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parseFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
@@ -499,7 +499,7 @@ public final class ListenerRegistrationMessages {
 
     public static Builder newBuilder() { return Builder.create(); }
     public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply prototype) {
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply prototype) {
       return newBuilder().mergeFrom(prototype);
     }
     public Builder toBuilder() { return newBuilder(this); }
@@ -515,20 +515,20 @@ public final class ListenerRegistrationMessages {
      */
     public static final class Builder extends
         com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReplyOrBuilder {
+       implements org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReplyOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
-        return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor;
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor;
       }
 
       protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
           internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_fieldAccessorTable
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_fieldAccessorTable
             .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply.class, org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply.Builder.class);
+                org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.class, org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.Builder.class);
       }
 
-      // Construct using org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply.newBuilder()
+      // Construct using org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.newBuilder()
       private Builder() {
         maybeForceBuilderInitialization();
       }
@@ -557,38 +557,38 @@ public final class ListenerRegistrationMessages {
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
-        return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor;
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor;
       }
 
-      public org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply.getDefaultInstance();
+      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply.getDefaultInstance();
       }
 
-      public org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply build() {
-        org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply result = buildPartial();
+      public org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply build() {
+        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply result = buildPartial();
         if (!result.isInitialized()) {
           throw newUninitializedMessageException(result);
         }
         return result;
       }
 
-      public org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply buildPartial() {
-        org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply result = new org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply(this);
+      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);
         onBuilt();
         return result;
       }
 
       public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply) {
-          return mergeFrom((org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply)other);
+        if (other instanceof org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply)other);
         } else {
           super.mergeFrom(other);
           return this;
         }
       }
 
-      public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply other) {
-        if (other == org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply.getDefaultInstance()) 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;
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
@@ -601,11 +601,11 @@ public final class ListenerRegistrationMessages {
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
-        org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parsedMessage = null;
+        org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply parsedMessage = null;
         try {
           parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
         } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply) e.getUnfinishedMessage();
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.CloseReply) e.getUnfinishedMessage();
           throw e;
         } finally {
           if (parsedMessage != null) {
@@ -647,9 +647,9 @@ public final class ListenerRegistrationMessages {
     java.lang.String[] descriptorData = {
       "\n\032ListenerRegistration.proto\022!org.openda" +
       "ylight.controller.mdsal\"\007\n\005Close\"\014\n\nClos" +
-      "eReplyBZ\n:org.opendaylight.controller.cl" +
-      "uster.datastore.registrationB\034ListenerRe" +
-      "gistrationMessages"
+      "eReplyB[\n;org.opendaylight.controller.pr" +
+      "otobuff.messages.registrationB\034ListenerR" +
+      "egistrationMessages"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -1,7 +1,7 @@
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: ShardManager.proto
 
-package org.opendaylight.controller.cluster.datastore.shard;
+package org.opendaylight.controller.protobuff.messages.shard;
 
 public final class ShardManagerMessages {
   private ShardManagerMessages() {}
@@ -96,14 +96,14 @@ public final class ShardManagerMessages {
     }
     public static final com.google.protobuf.Descriptors.Descriptor
         getDescriptor() {
-      return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_FindPrimary_descriptor;
+      return org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_FindPrimary_descriptor;
     }
 
     protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
         internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_FindPrimary_fieldAccessorTable
+      return org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_FindPrimary_fieldAccessorTable
           .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary.class, org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary.Builder.class);
+              org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary.class, org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary.Builder.class);
     }
 
     public static com.google.protobuf.Parser<FindPrimary> PARSER =
@@ -212,53 +212,53 @@ public final class ShardManagerMessages {
       return super.writeReplace();
     }
 
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary parseFrom(
         com.google.protobuf.ByteString data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary 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.datastore.shard.ShardManagerMessages.FindPrimary parseFrom(byte[] data)
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary parseFrom(byte[] data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary parseFrom(
         byte[] data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data, extensionRegistry);
     }
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parseFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary parseFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary 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.datastore.shard.ShardManagerMessages.FindPrimary parseDelimitedFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary parseDelimitedFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseDelimitedFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parseDelimitedFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary 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.datastore.shard.ShardManagerMessages.FindPrimary parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary parseFrom(
         com.google.protobuf.CodedInputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary parseFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
@@ -267,7 +267,7 @@ public final class ShardManagerMessages {
 
     public static Builder newBuilder() { return Builder.create(); }
     public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary prototype) {
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary prototype) {
       return newBuilder().mergeFrom(prototype);
     }
     public Builder toBuilder() { return newBuilder(this); }
@@ -283,20 +283,20 @@ public final class ShardManagerMessages {
      */
     public static final class Builder extends
         com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimaryOrBuilder {
+       implements org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimaryOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
-        return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_FindPrimary_descriptor;
+        return org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_FindPrimary_descriptor;
       }
 
       protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
           internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_FindPrimary_fieldAccessorTable
+        return org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_FindPrimary_fieldAccessorTable
             .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary.class, org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary.Builder.class);
+                org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary.class, org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary.Builder.class);
       }
 
-      // Construct using org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary.newBuilder()
+      // Construct using org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary.newBuilder()
       private Builder() {
         maybeForceBuilderInitialization();
       }
@@ -327,23 +327,23 @@ public final class ShardManagerMessages {
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
-        return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_FindPrimary_descriptor;
+        return org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_FindPrimary_descriptor;
       }
 
-      public org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary.getDefaultInstance();
+      public org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary.getDefaultInstance();
       }
 
-      public org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary build() {
-        org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary result = buildPartial();
+      public org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary build() {
+        org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary result = buildPartial();
         if (!result.isInitialized()) {
           throw newUninitializedMessageException(result);
         }
         return result;
       }
 
-      public org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary buildPartial() {
-        org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary result = new org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary(this);
+      public org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary buildPartial() {
+        org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary result = new org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary(this);
         int from_bitField0_ = bitField0_;
         int to_bitField0_ = 0;
         if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
@@ -356,16 +356,16 @@ public final class ShardManagerMessages {
       }
 
       public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary) {
-          return mergeFrom((org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary)other);
+        if (other instanceof org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary)other);
         } else {
           super.mergeFrom(other);
           return this;
         }
       }
 
-      public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary other) {
-        if (other == org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary.getDefaultInstance()) return this;
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary other) {
+        if (other == org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary.getDefaultInstance()) return this;
         if (other.hasShardName()) {
           bitField0_ |= 0x00000001;
           shardName_ = other.shardName_;
@@ -387,11 +387,11 @@ public final class ShardManagerMessages {
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
-        org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parsedMessage = null;
+        org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary parsedMessage = null;
         try {
           parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
         } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary) e.getUnfinishedMessage();
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.FindPrimary) e.getUnfinishedMessage();
           throw e;
         } finally {
           if (parsedMessage != null) {
@@ -554,14 +554,14 @@ public final class ShardManagerMessages {
     }
     public static final com.google.protobuf.Descriptors.Descriptor
         getDescriptor() {
-      return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryFound_descriptor;
+      return org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryFound_descriptor;
     }
 
     protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
         internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryFound_fieldAccessorTable
+      return org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryFound_fieldAccessorTable
           .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound.class, org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound.Builder.class);
+              org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound.class, org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound.Builder.class);
     }
 
     public static com.google.protobuf.Parser<PrimaryFound> PARSER =
@@ -614,53 +614,53 @@ public final class ShardManagerMessages {
       return super.writeReplace();
     }
 
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound parseFrom(
         com.google.protobuf.ByteString data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound 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.datastore.shard.ShardManagerMessages.PrimaryFound parseFrom(byte[] data)
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound parseFrom(byte[] data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound parseFrom(
         byte[] data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data, extensionRegistry);
     }
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parseFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound parseFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound 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.datastore.shard.ShardManagerMessages.PrimaryFound parseDelimitedFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound parseDelimitedFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseDelimitedFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parseDelimitedFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound 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.datastore.shard.ShardManagerMessages.PrimaryFound parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound parseFrom(
         com.google.protobuf.CodedInputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound parseFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
@@ -669,7 +669,7 @@ public final class ShardManagerMessages {
 
     public static Builder newBuilder() { return Builder.create(); }
     public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound prototype) {
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound prototype) {
       return newBuilder().mergeFrom(prototype);
     }
     public Builder toBuilder() { return newBuilder(this); }
@@ -685,20 +685,20 @@ public final class ShardManagerMessages {
      */
     public static final class Builder extends
         com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFoundOrBuilder {
+       implements org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFoundOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
-        return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryFound_descriptor;
+        return org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryFound_descriptor;
       }
 
       protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
           internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryFound_fieldAccessorTable
+        return org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryFound_fieldAccessorTable
             .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound.class, org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound.Builder.class);
+                org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound.class, org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound.Builder.class);
       }
 
-      // Construct using org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound.newBuilder()
+      // Construct using org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound.newBuilder()
       private Builder() {
         maybeForceBuilderInitialization();
       }
@@ -727,38 +727,38 @@ public final class ShardManagerMessages {
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
-        return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryFound_descriptor;
+        return org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryFound_descriptor;
       }
 
-      public org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound.getDefaultInstance();
+      public org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound.getDefaultInstance();
       }
 
-      public org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound build() {
-        org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound result = buildPartial();
+      public org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound build() {
+        org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound result = buildPartial();
         if (!result.isInitialized()) {
           throw newUninitializedMessageException(result);
         }
         return result;
       }
 
-      public org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound buildPartial() {
-        org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound result = new org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound(this);
+      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);
         onBuilt();
         return result;
       }
 
       public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound) {
-          return mergeFrom((org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound)other);
+        if (other instanceof org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound)other);
         } else {
           super.mergeFrom(other);
           return this;
         }
       }
 
-      public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound other) {
-        if (other == org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound.getDefaultInstance()) return this;
+      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;
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
@@ -771,11 +771,11 @@ public final class ShardManagerMessages {
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
-        org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parsedMessage = null;
+        org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound parsedMessage = null;
         try {
           parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
         } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound) e.getUnfinishedMessage();
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound) e.getUnfinishedMessage();
           throw e;
         } finally {
           if (parsedMessage != null) {
@@ -863,14 +863,14 @@ public final class ShardManagerMessages {
     }
     public static final com.google.protobuf.Descriptors.Descriptor
         getDescriptor() {
-      return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_descriptor;
+      return org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_descriptor;
     }
 
     protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
         internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_fieldAccessorTable
+      return org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_fieldAccessorTable
           .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound.class, org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound.Builder.class);
+              org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound.class, org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound.Builder.class);
     }
 
     public static com.google.protobuf.Parser<PrimaryNotFound> PARSER =
@@ -923,53 +923,53 @@ public final class ShardManagerMessages {
       return super.writeReplace();
     }
 
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound parseFrom(
         com.google.protobuf.ByteString data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound 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.datastore.shard.ShardManagerMessages.PrimaryNotFound parseFrom(byte[] data)
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound parseFrom(byte[] data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound parseFrom(
         byte[] data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data, extensionRegistry);
     }
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parseFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound parseFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound 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.datastore.shard.ShardManagerMessages.PrimaryNotFound parseDelimitedFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound parseDelimitedFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseDelimitedFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parseDelimitedFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound 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.datastore.shard.ShardManagerMessages.PrimaryNotFound parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound parseFrom(
         com.google.protobuf.CodedInputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound parseFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
@@ -978,7 +978,7 @@ public final class ShardManagerMessages {
 
     public static Builder newBuilder() { return Builder.create(); }
     public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound prototype) {
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound prototype) {
       return newBuilder().mergeFrom(prototype);
     }
     public Builder toBuilder() { return newBuilder(this); }
@@ -994,20 +994,20 @@ public final class ShardManagerMessages {
      */
     public static final class Builder extends
         com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFoundOrBuilder {
+       implements org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFoundOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
-        return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_descriptor;
+        return org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_descriptor;
       }
 
       protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
           internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_fieldAccessorTable
+        return org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_fieldAccessorTable
             .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound.class, org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound.Builder.class);
+                org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound.class, org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound.Builder.class);
       }
 
-      // Construct using org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound.newBuilder()
+      // Construct using org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound.newBuilder()
       private Builder() {
         maybeForceBuilderInitialization();
       }
@@ -1036,38 +1036,38 @@ public final class ShardManagerMessages {
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
-        return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_descriptor;
+        return org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_descriptor;
       }
 
-      public org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound.getDefaultInstance();
+      public org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound.getDefaultInstance();
       }
 
-      public org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound build() {
-        org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound result = buildPartial();
+      public org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound build() {
+        org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound result = buildPartial();
         if (!result.isInitialized()) {
           throw newUninitializedMessageException(result);
         }
         return result;
       }
 
-      public org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound buildPartial() {
-        org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound result = new org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound(this);
+      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);
         onBuilt();
         return result;
       }
 
       public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound) {
-          return mergeFrom((org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound)other);
+        if (other instanceof org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound)other);
         } else {
           super.mergeFrom(other);
           return this;
         }
       }
 
-      public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound other) {
-        if (other == org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound.getDefaultInstance()) return this;
+      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;
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
@@ -1080,11 +1080,11 @@ public final class ShardManagerMessages {
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
-        org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parsedMessage = null;
+        org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound parsedMessage = null;
         try {
           parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
         } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound) e.getUnfinishedMessage();
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound) e.getUnfinishedMessage();
           throw e;
         } finally {
           if (parsedMessage != null) {
@@ -1132,9 +1132,9 @@ public final class ShardManagerMessages {
       "\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" +
-      "oundBK\n3org.opendaylight.controller.clus" +
-      "ter.datastore.shardB\024ShardManagerMessage" +
-      "s"
+      "oundBL\n4org.opendaylight.controller.prot" +
+      "obuff.messages.shardB\024ShardManagerMessag" +
+      "es"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -1,7 +1,7 @@
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: ShardTransactionChainMessages.proto
+// source: ShardTransactionChain.proto
 
-package org.opendaylight.controller.cluster.datastore.transaction;
+package org.opendaylight.controller.protobuff.messages.transaction;
 
 public final class ShardTransactionChainMessages {
   private ShardTransactionChainMessages() {}
@@ -75,14 +75,14 @@ public final class ShardTransactionChainMessages {
     }
     public static final com.google.protobuf.Descriptors.Descriptor
         getDescriptor() {
-      return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_descriptor;
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_descriptor;
     }
 
     protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
         internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_fieldAccessorTable
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_fieldAccessorTable
           .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain.Builder.class);
+              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain.Builder.class);
     }
 
     public static com.google.protobuf.Parser<CloseTransactionChain> PARSER =
@@ -135,53 +135,53 @@ public final class ShardTransactionChainMessages {
       return super.writeReplace();
     }
 
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom(
         com.google.protobuf.ByteString data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain 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.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom(byte[] data)
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom(byte[] data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom(
         byte[] data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data, extensionRegistry);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain 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.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseDelimitedFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain parseDelimitedFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseDelimitedFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseDelimitedFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain 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.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom(
         com.google.protobuf.CodedInputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
@@ -190,7 +190,7 @@ public final class ShardTransactionChainMessages {
 
     public static Builder newBuilder() { return Builder.create(); }
     public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain prototype) {
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain prototype) {
       return newBuilder().mergeFrom(prototype);
     }
     public Builder toBuilder() { return newBuilder(this); }
@@ -206,20 +206,20 @@ public final class ShardTransactionChainMessages {
      */
     public static final class Builder extends
         com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainOrBuilder {
+       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_descriptor;
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_descriptor;
       }
 
       protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
           internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_fieldAccessorTable
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_fieldAccessorTable
             .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain.Builder.class);
+                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain.Builder.class);
       }
 
-      // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain.newBuilder()
+      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain.newBuilder()
       private Builder() {
         maybeForceBuilderInitialization();
       }
@@ -248,38 +248,38 @@ public final class ShardTransactionChainMessages {
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_descriptor;
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_descriptor;
       }
 
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain.getDefaultInstance();
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain.getDefaultInstance();
       }
 
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain build() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain result = buildPartial();
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain build() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain result = buildPartial();
         if (!result.isInitialized()) {
           throw newUninitializedMessageException(result);
         }
         return result;
       }
 
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain buildPartial() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain(this);
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain buildPartial() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain(this);
         onBuilt();
         return result;
       }
 
       public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain) {
-          return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain)other);
+        if (other instanceof org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain)other);
         } else {
           super.mergeFrom(other);
           return this;
         }
       }
 
-      public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain other) {
-        if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain.getDefaultInstance()) return this;
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain other) {
+        if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain.getDefaultInstance()) return this;
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
@@ -292,11 +292,11 @@ public final class ShardTransactionChainMessages {
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parsedMessage = null;
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain parsedMessage = null;
         try {
           parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
         } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain) e.getUnfinishedMessage();
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChain) e.getUnfinishedMessage();
           throw e;
         } finally {
           if (parsedMessage != null) {
@@ -384,14 +384,14 @@ public final class ShardTransactionChainMessages {
     }
     public static final com.google.protobuf.Descriptors.Descriptor
         getDescriptor() {
-      return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_descriptor;
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_descriptor;
     }
 
     protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
         internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_fieldAccessorTable
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_fieldAccessorTable
           .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.Builder.class);
+              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.Builder.class);
     }
 
     public static com.google.protobuf.Parser<CloseTransactionChainReply> PARSER =
@@ -444,53 +444,53 @@ public final class ShardTransactionChainMessages {
       return super.writeReplace();
     }
 
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom(
         com.google.protobuf.ByteString data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply 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.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom(byte[] data)
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom(byte[] data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom(
         byte[] data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data, extensionRegistry);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply 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.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseDelimitedFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseDelimitedFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseDelimitedFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseDelimitedFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply 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.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom(
         com.google.protobuf.CodedInputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
@@ -499,7 +499,7 @@ public final class ShardTransactionChainMessages {
 
     public static Builder newBuilder() { return Builder.create(); }
     public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply prototype) {
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply prototype) {
       return newBuilder().mergeFrom(prototype);
     }
     public Builder toBuilder() { return newBuilder(this); }
@@ -515,20 +515,20 @@ public final class ShardTransactionChainMessages {
      */
     public static final class Builder extends
         com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReplyOrBuilder {
+       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReplyOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_descriptor;
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_descriptor;
       }
 
       protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
           internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_fieldAccessorTable
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_fieldAccessorTable
             .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.Builder.class);
+                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.Builder.class);
       }
 
-      // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.newBuilder()
+      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.newBuilder()
       private Builder() {
         maybeForceBuilderInitialization();
       }
@@ -557,38 +557,38 @@ public final class ShardTransactionChainMessages {
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_descriptor;
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_descriptor;
       }
 
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.getDefaultInstance();
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.getDefaultInstance();
       }
 
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply build() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply result = buildPartial();
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply build() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply result = buildPartial();
         if (!result.isInitialized()) {
           throw newUninitializedMessageException(result);
         }
         return result;
       }
 
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply buildPartial() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply(this);
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply buildPartial() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply(this);
         onBuilt();
         return result;
       }
 
       public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply) {
-          return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply)other);
+        if (other instanceof org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply)other);
         } else {
           super.mergeFrom(other);
           return this;
         }
       }
 
-      public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply other) {
-        if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.getDefaultInstance()) return this;
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply other) {
+        if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.getDefaultInstance()) return this;
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
@@ -601,11 +601,11 @@ public final class ShardTransactionChainMessages {
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parsedMessage = null;
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parsedMessage = null;
         try {
           parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
         } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply) e.getUnfinishedMessage();
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CloseTransactionChainReply) e.getUnfinishedMessage();
           throw e;
         } finally {
           if (parsedMessage != null) {
@@ -693,14 +693,14 @@ public final class ShardTransactionChainMessages {
     }
     public static final com.google.protobuf.Descriptors.Descriptor
         getDescriptor() {
-      return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_descriptor;
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_descriptor;
     }
 
     protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
         internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_fieldAccessorTable
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_fieldAccessorTable
           .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain.Builder.class);
+              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain.Builder.class);
     }
 
     public static com.google.protobuf.Parser<CreateTransactionChain> PARSER =
@@ -753,53 +753,53 @@ public final class ShardTransactionChainMessages {
       return super.writeReplace();
     }
 
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom(
         com.google.protobuf.ByteString data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain 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.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom(byte[] data)
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom(byte[] data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom(
         byte[] data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data, extensionRegistry);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain 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.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseDelimitedFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain parseDelimitedFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseDelimitedFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseDelimitedFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain 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.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom(
         com.google.protobuf.CodedInputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
@@ -808,7 +808,7 @@ public final class ShardTransactionChainMessages {
 
     public static Builder newBuilder() { return Builder.create(); }
     public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain prototype) {
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain prototype) {
       return newBuilder().mergeFrom(prototype);
     }
     public Builder toBuilder() { return newBuilder(this); }
@@ -824,20 +824,20 @@ public final class ShardTransactionChainMessages {
      */
     public static final class Builder extends
         com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainOrBuilder {
+       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_descriptor;
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_descriptor;
       }
 
       protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
           internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_fieldAccessorTable
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_fieldAccessorTable
             .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain.Builder.class);
+                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain.Builder.class);
       }
 
-      // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain.newBuilder()
+      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain.newBuilder()
       private Builder() {
         maybeForceBuilderInitialization();
       }
@@ -866,38 +866,38 @@ public final class ShardTransactionChainMessages {
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_descriptor;
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_descriptor;
       }
 
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain.getDefaultInstance();
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain.getDefaultInstance();
       }
 
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain build() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain result = buildPartial();
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain build() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain result = buildPartial();
         if (!result.isInitialized()) {
           throw newUninitializedMessageException(result);
         }
         return result;
       }
 
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain buildPartial() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain(this);
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain buildPartial() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain(this);
         onBuilt();
         return result;
       }
 
       public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain) {
-          return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain)other);
+        if (other instanceof org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain)other);
         } else {
           super.mergeFrom(other);
           return this;
         }
       }
 
-      public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain other) {
-        if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain.getDefaultInstance()) return this;
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain other) {
+        if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain.getDefaultInstance()) return this;
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
@@ -910,11 +910,11 @@ public final class ShardTransactionChainMessages {
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parsedMessage = null;
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain parsedMessage = null;
         try {
           parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
         } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain) e.getUnfinishedMessage();
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChain) e.getUnfinishedMessage();
           throw e;
         } finally {
           if (parsedMessage != null) {
@@ -1023,14 +1023,14 @@ public final class ShardTransactionChainMessages {
     }
     public static final com.google.protobuf.Descriptors.Descriptor
         getDescriptor() {
-      return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_descriptor;
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_descriptor;
     }
 
     protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
         internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_fieldAccessorTable
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_fieldAccessorTable
           .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.Builder.class);
+              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.Builder.class);
     }
 
     public static com.google.protobuf.Parser<CreateTransactionChainReply> PARSER =
@@ -1139,53 +1139,53 @@ public final class ShardTransactionChainMessages {
       return super.writeReplace();
     }
 
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom(
         com.google.protobuf.ByteString data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply 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.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom(byte[] data)
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom(byte[] data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom(
         byte[] data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data, extensionRegistry);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply 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.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseDelimitedFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseDelimitedFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseDelimitedFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseDelimitedFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply 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.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom(
         com.google.protobuf.CodedInputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
@@ -1194,7 +1194,7 @@ public final class ShardTransactionChainMessages {
 
     public static Builder newBuilder() { return Builder.create(); }
     public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply prototype) {
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply prototype) {
       return newBuilder().mergeFrom(prototype);
     }
     public Builder toBuilder() { return newBuilder(this); }
@@ -1210,20 +1210,20 @@ public final class ShardTransactionChainMessages {
      */
     public static final class Builder extends
         com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReplyOrBuilder {
+       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReplyOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_descriptor;
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_descriptor;
       }
 
       protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
           internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_fieldAccessorTable
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_fieldAccessorTable
             .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.Builder.class);
+                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.Builder.class);
       }
 
-      // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.newBuilder()
+      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.newBuilder()
       private Builder() {
         maybeForceBuilderInitialization();
       }
@@ -1254,23 +1254,23 @@ public final class ShardTransactionChainMessages {
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_descriptor;
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_descriptor;
       }
 
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.getDefaultInstance();
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.getDefaultInstance();
       }
 
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply build() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply result = buildPartial();
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply build() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply result = buildPartial();
         if (!result.isInitialized()) {
           throw newUninitializedMessageException(result);
         }
         return result;
       }
 
-      public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply buildPartial() {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply(this);
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply buildPartial() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply(this);
         int from_bitField0_ = bitField0_;
         int to_bitField0_ = 0;
         if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
@@ -1283,16 +1283,16 @@ public final class ShardTransactionChainMessages {
       }
 
       public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply) {
-          return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply)other);
+        if (other instanceof org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply)other);
         } else {
           super.mergeFrom(other);
           return this;
         }
       }
 
-      public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply other) {
-        if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.getDefaultInstance()) return this;
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply other) {
+        if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.getDefaultInstance()) return this;
         if (other.hasTransactionChainPath()) {
           bitField0_ |= 0x00000001;
           transactionChainPath_ = other.transactionChainPath_;
@@ -1303,7 +1303,8 @@ public final class ShardTransactionChainMessages {
       }
 
       public final boolean isInitialized() {
-        if (!hasTransactionChainPath()){
+        if (!hasTransactionChainPath()) {
+
           return false;
         }
         return true;
@@ -1313,11 +1314,11 @@ public final class ShardTransactionChainMessages {
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
-        org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parsedMessage = null;
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parsedMessage = null;
         try {
           parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
         } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply) e.getUnfinishedMessage();
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages.CreateTransactionChainReply) e.getUnfinishedMessage();
           throw e;
         } finally {
           if (parsedMessage != null) {
@@ -1442,14 +1443,14 @@ public final class ShardTransactionChainMessages {
       descriptor;
   static {
     java.lang.String[] descriptorData = {
-      "\n#ShardTransactionChainMessages.proto\022!o" +
-      "rg.opendaylight.controller.mdsal\"\027\n\025Clos" +
-      "eTransactionChain\"\034\n\032CloseTransactionCha" +
-      "inReply\"\030\n\026CreateTransactionChain\";\n\033Cre" +
-      "ateTransactionChainReply\022\034\n\024transactionC" +
-      "hainPath\030\001 \002(\tBZ\n9org.opendaylight.contr" +
-      "oller.cluster.datastore.transactionB\035Sha" +
-      "rdTransactionChainMessages"
+      "\n\033ShardTransactionChain.proto\022!org.opend" +
+      "aylight.controller.mdsal\"\027\n\025CloseTransac" +
+      "tionChain\"\034\n\032CloseTransactionChainReply\"" +
+      "\030\n\026CreateTransactionChain\";\n\033CreateTrans" +
+      "actionChainReply\022\034\n\024transactionChainPath" +
+      "\030\001 \002(\tB[\n:org.opendaylight.controller.pr" +
+      "otobuff.messages.transactionB\035ShardTrans" +
+      "actionChainMessages"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessages.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessages.java
new file mode 100644 (file)
index 0000000..cabcf85
--- /dev/null
@@ -0,0 +1,5207 @@
+// Generated by the protocol buffer compiler.  DO NOT EDIT!
+// source: ShardTransaction.proto
+
+package org.opendaylight.controller.protobuff.messages.transaction;
+
+public final class ShardTransactionMessages {
+  private ShardTransactionMessages() {}
+  public static void registerAllExtensions(
+      com.google.protobuf.ExtensionRegistry registry) {
+  }
+  public interface CloseTransactionOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.CloseTransaction}
+   */
+  public static final class CloseTransaction extends
+      com.google.protobuf.GeneratedMessage
+      implements CloseTransactionOrBuilder {
+    // Use CloseTransaction.newBuilder() to construct.
+    private CloseTransaction(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private CloseTransaction(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final CloseTransaction defaultInstance;
+    public static CloseTransaction getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public CloseTransaction getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private CloseTransaction(
+        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_CloseTransaction_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransaction_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<CloseTransaction> PARSER =
+        new com.google.protobuf.AbstractParser<CloseTransaction>() {
+      public CloseTransaction parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new CloseTransaction(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<CloseTransaction> 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.CloseTransaction parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction 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.CloseTransaction parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction 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.CloseTransaction parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction 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.CloseTransaction parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction 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.CloseTransaction parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction 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.CloseTransaction 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.CloseTransaction}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransaction_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransaction_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction.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_CloseTransaction_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction build() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction buildPartial() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction(this);
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction other) {
+        if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction.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.CloseTransaction parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransaction) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CloseTransaction)
+    }
+
+    static {
+      defaultInstance = new CloseTransaction(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CloseTransaction)
+  }
+
+  public interface CloseTransactionReplyOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.CloseTransactionReply}
+   */
+  public static final class CloseTransactionReply extends
+      com.google.protobuf.GeneratedMessage
+      implements CloseTransactionReplyOrBuilder {
+    // Use CloseTransactionReply.newBuilder() to construct.
+    private CloseTransactionReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private CloseTransactionReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final CloseTransactionReply defaultInstance;
+    public static CloseTransactionReply getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public CloseTransactionReply getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private CloseTransactionReply(
+        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_CloseTransactionReply_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<CloseTransactionReply> PARSER =
+        new com.google.protobuf.AbstractParser<CloseTransactionReply>() {
+      public CloseTransactionReply parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new CloseTransactionReply(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<CloseTransactionReply> 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.CloseTransactionReply parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply 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.CloseTransactionReply parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply 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.CloseTransactionReply parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply 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.CloseTransactionReply parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply 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.CloseTransactionReply parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply 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.CloseTransactionReply 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.CloseTransactionReply}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReplyOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply.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_CloseTransactionReply_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply build() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply buildPartial() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply(this);
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply other) {
+        if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply.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.CloseTransactionReply parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CloseTransactionReply) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CloseTransactionReply)
+    }
+
+    static {
+      defaultInstance = new CloseTransactionReply(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CloseTransactionReply)
+  }
+
+  public interface CreateTransactionOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.CreateTransaction}
+   */
+  public static final class CreateTransaction extends
+      com.google.protobuf.GeneratedMessage
+      implements CreateTransactionOrBuilder {
+    // Use CreateTransaction.newBuilder() to construct.
+    private CreateTransaction(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private CreateTransaction(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final CreateTransaction defaultInstance;
+    public static CreateTransaction getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public CreateTransaction getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private CreateTransaction(
+        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_CreateTransaction_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransaction_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<CreateTransaction> PARSER =
+        new com.google.protobuf.AbstractParser<CreateTransaction>() {
+      public CreateTransaction parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new CreateTransaction(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<CreateTransaction> 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.CreateTransaction parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction 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.CreateTransaction parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction 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.CreateTransaction parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction 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.CreateTransaction parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction 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.CreateTransaction parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction 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.CreateTransaction 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.CreateTransaction}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransaction_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransaction_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction.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_CreateTransaction_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction build() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      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);
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      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;
+        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.CreateTransaction parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CreateTransaction)
+    }
+
+    static {
+      defaultInstance = new CreateTransaction(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CreateTransaction)
+  }
+
+  public interface CreateTransactionReplyOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required string transactionPath = 1;
+    /**
+     * <code>required string transactionPath = 1;</code>
+     */
+    boolean hasTransactionPath();
+    /**
+     * <code>required string transactionPath = 1;</code>
+     */
+    java.lang.String getTransactionPath();
+    /**
+     * <code>required string transactionPath = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getTransactionPathBytes();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.CreateTransactionReply}
+   */
+  public static final class CreateTransactionReply extends
+      com.google.protobuf.GeneratedMessage
+      implements CreateTransactionReplyOrBuilder {
+    // Use CreateTransactionReply.newBuilder() to construct.
+    private CreateTransactionReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private CreateTransactionReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final CreateTransactionReply defaultInstance;
+    public static CreateTransactionReply getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public CreateTransactionReply getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private CreateTransactionReply(
+        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;
+              transactionPath_ = 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.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<CreateTransactionReply> PARSER =
+        new com.google.protobuf.AbstractParser<CreateTransactionReply>() {
+      public CreateTransactionReply parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new CreateTransactionReply(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<CreateTransactionReply> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required string transactionPath = 1;
+    public static final int TRANSACTIONPATH_FIELD_NUMBER = 1;
+    private java.lang.Object transactionPath_;
+    /**
+     * <code>required string transactionPath = 1;</code>
+     */
+    public boolean hasTransactionPath() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required string transactionPath = 1;</code>
+     */
+    public java.lang.String getTransactionPath() {
+      java.lang.Object ref = transactionPath_;
+      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()) {
+          transactionPath_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string transactionPath = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getTransactionPathBytes() {
+      java.lang.Object ref = transactionPath_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b =
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        transactionPath_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    private void initFields() {
+      transactionPath_ = "";
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasTransactionPath()) {
+        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, getTransactionPathBytes());
+      }
+      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, getTransactionPathBytes());
+      }
+      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.CreateTransactionReply parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply 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.CreateTransactionReply parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply 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.CreateTransactionReply parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply 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.CreateTransactionReply parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply 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.CreateTransactionReply parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply 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.CreateTransactionReply 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.CreateTransactionReply}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReplyOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply.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();
+        transactionPath_ = "";
+        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.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply build() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply buildPartial() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.transactionPath_ = transactionPath_;
+        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.CreateTransactionReply) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      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()) {
+          bitField0_ |= 0x00000001;
+          transactionPath_ = other.transactionPath_;
+          onChanged();
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasTransactionPath()) {
+
+          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.CreateTransactionReply parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required string transactionPath = 1;
+      private java.lang.Object transactionPath_ = "";
+      /**
+       * <code>required string transactionPath = 1;</code>
+       */
+      public boolean hasTransactionPath() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required string transactionPath = 1;</code>
+       */
+      public java.lang.String getTransactionPath() {
+        java.lang.Object ref = transactionPath_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          transactionPath_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string transactionPath = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getTransactionPathBytes() {
+        java.lang.Object ref = transactionPath_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b =
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          transactionPath_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string transactionPath = 1;</code>
+       */
+      public Builder setTransactionPath(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        transactionPath_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string transactionPath = 1;</code>
+       */
+      public Builder clearTransactionPath() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        transactionPath_ = getDefaultInstance().getTransactionPath();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string transactionPath = 1;</code>
+       */
+      public Builder setTransactionPathBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        transactionPath_ = value;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CreateTransactionReply)
+    }
+
+    static {
+      defaultInstance = new CreateTransactionReply(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CreateTransactionReply)
+  }
+
+  public interface ReadyTransactionOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.ReadyTransaction}
+   */
+  public static final class ReadyTransaction extends
+      com.google.protobuf.GeneratedMessage
+      implements ReadyTransactionOrBuilder {
+    // Use ReadyTransaction.newBuilder() to construct.
+    private ReadyTransaction(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private ReadyTransaction(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final ReadyTransaction defaultInstance;
+    public static ReadyTransaction getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public ReadyTransaction getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private ReadyTransaction(
+        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_ReadyTransaction_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<ReadyTransaction> PARSER =
+        new com.google.protobuf.AbstractParser<ReadyTransaction>() {
+      public ReadyTransaction parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new ReadyTransaction(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<ReadyTransaction> 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.ReadyTransaction parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction 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.ReadyTransaction parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction 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.ReadyTransaction parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction 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.ReadyTransaction parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction 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.ReadyTransaction parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction 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.ReadyTransaction 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.ReadyTransaction}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction.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_ReadyTransaction_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction build() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction buildPartial() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction(this);
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction other) {
+        if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction.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.ReadyTransaction parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransaction) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.ReadyTransaction)
+    }
+
+    static {
+      defaultInstance = new ReadyTransaction(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.ReadyTransaction)
+  }
+
+  public interface ReadyTransactionReplyOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required string actorPath = 1;
+    /**
+     * <code>required string actorPath = 1;</code>
+     */
+    boolean hasActorPath();
+    /**
+     * <code>required string actorPath = 1;</code>
+     */
+    java.lang.String getActorPath();
+    /**
+     * <code>required string actorPath = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getActorPathBytes();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.ReadyTransactionReply}
+   */
+  public static final class ReadyTransactionReply extends
+      com.google.protobuf.GeneratedMessage
+      implements ReadyTransactionReplyOrBuilder {
+    // Use ReadyTransactionReply.newBuilder() to construct.
+    private ReadyTransactionReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private ReadyTransactionReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final ReadyTransactionReply defaultInstance;
+    public static ReadyTransactionReply getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public ReadyTransactionReply getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private ReadyTransactionReply(
+        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;
+              actorPath_ = 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.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<ReadyTransactionReply> PARSER =
+        new com.google.protobuf.AbstractParser<ReadyTransactionReply>() {
+      public ReadyTransactionReply parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new ReadyTransactionReply(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<ReadyTransactionReply> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required string actorPath = 1;
+    public static final int ACTORPATH_FIELD_NUMBER = 1;
+    private java.lang.Object actorPath_;
+    /**
+     * <code>required string actorPath = 1;</code>
+     */
+    public boolean hasActorPath() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required string actorPath = 1;</code>
+     */
+    public java.lang.String getActorPath() {
+      java.lang.Object ref = actorPath_;
+      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()) {
+          actorPath_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>required string actorPath = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getActorPathBytes() {
+      java.lang.Object ref = actorPath_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b =
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        actorPath_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    private void initFields() {
+      actorPath_ = "";
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasActorPath()) {
+        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, getActorPathBytes());
+      }
+      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, getActorPathBytes());
+      }
+      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.ReadyTransactionReply parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply 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.ReadyTransactionReply parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply 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.ReadyTransactionReply parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply 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.ReadyTransactionReply parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply 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.ReadyTransactionReply parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply 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.ReadyTransactionReply 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.ReadyTransactionReply}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReplyOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply.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();
+        actorPath_ = "";
+        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.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply build() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply buildPartial() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.actorPath_ = actorPath_;
+        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.ReadyTransactionReply) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply other) {
+        if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply.getDefaultInstance()) return this;
+        if (other.hasActorPath()) {
+          bitField0_ |= 0x00000001;
+          actorPath_ = other.actorPath_;
+          onChanged();
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasActorPath()) {
+
+          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.ReadyTransactionReply parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadyTransactionReply) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required string actorPath = 1;
+      private java.lang.Object actorPath_ = "";
+      /**
+       * <code>required string actorPath = 1;</code>
+       */
+      public boolean hasActorPath() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required string actorPath = 1;</code>
+       */
+      public java.lang.String getActorPath() {
+        java.lang.Object ref = actorPath_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          actorPath_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string actorPath = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getActorPathBytes() {
+        java.lang.Object ref = actorPath_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b =
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          actorPath_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string actorPath = 1;</code>
+       */
+      public Builder setActorPath(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        actorPath_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string actorPath = 1;</code>
+       */
+      public Builder clearActorPath() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        actorPath_ = getDefaultInstance().getActorPath();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string actorPath = 1;</code>
+       */
+      public Builder setActorPathBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        actorPath_ = value;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.ReadyTransactionReply)
+    }
+
+    static {
+      defaultInstance = new ReadyTransactionReply(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.ReadyTransactionReply)
+  }
+
+  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();
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    int getInstanceIdentifierPathArgumentsCount();
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    java.lang.String getInstanceIdentifierPathArguments(int index);
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getInstanceIdentifierPathArgumentsBytes(int index);
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.DeleteData}
+   */
+  public static final class DeleteData extends
+      com.google.protobuf.GeneratedMessage
+      implements DeleteDataOrBuilder {
+    // Use DeleteData.newBuilder() to construct.
+    private DeleteData(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private DeleteData(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final DeleteData defaultInstance;
+    public static DeleteData getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public DeleteData getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private DeleteData(
+        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)) {
+                instanceIdentifierPathArguments_ = new com.google.protobuf.LazyStringArrayList();
+                mutable_bitField0_ |= 0x00000001;
+              }
+              instanceIdentifierPathArguments_.add(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 {
+        if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
+          instanceIdentifierPathArguments_ = new com.google.protobuf.UnmodifiableLazyStringList(instanceIdentifierPathArguments_);
+        }
+        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_DeleteData_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteData_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<DeleteData> PARSER =
+        new com.google.protobuf.AbstractParser<DeleteData>() {
+      public DeleteData parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new DeleteData(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<DeleteData> getParserForType() {
+      return PARSER;
+    }
+
+    // repeated string 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_;
+    }
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    public int getInstanceIdentifierPathArgumentsCount() {
+      return instanceIdentifierPathArguments_.size();
+    }
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    public java.lang.String getInstanceIdentifierPathArguments(int index) {
+      return instanceIdentifierPathArguments_.get(index);
+    }
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getInstanceIdentifierPathArgumentsBytes(int index) {
+      return instanceIdentifierPathArguments_.getByteString(index);
+    }
+
+    private void initFields() {
+      instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+    }
+    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();
+      for (int i = 0; i < instanceIdentifierPathArguments_.size(); i++) {
+        output.writeBytes(1, instanceIdentifierPathArguments_.getByteString(i));
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      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();
+      }
+      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.DeleteData parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData 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.DeleteData parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData 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.DeleteData parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData 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.DeleteData parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData 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.DeleteData parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData 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.DeleteData 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.DeleteData}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteData_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteData_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData.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();
+        instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+        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.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteData_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData build() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      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);
+        }
+        result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      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();
+        }
+        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.DeleteData parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      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;
+         }
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public java.util.List<java.lang.String>
+          getInstanceIdentifierPathArgumentsList() {
+        return java.util.Collections.unmodifiableList(instanceIdentifierPathArguments_);
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public int getInstanceIdentifierPathArgumentsCount() {
+        return instanceIdentifierPathArguments_.size();
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public java.lang.String getInstanceIdentifierPathArguments(int index) {
+        return instanceIdentifierPathArguments_.get(index);
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getInstanceIdentifierPathArgumentsBytes(int index) {
+        return instanceIdentifierPathArguments_.getByteString(index);
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder setInstanceIdentifierPathArguments(
+          int index, java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  ensureInstanceIdentifierPathArgumentsIsMutable();
+        instanceIdentifierPathArguments_.set(index, value);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder addInstanceIdentifierPathArguments(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  ensureInstanceIdentifierPathArgumentsIsMutable();
+        instanceIdentifierPathArguments_.add(value);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder addAllInstanceIdentifierPathArguments(
+          java.lang.Iterable<java.lang.String> values) {
+        ensureInstanceIdentifierPathArgumentsIsMutable();
+        super.addAll(values, instanceIdentifierPathArguments_);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder clearInstanceIdentifierPathArguments() {
+        instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+        bitField0_ = (bitField0_ & ~0x00000001);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder addInstanceIdentifierPathArgumentsBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  ensureInstanceIdentifierPathArgumentsIsMutable();
+        instanceIdentifierPathArguments_.add(value);
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.DeleteData)
+    }
+
+    static {
+      defaultInstance = new DeleteData(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.DeleteData)
+  }
+
+  public interface DeleteDataReplyOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.DeleteDataReply}
+   */
+  public static final class DeleteDataReply extends
+      com.google.protobuf.GeneratedMessage
+      implements DeleteDataReplyOrBuilder {
+    // Use DeleteDataReply.newBuilder() to construct.
+    private DeleteDataReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private DeleteDataReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final DeleteDataReply defaultInstance;
+    public static DeleteDataReply getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public DeleteDataReply getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private DeleteDataReply(
+        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_DeleteDataReply_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<DeleteDataReply> PARSER =
+        new com.google.protobuf.AbstractParser<DeleteDataReply>() {
+      public DeleteDataReply parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new DeleteDataReply(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<DeleteDataReply> 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.DeleteDataReply parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply 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.DeleteDataReply parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply 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.DeleteDataReply parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply 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.DeleteDataReply parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply 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.DeleteDataReply parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply 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.DeleteDataReply 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.DeleteDataReply}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReplyOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply.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_DeleteDataReply_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply build() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply buildPartial() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply(this);
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply other) {
+        if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply.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.DeleteDataReply parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteDataReply) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.DeleteDataReply)
+    }
+
+    static {
+      defaultInstance = new DeleteDataReply(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.DeleteDataReply)
+  }
+
+  public interface ReadDataOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required string instanceIdentifierPathArguments = 1;
+    /**
+     * <code>required string instanceIdentifierPathArguments = 1;</code>
+     */
+    boolean hasInstanceIdentifierPathArguments();
+    /**
+     * <code>required string instanceIdentifierPathArguments = 1;</code>
+     */
+    java.lang.String getInstanceIdentifierPathArguments();
+    /**
+     * <code>required string instanceIdentifierPathArguments = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getInstanceIdentifierPathArgumentsBytes();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.ReadData}
+   */
+  public static final class ReadData extends
+      com.google.protobuf.GeneratedMessage
+      implements ReadDataOrBuilder {
+    // Use ReadData.newBuilder() to construct.
+    private ReadData(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private ReadData(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final ReadData defaultInstance;
+    public static ReadData getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public ReadData getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private ReadData(
+        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;
+              instanceIdentifierPathArguments_ = 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.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadData_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadData_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<ReadData> PARSER =
+        new com.google.protobuf.AbstractParser<ReadData>() {
+      public ReadData parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new ReadData(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<ReadData> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required string instanceIdentifierPathArguments = 1;
+    public static final int INSTANCEIDENTIFIERPATHARGUMENTS_FIELD_NUMBER = 1;
+    private java.lang.Object instanceIdentifierPathArguments_;
+    /**
+     * <code>required string instanceIdentifierPathArguments = 1;</code>
+     */
+    public boolean hasInstanceIdentifierPathArguments() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required string 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;
+      }
+    }
+    /**
+     * <code>required string 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;
+      }
+    }
+
+    private void initFields() {
+      instanceIdentifierPathArguments_ = "";
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      if (!hasInstanceIdentifierPathArguments()) {
+        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, getInstanceIdentifierPathArgumentsBytes());
+      }
+      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, getInstanceIdentifierPathArgumentsBytes());
+      }
+      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.ReadData parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData 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.ReadData parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData 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.ReadData parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData 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.ReadData parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData 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.ReadData parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData 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.ReadData 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.ReadData}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadData_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadData_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData.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();
+        instanceIdentifierPathArguments_ = "";
+        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.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadData_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData build() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData buildPartial() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
+        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.ReadData) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      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();
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasInstanceIdentifierPathArguments()) {
+
+          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.ReadData parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // required string instanceIdentifierPathArguments = 1;
+      private java.lang.Object instanceIdentifierPathArguments_ = "";
+      /**
+       * <code>required string instanceIdentifierPathArguments = 1;</code>
+       */
+      public boolean hasInstanceIdentifierPathArguments() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required string 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;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>required string 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;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>required string instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder setInstanceIdentifierPathArguments(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        instanceIdentifierPathArguments_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder clearInstanceIdentifierPathArguments() {
+        bitField0_ = (bitField0_ & ~0x00000001);
+        instanceIdentifierPathArguments_ = getDefaultInstance().getInstanceIdentifierPathArguments();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>required string instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder setInstanceIdentifierPathArgumentsBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000001;
+        instanceIdentifierPathArguments_ = value;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.ReadData)
+    }
+
+    static {
+      defaultInstance = new ReadData(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.ReadData)
+  }
+
+  public interface ReadDataReplyOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+     */
+    boolean hasNormalizedNode();
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNode();
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeOrBuilder();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.ReadDataReply}
+   */
+  public static final class ReadDataReply extends
+      com.google.protobuf.GeneratedMessage
+      implements ReadDataReplyOrBuilder {
+    // Use ReadDataReply.newBuilder() to construct.
+    private ReadDataReply(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private ReadDataReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final ReadDataReply defaultInstance;
+    public static ReadDataReply getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public ReadDataReply getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private ReadDataReply(
+        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.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000001) == 0x00000001)) {
+                subBuilder = normalizedNode_.toBuilder();
+              }
+              normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(normalizedNode_);
+                normalizedNode_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000001;
+              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_ReadDataReply_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadDataReply_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<ReadDataReply> PARSER =
+        new com.google.protobuf.AbstractParser<ReadDataReply>() {
+      public ReadDataReply parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new ReadDataReply(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<ReadDataReply> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;
+    public static final int NORMALIZEDNODE_FIELD_NUMBER = 1;
+    private org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml normalizedNode_;
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+     */
+    public boolean hasNormalizedNode() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNode() {
+      return normalizedNode_;
+    }
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeOrBuilder() {
+      return normalizedNode_;
+    }
+
+    private void initFields() {
+      normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.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;
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeMessage(1, 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, 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.ReadDataReply parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply 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.ReadDataReply parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply 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.ReadDataReply parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply 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.ReadDataReply parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply 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.ReadDataReply parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply 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.ReadDataReply 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.ReadDataReply}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReplyOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadDataReply_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadDataReply_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply.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();
+        if (normalizedNodeBuilder_ == null) {
+          normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+        } else {
+          normalizedNodeBuilder_.clear();
+        }
+        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.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadDataReply_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply build() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply buildPartial() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        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.ReadDataReply) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply other) {
+        if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply.getDefaultInstance()) return this;
+        if (other.hasNormalizedNode()) {
+          mergeNormalizedNode(other.getNormalizedNode());
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasNormalizedNode()) {
+
+          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.ReadDataReply parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadDataReply) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      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();
+      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_;
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+       */
+      public boolean hasNormalizedNode() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNode() {
+        if (normalizedNodeBuilder_ == null) {
+          return normalizedNode_;
+        } else {
+          return normalizedNodeBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+       */
+      public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml value) {
+        if (normalizedNodeBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          normalizedNode_ = value;
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000001;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+       */
+      public Builder setNormalizedNode(
+          org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder builderForValue) {
+        if (normalizedNodeBuilder_ == null) {
+          normalizedNode_ = builderForValue.build();
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000001;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+       */
+      public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml 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.SimpleNormalizedNodeMessage.NormalizedNodeXml.newBuilder(normalizedNode_).mergeFrom(value).buildPartial();
+          } else {
+            normalizedNode_ = value;
+          }
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000001;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+       */
+      public Builder clearNormalizedNode() {
+        if (normalizedNodeBuilder_ == null) {
+          normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000001);
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder getNormalizedNodeBuilder() {
+        bitField0_ |= 0x00000001;
+        onChanged();
+        return getNormalizedNodeFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeOrBuilder() {
+        if (normalizedNodeBuilder_ != null) {
+          return normalizedNodeBuilder_.getMessageOrBuilder();
+        } else {
+          return normalizedNode_;
+        }
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml 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>
+          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>(
+                  normalizedNode_,
+                  getParentForChildren(),
+                  isClean());
+          normalizedNode_ = null;
+        }
+        return normalizedNodeBuilder_;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.ReadDataReply)
+    }
+
+    static {
+      defaultInstance = new ReadDataReply(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.ReadDataReply)
+  }
+
+  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();
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    int getInstanceIdentifierPathArgumentsCount();
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    java.lang.String getInstanceIdentifierPathArguments(int index);
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    com.google.protobuf.ByteString
+        getInstanceIdentifierPathArgumentsBytes(int index);
+
+    // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+     */
+    boolean hasNormalizedNode();
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNode();
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeOrBuilder();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.WriteData}
+   */
+  public static final class WriteData extends
+      com.google.protobuf.GeneratedMessage
+      implements WriteDataOrBuilder {
+    // Use WriteData.newBuilder() to construct.
+    private WriteData(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private WriteData(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final WriteData defaultInstance;
+    public static WriteData getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public WriteData getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private WriteData(
+        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)) {
+                instanceIdentifierPathArguments_ = new com.google.protobuf.LazyStringArrayList();
+                mutable_bitField0_ |= 0x00000001;
+              }
+              instanceIdentifierPathArguments_.add(input.readBytes());
+              break;
+            }
+            case 18: {
+              org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000001) == 0x00000001)) {
+                subBuilder = normalizedNode_.toBuilder();
+              }
+              normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(normalizedNode_);
+                normalizedNode_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000001;
+              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)) {
+          instanceIdentifierPathArguments_ = new com.google.protobuf.UnmodifiableLazyStringList(instanceIdentifierPathArguments_);
+        }
+        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_WriteData_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteData_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<WriteData> PARSER =
+        new com.google.protobuf.AbstractParser<WriteData>() {
+      public WriteData parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new WriteData(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<WriteData> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // repeated string 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_;
+    }
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    public int getInstanceIdentifierPathArgumentsCount() {
+      return instanceIdentifierPathArguments_.size();
+    }
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    public java.lang.String getInstanceIdentifierPathArguments(int index) {
+      return instanceIdentifierPathArguments_.get(index);
+    }
+    /**
+     * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+     */
+    public com.google.protobuf.ByteString
+        getInstanceIdentifierPathArgumentsBytes(int index) {
+      return instanceIdentifierPathArguments_.getByteString(index);
+    }
+
+    // required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;
+    public static final int NORMALIZEDNODE_FIELD_NUMBER = 2;
+    private org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml normalizedNode_;
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+     */
+    public boolean hasNormalizedNode() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNode() {
+      return normalizedNode_;
+    }
+    /**
+     * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeOrBuilder() {
+      return normalizedNode_;
+    }
+
+    private void initFields() {
+      instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+      normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.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;
+      }
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    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, normalizedNode_);
+      }
+      getUnknownFields().writeTo(output);
+    }
+
+    private int memoizedSerializedSize = -1;
+    public int getSerializedSize() {
+      int size = memoizedSerializedSize;
+      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, 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.WriteData parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData 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.WriteData parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData 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.WriteData parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData 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.WriteData parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData 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.WriteData parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData 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.WriteData 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.WriteData}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteDataOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteData_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_WriteData_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData.class, org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData.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();
+        instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+        bitField0_ = (bitField0_ & ~0x00000001);
+        if (normalizedNodeBuilder_ == null) {
+          normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.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_WriteData_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData build() {
+        org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData buildPartial() {
+        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);
+        }
+        result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        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.WriteData) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      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.hasNormalizedNode()) {
+          mergeNormalizedNode(other.getNormalizedNode());
+        }
+        this.mergeUnknownFields(other.getUnknownFields());
+        return this;
+      }
+
+      public final boolean isInitialized() {
+        if (!hasNormalizedNode()) {
+
+          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.WriteData parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      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;
+         }
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public java.util.List<java.lang.String>
+          getInstanceIdentifierPathArgumentsList() {
+        return java.util.Collections.unmodifiableList(instanceIdentifierPathArguments_);
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public int getInstanceIdentifierPathArgumentsCount() {
+        return instanceIdentifierPathArguments_.size();
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public java.lang.String getInstanceIdentifierPathArguments(int index) {
+        return instanceIdentifierPathArguments_.get(index);
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public com.google.protobuf.ByteString
+          getInstanceIdentifierPathArgumentsBytes(int index) {
+        return instanceIdentifierPathArguments_.getByteString(index);
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder setInstanceIdentifierPathArguments(
+          int index, java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  ensureInstanceIdentifierPathArgumentsIsMutable();
+        instanceIdentifierPathArguments_.set(index, value);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder addInstanceIdentifierPathArguments(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  ensureInstanceIdentifierPathArgumentsIsMutable();
+        instanceIdentifierPathArguments_.add(value);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder addAllInstanceIdentifierPathArguments(
+          java.lang.Iterable<java.lang.String> values) {
+        ensureInstanceIdentifierPathArgumentsIsMutable();
+        super.addAll(values, instanceIdentifierPathArguments_);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder clearInstanceIdentifierPathArguments() {
+        instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+        bitField0_ = (bitField0_ & ~0x00000001);
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>repeated string instanceIdentifierPathArguments = 1;</code>
+       */
+      public Builder addInstanceIdentifierPathArgumentsBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  ensureInstanceIdentifierPathArgumentsIsMutable();
+        instanceIdentifierPathArguments_.add(value);
+        onChanged();
+        return this;
+      }
+
+      // 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();
+      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_;
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+       */
+      public boolean hasNormalizedNode() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml getNormalizedNode() {
+        if (normalizedNodeBuilder_ == null) {
+          return normalizedNode_;
+        } else {
+          return normalizedNodeBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+       */
+      public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml 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.NormalizedNodeXml normalizedNode = 2;</code>
+       */
+      public Builder setNormalizedNode(
+          org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder builderForValue) {
+        if (normalizedNodeBuilder_ == null) {
+          normalizedNode_ = builderForValue.build();
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000002;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+       */
+      public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml 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.SimpleNormalizedNodeMessage.NormalizedNodeXml.newBuilder(normalizedNode_).mergeFrom(value).buildPartial();
+          } else {
+            normalizedNode_ = value;
+          }
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000002;
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+       */
+      public Builder clearNormalizedNode() {
+        if (normalizedNodeBuilder_ == null) {
+          normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.getDefaultInstance();
+          onChanged();
+        } else {
+          normalizedNodeBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000002);
+        return this;
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXml.Builder getNormalizedNodeBuilder() {
+        bitField0_ |= 0x00000002;
+        onChanged();
+        return getNormalizedNodeFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml normalizedNode = 2;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.SimpleNormalizedNodeMessage.NormalizedNodeXmlOrBuilder getNormalizedNodeOrBuilder() {
+        if (normalizedNodeBuilder_ != null) {
+          return normalizedNodeBuilder_.getMessageOrBuilder();
+        } else {
+          return normalizedNode_;
+        }
+      }
+      /**
+       * <code>required .org.opendaylight.controller.mdsal.NormalizedNodeXml 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>
+          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>(
+                  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)
+  }
+
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_CloseTransaction_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_CloseTransaction_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_CreateTransaction_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_CreateTransaction_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_DeleteData_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_DeleteData_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_ReadData_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_ReadData_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_ReadDataReply_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_ReadDataReply_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_WriteData_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_WriteData_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_WriteDataReply_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_WriteDataReply_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\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"
+    };
+    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_CloseTransaction_descriptor =
+            getDescriptor().getMessageTypes().get(0);
+          internal_static_org_opendaylight_controller_mdsal_CloseTransaction_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_CloseTransaction_descriptor,
+              new java.lang.String[] { });
+          internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_descriptor =
+            getDescriptor().getMessageTypes().get(1);
+          internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_descriptor,
+              new java.lang.String[] { });
+          internal_static_org_opendaylight_controller_mdsal_CreateTransaction_descriptor =
+            getDescriptor().getMessageTypes().get(2);
+          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[] { });
+          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", });
+          internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_descriptor =
+            getDescriptor().getMessageTypes().get(4);
+          internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_descriptor,
+              new java.lang.String[] { });
+          internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_descriptor =
+            getDescriptor().getMessageTypes().get(5);
+          internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_descriptor,
+              new java.lang.String[] { "ActorPath", });
+          internal_static_org_opendaylight_controller_mdsal_DeleteData_descriptor =
+            getDescriptor().getMessageTypes().get(6);
+          internal_static_org_opendaylight_controller_mdsal_DeleteData_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_DeleteData_descriptor,
+              new java.lang.String[] { "InstanceIdentifierPathArguments", });
+          internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_descriptor =
+            getDescriptor().getMessageTypes().get(7);
+          internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_descriptor,
+              new java.lang.String[] { });
+          internal_static_org_opendaylight_controller_mdsal_ReadData_descriptor =
+            getDescriptor().getMessageTypes().get(8);
+          internal_static_org_opendaylight_controller_mdsal_ReadData_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_ReadData_descriptor,
+              new java.lang.String[] { "InstanceIdentifierPathArguments", });
+          internal_static_org_opendaylight_controller_mdsal_ReadDataReply_descriptor =
+            getDescriptor().getMessageTypes().get(9);
+          internal_static_org_opendaylight_controller_mdsal_ReadDataReply_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_ReadDataReply_descriptor,
+              new java.lang.String[] { "NormalizedNode", });
+          internal_static_org_opendaylight_controller_mdsal_WriteData_descriptor =
+            getDescriptor().getMessageTypes().get(10);
+          internal_static_org_opendaylight_controller_mdsal_WriteData_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_WriteData_descriptor,
+              new java.lang.String[] { "InstanceIdentifierPathArguments", "NormalizedNode", });
+          internal_static_org_opendaylight_controller_mdsal_WriteDataReply_descriptor =
+            getDescriptor().getMessageTypes().get(11);
+          internal_static_org_opendaylight_controller_mdsal_WriteDataReply_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_WriteDataReply_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(),
+        }, assigner);
+  }
+
+  // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/DataChangeListener.proto b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/DataChangeListener.proto
new file mode 100644 (file)
index 0000000..f50c36f
--- /dev/null
@@ -0,0 +1,14 @@
+package org.opendaylight.controller.mdsal;
+
+import "SimpleNormalizedNode.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 DataChangedReply{
+
+}
\ No newline at end of file
index ec8046f5574d84c65b315cd4e9096d4002ce7726..27f3c232e726e2c3ae96d338a727717c4e771e8f 100644 (file)
@@ -1,6 +1,6 @@
 package org.opendaylight.controller.mdsal;
 
-option java_package = "org.opendaylight.controller.cluster.datastore.registration";
+option java_package = "org.opendaylight.controller.protobuff.messages.registration";
 option java_outer_classname = "ListenerRegistrationMessages";
 
 message Close {
index 31e8c58b13fcf95db1e34826be246f2a15d3992a..c86fde0c72dea6cb2f20f652794c19eb44478b80 100644 (file)
@@ -1,6 +1,6 @@
 package org.opendaylight.controller.mdsal;
 
-option java_package = "org.opendaylight.controller.cluster.datastore.shard";
+option java_package = "org.opendaylight.controller.protobuff.messages.shard";
 option java_outer_classname = "ShardManagerMessages";
 
 message FindPrimary {
index 0b260c807175fffed3551983349af063da672bfe..120913eb66f71ea854487c2f06e68b83ae19229e 100644 (file)
@@ -1,6 +1,6 @@
 package org.opendaylight.controller.mdsal;
-
-option java_package = "org.opendaylight.controller.cluster.datastore.transaction";
+import "SimpleNormalizedNode.proto";
+option java_package = "org.opendaylight.controller.protobuff.messages.transaction";
 option java_outer_classname = "ShardTransactionMessages";
 
 message CloseTransaction{
@@ -28,12 +28,26 @@ required string actorPath = 1;
 }
 
 message DeleteData {
-required string instanceIdentifierPath = 1;
+repeated string instanceIdentifierPathArguments = 1;
 }
 
 message DeleteDataReply{
 
 }
 message ReadData {
-required string intanceIdentifier=1;
+required string instanceIdentifierPathArguments=1;
+}
+
+message ReadDataReply{
+  required NormalizedNodeXml normalizedNode=1;
+}
+
+message WriteData {
+ repeated string instanceIdentifierPathArguments = 1;
+required NormalizedNodeXml normalizedNode =2;
+
+}
+
+message WriteDataReply{
+
 }
\ No newline at end of file
index 73a9aa11c800c5383910644b815024321fada379..42f87cbda6dbd661b395efccd5ae9e729420759f 100644 (file)
@@ -1,6 +1,6 @@
 package org.opendaylight.controller.mdsal;
 
-option java_package = "org.opendaylight.controller.cluster.datastore.transaction";
+option java_package = "org.opendaylight.controller.protobuff.messages.transaction";
 option java_outer_classname = "ShardTransactionChainMessages";
 
 message CloseTransactionChain {
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/SimpleNormalizedNode.proto b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/SimpleNormalizedNode.proto
new file mode 100644 (file)
index 0000000..e0b21d3
--- /dev/null
@@ -0,0 +1,10 @@
+package org.opendaylight.controller.mdsal;
+
+option java_package = "org.opendaylight.controller.protobuff.messages.common";
+option java_outer_classname = "SimpleNormalizedNodeMessage";
+
+message NormalizedNodeXml {
+  required string nodeIdentifier=1;
+  required string xmlString = 2;
+}
+
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/messages/ShardManagerMessagesTest.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/messages/ShardManagerMessagesTest.java
deleted file mode 100644 (file)
index f57cfc9..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.opendaylight.controller.cluster.datastore.messages;
-
-/**
- * This test case is present to ensure that if others have
- * used proper version of protocol buffer.
- *
- * If a different version of protocol buffer is used then it would
- * generate different java sources and would result in
- * breaking of this test case.
- *
- * @author: syedbahm
- * Date: 6/20/14
- *
- */
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-
-public class ShardManagerMessagesTest {
-
-  @Test
-  public void verifySerialization()throws Exception{
-   ShardManagerMessages.FindPrimary.Builder builder = ShardManagerMessages.FindPrimary.newBuilder();
-   builder.setShardName("Inventory");
-   File testFile = new File("./test");
-   FileOutputStream output = new FileOutputStream(testFile);
-   builder.build().writeTo(output);
-   output.close();
-
-   //Here we will read the same and check we got back what we had saved
-    ShardManagerMessages.FindPrimary findPrimary
-             =  ShardManagerMessages.FindPrimary.parseFrom(new FileInputStream(testFile));
-    Assert.assertEquals("Inventory", findPrimary.getShardName());
-
-    testFile.delete();
-
-  }
-}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/NormalizedNodeXmlConverterTest.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/NormalizedNodeXmlConverterTest.java
new file mode 100644 (file)
index 0000000..02deb5a
--- /dev/null
@@ -0,0 +1,502 @@
+/*
+ * 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.cluster.datastore.util;
+
+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.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.impl.codec.xml.XmlDocumentUtils;
+import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.ListNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeBuilder;
+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.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.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
+
+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.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * Two of the testcases in the yangtools/yang-data-impl are leveraged (with  modification) to
+ * create the serialization of NormalizedNode using the ProtocolBuffer
+ *
+ * @syedbahm
+ *
+ */
+
+
+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(SchemaContext context,
+      String moduleName, 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);
+  }
+
+  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());
+      }
+    }
+
+    for (DataNodeContainer container : containers) {
+      DataSchemaNode retVal = findChildNode(container.getChildNodes(), name);
+      if (retVal != null) {
+        return retVal;
+      }
+    }
+
+    return null;
+  }
+
+  private static InstanceIdentifier.NodeIdentifier getNodeIdentifier(
+      String localName) {
+    return new InstanceIdentifier.NodeIdentifier(new QName(
+        URI.create(NAMESPACE), revision, localName));
+  }
+
+  public static InstanceIdentifier.AugmentationIdentifier getAugmentIdentifier(
+      String... childNames) {
+    Set<QName> qn = Sets.newHashSet();
+
+    for (String childName : childNames) {
+      qn.add(getNodeIdentifier(childName).getNodeType());
+    }
+
+    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(String yangPath, String xmlPath, ContainerNode expectedNode)
+      throws Exception {
+    SchemaContext schema = parseTestSchema(yangPath);
+    this.xmlPath = xmlPath;
+    this.containerNode =
+        (ContainerSchemaNode) getSchemaNode(schema, "test", "container");
+    this.expectedNode = expectedNode;
+  }
+
+  SchemaContext parseTestSchema(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);
+
+    logger.info("{}", built);
+
+    Iterable<Element> els =
+        DomFromNormalizedNodeSerializerFactory
+            .getInstance(XmlDocumentUtils.getDocument(),
+                DomUtils.defaultValueCodecProvider())
+            .getContainerNodeSerializer().serialize(containerNode, built);
+
+    Element el = els.iterator().next();
+
+    XMLUnit.setIgnoreWhitespace(true);
+    XMLUnit.setIgnoreComments(true);
+
+    System.out.println(toString(doc.getDocumentElement()));
+    System.out.println(toString(el));
+
+    boolean diff =
+        new Diff(
+            XMLUnit.buildControlDocument(toString(doc.getDocumentElement())),
+            XMLUnit.buildTestDocument(toString(el))).similar();
+  }
+
+  private static ContainerNode listLeafListWithAttributes() {
+    DataContainerNodeBuilder<InstanceIdentifier.NodeIdentifier, ContainerNode> b =
+        Builders.containerBuilder();
+    b.withNodeIdentifier(getNodeIdentifier("container"));
+
+    CollectionNodeBuilder<MapEntryNode, MapNode> listBuilder =
+        Builders.mapBuilder().withNodeIdentifier(getNodeIdentifier("list"));
+
+    Map<QName, Object> predicates = Maps.newHashMap();
+    predicates.put(getNodeIdentifier("uint32InList").getNodeType(), 3L);
+
+    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"));
+
+    list1Builder.withChild(uint32InListBuilder.withValue(3L).build());
+
+    listBuilder.withChild(list1Builder.build());
+    b.withChild(listBuilder.build());
+
+    NormalizedNodeBuilder<InstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> booleanBuilder =
+        Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("boolean"));
+    booleanBuilder.withValue(false);
+    b.withChild(booleanBuilder.build());
+
+    ListNodeBuilder<Object, LeafSetEntryNode<Object>> leafListBuilder =
+        Builders.leafSetBuilder().withNodeIdentifier(
+            getNodeIdentifier("leafList"));
+
+    NormalizedNodeBuilder<InstanceIdentifier.NodeWithValue, Object, LeafSetEntryNode<Object>> leafList1Builder =
+        Builders.leafSetEntryBuilder().withNodeIdentifier(
+            new InstanceIdentifier.NodeWithValue(getNodeIdentifier("leafList")
+                .getNodeType(), "a"));
+
+    leafList1Builder.withValue("a");
+
+    leafListBuilder.withChild(leafList1Builder.build());
+    b.withChild(leafListBuilder.build());
+
+    return b.build();
+  }
+
+
+  @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);
+
+    if (expectedNode != null)
+      junit.framework.Assert.assertEquals(expectedNode, built);
+
+    logger.info("{}", built);
+
+    Iterable<Element> els =
+        DomFromNormalizedNodeSerializerFactory
+            .getInstance(XmlDocumentUtils.getDocument(),
+                DomUtils.defaultValueCodecProvider())
+            .getContainerNodeSerializer().serialize(containerNode, built);
+
+    Element el = els.iterator().next();
+
+    XMLUnit.setIgnoreWhitespace(true);
+    XMLUnit.setIgnoreComments(true);
+
+    System.out.println(toString(doc.getDocumentElement()));
+    System.out.println(toString(el));
+
+    boolean diff =
+        new Diff(
+            XMLUnit.buildControlDocument(toString(doc.getDocumentElement())),
+            XMLUnit.buildTestDocument(toString(el))).similar();
+  }
+
+
+  private Document loadDocument(String xmlPath) throws Exception {
+    InputStream resourceAsStream =
+        NormalizedNodeXmlConverterTest.class.getResourceAsStream(xmlPath);
+
+    Document currentConfigElement = readXmlToDocument(resourceAsStream);
+    Preconditions.checkNotNull(currentConfigElement);
+    return currentConfigElement;
+  }
+
+  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(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(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);
+    boolean diff =
+        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);
+    boolean diff =
+        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);
+
+
+  }
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/TestModel.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/TestModel.java
new file mode 100644 (file)
index 0000000..81878ba
--- /dev/null
@@ -0,0 +1,372 @@
+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.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 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();
+
+
+    final LeafSetEntryNode<Object> five =
+        ImmutableLeafSetEntryNodeBuilder
+            .create()
+            .withNodeIdentifier(
+                (new InstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME,
+                    "number"), 5))).withValue(5).build();
+    final LeafSetEntryNode<Object> fifteen =
+        ImmutableLeafSetEntryNodeBuilder
+            .create()
+            .withNodeIdentifier(
+                (new InstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME,
+                    "number"), 15))).withValue(15).build();
+    final LeafSetNode<Object> numbers =
+        ImmutableLeafSetNodeBuilder
+            .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"))
+            .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());
+
+
+    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/ShardManagerMessagesTest.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/protobuff/messages/ShardManagerMessagesTest.java
new file mode 100644 (file)
index 0000000..b0758da
--- /dev/null
@@ -0,0 +1,42 @@
+package org.opendaylight.controller.protobuff.messages;
+
+/**
+ * This test case is present to ensure that if others have used proper version of protocol buffer.
+ *
+ * If a different version of protocol buffer is used then it would generate different java sources
+ * and would result in breaking of this test case.
+ *
+ * @author: syedbahm Date: 6/20/14
+ *
+ */
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+
+public class ShardManagerMessagesTest {
+
+  @Test
+  public void verifySerialization() throws Exception {
+    ShardManagerMessages.FindPrimary.Builder builder =
+        ShardManagerMessages.FindPrimary.newBuilder();
+    builder.setShardName("Inventory");
+    File testFile = new File("./test");
+    FileOutputStream output = new FileOutputStream(testFile);
+    builder.build().writeTo(output);
+    output.close();
+
+    // Here we will read the same and check we got back what we had saved
+    ShardManagerMessages.FindPrimary findPrimary =
+        ShardManagerMessages.FindPrimary
+            .parseFrom(new FileInputStream(testFile));
+    Assert.assertEquals("Inventory", findPrimary.getShardName());
+
+    testFile.delete();
+
+  }
+}
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/augment_choice.xml b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/augment_choice.xml
new file mode 100644 (file)
index 0000000..c5a581c
--- /dev/null
@@ -0,0 +1,15 @@
+<container xmlns="urn:opendaylight:params:xml:ns:yang:controller:test">
+
+    <c2Leaf>2</c2Leaf>
+    <c2DeepChoiceCase1Leaf2>2</c2DeepChoiceCase1Leaf2>
+    <!--<c2DeepChoiceCase1Leaf1>2</c2DeepChoiceCase1Leaf1>-->
+
+    <c3Leaf>3</c3Leaf>
+
+    <augLeaf>augment</augLeaf>
+
+    <c1Leaf>1</c1Leaf>
+    <c1Leaf_AnotherAugment>1</c1Leaf_AnotherAugment>
+    <deepLeafc1>1</deepLeafc1>
+    <!--<deepLeafc2>1</deepLeafc2>-->
+</container>
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/augment_choice.yang b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/augment_choice.yang
new file mode 100644 (file)
index 0000000..c2a57f6
--- /dev/null
@@ -0,0 +1,109 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module test {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:test";
+    prefix "test";
+
+    organization "Cisco Systems, Inc.";
+
+    revision "2014-3-13" {
+        description
+            "Initial revision";
+    }
+
+
+    container container {
+        choice ch2{}
+        choice ch3{
+            case c3 {
+                leaf c3Leaf {
+                    type string;
+                }
+            }
+        }
+    }
+
+    augment "/container/" {
+        leaf augLeaf {
+            type string;
+        }
+    }
+
+    augment "/container/" {
+        choice ch{}
+    }
+
+    augment "/container/ch/" {
+        case c1 {
+            leaf c1Leaf {
+                type string;
+            }
+        }
+
+        leaf c12 {
+            type string;
+        }
+    }
+    augment "/container/ch/c1/" {
+        leaf c1Leaf_AnotherAugment {
+            type string;
+        }
+
+        choice deepChoice{}
+    }
+
+    augment "/container/ch3/" {
+        case c32 {
+            leaf c32Leaf {
+                type string;
+            }
+        }
+
+        leaf c34LeafS {
+            type string;
+        }
+    }
+
+
+    augment "/container/ch/c1/deepChoice/" {
+        case deepCase1 {
+            leaf deepLeafc1 {
+                type string;
+            }
+        }
+        case deepCase2 {
+            leaf deepLeafc2 {
+                type string;
+            }
+        }
+    }
+
+    augment "/container/ch2/" {
+        case c2 {
+            leaf c2Leaf {
+                type string;
+            }
+
+            choice c2DeepChoice {
+                case c2DeepChoiceCase1 {
+                    leaf c2DeepChoiceCase1Leaf1 {
+                        type string;
+                    }
+                }
+                case c2DeepChoiceCase2 {
+                    leaf c2DeepChoiceCase1Leaf2 {
+                        type string;
+                    }
+                }
+            }
+        }
+    }
+
+    augment "/container/ch2/" {
+        leaf c22Leaf {
+            type string;
+        }
+    }
+
+
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-test.yang b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-test.yang
new file mode 100644 (file)
index 0000000..32ec277
--- /dev/null
@@ -0,0 +1,33 @@
+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";
+
+    revision "2014-04-15" {
+        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-protocolbuffer-encoding/src/test/resources/simple_xml_with_attributes.xml b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/simple_xml_with_attributes.xml
new file mode 100644 (file)
index 0000000..0316d7a
--- /dev/null
@@ -0,0 +1,12 @@
+<container xmlns="urn:opendaylight:params:xml:ns:yang:controller:test" name="test" xmlns:foo="http://www.foo.com/"
+           foo:baz="baz">
+
+    <list list="on list entry">
+        <uint32InList name="test" foo:baz="baz">3</uint32InList>
+    </list>
+
+    <boolean xmlns:leaf="test:namespace:in:leaf" leaf:a="b">false</boolean>
+
+    <leafList foo:b="b">a</leafList>
+
+</container>
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/test.yang b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/test.yang
new file mode 100644 (file)
index 0000000..5f0e500
--- /dev/null
@@ -0,0 +1,225 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module test {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:test";
+    prefix "test";
+
+    organization "Cisco Systems, Inc.";
+
+    revision "2014-3-13" {
+        description
+            "Initial revision";
+    }
+
+    grouping listGroup {
+        list list {
+            key "uint32InList";
+
+            leaf uint32InList {
+                type uint32;
+            }
+
+            container containerInList{
+                leaf uint32 {
+                    type uint32;
+                }
+                leaf uint16 {
+                    type uint16;
+                }
+            }
+        }
+     }
+
+     grouping innerContainerGrouping {
+        container innerContainer {
+            leaf uint16 {
+                type uint16;
+            }
+
+            container innerInnerContainer {
+
+                leaf uint16 {
+                    type uint16;
+                }
+
+                leaf uint32 {
+                    type uint32;
+                }
+            }
+        }
+     }
+
+    container container {
+        leaf uint32 {
+            type uint32;
+        }
+
+        leaf decimal64 {
+            type decimal64 {
+                fraction-digits 2;
+            }
+        }
+
+        leaf boolean {
+            type boolean;
+        }
+
+        leaf binary {
+            type binary;
+        }
+
+        leaf string {
+            type string;
+        }
+
+        uses listGroup {
+            augment "list/" {
+                leaf stringAugmentedToList{
+                    type string;
+                }
+
+                choice choiceInList {
+                    case caseInList1 {
+                        leaf stringAugmentedToListInCase1 {
+                            type string;
+                        }
+                    }
+                    case caseInList2 {
+                        leaf stringAugmentedToListInCase2 {
+                            type string;
+                        }
+                    }
+                }
+            }
+        }
+
+        list directList {
+            leaf stringInDirectList {
+                type string;
+            }
+        }
+
+        uses innerContainerGrouping;
+
+        choice choice{}
+        choice choice2{}
+
+        leaf-list leafList {
+            type string;
+        }
+
+        leaf identityRef {
+            type identityref {
+                base test-identity;
+            }
+        }
+
+        /* TODO test modification with empty type
+        leaf empty {
+             type empty;
+         }
+         */
+    }
+
+    augment "/container/" {
+        leaf augmentUint32 {
+            type uint32;
+        }
+    }
+
+    augment "/container/directList/" {
+        leaf augmentedString {
+            type uint32;
+        }
+    }
+
+    augment "/container/choice/" {
+        case test-identity-augment {
+            when "/container/identityRef = 'test-identity'";
+            leaf augmentString1 {
+                type string;
+            }
+
+            leaf augmentInt1 {
+                type uint32;
+            }
+        }
+        case test-identity-augment2 {
+            when "/container/identityRef = 'test-identity2'";
+            leaf augmentString2 {
+                type string;
+            }
+
+            leaf augmentInt2 {
+                type uint32;
+            }
+        }
+    }
+
+    augment "/container/choice/test-identity-augment/" {
+
+        choice augmentedChoiceInCase {
+
+            case augmentedCaseInAugmentedChoice {
+                leaf stringInAugmentedCaseInAugmentedChoice {
+                    type string;
+                }
+            }
+
+            case augmentedCaseInAugmentedChoice2 {
+                leaf stringInAugmentedCaseInAugmentedChoice2 {
+                    type string;
+                }
+            }
+        }
+    }
+
+    augment "/container/choice/test-identity-augment/augmentedChoiceInCase/" {
+        case augmentedCaseInAugmentedChoiceFromAugment {
+            leaf stringInAugmentedCaseInAugmentedChoiceFromAugment {
+                type string;
+            }
+        }
+    }
+
+    augment "/container/choice2/" {
+        case test-identity-augment {
+            when "/container/identityRef = 'test-identity'";
+            container augmentContainer {
+                leaf augmentStringInaugmentContainer {
+                    type string;
+                }
+            }
+        }
+        case test-identity-augment2 {
+            when "/container/identityRef = 'test-identity2'";
+            list augmentedList {
+                leaf augmentStringInaugmentList {
+                    type string;
+                }
+            }
+        }
+    }
+
+
+    augment "/container/choice2/test-identity-augment2/augmentedList/" {
+
+        container augmentedContainerInAugmentedListInAugmentedCase {
+            leaf-list leafInAugmentedContainerInAugmentedListInAugmentedCase {
+                type uint32;
+            }
+        }
+
+        list augmentedListInAugmentedListInAugmentedCase {
+            leaf-list leafInAugmentedListInAugmentedListInAugmentedCase {
+                    type uint32;
+                }
+        }
+    }
+
+    identity test-identity {}
+    identity test-identity2 {
+        base test-identity;
+    }
+
+}
\ No newline at end of file
index 056be72d4e057b249a17c0286e87b9b0ebe19e72..2f11d8ed7d72d40282c37ac437de530351efc151 100644 (file)
@@ -10,42 +10,41 @@ package org.opendaylight.controller.sal.rest.api;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.DefaultValue;
+import javax.ws.rs.Encoded;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
-import javax.ws.rs.Encoded;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
-
 import org.opendaylight.controller.sal.restconf.impl.StructuredData;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 
 /**
- *   The URI hierarchy for the RESTCONF resources consists of an entry
- *   point container, 4 top-level resources, and 1 field.
- *   <ul>
- *    <li><b>/restconf</b> - {@link #getRoot()}
- *     <ul>
- *      <li><b>/config</b> - {@link #readConfigurationData(String)}
- *                              {@link #updateConfigurationData(String, CompositeNode)}
- *                              {@link #createConfigurationData(CompositeNode)}
- *                              {@link #createConfigurationData(String, CompositeNode)}
- *                              {@link #deleteConfigurationData(String)}
- *      <li><b>/operational</b> - {@link #readOperationalData(String)}
- *      <li>/modules - {@link #getModules()}
- *       <ul>
- *        <li>/module
- *       </ul>
- *      <li><b>/operations</b> - {@link #invokeRpc(String, CompositeNode)}
- *                               {@link #invokeRpc(String, CompositeNode)}
- *      <li>/version (field)
- *     </ul>
- *   </ul>
+ * The URI hierarchy for the RESTCONF resources consists of an entry point
+ * container, 4 top-level resources, and 1 field.
+ * <ul>
+ * <li><b>/restconf</b> - {@link #getRoot()}
+ * <ul>
+ * <li><b>/config</b> - {@link #readConfigurationData(String)}
+ * {@link #updateConfigurationData(String, CompositeNode)}
+ * {@link #createConfigurationData(CompositeNode)}
+ * {@link #createConfigurationData(String, CompositeNode)}
+ * {@link #deleteConfigurationData(String)}
+ * <li><b>/operational</b> - {@link #readOperationalData(String)}
+ * <li>/modules - {@link #getModules()}
+ * <ul>
+ * <li>/module
+ * </ul>
+ * <li><b>/operations</b> - {@link #invokeRpc(String, CompositeNode)}
+ * {@link #invokeRpc(String, CompositeNode)}
+ * <li>/version (field)
+ * </ul>
+ * </ul>
  */
 @Path("/")
 public interface RestconfService {
@@ -58,81 +57,81 @@ public interface RestconfService {
 
     @GET
     @Path("/modules")
-    @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
-               MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
-    public StructuredData getModules();
+    @Produces({ Draft02.MediaTypes.API + XML, Draft02.MediaTypes.API + JSON, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    public StructuredData getModules(@Context UriInfo uriInfo);
 
     @GET
     @Path("/modules/{identifier:.+}")
-    @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
-               MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
-    public StructuredData getModules(@PathParam("identifier") String identifier);
+    @Produces({ Draft02.MediaTypes.API + XML, Draft02.MediaTypes.API + JSON, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    public StructuredData getModules(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
 
     @GET
     @Path("/modules/module/{identifier:.+}")
-    @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
-               MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
-    public StructuredData getModule(@PathParam("identifier") String identifier);
+    @Produces({ Draft02.MediaTypes.API + XML, Draft02.MediaTypes.API + JSON, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    public StructuredData getModule(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
 
     @GET
     @Path("/operations")
-    @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
-               MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
-    public StructuredData getOperations();
+    @Produces({ Draft02.MediaTypes.API + XML, Draft02.MediaTypes.API + JSON, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    public StructuredData getOperations(@Context UriInfo uriInfo);
 
     @GET
     @Path("/operations/{identifier:.+}")
-    @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
-               MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
-    public StructuredData getOperations(@PathParam("identifier") String identifier);
+    @Produces({ Draft02.MediaTypes.API + XML, Draft02.MediaTypes.API + JSON, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    public StructuredData getOperations(@PathParam("identifier") String identifier, @Context UriInfo uriInfo);
 
     @POST
     @Path("/operations/{identifier:.+}")
-    @Produces({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
-               Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
-               MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
-    @Consumes({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
-               Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
-               MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
-    public StructuredData invokeRpc(@Encoded @PathParam("identifier") String identifier, CompositeNode payload);
+    @Produces({ Draft02.MediaTypes.OPERATION + JSON, Draft02.MediaTypes.OPERATION + XML,
+            Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    @Consumes({ Draft02.MediaTypes.OPERATION + JSON, Draft02.MediaTypes.OPERATION + XML,
+            Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    public StructuredData invokeRpc(@Encoded @PathParam("identifier") String identifier, CompositeNode payload, @Context UriInfo uriInfo);
 
     @POST
     @Path("/operations/{identifier:.+}")
-    @Produces({Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+XML,
-               Draft02.MediaTypes.DATA+JSON, Draft02.MediaTypes.DATA+XML,
-               MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
-    public StructuredData invokeRpc(@Encoded @PathParam("identifier") String identifier, @DefaultValue("") String noPayload);
+    @Produces({ Draft02.MediaTypes.OPERATION + JSON, Draft02.MediaTypes.OPERATION + XML,
+            Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    public StructuredData invokeRpc(@Encoded @PathParam("identifier") String identifier,
+            @DefaultValue("") String noPayload, @Context UriInfo uriInfo);
 
     @GET
     @Path("/config/{identifier:.+}")
-    @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
-               MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
+    @Produces({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
     public StructuredData readConfigurationData(@Encoded @PathParam("identifier") String identifier,
-                                                @Context UriInfo depth);
+            @Context UriInfo uriInfo);
 
     @GET
     @Path("/operational/{identifier:.+}")
-    @Produces({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
-               MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
-    public StructuredData readOperationalData(@Encoded @PathParam("identifier") String identifier,
-                                              @Context UriInfo depth);
+    @Produces({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    public StructuredData readOperationalData(@Encoded @PathParam("identifier") String identifier, @Context UriInfo uriInfo);
 
     @PUT
     @Path("/config/{identifier:.+}")
-    @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
-               MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
+    @Consumes({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
     public Response updateConfigurationData(@Encoded @PathParam("identifier") String identifier, CompositeNode payload);
 
     @POST
     @Path("/config/{identifier:.+}")
-    @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
-               MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
+    @Consumes({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
     public Response createConfigurationData(@Encoded @PathParam("identifier") String identifier, CompositeNode payload);
 
     @POST
     @Path("/config")
-    @Consumes({Draft02.MediaTypes.DATA+JSON,Draft02.MediaTypes.DATA+XML,
-               MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
+    @Consumes({ Draft02.MediaTypes.DATA + JSON, Draft02.MediaTypes.DATA + XML, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
     public Response createConfigurationData(CompositeNode payload);
 
     @DELETE
@@ -145,9 +144,8 @@ public interface RestconfService {
 
     @GET
     @Path("/streams")
-    @Produces({Draft02.MediaTypes.API+XML, Draft02.MediaTypes.API+JSON,
-            MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
-    public StructuredData getAvailableStreams();
-
+    @Produces({ Draft02.MediaTypes.API + XML, Draft02.MediaTypes.API + JSON, MediaType.APPLICATION_JSON,
+            MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+    public StructuredData getAvailableStreams(@Context UriInfo uriInfo);
 
 }
diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/gson/JsonParser.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/gson/JsonParser.java
new file mode 100644 (file)
index 0000000..f3b61de
--- /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.sal.rest.gson;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonIOException;
+import com.google.gson.JsonNull;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParseException;
+import com.google.gson.JsonPrimitive;
+import com.google.gson.JsonSyntaxException;
+import com.google.gson.internal.LazilyParsedNumber;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.MalformedJsonException;
+import java.io.EOFException;
+import java.io.IOException;
+
+/**
+ * This class parses JSON elements from a gson JsonReader. It disallows multiple
+ * elements of the same name unlike the default gson JsonParser."
+ */
+public class JsonParser {
+    public JsonElement parse(JsonReader reader) throws JsonIOException, JsonSyntaxException {
+        // code copied from gson's JsonParser and Stream classes
+
+        boolean lenient = reader.isLenient();
+        reader.setLenient(true);
+        boolean isEmpty = true;
+        try {
+            reader.peek();
+            isEmpty = false;
+            return read(reader);
+        } catch (EOFException e) {
+            if (isEmpty) {
+                return JsonNull.INSTANCE;
+            }
+            // The stream ended prematurely so it is likely a syntax error.
+            throw new JsonSyntaxException(e);
+        } catch (MalformedJsonException e) {
+            throw new JsonSyntaxException(e);
+        } catch (IOException e) {
+            throw new JsonIOException(e);
+        } catch (NumberFormatException e) {
+            throw new JsonSyntaxException(e);
+        } catch (StackOverflowError | OutOfMemoryError e) {
+            throw new JsonParseException("Failed parsing JSON source: " + reader + " to Json", e);
+        } finally {
+            reader.setLenient(lenient);
+        }
+    }
+
+    public JsonElement read(JsonReader in) throws IOException {
+        switch (in.peek()) {
+        case STRING:
+            return new JsonPrimitive(in.nextString());
+        case NUMBER:
+            String number = in.nextString();
+            return new JsonPrimitive(new LazilyParsedNumber(number));
+        case BOOLEAN:
+            return new JsonPrimitive(in.nextBoolean());
+        case NULL:
+            in.nextNull();
+            return JsonNull.INSTANCE;
+        case BEGIN_ARRAY:
+            JsonArray array = new JsonArray();
+            in.beginArray();
+            while (in.hasNext()) {
+                array.add(read(in));
+            }
+            in.endArray();
+            return array;
+        case BEGIN_OBJECT:
+            JsonObject object = new JsonObject();
+            in.beginObject();
+            while (in.hasNext()) {
+                final String childName = in.nextName();
+                if (object.has(childName)) {
+                    throw new JsonSyntaxException("Duplicate name " + childName + " in JSON input.");
+                }
+                object.add(childName, read(in));
+            }
+            in.endObject();
+            return object;
+        case END_DOCUMENT:
+        case NAME:
+        case END_OBJECT:
+        case END_ARRAY:
+        default:
+            throw new IllegalArgumentException();
+        }
+    }
+}
index 9e6966540534c9c79d2a120f89c35ebf603d956d..211e7e818a90bf2b3af9af67a5c693d86fb32ab7 100644 (file)
@@ -11,14 +11,12 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
-
 import javax.ws.rs.Consumes;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyReader;
 import javax.ws.rs.ext.Provider;
-
 import org.opendaylight.controller.sal.rest.api.Draft02;
 import org.opendaylight.controller.sal.rest.api.RestconfService;
 import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
@@ -34,25 +32,28 @@ import org.slf4j.LoggerFactory;
 public enum JsonToCompositeNodeProvider implements MessageBodyReader<CompositeNode> {
     INSTANCE;
 
-    private final static Logger LOG = LoggerFactory.getLogger( JsonToCompositeNodeProvider.class );
+    private final static Logger LOG = LoggerFactory.getLogger(JsonToCompositeNodeProvider.class);
 
     @Override
-    public boolean isReadable(final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType) {
+    public boolean isReadable(final Class<?> type, final Type genericType,
+                              final Annotation[] annotations, final MediaType mediaType) {
         return true;
     }
 
     @Override
-    public CompositeNode readFrom(final Class<CompositeNode> type, final Type genericType, final Annotation[] annotations,
-            final MediaType mediaType, final MultivaluedMap<String, String> httpHeaders, final InputStream entityStream)
-                    throws IOException, WebApplicationException {
+    public CompositeNode readFrom(final Class<CompositeNode> type, final Type genericType,
+                                  final Annotation[] annotations, final MediaType mediaType,
+                                  final MultivaluedMap<String, String> httpHeaders,
+                                  final InputStream entityStream)
+                                          throws IOException, WebApplicationException {
         try {
-            return JsonReader.read(entityStream);
+            return JsonToCompositeNodeReader.read(entityStream);
         } catch (Exception e) {
             LOG.debug( "Error parsing json input", e);
+
             throw new RestconfDocumentedException(
                     "Error parsing input: " + e.getMessage(),
                     ErrorType.PROTOCOL, ErrorTag.MALFORMED_MESSAGE);
         }
     }
-
 }
@@ -11,16 +11,17 @@ import com.google.common.base.Splitter;
 import com.google.common.collect.Iterators;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
 import com.google.gson.JsonPrimitive;
+import com.google.gson.stream.JsonReader;
 
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.net.URI;
-import java.util.Iterator;
 import java.util.Map.Entry;
+import java.util.Iterator;
 import java.util.Set;
 
+import org.opendaylight.controller.sal.rest.gson.JsonParser;
 import org.opendaylight.controller.sal.rest.impl.RestUtil.PrefixMapingFromJson;
 import org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper;
 import org.opendaylight.controller.sal.restconf.impl.EmptyNodeWrapper;
@@ -29,20 +30,22 @@ import org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-final class JsonReader {
+class JsonToCompositeNodeReader {
     private static final Logger LOG = LoggerFactory.getLogger(JsonReader.class);
     private static final Splitter COLON_SPLITTER = Splitter.on(':');
 
-    private JsonReader() {
+    private JsonToCompositeNodeReader() {
 
     }
 
-    public static CompositeNodeWrapper read(final InputStream entityStream) throws UnsupportedFormatException {
+    public static CompositeNodeWrapper read(final InputStream entityStream)
+                                                      throws UnsupportedFormatException {
         JsonParser parser = new JsonParser();
 
-        JsonElement rootElement = parser.parse(new InputStreamReader(entityStream));
+        JsonElement rootElement = parser.parse(new JsonReader(
+                                                    new InputStreamReader(entityStream)));
         if (rootElement.isJsonNull()) {
-            //no content, so return null to indicate no input
+            // no content, so return null to indicate no input
             return null;
         }
 
@@ -50,7 +53,8 @@ final class JsonReader {
             throw new UnsupportedFormatException("Root element of Json has to be Object");
         }
 
-        Set<Entry<String, JsonElement>> entrySetsOfRootJsonObject = rootElement.getAsJsonObject().entrySet();
+        Set<Entry<String, JsonElement>> entrySetsOfRootJsonObject =
+                                                  rootElement.getAsJsonObject().entrySet();
         if (entrySetsOfRootJsonObject.size() != 1) {
             throw new UnsupportedFormatException("Json Object should contain one element");
         }
@@ -77,7 +81,8 @@ final class JsonReader {
                 "First element in Json Object has to be \"Object\" or \"Array with one Object element\". Other scenarios are not supported yet.");
     }
 
-    private static CompositeNodeWrapper createStructureWithRoot(final String rootObjectName, final JsonObject rootObject) {
+    private static CompositeNodeWrapper createStructureWithRoot(final String rootObjectName,
+                                                                final JsonObject rootObject) {
         CompositeNodeWrapper firstNode = new CompositeNodeWrapper(getNamespaceFor(rootObjectName),
                 getLocalNameFor(rootObjectName));
         for (Entry<String, JsonElement> childOfFirstNode : rootObject.entrySet()) {
@@ -86,9 +91,11 @@ final class JsonReader {
         return firstNode;
     }
 
-    private static void addChildToParent(final String childName, final JsonElement childType, final CompositeNodeWrapper parent) {
+    private static void addChildToParent(final String childName, final JsonElement childType,
+                                         final CompositeNodeWrapper parent) {
         if (childType.isJsonObject()) {
-            CompositeNodeWrapper child = new CompositeNodeWrapper(getNamespaceFor(childName), getLocalNameFor(childName));
+            CompositeNodeWrapper child = new CompositeNodeWrapper(getNamespaceFor(childName),
+                    getLocalNameFor(childName));
             parent.addValue(child);
             for (Entry<String, JsonElement> childOfChild : childType.getAsJsonObject().entrySet()) {
                 addChildToParent(childOfChild.getKey(), childOfChild.getValue(), child);
@@ -96,6 +103,7 @@ final class JsonReader {
         } else if (childType.isJsonArray()) {
             if (childType.getAsJsonArray().size() == 1 && childType.getAsJsonArray().get(0).isJsonNull()) {
                 parent.addValue(new EmptyNodeWrapper(getNamespaceFor(childName), getLocalNameFor(childName)));
+
             } else {
                 for (JsonElement childOfChildType : childType.getAsJsonArray()) {
                     addChildToParent(childName, childOfChildType, parent);
@@ -145,8 +153,9 @@ final class JsonReader {
         // it could be identityref Built-In Type
         URI namespace = getNamespaceFor(value);
         if (namespace != null) {
-            return new IdentityValuesDTO(namespace.toString(), getLocalNameFor(value), null,value);
+            return new IdentityValuesDTO(namespace.toString(), getLocalNameFor(value), null, value);
         }
+
         // it is not "prefix:value" but just "value"
         return value;
     }
index 2abd4b6a3ab5b9a08c56e782257a262db80fbfe2..1c95f1327b7ee5fa9cd4219ec6dad4a11a6b843a 100644 (file)
@@ -51,12 +51,15 @@ public class RestconfProvider implements BundleActivator, Provider, ServiceTrack
 
     @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;
-        brokerServiceTrancker = new ServiceTracker<>(context, Broker.class, this);
-        brokerServiceTrancker.open();
-        webSocketServerThread = new Thread(new WebSocketServer());
+        webSocketServerThread = new Thread(WebSocketServer.createInstance(websocketPort));
         webSocketServerThread.setName("Web socket server");
         webSocketServerThread.start();
+        brokerServiceTrancker = new ServiceTracker<>(context, Broker.class, this);
+        brokerServiceTrancker.open();
     }
 
     @Override
index 1c2e9c5009897f741efaa6a1320665d7ba2a4b0a..063d2f51afffdd0c7094d7363d95795182b5cd8e 100644 (file)
@@ -9,13 +9,11 @@ package org.opendaylight.controller.sal.rest.impl;
 
 import com.google.common.base.Charsets;
 import com.google.gson.stream.JsonWriter;
-
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
-
 import javax.ws.rs.Produces;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
@@ -23,7 +21,6 @@ import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
-
 import org.opendaylight.controller.sal.rest.api.Draft02;
 import org.opendaylight.controller.sal.rest.api.RestconfService;
 import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
@@ -39,7 +36,7 @@ public enum StructuredDataToJsonProvider implements MessageBodyWriter<Structured
 
     @Override
     public boolean isWriteable(final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType) {
-        return type.equals( StructuredData.class );
+        return type.equals(StructuredData.class);
     }
 
     @Override
@@ -57,10 +54,14 @@ public enum StructuredDataToJsonProvider implements MessageBodyWriter<Structured
         }
 
         JsonWriter writer = new JsonWriter(new OutputStreamWriter(entityStream, Charsets.UTF_8));
-        writer.setIndent("    ");
+
+        if (t.isPrettyPrintMode()) {
+            writer.setIndent("    ");
+        } else {
+            writer.setIndent("");
+        }
         JsonMapper jsonMapper = new JsonMapper(t.getMountPoint());
         jsonMapper.write(writer, data, (DataNodeContainer) t.getSchema());
         writer.flush();
     }
-
 }
index e5a56cf47566c6ca4d3d8e1113b817706b404d71..3a235ced858a4be9af6dc24d9152602ff806bc09 100644 (file)
@@ -11,7 +11,6 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
-
 import javax.ws.rs.Produces;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
@@ -26,7 +25,6 @@ import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
-
 import org.opendaylight.controller.sal.rest.api.Draft02;
 import org.opendaylight.controller.sal.rest.api.RestconfService;
 import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
@@ -70,7 +68,7 @@ public enum StructuredDataToXmlProvider implements MessageBodyWriter<StructuredD
 
     @Override
     public boolean isWriteable(final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType) {
-        return type.equals( StructuredData.class );
+        return type.equals(StructuredData.class);
     }
 
     @Override
@@ -90,6 +88,11 @@ public enum StructuredDataToXmlProvider implements MessageBodyWriter<StructuredD
         final Transformer trans;
         try {
             trans = TRANSFORMER.get();
+            if (t.isPrettyPrintMode()) {
+                trans.setOutputProperty(OutputKeys.INDENT, "yes");
+            } else {
+                trans.setOutputProperty(OutputKeys.INDENT, "no");
+            }
         } catch (RuntimeException e) {
             throw new RestconfDocumentedException(e.getMessage(), ErrorType.TRANSPORT,
                     ErrorTag.OPERATION_FAILED);
index bc7473864cbb3ffa553c78fbf8a96fb64a7dad6d..31e9c96462541e75205d9ef9c6aac9508abc6e43 100644 (file)
@@ -11,7 +11,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
-
 import javax.ws.rs.Consumes;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
@@ -19,7 +18,6 @@ import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyReader;
 import javax.ws.rs.ext.Provider;
 import javax.xml.stream.XMLStreamException;
-
 import org.opendaylight.controller.sal.rest.api.Draft02;
 import org.opendaylight.controller.sal.rest.api.RestconfService;
 import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
@@ -35,7 +33,7 @@ import org.slf4j.LoggerFactory;
 public enum XmlToCompositeNodeProvider implements MessageBodyReader<CompositeNode> {
     INSTANCE;
 
-    private final static Logger LOG = LoggerFactory.getLogger( XmlToCompositeNodeProvider.class );
+    private final static Logger LOG = LoggerFactory.getLogger(XmlToCompositeNodeProvider.class);
 
     @Override
     public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
@@ -46,14 +44,13 @@ public enum XmlToCompositeNodeProvider implements MessageBodyReader<CompositeNod
     public CompositeNode readFrom(Class<CompositeNode> type, Type genericType, Annotation[] annotations,
             MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
             throws IOException, WebApplicationException {
-        XmlReader xmlReader = new XmlReader();
+        XmlToCompositeNodeReader xmlReader = new XmlToCompositeNodeReader();
         try {
             return xmlReader.read(entityStream);
         } catch (XMLStreamException | UnsupportedFormatException e) {
-            LOG.debug( "Error parsing json input", e );
-            throw new RestconfDocumentedException(
-                            "Error parsing input: " + e.getMessage(),
-                            ErrorType.PROTOCOL, ErrorTag.MALFORMED_MESSAGE );
+            LOG.debug("Error parsing json input", e);
+            throw new RestconfDocumentedException("Error parsing input: " + e.getMessage(), ErrorType.PROTOCOL,
+                    ErrorTag.MALFORMED_MESSAGE);
         }
     }
 
@@ -28,19 +28,19 @@ import org.opendaylight.controller.sal.restconf.impl.NodeWrapper;
 import org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper;
 import org.opendaylight.yangtools.yang.data.api.Node;
 
-public class XmlReader {
+public class XmlToCompositeNodeReader {
 
     private final static XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
     private XMLEventReader eventReader;
 
-    public CompositeNodeWrapper read(InputStream entityStream) throws XMLStreamException,
-                                                                      UnsupportedFormatException,
-                                                                      IOException {
-        //Get an XML stream which can be marked, and reset, so we can check and see if there is
-        //any content being provided.
+    public CompositeNodeWrapper read(InputStream entityStream) throws XMLStreamException, UnsupportedFormatException,
+            IOException {
+        // Get an XML stream which can be marked, and reset, so we can check and
+        // see if there is
+        // any content being provided.
         entityStream = getMarkableStream(entityStream);
 
-        if( isInputStreamEmpty( entityStream ) ) {
+        if (isInputStreamEmpty(entityStream)) {
             return null;
         }
 
@@ -103,24 +103,24 @@ public class XmlReader {
     }
 
     /**
-     * If the input stream is not markable, then it wraps the input stream with a buffered stream,
-     * which is mark able. That way we can check if the stream is empty safely.
+     * If the input stream is not markable, then it wraps the input stream with
+     * a buffered stream, which is mark able. That way we can check if the
+     * stream is empty safely.
+     *
      * @param entityStream
      * @return
      */
     private InputStream getMarkableStream(InputStream entityStream) {
-        if( !entityStream.markSupported() )
-        {
-            entityStream = new BufferedInputStream( entityStream );
+        if (!entityStream.markSupported()) {
+            entityStream = new BufferedInputStream(entityStream);
         }
         return entityStream;
     }
 
-    private boolean isInputStreamEmpty(InputStream entityStream)
-            throws IOException {
+    private boolean isInputStreamEmpty(InputStream entityStream) throws IOException {
         boolean isEmpty = false;
-        entityStream.mark( 1 );
-        if( entityStream.read() == -1 ){
+        entityStream.mark(1);
+        if (entityStream.read() == -1) {
             isEmpty = true;
         }
         entityStream.reset();
@@ -131,7 +131,7 @@ public class XmlReader {
         checkArgument(event != null, "XML Event cannot be NULL!");
         if (event.isStartElement()) {
             XMLEvent innerEvent = skipCommentsAndWhitespace();
-            if ( innerEvent != null && (innerEvent.isCharacters() || innerEvent.isEndElement())) {
+            if (innerEvent != null && (innerEvent.isCharacters() || innerEvent.isEndElement())) {
                 return true;
             }
         }
@@ -142,7 +142,7 @@ public class XmlReader {
         checkArgument(event != null, "XML Event cannot be NULL!");
         if (event.isStartElement()) {
             XMLEvent innerEvent = skipCommentsAndWhitespace();
-            if( innerEvent != null ) {
+            if (innerEvent != null) {
                 if (innerEvent.isStartElement()) {
                     return true;
                 }
@@ -152,16 +152,16 @@ public class XmlReader {
     }
 
     private XMLEvent skipCommentsAndWhitespace() throws XMLStreamException {
-        while( eventReader.hasNext() ) {
+        while (eventReader.hasNext()) {
             XMLEvent event = eventReader.peek();
-            if( event.getEventType() == XMLStreamConstants.COMMENT ) {
+            if (event.getEventType() == XMLStreamConstants.COMMENT) {
                 eventReader.nextEvent();
                 continue;
             }
 
-            if( event.isCharacters() ) {
+            if (event.isCharacters()) {
                 Characters chars = event.asCharacters();
-                if( chars.isWhiteSpace() ) {
+                if (chars.isWhiteSpace()) {
                     eventReader.nextEvent();
                     continue;
                 }
@@ -235,7 +235,8 @@ public class XmlReader {
     private Object resolveValueOfElement(String value, StartElement startElement) {
         // it could be instance-identifier Built-In Type
         if (value.startsWith("/")) {
-            IdentityValuesDTO iiValue = RestUtil.asInstanceIdentifier(value, new RestUtil.PrefixMapingFromXml(startElement));
+            IdentityValuesDTO iiValue = RestUtil.asInstanceIdentifier(value, new RestUtil.PrefixMapingFromXml(
+                    startElement));
             if (iiValue != null) {
                 return iiValue;
             }
@@ -245,7 +246,7 @@ public class XmlReader {
         if (namespaceAndValue.length == 2) {
             String namespace = startElement.getNamespaceContext().getNamespaceURI(namespaceAndValue[0]);
             if (namespace != null && !namespace.isEmpty()) {
-                return new IdentityValuesDTO(namespace, namespaceAndValue[1], namespaceAndValue[0],value);
+                return new IdentityValuesDTO(namespace, namespaceAndValue[1], namespaceAndValue[0], value);
             }
         }
         // it is not "prefix:value" but just "value"
index 5a16c04aedb1fb7ed3d44b77bd1595897215d73f..c8440c0a1692066660b0a6b2025abee6476c28a6 100644 (file)
@@ -15,7 +15,6 @@ import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
-
 import java.net.URI;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -26,14 +25,13 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.Future;
-
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.Status;
 import javax.ws.rs.core.UriBuilder;
 import javax.ws.rs.core.UriInfo;
-
 import org.apache.commons.lang3.StringUtils;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.sal.core.api.mount.MountInstance;
@@ -78,6 +76,21 @@ import org.opendaylight.yangtools.yang.parser.builder.impl.ContainerSchemaNodeBu
 import org.opendaylight.yangtools.yang.parser.builder.impl.LeafSchemaNodeBuilder;
 
 public class RestconfImpl implements RestconfService {
+    private enum UriParameters {
+        PRETTY_PRINT( "prettyPrint"),
+        DEPTH( "depth");
+
+        private String uriParameterName;
+        UriParameters(String uriParameterName) {
+            this.uriParameterName = uriParameterName;
+        }
+
+        @Override
+        public String toString() {
+            return uriParameterName;
+        }
+    }
+
     private final static RestconfImpl INSTANCE = new RestconfImpl();
 
     private static final int CHAR_NOT_FOUND = -1;
@@ -110,7 +123,7 @@ public class RestconfImpl implements RestconfService {
     }
 
     @Override
-    public StructuredData getModules() {
+    public StructuredData getModules(final UriInfo uriInfo) {
         final Module restconfModule = this.getRestconfModule();
 
         final List<Node<?>> modulesAsData = new ArrayList<Node<?>>();
@@ -127,11 +140,11 @@ public class RestconfImpl implements RestconfService {
                 restconfModule, Draft02.RestConfModule.MODULES_CONTAINER_SCHEMA_NODE);
         QName qName = modulesSchemaNode.getQName();
         final CompositeNode modulesNode = NodeFactory.createImmutableCompositeNode(qName, null, modulesAsData);
-        return new StructuredData(modulesNode, modulesSchemaNode, null);
+        return new StructuredData(modulesNode, modulesSchemaNode, null,parsePrettyPrintParameter( uriInfo ));
     }
 
     @Override
-    public StructuredData getAvailableStreams() {
+    public StructuredData getAvailableStreams(final UriInfo uriInfo) {
         Set<String> availableStreams = Notificator.getStreamNames();
 
         final List<Node<?>> streamsAsData = new ArrayList<Node<?>>();
@@ -146,11 +159,11 @@ public class RestconfImpl implements RestconfService {
                 restconfModule, Draft02.RestConfModule.STREAMS_CONTAINER_SCHEMA_NODE);
         QName qName = streamsSchemaNode.getQName();
         final CompositeNode streamsNode = NodeFactory.createImmutableCompositeNode(qName, null, streamsAsData);
-        return new StructuredData(streamsNode, streamsSchemaNode, null);
+        return new StructuredData(streamsNode, streamsSchemaNode, null,parsePrettyPrintParameter( uriInfo ));
     }
 
     @Override
-    public StructuredData getModules(final String identifier) {
+    public StructuredData getModules(final String identifier,final UriInfo uriInfo) {
         Set<Module> modules = null;
         MountInstance mountPoint = null;
         if (identifier.contains(ControllerContext.MOUNT)) {
@@ -178,11 +191,11 @@ public class RestconfImpl implements RestconfService {
                 restconfModule, Draft02.RestConfModule.MODULES_CONTAINER_SCHEMA_NODE);
         QName qName = modulesSchemaNode.getQName();
         final CompositeNode modulesNode = NodeFactory.createImmutableCompositeNode(qName, null, modulesAsData);
-        return new StructuredData(modulesNode, modulesSchemaNode, mountPoint);
+        return new StructuredData(modulesNode, modulesSchemaNode, mountPoint,parsePrettyPrintParameter( uriInfo ));
     }
 
     @Override
-    public StructuredData getModule(final String identifier) {
+    public StructuredData getModule(final String identifier,final UriInfo uriInfo) {
         final QName moduleNameAndRevision = this.getModuleNameAndRevision(identifier);
         Module module = null;
         MountInstance mountPoint = null;
@@ -207,17 +220,17 @@ public class RestconfImpl implements RestconfService {
         final DataSchemaNode moduleSchemaNode = controllerContext.getRestconfModuleRestConfSchemaNode(
                 restconfModule, Draft02.RestConfModule.MODULE_LIST_SCHEMA_NODE);
         final CompositeNode moduleNode = this.toModuleCompositeNode(module, moduleSchemaNode);
-        return new StructuredData(moduleNode, moduleSchemaNode, mountPoint);
+        return new StructuredData(moduleNode, moduleSchemaNode, mountPoint,parsePrettyPrintParameter( uriInfo ));
     }
 
     @Override
-    public StructuredData getOperations() {
+    public StructuredData getOperations(final UriInfo uriInfo) {
         Set<Module> allModules = this.controllerContext.getAllModules();
-        return this.operationsFromModulesToStructuredData(allModules, null);
+        return this.operationsFromModulesToStructuredData(allModules, null,parsePrettyPrintParameter(uriInfo));
     }
 
     @Override
-    public StructuredData getOperations(final String identifier) {
+    public StructuredData getOperations(final String identifier,final UriInfo uriInfo) {
         Set<Module> modules = null;
         MountInstance mountPoint = null;
         if (identifier.contains(ControllerContext.MOUNT)) {
@@ -232,11 +245,11 @@ public class RestconfImpl implements RestconfService {
                             ControllerContext.MOUNT, ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE );
         }
 
-        return this.operationsFromModulesToStructuredData(modules, mountPoint);
+        return this.operationsFromModulesToStructuredData(modules, mountPoint,parsePrettyPrintParameter(uriInfo));
     }
 
     private StructuredData operationsFromModulesToStructuredData(final Set<Module> modules,
-            final MountInstance mountPoint) {
+                                                                 final MountInstance mountPoint,boolean prettyPrint) {
         final List<Node<?>> operationsAsData = new ArrayList<Node<?>>();
         Module restconfModule = this.getRestconfModule();
         final DataSchemaNode operationsSchemaNode = controllerContext.getRestconfModuleRestConfSchemaNode(
@@ -269,7 +282,7 @@ public class RestconfImpl implements RestconfService {
         final CompositeNode operationsNode =
                 NodeFactory.createImmutableCompositeNode(qName, null, operationsAsData);
         ContainerSchemaNode schemaNode = fakeOperationsSchemaNode.build();
-        return new StructuredData(operationsNode, schemaNode, mountPoint);
+        return new StructuredData(operationsNode, schemaNode, mountPoint,prettyPrint);
     }
 
     private Module getRestconfModule() {
@@ -389,18 +402,18 @@ public class RestconfImpl implements RestconfService {
     }
 
     @Override
-    public StructuredData invokeRpc(final String identifier, final CompositeNode payload) {
+    public StructuredData invokeRpc(final String identifier, final CompositeNode payload,final UriInfo uriInfo) {
         final RpcExecutor rpc = this.resolveIdentifierInInvokeRpc(identifier);
         QName rpcName = rpc.getRpcDefinition().getQName();
         URI rpcNamespace = rpcName.getNamespace();
         if (Objects.equal(rpcNamespace.toString(), SAL_REMOTE_NAMESPACE) &&
                 Objects.equal(rpcName.getLocalName(), SAL_REMOTE_RPC_SUBSRCIBE)) {
-            return invokeSalRemoteRpcSubscribeRPC(payload, rpc.getRpcDefinition());
+            return invokeSalRemoteRpcSubscribeRPC(payload, rpc.getRpcDefinition(),parsePrettyPrintParameter(uriInfo));
         }
 
         validateInput( rpc.getRpcDefinition().getInput(), payload );
 
-        return callRpc(rpc, payload);
+        return callRpc(rpc, payload,parsePrettyPrintParameter(uriInfo));
     }
 
     private void validateInput(final DataSchemaNode inputSchema, final CompositeNode payload) {
@@ -426,7 +439,7 @@ public class RestconfImpl implements RestconfService {
     }
 
     private StructuredData invokeSalRemoteRpcSubscribeRPC(final CompositeNode payload,
-            final RpcDefinition rpc) {
+                                                          final RpcDefinition rpc,final boolean prettyPrint) {
         final CompositeNode value = this.normalizeNode(payload, rpc.getInput(), null);
         final SimpleNode<? extends Object> pathNode = value == null ? null :
             value.getFirstSimpleByName( QName.create(rpc.getQName(), "path") );
@@ -463,16 +476,16 @@ public class RestconfImpl implements RestconfService {
             Notificator.createListener(pathIdentifier, streamName);
         }
 
-        return new StructuredData(responseData, rpc.getOutput(), null);
+        return new StructuredData(responseData, rpc.getOutput(), null,prettyPrint);
     }
 
     @Override
-    public StructuredData invokeRpc(final String identifier, final String noPayload) {
+    public StructuredData invokeRpc(final String identifier, final String noPayload, final UriInfo uriInfo) {
         if (StringUtils.isNotBlank(noPayload)) {
             throw new RestconfDocumentedException(
                     "Content must be empty.", ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE );
         }
-        return invokeRpc( identifier, (CompositeNode)null );
+        return invokeRpc( identifier, (CompositeNode)null,uriInfo);
     }
 
     private RpcExecutor resolveIdentifierInInvokeRpc(final String identifier) {
@@ -516,7 +529,7 @@ public class RestconfImpl implements RestconfService {
 
     }
 
-    private StructuredData callRpc(final RpcExecutor rpcExecutor, final CompositeNode payload) {
+    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 );
@@ -547,7 +560,7 @@ public class RestconfImpl implements RestconfService {
             return null; //no output, nothing to send back.
         }
 
-        return new StructuredData(rpcResult.getResult(), rpc.getOutput(), null);
+        return new StructuredData(rpcResult.getResult(), rpc.getOutput(), null,prettyPrint);
     }
 
     private void checkRpcSuccessAndThrowException(final RpcResult<CompositeNode> rpcResult) {
@@ -570,7 +583,7 @@ public class RestconfImpl implements RestconfService {
     }
 
     @Override
-    public StructuredData readConfigurationData(final String identifier, final UriInfo info) {
+    public StructuredData readConfigurationData(final String identifier, final UriInfo uriInfo) {
         final InstanceIdWithSchemaNode iiWithData = this.controllerContext.toInstanceIdentifier(identifier);
         CompositeNode data = null;
         MountInstance mountPoint = iiWithData.getMountPoint();
@@ -581,8 +594,9 @@ public class RestconfImpl implements RestconfService {
             data = broker.readConfigurationData(iiWithData.getInstanceIdentifier());
         }
 
-        data = pruneDataAtDepth( data, parseDepthParameter( info ) );
-        return new StructuredData(data, iiWithData.getSchemaNode(), iiWithData.getMountPoint());
+        data = pruneDataAtDepth( data, parseDepthParameter( uriInfo ) );
+        boolean prettyPrintMode = parsePrettyPrintParameter( uriInfo );
+        return new StructuredData(data, iiWithData.getSchemaNode(), iiWithData.getMountPoint(),prettyPrintMode);
     }
 
     @SuppressWarnings("unchecked")
@@ -607,7 +621,7 @@ public class RestconfImpl implements RestconfService {
     }
 
     private Integer parseDepthParameter( final UriInfo info ) {
-        String param = info.getQueryParameters( false ).getFirst( "depth" );
+        String param = info.getQueryParameters( false ).getFirst( UriParameters.DEPTH.toString() );
         if( Strings.isNullOrEmpty( param ) || "unbounded".equals( param ) ) {
             return null;
         }
@@ -643,7 +657,13 @@ public class RestconfImpl implements RestconfService {
         }
 
         data = pruneDataAtDepth( data, parseDepthParameter( info ) );
-        return new StructuredData(data, iiWithData.getSchemaNode(), mountPoint);
+        boolean prettyPrintMode = parsePrettyPrintParameter( info );
+        return new StructuredData(data, iiWithData.getSchemaNode(), mountPoint,prettyPrintMode);
+    }
+
+    private boolean parsePrettyPrintParameter(UriInfo info) {
+        String param = info.getQueryParameters(false).getFirst(UriParameters.PRETTY_PRINT.toString());
+        return Boolean.parseBoolean(param);
     }
 
     @Override
@@ -858,7 +878,7 @@ public class RestconfImpl implements RestconfService {
         broker.registerToListenDataChanges(listener);
 
         final UriBuilder uriBuilder = uriInfo.getAbsolutePathBuilder();
-        UriBuilder port = uriBuilder.port(WebSocketServer.PORT);
+        UriBuilder port = uriBuilder.port(WebSocketServer.getInstance().getPort());
         final URI uriToWebsocketServer = port.replacePath(streamName).build();
 
         return Response.status(Status.OK).location(uriToWebsocketServer).build();
@@ -1117,6 +1137,7 @@ public class RestconfImpl implements RestconfService {
             final DataNodeContainer schema, final MountInstance mountPoint,
             final QName currentAugment ) {
         final List<NodeWrapper<?>> children = compositeNodeBuilder.getValues();
+        checkNodeMultiplicityAccordingToSchema(schema,children);
         for (final NodeWrapper<? extends Object> child : children) {
             final List<DataSchemaNode> potentialSchemaNodes =
                     this.controllerContext.findInstanceDataChildrenByName(
@@ -1177,6 +1198,29 @@ public class RestconfImpl implements RestconfService {
         }
     }
 
+    private void checkNodeMultiplicityAccordingToSchema(final DataNodeContainer dataNodeContainer,
+            final List<NodeWrapper<?>> nodes) {
+        Map<String, Integer> equalNodeNamesToCounts = new HashMap<String, Integer>();
+        for (NodeWrapper<?> child : nodes) {
+            Integer count = equalNodeNamesToCounts.get(child.getLocalName());
+            equalNodeNamesToCounts.put(child.getLocalName(), count == null ? 1 : ++count);
+        }
+
+        for (DataSchemaNode childSchemaNode : dataNodeContainer.getChildNodes()) {
+            if (childSchemaNode instanceof ContainerSchemaNode || childSchemaNode instanceof LeafSchemaNode) {
+                String localName = childSchemaNode.getQName().getLocalName();
+                Integer count = equalNodeNamesToCounts.get(localName);
+                if (count != null && count > 1) {
+                    throw new RestconfDocumentedException(
+                            "Multiple input data elements were specified for '"
+                            + childSchemaNode.getQName().getLocalName()
+                            + "'. The data for this element type can only be specified once.",
+                            ErrorType.APPLICATION, ErrorTag.BAD_ELEMENT);
+                }
+            }
+        }
+    }
+
     private QName normalizeNodeName(final NodeWrapper<? extends Object> nodeBuilder,
             final DataSchemaNode schema, final QName previousAugment,
             final MountInstance mountPoint) {
index 231fe7e02eedfdee29d2996a7d0ebc4839f73646..c745a8009deac75a70a7249626b07f56457d9243 100644 (file)
@@ -16,11 +16,18 @@ public class StructuredData {
     private final CompositeNode data;
     private final DataSchemaNode schema;
     private final MountInstance mountPoint;
+    private final boolean prettyPrintMode;
 
     public StructuredData(final CompositeNode data, final DataSchemaNode schema, final MountInstance mountPoint) {
+        this(data, schema, mountPoint, false);
+    }
+
+    public StructuredData(final CompositeNode data, final DataSchemaNode schema, final MountInstance mountPoint,
+            final boolean preattyPrintMode) {
         this.data = data;
         this.schema = schema;
         this.mountPoint = mountPoint;
+        this.prettyPrintMode = preattyPrintMode;
     }
 
     public CompositeNode getData() {
@@ -34,4 +41,8 @@ public class StructuredData {
     public MountInstance getMountPoint() {
         return mountPoint;
     }
+
+    public boolean isPrettyPrintMode() {
+        return prettyPrintMode;
+    }
 }
index fcfa8858ee940065baee9f4c8c4df2fb3a73089c..20951b01e2dd52a16b80cb5794d049c858eb2d82 100644 (file)
@@ -10,18 +10,69 @@ import org.opendaylight.controller.sal.streams.listeners.Notificator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Preconditions;
+
 /**
- * {@link WebSocketServer} is responsible to start and stop web socket server at
- * {@link #PORT}.
+ * {@link WebSocketServer} is responsible to start and stop web socket server
  */
 public class WebSocketServer implements Runnable {
 
     private static final Logger logger = LoggerFactory
             .getLogger(WebSocketServer.class);
-
-    public static final int PORT = 8181;
+    public static final String WEBSOCKET_SERVER_CONFIG_PROPERTY = "restconf.websocket.port";
+    public static final int DEFAULT_PORT = 8181;
     private EventLoopGroup bossGroup;
     private EventLoopGroup workerGroup;
+    private static WebSocketServer singleton = null;
+    private int port = DEFAULT_PORT;
+
+    private WebSocketServer(int port) {
+        this.port = port;
+    }
+
+    /**
+     * Create instance of {@link WebSocketServer}
+     * @param port TCP port used for this server
+     * @return instance of {@link WebSocketServer}
+     */
+    public static WebSocketServer createInstance(int port) {
+        if(singleton != null) {
+            throw new IllegalStateException("createInstance() has already been called");
+        }
+        if(port < 1024) {
+            throw new IllegalArgumentException("Privileged port (below 1024) is not allowed");
+        }
+        singleton = new WebSocketServer(port);
+        return singleton;
+    }
+
+    /**
+     * Return websocket TCP port
+     */
+    public int getPort() {
+        return port;
+    }
+
+    /**
+     * Get instance of {@link WebSocketServer} created by {@link #createInstance(int)}
+     * @return instance of {@link WebSocketServer}
+     */
+    public static WebSocketServer getInstance() {
+        Preconditions.checkNotNull(singleton,
+                "createInstance() must be called prior to getInstance()");
+        return singleton;
+    }
+
+    /**
+     * Destroy this already created instance
+     */
+    public static void destroyInstance() {
+        if(singleton == null) {
+            throw new IllegalStateException(
+                    "createInstance() must be called prior to destroyInstance()");
+        }
+        getInstance().stop();
+    }
 
     @Override
     public void run() {
@@ -33,8 +84,8 @@ public class WebSocketServer implements Runnable {
                     .channel(NioServerSocketChannel.class)
                     .childHandler(new WebSocketServerInitializer());
 
-            Channel ch = b.bind(PORT).sync().channel();
-            logger.info("Web socket server started at port {}.", PORT);
+            Channel ch = b.bind(port).sync().channel();
+            logger.info("Web socket server started at port {}.", port);
 
             ch.closeFuture().sync();
         } catch (InterruptedException e) {
index 24dba17c90cdff4e9a87d0a059160357dcbaad88..3f89c97367efd2f849802a61d5e4fec1f12149f1 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+import static org.opendaylight.controller.sal.restconf.impl.test.TestUtils.containsStringData;
 
 import java.io.IOException;
 import java.util.Collections;
@@ -50,7 +51,9 @@ public class CnSnToJsonNotExistingLeafTypeTest extends YangAndXmlAndDataSchemaLo
                         Collections.<Module>emptySet(), prepareDataSchemaNode(),
                         StructuredDataToJsonProvider.INSTANCE);
         assertNotNull(jsonOutput);
-        assertTrue(jsonOutput.contains("\"lf1\": \"\""));
+
+//      pattern for e.g. >    "lf1"   : ""    < or >"lf1":""<
+        assertTrue(containsStringData(jsonOutput, "\"lf1\"",":","\"\""));
     }
 
     private CompositeNode prepareCompositeNode() {
index e116129bf7cc63736760688234b1f7665dcf9533..3d25955b3caae0bff5a51b5dec49f53b270160e5 100644 (file)
@@ -9,11 +9,10 @@ package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+import static org.opendaylight.controller.sal.restconf.impl.test.TestUtils.containsStringData;
 
 import java.io.IOException;
-
 import javax.ws.rs.WebApplicationException;
-
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider;
@@ -47,12 +46,12 @@ public class CnSnToJsonWithAugmentTest extends YangAndXmlAndDataSchemaLoader {
         }
         assertNotNull(jsonOutput);
 
-        assertTrue(jsonOutput.contains("\"augment-leaf:lf2\": \"lf2\""));
-        assertTrue(jsonOutput.contains("\"augment-container:cont1\": {"));
-        assertTrue(jsonOutput.contains("\"augment-container:lf11\": \"lf11\""));
-        assertTrue(jsonOutput.contains("\"augment-list:lst1\": ["));
-        assertTrue(jsonOutput.contains("\"augment-list:lf11\": \"lf1_1\""));
-        assertTrue(jsonOutput.contains("\"augment-list:lf11\": \"lf1_2\""));
-        assertTrue(jsonOutput.contains("\"augment-leaflist:lflst1\": ["));
+        assertTrue(containsStringData(jsonOutput,"\"augment-leaf:lf2\"",":", "\"lf2\""));
+        assertTrue(containsStringData(jsonOutput,"\"augment-container:cont1\"",":", "\\{"));
+        assertTrue(containsStringData(jsonOutput,"\"augment-container:lf11\"",":", "\"lf11\""));
+        assertTrue(containsStringData(jsonOutput,"\"augment-list:lst1\"",":", "\\["));
+        assertTrue(containsStringData(jsonOutput,"\"augment-list:lf11\"",":", "\"lf1_1\""));
+        assertTrue(containsStringData(jsonOutput,"\"augment-list:lf11\"",":", "\"lf1_2\""));
+        assertTrue(containsStringData(jsonOutput,"\"augment-leaflist:lflst1\"",":", "\\["));
     }
 }
index 3f2c212bd87785ccbf021749d9bddb1db069bf6f..47171bf2470141bc509d2d96423b676a850826da 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.sal.restconf.impl.test;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+import static org.opendaylight.controller.sal.restconf.impl.test.TestUtils.containsStringData;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
@@ -19,16 +20,13 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-
 import javax.ws.rs.WebApplicationException;
 import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.events.StartElement;
 import javax.xml.stream.events.XMLEvent;
-
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider;
 import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider;
@@ -39,9 +37,10 @@ import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifie
 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.MutableCompositeNode;
-import org.opendaylight.yangtools.yang.data.api.MutableSimpleNode;
+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;
 
 public class CnSnToXmlAndJsonInstanceIdentifierTest extends YangAndXmlAndDataSchemaLoader {
 
@@ -55,21 +54,16 @@ public class CnSnToXmlAndJsonInstanceIdentifierTest extends YangAndXmlAndDataSch
         CompositeNode cnSn = prepareCnSn(createInstanceIdentifier());
         String output = TestUtils.writeCompNodeWithSchemaContextToOutput(cnSn, modules, dataSchemaNode,
                 StructuredDataToXmlProvider.INSTANCE);
-        //uncomment for debug
-        // System.out.println(output);
         validateXmlOutput(output);
 
     }
 
-    @Ignore
     @Test
     public void saveCnSnWithLeafListInstIdentifierToXmlTest() throws WebApplicationException, IOException,
-    URISyntaxException, XMLStreamException {
+            URISyntaxException, XMLStreamException {
         CompositeNode cnSn = prepareCnSn(createInstanceIdentifierWithLeafList());
         String output = TestUtils.writeCompNodeWithSchemaContextToOutput(cnSn, modules, dataSchemaNode,
                 StructuredDataToXmlProvider.INSTANCE);
-        //uncomment for debug
-        // System.out.println(output);
         validateXmlOutputWithLeafList(output);
     }
 
@@ -79,33 +73,40 @@ public class CnSnToXmlAndJsonInstanceIdentifierTest extends YangAndXmlAndDataSch
         String output = TestUtils.writeCompNodeWithSchemaContextToOutput(cnSn, modules, dataSchemaNode,
                 StructuredDataToJsonProvider.INSTANCE);
         boolean strInOutput = false;
-        strInOutput = output
-                .contains("\"augment-augment-module:lf111\": \"/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module:lst11[augment-module:keyvalue111=\\\"value1\\\"][augment-module:keyvalue112=\\\"value2\\\"]/augment-augment-module:lf112\"");
+        strInOutput = containsStringData(
+                output,
+                "\"augment-augment-module:lf111\"",
+                ":",
+                "\"/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module:lst11\\[augment-module:keyvalue111=\\\\\"value1\\\\\"\\]\\[augment-module:keyvalue112=\\\\\"value2\\\\\"\\]/augment-augment-module:lf112\"");
 
         if (!strInOutput) {
-            strInOutput = output
-                    .contains("\"augment-augment-module:lf111\": \"/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module:lst11[augment-module:keyvalue111='value1'][augment-module:keyvalue112='value2']/augment-augment-module:lf112\"");
+            strInOutput = containsStringData(
+                    output,
+                    "\"augment-augment-module:lf111\"",
+                    ":",
+                    "\"/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module:lst11\\[augment-module:keyvalue111='value1'\\]\\[augment-module:keyvalue112='value2'\\]/augment-augment-module:lf112\"");
         }
-        //uncomment for debug
-        // System.out.println(output);
         assertTrue(strInOutput);
     }
 
-
     @Test
     public void saveCnSnWithLeafListInstIdentifierToJsonTest() throws WebApplicationException, IOException,
-    URISyntaxException {
+            URISyntaxException {
         CompositeNode cnSn = prepareCnSn(createInstanceIdentifierWithLeafList());
         String output = TestUtils.writeCompNodeWithSchemaContextToOutput(cnSn, modules, dataSchemaNode,
                 StructuredDataToJsonProvider.INSTANCE);
-        //uncomment for debug
-        // System.out.println(output);
         boolean strInOutput = false;
-        strInOutput = output
-                .contains("\"augment-augment-module:lf111\": \"/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module-leaf-list:lflst11[.='lflst11_1']\"");
+        strInOutput = containsStringData(
+                output,
+                "\"augment-augment-module:lf111\"",
+                ":",
+                "\"/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module-leaf-list:lflst11\\[.='lflst11_1'\\]\"");
         if (!strInOutput) {
-            strInOutput = output
-                    .contains("\"augment-augment-module:lf111\": \"/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module-leaf-list:lflst11[.=\\\"lflst11_1\\\"]\"");
+            strInOutput = containsStringData(
+                    output,
+                    "\"augment-augment-module:lf111\"",
+                    ":",
+                    "\"/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module-leaf-list:lflst11\\[.=\\\\\"lflst11_1\\\\\"\\]\"");
         }
 
         assertTrue(strInOutput);
@@ -189,27 +190,21 @@ public class CnSnToXmlAndJsonInstanceIdentifierTest extends YangAndXmlAndDataSch
     }
 
     private CompositeNode prepareCnSn(final InstanceIdentifier instanceIdentifier) throws URISyntaxException {
-        MutableCompositeNode cont = NodeFactory.createMutableCompositeNode(
-                TestUtils.buildQName("cont", "instance:identifier:module", "2014-01-17"), null, null,null,null);
-        MutableCompositeNode cont1 = NodeFactory.createMutableCompositeNode(
-                TestUtils.buildQName("cont1", "instance:identifier:module", "2014-01-17"), cont, null,null,null);
-        MutableCompositeNode lst11 = NodeFactory.createMutableCompositeNode(
-                TestUtils.buildQName("lst11", "augment:module", "2014-01-17"), cont1, null,null,null);
-
-        MutableSimpleNode<?> lf111 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf111", "augment:augment:module", "2014-01-17"),
-                lst11, instanceIdentifier,null,null);
-
-
-        lst11.getValue().add(lf111);
-        lst11.init();
+        CompositeNodeBuilder<ImmutableCompositeNode> cont = ImmutableCompositeNode.builder();
+        cont.setQName(QName.create("instance:identifier:module", "2014-01-17", "cont"));
 
-        cont1.getValue().add(lst11);
-        cont1.init();
+        CompositeNodeBuilder<ImmutableCompositeNode> cont1 = ImmutableCompositeNode.builder();
+        cont1.setQName(QName.create("instance:identifier:module", "2014-01-17", "cont1"));
 
-        cont.getValue().add(cont1);
-        cont.init();
+        CompositeNodeBuilder<ImmutableCompositeNode> lst11 = ImmutableCompositeNode.builder();
+        lst11.setQName(QName.create("augment:module", "2014-01-17", "lst11"));
 
-        return cont;
+        SimpleNode<?> lf111 = NodeFactory.createImmutableSimpleNode(
+                QName.create("augment:augment:module", "2014-01-17", "lf111"), null, instanceIdentifier);
+        lst11.add(lf111);
+        cont1.add(lst11.toInstance());
+        cont.add(cont1.toInstance());
+        return cont.toInstance();
     }
 
     private InstanceIdentifier createInstanceIdentifier() throws URISyntaxException {
index 910ca8e20aab453d02b4e320b0493775666d3575..b90097bc94a0e7888b589f33960343cc94d36c12 100644 (file)
@@ -19,6 +19,9 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
 import java.io.FileNotFoundException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -27,7 +30,9 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.UriInfo;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -56,14 +61,11 @@ 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 com.google.common.base.Optional;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-
 public class InvokeRpcMethodTest {
 
     private RestconfImpl restconfImpl = null;
     private static ControllerContext controllerContext = null;
+    private static UriInfo uriInfo;
 
 
     @BeforeClass
@@ -77,7 +79,10 @@ public class InvokeRpcMethodTest {
         SchemaContext schemaContext = TestUtils.loadSchemaContext(allModules);
         controllerContext = spy( ControllerContext.getInstance() );
         controllerContext.setSchemas(schemaContext);
-
+        uriInfo = mock(UriInfo.class);
+        MultivaluedMap<String, String> map = new MultivaluedHashMap<>();
+        map.put("prettyPrint", Collections.singletonList("true"));
+        when(uriInfo.getQueryParameters(any(Boolean.class))).thenReturn(map);
     }
 
     @Before
@@ -114,7 +119,7 @@ public class InvokeRpcMethodTest {
             .thenReturn( Futures.<RpcResult<CompositeNode>>immediateFuture(
                                                Rpcs.<CompositeNode>getRpcResult( true ) ) );
 
-        StructuredData structData = restconf.invokeRpc("invoke-rpc-module:rpc-test", payload);
+        StructuredData structData = restconf.invokeRpc("invoke-rpc-module:rpc-test", payload,uriInfo);
         assertTrue(structData == null);
 
     }
@@ -143,7 +148,7 @@ public class InvokeRpcMethodTest {
         restconfImpl.setBroker(brokerFacade);
 
         try {
-            restconfImpl.invokeRpc("toaster:cancel-toast", "");
+            restconfImpl.invokeRpc("toaster:cancel-toast", "",uriInfo);
             fail("Expected an exception to be thrown.");
         }
         catch (RestconfDocumentedException e) {
@@ -196,7 +201,7 @@ public class InvokeRpcMethodTest {
         restconfImpl.setBroker(brokerFacade);
 
         try {
-            restconfImpl.invokeRpc("toaster:cancel-toast", "");
+            restconfImpl.invokeRpc("toaster:cancel-toast", "",uriInfo);
             fail("Expected an exception to be thrown.");
         }
         catch (RestconfDocumentedException e) {
@@ -220,7 +225,7 @@ public class InvokeRpcMethodTest {
         restconfImpl.setBroker(brokerFacade);
 
         StructuredData output = restconfImpl.invokeRpc("toaster:cancel-toast",
-                "");
+                "",uriInfo);
         assertEquals(null, output);
         //additional validation in the fact that the restconfImpl does not throw an exception.
     }
@@ -228,7 +233,7 @@ public class InvokeRpcMethodTest {
     @Test
     public void testInvokeRpcMethodExpectingNoPayloadButProvidePayload() {
         try {
-            restconfImpl.invokeRpc("toaster:cancel-toast", " a payload ");
+            restconfImpl.invokeRpc("toaster:cancel-toast", " a payload ",uriInfo);
             fail("Expected an exception");
         } catch (RestconfDocumentedException e) {
             verifyRestconfDocumentedException( e, 0, ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE,
@@ -239,7 +244,7 @@ public class InvokeRpcMethodTest {
     @Test
     public void testInvokeRpcMethodWithBadMethodName() {
         try {
-            restconfImpl.invokeRpc("toaster:bad-method", "");
+            restconfImpl.invokeRpc("toaster:bad-method", "",uriInfo);
             fail("Expected an exception");
         }
         catch (RestconfDocumentedException e) {
@@ -263,7 +268,7 @@ public class InvokeRpcMethodTest {
         restconfImpl.setBroker(brokerFacade);
 
         StructuredData output = restconfImpl.invokeRpc("toaster:make-toast",
-                payload);
+                payload,uriInfo);
         assertEquals(null, output);
         //additional validation in the fact that the restconfImpl does not throw an exception.
     }
@@ -271,7 +276,7 @@ public class InvokeRpcMethodTest {
     @Test
     public void testThrowExceptionWhenSlashInModuleName() {
         try {
-            restconfImpl.invokeRpc("toaster/slash", "");
+            restconfImpl.invokeRpc("toaster/slash", "",uriInfo);
             fail("Expected an exception.");
         }
         catch (RestconfDocumentedException e) {
@@ -294,7 +299,7 @@ public class InvokeRpcMethodTest {
 
         restconfImpl.setBroker(brokerFacade);
 
-        StructuredData output = restconfImpl.invokeRpc("toaster:testOutput", "");
+        StructuredData output = restconfImpl.invokeRpc("toaster:testOutput", "",uriInfo);
         assertNotNull( output );
         assertSame( compositeNode, output.getData() );
         assertNotNull( output.getSchema() );
@@ -330,7 +335,7 @@ public class InvokeRpcMethodTest {
         restconfImpl.setControllerContext( mockedContext );
         StructuredData output = restconfImpl.invokeRpc(
                 "opendaylight-inventory:nodes/node/REMOTE_HOST/yang-ext:mount/toaster:cancel-toast",
-                "");
+                "",uriInfo);
         assertEquals(null, output);
 
         //additional validation in the fact that the restconfImpl does not throw an exception.
index 319603dfc14b1f6a4965d6de46e99bf1a6199f8f..3dd3101a2e2a325f8da94cdacef60dbaa0c0add0 100644 (file)
@@ -19,12 +19,10 @@ import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUt
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
-
 import javax.ws.rs.client.Entity;
 import javax.ws.rs.core.Application;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.UriInfo;
-
 import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.test.JerseyTest;
 import org.junit.BeforeClass;
@@ -55,10 +53,10 @@ public class MediaTypesTest extends JerseyTest {
     @Override
     protected Application configure() {
         /* enable/disable Jersey logs to console */
-//        enable(TestProperties.LOG_TRAFFIC);
-//        enable(TestProperties.DUMP_ENTITY);
-//        enable(TestProperties.RECORD_LOG_LEVEL);
-//        set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue());
+        // enable(TestProperties.LOG_TRAFFIC);
+        // enable(TestProperties.DUMP_ENTITY);
+        // enable(TestProperties.RECORD_LOG_LEVEL);
+        // set(TestProperties.RECORD_LOG_LEVEL, Level.ALL.intValue());
         ResourceConfig resourceConfig = new ResourceConfig();
         resourceConfig = resourceConfig.registerInstances(restconfService, StructuredDataToXmlProvider.INSTANCE,
                 StructuredDataToJsonProvider.INSTANCE, XmlToCompositeNodeProvider.INSTANCE,
@@ -66,31 +64,31 @@ public class MediaTypesTest extends JerseyTest {
         return resourceConfig;
     }
 
-  @Test
-  public void testPostOperationsWithInputDataMediaTypes() throws UnsupportedEncodingException {
-      String uriPrefix = "/operations/";
-      String uriPath = "ietf-interfaces:interfaces";
-      String uri = uriPrefix + uriPath;
-      when(restconfService.invokeRpc(eq(uriPath), any(CompositeNode.class))).thenReturn(null);
-      post(uri, Draft02.MediaTypes.OPERATION+JSON, Draft02.MediaTypes.OPERATION+JSON, jsonData);
-      verify(restconfService, times(1)).invokeRpc(eq(uriPath), any(CompositeNode.class));
-      post(uri, Draft02.MediaTypes.OPERATION+XML, Draft02.MediaTypes.OPERATION+XML, xmlData);
-      verify(restconfService, times(2)).invokeRpc(eq(uriPath), any(CompositeNode.class));
-      post(uri, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, jsonData);
-      verify(restconfService, times(3)).invokeRpc(eq(uriPath), any(CompositeNode.class));
-      post(uri, MediaType.APPLICATION_XML, MediaType.APPLICATION_XML, xmlData);
-      verify(restconfService, times(4)).invokeRpc(eq(uriPath), any(CompositeNode.class));
-      post(uri, MediaType.TEXT_XML, MediaType.TEXT_XML, xmlData);
-      verify(restconfService, times(5)).invokeRpc(eq(uriPath), any(CompositeNode.class));
-      post(uri, null, MediaType.TEXT_XML, xmlData);
-      verify(restconfService, times(6)).invokeRpc(eq(uriPath), any(CompositeNode.class));
-
-      // negative tests
-      post(uri, MediaType.TEXT_PLAIN, MediaType.TEXT_XML, xmlData);
-      verify(restconfService, times(6)).invokeRpc(eq(uriPath), any(CompositeNode.class));
-      post(uri, MediaType.TEXT_XML, MediaType.TEXT_PLAIN, xmlData);
-      verify(restconfService, times(6)).invokeRpc(eq(uriPath), any(CompositeNode.class));
-  }
+    @Test
+    public void testPostOperationsWithInputDataMediaTypes() throws UnsupportedEncodingException {
+        String uriPrefix = "/operations/";
+        String uriPath = "ietf-interfaces:interfaces";
+        String uri = uriPrefix + uriPath;
+        when(restconfService.invokeRpc(eq(uriPath), any(CompositeNode.class), any(UriInfo.class))).thenReturn(null);
+        post(uri, Draft02.MediaTypes.OPERATION + JSON, Draft02.MediaTypes.OPERATION + JSON, jsonData);
+        verify(restconfService, times(1)).invokeRpc(eq(uriPath), any(CompositeNode.class), any(UriInfo.class));
+        post(uri, Draft02.MediaTypes.OPERATION + XML, Draft02.MediaTypes.OPERATION + XML, xmlData);
+        verify(restconfService, times(2)).invokeRpc(eq(uriPath), any(CompositeNode.class), any(UriInfo.class));
+        post(uri, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON, jsonData);
+        verify(restconfService, times(3)).invokeRpc(eq(uriPath), any(CompositeNode.class), any(UriInfo.class));
+        post(uri, MediaType.APPLICATION_XML, MediaType.APPLICATION_XML, xmlData);
+        verify(restconfService, times(4)).invokeRpc(eq(uriPath), any(CompositeNode.class), any(UriInfo.class));
+        post(uri, MediaType.TEXT_XML, MediaType.TEXT_XML, xmlData);
+        verify(restconfService, times(5)).invokeRpc(eq(uriPath), any(CompositeNode.class), any(UriInfo.class));
+        post(uri, null, MediaType.TEXT_XML, xmlData);
+        verify(restconfService, times(6)).invokeRpc(eq(uriPath), any(CompositeNode.class), any(UriInfo.class));
+
+        // negative tests
+        post(uri, MediaType.TEXT_PLAIN, MediaType.TEXT_XML, xmlData);
+        verify(restconfService, times(6)).invokeRpc(eq(uriPath), any(CompositeNode.class), any(UriInfo.class));
+        post(uri, MediaType.TEXT_XML, MediaType.TEXT_PLAIN, xmlData);
+        verify(restconfService, times(6)).invokeRpc(eq(uriPath), any(CompositeNode.class), any(UriInfo.class));
+    }
 
     @Test
     public void testGetConfigMediaTypes() throws UnsupportedEncodingException {
@@ -98,9 +96,9 @@ public class MediaTypesTest extends JerseyTest {
         String uriPath = "ietf-interfaces:interfaces";
         String uri = uriPrefix + uriPath;
         when(restconfService.readConfigurationData(eq(uriPath), any(UriInfo.class))).thenReturn(null);
-        get(uri, Draft02.MediaTypes.DATA+JSON);
+        get(uri, Draft02.MediaTypes.DATA + JSON);
         verify(restconfService, times(1)).readConfigurationData(eq(uriPath), any(UriInfo.class));
-        get(uri, Draft02.MediaTypes.DATA+XML);
+        get(uri, Draft02.MediaTypes.DATA + XML);
         verify(restconfService, times(2)).readConfigurationData(eq(uriPath), any(UriInfo.class));
         get(uri, MediaType.APPLICATION_JSON);
         verify(restconfService, times(3)).readConfigurationData(eq(uriPath), any(UriInfo.class));
@@ -120,9 +118,9 @@ public class MediaTypesTest extends JerseyTest {
         String uriPath = "ietf-interfaces:interfaces";
         String uri = uriPrefix + uriPath;
         when(restconfService.readOperationalData(eq(uriPath), any(UriInfo.class))).thenReturn(null);
-        get(uri, Draft02.MediaTypes.DATA+JSON);
+        get(uri, Draft02.MediaTypes.DATA + JSON);
         verify(restconfService, times(1)).readOperationalData(eq(uriPath), any(UriInfo.class));
-        get(uri, Draft02.MediaTypes.DATA+XML);
+        get(uri, Draft02.MediaTypes.DATA + XML);
         verify(restconfService, times(2)).readOperationalData(eq(uriPath), any(UriInfo.class));
         get(uri, MediaType.APPLICATION_JSON);
         verify(restconfService, times(3)).readOperationalData(eq(uriPath), any(UriInfo.class));
@@ -142,9 +140,9 @@ public class MediaTypesTest extends JerseyTest {
         String uriPath = "ietf-interfaces:interfaces";
         String uri = uriPrefix + uriPath;
         when(restconfService.updateConfigurationData(eq(uriPath), any(CompositeNode.class))).thenReturn(null);
-        put(uri, null, Draft02.MediaTypes.DATA+JSON, jsonData);
+        put(uri, null, Draft02.MediaTypes.DATA + JSON, jsonData);
         verify(restconfService, times(1)).updateConfigurationData(eq(uriPath), any(CompositeNode.class));
-        put(uri, null, Draft02.MediaTypes.DATA+XML, xmlData);
+        put(uri, null, Draft02.MediaTypes.DATA + XML, xmlData);
         verify(restconfService, times(2)).updateConfigurationData(eq(uriPath), any(CompositeNode.class));
         put(uri, null, MediaType.APPLICATION_JSON, jsonData);
         verify(restconfService, times(3)).updateConfigurationData(eq(uriPath), any(CompositeNode.class));
@@ -162,9 +160,9 @@ public class MediaTypesTest extends JerseyTest {
         String uriPath = "ietf-interfaces:interfaces";
         String uri = uriPrefix + uriPath;
         when(restconfService.createConfigurationData(eq(uriPath), any(CompositeNode.class))).thenReturn(null);
-        post(uri, null, Draft02.MediaTypes.DATA+JSON, jsonData);
+        post(uri, null, Draft02.MediaTypes.DATA + JSON, jsonData);
         verify(restconfService, times(1)).createConfigurationData(eq(uriPath), any(CompositeNode.class));
-        post(uri, null, Draft02.MediaTypes.DATA+XML, xmlData);
+        post(uri, null, Draft02.MediaTypes.DATA + XML, xmlData);
         verify(restconfService, times(2)).createConfigurationData(eq(uriPath), any(CompositeNode.class));
         post(uri, null, MediaType.APPLICATION_JSON, jsonData);
         verify(restconfService, times(3)).createConfigurationData(eq(uriPath), any(CompositeNode.class));
@@ -181,9 +179,9 @@ public class MediaTypesTest extends JerseyTest {
         String uriPrefix = "/config/";
         String uri = uriPrefix;
         when(restconfService.createConfigurationData(any(CompositeNode.class))).thenReturn(null);
-        post(uri, null, Draft02.MediaTypes.DATA+JSON, jsonData);
+        post(uri, null, Draft02.MediaTypes.DATA + JSON, jsonData);
         verify(restconfService, times(1)).createConfigurationData(any(CompositeNode.class));
-        post(uri, null, Draft02.MediaTypes.DATA+XML, xmlData);
+        post(uri, null, Draft02.MediaTypes.DATA + XML, xmlData);
         verify(restconfService, times(2)).createConfigurationData(any(CompositeNode.class));
         post(uri, null, MediaType.APPLICATION_JSON, jsonData);
         verify(restconfService, times(3)).createConfigurationData(any(CompositeNode.class));
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/MultipleEqualNamesForDataNodesTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/MultipleEqualNamesForDataNodesTest.java
new file mode 100644 (file)
index 0000000..4213102
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * 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.restconf.impl.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+import java.util.Set;
+import javax.ws.rs.ext.MessageBodyReader;
+import org.junit.Test;
+import org.opendaylight.controller.sal.rest.impl.JsonToCompositeNodeProvider;
+import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider;
+import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
+import org.opendaylight.controller.sal.restconf.impl.RestconfError;
+import org.opendaylight.controller.sal.restconf.impl.RestconfError.ErrorTag;
+import org.opendaylight.controller.sal.restconf.impl.RestconfError.ErrorType;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.model.api.Module;
+
+/**
+ * If more then one data element with equal name exists where container or
+ * leaf schema node should be present the RestconfDocumentedException has to
+ * be raised
+ *
+ * Tests for BUG 1204
+ */
+public class MultipleEqualNamesForDataNodesTest {
+
+    @Test
+    public void multipleEqualNameDataNodeTestForContainerJsonTest() {
+        multipleEqualNameDataNodeTest("/equal-data-node-names/equal-name-data-for-container.json", ErrorType.APPLICATION,
+                ErrorTag.BAD_ELEMENT,JsonToCompositeNodeProvider.INSTANCE);
+    }
+
+    @Test
+    public void multipleEqualNameDataNodeTestForLeafJsonTest() {
+        multipleEqualNameDataNodeTest("/equal-data-node-names/equal-name-data-for-leaf.json", ErrorType.PROTOCOL,
+                ErrorTag.MALFORMED_MESSAGE,JsonToCompositeNodeProvider.INSTANCE);
+    }
+
+    @Test
+    public void multipleEqualNameDataNodeTestForContainerXmlTest() {
+        multipleEqualNameDataNodeTest("/equal-data-node-names/equal-name-data-for-container.xml", ErrorType.APPLICATION,
+                ErrorTag.BAD_ELEMENT,XmlToCompositeNodeProvider.INSTANCE);
+    }
+
+    @Test
+    public void multipleEqualNameDataNodeTestForLeafXmlTest() {
+        multipleEqualNameDataNodeTest("/equal-data-node-names/equal-name-data-for-leaf.xml", ErrorType.APPLICATION,
+                ErrorTag.BAD_ELEMENT,XmlToCompositeNodeProvider.INSTANCE);
+    }
+
+    private void multipleEqualNameDataNodeTest(String path, ErrorType errorType, ErrorTag errorTag,MessageBodyReader<CompositeNode> messageBodyReader) {
+        try {
+            CompositeNode compositeNode = TestUtils.readInputToCnSn(path, false,messageBodyReader);
+            assertNotNull(compositeNode);
+
+            Set<Module> modules = null;
+            modules = TestUtils.loadModulesFrom("/equal-data-node-names/yang");
+            assertNotNull(modules);
+
+            TestUtils.normalizeCompositeNode(compositeNode, modules, "equal-data-node-names" + ":" + "cont");
+            fail("Exception RestconfDocumentedException should be raised");
+        } catch (RestconfDocumentedException e) {
+            List<RestconfError> errors = e.getErrors();
+            assertNotNull(errors);
+
+            assertEquals(1, errors.size());
+
+            RestconfError restconfError = errors.get(0);
+
+            assertEquals(errorType, restconfError.getErrorType());
+            assertEquals(errorTag, restconfError.getErrorTag());
+        }
+    }
+
+}
index 41a1c3827d21973180e01b7fd3cb11e2e73f993c..9fd5128d19b51db4c71ad3678dae982aec1b3551 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.controller.sal.restconf.impl.test;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -16,6 +17,8 @@ import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import java.io.FileNotFoundException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
@@ -29,14 +32,12 @@ import java.util.List;
 import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-
 import javax.ws.rs.core.Application;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedHashMap;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
-
 import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.test.JerseyTest;
 import org.junit.BeforeClass;
@@ -68,9 +69,6 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
 public class RestGetOperationTest extends JerseyTest {
 
     static class NodeData {
@@ -615,6 +613,39 @@ public class RestGetOperationTest extends JerseyTest {
         return null;
     }
 
+    /**
+     * If includeWhiteChars URI parameter is set to false then no white
+     * characters can be included in returned output
+     * @throws UnsupportedEncodingException
+     */
+    @Test
+    public void getDataWithUriIncludeWhiteCharsParameterTest() throws UnsupportedEncodingException {
+        getDataWithUriIncludeWhiteCharsParameter("config");
+        getDataWithUriIncludeWhiteCharsParameter("operational");
+    }
+
+
+    private void getDataWithUriIncludeWhiteCharsParameter(String target) throws UnsupportedEncodingException {
+        mockReadConfigurationDataMethod();
+        String uri = "/"+target+"/ietf-interfaces:interfaces/interface/eth0";
+        Response response = target(uri).queryParam("prettyPrint", "false").request("application/xml").get();
+        String xmlData = response.readEntity(String.class);
+
+        Pattern pattern = Pattern.compile(".*(>\\s+|\\s+<).*", Pattern.DOTALL);
+        Matcher matcher = pattern.matcher(xmlData);
+        // XML element can't surrounded with white character (e.g ">    " or
+        // "    <")
+        assertFalse(matcher.matches());
+
+        response = target(uri).queryParam("prettyPrint", "false").request("application/json").get();
+        String jsonData = response.readEntity(String.class);
+        pattern = Pattern.compile(".*(\\}\\s+|\\s+\\{|\\]\\s+|\\s+\\[|\\s+:|:\\s+).*", Pattern.DOTALL);
+        matcher = pattern.matcher(jsonData);
+        // JSON element can't surrounded with white character (e.g "} ", " {",
+        // "] ", " [", " :" or ": ")
+        assertFalse(matcher.matches());
+    }
+
     @Test
     public void getDataWithUriDepthParameterTest() throws UnsupportedEncodingException {
 
index 853c19f93530c16449840b1043ac07d30edaab4f..449b79923edd40e0c21f922ba3ff6c271e45d3c5 100644 (file)
@@ -13,6 +13,7 @@ import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
+import com.google.common.base.Preconditions;
 import java.io.BufferedReader;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -27,7 +28,8 @@ import java.sql.Date;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
-
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.ext.MessageBodyReader;
 import javax.ws.rs.ext.MessageBodyWriter;
@@ -40,7 +42,6 @@ import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
-
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.sal.restconf.impl.BrokerFacade;
 import org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper;
@@ -61,8 +62,6 @@ import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
-import com.google.common.base.Preconditions;
-
 public final class TestUtils {
 
     private static final Logger LOG = LoggerFactory.getLogger(TestUtils.class);
@@ -297,6 +296,22 @@ public final class TestUtils {
         }
         bufReader.close();
         return result.toString();
+    }
+
+    private static Pattern patternForStringsSeparatedByWhiteChars(String ... substrings ) {
+        StringBuilder pattern = new StringBuilder();
+        pattern.append(".*");
+        for (String substring : substrings) {
+            pattern.append(substring);
+            pattern.append("\\s*");
+        }
+        pattern.append(".*");
+        return Pattern.compile(pattern.toString(), Pattern.DOTALL);
+    }
 
+    public static boolean containsStringData(String jsonOutput,String ...substrings ) {
+        Pattern pattern = patternForStringsSeparatedByWhiteChars(substrings);
+        Matcher matcher = pattern.matcher(jsonOutput);
+        return matcher.matches();
     }
 }
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/equal-data-node-names/equal-name-data-for-container.json b/opendaylight/md-sal/sal-rest-connector/src/test/resources/equal-data-node-names/equal-name-data-for-container.json
new file mode 100644 (file)
index 0000000..78b097d
--- /dev/null
@@ -0,0 +1,16 @@
+{
+    "cont":{
+        "cont1":[
+            {
+                "lst11":{
+                    "lf111":"value1"
+                }
+            },
+            {
+                "lst11":{
+                    "lf111":"value2"
+                }
+            }
+        ]
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/equal-data-node-names/equal-name-data-for-container.xml b/opendaylight/md-sal/sal-rest-connector/src/test/resources/equal-data-node-names/equal-name-data-for-container.xml
new file mode 100644 (file)
index 0000000..26a1f5f
--- /dev/null
@@ -0,0 +1,12 @@
+<cont>
+    <cont1>
+        <lst11>
+            <lf111>value1</lf111>
+        </lst11>
+    </cont1>
+    <cont1>
+        <lst11>
+            <lf111>value1</lf111>
+        </lst11>
+    </cont1>
+</cont>
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/equal-data-node-names/equal-name-data-for-leaf.json b/opendaylight/md-sal/sal-rest-connector/src/test/resources/equal-data-node-names/equal-name-data-for-leaf.json
new file mode 100644 (file)
index 0000000..d0a9fd4
--- /dev/null
@@ -0,0 +1,15 @@
+{
+    "cont":{
+        "cont1":{
+            "lst11":[
+             {
+                "lf111":"value1",
+                "lf111":"value2"
+             },
+             {
+                "lf111":"value3"
+             }
+             ]
+         }
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/equal-data-node-names/equal-name-data-for-leaf.xml b/opendaylight/md-sal/sal-rest-connector/src/test/resources/equal-data-node-names/equal-name-data-for-leaf.xml
new file mode 100644 (file)
index 0000000..4221c2d
--- /dev/null
@@ -0,0 +1,11 @@
+<cont>
+    <cont1>
+        <lst11>
+          <lf111>value1</lf111>,
+          <lf111>value2</lf111>,
+        </lst11>
+        <lst11>
+          <lf111>value3</lf111>,
+        </lst11>
+    </cont1>
+</cont>
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/equal-data-node-names/yang/equal-data-node-names.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/equal-data-node-names/yang/equal-data-node-names.yang
new file mode 100644 (file)
index 0000000..3a3653a
--- /dev/null
@@ -0,0 +1,18 @@
+/* bug 1204 */
+module equal-data-node-names {
+  namespace "ns:equal:data:node:names";
+
+  prefix "eqdanona";
+  revision 2014-06-26 {
+  }
+
+  container cont {
+    container cont1 {
+        list lst11 {
+            leaf lf111 {
+                type string;
+            }
+        }
+    }
+  }
+}
\ No newline at end of file
index 10d964d6449595e13971a80428046ac6508871a2..b886fc9da9621459dc12531c22ea1d6ac9d360e2 100644 (file)
@@ -1,5 +1,5 @@
 {
-       "cont": {       
-               "lf":                           
-       }
+    "cont": {
+        "lf":
+    }
 }
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/resources/multiple-nodes/multiple-nodes.yang b/opendaylight/md-sal/sal-rest-connector/src/test/resources/multiple-nodes/multiple-nodes.yang
new file mode 100644 (file)
index 0000000..22a1dae
--- /dev/null
@@ -0,0 +1,17 @@
+module multiple-nodes {
+    namespace "multiple:nodes";
+    prefix "mod1";
+    revision "2014-06-23";
+
+    container cont {
+        container cont1 {
+            leaf lf11 {
+                type string;
+            }
+        }
+
+        leaf lf1 {
+            type string;
+        }
+    }
+}
\ No newline at end of file
index 755ca7501582e43651d51046de5a057d5adbe038..8bac0d211e71cb2d88969c72d9b3f21a9fb00919 100644 (file)
@@ -14,7 +14,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-
 import org.apache.commons.lang3.BooleanUtils;
 import org.json.JSONArray;
 import org.json.JSONException;
@@ -26,6 +25,7 @@ import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
@@ -86,6 +86,8 @@ public class ModelGenerator {
     private static final String NUMBER = "number";
     private static final String BOOLEAN = "boolean";
     private static final String STRING = "string";
+  private static final String ID_KEY = "id";
+  private static final String SUB_TYPES_KEY = "subTypes";
 
     private static final Map<Class<? extends TypeDefinition<?>>, String> YANG_TYPE_TO_JSON_TYPE_MAPPING;
 
@@ -116,6 +118,7 @@ public class ModelGenerator {
         JSONObject models = new JSONObject();
         processContainers(module, models);
         processRPCs(module, models);
+    processIdentities(module, models);
         return models;
     }
 
@@ -188,6 +191,58 @@ public class ModelGenerator {
         }
     }
 
+  /**
+   * Processes the 'identity' statement in a yang model
+   * and maps it to a 'model' in the Swagger JSON spec.
+   *
+   * @param module The module from which the identity stmt will be processed
+   * @param models The JSONObject in which the parsed identity will be put as a 'model' obj
+   * @throws JSONException
+   */
+  private void processIdentities(Module module, JSONObject models) throws JSONException {
+
+    String moduleName = module.getName();
+    Set<IdentitySchemaNode> idNodes =  module.getIdentities();
+    _logger.debug("Processing Identities for module {} . Found {} identity statements", moduleName, idNodes.size());
+
+    for(IdentitySchemaNode idNode : idNodes){
+      JSONObject identityObj=new JSONObject();
+      String identityName = idNode.getQName().getLocalName();
+      _logger.debug("Processing Identity: {}", identityName);
+
+      identityObj.put(ID_KEY, identityName);
+      identityObj.put(DESCRIPTION_KEY, idNode.getDescription());
+
+      JSONObject props = new JSONObject();
+      IdentitySchemaNode baseId = idNode.getBaseIdentity();
+
+
+      if(baseId==null) {
+        /**
+         * This is a base identity. So lets see if
+         * it has sub types. If it does, then add them to the model definition.
+         */
+        Set<IdentitySchemaNode> derivedIds = idNode.getDerivedIdentities();
+
+        if(derivedIds != null) {
+          JSONArray subTypes = new JSONArray();
+          for(IdentitySchemaNode derivedId : derivedIds){
+            subTypes.put(derivedId.getQName().getLocalName());
+          }
+          identityObj.put(SUB_TYPES_KEY, subTypes);
+        }
+      } else {
+        /**
+         * This is a derived entity. Add it's base type & move on.
+         */
+        props.put(TYPE_KEY, baseId.getQName().getLocalName());
+      }
+
+      //Add the properties. For a base type, this will be an empty object as required by the Swagger spec.
+      identityObj.put(PROPERTIES_KEY, props);
+      models.put(identityName, identityObj);
+    }
+  }
     /**
      * Processes the container node and populates the moduleJSON
      *
@@ -446,7 +501,7 @@ public class ModelGenerator {
             processUnionType((UnionTypeDefinition) leafTypeDef, property);
 
         } else if (leafTypeDef instanceof IdentityrefTypeDefinition) {
-            property.putOpt(TYPE_KEY, "object");
+      property.putOpt(TYPE_KEY, ((IdentityrefTypeDefinition) leafTypeDef).getIdentity().getQName().getLocalName());
         } else if (leafTypeDef instanceof BinaryTypeDefinition) {
             processBinaryType((BinaryTypeDefinition) leafTypeDef, property);
         } else {
diff --git a/opendaylight/md-sal/sal-test-model/pom.xml b/opendaylight/md-sal/sal-test-model/pom.xml
new file mode 100644 (file)
index 0000000..8d29b98
--- /dev/null
@@ -0,0 +1,77 @@
+<?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">
+    <parent>
+        <artifactId>sal-parent</artifactId>
+        <groupId>org.opendaylight.controller</groupId>
+        <version>1.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-binding</artifactId>
+        </dependency>
+    </dependencies>
+
+    <artifactId>sal-test-model</artifactId>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.jacoco</groupId>
+                <artifactId>jacoco-maven-plugin</artifactId>
+                <configuration>
+                    <includes>
+                        <include>org.opendaylight.controller.*</include>
+                    </includes>
+                </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.opendaylight.yangtools</groupId>
+                <artifactId>yang-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>generate-sources</goal>
+                        </goals>
+                        <configuration>
+                            <codeGenerators>
+                                <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</url>
+    </scm>
+
+</project>
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-test-model/src/main/yang/opendaylight-mdsal-list-test.yang b/opendaylight/md-sal/sal-test-model/src/main/yang/opendaylight-mdsal-list-test.yang
new file mode 100644 (file)
index 0000000..48666e1
--- /dev/null
@@ -0,0 +1,51 @@
+module opendaylight-mdsal-list-test {
+
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:test:list";
+    prefix list-test;
+
+
+    description
+        "This module contains a collection of YANG definitions used for
+        some test cases.";
+
+    revision 2014-07-01 {
+        description
+        "Test model for testing data broker with nested lists.";
+    }
+
+    grouping two-level-list {
+        list top-level-list {
+            description
+                "Top Level List";
+            key "name";
+            leaf name {
+                type string;
+            }
+            list nested-list {
+                key "name";
+                leaf name {
+                    type string;
+                }
+                leaf type {
+                    type string;
+                    mandatory true;
+                    description
+                        "Mandatory type of list.";
+                }
+                ordered-by user;
+                description
+                    "A list of service functions that compose the service chain";
+            }
+        }
+    }
+
+    container top {
+        uses two-level-list;
+    }
+
+    rpc put-top {
+        input {
+            uses two-level-list;
+        }
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-test-model/src/main/yang/opendaylight-test-rpc-service.yang b/opendaylight/md-sal/sal-test-model/src/main/yang/opendaylight-test-rpc-service.yang
new file mode 100644 (file)
index 0000000..3412eb5
--- /dev/null
@@ -0,0 +1,22 @@
+module opendaylight-test-rpc-service {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:test:bi:ba:rpcservice";
+    prefix "rpc";
+
+    description
+        "Test model for testing of registering rpc service on binding independent mount point 
+        and retrieving rpc service via binding aware mount point.";
+
+    revision "2014-07-01" {
+        description
+            "Initial revision";
+    }
+
+    rpc rock-the-house {
+        input {
+            leaf zip-code {
+                type string;
+            }
+        }
+    }
+}
\ No newline at end of file
index f6a8306a98b6a71650ffcbc7b06a331a184dbd32..6e720299d8364e21d058e9603f86e33544697b1d 100644 (file)
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>config-api</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-common-util</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal-binding-api</artifactId>
index a23def6262a0af8e6938f59c4f7a92e3c14b0eb7..88281bd59369858f8818adfa75b741e4d4fea367 100644 (file)
@@ -9,6 +9,8 @@
  */
 package org.opendaylight.controller.config.yang.config.kitchen_service.impl;
 
+import java.util.concurrent.Future;
+
 import org.opendaylight.controller.sample.kitchen.api.EggsType;
 import org.opendaylight.controller.sample.kitchen.api.KitchenService;
 import org.opendaylight.controller.sample.kitchen.impl.KitchenServiceImpl;
@@ -16,6 +18,7 @@ import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterService;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.NotificationListener;
+import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -63,7 +66,9 @@ public final class KitchenServiceModule extends AbstractKitchenServiceModule {
             }
 
             @Override
-            public boolean makeBreakfast( final EggsType eggs, final Class<? extends ToastType> toast, final int toastDoneness ) {
+            public Future<RpcResult<Void>> makeBreakfast( final EggsType eggs,
+                                                          final Class<? extends ToastType> toast,
+                                                          final int toastDoneness ) {
                 return kitchenService.makeBreakfast( eggs, toast, toastDoneness );
             }
         }
index ef9c122ec1fb314a32d16e5566ca2275db7b5cd9..7e7f342962cba09a7204aa046b9126b77d46d33a 100644 (file)
@@ -1,7 +1,11 @@
 package org.opendaylight.controller.sample.kitchen.api;
 
+import java.util.concurrent.Future;
+
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToastType;
+import org.opendaylight.yangtools.yang.common.RpcResult;
 
 public interface KitchenService {
-    boolean makeBreakfast( EggsType eggs, Class<? extends ToastType> toast, int toastDoneness );
+    Future<RpcResult<Void>> makeBreakfast( EggsType eggs, Class<? extends ToastType> toast,
+                                           int toastDoneness );
 }
index 911a8c87d7166edc38c7faa2597678c8f55c611a..50ae8fd04fcce09c66a9eb7dd512af433df058d7 100644 (file)
@@ -1,10 +1,18 @@
 package org.opendaylight.controller.sample.kitchen.impl;
 
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
-
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
 import org.opendaylight.controller.config.yang.config.kitchen_service.impl.KitchenServiceRuntimeMXBean;
+import org.opendaylight.controller.sal.common.util.RpcErrors;
+import org.opendaylight.controller.sal.common.util.Rpcs;
 import org.opendaylight.controller.sample.kitchen.api.EggsType;
 import org.opendaylight.controller.sample.kitchen.api.KitchenService;
+import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastInput;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastInputBuilder;
 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.ToasterListener;
@@ -12,16 +20,31 @@ import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterRestocked;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterService;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.WheatBread;
+import org.opendaylight.yangtools.yang.common.RpcError.ErrorSeverity;
+import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
+import com.google.common.util.concurrent.AsyncFunction;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.JdkFutureAdapters;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
+
 public class KitchenServiceImpl implements KitchenService, KitchenServiceRuntimeMXBean, ToasterListener {
 
     private static final Logger log = LoggerFactory.getLogger( KitchenServiceImpl.class );
 
     private final ToasterService toaster;
 
+    private final ListeningExecutorService executor =
+                                   MoreExecutors.listeningDecorator( Executors.newCachedThreadPool() );
+
     private volatile boolean toasterOutOfBread;
 
     public KitchenServiceImpl(ToasterService toaster) {
@@ -29,39 +52,102 @@ public class KitchenServiceImpl implements KitchenService, KitchenServiceRuntime
     }
 
     @Override
-    public boolean makeBreakfast( EggsType eggs, Class<? extends ToastType> toast, int toastDoneness ) {
+    public Future<RpcResult<Void>> makeBreakfast( EggsType eggsType, Class<? extends ToastType> toastType,
+                                                  int toastDoneness ) {
+
+        // Call makeToast and use JdkFutureAdapters to convert the Future to a ListenableFuture,
+        // The OpendaylightToaster impl already returns a ListenableFuture so the conversion is
+        // actually a no-op.
+
+        ListenableFuture<RpcResult<Void>> makeToastFuture = JdkFutureAdapters.listenInPoolThread(
+                makeToast( toastType, toastDoneness ), executor );
+
+        ListenableFuture<RpcResult<Void>> makeEggsFuture = makeEggs( eggsType );
+
+        // Combine the 2 ListenableFutures into 1 containing a list of RpcResults.
+
+        ListenableFuture<List<RpcResult<Void>>> combinedFutures =
+                Futures.allAsList( ImmutableList.of( makeToastFuture, makeEggsFuture ) );
+
+        // Then transform the RpcResults into 1.
+
+        return Futures.transform( combinedFutures,
+            new AsyncFunction<List<RpcResult<Void>>,RpcResult<Void>>() {
+                @Override
+                public ListenableFuture<RpcResult<Void>> apply( List<RpcResult<Void>> results )
+                                                                                 throws Exception {
+                    boolean atLeastOneSucceeded = false;
+                    Builder<RpcError> errorList = ImmutableList.builder();
+                    for( RpcResult<Void> result: results ) {
+                        if( result.isSuccessful() ) {
+                            atLeastOneSucceeded = true;
+                        }
+
+                        if( result.getErrors() != null ) {
+                            errorList.addAll( result.getErrors() );
+                        }
+                    }
+
+                    return Futures.immediateFuture(
+                              Rpcs.<Void> getRpcResult( atLeastOneSucceeded, errorList.build() ) );
+                }
+        } );
+    }
+
+    private ListenableFuture<RpcResult<Void>> makeEggs( EggsType eggsType ) {
+
+        return executor.submit( new Callable<RpcResult<Void>>() {
+
+            @Override
+            public RpcResult<Void> call() throws Exception {
+
+                // We don't actually do anything here - just return a successful result.
+                return Rpcs.<Void> getRpcResult( true, Collections.<RpcError>emptyList() );
+            }
+        } );
+    }
+
+    private Future<RpcResult<Void>> makeToast( Class<? extends ToastType> toastType,
+                                               int toastDoneness ) {
 
         if( toasterOutOfBread )
         {
             log.info( "We're out of toast but we can make eggs" );
-            return true;
+            return Futures.immediateFuture( Rpcs.<Void> getRpcResult( true,
+                       Arrays.asList( RpcErrors.getRpcError( "", "partial-operation", null,
+                                          ErrorSeverity.WARNING,
+                                          "Toaster is out of bread but we can make you eggs",
+                                          ErrorType.APPLICATION, null ) ) ) );
         }
 
         // Access the ToasterService to make the toast.
-        // We don't actually make the eggs for this example - sorry.
-        MakeToastInputBuilder toastInput = new MakeToastInputBuilder();
-        toastInput.setToasterDoneness( (long) toastDoneness);
-        toastInput.setToasterToastType( toast );
 
-        try {
-            RpcResult<Void> result = toaster.makeToast( toastInput.build() ).get();
+        MakeToastInput toastInput = new MakeToastInputBuilder()
+            .setToasterDoneness( (long) toastDoneness )
+            .setToasterToastType( toastType )
+            .build();
+
+        return toaster.makeToast( toastInput );
+    }
 
+    @Override
+    public Boolean makeScrambledWithWheat() {
+        try {
+            // This call has to block since we must return a result to the JMX client.
+            RpcResult<Void> result = makeBreakfast( EggsType.SCRAMBLED, WheatBread.class, 2 ).get();
             if( result.isSuccessful() ) {
-                log.info( "makeToast succeeded" );
+                log.info( "makeBreakfast succeeded" );
             } else {
-                log.warn( "makeToast failed: " + result.getErrors() );
+                log.warn( "makeBreakfast failed: " + result.getErrors() );
             }
 
             return result.isSuccessful();
+
         } catch( InterruptedException | ExecutionException e ) {
-            log.warn( "Error occurred during toast creation" );
+            log.warn( "An error occurred while maing breakfast: " + e );
         }
-        return false;
-    }
 
-    @Override
-    public Boolean makeScrambledWithWheat() {
-        return makeBreakfast( EggsType.SCRAMBLED, WheatBread.class, 2 );
+        return Boolean.FALSE;
     }
 
     /**
index 907b35475f80f3565e18d2965885ff505bb55d6e..30f1762197ecf58a35c8828775dfb009742a7025 100644 (file)
@@ -93,13 +93,13 @@ public class ToasterTest {
         long toastsMade = (long) platformMBeanServer.getAttribute(providerOn, "ToastsMade");
         assertEquals(0, toastsMade);
 
-        boolean toasts = true;
+        boolean success = true;
 
         // Make toasts using OSGi service
-        toasts &= kitchenService.makeBreakfast( EggsType.SCRAMBLED, HashBrown.class, 4);
-        toasts &= kitchenService.makeBreakfast( EggsType.POACHED, WhiteBread.class, 8 );
+        success &= kitchenService.makeBreakfast( EggsType.SCRAMBLED, HashBrown.class, 4).get().isSuccessful();
+        success &= kitchenService.makeBreakfast( EggsType.POACHED, WhiteBread.class, 8 ).get().isSuccessful();
 
-        Assert.assertTrue("Not all toasts done by " + kitchenService, toasts);
+        Assert.assertTrue("Not all breakfasts succeeded", success);
 
         // Verify toasts made count on provider via JMX/config-subsystem
         toastsMade = (long) platformMBeanServer.getAttribute(providerOn, "ToastsMade");
index f904f9726efce6c236526f318654fab49a81f49a..d76c2d3c22a415628beccef2eb9af4c36035840d 100644 (file)
@@ -10,7 +10,9 @@
 
   <logger name="org.opendaylight.yangtools.yang.parser" level="ERROR"/>
 
-  <root level="debug">
+  <logger name="org.opendaylight.controller.sample.toaster.provider" level="DEBUG"/>
+
+  <root level="error">
     <appender-ref ref="STDOUT" />
   </root>
 </configuration>
index ec352e8f510dad03911be2ad2eeb0ec6a5c44542..d2b0f90194a9a066558f6d4dca5d1d8751ec01aa 100644 (file)
@@ -9,19 +9,24 @@ package org.opendaylight.controller.sample.toaster.provider;
 
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.List;
 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.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
 
 import org.opendaylight.controller.config.yang.config.toaster_provider.impl.ToasterProviderRuntimeMXBean;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
+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.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.OptimisticLockFailedException;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.controller.sal.common.util.RpcErrors;
 import org.opendaylight.controller.sal.common.util.Rpcs;
@@ -44,7 +49,13 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.AsyncFunction;
+import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.SettableFuture;
 
 public class OpendaylightToaster implements ToasterService, ToasterProviderRuntimeMXBean,
                                             DataChangeListener, AutoCloseable {
@@ -61,10 +72,9 @@ public class OpendaylightToaster implements ToasterService, ToasterProviderRunti
 
     private final ExecutorService executor;
 
-    // As you will see we are using multiple threads here. Therefore we need to be careful about concurrency.
-    // In this case we use the taskLock to provide synchronization for the current task.
-    private volatile Future<RpcResult<Void>> currentTask;
-    private final Object taskLock = new Object();
+    // The following holds the Future for the current make toast task.
+    // This is used to cancel the current toast.
+    private final AtomicReference<Future<?>> currentMakeToastTask = new AtomicReference<>();
 
     private final AtomicLong amountOfBreadInStock = new AtomicLong( 100 );
 
@@ -83,7 +93,7 @@ public class OpendaylightToaster implements ToasterService, ToasterProviderRunti
 
     public void setDataProvider(final DataBroker salDataProvider) {
         this.dataProvider = salDataProvider;
-        updateStatus();
+        setToasterStatusUp( null );
     }
 
     /**
@@ -97,22 +107,30 @@ public class OpendaylightToaster implements ToasterService, ToasterProviderRunti
         if (dataProvider != null) {
             WriteTransaction t = dataProvider.newWriteOnlyTransaction();
             t.delete(LogicalDatastoreType.OPERATIONAL,TOASTER_IID);
-            t.commit().get(); // FIXME: This call should not be blocking.
+            ListenableFuture<RpcResult<TransactionStatus>> future = t.commit();
+            Futures.addCallback( future, new FutureCallback<RpcResult<TransactionStatus>>() {
+                @Override
+                public void onSuccess( RpcResult<TransactionStatus> result ) {
+                    LOG.debug( "Delete Toaster commit result: " + result );
+                }
+
+                @Override
+                public void onFailure( Throwable t ) {
+                    LOG.error( "Delete of Toaster failed", t );
+                }
+            } );
         }
     }
 
-    private Toaster buildToaster() {
-        // We don't need to synchronize on currentTask here b/c it's declared volatile and
-        // we're just doing a read.
-        boolean isUp = currentTask == null;
+    private Toaster buildToaster( ToasterStatus status ) {
 
         // note - we are simulating a device whose manufacture and model are
         // fixed (embedded) into the hardware.
         // This is why the manufacture and model number are hardcoded.
-        ToasterBuilder tb = new ToasterBuilder();
-        tb.setToasterManufacturer(TOASTER_MANUFACTURER).setToasterModelNumber(TOASTER_MODEL_NUMBER)
-                .setToasterStatus(isUp ? ToasterStatus.Up : ToasterStatus.Down);
-        return tb.build();
+        return new ToasterBuilder().setToasterManufacturer( TOASTER_MANUFACTURER )
+                                   .setToasterModelNumber( TOASTER_MODEL_NUMBER )
+                                   .setToasterStatus( status )
+                                   .build();
     }
 
     /**
@@ -133,57 +151,148 @@ public class OpendaylightToaster implements ToasterService, ToasterProviderRunti
     }
 
     /**
-     * RestConf RPC call implemented from the ToasterService interface.
+     * RPC call implemented from the ToasterService interface that cancels the current
+     * toast, if any.
      */
     @Override
     public Future<RpcResult<Void>> cancelToast() {
-        synchronized (taskLock) {
-            if (currentTask != null) {
-                currentTask.cancel(true);
-                currentTask = null;
-            }
+
+        Future<?> current = currentMakeToastTask.getAndSet( null );
+        if( current != null ) {
+            current.cancel( true );
         }
+
         // Always return success from the cancel toast call.
-        return Futures.immediateFuture(Rpcs.<Void> getRpcResult(true, Collections.<RpcError> emptySet()));
+        return Futures.immediateFuture( Rpcs.<Void> getRpcResult( true,
+                                        Collections.<RpcError>emptyList() ) );
     }
 
     /**
-     * RestConf RPC call implemented from the ToasterService interface.
+     * RPC call implemented from the ToasterService interface that attempts to make toast.
      */
     @Override
     public Future<RpcResult<Void>> makeToast(final MakeToastInput input) {
         LOG.info("makeToast: " + input);
 
-        synchronized (taskLock) {
-            if (currentTask != null) {
-                // return an error since we are already toasting some toast.
-                LOG.info( "Toaster is already making toast" );
+        final SettableFuture<RpcResult<Void>> futureResult = SettableFuture.create();
 
-                RpcResult<Void> result = Rpcs.<Void> getRpcResult(false, null, Arrays.asList(
-                        RpcErrors.getRpcError( "", "in-use", null, ErrorSeverity.WARNING,
-                                               "Toaster is busy", ErrorType.APPLICATION, null ) ) );
-                return Futures.immediateFuture(result);
-            }
-            else if( outOfBread() ) {
-                RpcResult<Void> result = Rpcs.<Void> getRpcResult(false, null, Arrays.asList(
-                        RpcErrors.getRpcError( "out-of-stock", "resource-denied", null, null,
-                                               "Toaster is out of bread",
-                                               ErrorType.APPLICATION, null ) ) );
-                return Futures.immediateFuture(result);
-            }
-            else {
-                // Notice that we are moving the actual call to another thread,
-                // allowing this thread to return immediately.
-                // The MD-SAL design encourages asynchronus programming. If the
-                // caller needs to block until the call is
-                // complete then they can leverage the blocking methods on the
-                // Future interface.
-                currentTask = executor.submit(new MakeToastTask(input));
+        checkStatusAndMakeToast( input, futureResult );
+
+        return futureResult;
+    }
+
+    private List<RpcError> makeToasterOutOfBreadError() {
+        return Arrays.asList(
+                RpcErrors.getRpcError( "out-of-stock", "resource-denied", null, null,
+                                       "Toaster is out of bread",
+                                       ErrorType.APPLICATION, null ) );
+    }
+
+    private List<RpcError> makeToasterInUseError() {
+        return Arrays.asList(
+            RpcErrors.getRpcError( "", "in-use", null, ErrorSeverity.WARNING,
+                                   "Toaster is busy", ErrorType.APPLICATION, null ) );
+    }
+
+    private void checkStatusAndMakeToast( final MakeToastInput input,
+                                          final SettableFuture<RpcResult<Void>> futureResult ) {
+
+        // Read the ToasterStatus and, if currently Up, try to write the status to Down.
+        // If that succeeds, then we essentially have an exclusive lock and can proceed
+        // to make toast.
+
+        final ReadWriteTransaction tx = dataProvider.newReadWriteTransaction();
+        ListenableFuture<Optional<DataObject>> readFuture =
+                                          tx.read( LogicalDatastoreType.OPERATIONAL, TOASTER_IID );
+
+        final ListenableFuture<RpcResult<TransactionStatus>> commitFuture =
+            Futures.transform( readFuture, new AsyncFunction<Optional<DataObject>,
+                                                                   RpcResult<TransactionStatus>>() {
+
+                @Override
+                public ListenableFuture<RpcResult<TransactionStatus>> apply(
+                        Optional<DataObject> toasterData ) throws Exception {
+
+                    ToasterStatus toasterStatus = ToasterStatus.Up;
+                    if( toasterData.isPresent() ) {
+                        toasterStatus = ((Toaster)toasterData.get()).getToasterStatus();
+                    }
+
+                    LOG.debug( "Read toaster status: {}", toasterStatus );
+
+                    if( toasterStatus == ToasterStatus.Up ) {
+
+                        if( outOfBread() ) {
+                            LOG.debug( "Toaster is out of bread" );
+
+                            return Futures.immediateFuture( Rpcs.<TransactionStatus>getRpcResult(
+                                       false, null, makeToasterOutOfBreadError() ) );
+                        }
+
+                        LOG.debug( "Setting Toaster status to Down" );
+
+                        // We're not currently making toast - try to update the status to Down
+                        // to indicate we're going to make toast. This acts as a lock to prevent
+                        // concurrent toasting.
+                        tx.put( LogicalDatastoreType.OPERATIONAL, TOASTER_IID,
+                                buildToaster( ToasterStatus.Down ) );
+                        return tx.commit();
+                    }
+
+                    LOG.debug( "Oops - already making toast!" );
+
+                    // Return an error since we are already making toast. This will get
+                    // propagated to the commitFuture below which will interpret the null
+                    // TransactionStatus in the RpcResult as an error condition.
+                    return Futures.immediateFuture( Rpcs.<TransactionStatus>getRpcResult(
+                            false, null, makeToasterInUseError() ) );
+                }
+        } );
+
+        Futures.addCallback( commitFuture, new FutureCallback<RpcResult<TransactionStatus>>() {
+            @Override
+            public void onSuccess( RpcResult<TransactionStatus> result ) {
+                if( result.getResult() == TransactionStatus.COMMITED  ) {
+
+                    // OK to make toast
+                    currentMakeToastTask.set( executor.submit(
+                                                    new MakeToastTask( input, futureResult ) ) );
+                } else {
+
+                    LOG.debug( "Setting error result" );
+
+                    // Either the transaction failed to commit for some reason or, more likely,
+                    // the read above returned ToasterStatus.Down. Either way, fail the
+                    // futureResult and copy the errors.
+
+                    futureResult.set( Rpcs.<Void>getRpcResult( false, null, result.getErrors() ) );
+                }
             }
-        }
 
-        updateStatus();
-        return currentTask;
+            @Override
+            public void onFailure( Throwable ex ) {
+                if( ex instanceof OptimisticLockFailedException ) {
+
+                    // Another thread is likely trying to make toast simultaneously and updated the
+                    // status before us. Try reading the status again - if another make toast is
+                    // now in progress, we should get ToasterStatus.Down and fail.
+
+                    LOG.debug( "Got OptimisticLockFailedException - trying again" );
+
+                    checkStatusAndMakeToast( input, futureResult );
+
+                } else {
+
+                    LOG.error( "Failed to commit Toaster status", ex );
+
+                    // Got some unexpected error so fail.
+                    futureResult.set( Rpcs.<Void> getRpcResult( false, null, Arrays.asList(
+                        RpcErrors.getRpcError( null, null, null, ErrorSeverity.ERROR,
+                                               ex.getMessage(),
+                                               ErrorType.APPLICATION, ex ) ) ) );
+                }
+            }
+        } );
     }
 
     /**
@@ -195,17 +304,15 @@ public class OpendaylightToaster implements ToasterService, ToasterProviderRunti
     public Future<RpcResult<java.lang.Void>> restockToaster(final RestockToasterInput input) {
         LOG.info( "restockToaster: " + input );
 
-        synchronized( taskLock ) {
-            amountOfBreadInStock.set( input.getAmountOfBreadToStock() );
+        amountOfBreadInStock.set( input.getAmountOfBreadToStock() );
 
-            if( amountOfBreadInStock.get() > 0 ) {
-                ToasterRestocked reStockedNotification =
-                    new ToasterRestockedBuilder().setAmountOfBread( input.getAmountOfBreadToStock() ).build();
-                notificationProvider.publish( reStockedNotification );
-            }
+        if( amountOfBreadInStock.get() > 0 ) {
+            ToasterRestocked reStockedNotification = new ToasterRestockedBuilder()
+                .setAmountOfBread( input.getAmountOfBreadToStock() ).build();
+            notificationProvider.publish( reStockedNotification );
         }
 
-        return Futures.immediateFuture(Rpcs.<Void> getRpcResult(true, Collections.<RpcError> emptySet()));
+        return Futures.immediateFuture(Rpcs.<Void> getRpcResult(true, Collections.<RpcError>emptyList()));
     }
 
     /**
@@ -225,19 +332,38 @@ public class OpendaylightToaster implements ToasterService, ToasterProviderRunti
         return toastsMade.get();
     }
 
-    private void updateStatus() {
-        if (dataProvider != null) {
-            WriteTransaction tx = dataProvider.newWriteOnlyTransaction();
-            tx.put(LogicalDatastoreType.OPERATIONAL,TOASTER_IID, buildToaster());
+    private void setToasterStatusUp( final Function<Boolean,Void> resultCallback ) {
 
-            try {
-                tx.commit().get();
-            } catch (InterruptedException | ExecutionException e) {
-                LOG.warn("Failed to update toaster status, operational otherwise", e);
+        WriteTransaction tx = dataProvider.newWriteOnlyTransaction();
+        tx.put( LogicalDatastoreType.OPERATIONAL,TOASTER_IID, buildToaster( ToasterStatus.Up ) );
+
+        ListenableFuture<RpcResult<TransactionStatus>> commitFuture = tx.commit();
+
+        Futures.addCallback( commitFuture, new FutureCallback<RpcResult<TransactionStatus>>() {
+            @Override
+            public void onSuccess( RpcResult<TransactionStatus> result ) {
+                if( result.getResult() != TransactionStatus.COMMITED ) {
+                    LOG.error( "Failed to update toaster status: " + result.getErrors() );
+                }
+
+                notifyCallback( result.getResult() == TransactionStatus.COMMITED );
             }
-        } else {
-            LOG.trace("No data provider configured, not updating status");
-        }
+
+            @Override
+            public void onFailure( Throwable t ) {
+                // We shouldn't get an OptimisticLockFailedException (or any ex) as no
+                // other component should be updating the operational state.
+                LOG.error( "Failed to update toaster status", t );
+
+                notifyCallback( false );
+            }
+
+            void notifyCallback( boolean result ) {
+                if( resultCallback != null ) {
+                    resultCallback.apply( result );
+                }
+            }
+        } );
     }
 
     private boolean outOfBread()
@@ -245,19 +371,22 @@ public class OpendaylightToaster implements ToasterService, ToasterProviderRunti
         return amountOfBreadInStock.get() == 0;
     }
 
-    private class MakeToastTask implements Callable<RpcResult<Void>> {
+    private class MakeToastTask implements Callable<Void> {
 
         final MakeToastInput toastRequest;
+        final SettableFuture<RpcResult<Void>> futureResult;
 
-        public MakeToastTask(final MakeToastInput toast) {
-            toastRequest = toast;
+        public MakeToastTask( final MakeToastInput toastRequest,
+                              final SettableFuture<RpcResult<Void>> futureResult ) {
+            this.toastRequest = toastRequest;
+            this.futureResult = futureResult;
         }
 
         @Override
-        public RpcResult<Void> call() {
+        public Void call() {
             try
             {
-                // make toast just sleeps for n secondn per doneness level.
+                // make toast just sleeps for n seconds per doneness level.
                 long darknessFactor = OpendaylightToaster.this.darknessFactor.get();
                 Thread.sleep(darknessFactor * toastRequest.getToasterDoneness());
 
@@ -275,15 +404,26 @@ public class OpendaylightToaster implements ToasterService, ToasterProviderRunti
                 notificationProvider.publish( new ToasterOutOfBreadBuilder().build() );
             }
 
-            synchronized (taskLock) {
-                currentTask = null;
-            }
+            // Set the Toaster status back to up - this essentially releases the toasting lock.
+            // We can't clear the current toast task nor set the Future result until the
+            // update has been committed so we pass a callback to be notified on completion.
+
+            setToasterStatusUp( new Function<Boolean,Void>() {
+                @Override
+                public Void apply( Boolean result ) {
+
+                    currentMakeToastTask.set( null );
+
+                    LOG.debug("Toast done");
 
-            updateStatus();
+                    futureResult.set( Rpcs.<Void>getRpcResult( true, null,
+                                                          Collections.<RpcError>emptyList() ) );
 
-            LOG.debug("Toast done");
+                    return null;
+                }
+            } );
 
-            return Rpcs.<Void> getRpcResult(true, null, Collections.<RpcError> emptySet());
+            return null;
         }
     }
 }
index 0ae33b8c71fa93add1914d79c595c14538b0737f..29a27e2bb2a2cdfc85c7b49eada243bdc9f8a531 100644 (file)
@@ -48,9 +48,13 @@ public class StatisticsRequestScheduler implements DataTransactionListener {
     private final TimerTask task = new TimerTask() {
         @Override
         public void run() {
-            long now = System.nanoTime();
-            if(now > lastRequestTime+TimeUnit.MILLISECONDS.toNanos(REQUEST_MONITOR_INTERVAL)){
-                requestStatistics();
+            try{
+                long now = System.nanoTime();
+                if(now > lastRequestTime+TimeUnit.MILLISECONDS.toNanos(REQUEST_MONITOR_INTERVAL)){
+                    requestStatistics();
+                }
+            }catch (IllegalArgumentException | IllegalStateException | NullPointerException e){
+                srsLogger.warn("Exception occured while sending statistics request : {}",e);
             }
         }
     };
index c10f0a9089ed5341550d21a62ea68c3ac67c9a02..8a29139854c3f801cc372c7c7ac94a1995c20ce4 100644 (file)
                             org.opendaylight.controller.netconf.confignetconfconnector.transactions,
                             org.opendaylight.controller.netconf.confignetconfconnector.util,
                             org.opendaylight.controller.netconf.confignetconfconnector.osgi,
-                            org.opendaylight.controller.config.util,
                             org.opendaylight.controller.netconf.confignetconfconnector.exception,</Private-Package>
             <Import-Package>com.google.common.base,
                             com.google.common.collect,
                             com.google.common.io,
                             org.opendaylight.yangtools.yang.model.api.type,
                             org.opendaylight.yangtools.sal.binding.generator.spi,
-                            org.opendaylight.yangtools.sal.binding.yang.types,</Import-Package>
+                            org.opendaylight.yangtools.sal.binding.yang.types,
+                            org.opendaylight.controller.config.util
+              </Import-Package>
             <Export-Package></Export-Package>
           </instructions>
         </configuration>
index 6fb231d847f2c5ae8c2022a7951460e19199ff70..3f04010015e8291d8dbeb6e47415d6ab8a12ad3f 100644 (file)
@@ -7,20 +7,25 @@
  */
 package org.opendaylight.controller.netconf.persist.impl.osgi;
 
-import org.junit.matchers.JUnitMatchers;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
 
+import org.junit.matchers.JUnitMatchers;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 final class TestingExceptionHandler implements Thread.UncaughtExceptionHandler {
 
+    private static final Logger logger = LoggerFactory.getLogger(ConfigPersisterTest.class);
+
     private Throwable t;
 
     @Override
     public void uncaughtException(Thread t, Throwable e) {
+        logger.debug("Uncaught exception in thread {}", t, e);
         this.t = e;
     }
 
diff --git a/opendaylight/netconf/netconf-cli/.gitignore b/opendaylight/netconf/netconf-cli/.gitignore
new file mode 100644 (file)
index 0000000..d5de9f2
--- /dev/null
@@ -0,0 +1,2 @@
+*.log
+cache
diff --git a/opendaylight/netconf/netconf-cli/README b/opendaylight/netconf/netconf-cli/README
new file mode 100644 (file)
index 0000000..c6a0af4
--- /dev/null
@@ -0,0 +1,113 @@
+usage: 
+Submit address + port for initial TCP connection (PURE TCP CONNECTIONS ARE NOT SUPPORTED YET)
+Submit username + password in addition to address + port for initial SSH connection
+If no arguments(or unexpected combination) is submitted, cli will be started without initial connection
+To use with ODL controller, run with: java -jar netconf-cli-0.2.5-SNAPSHOT-executable.jar  --server localhost --port 1830 --username admin --password admin
+
+Generic cli for netconf devices
+
+optional arguments:
+  -h, --help             show this help message and exit
+
+TCP:
+  Base arguments to initiate TCP connection right away
+
+  --server SERVER        Netconf device ip-address/domain name
+  --port PORT            Netconf device port
+
+SSH:
+  SSH credentials, if provided, initial connection will be attempted using SSH
+
+  --username USERNAME    Username for SSH connection
+  --password PASSWORD    Password for SSH connection
+------------------------------------------------------------------------
+
+To run the cli execute:
+
+java -jar netconf-cli-0.2.5-SNAPSHOT-executable.jar --username user --password password --server serverIP --port optionalPort
+
+The cli will connect to the remote device automatically.
+The initialization may take a few moments depending on the size of schemas provided by the device.
+To view the progress, one can take a look inside netconfcli.log file (All logs are in this file starting with level TRACE).
+Cli does not print any logging messages to the console, only to the file.
+
+------------------------------------------------------------------------
+
+Correct initialization + connection should display following output:
+
+[maros@localhost target]$ java -jar netconf-cli-0.2.5-SNAPSHOT-executable.jar  --server localhost --port 1830 --username admin --password admin
+Connecting to localhost via SSH. Please wait.
+Cli is up, available commands:
+
+add-flow(sal-flow)                                                                            add-group(sal-group)                                                                          
+add-meter(sal-meter)                                                                          begin-transaction(sal-remote)                                                                 
+cancel-commit(ietf-netconf)                                                                   cancel-toast(toaster)                                                                         
+clear-toasts-made(toaster-provider-impl)                                                      close(netconf-cli)                                                                            
+close-session(ietf-netconf)                                                                   commit(ietf-netconf)                                                                          
+connect(netconf-cli)                                                                          copy-config(ietf-netconf)                                                                     
+create-data-change-event-subscription(sal-remote)                                             create-notification-stream(sal-remote)                                                        
+delete-config(ietf-netconf)                                                                   discard-changes(ietf-netconf)                                                                 
+disconnect(netconf-cli)                                                                       edit-config(ietf-netconf)                                                                     
+finish-transaction(flow-capable-transaction)                                                  get(ietf-netconf)                                                                             
+get-aggregate-flow-statistics-from-flow-table-for-all-flows(opendaylight-flow-statistics)     get-aggregate-flow-statistics-from-flow-table-for-given-match(opendaylight-flow-statistics)   
+get-all-flow-statistics-from-flow-table(opendaylight-flow-statistics)                         get-all-flows-statistics-from-all-flow-tables(opendaylight-flow-statistics)                   
+get-all-group-statistics(opendaylight-group-statistics)                                       get-all-meter-config-statistics(opendaylight-meter-statistics)                                
+get-all-meter-statistics(opendaylight-meter-statistics)                                       get-all-node-connectors-statistics(opendaylight-port-statistics)                              
+get-all-queues-statistics-from-all-ports(opendaylight-queue-statistics)                       get-all-queues-statistics-from-given-port(opendaylight-queue-statistics)                      
+get-config(ietf-netconf)                                                                      get-dead-events-count(threadpool-impl)                                                        
+get-flow-statistics-from-flow-table(opendaylight-flow-statistics)                             get-flow-tables-statistics(opendaylight-flow-table-statistics)                                
+get-group-description(opendaylight-group-statistics)                                          get-group-features(opendaylight-group-statistics)                                             
+get-group-statistics(opendaylight-group-statistics)                                           get-meter-features(opendaylight-meter-statistics)                                             
+get-meter-statistics(opendaylight-meter-statistics)                                           get-next-transaction-id(flow-capable-transaction)                                             
+get-node-connector-statistics(opendaylight-port-statistics)                                   get-queue(sal-queue)                                                                          
+get-queue-statistics-from-given-port(opendaylight-queue-statistics)                           get-schema(ietf-netconf-monitoring)                                                           
+help(netconf-cli)                                                                             kill-session(ietf-netconf)                                                                    
+lock(ietf-netconf)                                                                            make-scrambled-with-wheat(kitchen-service-impl)                                               
+make-toast(toaster)                                                                           remove-flow(sal-flow)                                                                         
+remove-group(sal-group)                                                                       remove-meter(sal-meter)                                                                       
+reset(config-logging)                                                                         restock-toaster(toaster)                                                                      
+shutdown(shutdown-impl)                                                                       solicit-refresh(flow-topology-discovery)                                                      
+transmit-packet(packet-processing)                                                            unlock(ietf-netconf)                                                                          
+update-flow(sal-flow)                                                                         update-group(sal-group)                                                                       
+update-meter(sal-meter)                                                                       update-port(sal-port)                                                                         
+update-table(sal-table)                                                                       validate(ietf-netconf)                                                                        
+
+netconf()>
+
+
+------------------------------------------------------------------------
+
+At this stage, any supported rpc can be invoked. To see all possible rpcs press TAB (serves as autocomplete). The output contains all the commands reported after at start-up
+
+------------------------------------------------------------------------
+
+Example step-by-step execution of get-config rpc:
+
+1. Type get-config, hit TAB, hit enter
+2. Cli will now walk all the input arguments of get-config rpc and ask for value
+3. Cli asks for filter value
+4. Submit filter (using TAB autocomplete) as a schema path or type "skip" (to not add any filter) and hit enter
+5. Cli asks for config source (e.g. which data-store to query)
+6. Use TAB to view options and submit either running or candidate data-store
+7. Cli will display configuration of the remote device e.g. :
+
+data {
+  a {
+    address {
+      last-name a
+      first-name o
+      street aaaaa
+    }
+    address {
+      last-name a
+      first-name t
+    }
+    address {
+      last-name a
+      first-name y
+    }
+  }
+}
+
+
+------------------------------------------------------------------------
diff --git a/opendaylight/netconf/netconf-cli/README_ODL b/opendaylight/netconf/netconf-cli/README_ODL
new file mode 100644 (file)
index 0000000..3a15454
--- /dev/null
@@ -0,0 +1,154 @@
+This file contains ODL controller specific examples:
+
+1A. Connecting to ODL controller automatically:
+    a. Make sure ODL controller is running on your or any other accessible device
+    b. Start the cli using this command (in folder controller/opendaylight/netconf/netconf-cli/target/):
+        java -jar netconf-cli-0.2.5-SNAPSHOT-executable.jar  --server localhost --port 1830 --username admin --password admin
+    c. The cli will start up in aprox. 20 seconds (Schema download might take some time on the first connection, subsequent attempts should take less time)
+    d. You should see the list of commands avaliable in the controller e.g.:
+        add-flow(sal-flow)                                                                            add-group(sal-group)                                                                          
+        add-meter(sal-meter)                                                                          begin-transaction(sal-remote)                                                                 
+        cancel-commit(ietf-netconf)                                                                   cancel-toast(toaster)                                                                         
+        clear-toasts-made(toaster-provider-impl)                                                      close(netconf-cli)                                                                            
+        close-session(ietf-netconf)                                                                   commit(ietf-netconf)                                                                          
+        connect(netconf-cli)                                                                          copy-config(ietf-netconf)                                                                     
+        create-data-change-event-subscription(sal-remote)                                             ....
+
+
+1B. Connecting to ODL from the CLI:
+    a. Make sure ODL controller is running on your or any other accessible device
+    b. Start the cli using this command (in folder controller/opendaylight/netconf/netconf-cli/target/):
+        java -jar netconf-cli-0.2.5-SNAPSHOT-executable.jar
+    c. The cli will start app right away (few seconds)
+    d. You should see only the basic commands e.g. connect, close, help, disconnect 
+    e. Type connect, hit TAB, hit ENTER
+    f. Cli will ask for connect arguments: [address-name, address-port, user-name, user-password]
+    g. Address-name
+        The cli will ask what type of address you want to provide (domain-name or ip-address). This is caused by the yang model for connect command, the address-name is of type ietf-inet-types:host, which is a union of domain-name and ip-address.
+        Submit "domain-name" (TAB can be used for autocompete)
+        Now you need to provide value, submit "localhost" (TAB can be used for autocomplete, as "localhost" is the default value)
+    h. Address-port
+        Submit 1830 (default port for netconf SSH server in ODL)
+    i. User-name
+        Submit "admin"
+    j. User-password
+        Submit "admin"
+    k. The connection will be up in aprox. 20 seconds (Schema download might take some time on the first connection, subsequent attempts should take less time)
+    l. You should see the list of commands available in the controller
+
+
+2.  Disconnecting from ODL in the CLI
+    a. Execute scenario 1A or 1B
+    b. Type "disconn", hit TAB, hit Enter
+    c. You should see the following output:
+        status Connection disconnected
+    d. Use TAB to see available commands, only local commands are present now
+    e. Now you can use the connect command(as in 1B) to connect again
+
+
+3.  Using help command
+    a. Help command can be executed in connected as well as disconnected state
+    b. Type "help", hit TAB, hit Enter
+    c. You should see the help conent containing the list of all available commands with description for each of them e.g.
+        commands  {
+          commands [id=close(netconf-cli)] {
+            id close(netconf-cli)
+            description Close the whole cli
+          }
+          commands [id=help(netconf-cli)] {
+            id help(netconf-cli)
+            description Display help
+          }
+          commands [id=disconnect(netconf-cli)] {
+            id disconnect(netconf-cli)
+            description Disconnect from a netconf device that is currently connected
+          }
+          commands [id=connect(netconf-cli)] {
+            id connect(netconf-cli)
+            description Connect to a remote netconf device, if not connected yet. Connection initialization is blocking and might take some time, depending on amount of yang schemas in remote device.
+          }
+        }
+
+
+4.  Executing get-config command (get-config(ietf-netconf))
+    a. Execute scenario 1A or 1B
+    b. Type "get-config", hit TAB, hit Enter
+    c. Cli will ask for get-config arguments: [filter, source]
+    d. Filter
+        Submit "skip" (This will ignore the filter attribute, ODL does not support filtering at this moment, but will be supported in near future)
+    e. Source
+        You have to choose from candidate, running, startup. Submit running.
+    f. You should see the whole configuration of the ODL e.g.:
+        data {
+          modules {
+            module  {
+              module [name=toaster-provider-impl] {
+                name toaster-provider-impl
+                type (urn:opendaylight:params:xml:ns:yang:controller:config:toaster-provider:impl?revision=2014-01-31)toaster-provider-impl
+                choice configuration (toaster-provider-impl)  {
+                    ...
+
+
+5.  Executing get command (get(ietf-netconf))
+    a. Execute scenario 1A or 1B
+    b. Type "get(", hit TAB, hit Enter
+    c. Cli will ask for get arguments: [filter]
+    d. Filter
+        Submit "skip" (This will ignore the filter attribute, ODL does not support filtering at this moment, but will be supported in near future)
+    f. You should see the whole data-tree of the ODL
+
+
+6.  Executing edit-config command (edit-config(ietf-netconf))
+    a. Execute scenario 1A or 1B
+    b. Type "edit", hit TAB, hit Enter
+    c. Cli will ask for edit-config arguments: [default-operation, edit-content, error-option, target, test-option]
+    d. Config
+        Config contains the data to be edited
+        1. First you have to specify a path pointing to a concrete data node. Use TAB to help with autocomplete.
+        Submit "modules(config)/module(config)/"
+        Module node is of type list and now you have to construct a whole new list entry for the module list.
+        2. The cli will ask for these nodes: [configuration, name, type]
+            Name - Submit any name e.g. newModule
+            Type - For Type you have to pick from available module types in the ODL, hit TAB for hints
+               Submit "threadfactory-naming(threadpool-impl)" to create a new instance of threadfactory in the ODL.
+            Configuration - For configuration you have to pick from available module types again
+               Submit "threadfactory-naming" to match previous module type
+               The cli will now ask for threadfactory-naming specific configuration: [prefix]
+                    Prefix - Submit any string
+        
+        The cli will now if you want to create another module entry.
+        Submit "N".
+    e. Default-operation
+        Submit "skip" to skip or pick from available e.g. merge, replace etc.
+    f. Error-option
+        Submit "skip" to skip option.
+    g. Config-target
+        This is a choice between running and candidate. Submit candidate to edit configuration only in the candidate datastore.
+    h. Test-option
+        Submit "skip" to skip option.
+    i. You should see OK response
+    j. You can check the candidate datastore change by executing get-config command as in scenario 4, but pick candidate as the source.
+    k. You should see this module in the output:
+        module [name=newModule] {
+            name newModule
+            type (urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl?revision=2013-04-05)threadfactory-naming
+            choice configuration (threadfactory-naming)  {
+              name-prefix prefix
+            }
+          }
+
+
+7. Commiting changes from candidate to running datastore
+    a. Execute scenario 6.
+    b. Type commit, hit TAB, hit Enter
+    c. Cli will ask for commit arguments: [confirm-timeout, confirmed, persist, persist-id]. We will skip all these arguments since they are not supported in ODL. Cli should be able to detect this and not ask for them. This is a TODO, by supporting feature/if-feature detection in the CLI.
+    d. Confirm-timeout
+        Skip
+    e. Confirmed
+        N
+    f. Persist
+        Skip
+    g. Persist-id
+        Skip
+    h. You should see OK response
+    i. You can check the candidate datastore change by executing get-config command as in scenario 4.
diff --git a/opendaylight/netconf/netconf-cli/pom.xml b/opendaylight/netconf/netconf-cli/pom.xml
new file mode 100644 (file)
index 0000000..cd7a1aa
--- /dev/null
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!-- 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>netconf-subsystem</artifactId>
+    <version>0.2.5-SNAPSHOT</version>
+  </parent>
+  <artifactId>netconf-cli</artifactId>
+  <packaging>jar</packaging>
+  <name>${project.artifactId}</name>
+
+  <!--
+  <properties>
+    <checkstyle.skip>true</checkstyle.skip>
+  </properties> -->
+
+  <dependencies>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+      <!--TODO configure properly -->
+    </dependency>
+    <dependency>
+      <groupId>jline</groupId>
+      <artifactId>jline</artifactId>
+      <version>2.11</version>
+    </dependency>
+    <dependency>
+      <groupId>net.sourceforge.argparse4j</groupId>
+      <artifactId>argparse4j</artifactId>
+      <version>0.4.3</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-core-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-netconf-connector</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>mockito-configuration</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-data-impl</artifactId>
+      <!--        <version>0.6.2-SNAPSHOT</version>-->
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-data-json</artifactId>
+      <version>0.6.2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-model-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-parser-impl</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifest>
+              <mainClass>org.opendaylight.controller.netconf.cli.Main</mainClass>
+            </manifest>
+          </archive>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-shade-plugin</artifactId>
+        <configuration></configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <phase>package</phase>
+            <configuration>
+              <transformers>
+                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                  <mainClass>org.opendaylight.controller.netconf.cli.Main</mainClass>
+                </transformer>
+              </transformers>
+              <shadedArtifactAttached>true</shadedArtifactAttached>
+              <shadedClassifierName>executable</shadedClassifierName>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/Cli.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/Cli.java
new file mode 100644 (file)
index 0000000..a49c7b9
--- /dev/null
@@ -0,0 +1,218 @@
+/*
+ * 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.netconf.cli;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import jline.console.UserInterruptException;
+import jline.console.completer.Completer;
+import jline.console.completer.StringsCompleter;
+import org.opendaylight.controller.netconf.cli.commands.Command;
+import org.opendaylight.controller.netconf.cli.commands.CommandConstants;
+import org.opendaylight.controller.netconf.cli.commands.CommandDispatcher;
+import org.opendaylight.controller.netconf.cli.commands.CommandInvocationException;
+import org.opendaylight.controller.netconf.cli.commands.input.Input;
+import org.opendaylight.controller.netconf.cli.commands.input.InputDefinition;
+import org.opendaylight.controller.netconf.cli.commands.output.Output;
+import org.opendaylight.controller.netconf.cli.commands.output.OutputDefinition;
+import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.cli.reader.ReadingException;
+import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
+import org.opendaylight.controller.netconf.cli.writer.WriteException;
+import org.opendaylight.controller.netconf.cli.writer.Writer;
+import org.opendaylight.controller.netconf.cli.writer.impl.CompositeNodeWriter;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+/**
+ * The top level cli state that dispatches command executions
+ */
+public class Cli implements Runnable {
+    private final CommandDispatcher commandRegistry;
+    private final CommandArgHandlerRegistry argumentHandlerRegistry;
+    private final SchemaContextRegistry schemaContextRegistry;
+    private final ConsoleIO consoleIO;
+
+    public Cli(final ConsoleIO consoleIO, final CommandDispatcher commandRegistry,
+            final CommandArgHandlerRegistry argumentHandlerRegistry, final SchemaContextRegistry schemaContextRegistry) {
+        this.consoleIO = consoleIO;
+        this.commandRegistry = commandRegistry;
+        this.argumentHandlerRegistry = argumentHandlerRegistry;
+        this.schemaContextRegistry = schemaContextRegistry;
+    }
+
+    @Override
+    public void run() {
+        try {
+            consoleIO.writeLn("Cli is up, available commands:");
+            final RootConsoleContext consoleContext = new RootConsoleContext(commandRegistry);
+            consoleIO.enterContext(consoleContext);
+            consoleIO.complete();
+            consoleIO.writeLn("");
+
+            while (true) {
+                final String commandName = consoleIO.read();
+                final Optional<Command> commandOpt = commandRegistry.getCommand(commandName);
+
+                if (commandOpt.isPresent() == false) {
+                    continue;
+                }
+
+                final Command command = commandOpt.get();
+                try {
+                    consoleIO.enterContext(command.getConsoleContext());
+                    final Output response = command.invoke(handleInput(command.getInputDefinition()));
+                    handleOutput(command, response);
+                } catch (final CommandInvocationException e) {
+                    consoleIO.write(e.getMessage());
+                } catch (final UserInterruptException e) {
+                    consoleIO.writeLn("Command " + command.getCommandId() + " was terminated.");
+                } finally {
+                    consoleIO.leaveContext();
+                }
+
+            }
+        } catch (final IOException e) {
+            throw new RuntimeException("IO failure", e);
+        }
+    }
+
+    private void handleOutput(final Command command, final Output response) {
+        final OutputDefinition outputDefinition = command.getOutputDefinition();
+
+        final Writer<DataSchemaNode> outHandler = argumentHandlerRegistry.getGenericWriter();
+        if (outputDefinition.isEmpty()) {
+            handleEmptyOutput(command, response);
+        } else {
+            handleRegularOutput(response, outputDefinition, outHandler);
+        }
+    }
+
+    private void handleRegularOutput(final Output response, final OutputDefinition outputDefinition,
+            final Writer<DataSchemaNode> outHandler) {
+        final Map<DataSchemaNode, List<Node<?>>> unwrap = response.unwrap(outputDefinition);
+
+        for (final DataSchemaNode schemaNode : unwrap.keySet()) {
+            Preconditions.checkNotNull(schemaNode);
+
+            try {
+
+                // FIXME move custom writer to GenericWriter/Serializers ...
+                // this checks only first level
+                final Optional<Class<? extends Writer<DataSchemaNode>>> customReaderClassOpt = tryGetCustomHandler(schemaNode);
+
+                if (customReaderClassOpt.isPresent()) {
+                    final Writer<DataSchemaNode> customReaderInstance = argumentHandlerRegistry
+                            .getCustomWriter(customReaderClassOpt.get());
+                    Preconditions.checkNotNull(customReaderInstance, "Unknown custom writer: %s",
+                            customReaderClassOpt.get());
+                    customReaderInstance.write(schemaNode, unwrap.get(schemaNode));
+                } else {
+                    outHandler.write(schemaNode, unwrap.get(schemaNode));
+                }
+
+            } catch (final WriteException e) {
+                throw new IllegalStateException("Unable to write value for: " + schemaNode.getQName() + " from: "
+                        + unwrap.get(schemaNode), e);
+            }
+        }
+    }
+
+    private void handleEmptyOutput(final Command command, final Output response) {
+        try {
+            new CompositeNodeWriter(consoleIO, new OutFormatter()).write(null,
+                    Collections.<Node<?>> singletonList(response.getOutput()));
+        } catch (final WriteException e) {
+            throw new IllegalStateException("Unable to write value for: " + response.getOutput().getNodeType()
+                    + " from: " + command.getCommandId(), e);
+        }
+    }
+
+    private Input handleInput(final InputDefinition inputDefinition) {
+        List<Node<?>> allArgs = Collections.emptyList();
+        try {
+            if (!inputDefinition.isEmpty()) {
+                allArgs = argumentHandlerRegistry.getGenericReader(schemaContextRegistry.getLocalSchemaContext()).read(
+                        inputDefinition.getInput());
+            }
+        } catch (final ReadingException e) {
+            throw new IllegalStateException("Unable to read value for: " + inputDefinition.getInput().getQName(), e);
+        }
+
+        return new Input(allArgs);
+    }
+
+    // TODO move tryGet to GenericWriter, GenericReader has the same code
+    private <T> Optional<Class<? extends T>> tryGetCustomHandler(final DataSchemaNode dataSchemaNode) {
+
+        for (final UnknownSchemaNode unknownSchemaNode : dataSchemaNode.getUnknownSchemaNodes()) {
+
+            if (isExtenstionForCustomHandler(unknownSchemaNode)) {
+                final String argumentHandlerClassName = unknownSchemaNode.getNodeParameter();
+                try {
+                    final Class<?> argumentClass = Class.forName(argumentHandlerClassName);
+                    // TODO add check before cast
+                    return Optional.<Class<? extends T>> of((Class<? extends T>) argumentClass);
+                } catch (final ClassNotFoundException e) {
+                    throw new IllegalArgumentException("Unknown custom reader class " + argumentHandlerClassName
+                            + " for: " + dataSchemaNode.getQName());
+                }
+            }
+        }
+
+        return Optional.absent();
+    }
+
+    private boolean isExtenstionForCustomHandler(final UnknownSchemaNode unknownSchemaNode) {
+        final QName qName = unknownSchemaNode.getExtensionDefinition().getQName();
+        return qName.equals(CommandConstants.ARG_HANDLER_EXT_QNAME);
+    }
+
+    private static final class RootConsoleContext implements ConsoleContext {
+
+        private final Completer completer;
+
+        public RootConsoleContext(final CommandDispatcher commandRegistry) {
+            completer = new CommandCompleter(commandRegistry);
+        }
+
+        @Override
+        public Completer getCompleter() {
+            return completer;
+        }
+
+        @Override
+        public Optional<String> getPrompt() {
+            return Optional.absent();
+        }
+
+        private class CommandCompleter extends StringsCompleter {
+
+            private final CommandDispatcher commandRegistry;
+
+            public CommandCompleter(final CommandDispatcher commandRegistry) {
+                this.commandRegistry = commandRegistry;
+            }
+
+            @Override
+            public int complete(final String buffer, final int cursor, final List<CharSequence> candidates) {
+                getStrings().clear();
+                getStrings().addAll(commandRegistry.getCommandIds());
+                return super.complete(buffer, cursor, candidates);
+            }
+        }
+    }
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/CommandArgHandlerRegistry.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/CommandArgHandlerRegistry.java
new file mode 100644 (file)
index 0000000..2eab22a
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * 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.netconf.cli;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
+import java.util.Map;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.cli.reader.Reader;
+import org.opendaylight.controller.netconf.cli.reader.custom.ConfigReader;
+import org.opendaylight.controller.netconf.cli.reader.custom.EditContentReader;
+import org.opendaylight.controller.netconf.cli.reader.custom.FilterReader;
+import org.opendaylight.controller.netconf.cli.reader.custom.PasswordReader;
+import org.opendaylight.controller.netconf.cli.reader.impl.GenericReader;
+import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
+import org.opendaylight.controller.netconf.cli.writer.Writer;
+import org.opendaylight.controller.netconf.cli.writer.custom.DataWriter;
+import org.opendaylight.controller.netconf.cli.writer.impl.NormalizedNodeWriter;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+/**
+ * Keeps custom and generic input/output arguments handlers. Custom handlers are
+ * constructed lazily, due to remote schema context acquisition.
+ */
+public class CommandArgHandlerRegistry {
+
+    private final ConsoleIO consoleIO;
+    private final SchemaContextRegistry schemaContextRegistry;
+
+    private final Map<Class<? extends Reader<? extends DataSchemaNode>>, ReaderProvider> customReaders = Maps
+            .newHashMap();
+    private final Map<Class<? extends Writer<DataSchemaNode>>, WriterProvider> customWriters = Maps.newHashMap();
+
+    public CommandArgHandlerRegistry(final ConsoleIO consoleIO, final SchemaContextRegistry schemaContextRegistry) {
+        this.consoleIO = consoleIO;
+        this.schemaContextRegistry = schemaContextRegistry;
+
+        setUpReaders();
+        setUpWriters();
+    }
+
+    private void setUpWriters() {
+        customWriters.put(DataWriter.class, new DataWriterProvider());
+    }
+
+    private void setUpReaders() {
+        customReaders.put(PasswordReader.class, new PasswordReaderProvider());
+        customReaders.put(FilterReader.class, new FilterReaderProvider());
+        customReaders.put(ConfigReader.class, new ConfigReaderProvider());
+        customReaders.put(EditContentReader.class, new EditContentReaderProvider());
+    }
+
+    public synchronized Reader<? extends DataSchemaNode> getCustomReader(
+            final Class<? extends Reader<DataSchemaNode>> readerType) {
+        return customReaders.get(readerType).provide(consoleIO, this, schemaContextRegistry);
+    }
+
+    private static SchemaContext getRemoteSchema(final Class<?> handlerType,
+            final SchemaContextRegistry schemaContextRegistry) {
+        final Optional<SchemaContext> remoteSchemaContext = schemaContextRegistry.getRemoteSchemaContext();
+        Preconditions.checkState(remoteSchemaContext.isPresent(),
+                "Remote schema context not acquired yet, cannot get handler %s", handlerType);
+        return remoteSchemaContext.get();
+    }
+
+    public synchronized Reader<DataSchemaNode> getGenericReader(final SchemaContext schemaContext) {
+        return new GenericReader(consoleIO, this, schemaContext);
+    }
+
+    public synchronized Reader<DataSchemaNode> getGenericReader(final SchemaContext schemaContext,
+            final boolean readConfigNode) {
+        return new GenericReader(consoleIO, this, schemaContext, readConfigNode);
+    }
+
+    public synchronized Writer<DataSchemaNode> getCustomWriter(final Class<? extends Writer<DataSchemaNode>> writerType) {
+        return customWriters.get(writerType).provide(consoleIO, getRemoteSchema(writerType, schemaContextRegistry),
+                this);
+    }
+
+    public synchronized Writer<DataSchemaNode> getGenericWriter() {
+        return new NormalizedNodeWriter(consoleIO, new OutFormatter());
+    }
+
+    /**
+     * Reader providers, in order to construct readers lazily
+     */
+    private static interface ReaderProvider {
+        Reader<? extends DataSchemaNode> provide(ConsoleIO consoleIO,
+                final CommandArgHandlerRegistry commandArgHandlerRegistry,
+                final SchemaContextRegistry schemaContextRegistry);
+    }
+
+    private static final class FilterReaderProvider implements ReaderProvider {
+        @Override
+        public Reader<? extends DataSchemaNode> provide(final ConsoleIO consoleIO,
+                final CommandArgHandlerRegistry commandArgHandlerRegistry,
+                final SchemaContextRegistry schemaContextRegistry) {
+            return new FilterReader(consoleIO, getRemoteSchema(FilterReader.class, schemaContextRegistry));
+        }
+    }
+
+    private static final class ConfigReaderProvider implements ReaderProvider {
+        @Override
+        public Reader<? extends DataSchemaNode> provide(final ConsoleIO consoleIO,
+                final CommandArgHandlerRegistry commandArgHandlerRegistry,
+                final SchemaContextRegistry schemaContextRegistry) {
+            return new ConfigReader(consoleIO, getRemoteSchema(ConfigReader.class, schemaContextRegistry),
+                    commandArgHandlerRegistry);
+        }
+    }
+
+    private static final class EditContentReaderProvider implements ReaderProvider {
+        @Override
+        public Reader<? extends DataSchemaNode> provide(final ConsoleIO consoleIO,
+                final CommandArgHandlerRegistry commandArgHandlerRegistry,
+                final SchemaContextRegistry schemaContextRegistry) {
+            return new EditContentReader(consoleIO, commandArgHandlerRegistry, getRemoteSchema(EditContentReader.class,
+                    schemaContextRegistry));
+        }
+    }
+
+    private static final class PasswordReaderProvider implements ReaderProvider {
+        @Override
+        public Reader<? extends DataSchemaNode> provide(final ConsoleIO consoleIO,
+                final CommandArgHandlerRegistry commandArgHandlerRegistry,
+                final SchemaContextRegistry schemaContextRegistry) {
+            return new PasswordReader(consoleIO, schemaContextRegistry.getLocalSchemaContext());
+        }
+    }
+
+    /**
+     * Writer providers, in order to construct readers lazily
+     */
+    private static interface WriterProvider {
+        Writer<DataSchemaNode> provide(ConsoleIO consoleIO, SchemaContext schema,
+                final CommandArgHandlerRegistry commandArgHandlerRegistry);
+    }
+
+    private class DataWriterProvider implements WriterProvider {
+        @Override
+        public Writer<DataSchemaNode> provide(final ConsoleIO consoleIO, final SchemaContext schema,
+                final CommandArgHandlerRegistry commandArgHandlerRegistry) {
+            return new DataWriter(consoleIO, new OutFormatter(), schema);
+        }
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/Main.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/Main.java
new file mode 100644 (file)
index 0000000..8605501
--- /dev/null
@@ -0,0 +1,231 @@
+/*
+ * 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.netconf.cli;
+
+import com.google.common.base.Preconditions;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+import net.sourceforge.argparse4j.ArgumentParsers;
+import net.sourceforge.argparse4j.inf.ArgumentGroup;
+import net.sourceforge.argparse4j.inf.ArgumentParser;
+import net.sourceforge.argparse4j.inf.ArgumentParserException;
+import net.sourceforge.argparse4j.inf.Namespace;
+import org.opendaylight.controller.netconf.cli.commands.CommandDispatcher;
+import org.opendaylight.controller.netconf.cli.commands.local.Connect;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIOImpl;
+import org.opendaylight.controller.netconf.client.conf.NetconfClientConfiguration;
+import org.opendaylight.controller.netconf.client.conf.NetconfClientConfigurationBuilder;
+import org.opendaylight.controller.netconf.nettyutil.handler.ssh.authentication.LoginPassword;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+/**
+ * Parse arguments, start remote device connection and start CLI after the
+ * connection is fully up
+ */
+public class Main {
+
+    public static void main(final String[] args) {
+        final CliArgumentParser cliArgs = new CliArgumentParser();
+        try {
+            cliArgs.parse(args);
+        } catch (final ArgumentParserException e) {
+            // Just end the cli, exception was handled by the CliArgumentParser
+            return;
+        }
+
+        final ConsoleIO consoleIO;
+        try {
+            consoleIO = new ConsoleIOImpl();
+        } catch (final IOException e) {
+            handleStartupException(e);
+            return;
+        }
+
+        final SchemaContext localSchema = CommandDispatcher.parseSchema(CommandDispatcher.LOCAL_SCHEMA_PATHS);
+        final SchemaContextRegistry schemaContextRegistry = new SchemaContextRegistry(localSchema);
+
+        final CommandDispatcher commandDispatcher = new CommandDispatcher();
+        final CommandArgHandlerRegistry argumentHandlerRegistry = new CommandArgHandlerRegistry(consoleIO,
+                schemaContextRegistry);
+        final NetconfDeviceConnectionManager connectionManager = new NetconfDeviceConnectionManager(commandDispatcher,
+                argumentHandlerRegistry, schemaContextRegistry, consoleIO);
+
+        commandDispatcher.addLocalCommands(connectionManager, localSchema, cliArgs.getConnectionTimeoutMs());
+
+        switch (cliArgs.connectionArgsPresent()) {
+        case TCP: {
+            // FIXME support pure TCP
+            handleRunningException(new UnsupportedOperationException("PURE TCP CONNECTIONS ARE NOT SUPPORTED YET, USE SSH INSTEAD BY PROVIDING USERNAME AND PASSWORD AS WELL"));
+            return;
+        }
+        case SSH: {
+            writeStatus(consoleIO, "Connecting to %s via SSH. Please wait.", cliArgs.getAddress());
+            connectionManager.connectBlocking(cliArgs.getAddress(), getClientSshConfig(cliArgs));
+            break;
+        }
+        case NONE: {/* Do not connect initially */
+            writeStatus(consoleIO, "No initial connection. To connect use the connect command");
+        }
+        }
+
+        try {
+            new Cli(consoleIO, commandDispatcher, argumentHandlerRegistry, schemaContextRegistry).run();
+        } catch (final Exception e) {
+            // TODO Running exceptions have to be handled properly
+            handleRunningException(e);
+            System.exit(0);
+        }
+    }
+
+    private static NetconfClientConfigurationBuilder getClientConfig(final CliArgumentParser cliArgs) {
+        return NetconfClientConfigurationBuilder.create().withAddress(cliArgs.getServerAddress())
+                .withConnectionTimeoutMillis(cliArgs.getConnectionTimeoutMs())
+                .withReconnectStrategy(Connect.getReconnectStrategy())
+                .withProtocol(NetconfClientConfiguration.NetconfClientProtocol.TCP);
+    }
+
+    private static NetconfClientConfigurationBuilder getClientSshConfig(final CliArgumentParser cliArgs) {
+        return NetconfClientConfigurationBuilder.create().withAddress(cliArgs.getServerAddress())
+                .withConnectionTimeoutMillis(cliArgs.getConnectionTimeoutMs())
+                .withReconnectStrategy(Connect.getReconnectStrategy())
+                .withAuthHandler(cliArgs.getCredentials())
+                .withProtocol(NetconfClientConfiguration.NetconfClientProtocol.SSH);
+    }
+
+    private static void handleStartupException(final IOException e) {
+        handleException(e, "Unable to initialize CLI");
+    }
+
+    private static void handleException(final Exception e, final String message) {
+        System.err.println(message);
+        e.printStackTrace(System.err);
+    }
+
+    private static void writeStatus(final ConsoleIO io, final String blueprint, final Object... args) {
+        try {
+            io.formatLn(blueprint, args);
+        } catch (final IOException e) {
+            handleStartupException(e);
+        }
+    }
+
+    private static void handleRunningException(final Exception e) {
+        handleException(e, "Unexpected CLI runtime exception");
+    }
+
+    private static final class CliArgumentParser {
+
+        public static final String USERNAME = "username";
+        public static final String PASSWORD = "password";
+        public static final String SERVER = "server";
+        public static final String PORT = "port";
+
+        public static final String CONNECT_TIMEOUT = "connectionTimeout";
+        public static final int DEFAULT_CONNECTION_TIMEOUT_MS = 50000;
+
+        private final ArgumentParser parser;
+        private Namespace parsed;
+
+        private CliArgumentParser() {
+            parser = ArgumentParsers.newArgumentParser("Netconf cli").defaultHelp(true)
+                    .description("Generic cli for netconf devices")
+                    .usage("Submit address + port for initial TCP connection (PURE TCP CONNECTIONS ARE NOT SUPPORTED YET)\n" +
+                            "Submit username + password in addition to address + port for initial SSH connection\n" +
+                            "If no arguments(or unexpected combination) is submitted, cli will be started without initial connection\n" +
+                            "To use with ODL controller, run with: java -jar netconf-cli-0.2.5-SNAPSHOT-executable.jar  --server localhost --port 1830 --username admin --password admin");
+
+            final ArgumentGroup tcpGroup = parser.addArgumentGroup("TCP")
+                    .description("Base arguments to initiate TCP connection right away");
+
+            tcpGroup.addArgument("--" + SERVER).help("Netconf device ip-address/domain name");
+            tcpGroup.addArgument("--" + PORT).type(Integer.class).help("Netconf device port");
+            tcpGroup.addArgument("--" + CONNECT_TIMEOUT)
+                    .type(Integer.class)
+                    .setDefault(DEFAULT_CONNECTION_TIMEOUT_MS)
+                    .help("Timeout(in ms) for connection to succeed, if the connection is not fully established by the time is up, " +
+                            "connection attempt is considered a failure. This attribute is not working as expected yet");
+
+            final ArgumentGroup sshGroup = parser.addArgumentGroup("SSH")
+                    .description("SSH credentials, if provided, initial connection will be attempted using SSH");
+
+            sshGroup.addArgument("--" + USERNAME).help("Username for SSH connection");
+            sshGroup.addArgument("--" + PASSWORD).help("Password for SSH connection");
+        }
+
+        public void parse(final String[] args) throws ArgumentParserException {
+            try {
+                this.parsed = parser.parseArgs(args);
+            } catch (final ArgumentParserException e) {
+                parser.handleError(e);
+                throw e;
+            }
+        }
+
+        public InetSocketAddress getServerAddress() {
+            try {
+                return new InetSocketAddress(InetAddress.getByName(getAddress()), getPort());
+            } catch (final UnknownHostException e) {
+                throw new IllegalArgumentException(e);
+            }
+        }
+
+        private Integer getPort() {
+            checkParsed();
+            return parsed.getInt(PORT);
+        }
+
+        private String getAddress() {
+            checkParsed();
+            return getString(SERVER);
+        }
+
+        private Integer getConnectionTimeoutMs() {
+            checkParsed();
+            return parsed.getInt(CONNECT_TIMEOUT);
+        }
+
+        private void checkParsed() {
+            Preconditions.checkState(parsed != null, "No arguments were parsed yet");
+        }
+
+        public String getUsername() {
+            checkParsed();
+            return getString(USERNAME);
+        }
+
+        private String getString(final String key) {
+            return parsed.getString(key);
+        }
+
+        public LoginPassword getCredentials() {
+            return new LoginPassword(getUsername(), getPassword());
+        }
+
+        public String getPassword() {
+            checkParsed();
+            return getString(PASSWORD);
+        }
+
+        public InitialConnectionType connectionArgsPresent() {
+            if(getAddress() != null && getPort() != null) {
+                if(getUsername() != null && getPassword() != null) {
+                    return InitialConnectionType.SSH;
+                }
+                return InitialConnectionType.TCP;
+            }
+            return InitialConnectionType.NONE;
+        }
+
+        enum InitialConnectionType {
+            TCP, SSH, NONE
+        }
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/NetconfDeviceConnectionHandler.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/NetconfDeviceConnectionHandler.java
new file mode 100644 (file)
index 0000000..bd092bc
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * 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.netconf.cli;
+
+import com.google.common.base.Optional;
+import jline.console.completer.Completer;
+import jline.console.completer.NullCompleter;
+import org.opendaylight.controller.netconf.cli.commands.CommandDispatcher;
+import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.sal.connect.api.RemoteDeviceHandler;
+import org.opendaylight.controller.sal.connect.netconf.listener.NetconfSessionCapabilities;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
+
+/**
+ * Implementation of RemoteDeviceHandler. Integrates cli with
+ * sal-netconf-connector.
+ */
+public class NetconfDeviceConnectionHandler implements RemoteDeviceHandler<NetconfSessionCapabilities> {
+
+    private final CommandDispatcher commandDispatcher;
+    private final SchemaContextRegistry schemaContextRegistry;
+    private final ConsoleIO console;
+    private final String deviceId;
+
+    private boolean up = false;
+
+    public NetconfDeviceConnectionHandler(final CommandDispatcher commandDispatcher,
+            final SchemaContextRegistry schemaContextRegistry, final ConsoleIO console, final String deviceId) {
+        this.commandDispatcher = commandDispatcher;
+        this.schemaContextRegistry = schemaContextRegistry;
+        this.console = console;
+        this.deviceId = deviceId;
+    }
+
+    @Override
+    public synchronized void onDeviceConnected(final SchemaContextProvider contextProvider,
+            final NetconfSessionCapabilities capabilities, final RpcImplementation rpcImplementation) {
+        console.enterRootContext(new ConsoleContext() {
+
+            @Override
+            public Optional<String> getPrompt() {
+                return Optional.of(deviceId);
+            }
+
+            @Override
+            public Completer getCompleter() {
+                return new NullCompleter();
+            }
+        });
+
+        // TODO Load schemas for base netconf + inet types from remote device if
+        // possible
+        // TODO detect netconf base version
+        // TODO detect inet types version
+        commandDispatcher.addRemoteCommands(rpcImplementation, contextProvider.getSchemaContext());
+        schemaContextRegistry.setRemoteSchemaContext(contextProvider.getSchemaContext());
+        up = true;
+        this.notify();
+    }
+
+    /**
+     * @return true if connection was fully established
+     */
+    public synchronized boolean isUp() {
+        return up;
+    }
+
+    @Override
+    public synchronized void onDeviceDisconnected() {
+        console.leaveRootContext();
+        commandDispatcher.removeRemoteCommands();
+        schemaContextRegistry.setRemoteSchemaContext(null);
+        up = false;
+    }
+
+    @Override
+    public void onNotification(final CompositeNode compositeNode) {
+        // FIXME
+    }
+
+    @Override
+    public void close() {
+        // FIXME
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/NetconfDeviceConnectionManager.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/NetconfDeviceConnectionManager.java
new file mode 100644 (file)
index 0000000..3dd892e
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * 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.netconf.cli;
+
+import com.google.common.base.Preconditions;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.util.HashedWheelTimer;
+import java.io.Closeable;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import org.opendaylight.controller.netconf.cli.commands.CommandDispatcher;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.client.NetconfClientDispatcherImpl;
+import org.opendaylight.controller.netconf.client.conf.NetconfClientConfigurationBuilder;
+import org.opendaylight.controller.sal.connect.netconf.NetconfDevice;
+import org.opendaylight.controller.sal.connect.netconf.listener.NetconfDeviceCommunicator;
+import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
+import org.opendaylight.yangtools.yang.model.util.repo.AbstractCachingSchemaSourceProvider;
+import org.opendaylight.yangtools.yang.model.util.repo.FilesystemSchemaCachingProvider;
+import org.opendaylight.yangtools.yang.model.util.repo.SchemaSourceProvider;
+import org.opendaylight.yangtools.yang.model.util.repo.SchemaSourceProviders;
+
+/**
+ * Manages connect/disconnect to 1 remote device
+ */
+public class NetconfDeviceConnectionManager implements Closeable {
+
+    private final CommandDispatcher commandDispatcher;
+    private final SchemaContextRegistry schemaContextRegistry;
+    private final ConsoleIO console;
+
+    private final ExecutorService executor;
+    private final NioEventLoopGroup nettyThreadGroup;
+    private final NetconfClientDispatcherImpl netconfClientDispatcher;
+
+    // Connection
+    private NetconfDeviceConnectionHandler handler;
+    private NetconfDevice device;
+    private NetconfDeviceCommunicator listener;
+
+    public NetconfDeviceConnectionManager(final CommandDispatcher commandDispatcher,
+            final CommandArgHandlerRegistry argumentHandlerRegistry, final SchemaContextRegistry schemaContextRegistry,
+            final ConsoleIO consoleIO) {
+        this.commandDispatcher = commandDispatcher;
+        this.schemaContextRegistry = schemaContextRegistry;
+        this.console = consoleIO;
+
+        executor = Executors.newSingleThreadExecutor();
+        nettyThreadGroup = new NioEventLoopGroup();
+        netconfClientDispatcher = new NetconfClientDispatcherImpl(nettyThreadGroup, nettyThreadGroup,
+                new HashedWheelTimer());
+    }
+
+    // TODO we receive configBuilder in order to add SessionListener, Session
+    // Listener should not be part of config
+    public synchronized void connect(final String name, final NetconfClientConfigurationBuilder configBuilder) {
+        // TODO change IllegalState exceptions to custom ConnectionException
+        Preconditions.checkState(listener == null, "Already connected");
+
+        final RemoteDeviceId deviceId = new RemoteDeviceId(name);
+
+        handler = new NetconfDeviceConnectionHandler(commandDispatcher, schemaContextRegistry,
+                console, name);
+        device = NetconfDevice.createNetconfDevice(deviceId, getGlobalNetconfSchemaProvider(), executor, handler);
+        listener = new NetconfDeviceCommunicator(deviceId, device);
+        configBuilder.withSessionListener(listener);
+        listener.initializeRemoteConnection(netconfClientDispatcher, configBuilder.build());
+    }
+
+    /**
+     * Blocks thread until connection is fully established
+     */
+    public synchronized Set<String> connectBlocking(final String name, final NetconfClientConfigurationBuilder configBuilder) {
+        this.connect(name, configBuilder);
+        synchronized (handler) {
+            while (handler.isUp() == false) {
+                try {
+                    // TODO implement Timeout for unsuccessful connection
+                    handler.wait();
+                } catch (final InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                    throw new IllegalArgumentException(e);
+                }
+            }
+        }
+
+        return commandDispatcher.getRemoteCommandIds();
+    }
+
+    public synchronized void disconnect() {
+        Preconditions.checkState(listener != null, "Not connected yet");
+        Preconditions.checkState(handler.isUp(), "Not connected yet");
+        listener.close();
+        listener = null;
+        device = null;
+        handler.close();
+        handler = null;
+    }
+
+    private static AbstractCachingSchemaSourceProvider<String, InputStream> getGlobalNetconfSchemaProvider() {
+        // FIXME move to args
+        final String storageFile = "cache/schema";
+        final File directory = new File(storageFile);
+        final SchemaSourceProvider<String> defaultProvider = SchemaSourceProviders.noopProvider();
+        return FilesystemSchemaCachingProvider.createFromStringSourceProvider(defaultProvider, directory);
+    }
+
+    @Override
+    public void close() throws IOException {
+        executor.shutdownNow();
+        nettyThreadGroup.shutdownGracefully();
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/SchemaContextRegistry.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/SchemaContextRegistry.java
new file mode 100644 (file)
index 0000000..5c3cfe7
--- /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.netconf.cli;
+
+import com.google.common.base.Optional;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+/**
+ * Contains the local schema context (containing local commands) and remote schema context (remote commands)
+ *
+ * Remote commands are set only after the connection is fully established. So classes using the remote schema context
+ */
+public class SchemaContextRegistry {
+
+    private final SchemaContext localSchemaContext;
+    private SchemaContext remoteSchemaContext;
+
+    public SchemaContextRegistry(final SchemaContext localSchemaContext) {
+        this.localSchemaContext = localSchemaContext;
+    }
+
+    public synchronized Optional<SchemaContext> getRemoteSchemaContext() {
+        return Optional.fromNullable(remoteSchemaContext);
+    }
+
+    public SchemaContext getLocalSchemaContext() {
+        return localSchemaContext;
+    }
+
+    public synchronized void setRemoteSchemaContext(final SchemaContext remoteSchemaContext) {
+        this.remoteSchemaContext = remoteSchemaContext;
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/AbstractCommand.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/AbstractCommand.java
new file mode 100644 (file)
index 0000000..f02ce74
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * 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.netconf.cli.commands;
+
+import com.google.common.base.Optional;
+import jline.console.completer.Completer;
+import jline.console.completer.NullCompleter;
+import org.opendaylight.controller.netconf.cli.commands.input.InputDefinition;
+import org.opendaylight.controller.netconf.cli.commands.output.OutputDefinition;
+import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+
+public abstract class AbstractCommand implements Command {
+
+    private final QName qName;
+    private final InputDefinition args;
+    private final OutputDefinition output;
+    private final String description;
+
+    public AbstractCommand(final QName qName, final InputDefinition args, final OutputDefinition output,
+            final String description) {
+        this.qName = qName;
+        this.args = args;
+        this.output = output;
+        this.description = description;
+    }
+
+    protected static OutputDefinition getOutputDefinition(final RpcDefinition rpcDefinition) {
+        final ContainerSchemaNode output = rpcDefinition.getOutput();
+        return output != null ? OutputDefinition.fromOutput(output) : OutputDefinition.empty();
+    }
+
+    protected static InputDefinition getInputDefinition(final RpcDefinition rpcDefinition) {
+        final ContainerSchemaNode input = rpcDefinition.getInput();
+        return InputDefinition.fromInput(input);
+    }
+
+    @Override
+    public InputDefinition getInputDefinition() {
+        return args;
+    }
+
+    @Override
+    public OutputDefinition getOutputDefinition() {
+        return output;
+    }
+
+    @Override
+    public QName getCommandId() {
+        return qName;
+    }
+
+    @Override
+    public ConsoleContext getConsoleContext() {
+        return new ConsoleContext() {
+
+            @Override
+            public Completer getCompleter() {
+                return new NullCompleter();
+            }
+
+            @Override
+            public Optional<String> getPrompt() {
+                return Optional.of(qName.getLocalName());
+            }
+        };
+    }
+
+    @Override
+    public Optional<String> getCommandDescription() {
+        return Optional.fromNullable(description);
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/Command.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/Command.java
new file mode 100644 (file)
index 0000000..1435abd
--- /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.netconf.cli.commands;
+
+import com.google.common.base.Optional;
+import org.opendaylight.controller.netconf.cli.commands.input.Input;
+import org.opendaylight.controller.netconf.cli.commands.input.InputDefinition;
+import org.opendaylight.controller.netconf.cli.commands.output.Output;
+import org.opendaylight.controller.netconf.cli.commands.output.OutputDefinition;
+import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
+import org.opendaylight.yangtools.yang.common.QName;
+
+/**
+ * Local command e.g. help or remote rpc e.g. get-config must conform to this interface
+ */
+public interface Command {
+
+    Output invoke(Input inputArgs) throws CommandInvocationException;
+
+    InputDefinition getInputDefinition();
+
+    OutputDefinition getOutputDefinition();
+
+    QName getCommandId();
+
+    Optional<String> getCommandDescription();
+
+    ConsoleContext getConsoleContext();
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/CommandConstants.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/CommandConstants.java
new file mode 100644 (file)
index 0000000..7159af5
--- /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.netconf.cli.commands;
+
+import java.net.URI;
+import org.opendaylight.controller.netconf.cli.io.IOUtil;
+import org.opendaylight.yangtools.yang.common.QName;
+
+public class CommandConstants {
+
+    // Local command ids are defined here, this links the implementation to the rpc definition in yang
+    // Better way needs to be found to provide this link instead of hardcoded QNames (e.g. yang extension)
+    public static final QName HELP_QNAME = QName.create(URI.create("netconf:cli"), IOUtil.parseDate("2014-05-22"), "help");
+    public static final QName CLOSE_QNAME = QName.create(HELP_QNAME, "close");
+    public static final QName CONNECT_QNAME = QName.create(HELP_QNAME, "connect");
+    public static final QName DISCONNECT_QNAME = QName.create(CONNECT_QNAME, "disconnect");
+
+    public static final QName ARG_HANDLER_EXT_QNAME = QName.create(
+            URI.create("urn:ietf:params:xml:ns:netconf:base:1.0:cli"), IOUtil.parseDate("2014-05-26"),
+            "argument-handler");
+
+    public static final QName NETCONF_BASE_QNAME = QName.create("urn:ietf:params:xml:ns:netconf:base:1.0", "2011-06-01",
+            "netconf");
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/CommandDispatcher.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/CommandDispatcher.java
new file mode 100644 (file)
index 0000000..ec7b5b4
--- /dev/null
@@ -0,0 +1,183 @@
+/*
+ * 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.netconf.cli.commands;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.opendaylight.controller.netconf.cli.NetconfDeviceConnectionHandler;
+import org.opendaylight.controller.netconf.cli.NetconfDeviceConnectionManager;
+import org.opendaylight.controller.netconf.cli.commands.local.Close;
+import org.opendaylight.controller.netconf.cli.commands.local.Connect;
+import org.opendaylight.controller.netconf.cli.commands.local.Disconnect;
+import org.opendaylight.controller.netconf.cli.commands.local.Help;
+import org.opendaylight.controller.netconf.cli.commands.remote.RemoteCommand;
+import org.opendaylight.controller.netconf.cli.io.IOUtil;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.yangtools.yang.common.QName;
+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;
+
+/**
+ * The registry of available commands local + remote. Created from schema contexts.
+ */
+public class CommandDispatcher {
+
+    // TODO extract interface
+
+    private final Map<QName, Command> localCommands = Maps.newHashMap();
+    private final Map<String, QName> nameToQNameLocal = Maps.newHashMap();
+
+    private final Map<QName, Command> remoteCommands = Maps.newHashMap();
+    private final Map<String, QName> nameToQNameRemote = Maps.newHashMap();
+
+    public synchronized Map<QName, Command> getCommands() {
+        return Collections.unmodifiableMap(mergeCommands());
+    }
+
+    private Map<QName, Command> mergeCommands() {
+        // TODO cache this merged map
+        return mergeMaps(remoteCommands, localCommands);
+    }
+
+    private Map<String, QName> mergeCommandIds() {
+        // TODO cache this merged map
+        return mergeMaps(nameToQNameRemote, nameToQNameLocal);
+    }
+
+    private <K, V> Map<K, V> mergeMaps(final Map<K, V> remoteMap, final Map<K, V> localMap) {
+        final Map<K, V> mergedCommands = Maps.newHashMap();
+        mergedCommands.putAll(remoteMap);
+        mergedCommands.putAll(localMap);
+        return mergedCommands;
+    }
+
+    public synchronized Set<String> getCommandIds() {
+        return mergeCommandIds().keySet();
+    }
+
+    public synchronized Set<String> getRemoteCommandIds() {
+        return nameToQNameRemote.keySet();
+    }
+
+    public synchronized Optional<Command> getCommand(final String nameWithModule) {
+        final QName commandQName = mergeCommandIds().get(nameWithModule);
+        final Map<QName, Command> qNameCommandMap = mergeCommands();
+        if(commandQName == null || qNameCommandMap.containsKey(commandQName) == false) {
+            return Optional.absent();
+        }
+
+        return Optional.of(qNameCommandMap.get(commandQName));
+    }
+
+    public synchronized Optional<Command> getCommand(final QName qName) {
+        return Optional.fromNullable(mergeCommands().get(qName));
+    }
+
+    private static Optional<Command> getCommand(final Map<String, QName> commandNameMap, final Map<QName, Command> commands, final String nameWithModule) {
+        final QName qName = commandNameMap.get(nameWithModule);
+        if(qName == null)
+            return Optional.absent();
+
+        final Command command = commands.get(qName);
+        if(command == null) {
+            return Optional.absent();
+        }
+
+        return Optional.of(command);
+    }
+
+    public static final Collection<String> BASE_NETCONF_SCHEMA_PATHS = Lists.newArrayList("/schema/remote/ietf-netconf.yang",
+            "/schema/common/netconf-cli-ext.yang", "/schema/common/ietf-inet-types.yang");
+
+    public synchronized void addRemoteCommands(final RpcImplementation rpcInvoker, final SchemaContext remoteSchema) {
+        this.addRemoteCommands(rpcInvoker, remoteSchema, parseSchema(BASE_NETCONF_SCHEMA_PATHS));
+    }
+
+    public synchronized void addRemoteCommands(final RpcImplementation rpcInvoker, final SchemaContext remoteSchema, final SchemaContext baseNetconfSchema) {
+        for (final SchemaContext context : Lists.newArrayList(remoteSchema, baseNetconfSchema)) {
+            for (final Module module : context.getModules()) {
+                for (final RpcDefinition rpcDefinition : module.getRpcs()) {
+                    final Command command = RemoteCommand.fromRpc(rpcDefinition, rpcInvoker);
+                    remoteCommands.put(rpcDefinition.getQName(), command);
+                    nameToQNameRemote.put(getCommandName(rpcDefinition, module), rpcDefinition.getQName());
+                }
+            }
+        }
+    }
+
+    public synchronized void removeRemoteCommands() {
+        remoteCommands.clear();
+        nameToQNameRemote.clear();
+    }
+
+    public static final Collection<String> LOCAL_SCHEMA_PATHS = Lists.newArrayList("/schema/local/netconf-cli.yang", "/schema/common/netconf-cli-ext.yang",
+            "/schema/common/ietf-inet-types.yang");
+
+    public synchronized void addLocalCommands(final NetconfDeviceConnectionManager connectionManager, final SchemaContext localSchema, final Integer connectionTimeout) {
+        for (final Module module : localSchema.getModules()) {
+            for (final RpcDefinition rpcDefinition : module.getRpcs()) {
+
+                // FIXME make local commands extensible
+                // e.g. by yang extension defining java class to be instantiated
+                // problem is with command specific resources
+                // e.g. Help would need command registry
+                final Command localCommand;
+                if (rpcDefinition.getQName().equals(CommandConstants.HELP_QNAME)) {
+                    localCommand = Help.create(rpcDefinition, this);
+                } else if (rpcDefinition.getQName().equals(CommandConstants.CLOSE_QNAME)) {
+                    localCommand = Close.create(rpcDefinition);
+                } else if (rpcDefinition.getQName().equals(CommandConstants.CONNECT_QNAME)) {
+                    localCommand = Connect.create(rpcDefinition, connectionManager, connectionTimeout);
+                } else if (rpcDefinition.getQName().equals(CommandConstants.DISCONNECT_QNAME)) {
+                    localCommand = Disconnect.create(rpcDefinition, connectionManager);
+                } else {
+                    throw new IllegalStateException("No command implementation available for local command: " + rpcDefinition.getQName());
+                }
+
+                localCommands.put(localCommand.getCommandId(), localCommand);
+                nameToQNameLocal.put(getCommandName(rpcDefinition, module), localCommand.getCommandId());
+            }
+        }
+    }
+
+    private static String getCommandName(final RpcDefinition rpcDefinition, final Module module) {
+        return IOUtil.qNameToKeyString(rpcDefinition.getQName(), module.getName());
+    }
+
+    public static SchemaContext parseSchema(final Collection<String> yangPath) {
+        final YangParserImpl yangParserImpl = new YangParserImpl();
+        // TODO change deprecated method
+        final Set<Module> modules = yangParserImpl.parseYangModelsFromStreams(loadYangs(yangPath));
+        return yangParserImpl.resolveSchemaContext(modules);
+    }
+
+    private static List<InputStream> loadYangs(final Collection<String> yangPaths) {
+
+        return Lists.newArrayList(Collections2.transform(Lists.newArrayList(yangPaths),
+                new Function<String, InputStream>() {
+                    @Override
+                    public InputStream apply(final String input) {
+                        final InputStream resourceAsStream = NetconfDeviceConnectionHandler.class.getResourceAsStream(input);
+                        Preconditions.checkNotNull(resourceAsStream, "File %s was null", input);
+                        return resourceAsStream;
+                    }
+                }));
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/CommandInvocationException.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/CommandInvocationException.java
new file mode 100644 (file)
index 0000000..e38f45f
--- /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.netconf.cli.commands;
+
+import org.opendaylight.yangtools.yang.common.QName;
+
+public class CommandInvocationException extends Exception {
+
+    public CommandInvocationException(final QName qName, final Throwable cause) {
+        this("Command " + qName + " invocation failed: " + cause.getMessage(), cause);
+    }
+
+    protected CommandInvocationException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public static class CommandTimeoutException extends CommandInvocationException {
+
+        public CommandTimeoutException(final QName qName, final Throwable e) {
+            super("Command " + qName + " timed out: " + e.getMessage(), e);
+        }
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/input/Input.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/input/Input.java
new file mode 100644 (file)
index 0000000..02173ac
--- /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.netconf.cli.commands.input;
+
+import com.google.common.base.Preconditions;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+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.Node;
+import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl;
+
+/**
+ * Input arguments for and rpc/command execution
+ */
+public class Input {
+
+    private final List<Node<?>> args;
+
+    private final Map<String, Node<?>> nameToArg = new HashMap<String, Node<?>>();
+
+    public Input(final List<Node<?>> args) {
+        // FIXME empty Input should be constructed from static factory method
+        if(args.isEmpty()) {
+            this.args = Collections.emptyList();
+            return;
+        }
+
+        final Node<?> input = args.iterator().next();
+        Preconditions
+                .checkArgument(input instanceof CompositeNode, "Input container has to be of type composite node.");
+        this.args = ((CompositeNode) input).getValue();
+
+        for (final Node<?> arg : this.args) {
+            nameToArg.put(arg.getNodeType().getLocalName(), arg);
+        }
+    }
+
+    public Node<?> getArg(final String name) {
+        return nameToArg.get(name);
+    }
+
+    public CompositeNode wrap(final QName rpcQName) {
+        return new CompositeNodeTOImpl(rpcQName, null, args);
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/input/InputDefinition.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/input/InputDefinition.java
new file mode 100644 (file)
index 0000000..83e1b19
--- /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.netconf.cli.commands.input;
+
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+
+/**
+ * The definition of input arguments represented by schema nodes parsed from
+ * yang rpc definition
+ */
+public class InputDefinition {
+
+    private final ContainerSchemaNode inputContainer;
+
+    public InputDefinition(final ContainerSchemaNode inputContainer) {
+        this.inputContainer = inputContainer;
+    }
+
+    public static InputDefinition fromInput(final ContainerSchemaNode input) {
+        return new InputDefinition(input);
+    }
+
+    public ContainerSchemaNode getInput() {
+        return inputContainer;
+    }
+
+    // FIXME add empty as in output
+    public boolean isEmpty() {
+        return inputContainer == null;
+    }
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/local/Close.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/local/Close.java
new file mode 100644 (file)
index 0000000..c43432d
--- /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.netconf.cli.commands.local;
+
+import org.opendaylight.controller.netconf.cli.commands.AbstractCommand;
+import org.opendaylight.controller.netconf.cli.commands.Command;
+import org.opendaylight.controller.netconf.cli.commands.CommandInvocationException;
+import org.opendaylight.controller.netconf.cli.commands.input.Input;
+import org.opendaylight.controller.netconf.cli.commands.input.InputDefinition;
+import org.opendaylight.controller.netconf.cli.commands.output.Output;
+import org.opendaylight.controller.netconf.cli.commands.output.OutputDefinition;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+
+/**
+ * Local command to shut down the cli
+ */
+public class Close extends AbstractCommand {
+
+    public Close(final QName qName, final InputDefinition args, final OutputDefinition output, final String description) {
+        super(qName, args, output, description);
+    }
+
+    @Override
+    public Output invoke(final Input inputArgs) throws CommandInvocationException {
+        // FIXME clean up, close session and then close
+        System.exit(0);
+        return null;
+    }
+
+    public static Command create(final RpcDefinition rpcDefinition) {
+        return new Close(rpcDefinition.getQName(), getInputDefinition(rpcDefinition),
+                getOutputDefinition(rpcDefinition), rpcDefinition.getDescription());
+    }
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/local/Connect.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/local/Connect.java
new file mode 100644 (file)
index 0000000..f702aa3
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * 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.netconf.cli.commands.local;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import io.netty.util.concurrent.GlobalEventExecutor;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Set;
+import org.opendaylight.controller.netconf.cli.NetconfDeviceConnectionManager;
+import org.opendaylight.controller.netconf.cli.commands.AbstractCommand;
+import org.opendaylight.controller.netconf.cli.commands.Command;
+import org.opendaylight.controller.netconf.cli.commands.input.Input;
+import org.opendaylight.controller.netconf.cli.commands.input.InputDefinition;
+import org.opendaylight.controller.netconf.cli.commands.output.Output;
+import org.opendaylight.controller.netconf.cli.commands.output.OutputDefinition;
+import org.opendaylight.controller.netconf.client.conf.NetconfClientConfiguration;
+import org.opendaylight.controller.netconf.client.conf.NetconfClientConfigurationBuilder;
+import org.opendaylight.controller.netconf.nettyutil.handler.ssh.authentication.LoginPassword;
+import org.opendaylight.protocol.framework.NeverReconnectStrategy;
+import org.opendaylight.protocol.framework.ReconnectStrategy;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.api.SimpleNode;
+import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl;
+import org.opendaylight.yangtools.yang.data.impl.SimpleNodeTOImpl;
+import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+
+/**
+ * Local command to connect to a remote device
+ */
+public class Connect extends AbstractCommand {
+
+    private final NetconfDeviceConnectionManager connectManager;
+    private final Integer connectionTimeout;
+
+    private Connect(final QName qName, final InputDefinition args, final OutputDefinition output,
+                    final NetconfDeviceConnectionManager connectManager, final String description, final Integer connectionTimeout) {
+        super(qName, args, output, description);
+        this.connectManager = connectManager;
+        this.connectionTimeout = connectionTimeout;
+    }
+
+    @Override
+    public Output invoke(final Input inputArgs) {
+        final NetconfClientConfigurationBuilder config = getConfig(inputArgs);
+        return invoke(config, getArgument(inputArgs, "address-name", String.class));
+    }
+
+    private Output invoke(final NetconfClientConfigurationBuilder config, final String addressName) {
+        final Set<String> remoteCmds = connectManager.connectBlocking(addressName, config);
+
+        final ArrayList<Node<?>> output = Lists.newArrayList();
+        output.add(new SimpleNodeTOImpl<>(QName.create(getCommandId(), "status"), null, "Connection initiated"));
+
+        for (final String cmdId : remoteCmds) {
+            output.add(new SimpleNodeTOImpl<>(QName.create(getCommandId(), "remote-commands"), null, cmdId));
+        }
+
+        return new Output(new CompositeNodeTOImpl(getCommandId(), null, output));
+    }
+
+    private NetconfClientConfigurationBuilder getConfig(final Input inputArgs) {
+
+        final ReconnectStrategy strategy = getReconnectStrategy();
+
+        final String address = getArgument(inputArgs, "address-name", String.class);
+        final Integer port = getArgument(inputArgs, "address-port", Integer.class);
+        final String username = getArgument(inputArgs, "user-name", String.class);
+        final String passwd = getArgument(inputArgs, "user-password", String.class);
+
+        final InetSocketAddress inetAddress;
+        try {
+            inetAddress = new InetSocketAddress(InetAddress.getByName(address), port);
+        } catch (final UnknownHostException e) {
+            throw new IllegalArgumentException("Unable to use address: " + address, e);
+        }
+
+        return NetconfClientConfigurationBuilder.create().withAddress(inetAddress)
+                .withConnectionTimeoutMillis(connectionTimeout)
+                .withReconnectStrategy(strategy)
+                .withAuthHandler(new LoginPassword(username, passwd))
+                .withProtocol(NetconfClientConfiguration.NetconfClientProtocol.SSH);
+    }
+
+    private <T> Optional<T> getArgumentOpt(final Input inputArgs, final String argName, final Class<T> type) {
+        final QName argQName = QName.create(getCommandId(), argName);
+        final Node<?> argumentNode = inputArgs.getArg(argName);
+        if (argumentNode == null) {
+            return Optional.absent();
+        }
+        Preconditions.checkArgument(argumentNode instanceof SimpleNode, "Only simple type argument supported, %s",
+                argQName);
+
+        final Object value = argumentNode.getValue();
+        Preconditions.checkArgument(type.isInstance(value), "Unexpected instance type: %s for argument: %s",
+                value.getClass(), argQName);
+        return Optional.of(type.cast(value));
+    }
+
+    private <T> T getArgument(final Input inputArgs, final String argName, final Class<T> type) {
+        final Optional<T> argumentOpt = getArgumentOpt(inputArgs, argName, type);
+        Preconditions.checkState(argumentOpt.isPresent(), "Argument: %s is missing but is required", argName);
+        return argumentOpt.get();
+    }
+
+    public static ReconnectStrategy getReconnectStrategy() {
+        // FIXME move to args either start-up args or input nodes for connect or both
+        return new NeverReconnectStrategy(GlobalEventExecutor.INSTANCE, 1000);
+    }
+
+    public static Command create(final RpcDefinition rpcDefinition, final NetconfDeviceConnectionManager connectManager, final Integer connectionTimeout) {
+        return new Connect(rpcDefinition.getQName(), getInputDefinition(rpcDefinition),
+                getOutputDefinition(rpcDefinition), connectManager, rpcDefinition.getDescription(), connectionTimeout);
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/local/Disconnect.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/local/Disconnect.java
new file mode 100644 (file)
index 0000000..723e484
--- /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.netconf.cli.commands.local;
+
+import com.google.common.collect.Lists;
+import org.opendaylight.controller.netconf.cli.NetconfDeviceConnectionManager;
+import org.opendaylight.controller.netconf.cli.commands.AbstractCommand;
+import org.opendaylight.controller.netconf.cli.commands.Command;
+import org.opendaylight.controller.netconf.cli.commands.input.Input;
+import org.opendaylight.controller.netconf.cli.commands.input.InputDefinition;
+import org.opendaylight.controller.netconf.cli.commands.output.Output;
+import org.opendaylight.controller.netconf.cli.commands.output.OutputDefinition;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl;
+import org.opendaylight.yangtools.yang.data.impl.SimpleNodeTOImpl;
+import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+
+/**
+ * Local disconnect command
+ */
+public class Disconnect extends AbstractCommand {
+
+    private final NetconfDeviceConnectionManager connectionManager;
+
+    public Disconnect(final QName qName, final InputDefinition inputDefinition,
+            final OutputDefinition outputDefinition, final NetconfDeviceConnectionManager connectionManager,
+            final String description) {
+        super(qName, inputDefinition, outputDefinition, description);
+        this.connectionManager = connectionManager;
+    }
+
+    @Override
+    public Output invoke(final Input inputArgs) {
+        connectionManager.disconnect();
+
+        return new Output(new CompositeNodeTOImpl(getCommandId(), null,
+                Lists.<Node<?>> newArrayList(new SimpleNodeTOImpl<>(new QName(getCommandId(), "status"), null,
+                        "Connection disconnected"))));
+    }
+
+    public static Command create(final RpcDefinition rpcDefinition,
+            final NetconfDeviceConnectionManager commandDispatcher) {
+        return new Disconnect(rpcDefinition.getQName(), getInputDefinition(rpcDefinition),
+                getOutputDefinition(rpcDefinition), commandDispatcher, rpcDefinition.getDescription());
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/local/Help.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/local/Help.java
new file mode 100644 (file)
index 0000000..1816469
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * 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.netconf.cli.commands.local;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import java.util.ArrayList;
+import java.util.List;
+import org.opendaylight.controller.netconf.cli.commands.AbstractCommand;
+import org.opendaylight.controller.netconf.cli.commands.Command;
+import org.opendaylight.controller.netconf.cli.commands.CommandDispatcher;
+import org.opendaylight.controller.netconf.cli.commands.input.Input;
+import org.opendaylight.controller.netconf.cli.commands.input.InputDefinition;
+import org.opendaylight.controller.netconf.cli.commands.output.Output;
+import org.opendaylight.controller.netconf.cli.commands.output.OutputDefinition;
+import org.opendaylight.yangtools.yang.common.QName;
+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.model.api.RpcDefinition;
+
+/**
+ * Local Help command. Displays all commands with description.
+ */
+public class Help extends AbstractCommand {
+
+    private final CommandDispatcher commandDispatcher;
+
+    public Help(final QName qName, final InputDefinition argsDefinition, final OutputDefinition output, final String description, final CommandDispatcher commandDispatcher) {
+        super(qName, argsDefinition, output, description);
+        this.commandDispatcher = commandDispatcher;
+    }
+
+    @Override
+    public Output invoke(final Input inputArgs) {
+        final ArrayList<Node<?>> value = Lists.newArrayList();
+
+        for (final String id : commandDispatcher.getCommandIds()) {
+            final Optional<Command> cmd = commandDispatcher.getCommand(id);
+            Preconditions.checkState(cmd.isPresent(), "Command %s has to be present in command dispatcher", id);
+            final Optional<String> description = cmd.get().getCommandDescription();
+            final List<Node<?>> nameAndDescription = Lists.newArrayList();
+            nameAndDescription.add(NodeFactory.createImmutableSimpleNode(QName.create(getCommandId(), "id"), null, id));
+            if(description.isPresent()) {
+                nameAndDescription.add(NodeFactory.createImmutableSimpleNode(QName.create(getCommandId(), "description"), null, description.get()));
+            }
+            value.add(ImmutableCompositeNode.create(QName.create(getCommandId(), "commands"), nameAndDescription));
+        }
+
+        return new Output(new CompositeNodeTOImpl(getCommandId(), null, value));
+    }
+
+    public static Command create(final RpcDefinition rpcDefinition, final CommandDispatcher commandDispatcher) {
+        return new Help(rpcDefinition.getQName(), getInputDefinition(rpcDefinition), getOutputDefinition(rpcDefinition), rpcDefinition.getDescription(), commandDispatcher);
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/output/Output.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/output/Output.java
new file mode 100644 (file)
index 0000000..c366c89
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * 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.netconf.cli.commands.output;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import java.util.List;
+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.Node;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+
+/**
+ * Output values for and rpc/command execution
+ */
+public class Output {
+
+    private final CompositeNode output;
+
+    public Output(final CompositeNode output) {
+        this.output = output;
+    }
+
+    public Map<DataSchemaNode, List<Node<?>>> unwrap(final OutputDefinition outputDefinition) {
+        Preconditions.checkArgument(outputDefinition.isEmpty() == false);
+
+        final Map<QName, DataSchemaNode> mappedSchemaNodes = mapOutput(outputDefinition);
+        final Map<DataSchemaNode, List<Node<?>>> mappedNodesToSchema = Maps.newHashMap();
+
+        for (final Node<?> node : output.getValue()) {
+            final DataSchemaNode schemaNode = mappedSchemaNodes.get(node.getKey().withoutRevision());
+            final List<Node<?>> list = mappedNodesToSchema.get(schemaNode) == null ? Lists.<Node<?>> newArrayList()
+                    : mappedNodesToSchema.get(schemaNode);
+            list.add(node);
+            mappedNodesToSchema.put(schemaNode, list);
+        }
+
+        return mappedNodesToSchema;
+    }
+
+    public CompositeNode getOutput() {
+        return output;
+    }
+
+    private Map<QName, DataSchemaNode> mapOutput(final OutputDefinition outputDefinition) {
+        final Map<QName, DataSchemaNode> mapped = Maps.newHashMap();
+        for (final DataSchemaNode dataSchemaNode : outputDefinition) {
+            // without revision since data QNames come without revision
+            mapped.put(dataSchemaNode.getQName().withoutRevision(), dataSchemaNode);
+        }
+
+        return mapped;
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/output/OutputDefinition.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/output/OutputDefinition.java
new file mode 100644 (file)
index 0000000..66d0d4d
--- /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.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;
+
+/**
+ * The definition of output elements represented by schema nodes parsed from yang rpc definition
+ */
+public class OutputDefinition implements Iterable<DataSchemaNode> {
+
+    public static final OutputDefinition EMPTY_OUTPUT = new OutputDefinition(Collections.<DataSchemaNode>emptySet());
+    private final Set<DataSchemaNode> childNodes;
+
+    public OutputDefinition(final Set<DataSchemaNode> childNodes) {
+        this.childNodes = childNodes;
+    }
+
+    @Override
+    public Iterator<DataSchemaNode> iterator() {
+        return childNodes.iterator();
+    }
+
+    public static OutputDefinition fromOutput(final ContainerSchemaNode output) {
+        Preconditions.checkNotNull(output);
+        return new OutputDefinition(output.getChildNodes());
+    }
+
+    public static OutputDefinition empty() {
+        return EMPTY_OUTPUT;
+    }
+
+    public boolean isEmpty() {
+        return this == EMPTY_OUTPUT;
+    }
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/remote/RemoteCommand.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/commands/remote/RemoteCommand.java
new file mode 100644 (file)
index 0000000..05b9e85
--- /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.netconf.cli.commands.remote;
+
+import com.google.common.util.concurrent.ListenableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import org.opendaylight.controller.netconf.cli.commands.AbstractCommand;
+import org.opendaylight.controller.netconf.cli.commands.Command;
+import org.opendaylight.controller.netconf.cli.commands.CommandInvocationException;
+import org.opendaylight.controller.netconf.cli.commands.input.Input;
+import org.opendaylight.controller.netconf.cli.commands.input.InputDefinition;
+import org.opendaylight.controller.netconf.cli.commands.output.Output;
+import org.opendaylight.controller.netconf.cli.commands.output.OutputDefinition;
+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.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+
+/**
+ * Generic remote command implementation that sends the rpc xml to the remote device and waits for response
+ * Waiting is limited with TIMEOUT
+ */
+public class RemoteCommand extends AbstractCommand {
+
+    // TODO make this configurable
+    private static final long DEFAULT_TIMEOUT = 10000;
+    private static final TimeUnit DEFAULT_TIMEOUT_UNIT = TimeUnit.MILLISECONDS;
+    private final RpcImplementation rpc;
+
+    public RemoteCommand(final QName qName, final InputDefinition args, final OutputDefinition output, final String description, final RpcImplementation rpc) {
+        super(qName, args, output, description);
+        this.rpc = rpc;
+    }
+
+    @Override
+    public Output invoke(final Input inputArgs) throws CommandInvocationException {
+        final ListenableFuture<RpcResult<CompositeNode>> invokeRpc = rpc.invokeRpc(getCommandId(), inputArgs.wrap(getCommandId()));
+        try {
+            return new Output(invokeRpc.get(DEFAULT_TIMEOUT, DEFAULT_TIMEOUT_UNIT).getResult());
+        } catch (final ExecutionException e) {
+            throw new CommandInvocationException(getCommandId(), e);
+        } catch (final TimeoutException e) {
+            // Request timed out, cancel request
+            invokeRpc.cancel(true);
+            throw new CommandInvocationException.CommandTimeoutException(getCommandId(), e);
+        } catch (final InterruptedException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public static Command fromRpc(final RpcDefinition rpcDefinition, final RpcImplementation rpcInvoker) {
+        final InputDefinition args = getInputDefinition(rpcDefinition);
+        final OutputDefinition retVal = getOutputDefinition(rpcDefinition);
+
+        return new RemoteCommand(rpcDefinition.getQName(), args, retVal, rpcDefinition.getDescription(), rpcInvoker);
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/io/BaseConsoleContext.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/io/BaseConsoleContext.java
new file mode 100644 (file)
index 0000000..26e46d3
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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.netconf.cli.io;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import jline.console.completer.AggregateCompleter;
+import jline.console.completer.Completer;
+import jline.console.completer.StringsCompleter;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+
+public class BaseConsoleContext<T extends DataSchemaNode> implements ConsoleContext {
+
+    private static final Completer SKIP_COMPLETER = new StringsCompleter(IOUtil.SKIP);
+
+    private final T dataSchemaNode;
+
+    public BaseConsoleContext(final T dataSchemaNode) {
+        Preconditions.checkNotNull(dataSchemaNode);
+        this.dataSchemaNode = dataSchemaNode;
+    }
+
+    @Override
+    public Completer getCompleter() {
+        final ArrayList<Completer> completers = Lists.newArrayList(SKIP_COMPLETER);
+        completers.addAll(getAdditionalCompleters());
+        return new AggregateCompleter(completers);
+    }
+
+    protected List<Completer> getAdditionalCompleters() {
+        return Collections.emptyList();
+    }
+
+    @Override
+    public Optional<String> getPrompt() {
+        return Optional.of(dataSchemaNode.getQName().getLocalName());
+    }
+
+    protected T getDataSchemaNode() {
+        return dataSchemaNode;
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/io/ConsoleContext.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/io/ConsoleContext.java
new file mode 100644 (file)
index 0000000..f4ebfca
--- /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.netconf.cli.io;
+
+import com.google.common.base.Optional;
+import jline.console.completer.Completer;
+
+/**
+ * Context to be set in the IO. Different prompts + completers are required in different contexts of the CLI.
+ */
+public interface ConsoleContext {
+
+    Completer getCompleter();
+
+    Optional<String> getPrompt();
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/io/ConsoleIO.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/io/ConsoleIO.java
new file mode 100644 (file)
index 0000000..6bffeac
--- /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.netconf.cli.io;
+
+import java.io.IOException;
+
+/**
+ * Definition of IO interface
+ */
+public interface ConsoleIO {
+
+    String read() throws IOException;
+
+    String read(Character mask) throws IOException;
+
+    void write(CharSequence data) throws IOException;
+
+    void writeLn(CharSequence data) throws IOException;
+
+    void formatLn(String format, Object... args) throws IOException;
+
+    void enterContext(ConsoleContext consoleContext);
+
+    void enterRootContext(ConsoleContext consoleContext);
+
+    void leaveContext();
+
+    void leaveRootContext();
+
+    void complete();
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/io/ConsoleIOImpl.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/io/ConsoleIOImpl.java
new file mode 100644 (file)
index 0000000..5b7374a
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ * 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.netconf.cli.io;
+
+import static org.opendaylight.controller.netconf.cli.io.IOUtil.PATH_SEPARATOR;
+import static org.opendaylight.controller.netconf.cli.io.IOUtil.PROMPT_SUFIX;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.Lists;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.IOException;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Deque;
+import java.util.Iterator;
+import jline.console.ConsoleReader;
+import jline.console.completer.Completer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Jline based IO implementation
+ */
+public class ConsoleIOImpl implements ConsoleIO {
+
+    private static final Logger LOG = LoggerFactory.getLogger(ConsoleIOImpl.class);
+
+    private final ConsoleReader console;
+    private final Deque<ConsoleContext> contexts = new ArrayDeque<>();
+
+    public ConsoleIOImpl() throws IOException {
+        console = new ConsoleReader();
+        console.setHandleUserInterrupt(true);
+        console.setPaginationEnabled(true);
+        console.setHistoryEnabled(true);
+
+        // TODO trifferedActions not supported by jline in current version
+        // https://github.com/jline/jline2/issues/149
+        console.addTriggeredAction('?', new QuestionMarkActionListener());
+    }
+
+    @Override
+    public String read() throws IOException {
+        return console.readLine().trim();
+    }
+
+    @Override
+    public String read(final Character mask) throws IOException {
+        return console.readLine(mask).trim();
+    }
+
+    @Override
+    public void write(final CharSequence data) throws IOException {
+        console.print(data);
+        console.flush();
+    }
+
+    @Override
+    public void writeLn(final CharSequence data) throws IOException {
+        console.println(data);
+        console.flush();
+    }
+
+    @Override
+    public void formatLn(final String format, final Object... args) throws IOException {
+        console.println(String.format(format, args));
+        console.flush();
+    }
+
+    @Override
+    public void enterContext(final ConsoleContext consoleContext) {
+        contexts.push(consoleContext);
+        enterCtx(consoleContext);
+    }
+
+
+    @Override
+    public void enterRootContext(final ConsoleContext consoleContext) {
+        contexts.addLast(consoleContext);
+        enterCtx(consoleContext);
+    }
+
+    private void enterCtx(final ConsoleContext consoleContext) {
+        setCompleter(consoleContext.getCompleter());
+        console.setPrompt(buildPrompt());
+    }
+
+    @Override
+    public void leaveContext() {
+        contexts.pollFirst();
+        leaveCtx();
+    }
+
+    @Override
+    public void leaveRootContext() {
+        contexts.pollLast();
+        leaveCtx();
+    }
+
+    private void leaveCtx() {
+        console.setPrompt(buildPrompt());
+        if (contexts.peek() != null) {
+            setCompleter(contexts.peek().getCompleter());
+        }
+    }
+
+    protected String buildPrompt() {
+        final StringBuilder newPrompt = new StringBuilder();
+
+        final Iterator<ConsoleContext> descendingIterator = contexts.descendingIterator();
+        while (descendingIterator.hasNext()) {
+            final ConsoleContext consoleContext = descendingIterator.next();
+            final Optional<String> promptPart = consoleContext.getPrompt();
+            if (promptPart.isPresent()) {
+                newPrompt.append(PATH_SEPARATOR);
+                newPrompt.append(promptPart.get());
+            }
+        }
+        if (newPrompt.length() ==0) {
+            newPrompt.append(PATH_SEPARATOR);
+        }
+
+        newPrompt.append(PROMPT_SUFIX);
+
+        return newPrompt.toString();
+    }
+
+    private void setCompleter(final Completer newCompleter) {
+        for (final Completer concreteCompleter : console.getCompleters()) {
+            console.removeCompleter(concreteCompleter);
+        }
+        console.addCompleter(newCompleter);
+    }
+
+    private class QuestionMarkActionListener implements ActionListener {
+        @Override
+        public void actionPerformed(final ActionEvent e) {
+            ConsoleIOImpl.this.complete();
+        }
+    }
+
+    public void complete() {
+        final ArrayList<CharSequence> candidates = Lists.newArrayList();
+        contexts.peek().getCompleter().complete("", 0, candidates);
+        try {
+            console.getCompletionHandler().complete(console, candidates, 0);
+        } catch (final IOException ex) {
+            throw new IllegalStateException("Unable to write to output", ex);
+        }
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/io/IOUtil.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/io/IOUtil.java
new file mode 100644 (file)
index 0000000..1817cdd
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * 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.netconf.cli.io;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.opendaylight.controller.netconf.cli.reader.ReadingException;
+import org.opendaylight.yangtools.yang.common.QName;
+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.SchemaNode;
+
+public class IOUtil {
+
+    public static final String SKIP = "skip";
+    public static final String PROMPT_SUFIX = ">";
+    public static final String PATH_SEPARATOR = "/";
+
+    private IOUtil() {
+    }
+
+    public static boolean isQName(final String qName) {
+        final Matcher matcher = patternNew.matcher(qName);
+        return matcher.matches();
+    }
+
+    public static Date parseDate(final String revision) {
+        final SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+        try {
+            return formatter.parse(revision);
+        } catch (final ParseException e) {
+            throw new IllegalArgumentException("Date not valid", e);
+        }
+    }
+
+    public static String listType(final SchemaNode schemaNode) {
+        if (schemaNode instanceof LeafListSchemaNode) {
+            return "Leaf-list";
+        } else if (schemaNode instanceof ListSchemaNode) {
+            return "List";
+        } else if (schemaNode instanceof LeafSchemaNode) {
+            return "Leaf";
+        }
+        // FIXME throw exception on unexpected state, not null/emptyString
+        return "";
+    }
+
+    public static String qNameToKeyString(final QName qName, final String moduleName) {
+        return String.format("%s(%s)", qName.getLocalName(), moduleName);
+    }
+
+    // TODO test and check regex + review format of string for QName
+    final static Pattern patternNew = Pattern.compile("([^\\)]+)\\(([^\\)]+)\\)");
+
+    public static QName qNameFromKeyString(final String qName, final Map<String, QName> mappedModules)
+            throws ReadingException {
+        final Matcher matcher = patternNew.matcher(qName);
+        if (!matcher.matches()) {
+            final String message = String.format("QName in wrong format: %s should be: %s", qName, patternNew);
+            throw new ReadingException(message);
+        }
+        final QName base = mappedModules.get(matcher.group(2));
+        if (base == null) {
+            final String message = String.format("Module %s cannot be found", matcher.group(2));
+            throw new ReadingException(message);
+        }
+        return QName.create(base, matcher.group(1));
+    }
+
+    public static boolean isSkipInput(final String rawValue) {
+        return rawValue.equals(SKIP);
+    }
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/AbstractReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/AbstractReader.java
new file mode 100644 (file)
index 0000000..6131eef
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * 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.netconf.cli.reader;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Strings;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import jline.console.completer.Completer;
+import jline.console.completer.NullCompleter;
+import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.EmptyTypeDefinition;
+
+public abstract class AbstractReader<T extends DataSchemaNode> implements Reader<T> {
+
+    public static final NullContext NULL_CONTEXT = new NullContext();
+
+    // TODO make console private add protected getter
+    protected ConsoleIO console;
+    private final SchemaContext context;
+    private boolean readConfigNode = false;
+
+    public AbstractReader(final ConsoleIO console, final SchemaContext context) {
+        this.console = console;
+        this.context = context;
+    }
+
+    public AbstractReader(final ConsoleIO console, final SchemaContext context, final boolean readConfigNode) {
+        this(console, context);
+        this.readConfigNode = readConfigNode;
+    }
+
+    protected SchemaContext getSchemaContext() {
+        return context;
+    }
+
+    protected ConsoleIO getConsole() {
+        return console;
+    }
+
+    protected boolean getReadConfigNode() {
+        return readConfigNode;
+    }
+
+    @Override
+    public List<Node<?>> read(final T schemaNode) throws ReadingException {
+        if (isReadingWanted(schemaNode)) {
+            final ConsoleContext ctx = getContext(schemaNode);
+            console.enterContext(ctx);
+            try {
+                return readWithContext(schemaNode);
+            } catch (final IOException e) {
+                throw new ReadingException("Unable to read data from input for " + schemaNode.getQName(), e);
+            } finally {
+                console.leaveContext();
+            }
+        }
+        return Collections.emptyList();
+    }
+
+    private boolean isReadingWanted(final DataSchemaNode node) {
+        if (readConfigNode && !node.isConfiguration()) {
+            return false;
+        }
+        return true;
+    }
+
+    // TODO javadoc
+
+    protected abstract List<Node<?>> readWithContext(T schemaNode) throws IOException, ReadingException;
+
+    protected abstract ConsoleContext getContext(T schemaNode);
+
+    protected Optional<String> getDefaultValue(final T schemaNode) {
+        String defaultValue = null;
+        if (schemaNode instanceof LeafSchemaNode) {
+            defaultValue = ((LeafSchemaNode) schemaNode).getDefault();
+        } else if (schemaNode instanceof ChoiceNode) {
+            defaultValue = ((ChoiceNode) schemaNode).getDefaultCase();
+        }
+
+        return Optional.fromNullable(defaultValue);
+    }
+
+    protected boolean isEmptyInput(final String rawValue) {
+        return Strings.isNullOrEmpty(rawValue);
+    }
+
+    protected static boolean isEmptyType(final TypeDefinition<?> type) {
+        return type instanceof EmptyTypeDefinition;
+    }
+
+    private static class NullContext implements ConsoleContext {
+        @Override
+        public Completer getCompleter() {
+            return new NullCompleter();
+        }
+
+        @Override
+        public Optional<String> getPrompt() {
+            return Optional.absent();
+        }
+    }
+
+}
@@ -5,20 +5,13 @@
  * 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.spi.remote;
-
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-
-public interface RemoteRpcRouter {
-
-
-
-
-
-
-    ListenerRegistration<RouteChangeListener> registerRouteChangeListener(RouteChangeListener listener);
-
+package org.opendaylight.controller.netconf.cli.reader;
 
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 
+/**
+ * marker interface to mark reader which can be used with GenericListReader
+ */
+public interface GenericListEntryReader<T extends DataSchemaNode> extends Reader<T> {
 
 }
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/Reader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/Reader.java
new file mode 100644 (file)
index 0000000..9f27b8f
--- /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.netconf.cli.reader;
+
+import java.util.List;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+
+/**
+ * Generic provider(reader) of input arguments for commands
+ */
+public interface Reader<T extends DataSchemaNode> {
+
+    List<Node<?>> read(T schemaNode) throws ReadingException;
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/ReadingException.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/ReadingException.java
new file mode 100644 (file)
index 0000000..81915fc
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * 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.netconf.cli.reader;
+
+public class ReadingException extends Exception {
+
+    private static final long serialVersionUID = -298382323286156591L;
+
+    public ReadingException(final String msg, final Exception e) {
+        super(msg, e);
+    }
+
+    public ReadingException(final String msg) {
+        super(msg);
+    }
+
+    public static class IncorrectValueException extends ReadingException {
+
+        private static final long serialVersionUID = 164168437058431592L;
+
+        public IncorrectValueException(final String msg) {
+            super(msg);
+        }
+
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/custom/ConfigReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/custom/ConfigReader.java
new file mode 100644 (file)
index 0000000..95fc098
--- /dev/null
@@ -0,0 +1,203 @@
+/*
+ * 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.netconf.cli.reader.custom;
+
+import static org.opendaylight.controller.netconf.cli.io.IOUtil.isSkipInput;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import java.io.IOException;
+import java.net.URI;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import jline.console.completer.Completer;
+import org.opendaylight.controller.netconf.cli.CommandArgHandlerRegistry;
+import org.opendaylight.controller.netconf.cli.io.BaseConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.cli.io.IOUtil;
+import org.opendaylight.controller.netconf.cli.reader.AbstractReader;
+import org.opendaylight.controller.netconf.cli.reader.ReadingException;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl;
+import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+/**
+ * Custom reader implementation for filter elements in get/get-config rpcs. This
+ * reader overrides the default anyxml reader and reads filter as a schema path.
+ */
+public class ConfigReader extends AbstractReader<DataSchemaNode> {
+
+    public static final String SEPARATOR = "/";
+
+    private final CommandArgHandlerRegistry commandArgHandlerRegistry;
+    private final Map<String, QName> mappedModules;
+    private final Map<URI, QName> mappedModulesNamespace;
+
+    public ConfigReader(final ConsoleIO console, final SchemaContext remoteSchemaContext,
+            final CommandArgHandlerRegistry commandArgHandlerRegistry) {
+        super(console, remoteSchemaContext);
+        this.commandArgHandlerRegistry = commandArgHandlerRegistry;
+
+        mappedModules = Maps.newHashMap();
+        mappedModulesNamespace = Maps.newHashMap();
+        for (final Module module : remoteSchemaContext.getModules()) {
+            final QName moduleQName = QName.create(module.getNamespace(), module.getRevision(), module.getName());
+            mappedModules.put(moduleQName.getLocalName(), moduleQName);
+            mappedModulesNamespace.put(moduleQName.getNamespace(), moduleQName);
+        }
+    }
+
+    // FIXME refactor + unite common code with FilterReader
+
+    @Override
+    protected List<Node<?>> readWithContext(final DataSchemaNode schemaNode) throws IOException, ReadingException {
+        console.writeLn("Config " + schemaNode.getQName().getLocalName());
+        console.writeLn("Submit path of the data to edit. Use TAB for autocomplete");
+
+        final String rawValue = console.read();
+
+        // FIXME isSkip check should be somewhere in abstractReader
+        if (isSkipInput(rawValue) || Strings.isNullOrEmpty(rawValue)) {
+            return Collections.emptyList();
+        }
+
+        final List<QName> filterPartsQNames = Lists.newArrayList();
+
+        for (final String part : rawValue.split(SEPARATOR)) {
+            final QName qName = IOUtil.qNameFromKeyString(part, mappedModules);
+            filterPartsQNames.add(qName);
+        }
+
+        List<Node<?>> previous = readInnerNode(rawValue);
+
+        for (final QName qName : Lists.reverse(filterPartsQNames).subList(1, filterPartsQNames.size())) {
+            previous = Collections.<Node<?>> singletonList(new CompositeNodeTOImpl(qName, null,
+                    previous == null ? Collections.<Node<?>> emptyList() : previous));
+        }
+
+        final Node<?> newNode = previous == null ? null
+                : new CompositeNodeTOImpl(schemaNode.getQName(), null, previous);
+
+        return Collections.<Node<?>> singletonList(newNode);
+    }
+
+    private List<Node<?>> readInnerNode(final String pathString) throws ReadingException {
+        final Optional<DataSchemaNode> schema = getCurrentNode(getSchemaContext(), pathString);
+        Preconditions.checkState(schema.isPresent(), "Unable to find schema for %s", pathString);
+        return commandArgHandlerRegistry.getGenericReader(getSchemaContext(), true).read(schema.get());
+    }
+
+    @Override
+    protected ConsoleContext getContext(final DataSchemaNode schemaNode) {
+        return new FilterConsoleContext(schemaNode, getSchemaContext());
+    }
+
+    private final class FilterConsoleContext extends BaseConsoleContext<DataSchemaNode> {
+
+        private final SchemaContext remoteSchemaContext;
+
+        public FilterConsoleContext(final DataSchemaNode schemaNode, final SchemaContext remoteSchemaContext) {
+            super(schemaNode);
+            this.remoteSchemaContext = remoteSchemaContext;
+        }
+
+        @Override
+        protected List<Completer> getAdditionalCompleters() {
+            return Collections.<Completer> singletonList(new FilterCompleter(remoteSchemaContext));
+        }
+    }
+
+    private final class FilterCompleter implements Completer {
+
+        private final SchemaContext remoteSchemaContext;
+
+        public FilterCompleter(final SchemaContext remoteSchemaContext) {
+            this.remoteSchemaContext = remoteSchemaContext;
+        }
+
+        @Override
+        public int complete(final String buffer, final int cursor, final List<CharSequence> candidates) {
+            final int idx = buffer.lastIndexOf(SEPARATOR);
+
+            final Optional<DataSchemaNode> currentNode = getCurrentNode(remoteSchemaContext, buffer);
+            if (currentNode.isPresent() && currentNode.get() instanceof DataNodeContainer) {
+                final Collection<DataSchemaNode> childNodes = ((DataNodeContainer) currentNode.get()).getChildNodes();
+                final Collection<String> transformed = Collections2.transform(childNodes,
+                        new Function<DataSchemaNode, String>() {
+                            @Override
+                            public String apply(final DataSchemaNode input) {
+                                return IOUtil.qNameToKeyString(input.getQName(),
+                                        mappedModulesNamespace.get(input.getQName().getNamespace()).getLocalName());
+                            }
+                        });
+
+                fillCandidates(buffer.substring(idx + 1), candidates, transformed);
+            }
+
+            return idx == -1 ? 0 : idx + 1;
+        }
+
+        private void fillCandidates(final String buffer, final List<CharSequence> candidates,
+                final Collection<String> transformed) {
+            final SortedSet<String> strings = new TreeSet<>(transformed);
+
+            if (buffer == null) {
+                candidates.addAll(strings);
+            } else {
+                for (final String match : strings.tailSet(buffer)) {
+                    if (!match.startsWith(buffer)) {
+                        break;
+                    }
+                    candidates.add(match);
+                }
+            }
+
+            if (candidates.size() == 1) {
+                candidates.set(0, candidates.get(0) + SEPARATOR);
+            }
+        }
+
+    }
+
+    private Optional<DataSchemaNode> getCurrentNode(DataSchemaNode parent, final String buffer) {
+        for (final String part : buffer.split(SEPARATOR)) {
+            if (IOUtil.isQName(part) == false) {
+                return Optional.of(parent);
+            }
+
+            final QName qName;
+            try {
+                qName = IOUtil.qNameFromKeyString(part, mappedModules);
+            } catch (final ReadingException e) {
+                return Optional.of(parent);
+            }
+            if (parent instanceof DataNodeContainer) {
+                parent = ((DataNodeContainer) parent).getDataChildByName(qName);
+            } else {
+                // This should check if we are at the end of buffer ?
+                return Optional.of(parent);
+            }
+        }
+        return Optional.of(parent);
+    }
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/custom/EditContentReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/custom/EditContentReader.java
new file mode 100644 (file)
index 0000000..af43d37
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * 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.netconf.cli.reader.custom;
+
+import com.google.common.base.Preconditions;
+import java.io.IOException;
+import java.util.List;
+import org.opendaylight.controller.netconf.cli.CommandArgHandlerRegistry;
+import org.opendaylight.controller.netconf.cli.commands.CommandConstants;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.cli.reader.ReadingException;
+import org.opendaylight.controller.netconf.cli.reader.impl.ChoiceReader;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
+import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+public class EditContentReader extends ChoiceReader {
+
+    public static final QName EDIT_CONTENT_QNAME = QName.create(CommandConstants.NETCONF_BASE_QNAME, "edit-content");
+    public static final QName CONFIG_QNAME = QName.create(EDIT_CONTENT_QNAME, "config");
+
+    // FIXME this could be removed if feature/if-feature are supported
+
+    public EditContentReader(final ConsoleIO console, final CommandArgHandlerRegistry argumentHandlerRegistry, final SchemaContext schemaContext) {
+        super(console, argumentHandlerRegistry, schemaContext);
+    }
+
+    @Override
+    public List<Node<?>> readWithContext(final ChoiceNode choiceNode) throws IOException, ReadingException {
+        Preconditions.checkState(choiceNode.getQName().equals(EDIT_CONTENT_QNAME), "Unexpected choice %s, expected %s", choiceNode, EDIT_CONTENT_QNAME);
+        final ChoiceCaseNode selectedCase = choiceNode.getCaseNodeByName(CONFIG_QNAME);
+        Preconditions.checkNotNull(selectedCase, "Unexpected choice %s, expected %s that contains %s", choiceNode, EDIT_CONTENT_QNAME, CONFIG_QNAME);
+        return readSelectedCase(selectedCase);
+    }
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/custom/FilterReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/custom/FilterReader.java
new file mode 100644 (file)
index 0000000..7b37f69
--- /dev/null
@@ -0,0 +1,218 @@
+/*
+ * 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.netconf.cli.reader.custom;
+
+import static org.opendaylight.controller.netconf.cli.io.IOUtil.isSkipInput;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Strings;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import java.io.IOException;
+import java.net.URI;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import jline.console.completer.Completer;
+import org.opendaylight.controller.netconf.cli.io.BaseConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.cli.io.IOUtil;
+import org.opendaylight.controller.netconf.cli.reader.AbstractReader;
+import org.opendaylight.controller.netconf.cli.reader.ReadingException;
+import org.opendaylight.yangtools.yang.common.QName;
+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.model.api.DataNodeContainer;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Custom reader implementation for filter elements in get/get-config rpcs. This
+ * reader overrides the default anyxml reader and reads filter as a schema path.
+ */
+public class FilterReader extends AbstractReader<DataSchemaNode> {
+
+    private static final Logger LOG = LoggerFactory.getLogger(FilterReader.class);
+
+    public static final String SEPARATOR = "/";
+
+    private final Map<String, QName> mappedModules;
+    private final Map<URI, QName> mappedModulesNamespace;
+
+    public FilterReader(final ConsoleIO console, final SchemaContext remoteSchemaContext) {
+        super(console, remoteSchemaContext);
+
+        mappedModules = Maps.newHashMap();
+        mappedModulesNamespace = Maps.newHashMap();
+        for (final Module module : remoteSchemaContext.getModules()) {
+            final QName moduleQName = QName.create(module.getNamespace(), module.getRevision(), module.getName());
+            mappedModules.put(moduleQName.getLocalName(), moduleQName);
+            mappedModulesNamespace.put(moduleQName.getNamespace(), moduleQName);
+        }
+    }
+
+    // FIXME refactor
+
+    public static final QName FILTER_TYPE_QNAME = QName.create("urn:ietf:params:xml:ns:netconf:base:1.0", "2011-06-01",
+            "type");
+    public static final String FILTER_TYPE_VALUE_DEFAULT = "subtree";
+
+    @Override
+    protected List<Node<?>> readWithContext(final DataSchemaNode schemaNode) throws IOException, ReadingException {
+        boolean redSuccessfuly = false;
+        Node<?> newNode = null;
+        do {
+            console.writeLn("Filter " + schemaNode.getQName().getLocalName());
+            console.writeLn("Submit path of the data to retrieve. Use TAB for autocomplete");
+
+            final String rawValue = console.read();
+
+            // FIXME skip should be somewhere in abstractReader
+            if (isSkipInput(rawValue) || Strings.isNullOrEmpty(rawValue)) {
+                return Collections.emptyList();
+            }
+
+            final List<QName> filterPartsQNames = Lists.newArrayList();
+
+            try {
+                for (final String part : rawValue.split(SEPARATOR)) {
+                    final QName qName = IOUtil.qNameFromKeyString(part, mappedModules);
+                    filterPartsQNames.add(qName);
+                }
+
+                Node<?> previous = null;
+
+                for (final QName qName : Lists.reverse(filterPartsQNames)) {
+                    previous = new CompositeNodeTOImpl(qName, null,
+                            previous == null ? Collections.<Node<?>> emptyList()
+                                    : Collections.<Node<?>> singletonList(previous));
+                }
+
+                final Map<QName, String> attributes = Collections.singletonMap(FILTER_TYPE_QNAME,
+                        FILTER_TYPE_VALUE_DEFAULT);
+                newNode = previous == null ? null : ImmutableCompositeNode.create(schemaNode.getQName(), attributes,
+                        Collections.<Node<?>> singletonList(previous));
+                redSuccessfuly = true;
+            } catch (final ReadingException e) {
+                final String message = "Specified filter path isn't correct.";
+                LOG.error(message, e);
+                console.writeLn(message);
+            }
+        } while (!redSuccessfuly);
+        return Collections.<Node<?>> singletonList(newNode);
+    }
+
+    @Override
+    protected ConsoleContext getContext(final DataSchemaNode schemaNode) {
+        return new FilterConsoleContext(schemaNode, getSchemaContext());
+    }
+
+    private final class FilterConsoleContext extends BaseConsoleContext<DataSchemaNode> {
+
+        private final SchemaContext remoteSchemaContext;
+
+        public FilterConsoleContext(final DataSchemaNode schemaNode, final SchemaContext remoteSchemaContext) {
+            super(schemaNode);
+            this.remoteSchemaContext = remoteSchemaContext;
+        }
+
+        @Override
+        protected List<Completer> getAdditionalCompleters() {
+            return Collections.<Completer> singletonList(new FilterCompleter(remoteSchemaContext));
+        }
+
+    }
+
+    private final class FilterCompleter implements Completer {
+
+        private final SchemaContext remoteSchemaContext;
+
+        // TODO add skip to filter completer, better soulution would be to add
+        // SKIP completer before context completer if possible
+
+        public FilterCompleter(final SchemaContext remoteSchemaContext) {
+            this.remoteSchemaContext = remoteSchemaContext;
+        }
+
+        @Override
+        public int complete(final String buffer, final int cursor, final List<CharSequence> candidates) {
+            final int idx = buffer.lastIndexOf(SEPARATOR);
+
+            final Optional<DataNodeContainer> currentNode = getCurrentNode(remoteSchemaContext, buffer);
+            if (currentNode.isPresent()) {
+
+                final Collection<String> transformed = Collections2.transform(currentNode.get().getChildNodes(),
+                        new Function<DataSchemaNode, String>() {
+                            @Override
+                            public String apply(final DataSchemaNode input) {
+                                return IOUtil.qNameToKeyString(input.getQName(),
+                                        mappedModulesNamespace.get(input.getQName().getNamespace()).getLocalName());
+                            }
+                        });
+
+                fillCandidates(buffer.substring(idx + 1), candidates, transformed);
+            }
+
+            return idx == -1 ? 0 : idx + 1;
+        }
+
+        private void fillCandidates(final String buffer, final List<CharSequence> candidates,
+                final Collection<String> transformed) {
+            final SortedSet<String> strings = new TreeSet<>(transformed);
+
+            if (buffer == null) {
+                candidates.addAll(strings);
+            } else {
+                for (final String match : strings.tailSet(buffer)) {
+                    if (!match.startsWith(buffer)) {
+                        break;
+                    }
+                    candidates.add(match);
+                }
+            }
+
+            if (candidates.size() == 1) {
+                candidates.set(0, candidates.get(0) + SEPARATOR);
+            }
+        }
+
+        private Optional<DataNodeContainer> getCurrentNode(DataNodeContainer parent, final String buffer) {
+            for (final String part : buffer.split(SEPARATOR)) {
+                if (!IOUtil.isQName(part)) {
+                    return Optional.of(parent);
+                }
+
+                QName qName;
+                try {
+                    qName = IOUtil.qNameFromKeyString(part, mappedModules);
+                } catch (final ReadingException e) {
+                    return Optional.of(parent);
+                }
+
+                final DataSchemaNode dataChildByName = parent.getDataChildByName(qName);
+                if (dataChildByName instanceof DataNodeContainer) {
+                    parent = (DataNodeContainer) dataChildByName;
+                } else {
+                    return Optional.absent();
+                }
+            }
+            return Optional.of(parent);
+        }
+    }
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/custom/PasswordReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/custom/PasswordReader.java
new file mode 100644 (file)
index 0000000..4804455
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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.netconf.cli.reader.custom;
+
+import com.google.common.base.Preconditions;
+import java.io.IOException;
+import jline.console.completer.Completer;
+import jline.console.completer.NullCompleter;
+import org.opendaylight.controller.netconf.cli.io.BaseConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.cli.reader.impl.BasicDataHolderReader;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+
+public class PasswordReader extends BasicDataHolderReader<DataSchemaNode> {
+
+    private static final char PASSWORD_MASK = '*';
+
+    public PasswordReader(final ConsoleIO console, final SchemaContext schemaContext) {
+        super(console, schemaContext);
+    }
+
+    @Override
+    protected ConsoleContext getContext(final DataSchemaNode schemaNode) {
+        return new BaseConsoleContext<DataSchemaNode>(schemaNode) {
+            @Override
+            public Completer getCompleter() {
+                return new NullCompleter();
+            }
+        };
+    }
+
+    @Override
+    protected TypeDefinition<?> getType(final DataSchemaNode schemaNode) {
+        Preconditions.checkArgument(schemaNode instanceof LeafSchemaNode);
+        return ((LeafSchemaNode)schemaNode).getType();
+    }
+
+    @Override
+    protected String readValue() throws IOException {
+        return console.read(PASSWORD_MASK);
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/AnyXmlReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/AnyXmlReader.java
new file mode 100644 (file)
index 0000000..2ce2f64
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * 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.netconf.cli.reader.impl;
+
+import static org.opendaylight.controller.netconf.cli.io.IOUtil.isSkipInput;
+import static org.opendaylight.controller.netconf.cli.io.IOUtil.listType;
+
+import com.google.common.base.Optional;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.opendaylight.controller.netconf.cli.io.BaseConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.cli.reader.AbstractReader;
+import org.opendaylight.controller.netconf.cli.reader.ReadingException;
+import org.opendaylight.controller.netconf.util.xml.XmlUtil;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
+import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlDocumentUtils;
+import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+public class AnyXmlReader extends AbstractReader<AnyXmlSchemaNode> {
+
+    public AnyXmlReader(final ConsoleIO console, final SchemaContext schemaContext) {
+        super(console, schemaContext);
+    }
+
+    public AnyXmlReader(final ConsoleIO console, final SchemaContext schemaContext, final boolean readConfigNode) {
+        super(console, schemaContext, readConfigNode);
+    }
+
+    @Override
+    protected List<Node<?>> readWithContext(final AnyXmlSchemaNode schemaNode) throws IOException, ReadingException {
+        console.writeLn(listType(schemaNode) + " " + schemaNode.getQName().getLocalName());
+
+        final String rawValue = console.read();
+
+        Node<?> newNode = null;
+        if (!isSkipInput(rawValue)) {
+            final Optional<Node<?>> value = tryParse(rawValue);
+
+            if (value.isPresent()) {
+                newNode = NodeFactory.createImmutableCompositeNode(schemaNode.getQName(), null,
+                        Collections.<Node<?>> singletonList(value.get()));
+            } else {
+                newNode = NodeFactory.createImmutableSimpleNode(schemaNode.getQName(), null, rawValue);
+            }
+        }
+
+        final List<Node<?>> newNodes = new ArrayList<>();
+        newNodes.add(newNode);
+        return newNodes;
+    }
+
+    private Optional<Node<?>> tryParse(final String rawValue) {
+        try {
+            final Document dom = XmlUtil.readXmlToDocument(rawValue);
+            return Optional.<Node<?>> of(XmlDocumentUtils.toDomNode(dom));
+        } catch (SAXException | IOException e) {
+            // TODO log
+            return Optional.absent();
+        }
+    }
+
+    @Override
+    protected ConsoleContext getContext(final AnyXmlSchemaNode schemaNode) {
+        return new BaseConsoleContext<>(schemaNode);
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/BasicDataHolderReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/BasicDataHolderReader.java
new file mode 100644 (file)
index 0000000..ef41e7f
--- /dev/null
@@ -0,0 +1,255 @@
+/*
+ * 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.netconf.cli.reader.impl;
+
+import static org.opendaylight.controller.netconf.cli.io.IOUtil.isSkipInput;
+import static org.opendaylight.controller.netconf.cli.io.IOUtil.listType;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.collect.BiMap;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.HashBiMap;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import jline.console.completer.Completer;
+import jline.console.completer.StringsCompleter;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.cli.io.IOUtil;
+import org.opendaylight.controller.netconf.cli.reader.AbstractReader;
+import org.opendaylight.controller.netconf.cli.reader.ReadingException;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
+import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition.EnumPair;
+import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class BasicDataHolderReader<T extends DataSchemaNode> extends AbstractReader<T> {
+
+    private static final Logger LOG = LoggerFactory.getLogger(BasicDataHolderReader.class);
+    private DataHolderCompleter currentCompleter;
+
+    public BasicDataHolderReader(final ConsoleIO console, final SchemaContext schemaContext,
+            final boolean readConfigNode) {
+        super(console, schemaContext, readConfigNode);
+    }
+
+    public BasicDataHolderReader(final ConsoleIO console, final SchemaContext schemaContext) {
+        super(console, schemaContext);
+    }
+
+    @Override
+    public List<Node<?>> readWithContext(final T schemaNode) throws IOException, ReadingException {
+        TypeDefinition<?> type = getType(schemaNode);
+        console.formatLn("Submit %s %s(%s)", listType(schemaNode), schemaNode.getQName().getLocalName(), type.getQName().getLocalName());
+
+        while (baseTypeFor(type) instanceof UnionTypeDefinition) {
+            final Optional<TypeDefinition<?>> optionalTypeDef = new UnionTypeReader(console).read(type);
+            if (!optionalTypeDef.isPresent()) {
+                return postSkipOperations(schemaNode);
+            }
+            type = optionalTypeDef.get();
+        }
+
+        if (currentCompleter == null) {
+            currentCompleter = getBaseCompleter(schemaNode);
+        }
+
+        // TODO what if type is leafref, instance-identifier?
+
+        // Handle empty type leaf by question
+        if (isEmptyType(type)) {
+            final Optional<Boolean> shouldAddEmpty = new DecisionReader().read(console, "Add empty type leaf %s ?",
+                    schemaNode.getQName().getLocalName());
+            if (shouldAddEmpty.isPresent()) {
+                if (shouldAddEmpty.get()) {
+                    return wrapValue(schemaNode, "");
+                } else {
+                    return Collections.emptyList();
+                }
+            } else {
+                return postSkipOperations(schemaNode);
+            }
+        }
+
+        final String rawValue = readValue();
+        if (isSkipInput(rawValue)) {
+            return postSkipOperations(schemaNode);
+        }
+
+        final Object resolvedValue = currentCompleter.resolveValue(rawValue);
+
+        // Reset state TODO should be in finally
+        currentCompleter = null;
+        return wrapValue(schemaNode, resolvedValue);
+    }
+
+    private List<Node<?>> postSkipOperations(final DataSchemaNode schemaNode) throws IOException {
+        console.formatLn("Skipping %s", schemaNode.getQName());
+        return Collections.emptyList();
+    }
+
+    private TypeDefinition<?> baseTypeFor(final TypeDefinition<?> type) {
+        if (type.getBaseType() != null) {
+            return baseTypeFor(type.getBaseType());
+        }
+        return type;
+    }
+
+    protected String readValue() throws IOException {
+        return console.read();
+    }
+
+    private List<Node<?>> wrapValue(final T schemaNode, final Object value) {
+        final Node<?> newNode = NodeFactory.createImmutableSimpleNode(schemaNode.getQName(), null, value);
+        return Collections.<Node<?>> singletonList(newNode);
+    }
+
+    protected abstract TypeDefinition<?> getType(final T schemaNode);
+
+    protected final DataHolderCompleter getBaseCompleter(final T schemaNode) {
+        final TypeDefinition<?> type = getType(schemaNode);
+        final DataHolderCompleter currentCompleter;
+
+        // Add enum completer
+        if (type instanceof EnumTypeDefinition) {
+            currentCompleter = new EnumDataHolderCompleter(type);
+        } else if (type instanceof IdentityrefTypeDefinition) {
+            currentCompleter = new IdentityRefDataHolderCompleter(type, getSchemaContext());
+        } else {
+            currentCompleter = new GeneralDataHolderCompleter(type);
+        }
+        this.currentCompleter = currentCompleter;
+        return currentCompleter;
+    }
+
+    private static interface DataHolderCompleter extends Completer {
+
+        Object resolveValue(String rawValue) throws ReadingException;
+    }
+
+    private static class GeneralDataHolderCompleter implements DataHolderCompleter {
+
+        private final Optional<TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>>> codec;
+        private final TypeDefinition<?> type;
+
+        public GeneralDataHolderCompleter(final TypeDefinition<?> type) {
+            this.type = type;
+            codec = getCodecForType(type);
+        }
+
+        protected TypeDefinition<?> getType() {
+            return type;
+        }
+
+        private Optional<TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>>> getCodecForType(
+                final TypeDefinition<?> type) {
+            if (type != null) {
+                return Optional
+                        .<TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>>> fromNullable(TypeDefinitionAwareCodec
+                                .from(type));
+            }
+            return Optional.absent();
+        }
+
+        @Override
+        public Object resolveValue(final String rawValue) throws ReadingException {
+            try {
+                return codec.isPresent() ? codec.get().deserialize(rawValue) : rawValue;
+            } catch (final RuntimeException e) {
+                final String message = "It wasn't possible deserialize value " + rawValue + ".";
+                LOG.error(message, e);
+                throw new ReadingException(message, e);
+            }
+        }
+
+        @Override
+        public int complete(final String buffer, final int cursor, final List<CharSequence> candidates) {
+            return 0;
+        }
+    }
+
+    private static final class EnumDataHolderCompleter extends GeneralDataHolderCompleter {
+
+        public EnumDataHolderCompleter(final TypeDefinition<?> type) {
+            super(type);
+        }
+
+        @Override
+        public Object resolveValue(final String rawValue) throws ReadingException {
+            return super.resolveValue(rawValue);
+        }
+
+        @Override
+        public int complete(final String buffer, final int cursor, final List<CharSequence> candidates) {
+            return new StringsCompleter(Collections2.transform(((EnumTypeDefinition) getType()).getValues(),
+                    new Function<EnumPair, String>() {
+                        @Override
+                        public String apply(final EnumPair input) {
+                            return input.getName();
+                        }
+                    })).complete(buffer, cursor, candidates);
+        }
+    }
+
+    private static final class IdentityRefDataHolderCompleter extends GeneralDataHolderCompleter {
+
+        private final BiMap<String, QName> identityMap;
+
+        public IdentityRefDataHolderCompleter(final TypeDefinition<?> type, final SchemaContext schemaContext) {
+            super(type);
+            this.identityMap = getIdentityMap(schemaContext);
+        }
+
+        private static BiMap<String, QName> getIdentityMap(final SchemaContext schemaContext) {
+            final BiMap<String, QName> identityMap = HashBiMap.create();
+            for (final Module module : schemaContext.getModules()) {
+                for (final IdentitySchemaNode identity : module.getIdentities()) {
+                    identityMap.put(getIdentityName(identity, module), identity.getQName());
+                }
+            }
+            return identityMap;
+        }
+
+        private static String getIdentityName(final IdentitySchemaNode rpcDefinition, final Module module) {
+            return IOUtil.qNameToKeyString(rpcDefinition.getQName(), module.getName());
+        }
+
+        @Override
+        public Object resolveValue(final String rawValue) throws ReadingException {
+            final QName qName = identityMap.get(rawValue);
+            if (qName == null) {
+                throw new ReadingException("No identity found for " + rawValue + " available " + identityMap.keySet());
+            }
+            return qName;
+        }
+
+        @Override
+        public int complete(final String buffer, final int cursor, final List<CharSequence> candidates) {
+
+            return new StringsCompleter(Collections2.transform(((IdentityrefTypeDefinition) getType()).getIdentity()
+                    .getDerivedIdentities(), new Function<IdentitySchemaNode, String>() {
+                @Override
+                public String apply(final IdentitySchemaNode input) {
+                    return identityMap.inverse().get(input.getQName());
+                }
+            })).complete(buffer, cursor, candidates);
+        }
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/ChoiceReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/ChoiceReader.java
new file mode 100644 (file)
index 0000000..1e69fbb
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * 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.netconf.cli.reader.impl;
+
+import static org.opendaylight.controller.netconf.cli.io.IOUtil.isSkipInput;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Maps;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import jline.console.completer.Completer;
+import jline.console.completer.StringsCompleter;
+import org.opendaylight.controller.netconf.cli.CommandArgHandlerRegistry;
+import org.opendaylight.controller.netconf.cli.io.BaseConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.cli.reader.AbstractReader;
+import org.opendaylight.controller.netconf.cli.reader.ReadingException;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
+import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
+import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ChoiceReader extends AbstractReader<ChoiceNode> {
+
+    private static final Logger LOG = LoggerFactory.getLogger(ChoiceReader.class);
+
+    private final CommandArgHandlerRegistry argumentHandlerRegistry;
+
+    public ChoiceReader(final ConsoleIO console, final CommandArgHandlerRegistry argumentHandlerRegistry,
+            final SchemaContext schemaContext) {
+        super(console, schemaContext);
+        this.argumentHandlerRegistry = argumentHandlerRegistry;
+    }
+
+    public ChoiceReader(final ConsoleIO console, final CommandArgHandlerRegistry argumentHandlerRegistry,
+            final SchemaContext schemaContext, final boolean readConfigNode) {
+        super(console, schemaContext, readConfigNode);
+        this.argumentHandlerRegistry = argumentHandlerRegistry;
+    }
+
+    @Override
+    public List<Node<?>> readWithContext(final ChoiceNode choiceNode) throws IOException, ReadingException {
+        final Map<String, ChoiceCaseNode> availableCases = collectAllCases(choiceNode);
+        console.formatLn("Select case for choice %s from: %s", choiceNode.getQName().getLocalName(),
+                formatSet(availableCases.keySet()));
+
+        ChoiceCaseNode selectedCase = null;
+        final String rawValue = console.read();
+        if (isSkipInput(rawValue)) {
+            return Collections.emptyList();
+        }
+
+        selectedCase = availableCases.get(rawValue);
+        if (selectedCase == null) {
+            final String message = String.format("Incorrect value (%s) for choice %s was selected.", rawValue,
+                    choiceNode.getQName().getLocalName());
+            LOG.error(message);
+            throw new ReadingException(message);
+        }
+
+        return readSelectedCase(selectedCase);
+    }
+
+    protected List<Node<?>> readSelectedCase(final ChoiceCaseNode selectedCase) throws ReadingException {
+        // IF there is a case that contains only one Empty type leaf, create the
+        // leaf without question, since the case was selected
+        if (containsOnlyOneEmptyLeaf(selectedCase)) {
+            final Node<?> newNode = NodeFactory.createImmutableSimpleNode(selectedCase.getChildNodes().iterator()
+                    .next().getQName(), null, null);
+            return Collections.<Node<?>> singletonList(newNode);
+        }
+
+        final List<Node<?>> newNodes = new ArrayList<>();
+        for (final DataSchemaNode schemaNode : selectedCase.getChildNodes()) {
+            newNodes.addAll(argumentHandlerRegistry.getGenericReader(getSchemaContext(), getReadConfigNode()).read(
+                    schemaNode));
+        }
+        return newNodes;
+    }
+
+    private Object formatSet(final Set<String> values) {
+        final StringBuilder formatedValues = new StringBuilder();
+        for (final String value : values) {
+            formatedValues.append("\n  ");
+            formatedValues.append(value);
+        }
+        return formatedValues.toString();
+    }
+
+    private boolean containsOnlyOneEmptyLeaf(final ChoiceCaseNode selectedCase) {
+        if (selectedCase.getChildNodes().size() != 1) {
+            return false;
+        }
+        final DataSchemaNode next = selectedCase.getChildNodes().iterator().next();
+        if (next instanceof LeafSchemaNode) {
+            final TypeDefinition<?> type = ((LeafSchemaNode) next).getType();
+            if (isEmptyType(type)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private Map<String, ChoiceCaseNode> collectAllCases(final ChoiceNode schemaNode) {
+        return Maps.uniqueIndex(schemaNode.getCases(), new Function<ChoiceCaseNode, String>() {
+            @Override
+            public String apply(final ChoiceCaseNode input) {
+                return input.getQName().getLocalName();
+            }
+        });
+    }
+
+    @Override
+    protected ConsoleContext getContext(final ChoiceNode schemaNode) {
+        return new BaseConsoleContext<ChoiceNode>(schemaNode) {
+            @Override
+            public List<Completer> getAdditionalCompleters() {
+                return Collections
+                        .<Completer> singletonList(new StringsCompleter(collectAllCases(schemaNode).keySet()));
+            }
+        };
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/ContainerReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/ContainerReader.java
new file mode 100644 (file)
index 0000000..8e9a29e
--- /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.netconf.cli.reader.impl;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
+import org.opendaylight.controller.netconf.cli.CommandArgHandlerRegistry;
+import org.opendaylight.controller.netconf.cli.io.BaseConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.cli.reader.AbstractReader;
+import org.opendaylight.controller.netconf.cli.reader.ReadingException;
+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;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+public class ContainerReader extends AbstractReader<ContainerSchemaNode> {
+
+    private final CommandArgHandlerRegistry argumentHandlerRegistry;
+    private static final InputArgsLocalNameComparator CONTAINER_CHILDS_SORTER = new InputArgsLocalNameComparator();
+
+    public ContainerReader(final ConsoleIO console, final CommandArgHandlerRegistry argumentHandlerRegistry,
+            final SchemaContext schemaContext) {
+        super(console, schemaContext);
+        this.argumentHandlerRegistry = argumentHandlerRegistry;
+    }
+
+    public ContainerReader(final ConsoleIO console, final CommandArgHandlerRegistry argumentHandlerRegistry,
+            final SchemaContext schemaContext, final boolean readConfigNode) {
+        super(console, schemaContext, readConfigNode);
+        this.argumentHandlerRegistry = argumentHandlerRegistry;
+    }
+
+    @Override
+    public List<Node<?>> readWithContext(final ContainerSchemaNode containerNode) throws IOException, ReadingException {
+        console.formatLn("Submit child nodes for container: %s, %s", containerNode.getQName().getLocalName(),
+                Collections2.transform(containerNode.getChildNodes(), new Function<DataSchemaNode, String>() {
+                    @Override
+                    public String apply(final DataSchemaNode input) {
+                        return input.getQName().getLocalName();
+                    }
+                }));
+
+        final CompositeNodeBuilder<ImmutableCompositeNode> compositeNodeBuilder = ImmutableCompositeNode.builder();
+        compositeNodeBuilder.setQName(containerNode.getQName());
+        final SeparatedNodes separatedNodes = SeparatedNodes.separateNodes(containerNode, getReadConfigNode());
+        for (final DataSchemaNode childNode : sortChildren(separatedNodes.getMandatoryNotKey())) {
+            final List<Node<?>> redNodes = argumentHandlerRegistry.getGenericReader(getSchemaContext(),
+                    getReadConfigNode()).read(childNode);
+            if (redNodes.isEmpty()) {
+                console.formatLn("No data specified for mandatory element %s.", childNode.getQName().getLocalName());
+                return Collections.emptyList();
+            } else {
+                compositeNodeBuilder.addAll(redNodes);
+            }
+        }
+
+        for (final DataSchemaNode childNode : sortChildren(separatedNodes.getOthers())) {
+            compositeNodeBuilder.addAll(argumentHandlerRegistry.getGenericReader(getSchemaContext(),
+                    getReadConfigNode()).read(childNode));
+        }
+        return Collections.<Node<?>> singletonList(compositeNodeBuilder.toInstance());
+    }
+
+    private List<DataSchemaNode> sortChildren(final Set<DataSchemaNode> unsortedNodes) {
+        final List<DataSchemaNode> childNodes = Lists.newArrayList(unsortedNodes);
+        Collections.sort(childNodes, CONTAINER_CHILDS_SORTER);
+        return childNodes;
+    }
+
+    @Override
+    protected ConsoleContext getContext(final ContainerSchemaNode schemaNode) {
+        return new BaseConsoleContext<>(schemaNode);
+    }
+
+    private static class InputArgsLocalNameComparator implements Comparator<DataSchemaNode> {
+        @Override
+        public int compare(final DataSchemaNode o1, final DataSchemaNode o2) {
+            return o1.getQName().getLocalName().compareTo(o2.getQName().getLocalName());
+        }
+    }
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/DecisionReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/DecisionReader.java
new file mode 100644 (file)
index 0000000..b1e9a43
--- /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.netconf.cli.reader.impl;
+
+import static org.opendaylight.controller.netconf.cli.io.IOUtil.SKIP;
+
+import com.google.common.base.Optional;
+import java.io.IOException;
+import jline.console.completer.AggregateCompleter;
+import jline.console.completer.Completer;
+import jline.console.completer.StringsCompleter;
+import jline.internal.Log;
+import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.cli.io.IOUtil;
+import org.opendaylight.controller.netconf.cli.reader.ReadingException;
+
+public class DecisionReader {
+
+    private static final String YES = "Y";
+    private static final String NO = "N";
+    public static final Completer YES_NO_COMPLETER = new StringsCompleter(YES, NO);
+
+    public Optional<Boolean> read(final ConsoleIO console, final String questionMessageBlueprint,
+            final Object... questionMessageArgs) throws IOException, ReadingException {
+        final ConsoleContext ctx = getContext();
+        console.enterContext(ctx);
+        try {
+            console.formatLn(questionMessageBlueprint, questionMessageArgs);
+            final String rawValue = console.read();
+            if (YES.equals(rawValue.toUpperCase())) {
+                return Optional.of(Boolean.TRUE);
+            } else if (NO.equals(rawValue.toUpperCase())) {
+                return Optional.of(Boolean.FALSE);
+            } else if (SKIP.equals(rawValue)) {
+                return Optional.absent();
+            } else {
+                final String message = String.format("Incorrect possibility (%s) was selected", rawValue);
+                Log.error(message);
+                throw new ReadingException(message);
+            }
+        } finally {
+            console.leaveContext();
+        }
+    }
+
+    private static ConsoleContext getContext() {
+        return new ConsoleContext() {
+
+            @Override
+            public Optional<String> getPrompt() {
+                return Optional.absent();
+            }
+
+            @Override
+            public Completer getCompleter() {
+                return new AggregateCompleter(YES_NO_COMPLETER, new StringsCompleter(IOUtil.SKIP));
+            }
+
+        };
+    }
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/GenericListReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/GenericListReader.java
new file mode 100644 (file)
index 0000000..6cf8eb2
--- /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.netconf.cli.reader.impl;
+
+import static org.opendaylight.controller.netconf.cli.io.IOUtil.listType;
+
+import com.google.common.base.Optional;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import org.opendaylight.controller.netconf.cli.io.BaseConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.cli.reader.AbstractReader;
+import org.opendaylight.controller.netconf.cli.reader.GenericListEntryReader;
+import org.opendaylight.controller.netconf.cli.reader.ReadingException;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GenericListReader<T extends DataSchemaNode> extends AbstractReader<T> {
+    private static final Logger LOG = LoggerFactory.getLogger(GenericListReader.class);
+
+    private final GenericListEntryReader<T> concreteListEntryReader;
+
+    public GenericListReader(final ConsoleIO console, final GenericListEntryReader<T> concreteListEntryReader,
+            final SchemaContext schemaContext) {
+        super(console, schemaContext);
+        this.concreteListEntryReader = concreteListEntryReader;
+    }
+
+    public GenericListReader(final ConsoleIO console, final GenericListEntryReader<T> concreteListEntryReader,
+            final SchemaContext schemaContext, final boolean readConfigNode) {
+        super(console, schemaContext, readConfigNode);
+        this.concreteListEntryReader = concreteListEntryReader;
+    }
+
+    @Override
+    public List<Node<?>> readWithContext(final T schemaNode) throws IOException, ReadingException {
+        final List<Node<?>> newNodes = new ArrayList<>();
+        Optional<Boolean> readNextListEntry = Optional.of(Boolean.TRUE);
+        console.formatLn("Reading collection type argument: %s", schemaNode.getQName().getLocalName());
+        while (readNextListEntry.isPresent() && readNextListEntry.get()) {
+            try {
+                newNodes.addAll(concreteListEntryReader.read(schemaNode));
+            } catch (final ReadingException e) {
+                console.writeLn(e.getMessage());
+            }
+            readNextListEntry = new DecisionReader().read(console, "Add other entry to " + listType(schemaNode) + " "
+                    + schemaNode.getQName().getLocalName() + " " + " [Y|N]?");
+        }
+        console.formatLn("Collection type argument: %s read finished", schemaNode.getQName().getLocalName());
+
+        return newNodes;
+    }
+
+    @Override
+    protected ConsoleContext getContext(final T schemaNode) {
+        return new BaseConsoleContext<>(schemaNode);
+    }
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/GenericReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/GenericReader.java
new file mode 100644 (file)
index 0000000..8fbfbb7
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * 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.netconf.cli.reader.impl;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import org.opendaylight.controller.netconf.cli.CommandArgHandlerRegistry;
+import org.opendaylight.controller.netconf.cli.commands.CommandConstants;
+import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.cli.reader.AbstractReader;
+import org.opendaylight.controller.netconf.cli.reader.GenericListEntryReader;
+import org.opendaylight.controller.netconf.cli.reader.Reader;
+import org.opendaylight.controller.netconf.cli.reader.ReadingException;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+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.UnknownSchemaNode;
+
+public class GenericReader extends AbstractReader<DataSchemaNode> {
+
+    private final CommandArgHandlerRegistry argumentHandlerRegistry;
+
+    public GenericReader(final ConsoleIO console, final CommandArgHandlerRegistry argumentHandlerRegistry,
+            final SchemaContext schemaContext) {
+        super(console, schemaContext);
+        this.argumentHandlerRegistry = argumentHandlerRegistry;
+    }
+
+    public GenericReader(final ConsoleIO console, final CommandArgHandlerRegistry argumentHandlerRegistry,
+            final SchemaContext schemaContext, final boolean readConfigNode) {
+        super(console, schemaContext, readConfigNode);
+        this.argumentHandlerRegistry = argumentHandlerRegistry;
+    }
+
+    @Override
+    protected List<Node<?>> readWithContext(final DataSchemaNode schemaNode) throws IOException, ReadingException {
+        final Optional<Class<? extends Reader<DataSchemaNode>>> customReaderClassOpt = tryGetCustomHandler(schemaNode);
+
+        if (customReaderClassOpt.isPresent()) {
+            // TODO resolve class cast of generic custom readers
+            final Reader<DataSchemaNode> customReaderInstance = (Reader<DataSchemaNode>) argumentHandlerRegistry
+                    .getCustomReader(customReaderClassOpt.get());
+            Preconditions.checkNotNull(customReaderInstance, "Unknown custom reader: %s", customReaderClassOpt.get());
+            return customReaderInstance.read(schemaNode);
+        } else {
+            return readGeneric(schemaNode);
+        }
+
+        // TODO reuse instances
+    }
+
+    private List<Node<?>> readGeneric(final DataSchemaNode schemaNode) throws ReadingException, IOException {
+        final List<Node<?>> newNodes = new ArrayList<>();
+        boolean isRedCorrectly = false;
+        do {
+            try {
+                if (schemaNode instanceof LeafSchemaNode) {
+                    return new LeafReader(console, getSchemaContext(), getReadConfigNode())
+                            .read((LeafSchemaNode) schemaNode);
+                } else if (schemaNode instanceof ContainerSchemaNode) {
+                    return new ContainerReader(console, argumentHandlerRegistry, getSchemaContext(),
+                            getReadConfigNode()).read((ContainerSchemaNode) schemaNode);
+                } else if (schemaNode instanceof ListSchemaNode) {
+                    final GenericListEntryReader<ListSchemaNode> entryReader = new ListEntryReader(console,
+                            argumentHandlerRegistry, getSchemaContext(), getReadConfigNode());
+                    return new GenericListReader<>(console, entryReader, getSchemaContext(), getReadConfigNode())
+                            .read((ListSchemaNode) schemaNode);
+                } else if (schemaNode instanceof LeafListSchemaNode) {
+                    final GenericListEntryReader<LeafListSchemaNode> entryReader = new LeafListEntryReader(console,
+                            getSchemaContext(), getReadConfigNode());
+                    return new GenericListReader<>(console, entryReader, getSchemaContext(), getReadConfigNode())
+                            .read((LeafListSchemaNode) schemaNode);
+                } else if (schemaNode instanceof ChoiceNode) {
+                    return new ChoiceReader(console, argumentHandlerRegistry, getSchemaContext(), getReadConfigNode())
+                            .read((ChoiceNode) schemaNode);
+                } else if (schemaNode instanceof AnyXmlSchemaNode) {
+                    return new AnyXmlReader(console, getSchemaContext(), getReadConfigNode())
+                            .read((AnyXmlSchemaNode) schemaNode);
+                }
+                isRedCorrectly = true;
+            } catch (final ReadingException e) {
+                console.writeLn(e.getMessage());
+            }
+        } while (!isRedCorrectly);
+        return newNodes;
+    }
+
+    @Override
+    protected ConsoleContext getContext(final DataSchemaNode schemaNode) {
+        // return null context, leave context to specific implementations
+        return NULL_CONTEXT;
+    }
+
+    private <T> Optional<Class<? extends T>> tryGetCustomHandler(final DataSchemaNode dataSchemaNode) {
+
+        for (final UnknownSchemaNode unknownSchemaNode : dataSchemaNode.getUnknownSchemaNodes()) {
+
+            if (isExtenstionForCustomHandler(unknownSchemaNode)) {
+                final String argumentHandlerClassName = unknownSchemaNode.getNodeParameter();
+                try {
+                    final Class<?> argumentClass = Class.forName(argumentHandlerClassName);
+                    // TODO add check before cast
+                    return Optional.<Class<? extends T>> of((Class<? extends T>) argumentClass);
+                } catch (final ClassNotFoundException e) {
+                    throw new IllegalArgumentException("Unknown custom reader class " + argumentHandlerClassName
+                            + " for: " + dataSchemaNode.getQName());
+                }
+            }
+        }
+
+        return Optional.absent();
+    }
+
+    private boolean isExtenstionForCustomHandler(final UnknownSchemaNode unknownSchemaNode) {
+        final QName qName = unknownSchemaNode.getExtensionDefinition().getQName();
+        return qName.equals(CommandConstants.ARG_HANDLER_EXT_QNAME);
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/LeafListEntryReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/LeafListEntryReader.java
new file mode 100644 (file)
index 0000000..4ba3478
--- /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.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;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.cli.reader.GenericListEntryReader;
+import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+
+class LeafListEntryReader extends BasicDataHolderReader<LeafListSchemaNode> implements
+        GenericListEntryReader<LeafListSchemaNode> {
+
+    public LeafListEntryReader(final ConsoleIO console, final SchemaContext schemaContext) {
+        super(console, schemaContext);
+    }
+
+    public LeafListEntryReader(final ConsoleIO console, final SchemaContext schemaContext, final boolean readConfigNode) {
+        super(console, schemaContext, readConfigNode);
+    }
+
+    @Override
+    protected TypeDefinition<?> getType(final LeafListSchemaNode schemaNode) {
+        return schemaNode.getType();
+    }
+
+    @Override
+    protected ConsoleContext getContext(final LeafListSchemaNode schemaNode) {
+        return new BaseConsoleContext<LeafListSchemaNode>(schemaNode) {
+
+            @Override
+            public Optional<String> getPrompt() {
+                return Optional.of("[entry]");
+            }
+
+            @Override
+            protected List<Completer> getAdditionalCompleters() {
+                return Lists.<Completer> newArrayList(getBaseCompleter(getDataSchemaNode()));
+            }
+        };
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/LeafReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/LeafReader.java
new file mode 100644 (file)
index 0000000..9a847f6
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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.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 jline.console.completer.StringsCompleter;
+import org.opendaylight.controller.netconf.cli.io.BaseConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+
+public class LeafReader extends BasicDataHolderReader<LeafSchemaNode> {
+
+    public LeafReader(final ConsoleIO console, final SchemaContext schemaContext) {
+        super(console, schemaContext);
+    }
+
+    public LeafReader(final ConsoleIO console, final SchemaContext schemaContext, final boolean readConfigNode) {
+        super(console, schemaContext, readConfigNode);
+    }
+
+    @Override
+    protected TypeDefinition<?> getType(final LeafSchemaNode schemaNode) {
+        return schemaNode.getType();
+    }
+
+    @Override
+    protected ConsoleContext getContext(final LeafSchemaNode schemaNode) {
+        return new BaseConsoleContext<LeafSchemaNode>(schemaNode) {
+            @Override
+            public List<Completer> getAdditionalCompleters() {
+                final List<Completer> completers = Lists.<Completer> newArrayList(getBaseCompleter(schemaNode));
+                final Optional<String> defaultValue = getDefaultValue(schemaNode);
+                if (defaultValue.isPresent()) {
+                    completers.add(new StringsCompleter(defaultValue.get()));
+                }
+                return completers;
+            }
+        };
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/ListEntryReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/ListEntryReader.java
new file mode 100644 (file)
index 0000000..97f7694
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ * 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.netconf.cli.reader.impl;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.collect.Collections2;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import org.opendaylight.controller.netconf.cli.CommandArgHandlerRegistry;
+import org.opendaylight.controller.netconf.cli.io.BaseConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.cli.reader.AbstractReader;
+import org.opendaylight.controller.netconf.cli.reader.GenericListEntryReader;
+import org.opendaylight.controller.netconf.cli.reader.ReadingException;
+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;
+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 org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+class ListEntryReader extends AbstractReader<ListSchemaNode> implements GenericListEntryReader<ListSchemaNode> {
+    private static final Logger LOG = LoggerFactory.getLogger(ListEntryReader.class);
+
+    private final CommandArgHandlerRegistry argumentHandlerRegistry;
+
+    public ListEntryReader(final ConsoleIO console, final CommandArgHandlerRegistry argumentHandlerRegistry,
+            final SchemaContext schemaContext) {
+        super(console, schemaContext);
+        this.argumentHandlerRegistry = argumentHandlerRegistry;
+    }
+
+    public ListEntryReader(final ConsoleIO console, final CommandArgHandlerRegistry argumentHandlerRegistry,
+            final SchemaContext schemaContext, final boolean readConfigNode) {
+        super(console, schemaContext, readConfigNode);
+        this.argumentHandlerRegistry = argumentHandlerRegistry;
+    }
+
+    @Override
+    public List<Node<?>> readWithContext(final ListSchemaNode listNode) throws IOException, ReadingException {
+        console.formatLn("Submit child nodes for list entry: %s, %s", listNode.getQName().getLocalName(),
+                Collections2.transform(listNode.getChildNodes(), new Function<DataSchemaNode, String>() {
+                    @Override
+                    public String apply(final DataSchemaNode input) {
+                        return input.getQName().getLocalName();
+                    }
+                }));
+
+        final String listName = listNode.getQName().getLocalName();
+        final CompositeNodeBuilder<ImmutableCompositeNode> compositeNodeBuilder = ImmutableCompositeNode.builder();
+        compositeNodeBuilder.setQName(listNode.getQName());
+
+        final SeparatedNodes separatedChildNodes = SeparatedNodes.separateNodes(listNode, getReadConfigNode());
+
+        final List<Node<?>> nodes = readKeys(separatedChildNodes.getKeyNodes());
+        nodes.addAll(readMandatoryNotKeys(separatedChildNodes.getMandatoryNotKey()));
+        if (!separatedChildNodes.getOthers().isEmpty()) {
+            final Optional<Boolean> readNodesWhichAreNotKey = new DecisionReader().read(console,
+                    "Add non-key, non-mandatory nodes to list %s? [Y|N]", listName);
+            if (readNodesWhichAreNotKey.isPresent() && readNodesWhichAreNotKey.get()) {
+                nodes.addAll(readNotKeys(separatedChildNodes.getOthers()));
+            }
+        }
+
+        if (!nodes.isEmpty()) {
+            compositeNodeBuilder.addAll(nodes);
+            return Collections.<Node<?>> singletonList(compositeNodeBuilder.toInstance());
+        } else {
+            return Collections.emptyList();
+        }
+    }
+
+    private List<Node<?>> readKeys(final Set<DataSchemaNode> keys) throws ReadingException, IOException {
+        final List<Node<?>> newNodes = new ArrayList<>();
+        console.writeLn("Reading keys:");
+        for (final DataSchemaNode key : keys) {
+            final List<Node<?>> readKey = new LeafReader(console, getSchemaContext(), getReadConfigNode())
+                    .read((LeafSchemaNode) key);
+            if (readKey.size() != 1) {
+                final String message = String.format(
+                        "Value for key element %s has to be set. Creation of this entry is canceled.", key.getQName()
+                                .getLocalName());
+                LOG.error(message);
+                throw new ReadingException(message);
+            }
+            newNodes.addAll(readKey);
+        }
+        return newNodes;
+    }
+
+    private List<Node<?>> readMandatoryNotKeys(final Set<DataSchemaNode> mandatoryNotKeys) throws ReadingException,
+            IOException {
+        final List<Node<?>> newNodes = new ArrayList<>();
+        console.writeLn("Reading mandatory not keys nodes:");
+
+        for (final DataSchemaNode mandatoryNode : mandatoryNotKeys) {
+            final List<Node<?>> redValue = argumentHandlerRegistry.getGenericReader(getSchemaContext(),
+                    getReadConfigNode()).read(mandatoryNode);
+            if (redValue.isEmpty()) {
+                final String message = String.format(
+                        "Value for mandatory element %s has to be set. Creation of this entry is canceled.",
+                        mandatoryNode.getQName().getLocalName());
+                LOG.error(message);
+                throw new ReadingException(message);
+            }
+            newNodes.addAll(redValue);
+        }
+        return newNodes;
+    }
+
+    private List<Node<?>> readNotKeys(final Set<DataSchemaNode> notKeys) throws ReadingException {
+        final List<Node<?>> newNodes = new ArrayList<>();
+        for (final DataSchemaNode notKey : notKeys) {
+            newNodes.addAll(argumentHandlerRegistry.getGenericReader(getSchemaContext(), getReadConfigNode()).read(
+                    notKey));
+        }
+        return newNodes;
+    }
+
+    @Override
+    protected ConsoleContext getContext(final ListSchemaNode schemaNode) {
+        return new BaseConsoleContext<ListSchemaNode>(schemaNode) {
+            @Override
+            public Optional<String> getPrompt() {
+                return Optional.of("[entry]");
+            }
+        };
+    }
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/SeparatedNodes.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/SeparatedNodes.java
new file mode 100644 (file)
index 0000000..e05f786
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * 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.netconf.cli.reader.impl;
+
+import com.google.common.base.Preconditions;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+
+class SeparatedNodes {
+    private final Set<DataSchemaNode> keyNodes;
+    private final Set<DataSchemaNode> mandatoryNotKey;
+    private final Set<DataSchemaNode> otherNodes;
+
+    public SeparatedNodes(final Set<DataSchemaNode> keyNodes, final Set<DataSchemaNode> mandatoryNotKey,
+            final Set<DataSchemaNode> otherNodes) {
+        this.keyNodes = keyNodes;
+        this.mandatoryNotKey = mandatoryNotKey;
+        this.otherNodes = otherNodes;
+    }
+
+    public Set<DataSchemaNode> getKeyNodes() {
+        return keyNodes;
+    }
+
+    public Set<DataSchemaNode> getMandatoryNotKey() {
+        return mandatoryNotKey;
+    }
+
+    public Set<DataSchemaNode> getOthers() {
+        return otherNodes;
+    }
+
+    static SeparatedNodes separateNodes(final DataNodeContainer dataNodeContainer) {
+        return separateNodes(dataNodeContainer, false);
+    }
+
+    static SeparatedNodes separateNodes(final DataNodeContainer dataNodeContainer, final boolean removeConfigFalseNodes) {
+        final Set<DataSchemaNode> keys = new HashSet<>();
+        final Set<DataSchemaNode> mandatoryNotKeys = new HashSet<>();
+        final Set<DataSchemaNode> others = new HashSet<>();
+
+        List<QName> keyQNames = Collections.emptyList();
+        if (dataNodeContainer instanceof ListSchemaNode) {
+            keyQNames = ((ListSchemaNode) dataNodeContainer).getKeyDefinition();
+        }
+
+        for (final DataSchemaNode dataSchemaNode : dataNodeContainer.getChildNodes()) {
+            if (removeConfigFalseNodes) {
+                if (!dataSchemaNode.isConfiguration()) {
+                    continue;
+                }
+            }
+            if (keyQNames.contains(dataSchemaNode.getQName())) {
+                Preconditions.checkArgument(dataSchemaNode instanceof LeafSchemaNode);
+                keys.add(dataSchemaNode);
+            } else if (dataSchemaNode.getConstraints().isMandatory()) {
+                mandatoryNotKeys.add(dataSchemaNode);
+            } else {
+                others.add(dataSchemaNode);
+            }
+        }
+
+        return new SeparatedNodes(keys, mandatoryNotKeys, others);
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/UnionTypeReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/UnionTypeReader.java
new file mode 100644 (file)
index 0000000..e2d186b
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * 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.netconf.cli.reader.impl;
+
+import static org.opendaylight.controller.netconf.cli.io.IOUtil.isSkipInput;
+
+import com.google.common.base.Optional;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import jline.console.completer.AggregateCompleter;
+import jline.console.completer.Completer;
+import jline.console.completer.StringsCompleter;
+import org.opendaylight.controller.netconf.cli.io.ConsoleContext;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.cli.io.IOUtil;
+import org.opendaylight.controller.netconf.cli.reader.ReadingException;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+class UnionTypeReader {
+    private static final Logger LOG = LoggerFactory.getLogger(UnionTypeReader.class);
+
+    private final ConsoleIO console;
+
+    public UnionTypeReader(final ConsoleIO console) {
+        this.console = console;
+    }
+
+    public Optional<TypeDefinition<?>> read(final TypeDefinition<?> unionTypeDefinition) throws IOException,
+            ReadingException {
+        final ConsoleContext context = getContext(unionTypeDefinition);
+        console.enterContext(context);
+        try {
+            final Map<String, TypeDefinition<?>> mapping = ((UnionConsoleContext) context).getMenuItemMapping();
+            console.formatLn("The element is of type union. Choose concrete type from: %s", mapping.keySet());
+
+            final String rawValue = console.read();
+            if (isSkipInput(rawValue)) {
+                return Optional.absent();
+            }
+            final TypeDefinition<?> value = mapping.get(rawValue);
+            if (value != null) {
+                return Optional.<TypeDefinition<?>> of(value);
+            } else {
+                final String message = String.format("Incorrect type (%s) was specified for union type definition", rawValue);
+                LOG.error(message);
+                throw new ReadingException(message);
+            }
+        } finally {
+            console.leaveContext();
+        }
+    }
+
+    private UnionConsoleContext getContext(final TypeDefinition<?> typeDefinition) {
+        return new UnionConsoleContext(typeDefinition);
+    }
+
+    private class UnionConsoleContext implements ConsoleContext {
+
+        private final TypeDefinition<?> typeDef;
+        private final Map<String, TypeDefinition<?>> menuItemsToTypeDefinitions = new HashMap<>();
+
+        public UnionConsoleContext(final TypeDefinition<?> typeDef) {
+            this.typeDef = typeDef;
+        }
+
+        @Override
+        public Optional<String> getPrompt() {
+            return Optional.of("type[" + typeDef.getQName().getLocalName()  + "]");
+        }
+
+        @Override
+        public Completer getCompleter() {
+            List<TypeDefinition<?>> subtypesForMenu = resolveSubtypesFrom(typeDef);
+            if (subtypesForMenu.isEmpty()) {
+                subtypesForMenu = Collections.<TypeDefinition<?>> singletonList(typeDef);
+            }
+            final Collection<String> menuItems = toMenuItem(subtypesForMenu);
+            return new AggregateCompleter(new StringsCompleter(menuItems), new StringsCompleter(IOUtil.SKIP));
+        }
+
+        public Map<String, TypeDefinition<?>> getMenuItemMapping() {
+            return menuItemsToTypeDefinitions;
+        }
+
+        private Collection<String> toMenuItem(final List<TypeDefinition<?>> allTypesBehindUnion) {
+            final List<String> result = new ArrayList<String>();
+            for (final TypeDefinition<?> type : allTypesBehindUnion) {
+                final String menuItem = type.getQName().getLocalName();
+                menuItemsToTypeDefinitions.put(menuItem, type);
+                result.add(menuItem);
+            }
+            return result;
+        }
+
+        /**
+         *
+         * If union type is found in potentialEndTypeCandidate as subtype then
+         * it these subtypes become candidates.
+         *
+         * @param potentialEndTypeCandidate
+         *            candidate to node which has no union subtype
+         */
+        private List<TypeDefinition<?>> resolveSubtypesFrom(final TypeDefinition<?> potentialEndTypeCandidate) {
+            if (potentialEndTypeCandidate instanceof UnionTypeDefinition) {
+                return ((UnionTypeDefinition) potentialEndTypeCandidate).getTypes();
+            }
+            if (potentialEndTypeCandidate.getBaseType() == null) {
+                return Collections.emptyList();
+            }
+            return resolveSubtypesFrom(potentialEndTypeCandidate.getBaseType());
+        }
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/OutFormatter.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/OutFormatter.java
new file mode 100644 (file)
index 0000000..bed27b4
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.netconf.cli.writer;
+
+public class OutFormatter {
+
+    public static final String INDENT_STEP = "  ";
+    public static final String COMPOSITE_OPEN_NODE = " {";
+    public static final String COMPOSITE_CLOSE_NODE = "}";
+    public static final String NEW_LINE = "\n";
+
+    int indentLevel = -1;
+    private String currentIndent = "";
+
+    public OutFormatter indent(final StringBuilder buffer) {
+        buffer.append(currentIndent);
+        return this;
+    }
+
+    public OutFormatter openComposite(final StringBuilder buffer) {
+        buffer.append(COMPOSITE_OPEN_NODE);
+        return this;
+    }
+
+    public OutFormatter closeCompositeWithIndent(final StringBuilder buffer) {
+        buffer.append(currentIndent);
+        buffer.append(COMPOSITE_CLOSE_NODE);
+        return this;
+    }
+
+    public OutFormatter newLine(final StringBuilder buffer) {
+        buffer.append(NEW_LINE);
+        return this;
+    }
+
+    private void prepareIndent() {
+        final StringBuilder output = new StringBuilder();
+        for (int i = 0; i < indentLevel; i++) {
+            output.append(INDENT_STEP);
+        }
+        currentIndent = output.toString();
+    }
+
+    public OutFormatter increaseIndent() {
+        indentLevel++;
+        prepareIndent();
+        return this;
+    }
+
+    public OutFormatter decreaseIndent() {
+        indentLevel--;
+        prepareIndent();
+        return this;
+    }
+
+    public OutFormatter addStringWithIndent(final StringBuilder buffer, final String value) {
+        indent(buffer);
+        buffer.append(value);
+        return this;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/WriteException.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/WriteException.java
new file mode 100644 (file)
index 0000000..b2cc456
--- /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.netconf.cli.writer;
+
+public class WriteException extends Exception {
+
+    private static final long serialVersionUID = 8401242676753560336L;
+
+    public WriteException(final String msg, final Exception e) {
+        super(msg, e);
+    }
+
+    public WriteException(final String msg) {
+        super(msg);
+    }
+
+    public static class IncorrectNumberOfNodes extends WriteException {
+        private static final long serialVersionUID = 8910285140705622920L;
+
+        public IncorrectNumberOfNodes(final String msg) {
+            super(msg);
+        }
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/Writer.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/Writer.java
new file mode 100644 (file)
index 0000000..ba3d876
--- /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.netconf.cli.writer;
+
+import java.util.List;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+
+/**
+ * Generic handler(writer) of output elements for commands
+ */
+public interface Writer<T extends DataSchemaNode> {
+
+    void write(T dataSchemaNode, List<Node<?>> dataNodes) throws WriteException;
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/custom/DataWriter.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/custom/DataWriter.java
new file mode 100644 (file)
index 0000000..3724ecb
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * 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.netconf.cli.writer.custom;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import java.io.IOException;
+import java.util.Collections;
+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.controller.netconf.cli.writer.impl.AbstractWriter;
+import org.opendaylight.controller.netconf.cli.writer.impl.NormalizedNodeWriter;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlDocumentUtils;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+public class DataWriter extends AbstractWriter<DataSchemaNode> {
+
+    private final OutFormatter out;
+    private final SchemaContext remoteSchemaContext;
+
+    public DataWriter(final ConsoleIO console, final OutFormatter out, final SchemaContext remoteSchemaContext) {
+        super(console);
+        this.out = out;
+        this.remoteSchemaContext = remoteSchemaContext;
+    }
+
+    @Override
+    protected void writeInner(final DataSchemaNode dataSchemaNode, final List<Node<?>> dataNodes) throws IOException, WriteException {
+        Preconditions.checkArgument(dataNodes.size() == 1, "Expected only 1 element for data node");
+        final Node<?> dataNode = dataNodes.get(0);
+        Preconditions.checkArgument(dataNode instanceof CompositeNode, "Unexpected node type: %s, should be %s", dataNode, CompositeNode.class);
+
+        StringBuilder output = new StringBuilder();
+        out.increaseIndent().addStringWithIndent(output, dataSchemaNode.getQName().getLocalName()).openComposite(output);
+        console.writeLn(output.toString());
+
+        for (final Node<?> childNode : ((CompositeNode) dataNode).getValue()) {
+            final Optional<DataSchemaNode> schemaNode = XmlDocumentUtils.findFirstSchema(childNode.getNodeType(), remoteSchemaContext.getDataDefinitions());
+            Preconditions.checkState(schemaNode.isPresent(), "Unknown data node %s, not defined in schema", childNode.getNodeType());
+            new NormalizedNodeWriter(console, out).write(schemaNode.get(), Collections.<Node<?>>singletonList(childNode));
+        }
+
+        output = new StringBuilder();
+        out.decreaseIndent().closeCompositeWithIndent(output);
+        console.writeLn(output.toString());
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/AbstractWriter.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/AbstractWriter.java
new file mode 100644 (file)
index 0000000..f9c4e84
--- /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.netconf.cli.writer.impl;
+
+import java.io.IOException;
+import java.util.List;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIO;
+import org.opendaylight.controller.netconf.cli.writer.WriteException;
+import org.opendaylight.controller.netconf.cli.writer.Writer;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+
+public abstract class AbstractWriter<T extends DataSchemaNode> implements Writer<T> {
+
+    protected ConsoleIO console;
+
+    public AbstractWriter(final ConsoleIO console) {
+        this.console = console;
+    }
+
+    @Override
+    public void write(final T dataSchemaNode, final List<Node<?>> dataNodes) throws WriteException {
+        try {
+            writeInner(dataSchemaNode, dataNodes);
+        } catch (final IOException e) {
+            throw new WriteException("Unable to write data to output for " + dataSchemaNode.getQName(), e);
+        }
+    }
+
+    protected abstract void writeInner(final T dataSchemaNode, final List<Node<?>> dataNodes) throws IOException,
+            WriteException;
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/AugmentationNodeCliSerializer.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/AugmentationNodeCliSerializer.java
new file mode 100644 (file)
index 0000000..626bc4e
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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.netconf.cli.writer.impl;
+
+import com.google.common.base.Preconditions;
+import java.util.Collections;
+import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
+import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.AugmentationNodeBaseSerializer;
+import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
+final class AugmentationNodeCliSerializer extends AugmentationNodeBaseSerializer<String> {
+
+    private final NodeSerializerDispatcher<String> dispatcher;
+    private final OutFormatter out;
+
+    AugmentationNodeCliSerializer(final OutFormatter out, final NodeSerializerDispatcher<String> dispatcher) {
+        this.out = Preconditions.checkNotNull(out);
+        this.dispatcher = Preconditions.checkNotNull(dispatcher);
+    }
+
+    @Override
+    public Iterable<String> serialize(final AugmentationSchema schema, final AugmentationNode node) {
+        final StringBuilder output = new StringBuilder();
+        out.increaseIndent();
+        out.addStringWithIndent(output, "augment");
+        out.openComposite(output);
+        out.newLine(output);
+
+        for (final String childOutput : super.serialize(schema, node)) {
+            output.append(childOutput);
+            out.newLine(output);
+        }
+
+        out.closeCompositeWithIndent(output);
+        out.decreaseIndent();
+        return Collections.singletonList(output.toString());
+    }
+
+    @Override
+    protected NodeSerializerDispatcher<String> getNodeDispatcher() {
+        return dispatcher;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/ChoiceNodeCliSerializer.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/ChoiceNodeCliSerializer.java
new file mode 100644 (file)
index 0000000..62845ad
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * 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.netconf.cli.writer.impl;
+
+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.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;
+import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
+import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
+
+final class ChoiceNodeCliSerializer extends ChoiceNodeBaseSerializer<String> {
+    private final NodeSerializerDispatcher<String> dispatcher;
+    private final OutFormatter out;
+
+    ChoiceNodeCliSerializer(final OutFormatter out, final NodeSerializerDispatcher<String> dispatcher) {
+        this.out = Preconditions.checkNotNull(out);
+        this.dispatcher = Preconditions.checkNotNull(dispatcher);
+    }
+
+    @Override
+    public Iterable<String> serialize(final ChoiceNode schema, final org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode node) {
+        final StringBuilder output = new StringBuilder();
+        out.increaseIndent();
+        out.addStringWithIndent(output, "choice ");
+        output.append(schema.getQName().getLocalName());
+        output.append(" (");
+        output.append(detectCase(schema, node));
+        output.append(") ");
+        out.openComposite(output);
+        out.newLine(output);
+
+        for (final String childOutput : super.serialize(schema, node)) {
+            output.append(childOutput);
+            out.newLine(output);
+        }
+
+        out.closeCompositeWithIndent(output);
+        out.decreaseIndent();
+        return Collections.singletonList(output.toString());
+    }
+
+    private String detectCase(final ChoiceNode schema, final org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode node) {
+        for (final DataContainerChild<? extends PathArgument, ?> caseChild : node.getValue()) {
+            final QName presentChildQName = caseChild.getNodeType();
+            for (final ChoiceCaseNode choiceCaseNode : schema.getCases()) {
+                if (choiceCaseNode.getDataChildByName(presentChildQName) != null) {
+                    // Pick the first case that contains first child node
+                    return choiceCaseNode.getQName().getLocalName();
+                }
+            }
+        }
+
+        // Should not happen, nodes should come from one of the cases
+        throw new IllegalStateException("Choice node " + node + " does not conform to choice schema " + schema);
+    }
+
+    @Override
+    protected NodeSerializerDispatcher<String> getNodeDispatcher() {
+        return dispatcher;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/CliOutputFromNormalizedNodeSerializerFactory.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/CliOutputFromNormalizedNodeSerializerFactory.java
new file mode 100644 (file)
index 0000000..cab07af
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * 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.netconf.cli.writer.impl;
+
+import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
+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.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.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.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+
+public final class CliOutputFromNormalizedNodeSerializerFactory implements FromNormalizedNodeSerializerFactory<String> {
+    private final ContainerNodeCliSerializer containerSerializer;
+    private final ChoiceNodeCliSerializer choiceSerializer;
+    private final AugmentationNodeCliSerializer augmentSerializer;
+    private final LeafNodeCliSerializer leafNodeSerializer;
+    private final LeafSetNodeCliSerializer leafSetSerializer;
+    private final MapNodeCliSerializer mapNodeSerializer;
+    private final LeafSetEntryNodeCliSerializer leafSetEntryNodeSerializer;
+    private final MapEntryNodeCliSerializer mapEntryNodeSerializer;
+    final NodeSerializerDispatcher<String> dispatcher = new NodeCliSerializerDispatcher(this);
+
+    private CliOutputFromNormalizedNodeSerializerFactory(final OutFormatter out, final XmlCodecProvider codecProvider) {
+
+        containerSerializer = new ContainerNodeCliSerializer(out, dispatcher);
+        choiceSerializer = new ChoiceNodeCliSerializer(out, dispatcher);
+        augmentSerializer = new AugmentationNodeCliSerializer(out, dispatcher);
+        leafNodeSerializer = new LeafNodeCliSerializer(out);
+
+        leafSetEntryNodeSerializer = new LeafSetEntryNodeCliSerializer(out);
+        leafSetSerializer = new LeafSetNodeCliSerializer(out, leafSetEntryNodeSerializer);
+
+        mapEntryNodeSerializer = new MapEntryNodeCliSerializer(out, dispatcher);
+        mapNodeSerializer = new MapNodeCliSerializer(out, mapEntryNodeSerializer);
+    }
+
+    public NodeSerializerDispatcher<String> getDispatcher() {
+        return dispatcher;
+    }
+
+    public static CliOutputFromNormalizedNodeSerializerFactory getInstance(final OutFormatter out,
+            final XmlCodecProvider codecProvider) {
+        return new CliOutputFromNormalizedNodeSerializerFactory(out, codecProvider);
+    }
+
+    @Override
+    public FromNormalizedNodeSerializer<String, AugmentationNode, AugmentationSchema> getAugmentationNodeSerializer() {
+        return augmentSerializer;
+    }
+
+    @Override
+    public FromNormalizedNodeSerializer<String, ChoiceNode, org.opendaylight.yangtools.yang.model.api.ChoiceNode> getChoiceNodeSerializer() {
+        return choiceSerializer;
+    }
+
+    @Override
+    public FromNormalizedNodeSerializer<String, ContainerNode, ContainerSchemaNode> getContainerNodeSerializer() {
+        return containerSerializer;
+    }
+
+    @Override
+    public FromNormalizedNodeSerializer<String, LeafNode<?>, LeafSchemaNode> getLeafNodeSerializer() {
+        return leafNodeSerializer;
+    }
+
+    @Override
+    public FromNormalizedNodeSerializer<String, LeafSetEntryNode<?>, LeafListSchemaNode> getLeafSetEntryNodeSerializer() {
+        return leafSetEntryNodeSerializer;
+    }
+
+    @Override
+    public FromNormalizedNodeSerializer<String, LeafSetNode<?>, LeafListSchemaNode> getLeafSetNodeSerializer() {
+        return leafSetSerializer;
+    }
+
+    @Override
+    public FromNormalizedNodeSerializer<String, MapEntryNode, ListSchemaNode> getMapEntryNodeSerializer() {
+        return mapEntryNodeSerializer;
+    }
+
+    @Override
+    public FromNormalizedNodeSerializer<String, MapNode, ListSchemaNode> getMapNodeSerializer() {
+        return mapNodeSerializer;
+    }
+
+}
\ No newline at end of file
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/CompositeNodeWriter.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/CompositeNodeWriter.java
new file mode 100644 (file)
index 0000000..57d8f57
--- /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.netconf.cli.writer.impl;
+
+import java.io.IOException;
+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.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.api.SimpleNode;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+
+public class CompositeNodeWriter extends AbstractWriter<DataSchemaNode> {
+
+    private final OutFormatter outFormatter;
+
+    public CompositeNodeWriter(final ConsoleIO console, final OutFormatter outFormatter) {
+        super(console);
+        this.outFormatter = outFormatter;
+    }
+
+    @Override
+    protected void writeInner(final DataSchemaNode dataSchemaNode, final List<Node<?>> dataNodes) throws IOException, WriteException {
+        final StringBuilder output = new StringBuilder();
+        writeNode(dataNodes, output);
+        console.writeLn(output);
+    }
+
+    private void writeNode(final List<Node<?>> dataNodes, final StringBuilder output) throws IOException, WriteException {
+        for (final Node<?> dataNode : dataNodes) {
+            outFormatter.increaseIndent();
+            outFormatter.addStringWithIndent(output, dataNode.getNodeType().getLocalName());
+            if (dataNode instanceof CompositeNode) {
+                outFormatter.openComposite(output);
+                outFormatter.newLine(output);
+                writeNode(((CompositeNode) dataNode).getValue(), output);
+                outFormatter.closeCompositeWithIndent(output);
+                outFormatter.newLine(output);
+            } else if (dataNode instanceof SimpleNode<?>) {
+                final SimpleNode<?> simpleNode = (SimpleNode<?>) dataNode;
+                output.append(" ");
+                output.append(simpleNode.getValue());
+                outFormatter.newLine(output);
+            }
+            outFormatter.decreaseIndent();
+        }
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/ContainerNodeCliSerializer.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/ContainerNodeCliSerializer.java
new file mode 100644 (file)
index 0000000..62b995e
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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.netconf.cli.writer.impl;
+
+import com.google.common.base.Preconditions;
+import java.util.Collections;
+import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.ContainerNodeBaseSerializer;
+import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+
+final class ContainerNodeCliSerializer extends ContainerNodeBaseSerializer<String> {
+
+    private final NodeSerializerDispatcher<String> dispatcher;
+    private final OutFormatter out;
+
+    ContainerNodeCliSerializer(final OutFormatter out, final NodeSerializerDispatcher<String> dispatcher) {
+        this.out = Preconditions.checkNotNull(out);
+        this.dispatcher = Preconditions.checkNotNull(dispatcher);
+    }
+
+    @Override
+    public Iterable<String> serialize(final ContainerSchemaNode schema, final ContainerNode containerNode) {
+        final StringBuilder output = new StringBuilder();
+        out.increaseIndent();
+        out.addStringWithIndent(output, containerNode.getNodeType().getLocalName());
+        out.openComposite(output);
+        out.newLine(output);
+
+        for (final String childOutput : super.serialize(schema, containerNode)) {
+            output.append(childOutput);
+            out.newLine(output);
+        }
+
+        out.closeCompositeWithIndent(output);
+        out.decreaseIndent();
+        return Collections.singletonList(output.toString());
+    }
+
+    @Override
+    protected NodeSerializerDispatcher<String> getNodeDispatcher() {
+        return dispatcher;
+    }
+
+}
\ No newline at end of file
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/LeafNodeCliSerializer.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/LeafNodeCliSerializer.java
new file mode 100644 (file)
index 0000000..d3216c2
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * 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.netconf.cli.writer.impl;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.LeafNodeBaseSerializer;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+
+final class LeafNodeCliSerializer extends LeafNodeBaseSerializer<String> {
+    private final OutFormatter out;
+
+    LeafNodeCliSerializer(final OutFormatter out) {
+        this.out = Preconditions.checkNotNull(out);
+    }
+
+    @Override
+    public String serializeLeaf(final LeafSchemaNode schema, final LeafNode<?> node) {
+        final StringBuilder output = new StringBuilder();
+        out.increaseIndent();
+        out.addStringWithIndent(output, node.getNodeType().getLocalName());
+        output.append(" ");
+        output.append(node.getValue());
+        out.decreaseIndent();
+        return output.toString();
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/LeafSetEntryNodeCliSerializer.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/LeafSetEntryNodeCliSerializer.java
new file mode 100644 (file)
index 0000000..4937432
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * 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.netconf.cli.writer.impl;
+
+import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.LeafSetEntryNodeBaseSerializer;
+import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
+
+final class LeafSetEntryNodeCliSerializer extends LeafSetEntryNodeBaseSerializer<String> {
+
+    private final OutFormatter out;
+
+    public LeafSetEntryNodeCliSerializer(final OutFormatter out) {
+        this.out = out;
+    }
+
+    @Override
+    protected String serializeLeaf(final LeafListSchemaNode schema, final LeafSetEntryNode<?> node) {
+        final StringBuilder output = new StringBuilder();
+        out.increaseIndent();
+        out.addStringWithIndent(output, node.getValue().toString());
+        out.decreaseIndent();
+        return output.toString();
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/LeafSetNodeCliSerializer.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/LeafSetNodeCliSerializer.java
new file mode 100644 (file)
index 0000000..8d618e8
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * 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.netconf.cli.writer.impl;
+
+import java.util.Collections;
+import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.transform.FromNormalizedNodeSerializer;
+import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
+
+final class LeafSetNodeCliSerializer implements
+        FromNormalizedNodeSerializer<String, LeafSetNode<?>, LeafListSchemaNode> {
+    private final LeafSetEntryNodeCliSerializer leafSetEntryNodeSerializer;
+    private final OutFormatter out;
+
+    LeafSetNodeCliSerializer(final OutFormatter out, final LeafSetEntryNodeCliSerializer leafSetEntryNodeSerializer) {
+        this.out = out;
+        this.leafSetEntryNodeSerializer = leafSetEntryNodeSerializer;
+    }
+
+    @Override
+    public Iterable<String> serialize(final LeafListSchemaNode schema, final LeafSetNode<?> node) {
+        final StringBuilder output = new StringBuilder();
+        out.increaseIndent();
+        out.addStringWithIndent(output, node.getNodeType().getLocalName());
+        out.openComposite(output);
+        out.newLine(output);
+        for (final LeafSetEntryNode<?> leafEntryNode : node.getValue()) {
+            final Iterable<String> valueFromLeafSetEntry = leafSetEntryNodeSerializer.serialize(schema, leafEntryNode);
+            output.append(valueFromLeafSetEntry.iterator().next());
+            out.newLine(output);
+        }
+        out.closeCompositeWithIndent(output);
+        out.decreaseIndent();
+        return Collections.singletonList(output.toString());
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/MapEntryNodeCliSerializer.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/MapEntryNodeCliSerializer.java
new file mode 100644 (file)
index 0000000..15f86a7
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * 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.netconf.cli.writer.impl;
+
+import com.google.common.base.Preconditions;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.MapEntryNodeBaseSerializer;
+import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+
+final class MapEntryNodeCliSerializer extends MapEntryNodeBaseSerializer<String> {
+
+    private final NodeSerializerDispatcher<String> dispatcher;
+    private final OutFormatter out;
+
+    MapEntryNodeCliSerializer(final OutFormatter out, final NodeSerializerDispatcher<String> dispatcher) {
+        this.out = Preconditions.checkNotNull(out);
+        this.dispatcher = Preconditions.checkNotNull(dispatcher);
+    }
+
+    @Override
+    public Iterable<String> serialize(final ListSchemaNode schema, final MapEntryNode node) {
+        final StringBuilder output = new StringBuilder();
+        out.increaseIndent();
+        out.addStringWithIndent(output, node.getNodeType().getLocalName());
+        serializeKeysIfPresent(node, output);
+
+        out.openComposite(output);
+        out.newLine(output);
+
+        for (final String childOutput : super.serialize(schema, node)) {
+            output.append(childOutput);
+            out.newLine(output);
+        }
+
+        out.closeCompositeWithIndent(output);
+        out.newLine(output);
+        out.decreaseIndent();
+        return Collections.singletonList(output.toString());
+    }
+
+    private void serializeKeysIfPresent(final MapEntryNode node, final StringBuilder output) {
+        final Map<QName, Object> keyValues = node.getIdentifier().getKeyValues();
+        if (keyValues.isEmpty()) {
+            return;
+        }
+
+        int i = 0;
+        output.append(" [");
+        for (final Entry<QName, Object> qNameObjectEntry : keyValues.entrySet()) {
+            output.append(qNameObjectEntry.getKey().getLocalName());
+            output.append("=");
+            output.append(qNameObjectEntry.getValue().toString());
+            if (++i != keyValues.size()) {
+                output.append(", ");
+            }
+        }
+        output.append("]");
+    }
+
+    @Override
+    protected NodeSerializerDispatcher<String> getNodeDispatcher() {
+        return dispatcher;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/MapNodeCliSerializer.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/MapNodeCliSerializer.java
new file mode 100644 (file)
index 0000000..b08acbf
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * 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.netconf.cli.writer.impl;
+
+import com.google.common.base.Preconditions;
+import java.util.Collections;
+import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.transform.FromNormalizedNodeSerializer;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+
+final class MapNodeCliSerializer implements FromNormalizedNodeSerializer<String, MapNode, ListSchemaNode> {
+
+    private final FromNormalizedNodeSerializer<String, MapEntryNode, ListSchemaNode> mapEntrySerializer;
+    private final OutFormatter out;
+
+    MapNodeCliSerializer(final OutFormatter out, final MapEntryNodeCliSerializer mapEntrySerializer) {
+        this.out = Preconditions.checkNotNull(out);
+        this.mapEntrySerializer = mapEntrySerializer;
+    }
+
+    @Override
+    public Iterable<String> serialize(final ListSchemaNode schema, final MapNode node) {
+        final StringBuilder output = new StringBuilder();
+
+        out.increaseIndent();
+        out.addStringWithIndent(output, node.getNodeType().getLocalName());
+        output.append(" ");
+        out.openComposite(output);
+        out.newLine(output);
+
+        for (final MapEntryNode mapEntryNode : node.getValue()) {
+            final Iterable<String> valueFromLeafSetEntry = mapEntrySerializer.serialize(schema, mapEntryNode);
+            output.append(valueFromLeafSetEntry.iterator().next());
+        }
+
+        out.closeCompositeWithIndent(output);
+        out.decreaseIndent();
+
+        return Collections.singletonList(output.toString());
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NodeCliSerializerDispatcher.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NodeCliSerializerDispatcher.java
new file mode 100644 (file)
index 0000000..08abd47
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * 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.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.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.LeafNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MixinNode;
+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.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+
+public class NodeCliSerializerDispatcher implements NodeSerializerDispatcher<String> {
+    private final FromNormalizedNodeSerializerFactory<String> factory;
+
+    public NodeCliSerializerDispatcher(final FromNormalizedNodeSerializerFactory<String> factory) {
+        this.factory = Preconditions.checkNotNull(factory);
+    }
+
+    @Override
+    public final Iterable<String> dispatchChildElement(final Object childSchema,
+            final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+        if (dataContainerChild instanceof ContainerNode) {
+            return onContainerNode(childSchema, dataContainerChild);
+        } else if (dataContainerChild instanceof LeafNode<?>) {
+            return onLeafNode(childSchema, dataContainerChild);
+        } else if (dataContainerChild instanceof MixinNode) {
+            if (dataContainerChild instanceof LeafSetNode<?>) {
+                return onLeafListNode(childSchema, dataContainerChild);
+            } else if (dataContainerChild instanceof MapNode) {
+                return onListNode(childSchema, dataContainerChild);
+            } else if (dataContainerChild instanceof ChoiceNode) {
+                return onChoiceNode(childSchema, dataContainerChild);
+            } else if (dataContainerChild instanceof AugmentationNode) {
+                return onAugmentationSchema(childSchema, dataContainerChild);
+            }
+        }
+        throw new IllegalArgumentException("Unable to serialize " + childSchema);
+    }
+
+    private Iterable<String> onAugmentationSchema(final Object childSchema,
+            final DataContainerChild<? extends InstanceIdentifier.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) {
+        checkSchemaCompatibility(childSchema, org.opendaylight.yangtools.yang.model.api.ChoiceNode.class,
+                dataContainerChild);
+        return factory.getChoiceNodeSerializer().serialize(
+                (org.opendaylight.yangtools.yang.model.api.ChoiceNode) childSchema, (ChoiceNode) dataContainerChild);
+    }
+
+    private Iterable<String> onListNode(final Object childSchema,
+            final DataContainerChild<? extends InstanceIdentifier.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) {
+        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) {
+        checkSchemaCompatibility(childSchema, LeafSchemaNode.class, dataContainerChild);
+        final Iterable<String> elements = factory.getLeafNodeSerializer().serialize((LeafSchemaNode) childSchema,
+                (LeafNode<?>) dataContainerChild);
+        checkOnlyOneSerializedElement(elements, dataContainerChild);
+        return elements;
+    }
+
+    private static void checkOnlyOneSerializedElement(final Iterable<?> elements,
+            final DataContainerChild<? extends InstanceIdentifier.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,
+                size);
+    }
+
+    private Iterable<String> onContainerNode(final Object childSchema,
+            final DataContainerChild<? extends InstanceIdentifier.PathArgument, ?> dataContainerChild) {
+        checkSchemaCompatibility(childSchema, ContainerSchemaNode.class, dataContainerChild);
+
+        final Iterable<String> elements = factory.getContainerNodeSerializer().serialize(
+                (ContainerSchemaNode) childSchema, (ContainerNode) dataContainerChild);
+        checkOnlyOneSerializedElement(elements, dataContainerChild);
+        return elements;
+    }
+
+    private static void checkSchemaCompatibility(final Object childSchema, final Class<?> containerSchemaNodeClass,
+            final DataContainerChild<? extends InstanceIdentifier.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
diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NormalizedNodeWriter.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/writer/impl/NormalizedNodeWriter.java
new file mode 100644 (file)
index 0000000..eef9a39
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * 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.netconf.cli.writer.impl;
+
+import java.io.IOException;
+import java.util.Iterator;
+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.Node;
+import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
+import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher;
+import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils;
+import org.opendaylight.yangtools.yang.data.json.schema.cnsn.parser.CnSnToNormalizedNodeParserFactory;
+import org.opendaylight.yangtools.yang.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.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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class NormalizedNodeWriter extends AbstractWriter<DataSchemaNode> {
+
+    private static final Logger LOG = LoggerFactory.getLogger(NormalizedNodeWriter.class);
+    private final OutFormatter out;
+
+    public NormalizedNodeWriter(final ConsoleIO console, final OutFormatter out) {
+        super(console);
+        this.out = out;
+    }
+
+    public void writeInner(final DataSchemaNode dataSchemaNode, final List<Node<?>> dataNodes) throws WriteException,
+            IOException {
+
+        // TODO - add getDispatcher method to CnSnToNormalizedNodeParserFactory
+        // to be able call dispatchChildElement
+        final DataContainerChild<? extends PathArgument, ?> dataContainerChild = parseToNormalizedNode(dataNodes,
+                dataSchemaNode);
+
+        if (dataContainerChild != null) {
+            console.writeLn(serializeToCliOutput(dataContainerChild, dataSchemaNode));
+        }
+
+    }
+
+    private String serializeToCliOutput(final DataContainerChild<? extends PathArgument, ?> dataContainerChild,
+            final DataSchemaNode childSchema) {
+        final CliOutputFromNormalizedNodeSerializerFactory factorySerialization = CliOutputFromNormalizedNodeSerializerFactory
+                .getInstance(out, DomUtils.defaultValueCodecProvider());
+        final NodeSerializerDispatcher<String> dispatcher = factorySerialization.getDispatcher();
+        final Iterable<String> result = dispatcher.dispatchChildElement(childSchema, dataContainerChild);
+
+        if (result == null) {
+            return "";
+        }
+
+        final Iterator<String> output = result.iterator();
+        if (!output.hasNext()) {
+            return "";
+        }
+
+        return output.next();
+    }
+
+    private DataContainerChild<? extends PathArgument, ?> parseToNormalizedNode(final List<Node<?>> dataNodes,
+            final DataSchemaNode dataSchemaNode) {
+        final CnSnToNormalizedNodeParserFactory factoryParsing = CnSnToNormalizedNodeParserFactory.getInstance();
+        if (dataSchemaNode instanceof ContainerSchemaNode) {
+            return factoryParsing.getContainerNodeParser().parse(dataNodes, (ContainerSchemaNode) dataSchemaNode);
+        } else if (dataSchemaNode instanceof LeafSchemaNode) {
+            return factoryParsing.getLeafNodeParser().parse(dataNodes, (LeafSchemaNode) dataSchemaNode);
+        } else if (dataSchemaNode instanceof LeafListSchemaNode) {
+            return factoryParsing.getLeafSetNodeParser().parse(dataNodes, (LeafListSchemaNode) dataSchemaNode);
+        } else if (dataSchemaNode instanceof ListSchemaNode) {
+            return factoryParsing.getMapNodeParser().parse(dataNodes, (ListSchemaNode) dataSchemaNode);
+        } else if (dataSchemaNode instanceof ChoiceNode) {
+            return factoryParsing.getChoiceNodeParser().parse(dataNodes, (ChoiceNode) dataSchemaNode);
+        } else if (dataSchemaNode instanceof AugmentationSchema) {
+            return factoryParsing.getAugmentationNodeParser().parse(dataNodes, (AugmentationSchema) dataSchemaNode);
+        }
+        return null;
+    }
+
+}
\ No newline at end of file
diff --git a/opendaylight/netconf/netconf-cli/src/main/resources/logback.xml b/opendaylight/netconf/netconf-cli/src/main/resources/logback.xml
new file mode 100644 (file)
index 0000000..55eedc5
--- /dev/null
@@ -0,0 +1,31 @@
+
+<configuration scan="true">
+  <appender name="netconfcli.log" class="ch.qos.logback.core.FileAppender">
+    <file>netconfcli.log</file>
+
+    <encoder>
+      <pattern>%date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level
+        %logger{35} - %msg%n</pattern>
+    </encoder>
+
+  </appender>
+
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder
+      by default -->
+    <encoder>
+      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+      </pattern>
+    </encoder>
+  </appender>
+
+
+
+  <root level="trace">
+    <appender-ref ref="netconfcli.log" />
+    <!-- <appender-ref ref="STDOUT" /> -->
+  </root>
+
+  <!-- <logger name="org.opendaylight.yangtools.yang.model.api" level="TRACE"
+    additivity="false"> <appender-ref ref="netconfcli.log" /> </logger> -->
+</configuration>
diff --git a/opendaylight/netconf/netconf-cli/src/main/resources/schema/common/ietf-inet-types.yang b/opendaylight/netconf/netconf-cli/src/main/resources/schema/common/ietf-inet-types.yang
new file mode 100644 (file)
index 0000000..edd285d
--- /dev/null
@@ -0,0 +1,427 @@
+module ietf-inet-types {
+
+  namespace "urn:ietf:params:xml:ns:yang:ietf-inet-types";
+  prefix "inet";
+
+  organization
+   "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+  contact
+   "WG Web:   <http://tools.ietf.org/wg/netmod/>
+    WG List:  <mailto:netmod@ietf.org>
+
+    WG Chair: David Partain
+              <mailto:david.partain@ericsson.com>
+
+    WG Chair: David Kessens
+              <mailto:david.kessens@nsn.com>
+
+    Editor:   Juergen Schoenwaelder
+              <mailto:j.schoenwaelder@jacobs-university.de>";
+
+  description
+   "This module contains a collection of generally useful derived
+    YANG data types for Internet addresses and related things.
+
+    Copyright (c) 2010 IETF Trust and the persons identified as
+    authors of the code.  All rights reserved.
+
+
+
+    Redistribution and use in source and binary forms, with or without
+    modification, is permitted pursuant to, and subject to the license
+    terms contained in, the Simplified BSD License set forth in Section
+    4.c of the IETF Trust's Legal Provisions Relating to IETF Documents
+    (http://trustee.ietf.org/license-info).
+
+    This version of this YANG module is part of RFC 6021; see
+    the RFC itself for full legal notices.";
+
+  revision 2010-09-24 {
+    description
+     "Initial revision.";
+    reference
+     "RFC 6021: Common YANG Data Types";
+  }
+
+  /*** collection of protocol field related types ***/
+
+  typedef ip-version {
+    type enumeration {
+      enum unknown {
+        value "0";
+        description
+         "An unknown or unspecified version of the Internet protocol.";
+      }
+      enum ipv4 {
+        value "1";
+        description
+         "The IPv4 protocol as defined in RFC 791.";
+      }
+      enum ipv6 {
+        value "2";
+        description
+         "The IPv6 protocol as defined in RFC 2460.";
+      }
+    }
+    description
+     "This value represents the version of the IP protocol.
+
+      In the value set and its semantics, this type is equivalent
+      to the InetVersion textual convention of the SMIv2.";
+    reference
+     "RFC  791: Internet Protocol
+      RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
+      RFC 4001: Textual Conventions for Internet Network Addresses";
+  }
+
+  typedef dscp {
+    type uint8 {
+      range "0..63";
+    }
+    description
+     "The dscp type represents a Differentiated Services Code-Point
+      that may be used for marking packets in a traffic stream.
+
+      In the value set and its semantics, this type is equivalent
+      to the Dscp textual convention of the SMIv2.";
+    reference
+     "RFC 3289: Management Information Base for the Differentiated
+                Services Architecture
+      RFC 2474: Definition of the Differentiated Services Field
+                (DS Field) in the IPv4 and IPv6 Headers
+      RFC 2780: IANA Allocation Guidelines For Values In
+                the Internet Protocol and Related Headers";
+  }
+
+  typedef ipv6-flow-label {
+    type uint32 {
+      range "0..1048575";
+    }
+    description
+     "The flow-label type represents flow identifier or Flow Label
+      in an IPv6 packet header that may be used to discriminate
+      traffic flows.
+
+      In the value set and its semantics, this type is equivalent
+      to the IPv6FlowLabel textual convention of the SMIv2.";
+    reference
+     "RFC 3595: Textual Conventions for IPv6 Flow Label
+      RFC 2460: Internet Protocol, Version 6 (IPv6) Specification";
+  }
+
+  typedef port-number {
+    type uint16 {
+      range "0..65535";
+    }
+    description
+     "The port-number type represents a 16-bit port number of an
+      Internet transport layer protocol such as UDP, TCP, DCCP, or
+      SCTP.  Port numbers are assigned by IANA.  A current list of
+      all assignments is available from <http://www.iana.org/>.
+
+      Note that the port number value zero is reserved by IANA.  In
+      situations where the value zero does not make sense, it can
+      be excluded by subtyping the port-number type.
+
+      In the value set and its semantics, this type is equivalent
+      to the InetPortNumber textual convention of the SMIv2.";
+    reference
+     "RFC  768: User Datagram Protocol
+      RFC  793: Transmission Control Protocol
+      RFC 4960: Stream Control Transmission Protocol
+      RFC 4340: Datagram Congestion Control Protocol (DCCP)
+      RFC 4001: Textual Conventions for Internet Network Addresses";
+  }
+
+  /*** collection of autonomous system related types ***/
+
+  typedef as-number {
+    type uint32;
+    description
+     "The as-number type represents autonomous system numbers
+      which identify an Autonomous System (AS).  An AS is a set
+      of routers under a single technical administration, using
+      an interior gateway protocol and common metrics to route
+      packets within the AS, and using an exterior gateway
+      protocol to route packets to other ASs'.  IANA maintains
+      the AS number space and has delegated large parts to the
+      regional registries.
+
+      Autonomous system numbers were originally limited to 16
+      bits.  BGP extensions have enlarged the autonomous system
+      number space to 32 bits.  This type therefore uses an uint32
+      base type without a range restriction in order to support
+      a larger autonomous system number space.
+
+      In the value set and its semantics, this type is equivalent
+      to the InetAutonomousSystemNumber textual convention of
+      the SMIv2.";
+    reference
+     "RFC 1930: Guidelines for creation, selection, and registration
+                of an Autonomous System (AS)
+      RFC 4271: A Border Gateway Protocol 4 (BGP-4)
+      RFC 4893: BGP Support for Four-octet AS Number Space
+      RFC 4001: Textual Conventions for Internet Network Addresses";
+  }
+
+  /*** collection of IP address and hostname related types ***/
+
+  typedef ip-address {
+    type union {
+      type inet:ipv4-address;
+      type inet:ipv6-address;
+    }
+    description
+     "The ip-address type represents an IP address and is IP
+      version neutral.  The format of the textual representations
+      implies the IP version.";
+  }
+
+  typedef ipv4-address {
+    type string {
+      pattern
+        '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+      +  '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
+      + '(%[\p{N}\p{L}]+)?';
+    }
+    description
+      "The ipv4-address type represents an IPv4 address in
+       dotted-quad notation.  The IPv4 address may include a zone
+       index, separated by a % sign.
+
+       The zone index is used to disambiguate identical address
+       values.  For link-local addresses, the zone index will
+       typically be the interface index number or the name of an
+       interface.  If the zone index is not present, the default
+       zone of the device will be used.
+
+       The canonical format for the zone index is the numerical
+       format";
+  }
+
+  typedef ipv6-address {
+    type string {
+      pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
+            + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
+            + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
+            + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
+            + '(%[\p{N}\p{L}]+)?';
+      pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
+            + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
+            + '(%.+)?';
+    }
+    description
+     "The ipv6-address type represents an IPv6 address in full,
+      mixed, shortened, and shortened-mixed notation.  The IPv6
+      address may include a zone index, separated by a % sign.
+
+
+
+
+
+      The zone index is used to disambiguate identical address
+      values.  For link-local addresses, the zone index will
+      typically be the interface index number or the name of an
+      interface.  If the zone index is not present, the default
+      zone of the device will be used.
+
+      The canonical format of IPv6 addresses uses the compressed
+      format described in RFC 4291, Section 2.2, item 2 with the
+      following additional rules: the :: substitution must be
+      applied to the longest sequence of all-zero 16-bit chunks
+      in an IPv6 address.  If there is a tie, the first sequence
+      of all-zero 16-bit chunks is replaced by ::.  Single
+      all-zero 16-bit chunks are not compressed.  The canonical
+      format uses lowercase characters and leading zeros are
+      not allowed.  The canonical format for the zone index is
+      the numerical format as described in RFC 4007, Section
+      11.2.";
+    reference
+     "RFC 4291: IP Version 6 Addressing Architecture
+      RFC 4007: IPv6 Scoped Address Architecture
+      RFC 5952: A Recommendation for IPv6 Address Text Representation";
+  }
+
+  typedef ip-prefix {
+    type union {
+      type inet:ipv4-prefix;
+      type inet:ipv6-prefix;
+    }
+    description
+     "The ip-prefix type represents an IP prefix and is IP
+      version neutral.  The format of the textual representations
+      implies the IP version.";
+  }
+
+  typedef ipv4-prefix {
+    type string {
+      pattern
+         '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+       +  '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
+       + '/(([0-9])|([1-2][0-9])|(3[0-2]))';
+    }
+    description
+     "The ipv4-prefix type represents an IPv4 address prefix.
+      The prefix length is given by the number following the
+      slash character and must be less than or equal to 32.
+
+
+
+      A prefix length value of n corresponds to an IP address
+      mask that has n contiguous 1-bits from the most
+      significant bit (MSB) and all other bits set to 0.
+
+      The canonical format of an IPv4 prefix has all bits of
+      the IPv4 address set to zero that are not part of the
+      IPv4 prefix.";
+  }
+
+  typedef ipv6-prefix {
+    type string {
+      pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
+            + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
+            + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
+            + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
+            + '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';
+      pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
+            + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
+            + '(/.+)';
+    }
+    description
+     "The ipv6-prefix type represents an IPv6 address prefix.
+      The prefix length is given by the number following the
+      slash character and must be less than or equal 128.
+
+      A prefix length value of n corresponds to an IP address
+      mask that has n contiguous 1-bits from the most
+      significant bit (MSB) and all other bits set to 0.
+
+      The IPv6 address should have all bits that do not belong
+      to the prefix set to zero.
+
+      The canonical format of an IPv6 prefix has all bits of
+      the IPv6 address set to zero that are not part of the
+      IPv6 prefix.  Furthermore, IPv6 address is represented
+      in the compressed format described in RFC 4291, Section
+      2.2, item 2 with the following additional rules: the ::
+      substitution must be applied to the longest sequence of
+      all-zero 16-bit chunks in an IPv6 address.  If there is
+      a tie, the first sequence of all-zero 16-bit chunks is
+      replaced by ::.  Single all-zero 16-bit chunks are not
+      compressed.  The canonical format uses lowercase
+      characters and leading zeros are not allowed.";
+    reference
+     "RFC 4291: IP Version 6 Addressing Architecture";
+  }
+
+
+  /*** collection of domain name and URI types ***/
+
+  typedef domain-name {
+    type string {
+      pattern '((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*'
+           +  '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)'
+           +  '|\.';
+      length "1..253";
+    }
+    description
+     "The domain-name type represents a DNS domain name.  The
+      name SHOULD be fully qualified whenever possible.
+
+      Internet domain names are only loosely specified.  Section
+      3.5 of RFC 1034 recommends a syntax (modified in Section
+      2.1 of RFC 1123).  The pattern above is intended to allow
+      for current practice in domain name use, and some possible
+      future expansion.  It is designed to hold various types of
+      domain names, including names used for A or AAAA records
+      (host names) and other records, such as SRV records.  Note
+      that Internet host names have a stricter syntax (described
+      in RFC 952) than the DNS recommendations in RFCs 1034 and
+      1123, and that systems that want to store host names in
+      schema nodes using the domain-name type are recommended to
+      adhere to this stricter standard to ensure interoperability.
+
+      The encoding of DNS names in the DNS protocol is limited
+      to 255 characters.  Since the encoding consists of labels
+      prefixed by a length bytes and there is a trailing NULL
+      byte, only 253 characters can appear in the textual dotted
+      notation.
+
+      The description clause of schema nodes using the domain-name
+      type MUST describe when and how these names are resolved to
+      IP addresses.  Note that the resolution of a domain-name value
+      may require to query multiple DNS records (e.g., A for IPv4
+      and AAAA for IPv6).  The order of the resolution process and
+      which DNS record takes precedence can either be defined
+      explicitely or it may depend on the configuration of the
+      resolver.
+
+      Domain-name values use the US-ASCII encoding.  Their canonical
+      format uses lowercase US-ASCII characters.  Internationalized
+      domain names MUST be encoded in punycode as described in RFC
+      3492";
+    reference
+     "RFC  952: DoD Internet Host Table Specification
+      RFC 1034: Domain Names - Concepts and Facilities
+      RFC 1123: Requirements for Internet Hosts -- Application
+                and Support
+      RFC 2782: A DNS RR for specifying the location of services
+                (DNS SRV)
+      RFC 3492: Punycode: A Bootstring encoding of Unicode for
+                Internationalized Domain Names in Applications
+                (IDNA)
+      RFC 5891: Internationalizing Domain Names in Applications
+                (IDNA): Protocol";
+  }
+
+  typedef host {
+    type union {
+      type inet:ip-address;
+      type inet:domain-name;
+    }
+    description
+     "The host type represents either an IP address or a DNS
+      domain name.";
+  }
+
+  typedef uri {
+    type string;
+    description
+     "The uri type represents a Uniform Resource Identifier
+      (URI) as defined by STD 66.
+
+      Objects using the uri type MUST be in US-ASCII encoding,
+      and MUST be normalized as described by RFC 3986 Sections
+      6.2.1, 6.2.2.1, and 6.2.2.2.  All unnecessary
+      percent-encoding is removed, and all case-insensitive
+      characters are set to lowercase except for hexadecimal
+      digits, which are normalized to uppercase as described in
+      Section 6.2.2.1.
+
+      The purpose of this normalization is to help provide
+      unique URIs.  Note that this normalization is not
+      sufficient to provide uniqueness.  Two URIs that are
+      textually distinct after this normalization may still be
+      equivalent.
+
+      Objects using the uri type may restrict the schemes that
+      they permit.  For example, 'data:' and 'urn:' schemes
+      might not be appropriate.
+
+      A zero-length URI is not a valid URI.  This can be used to
+      express 'URI absent' where required.
+
+      In the value set and its semantics, this type is equivalent
+      to the Uri SMIv2 textual convention defined in RFC 5017.";
+    reference
+     "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
+      RFC 3305: Report from the Joint W3C/IETF URI Planning Interest
+                Group: Uniform Resource Identifiers (URIs), URLs,
+                and Uniform Resource Names (URNs): Clarifications
+                and Recommendations
+      RFC 5017: MIB Textual Conventions for Uniform Resource
+                Identifiers (URIs)";
+  }
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/resources/schema/common/netconf-cli-ext.yang b/opendaylight/netconf/netconf-cli/src/main/resources/schema/common/netconf-cli-ext.yang
new file mode 100644 (file)
index 0000000..139778a
--- /dev/null
@@ -0,0 +1,18 @@
+module netconf-cli-ext {
+
+  namespace "urn:ietf:params:xml:ns:netconf:base:1.0:cli";
+
+  prefix cliext;
+
+    revision 2014-05-26 {
+      description
+        "Initial revision";
+    }
+
+  extension argument-handler {
+    description
+        "Links custom argument reader to an input argument";
+    argument "name";
+  }
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/resources/schema/local/netconf-cli.yang b/opendaylight/netconf/netconf-cli/src/main/resources/schema/local/netconf-cli.yang
new file mode 100644 (file)
index 0000000..52f7b97
--- /dev/null
@@ -0,0 +1,97 @@
+module netconf-cli {
+
+  namespace "netconf:cli";
+  prefix ncli;
+
+  import ietf-inet-types { prefix inet; revision-date 2010-09-24; }
+  import netconf-cli-ext { prefix cliext; revision-date 2014-05-26; }
+
+
+    revision 2014-05-22 {
+      description
+       "Initial revision.";
+    }
+
+  extension java-class {
+      description
+          "This could be used to link between rpc yang definition and custom command implementation";
+
+      argument "name";
+  }
+
+  rpc help {
+    description
+        "Display help";
+
+    output {
+      list commands {
+
+        key "id";
+        leaf id {
+            type string;
+        }
+        leaf description {
+            type string;
+        }
+      }
+    }
+  }
+
+  rpc close {
+      description
+          "Close the whole cli";
+  }
+
+  rpc connect {
+
+        description
+            "Connect to a remote netconf device, if not connected yet. Connection initialization is blocking and might take some time, depending on amount of yang schemas in remote device.";
+
+      input {
+
+         // TODO yangtools keep input arguments unordered so the ordering in cli is random
+         leaf address-name {
+           type inet:host;
+           default localhost;
+         }
+
+         leaf address-port {
+           type inet:port-number;
+           default 830;
+         }
+
+          leaf user-name {
+           type string;
+         }
+
+        leaf user-password {
+            cliext:argument-handler org.opendaylight.controller.netconf.cli.reader.custom.PasswordReader;
+            type string;
+        }
+      }
+
+      output {
+        leaf status {
+            type string;
+        }
+
+        leaf-list remote-commands {
+            type string;
+        }
+      }
+  }
+
+
+  rpc disconnect {
+
+      description
+          "Disconnect from a netconf device that is currently connected";
+
+      output {
+        leaf status {
+            type string;
+        }
+      }
+    }
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/main/resources/schema/remote/ietf-netconf.yang b/opendaylight/netconf/netconf-cli/src/main/resources/schema/remote/ietf-netconf.yang
new file mode 100644 (file)
index 0000000..d41c2e3
--- /dev/null
@@ -0,0 +1,943 @@
+module ietf-netconf {
+
+  // the namespace for NETCONF XML definitions is unchanged
+  // from RFC 4741, which this document replaces
+  namespace "urn:ietf:params:xml:ns:netconf:base:1.0";
+
+  prefix nc;
+
+  import ietf-inet-types {
+    prefix inet;
+  }
+
+  import netconf-cli-ext { prefix cliext; revision-date 2014-05-26; }
+
+
+  organization
+    "IETF NETCONF (Network Configuration) Working Group";
+
+  contact
+    "WG Web:   <http://tools.ietf.org/wg/netconf/>
+     WG List:  <netconf@ietf.org>
+
+     WG Chair: Bert Wijnen
+               <bertietf@bwijnen.net>
+
+     WG Chair: Mehmet Ersue
+               <mehmet.ersue@nsn.com>
+
+     Editor:   Martin Bjorklund
+               <mbj@tail-f.com>
+
+     Editor:   Juergen Schoenwaelder
+               <j.schoenwaelder@jacobs-university.de>
+
+     Editor:   Andy Bierman
+               <andy.bierman@brocade.com>";
+  description
+    "NETCONF Protocol Data Types and Protocol Operations.
+
+     Copyright (c) 2011 IETF Trust and the persons identified as
+     the document authors.  All rights reserved.
+
+     Redistribution and use in source and binary forms, with or
+     without modification, is permitted pursuant to, and subject
+     to the license terms contained in, the Simplified BSD License
+     set forth in Section 4.c of the IETF Trust's Legal Provisions
+     Relating to IETF Documents
+     (http://trustee.ietf.org/license-info).
+
+     This version of this YANG module is part of RFC 6241; see
+     the RFC itself for full legal notices.";
+  revision 2011-06-01 {
+    description
+      "Initial revision";
+    reference
+      "RFC 6241: Network Configuration Protocol";
+  }
+
+  extension get-filter-element-attributes {
+    description
+      "If this extension is present within an 'anyxml'
+       statement named 'filter', which must be conceptually
+       defined within the RPC input section for the <get>
+       and <get-config> protocol operations, then the
+       following unqualified XML attribute is supported
+       within the <filter> element, within a <get> or
+       <get-config> protocol operation:
+
+         type : optional attribute with allowed
+                value strings 'subtree' and 'xpath'.
+                If missing, the default value is 'subtree'.
+
+       If the 'xpath' feature is supported, then the
+       following unqualified XML attribute is
+       also supported:
+
+         select: optional attribute containing a
+                 string representing an XPath expression.
+                 The 'type' attribute must be equal to 'xpath'
+                 if this attribute is present.";
+  }
+
+  // NETCONF capabilities defined as features
+  feature writable-running {
+    description
+      "NETCONF :writable-running capability;
+       If the server advertises the :writable-running
+       capability for a session, then this feature must
+       also be enabled for that session.  Otherwise,
+       this feature must not be enabled.";
+    reference "RFC 6241, Section 8.2";
+  }
+
+  feature candidate {
+    description
+      "NETCONF :candidate capability;
+       If the server advertises the :candidate
+       capability for a session, then this feature must
+       also be enabled for that session.  Otherwise,
+       this feature must not be enabled.";
+    reference "RFC 6241, Section 8.3";
+  }
+
+  feature confirmed-commit {
+    if-feature candidate;
+    description
+      "NETCONF :confirmed-commit:1.1 capability;
+       If the server advertises the :confirmed-commit:1.1
+       capability for a session, then this feature must
+       also be enabled for that session.  Otherwise,
+       this feature must not be enabled.";
+
+    reference "RFC 6241, Section 8.4";
+  }
+
+  feature rollback-on-error {
+    description
+      "NETCONF :rollback-on-error capability;
+       If the server advertises the :rollback-on-error
+       capability for a session, then this feature must
+       also be enabled for that session.  Otherwise,
+       this feature must not be enabled.";
+    reference "RFC 6241, Section 8.5";
+  }
+
+  feature validate {
+    description
+      "NETCONF :validate:1.1 capability;
+       If the server advertises the :validate:1.1
+       capability for a session, then this feature must
+       also be enabled for that session.  Otherwise,
+       this feature must not be enabled.";
+    reference "RFC 6241, Section 8.6";
+  }
+
+  feature startup {
+    description
+      "NETCONF :startup capability;
+       If the server advertises the :startup
+       capability for a session, then this feature must
+       also be enabled for that session.  Otherwise,
+       this feature must not be enabled.";
+    reference "RFC 6241, Section 8.7";
+  }
+
+  feature url {
+    description
+      "NETCONF :url capability;
+       If the server advertises the :url
+       capability for a session, then this feature must
+       also be enabled for that session.  Otherwise,
+       this feature must not be enabled.";
+    reference "RFC 6241, Section 8.8";
+  }
+
+  feature xpath {
+    description
+      "NETCONF :xpath capability;
+       If the server advertises the :xpath
+       capability for a session, then this feature must
+       also be enabled for that session.  Otherwise,
+       this feature must not be enabled.";
+    reference "RFC 6241, Section 8.9";
+  }
+
+  // NETCONF Simple Types
+
+  typedef session-id-type {
+    type uint32 {
+      range "1..max";
+    }
+    description
+      "NETCONF Session Id";
+  }
+
+  typedef session-id-or-zero-type {
+    type uint32;
+    description
+      "NETCONF Session Id or Zero to indicate none";
+  }
+  typedef error-tag-type {
+    type enumeration {
+       enum in-use {
+         description
+           "The request requires a resource that
+            already is in use.";
+       }
+       enum invalid-value {
+         description
+           "The request specifies an unacceptable value for one
+            or more parameters.";
+       }
+       enum too-big {
+         description
+           "The request or response (that would be generated) is
+            too large for the implementation to handle.";
+       }
+       enum missing-attribute {
+         description
+           "An expected attribute is missing.";
+       }
+       enum bad-attribute {
+         description
+           "An attribute value is not correct; e.g., wrong type,
+            out of range, pattern mismatch.";
+       }
+       enum unknown-attribute {
+         description
+           "An unexpected attribute is present.";
+       }
+       enum missing-element {
+         description
+           "An expected element is missing.";
+       }
+       enum bad-element {
+         description
+           "An element value is not correct; e.g., wrong type,
+            out of range, pattern mismatch.";
+       }
+       enum unknown-element {
+         description
+           "An unexpected element is present.";
+       }
+       enum unknown-namespace {
+         description
+           "An unexpected namespace is present.";
+       }
+       enum access-denied {
+         description
+           "Access to the requested protocol operation or
+            data model is denied because authorization failed.";
+       }
+       enum lock-denied {
+         description
+           "Access to the requested lock is denied because the
+            lock is currently held by another entity.";
+       }
+       enum resource-denied {
+         description
+           "Request could not be completed because of
+            insufficient resources.";
+       }
+       enum rollback-failed {
+         description
+           "Request to roll back some configuration change (via
+            rollback-on-error or <discard-changes> operations)
+            was not completed for some reason.";
+
+       }
+       enum data-exists {
+         description
+           "Request could not be completed because the relevant
+            data model content already exists.  For example,
+            a 'create' operation was attempted on data that
+            already exists.";
+       }
+       enum data-missing {
+         description
+           "Request could not be completed because the relevant
+            data model content does not exist.  For example,
+            a 'delete' operation was attempted on
+            data that does not exist.";
+       }
+       enum operation-not-supported {
+         description
+           "Request could not be completed because the requested
+            operation is not supported by this implementation.";
+       }
+       enum operation-failed {
+         description
+           "Request could not be completed because the requested
+            operation failed for some reason not covered by
+            any other error condition.";
+       }
+       enum partial-operation {
+         description
+           "This error-tag is obsolete, and SHOULD NOT be sent
+            by servers conforming to this document.";
+       }
+       enum malformed-message {
+         description
+           "A message could not be handled because it failed to
+            be parsed correctly.  For example, the message is not
+            well-formed XML or it uses an invalid character set.";
+       }
+     }
+     description "NETCONF Error Tag";
+     reference "RFC 6241, Appendix A";
+  }
+
+  typedef error-severity-type {
+    type enumeration {
+      enum error {
+        description "Error severity";
+      }
+      enum warning {
+        description "Warning severity";
+      }
+    }
+    description "NETCONF Error Severity";
+    reference "RFC 6241, Section 4.3";
+  }
+
+  typedef edit-operation-type {
+    type enumeration {
+      enum merge {
+        description
+          "The configuration data identified by the
+           element containing this attribute is merged
+           with the configuration at the corresponding
+           level in the configuration datastore identified
+           by the target parameter.";
+      }
+      enum replace {
+        description
+          "The configuration data identified by the element
+           containing this attribute replaces any related
+           configuration in the configuration datastore
+           identified by the target parameter.  If no such
+           configuration data exists in the configuration
+           datastore, it is created.  Unlike a
+           <copy-config> operation, which replaces the
+           entire target configuration, only the configuration
+           actually present in the config parameter is affected.";
+      }
+      enum create {
+        description
+          "The configuration data identified by the element
+           containing this attribute is added to the
+           configuration if and only if the configuration
+           data does not already exist in the configuration
+           datastore.  If the configuration data exists, an
+           <rpc-error> element is returned with an
+           <error-tag> value of 'data-exists'.";
+      }
+      enum delete {
+        description
+          "The configuration data identified by the element
+           containing this attribute is deleted from the
+           configuration if and only if the configuration
+           data currently exists in the configuration
+           datastore.  If the configuration data does not
+           exist, an <rpc-error> element is returned with
+           an <error-tag> value of 'data-missing'.";
+      }
+      enum remove {
+        description
+          "The configuration data identified by the element
+           containing this attribute is deleted from the
+           configuration if the configuration
+           data currently exists in the configuration
+           datastore.  If the configuration data does not
+           exist, the 'remove' operation is silently ignored
+           by the server.";
+      }
+    }
+    default "merge";
+    description "NETCONF 'operation' attribute values";
+    reference "RFC 6241, Section 7.2";
+  }
+
+  // NETCONF Standard Protocol Operations
+
+  rpc get-config {
+    description
+      "Retrieve all or part of a specified configuration.";
+
+    reference "RFC 6241, Section 7.1";
+
+    input {
+      container source {
+        description
+          "Particular configuration to retrieve.";
+
+        choice config-source {
+          mandatory true;
+          description
+            "The configuration to retrieve.";
+          leaf candidate {
+            if-feature candidate;
+            type empty;
+            description
+              "The candidate configuration is the config source.";
+          }
+          leaf running {
+            type empty;
+            description
+              "The running configuration is the config source.";
+          }
+          leaf startup {
+            if-feature startup;
+            type empty;
+            description
+              "The startup configuration is the config source.
+               This is optional-to-implement on the server because
+               not all servers will support filtering for this
+               datastore.";
+          }
+        }
+      }
+
+      anyxml filter {
+        description
+          "Subtree or XPath filter to use.";
+        nc:get-filter-element-attributes;
+        // TODO this extension should be augmented (anyxml nodes cannot be augmented)
+        // or we can identify custom input/output arguments by schemaPath defined for custom handlers
+        cliext:argument-handler org.opendaylight.controller.netconf.cli.reader.custom.FilterReader;
+      }
+    }
+
+    output {
+      anyxml data {
+        description
+          "Copy of the source datastore subset that matched
+           the filter criteria (if any).  An empty data container
+           indicates that the request did not produce any results.";
+       cliext:argument-handler org.opendaylight.controller.netconf.cli.writer.custom.DataWriter;
+     }
+    }
+  }
+
+  rpc edit-config {
+    description
+      "The <edit-config> operation loads all or part of a specified
+       configuration to the specified target configuration.";
+
+    reference "RFC 6241, Section 7.2";
+
+    input {
+      container target {
+        description
+          "Particular configuration to edit.";
+
+        choice config-target {
+          mandatory true;
+          description
+            "The configuration target.";
+
+          leaf candidate {
+            if-feature candidate;
+            type empty;
+            description
+              "The candidate configuration is the config target.";
+          }
+          leaf running {
+            if-feature writable-running;
+            type empty;
+            description
+              "The running configuration is the config source.";
+          }
+        }
+      }
+
+      leaf default-operation {
+        type enumeration {
+          enum merge {
+            description
+              "The default operation is merge.";
+          }
+          enum replace {
+            description
+              "The default operation is replace.";
+          }
+          enum none {
+            description
+              "There is no default operation.";
+          }
+        }
+        default "merge";
+        description
+          "The default operation to use.";
+      }
+
+      leaf test-option {
+        if-feature validate;
+        type enumeration {
+          enum test-then-set {
+            description
+              "The server will test and then set if no errors.";
+          }
+          enum set {
+            description
+              "The server will set without a test first.";
+          }
+
+          enum test-only {
+            description
+              "The server will only test and not set, even
+               if there are no errors.";
+          }
+        }
+        default "test-then-set";
+        description
+          "The test option to use.";
+      }
+
+      leaf error-option {
+        type enumeration {
+          enum stop-on-error {
+            description
+              "The server will stop on errors.";
+          }
+          enum continue-on-error {
+            description
+              "The server may continue on errors.";
+          }
+          enum rollback-on-error {
+            description
+              "The server will roll back on errors.
+               This value can only be used if the 'rollback-on-error'
+               feature is supported.";
+          }
+        }
+        default "stop-on-error";
+        description
+          "The error option to use.";
+      }
+
+      choice edit-content {
+        mandatory true;
+        description
+          "The content for the edit operation.";
+
+        cliext:argument-handler org.opendaylight.controller.netconf.cli.reader.custom.EditContentReader;
+
+        anyxml config {
+          description
+            "Inline Config content.";
+          cliext:argument-handler org.opendaylight.controller.netconf.cli.reader.custom.ConfigReader;
+        }
+
+        leaf url {
+          if-feature url;
+          type inet:uri;
+          description
+            "URL-based config content.";
+        }
+      }
+    }
+  }
+
+  rpc copy-config {
+    description
+      "Create or replace an entire configuration datastore with the
+       contents of another complete configuration datastore.";
+
+    reference "RFC 6241, Section 7.3";
+
+    input {
+      container target {
+        description
+          "Particular configuration to copy to.";
+
+        choice config-target {
+          mandatory true;
+          description
+            "The configuration target of the copy operation.";
+
+          leaf candidate {
+            if-feature candidate;
+            type empty;
+            description
+              "The candidate configuration is the config target.";
+          }
+          leaf running {
+            if-feature writable-running;
+            type empty;
+            description
+              "The running configuration is the config target.
+               This is optional-to-implement on the server.";
+          }
+          leaf startup {
+            if-feature startup;
+            type empty;
+            description
+              "The startup configuration is the config target.";
+          }
+          leaf url {
+            if-feature url;
+            type inet:uri;
+            description
+              "The URL-based configuration is the config target.";
+          }
+        }
+      }
+
+      container source {
+        description
+          "Particular configuration to copy from.";
+
+        choice config-source {
+          mandatory true;
+          description
+            "The configuration source for the copy operation.";
+
+          leaf candidate {
+            if-feature candidate;
+            type empty;
+            description
+              "The candidate configuration is the config source.";
+          }
+          leaf running {
+            type empty;
+            description
+              "The running configuration is the config source.";
+          }
+          leaf startup {
+            if-feature startup;
+            type empty;
+            description
+              "The startup configuration is the config source.";
+          }
+          leaf url {
+            if-feature url;
+            type inet:uri;
+            description
+              "The URL-based configuration is the config source.";
+          }
+          anyxml config {
+            description
+              "Inline Config content: <config> element.  Represents
+               an entire configuration datastore, not
+               a subset of the running datastore.";
+          }
+        }
+      }
+    }
+  }
+
+  rpc delete-config {
+    description
+      "Delete a configuration datastore.";
+
+    reference "RFC 6241, Section 7.4";
+
+    input {
+      container target {
+        description
+          "Particular configuration to delete.";
+
+        choice config-target {
+          mandatory true;
+          description
+            "The configuration target to delete.";
+
+          leaf startup {
+            if-feature startup;
+            type empty;
+            description
+              "The startup configuration is the config target.";
+          }
+          leaf url {
+            if-feature url;
+            type inet:uri;
+            description
+              "The URL-based configuration is the config target.";
+          }
+        }
+      }
+    }
+  }
+
+  rpc lock {
+    description
+      "The lock operation allows the client to lock the configuration
+       system of a device.";
+
+    reference "RFC 6241, Section 7.5";
+
+    input {
+      container target {
+        description
+          "Particular configuration to lock.";
+
+        choice config-target {
+          mandatory true;
+          description
+            "The configuration target to lock.";
+
+          leaf candidate {
+            if-feature candidate;
+            type empty;
+            description
+              "The candidate configuration is the config target.";
+          }
+          leaf running {
+            type empty;
+            description
+              "The running configuration is the config target.";
+          }
+          leaf startup {
+            if-feature startup;
+            type empty;
+            description
+              "The startup configuration is the config target.";
+          }
+        }
+      }
+    }
+  }
+
+  rpc unlock {
+    description
+      "The unlock operation is used to release a configuration lock,
+       previously obtained with the 'lock' operation.";
+
+    reference "RFC 6241, Section 7.6";
+
+    input {
+      container target {
+        description
+          "Particular configuration to unlock.";
+
+        choice config-target {
+          mandatory true;
+          description
+            "The configuration target to unlock.";
+
+          leaf candidate {
+            if-feature candidate;
+            type empty;
+            description
+              "The candidate configuration is the config target.";
+          }
+          leaf running {
+            type empty;
+            description
+              "The running configuration is the config target.";
+          }
+          leaf startup {
+            if-feature startup;
+            type empty;
+            description
+              "The startup configuration is the config target.";
+          }
+        }
+      }
+    }
+  }
+
+  rpc get {
+    description
+      "Retrieve running configuration and device state information.";
+
+    reference "RFC 6241, Section 7.7";
+
+    input {
+      anyxml filter {
+        description
+          "This parameter specifies the portion of the system
+           configuration and state data to retrieve.";
+        nc:get-filter-element-attributes;
+        // TODO this extension should be augmented (anyxml nodes cannot be augmented)
+        cliext:argument-handler org.opendaylight.controller.netconf.cli.reader.custom.FilterReader;
+      }
+    }
+
+    output {
+      anyxml data {
+        description
+          "Copy of the running datastore subset and/or state
+           data that matched the filter criteria (if any).
+           An empty data container indicates that the request did not
+           produce any results.";
+
+       cliext:argument-handler org.opendaylight.controller.netconf.cli.writer.custom.DataWriter;
+
+      }
+    }
+  }
+
+  rpc close-session {
+    description
+      "Request graceful termination of a NETCONF session.";
+
+    reference "RFC 6241, Section 7.8";
+  }
+
+  rpc kill-session {
+    description
+      "Force the termination of a NETCONF session.";
+
+    reference "RFC 6241, Section 7.9";
+
+    input {
+      leaf session-id {
+        type session-id-type;
+        mandatory true;
+        description
+          "Particular session to kill.";
+      }
+    }
+  }
+
+  rpc commit {
+    if-feature candidate;
+
+    description
+      "Commit the candidate configuration as the device's new
+       current configuration.";
+
+    reference "RFC 6241, Section 8.3.4.1";
+
+    input {
+      leaf confirmed {
+        if-feature confirmed-commit;
+        type empty;
+        description
+          "Requests a confirmed commit.";
+        reference "RFC 6241, Section 8.3.4.1";
+      }
+
+      leaf confirm-timeout {
+        if-feature confirmed-commit;
+        type uint32 {
+          range "1..max";
+        }
+        units "seconds";
+        default "600";   // 10 minutes
+        description
+          "The timeout interval for a confirmed commit.";
+        reference "RFC 6241, Section 8.3.4.1";
+      }
+
+      leaf persist {
+        if-feature confirmed-commit;
+        type string;
+        description
+          "This parameter is used to make a confirmed commit
+           persistent.  A persistent confirmed commit is not aborted
+           if the NETCONF session terminates.  The only way to abort
+           a persistent confirmed commit is to let the timer expire,
+           or to use the <cancel-commit> operation.
+
+           The value of this parameter is a token that must be given
+           in the 'persist-id' parameter of <commit> or
+           <cancel-commit> operations in order to confirm or cancel
+           the persistent confirmed commit.
+
+           The token should be a random string.";
+        reference "RFC 6241, Section 8.3.4.1";
+      }
+
+      leaf persist-id {
+        if-feature confirmed-commit;
+        type string;
+        description
+          "This parameter is given in order to commit a persistent
+           confirmed commit.  The value must be equal to the value
+           given in the 'persist' parameter to the <commit> operation.
+           If it does not match, the operation fails with an
+          'invalid-value' error.";
+        reference "RFC 6241, Section 8.3.4.1";
+      }
+
+    }
+  }
+
+  rpc discard-changes {
+    if-feature candidate;
+
+    description
+      "Revert the candidate configuration to the current
+       running configuration.";
+    reference "RFC 6241, Section 8.3.4.2";
+  }
+
+  rpc cancel-commit {
+    if-feature confirmed-commit;
+    description
+      "This operation is used to cancel an ongoing confirmed commit.
+       If the confirmed commit is persistent, the parameter
+       'persist-id' must be given, and it must match the value of the
+       'persist' parameter.";
+    reference "RFC 6241, Section 8.4.4.1";
+
+    input {
+      leaf persist-id {
+        type string;
+        description
+          "This parameter is given in order to cancel a persistent
+           confirmed commit.  The value must be equal to the value
+           given in the 'persist' parameter to the <commit> operation.
+           If it does not match, the operation fails with an
+          'invalid-value' error.";
+      }
+    }
+  }
+
+  rpc validate {
+    if-feature validate;
+
+    description
+      "Validates the contents of the specified configuration.";
+
+    reference "RFC 6241, Section 8.6.4.1";
+
+    input {
+      container source {
+        description
+          "Particular configuration to validate.";
+
+        choice config-source {
+          mandatory true;
+          description
+            "The configuration source to validate.";
+
+          leaf candidate {
+            if-feature candidate;
+            type empty;
+            description
+              "The candidate configuration is the config source.";
+          }
+          leaf running {
+            type empty;
+            description
+              "The running configuration is the config source.";
+          }
+          leaf startup {
+            if-feature startup;
+            type empty;
+            description
+              "The startup configuration is the config source.";
+          }
+          leaf url {
+            if-feature url;
+            type inet:uri;
+            description
+              "The URL-based configuration is the config source.";
+          }
+          anyxml config {
+            description
+              "Inline Config content: <config> element.  Represents
+               an entire configuration datastore, not
+               a subset of the running datastore.";
+          }
+        }
+      }
+    }
+  }
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/test/java/org/opendaylight/controller/netconf/cli/ConsoleIOTestImpl.java b/opendaylight/netconf/netconf-cli/src/test/java/org/opendaylight/controller/netconf/cli/ConsoleIOTestImpl.java
new file mode 100644 (file)
index 0000000..29d7abd
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * 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.netconf.cli;
+
+import java.io.IOException;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.opendaylight.controller.netconf.cli.io.ConsoleIOImpl;
+
+public class ConsoleIOTestImpl extends ConsoleIOImpl {
+
+    Map<String, Deque<String>> inputValues = new HashMap<>();
+    String lastMessage;
+    private final List<ValueForMessage> valuesForMessages;
+
+    public ConsoleIOTestImpl(final Map<String, Deque<String>> inputValues, final List<ValueForMessage> valuesForMessages)
+            throws IOException {
+        super();
+        this.inputValues = inputValues;
+        this.valuesForMessages = valuesForMessages;
+    }
+
+    StringBuilder output = new StringBuilder();
+
+    @Override
+    public String read() throws IOException {
+        final String prompt = buildPrompt();
+        output.append(prompt);
+        System.out.print(prompt);
+
+        String value = inputValues.get(prompt).pollFirst();
+        if (value == null) {
+            value = getValueForLastMessage();
+        }
+
+        value = value != null ? value : "****NO VALUE****";
+
+        output.append(value + "\n");
+        System.out.print(value + "\n");
+        return value;
+    }
+
+    private String getValueForLastMessage() {
+        for (final ValueForMessage valueForMessage : valuesForMessages) {
+            if (containsLastMessageKeyWords(valueForMessage.getKeyWords())) {
+                return valueForMessage.getValue();
+            }
+        }
+        return null;
+    }
+
+    private boolean containsLastMessageKeyWords(final List<String> keyWords) {
+        for (final String keyWord : keyWords) {
+            if (!lastMessage.contains(keyWord)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public void write(final CharSequence data) throws IOException {
+        output.append(data);
+        lastMessage = (String) data;
+        System.out.print(data);
+    }
+
+    @Override
+    public void writeLn(final CharSequence data) throws IOException {
+        write(data);
+        output.append("\n");
+        System.out.print("\n");
+    }
+
+    public String getConsoleOutput() {
+        return output.toString();
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/test/java/org/opendaylight/controller/netconf/cli/NetconfCliTest.java b/opendaylight/netconf/netconf-cli/src/test/java/org/opendaylight/controller/netconf/cli/NetconfCliTest.java
new file mode 100644 (file)
index 0000000..7d85aa4
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ * 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.netconf.cli;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.opendaylight.controller.netconf.cli.io.IOUtil.PROMPT_SUFIX;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.opendaylight.controller.netconf.cli.reader.ReadingException;
+import org.opendaylight.controller.netconf.cli.reader.impl.GenericReader;
+import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
+import org.opendaylight.controller.netconf.cli.writer.WriteException;
+import org.opendaylight.controller.netconf.cli.writer.impl.NormalizedNodeWriter;
+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.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
+import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+
+@Ignore
+public class NetconfCliTest {
+
+    private final static YangContextParser parser = new YangParserImpl();
+
+    private static SchemaContext loadSchemaContext(final String resourceDirectory) throws IOException,
+            URISyntaxException {
+        final URI uri = NetconfCliTest.class.getResource(resourceDirectory).toURI();
+        final File testDir = new File(uri);
+        final String[] fileList = testDir.list();
+        final List<File> testFiles = new ArrayList<File>();
+        if (fileList == null) {
+            throw new FileNotFoundException(resourceDirectory);
+        }
+        for (final String fileName : fileList) {
+            if (new File(testDir, fileName).isDirectory() == false) {
+                testFiles.add(new File(testDir, fileName));
+            }
+        }
+        return parser.parseFiles(testFiles);
+    }
+
+    // @Ignore
+    @Test
+    public void cliTest() throws ReadingException, IOException, WriteException, URISyntaxException {
+
+        final SchemaContext schemaContext = loadSchemaContext("/schema-context");
+        assertNotNull(schemaContext);
+
+        final DataSchemaNode cont1 = findTopLevelElement("ns:model1", "2014-05-14", "cont1", schemaContext);
+        final Map<String, Deque<String>> values = new HashMap<>();
+
+        values.put(prompt("/cont1/cont11/lst111/[entry]/lf1111"), value("55", "32"));
+        values.put(prompt("/cont1/cont11/lst111/[entry]"), value("Y", "Y"));
+        values.put(prompt("/cont1/cont11/lst111/[entry]/cont111/lf1112"),
+                value("value for lf1112", "2value for lf1112"));
+        values.put(prompt("/cont1/cont11/lst111/[entry]/cont111/lflst1111"), value("Y", "N", "Y", "N"));
+        values.put(prompt("/cont1/cont11/lst111/[entry]/cont111/lflst1111/[entry]"), value("10", "15", "20", "30"));
+
+        values.put(prompt("/cont1/cont11/lst111"), value("Y", "N"));
+
+        values.put(prompt("/cont1/cont12/chcA"), value("AB"));
+        values.put(prompt("/cont1/cont12/chcA/cont12AB1/lf12AB1"), value("value for lf12AB1"));
+
+        values.put(prompt("/cont1/cont12/lst121/[entry]/lf1211"), value("value for lf12112", "2value for lf12112"));
+        values.put(prompt("/cont1/cont12/lst121/[entry]"), value("Y", "Y"));
+        values.put(prompt("/cont1/cont12/lst121/[entry]/lst1211"), value("Y", "N", "Y", "N"));
+        values.put(prompt("/cont1/cont12/lst121/[entry]/lst1211/[entry]"), value("Y", "Y", "Y", "Y"));
+        values.put(prompt("/cont1/cont12/lst121/[entry]/lst1211/[entry]/lf12111"), value("5", "10", "21", "50"));
+        values.put(prompt("/cont1/cont12/lst121/[entry]/lst1211/[entry]/lf12112"),
+                value("value for lf12112", "2value for lf12112", "3value for lf12112", "4value for lf12112"));
+
+        values.put(prompt("/cont1/cont12/lst121"), value("Y", "N"));
+
+        values.put(prompt("/cont1/cont12/lst122"), value("Y", "N"));
+
+        values.put(prompt("/cont1/lst11"), value("Y", "Y", "N"));
+        values.put(prompt("/cont1/lst11/[entry]"), value("Y", "Y", "Y"));
+        values.put(prompt("/cont1/lst11/[entry]/lf111"),
+                value("1value for lf111", "2value for lf111", "3value for lf111"));
+
+        values.put(prompt("/cont1/cont12/data"), value("<el1><el11>value</el11><el12>value1</el12></el1>"));
+
+        final List<ValueForMessage> valuesForMessages = new ArrayList<>();
+        valuesForMessages.add(new ValueForMessage("Y", "lst111", "[Y|N]"));
+        valuesForMessages.add(new ValueForMessage("Y", "lst121", "[Y|N]"));
+        valuesForMessages.add(new ValueForMessage("Y", "lst11", "[Y|N]"));
+
+        final ConsoleIOTestImpl console = new ConsoleIOTestImpl(values, valuesForMessages);
+
+        final List<Node<?>> redData = new GenericReader(console, new CommandArgHandlerRegistry(console,
+                new SchemaContextRegistry(schemaContext)), schemaContext).read(cont1);
+        assertNotNull(redData);
+       assertEquals(1, redData.size());
+
+        assertTrue(redData.get(0) instanceof CompositeNode);
+        final CompositeNode redTopLevelNode = (CompositeNode) redData.get(0);
+
+        System.out.println("============================");
+        new NormalizedNodeWriter(console, new OutFormatter()).write(cont1, redData);
+
+    }
+
+    private Deque<String> value(final String... values) {
+        return new ArrayDeque<>(Arrays.asList(values));
+    }
+
+    private String prompt(final String path) {
+        return "/localhost" + path + PROMPT_SUFIX;
+    }
+
+    private DataSchemaNode findTopLevelElement(final String namespace, final String revision,
+            final String topLevelElement, final SchemaContext schemaContext) {
+        final QName requiredElement = QName.create(namespace, revision, topLevelElement);
+        for (final DataSchemaNode dataSchemaNode : schemaContext.getChildNodes()) {
+            if (dataSchemaNode.getQName().equals(requiredElement)) {
+                return dataSchemaNode;
+            }
+        }
+        return null;
+
+    }
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/test/java/org/opendaylight/controller/netconf/cli/ValueForMessages.java b/opendaylight/netconf/netconf-cli/src/test/java/org/opendaylight/controller/netconf/cli/ValueForMessages.java
new file mode 100644 (file)
index 0000000..2532b36
--- /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.netconf.cli;
+
+import java.util.Arrays;
+import java.util.List;
+
+class ValueForMessage {
+    List<String> messageKeyWords;
+    String value;
+
+    public ValueForMessage(final String value, final String... messageKeyWords) {
+        this.messageKeyWords = Arrays.asList(messageKeyWords);
+        this.value = value;
+    }
+
+    public List<String> getKeyWords() {
+        return messageKeyWords;
+    }
+
+    public String getValue() {
+        return value;
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/test/java/org/opendaylight/controller/netconf/cli/io/IOUtilTest.java b/opendaylight/netconf/netconf-cli/src/test/java/org/opendaylight/controller/netconf/cli/io/IOUtilTest.java
new file mode 100644 (file)
index 0000000..2021bf7
--- /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.netconf.cli.io;
+
+import com.google.common.collect.Maps;
+import java.util.Map;
+import junit.framework.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.netconf.cli.commands.CommandConstants;
+import org.opendaylight.yangtools.yang.common.QName;
+
+public class IOUtilTest {
+
+    @Test
+    public void testQNameFromKeyStringNew() throws Exception {
+        final String s = IOUtil.qNameToKeyString(CommandConstants.HELP_QNAME, "module");
+        final Map<String, QName> modulesMap = Maps.newHashMap();
+        modulesMap.put("module", new QName(CommandConstants.HELP_QNAME, "module"));
+        final QName qName = IOUtil.qNameFromKeyString(s, modulesMap);
+        Assert.assertEquals(CommandConstants.HELP_QNAME, qName);
+    }
+}
diff --git a/opendaylight/netconf/netconf-cli/src/test/resources/schema-context/ietf-inet-types.yang b/opendaylight/netconf/netconf-cli/src/test/resources/schema-context/ietf-inet-types.yang
new file mode 100644 (file)
index 0000000..de20feb
--- /dev/null
@@ -0,0 +1,418 @@
+ module ietf-inet-types {
+
+   namespace "urn:ietf:params:xml:ns:yang:ietf-inet-types";
+   prefix "inet";
+
+   organization
+    "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+   contact
+    "WG Web:   <http://tools.ietf.org/wg/netmod/>
+     WG List:  <mailto:netmod@ietf.org>
+
+     WG Chair: David Partain
+               <mailto:david.partain@ericsson.com>
+
+     WG Chair: David Kessens
+               <mailto:david.kessens@nsn.com>
+
+     Editor:   Juergen Schoenwaelder
+               <mailto:j.schoenwaelder@jacobs-university.de>";
+
+   description
+    "This module contains a collection of generally useful derived
+     YANG data types for Internet addresses and related things.
+
+     Copyright (c) 2010 IETF Trust and the persons identified as
+     authors of the code.  All rights reserved.
+
+     Redistribution and use in source and binary forms, with or without
+     modification, is permitted pursuant to, and subject to the license
+     terms contained in, the Simplified BSD License set forth in Section
+     4.c of the IETF Trust's Legal Provisions Relating to IETF Documents
+     (http://trustee.ietf.org/license-info).
+
+     This version of this YANG module is part of RFC 6021; see
+     the RFC itself for full legal notices.";
+
+   revision 2010-09-24 {
+     description
+      "Initial revision.";
+     reference
+      "RFC 6021: Common YANG Data Types";
+   }
+
+   /*** collection of protocol field related types ***/
+
+   typedef ip-version {
+     type enumeration {
+       enum unknown {
+         value "0";
+         description
+          "An unknown or unspecified version of the Internet protocol.";
+       }
+       enum ipv4 {
+         value "1";
+         description
+          "The IPv4 protocol as defined in RFC 791.";
+       }
+       enum ipv6 {
+         value "2";
+         description
+          "The IPv6 protocol as defined in RFC 2460.";
+       }
+     }
+     description
+      "This value represents the version of the IP protocol.
+
+       In the value set and its semantics, this type is equivalent
+       to the InetVersion textual convention of the SMIv2.";
+     reference
+      "RFC  791: Internet Protocol
+       RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
+       RFC 4001: Textual Conventions for Internet Network Addresses";
+   }
+
+   typedef dscp {
+     type uint8 {
+       range "0..63";
+     }
+     description
+      "The dscp type represents a Differentiated Services Code-Point
+       that may be used for marking packets in a traffic stream.
+
+       In the value set and its semantics, this type is equivalent
+       to the Dscp textual convention of the SMIv2.";
+     reference
+      "RFC 3289: Management Information Base for the Differentiated
+                 Services Architecture
+       RFC 2474: Definition of the Differentiated Services Field
+                 (DS Field) in the IPv4 and IPv6 Headers
+       RFC 2780: IANA Allocation Guidelines For Values In
+                 the Internet Protocol and Related Headers";
+   }
+
+   typedef ipv6-flow-label {
+     type uint32 {
+       range "0..1048575";
+     }
+     description
+      "The flow-label type represents flow identifier or Flow Label
+       in an IPv6 packet header that may be used to discriminate
+       traffic flows.
+
+       In the value set and its semantics, this type is equivalent
+       to the IPv6FlowLabel textual convention of the SMIv2.";
+     reference
+      "RFC 3595: Textual Conventions for IPv6 Flow Label
+       RFC 2460: Internet Protocol, Version 6 (IPv6) Specification";
+   }
+
+   typedef port-number {
+     type uint16 {
+       range "0..65535";
+     }
+     description
+      "The port-number type represents a 16-bit port number of an
+       Internet transport layer protocol such as UDP, TCP, DCCP, or
+       SCTP.  Port numbers are assigned by IANA.  A current list of
+       all assignments is available from <http://www.iana.org/>.
+
+       Note that the port number value zero is reserved by IANA.  In
+       situations where the value zero does not make sense, it can
+       be excluded by subtyping the port-number type.
+
+       In the value set and its semantics, this type is equivalent
+       to the InetPortNumber textual convention of the SMIv2.";
+     reference
+      "RFC  768: User Datagram Protocol
+       RFC  793: Transmission Control Protocol
+       RFC 4960: Stream Control Transmission Protocol
+       RFC 4340: Datagram Congestion Control Protocol (DCCP)
+       RFC 4001: Textual Conventions for Internet Network Addresses";
+   }
+
+   /*** collection of autonomous system related types ***/
+
+   typedef as-number {
+     type uint32;
+     description
+      "The as-number type represents autonomous system numbers
+       which identify an Autonomous System (AS).  An AS is a set
+       of routers under a single technical administration, using
+       an interior gateway protocol and common metrics to route
+       packets within the AS, and using an exterior gateway
+       protocol to route packets to other ASs'.  IANA maintains
+       the AS number space and has delegated large parts to the
+       regional registries.
+
+       Autonomous system numbers were originally limited to 16
+       bits.  BGP extensions have enlarged the autonomous system
+       number space to 32 bits.  This type therefore uses an uint32
+       base type without a range restriction in order to support
+       a larger autonomous system number space.
+
+       In the value set and its semantics, this type is equivalent
+       to the InetAutonomousSystemNumber textual convention of
+       the SMIv2.";
+     reference
+      "RFC 1930: Guidelines for creation, selection, and registration
+                 of an Autonomous System (AS)
+       RFC 4271: A Border Gateway Protocol 4 (BGP-4)
+       RFC 4893: BGP Support for Four-octet AS Number Space
+       RFC 4001: Textual Conventions for Internet Network Addresses";
+   }
+
+   /*** collection of IP address and hostname related types ***/
+
+   typedef ip-address {
+     type union {
+       type inet:ipv4-address;
+       type inet:ipv6-address;
+     }
+     description
+      "The ip-address type represents an IP address and is IP
+       version neutral.  The format of the textual representations
+       implies the IP version.";
+   }
+
+   typedef ipv4-address {
+     type string {
+       pattern
+         '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+       +  '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
+       + '(%[\p{N}\p{L}]+)?';
+     }
+     description
+       "The ipv4-address type represents an IPv4 address in
+        dotted-quad notation.  The IPv4 address may include a zone
+        index, separated by a % sign.
+
+        The zone index is used to disambiguate identical address
+        values.  For link-local addresses, the zone index will
+        typically be the interface index number or the name of an
+        interface.  If the zone index is not present, the default
+        zone of the device will be used.
+
+        The canonical format for the zone index is the numerical
+        format";
+   }
+
+   typedef ipv6-address {
+     type string {
+       pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
+             + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
+             + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
+             + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
+             + '(%[\p{N}\p{L}]+)?';
+       pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
+             + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
+             + '(%.+)?';
+     }
+     description
+      "The ipv6-address type represents an IPv6 address in full,
+       mixed, shortened, and shortened-mixed notation.  The IPv6
+       address may include a zone index, separated by a % sign.
+
+       The zone index is used to disambiguate identical address
+       values.  For link-local addresses, the zone index will
+       typically be the interface index number or the name of an
+       interface.  If the zone index is not present, the default
+       zone of the device will be used.
+
+       The canonical format of IPv6 addresses uses the compressed
+       format described in RFC 4291, Section 2.2, item 2 with the
+       following additional rules: the :: substitution must be
+       applied to the longest sequence of all-zero 16-bit chunks
+       in an IPv6 address.  If there is a tie, the first sequence
+       of all-zero 16-bit chunks is replaced by ::.  Single
+       all-zero 16-bit chunks are not compressed.  The canonical
+       format uses lowercase characters and leading zeros are
+       not allowed.  The canonical format for the zone index is
+       the numerical format as described in RFC 4007, Section
+       11.2.";
+     reference
+      "RFC 4291: IP Version 6 Addressing Architecture
+       RFC 4007: IPv6 Scoped Address Architecture
+       RFC 5952: A Recommendation for IPv6 Address Text Representation";
+   }
+
+   typedef ip-prefix {
+     type union {
+       type inet:ipv4-prefix;
+       type inet:ipv6-prefix;
+     }
+     description
+      "The ip-prefix type represents an IP prefix and is IP
+       version neutral.  The format of the textual representations
+       implies the IP version.";
+   }
+
+   typedef ipv4-prefix {
+     type string {
+       pattern
+          '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+        +  '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
+        + '/(([0-9])|([1-2][0-9])|(3[0-2]))';
+     }
+     description
+      "The ipv4-prefix type represents an IPv4 address prefix.
+       The prefix length is given by the number following the
+       slash character and must be less than or equal to 32.
+
+       A prefix length value of n corresponds to an IP address
+       mask that has n contiguous 1-bits from the most
+       significant bit (MSB) and all other bits set to 0.
+
+       The canonical format of an IPv4 prefix has all bits of
+       the IPv4 address set to zero that are not part of the
+       IPv4 prefix.";
+   }
+
+   typedef ipv6-prefix {
+     type string {
+       pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
+             + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
+             + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
+             + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
+             + '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';
+       pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
+             + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
+             + '(/.+)';
+     }
+     description
+      "The ipv6-prefix type represents an IPv6 address prefix.
+       The prefix length is given by the number following the
+       slash character and must be less than or equal 128.
+
+       A prefix length value of n corresponds to an IP address
+       mask that has n contiguous 1-bits from the most
+       significant bit (MSB) and all other bits set to 0.
+
+       The IPv6 address should have all bits that do not belong
+       to the prefix set to zero.
+
+       The canonical format of an IPv6 prefix has all bits of
+       the IPv6 address set to zero that are not part of the
+       IPv6 prefix.  Furthermore, IPv6 address is represented
+       in the compressed format described in RFC 4291, Section
+       2.2, item 2 with the following additional rules: the ::
+       substitution must be applied to the longest sequence of
+       all-zero 16-bit chunks in an IPv6 address.  If there is
+       a tie, the first sequence of all-zero 16-bit chunks is
+       replaced by ::.  Single all-zero 16-bit chunks are not
+       compressed.  The canonical format uses lowercase
+       characters and leading zeros are not allowed.";
+     reference
+      "RFC 4291: IP Version 6 Addressing Architecture";
+   }
+
+   /*** collection of domain name and URI types ***/
+
+   typedef domain-name {
+     type string {
+       pattern '((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*'
+            +  '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)'
+            +  '|\.';
+       length "1..253";
+     }
+     description
+      "The domain-name type represents a DNS domain name.  The
+       name SHOULD be fully qualified whenever possible.
+
+       Internet domain names are only loosely specified.  Section
+       3.5 of RFC 1034 recommends a syntax (modified in Section
+       2.1 of RFC 1123).  The pattern above is intended to allow
+       for current practice in domain name use, and some possible
+       future expansion.  It is designed to hold various types of
+       domain names, including names used for A or AAAA records
+       (host names) and other records, such as SRV records.  Note
+       that Internet host names have a stricter syntax (described
+       in RFC 952) than the DNS recommendations in RFCs 1034 and
+       1123, and that systems that want to store host names in
+       schema nodes using the domain-name type are recommended to
+       adhere to this stricter standard to ensure interoperability.
+
+       The encoding of DNS names in the DNS protocol is limited
+       to 255 characters.  Since the encoding consists of labels
+       prefixed by a length bytes and there is a trailing NULL
+       byte, only 253 characters can appear in the textual dotted
+       notation.
+
+       The description clause of schema nodes using the domain-name
+       type MUST describe when and how these names are resolved to
+       IP addresses.  Note that the resolution of a domain-name value
+       may require to query multiple DNS records (e.g., A for IPv4
+       and AAAA for IPv6).  The order of the resolution process and
+       which DNS record takes precedence can either be defined
+       explicitely or it may depend on the configuration of the
+       resolver.
+
+       Domain-name values use the US-ASCII encoding.  Their canonical
+       format uses lowercase US-ASCII characters.  Internationalized
+       domain names MUST be encoded in punycode as described in RFC
+       3492";
+     reference
+      "RFC  952: DoD Internet Host Table Specification
+       RFC 1034: Domain Names - Concepts and Facilities
+       RFC 1123: Requirements for Internet Hosts -- Application
+                 and Support
+       RFC 2782: A DNS RR for specifying the location of services
+                 (DNS SRV)
+       RFC 3492: Punycode: A Bootstring encoding of Unicode for
+                 Internationalized Domain Names in Applications
+                 (IDNA)
+       RFC 5891: Internationalizing Domain Names in Applications
+                 (IDNA): Protocol";
+   }
+
+   typedef host {
+     type union {
+       type inet:ip-address;
+       type inet:domain-name;
+     }
+     description
+      "The host type represents either an IP address or a DNS
+       domain name.";
+   }
+
+   typedef uri {
+     type string;
+     description
+      "The uri type represents a Uniform Resource Identifier
+       (URI) as defined by STD 66.
+
+       Objects using the uri type MUST be in US-ASCII encoding,
+       and MUST be normalized as described by RFC 3986 Sections
+       6.2.1, 6.2.2.1, and 6.2.2.2.  All unnecessary
+       percent-encoding is removed, and all case-insensitive
+       characters are set to lowercase except for hexadecimal
+       digits, which are normalized to uppercase as described in
+       Section 6.2.2.1.
+
+       The purpose of this normalization is to help provide
+       unique URIs.  Note that this normalization is not
+       sufficient to provide uniqueness.  Two URIs that are
+       textually distinct after this normalization may still be
+       equivalent.
+
+       Objects using the uri type may restrict the schemes that
+       they permit.  For example, 'data:' and 'urn:' schemes
+       might not be appropriate.
+
+       A zero-length URI is not a valid URI.  This can be used to
+       express 'URI absent' where required.
+
+       In the value set and its semantics, this type is equivalent
+       to the Uri SMIv2 textual convention defined in RFC 5017.";
+     reference
+      "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
+       RFC 3305: Report from the Joint W3C/IETF URI Planning Interest
+                 Group: Uniform Resource Identifiers (URIs), URLs,
+                 and Uniform Resource Names (URNs): Clarifications
+                 and Recommendations
+       RFC 5017: MIB Textual Conventions for Uniform Resource
+                 Identifiers (URIs)";
+   }
+
+ }
diff --git a/opendaylight/netconf/netconf-cli/src/test/resources/schema-context/ietf-netconf.yang b/opendaylight/netconf/netconf-cli/src/test/resources/schema-context/ietf-netconf.yang
new file mode 100644 (file)
index 0000000..44c19c3
--- /dev/null
@@ -0,0 +1,927 @@
+module ietf-netconf {
+
+  // the namespace for NETCONF XML definitions is unchanged
+  // from RFC 4741, which this document replaces
+  namespace "urn:ietf:params:xml:ns:netconf:base:1.0";
+
+  prefix nc;
+
+  import ietf-inet-types {
+    prefix inet;
+  }
+
+  organization
+    "IETF NETCONF (Network Configuration) Working Group";
+
+  contact
+    "WG Web:   <http://tools.ietf.org/wg/netconf/>
+     WG List:  <netconf@ietf.org>
+
+     WG Chair: Bert Wijnen
+               <bertietf@bwijnen.net>
+
+     WG Chair: Mehmet Ersue
+               <mehmet.ersue@nsn.com>
+
+     Editor:   Martin Bjorklund
+               <mbj@tail-f.com>
+
+     Editor:   Juergen Schoenwaelder
+               <j.schoenwaelder@jacobs-university.de>
+
+     Editor:   Andy Bierman
+               <andy.bierman@brocade.com>";
+  description
+    "NETCONF Protocol Data Types and Protocol Operations.
+
+     Copyright (c) 2011 IETF Trust and the persons identified as
+     the document authors.  All rights reserved.
+
+     Redistribution and use in source and binary forms, with or
+     without modification, is permitted pursuant to, and subject
+     to the license terms contained in, the Simplified BSD License
+     set forth in Section 4.c of the IETF Trust's Legal Provisions
+     Relating to IETF Documents
+     (http://trustee.ietf.org/license-info).
+
+     This version of this YANG module is part of RFC 6241; see
+     the RFC itself for full legal notices.";
+  revision 2011-06-01 {
+    description
+      "Initial revision";
+    reference
+      "RFC 6241: Network Configuration Protocol";
+  }
+
+  extension get-filter-element-attributes {
+    description
+      "If this extension is present within an 'anyxml'
+       statement named 'filter', which must be conceptually
+       defined within the RPC input section for the <get>
+       and <get-config> protocol operations, then the
+       following unqualified XML attribute is supported
+       within the <filter> element, within a <get> or
+       <get-config> protocol operation:
+
+         type : optional attribute with allowed
+                value strings 'subtree' and 'xpath'.
+                If missing, the default value is 'subtree'.
+
+       If the 'xpath' feature is supported, then the
+       following unqualified XML attribute is
+       also supported:
+
+         select: optional attribute containing a
+                 string representing an XPath expression.
+                 The 'type' attribute must be equal to 'xpath'
+                 if this attribute is present.";
+  }
+
+  // NETCONF capabilities defined as features
+  feature writable-running {
+    description
+      "NETCONF :writable-running capability;
+       If the server advertises the :writable-running
+       capability for a session, then this feature must
+       also be enabled for that session.  Otherwise,
+       this feature must not be enabled.";
+    reference "RFC 6241, Section 8.2";
+  }
+
+  feature candidate {
+    description
+      "NETCONF :candidate capability;
+       If the server advertises the :candidate
+       capability for a session, then this feature must
+       also be enabled for that session.  Otherwise,
+       this feature must not be enabled.";
+    reference "RFC 6241, Section 8.3";
+  }
+
+  feature confirmed-commit {
+    if-feature candidate;
+    description
+      "NETCONF :confirmed-commit:1.1 capability;
+       If the server advertises the :confirmed-commit:1.1
+       capability for a session, then this feature must
+       also be enabled for that session.  Otherwise,
+       this feature must not be enabled.";
+
+    reference "RFC 6241, Section 8.4";
+  }
+
+  feature rollback-on-error {
+    description
+      "NETCONF :rollback-on-error capability;
+       If the server advertises the :rollback-on-error
+       capability for a session, then this feature must
+       also be enabled for that session.  Otherwise,
+       this feature must not be enabled.";
+    reference "RFC 6241, Section 8.5";
+  }
+
+  feature validate {
+    description
+      "NETCONF :validate:1.1 capability;
+       If the server advertises the :validate:1.1
+       capability for a session, then this feature must
+       also be enabled for that session.  Otherwise,
+       this feature must not be enabled.";
+    reference "RFC 6241, Section 8.6";
+  }
+
+  feature startup {
+    description
+      "NETCONF :startup capability;
+       If the server advertises the :startup
+       capability for a session, then this feature must
+       also be enabled for that session.  Otherwise,
+       this feature must not be enabled.";
+    reference "RFC 6241, Section 8.7";
+  }
+
+  feature url {
+    description
+      "NETCONF :url capability;
+       If the server advertises the :url
+       capability for a session, then this feature must
+       also be enabled for that session.  Otherwise,
+       this feature must not be enabled.";
+    reference "RFC 6241, Section 8.8";
+  }
+
+  feature xpath {
+    description
+      "NETCONF :xpath capability;
+       If the server advertises the :xpath
+       capability for a session, then this feature must
+       also be enabled for that session.  Otherwise,
+       this feature must not be enabled.";
+    reference "RFC 6241, Section 8.9";
+  }
+
+  // NETCONF Simple Types
+
+  typedef session-id-type {
+    type uint32 {
+      range "1..max";
+    }
+    description
+      "NETCONF Session Id";
+  }
+
+  typedef session-id-or-zero-type {
+    type uint32;
+    description
+      "NETCONF Session Id or Zero to indicate none";
+  }
+  typedef error-tag-type {
+    type enumeration {
+       enum in-use {
+         description
+           "The request requires a resource that
+            already is in use.";
+       }
+       enum invalid-value {
+         description
+           "The request specifies an unacceptable value for one
+            or more parameters.";
+       }
+       enum too-big {
+         description
+           "The request or response (that would be generated) is
+            too large for the implementation to handle.";
+       }
+       enum missing-attribute {
+         description
+           "An expected attribute is missing.";
+       }
+       enum bad-attribute {
+         description
+           "An attribute value is not correct; e.g., wrong type,
+            out of range, pattern mismatch.";
+       }
+       enum unknown-attribute {
+         description
+           "An unexpected attribute is present.";
+       }
+       enum missing-element {
+         description
+           "An expected element is missing.";
+       }
+       enum bad-element {
+         description
+           "An element value is not correct; e.g., wrong type,
+            out of range, pattern mismatch.";
+       }
+       enum unknown-element {
+         description
+           "An unexpected element is present.";
+       }
+       enum unknown-namespace {
+         description
+           "An unexpected namespace is present.";
+       }
+       enum access-denied {
+         description
+           "Access to the requested protocol operation or
+            data model is denied because authorization failed.";
+       }
+       enum lock-denied {
+         description
+           "Access to the requested lock is denied because the
+            lock is currently held by another entity.";
+       }
+       enum resource-denied {
+         description
+           "Request could not be completed because of
+            insufficient resources.";
+       }
+       enum rollback-failed {
+         description
+           "Request to roll back some configuration change (via
+            rollback-on-error or <discard-changes> operations)
+            was not completed for some reason.";
+
+       }
+       enum data-exists {
+         description
+           "Request could not be completed because the relevant
+            data model content already exists.  For example,
+            a 'create' operation was attempted on data that
+            already exists.";
+       }
+       enum data-missing {
+         description
+           "Request could not be completed because the relevant
+            data model content does not exist.  For example,
+            a 'delete' operation was attempted on
+            data that does not exist.";
+       }
+       enum operation-not-supported {
+         description
+           "Request could not be completed because the requested
+            operation is not supported by this implementation.";
+       }
+       enum operation-failed {
+         description
+           "Request could not be completed because the requested
+            operation failed for some reason not covered by
+            any other error condition.";
+       }
+       enum partial-operation {
+         description
+           "This error-tag is obsolete, and SHOULD NOT be sent
+            by servers conforming to this document.";
+       }
+       enum malformed-message {
+         description
+           "A message could not be handled because it failed to
+            be parsed correctly.  For example, the message is not
+            well-formed XML or it uses an invalid character set.";
+       }
+     }
+     description "NETCONF Error Tag";
+     reference "RFC 6241, Appendix A";
+  }
+
+  typedef error-severity-type {
+    type enumeration {
+      enum error {
+        description "Error severity";
+      }
+      enum warning {
+        description "Warning severity";
+      }
+    }
+    description "NETCONF Error Severity";
+    reference "RFC 6241, Section 4.3";
+  }
+
+  typedef edit-operation-type {
+    type enumeration {
+      enum merge {
+        description
+          "The configuration data identified by the
+           element containing this attribute is merged
+           with the configuration at the corresponding
+           level in the configuration datastore identified
+           by the target parameter.";
+      }
+      enum replace {
+        description
+          "The configuration data identified by the element
+           containing this attribute replaces any related
+           configuration in the configuration datastore
+           identified by the target parameter.  If no such
+           configuration data exists in the configuration
+           datastore, it is created.  Unlike a
+           <copy-config> operation, which replaces the
+           entire target configuration, only the configuration
+           actually present in the config parameter is affected.";
+      }
+      enum create {
+        description
+          "The configuration data identified by the element
+           containing this attribute is added to the
+           configuration if and only if the configuration
+           data does not already exist in the configuration
+           datastore.  If the configuration data exists, an
+           <rpc-error> element is returned with an
+           <error-tag> value of 'data-exists'.";
+      }
+      enum delete {
+        description
+          "The configuration data identified by the element
+           containing this attribute is deleted from the
+           configuration if and only if the configuration
+           data currently exists in the configuration
+           datastore.  If the configuration data does not
+           exist, an <rpc-error> element is returned with
+           an <error-tag> value of 'data-missing'.";
+      }
+      enum remove {
+        description
+          "The configuration data identified by the element
+           containing this attribute is deleted from the
+           configuration if the configuration
+           data currently exists in the configuration
+           datastore.  If the configuration data does not
+           exist, the 'remove' operation is silently ignored
+           by the server.";
+      }
+    }
+    default "merge";
+    description "NETCONF 'operation' attribute values";
+    reference "RFC 6241, Section 7.2";
+  }
+
+  // NETCONF Standard Protocol Operations
+
+  rpc get-config {
+    description
+      "Retrieve all or part of a specified configuration.";
+
+    reference "RFC 6241, Section 7.1";
+
+    input {
+      container source {
+        description
+          "Particular configuration to retrieve.";
+
+        choice config-source {
+          mandatory true;
+          description
+            "The configuration to retrieve.";
+          leaf candidate {
+            if-feature candidate;
+            type empty;
+            description
+              "The candidate configuration is the config source.";
+          }
+          leaf running {
+            type empty;
+            description
+              "The running configuration is the config source.";
+          }
+          leaf startup {
+            if-feature startup;
+            type empty;
+            description
+              "The startup configuration is the config source.
+               This is optional-to-implement on the server because
+               not all servers will support filtering for this
+               datastore.";
+          }
+        }
+      }
+
+      anyxml filter {
+        description
+          "Subtree or XPath filter to use.";
+        nc:get-filter-element-attributes;
+      }
+    }
+
+    output {
+      anyxml data {
+        description
+          "Copy of the source datastore subset that matched
+           the filter criteria (if any).  An empty data container
+           indicates that the request did not produce any results.";
+      }
+    }
+  }
+
+  rpc edit-config {
+    description
+      "The <edit-config> operation loads all or part of a specified
+       configuration to the specified target configuration.";
+
+    reference "RFC 6241, Section 7.2";
+
+    input {
+      container target {
+        description
+          "Particular configuration to edit.";
+
+        choice config-target {
+          mandatory true;
+          description
+            "The configuration target.";
+
+          leaf candidate {
+            if-feature candidate;
+            type empty;
+            description
+              "The candidate configuration is the config target.";
+          }
+          leaf running {
+            if-feature writable-running;
+            type empty;
+            description
+              "The running configuration is the config source.";
+          }
+        }
+      }
+
+      leaf default-operation {
+        type enumeration {
+          enum merge {
+            description
+              "The default operation is merge.";
+          }
+          enum replace {
+            description
+              "The default operation is replace.";
+          }
+          enum none {
+            description
+              "There is no default operation.";
+          }
+        }
+        default "merge";
+        description
+          "The default operation to use.";
+      }
+
+      leaf test-option {
+        if-feature validate;
+        type enumeration {
+          enum test-then-set {
+            description
+              "The server will test and then set if no errors.";
+          }
+          enum set {
+            description
+              "The server will set without a test first.";
+          }
+
+          enum test-only {
+            description
+              "The server will only test and not set, even
+               if there are no errors.";
+          }
+        }
+        default "test-then-set";
+        description
+          "The test option to use.";
+      }
+
+      leaf error-option {
+        type enumeration {
+          enum stop-on-error {
+            description
+              "The server will stop on errors.";
+          }
+          enum continue-on-error {
+            description
+              "The server may continue on errors.";
+          }
+          enum rollback-on-error {
+            description
+              "The server will roll back on errors.
+               This value can only be used if the 'rollback-on-error'
+               feature is supported.";
+          }
+        }
+        default "stop-on-error";
+        description
+          "The error option to use.";
+      }
+
+      choice edit-content {
+        mandatory true;
+        description
+          "The content for the edit operation.";
+
+        anyxml config {
+          description
+            "Inline Config content.";
+        }
+        leaf url {
+          if-feature url;
+          type inet:uri;
+          description
+            "URL-based config content.";
+        }
+      }
+    }
+  }
+
+  rpc copy-config {
+    description
+      "Create or replace an entire configuration datastore with the
+       contents of another complete configuration datastore.";
+
+    reference "RFC 6241, Section 7.3";
+
+    input {
+      container target {
+        description
+          "Particular configuration to copy to.";
+
+        choice config-target {
+          mandatory true;
+          description
+            "The configuration target of the copy operation.";
+
+          leaf candidate {
+            if-feature candidate;
+            type empty;
+            description
+              "The candidate configuration is the config target.";
+          }
+          leaf running {
+            if-feature writable-running;
+            type empty;
+            description
+              "The running configuration is the config target.
+               This is optional-to-implement on the server.";
+          }
+          leaf startup {
+            if-feature startup;
+            type empty;
+            description
+              "The startup configuration is the config target.";
+          }
+          leaf url {
+            if-feature url;
+            type inet:uri;
+            description
+              "The URL-based configuration is the config target.";
+          }
+        }
+      }
+
+      container source {
+        description
+          "Particular configuration to copy from.";
+
+        choice config-source {
+          mandatory true;
+          description
+            "The configuration source for the copy operation.";
+
+          leaf candidate {
+            if-feature candidate;
+            type empty;
+            description
+              "The candidate configuration is the config source.";
+          }
+          leaf running {
+            type empty;
+            description
+              "The running configuration is the config source.";
+          }
+          leaf startup {
+            if-feature startup;
+            type empty;
+            description
+              "The startup configuration is the config source.";
+          }
+          leaf url {
+            if-feature url;
+            type inet:uri;
+            description
+              "The URL-based configuration is the config source.";
+          }
+          anyxml config {
+            description
+              "Inline Config content: <config> element.  Represents
+               an entire configuration datastore, not
+               a subset of the running datastore.";
+          }
+        }
+      }
+    }
+  }
+
+  rpc delete-config {
+    description
+      "Delete a configuration datastore.";
+
+    reference "RFC 6241, Section 7.4";
+
+    input {
+      container target {
+        description
+          "Particular configuration to delete.";
+
+        choice config-target {
+          mandatory true;
+          description
+            "The configuration target to delete.";
+
+          leaf startup {
+            if-feature startup;
+            type empty;
+            description
+              "The startup configuration is the config target.";
+          }
+          leaf url {
+            if-feature url;
+            type inet:uri;
+            description
+              "The URL-based configuration is the config target.";
+          }
+        }
+      }
+    }
+  }
+
+  rpc lock {
+    description
+      "The lock operation allows the client to lock the configuration
+       system of a device.";
+
+    reference "RFC 6241, Section 7.5";
+
+    input {
+      container target {
+        description
+          "Particular configuration to lock.";
+
+        choice config-target {
+          mandatory true;
+          description
+            "The configuration target to lock.";
+
+          leaf candidate {
+            if-feature candidate;
+            type empty;
+            description
+              "The candidate configuration is the config target.";
+          }
+          leaf running {
+            type empty;
+            description
+              "The running configuration is the config target.";
+          }
+          leaf startup {
+            if-feature startup;
+            type empty;
+            description
+              "The startup configuration is the config target.";
+          }
+        }
+      }
+    }
+  }
+
+  rpc unlock {
+    description
+      "The unlock operation is used to release a configuration lock,
+       previously obtained with the 'lock' operation.";
+
+    reference "RFC 6241, Section 7.6";
+
+    input {
+      container target {
+        description
+          "Particular configuration to unlock.";
+
+        choice config-target {
+          mandatory true;
+          description
+            "The configuration target to unlock.";
+
+          leaf candidate {
+            if-feature candidate;
+            type empty;
+            description
+              "The candidate configuration is the config target.";
+          }
+          leaf running {
+            type empty;
+            description
+              "The running configuration is the config target.";
+          }
+          leaf startup {
+            if-feature startup;
+            type empty;
+            description
+              "The startup configuration is the config target.";
+          }
+        }
+      }
+    }
+  }
+
+  rpc get {
+    description
+      "Retrieve running configuration and device state information.";
+
+    reference "RFC 6241, Section 7.7";
+
+    input {
+      anyxml filter {
+        description
+          "This parameter specifies the portion of the system
+           configuration and state data to retrieve.";
+        nc:get-filter-element-attributes;
+      }
+    }
+
+    output {
+      anyxml data {
+        description
+          "Copy of the running datastore subset and/or state
+           data that matched the filter criteria (if any).
+           An empty data container indicates that the request did not
+           produce any results.";
+      }
+    }
+  }
+
+  rpc close-session {
+    description
+      "Request graceful termination of a NETCONF session.";
+
+    reference "RFC 6241, Section 7.8";
+  }
+
+  rpc kill-session {
+    description
+      "Force the termination of a NETCONF session.";
+
+    reference "RFC 6241, Section 7.9";
+
+    input {
+      leaf session-id {
+        type session-id-type;
+        mandatory true;
+        description
+          "Particular session to kill.";
+      }
+    }
+  }
+
+  rpc commit {
+    if-feature candidate;
+
+    description
+      "Commit the candidate configuration as the device's new
+       current configuration.";
+
+    reference "RFC 6241, Section 8.3.4.1";
+
+    input {
+      leaf confirmed {
+        if-feature confirmed-commit;
+        type empty;
+        description
+          "Requests a confirmed commit.";
+        reference "RFC 6241, Section 8.3.4.1";
+      }
+
+      leaf confirm-timeout {
+        if-feature confirmed-commit;
+        type uint32 {
+          range "1..max";
+        }
+        units "seconds";
+        default "600";   // 10 minutes
+        description
+          "The timeout interval for a confirmed commit.";
+        reference "RFC 6241, Section 8.3.4.1";
+      }
+
+      leaf persist {
+        if-feature confirmed-commit;
+        type string;
+        description
+          "This parameter is used to make a confirmed commit
+           persistent.  A persistent confirmed commit is not aborted
+           if the NETCONF session terminates.  The only way to abort
+           a persistent confirmed commit is to let the timer expire,
+           or to use the <cancel-commit> operation.
+
+           The value of this parameter is a token that must be given
+           in the 'persist-id' parameter of <commit> or
+           <cancel-commit> operations in order to confirm or cancel
+           the persistent confirmed commit.
+
+           The token should be a random string.";
+        reference "RFC 6241, Section 8.3.4.1";
+      }
+
+      leaf persist-id {
+        if-feature confirmed-commit;
+        type string;
+        description
+          "This parameter is given in order to commit a persistent
+           confirmed commit.  The value must be equal to the value
+           given in the 'persist' parameter to the <commit> operation.
+           If it does not match, the operation fails with an
+          'invalid-value' error.";
+        reference "RFC 6241, Section 8.3.4.1";
+      }
+
+    }
+  }
+
+  rpc discard-changes {
+    if-feature candidate;
+
+    description
+      "Revert the candidate configuration to the current
+       running configuration.";
+    reference "RFC 6241, Section 8.3.4.2";
+  }
+
+  rpc cancel-commit {
+    if-feature confirmed-commit;
+    description
+      "This operation is used to cancel an ongoing confirmed commit.
+       If the confirmed commit is persistent, the parameter
+       'persist-id' must be given, and it must match the value of the
+       'persist' parameter.";
+    reference "RFC 6241, Section 8.4.4.1";
+
+    input {
+      leaf persist-id {
+        type string;
+        description
+          "This parameter is given in order to cancel a persistent
+           confirmed commit.  The value must be equal to the value
+           given in the 'persist' parameter to the <commit> operation.
+           If it does not match, the operation fails with an
+          'invalid-value' error.";
+      }
+    }
+  }
+
+  rpc validate {
+    if-feature validate;
+
+    description
+      "Validates the contents of the specified configuration.";
+
+    reference "RFC 6241, Section 8.6.4.1";
+
+    input {
+      container source {
+        description
+          "Particular configuration to validate.";
+
+        choice config-source {
+          mandatory true;
+          description
+            "The configuration source to validate.";
+
+          leaf candidate {
+            if-feature candidate;
+            type empty;
+            description
+              "The candidate configuration is the config source.";
+          }
+          leaf running {
+            type empty;
+            description
+              "The running configuration is the config source.";
+          }
+          leaf startup {
+            if-feature startup;
+            type empty;
+            description
+              "The startup configuration is the config source.";
+          }
+          leaf url {
+            if-feature url;
+            type inet:uri;
+            description
+              "The URL-based configuration is the config source.";
+          }
+          anyxml config {
+            description
+              "Inline Config content: <config> element.  Represents
+               an entire configuration datastore, not
+               a subset of the running datastore.";
+          }
+        }
+      }
+    }
+  }
+
+}
diff --git a/opendaylight/netconf/netconf-cli/src/test/resources/schema-context/model1.yang b/opendaylight/netconf/netconf-cli/src/test/resources/schema-context/model1.yang
new file mode 100644 (file)
index 0000000..c84d55f
--- /dev/null
@@ -0,0 +1,74 @@
+module model1 {
+  namespace "ns:model1";
+  prefix "mod1";
+
+  revision "2014-05-14" {
+  }
+
+  container cont1 {
+    container cont11 {
+        list lst111 {
+            key lf1111;
+            leaf lf1111 {
+                type int32;
+            }
+            container cont111 {
+                leaf lf1112 {
+                    type string;
+                }
+                leaf-list lflst1111 {
+                    type int8;
+                }
+            }
+        }
+    }
+
+    container cont12 {
+        list lst121 {
+            key lf1211;
+            leaf lf1211 {
+                type string;
+            }
+            list lst1211 {
+                leaf lf12111 {
+                    type uint8;
+                }
+                leaf lf12112 {
+                    type string;
+                }
+            }
+        }
+        choice chcA {
+            case AA {
+                leaf lf12AA1 {
+                    type string;
+                }
+            }
+            case AB {
+                container cont12AB1 {
+                    leaf lf12AB1 {
+                        type string;
+                    }
+                }
+            }
+            leaf lf121 { //should be standalone case
+                type string;
+            }
+        }
+        list lst122 {
+        }
+    }
+  }
+
+  container cont2 {
+    container cont23 {
+    }
+  }
+
+  container contA {
+  }
+
+  container contB {
+  }
+
+}
\ No newline at end of file
diff --git a/opendaylight/netconf/netconf-cli/src/test/resources/schema-context/model2.yang b/opendaylight/netconf/netconf-cli/src/test/resources/schema-context/model2.yang
new file mode 100644 (file)
index 0000000..e92cbd7
--- /dev/null
@@ -0,0 +1,32 @@
+module model2 {
+  namespace "ns:model2";
+  prefix "mod2";
+
+  import model1 {prefix model1; revision-date 2014-05-14;}
+
+  revision "2014-05-14" {
+  }
+
+  container contA {
+  }
+
+  container contB {
+  }
+
+  augment "/model1:cont2" {
+    container cont21 {
+    }
+
+    container cont22 {
+    }
+  }
+
+  augment "/model1:cont1" {
+    list lst11 {
+       leaf lf111 {
+        type string;
+       }
+    }
+  }
+
+}
\ No newline at end of file
index d26fcf987e5469388b5c01bac3a391b805a46536..937949a17e5827bbe74d22eb5071904b3a71906d 100644 (file)
@@ -19,6 +19,7 @@
 
   <modules>
     <module>netconf-api</module>
+    <module>netconf-cli</module>
     <module>netconf-impl</module>
     <module>config-netconf-connector</module>
     <module>netconf-util</module>
diff --git a/pom.xml b/pom.xml
index c54d9a930f28ad39ad680f30314508248bd2eea5..af8400242924501d0aca460e46da718327876bdb 100644 (file)
--- a/pom.xml
+++ b/pom.xml
     <!-- 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>