Merge "Small fix to xsql dependencies"
authorTony Tkacik <ttkacik@cisco.com>
Tue, 2 Sep 2014 11:14:21 +0000 (11:14 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 2 Sep 2014 11:14:21 +0000 (11:14 +0000)
179 files changed:
features/mdsal/pom.xml
features/mdsal/src/main/resources/features.xml
opendaylight/commons/opendaylight/pom.xml
opendaylight/distribution/opendaylight/pom.xml
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/AbstractChangeListener.java [deleted file]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/FRMActivator.java
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/FlowCookieProducer.java [deleted file]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/FlowNodeReconciliation.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/ForwardingRulesCommiter.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/ForwardingRulesManager.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowChangeListener.java [deleted file]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowProvider.java [deleted file]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupChangeListener.java [deleted file]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupProvider.java [deleted file]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/impl/AbstractListeningCommiter.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/impl/FlowForwarder.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/impl/FlowNodeReconciliationImpl.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/impl/ForwardingRulesManagerImpl.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/impl/GroupForwarder.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/impl/MeterForwarder.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterChangeListener.java [deleted file]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterProvider.java [deleted file]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/reconil/FlowNodeReconcilListener.java [deleted file]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/reconil/FlowNodeReconcilProvider.java [deleted file]
opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/FlowListenerTest.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/GroupListenerTest.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/MeterListenerTest.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/NodeListenerTest.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/AbstractDataBrokerTest.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/AbstractSchemaAwareTest.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/DataBrokerTestCustomizer.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/FRMTest.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/MockSchemaService.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/RpcProviderRegistryMock.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/SalFlowServiceMock.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/SalGroupServiceMock.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/SalMeterServiceMock.java [new file with mode: 0644]
opendaylight/md-sal/md-sal-config/src/main/resources/initial/01-md-sal.xml
opendaylight/md-sal/sal-akka-raft/pom.xml
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/messages/KeyValue.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AppendEntries.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/client/messages/Payload.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/messages/VotingMessages.java [deleted file]
opendaylight/md-sal/sal-akka-raft/src/main/resources/VotingMessages.proto [deleted file]
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MockRaftActorContext.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/DomToBindingRpcForwarder.java
opendaylight/md-sal/sal-clustering-commons/pom.xml
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodec.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeDeSerializationContext.java [new file with mode: 0644]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeSerializationContext.java [new file with mode: 0644]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeSerializer.java [new file with mode: 0644]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeType.java [new file with mode: 0644]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentSerializer.java [new file with mode: 0644]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentType.java [new file with mode: 0644]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializer.java [new file with mode: 0644]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueType.java [new file with mode: 0644]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/common/actor/MeteredBoundedMailbox.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/cluster/example/KeyValueMessages.java [moved from opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/protobuff/messages/KeyValueMessages.java with 78% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/cluster/raft/AppendEntriesMessages.java [moved from opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/messages/AppendEntriesMessages.java with 79% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/cluster/raft/test/MockPayloadMessages.java [moved from opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/protobuff/messages/MockPayloadMessages.java with 66% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/common/NormalizedNodeMessages.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/persistent/PersistentMessages.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/shard/CompositeModificationPayload.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessages.java
opendaylight/md-sal/sal-clustering-commons/src/main/resources/AppendEntriesMessages.proto [moved from opendaylight/md-sal/sal-akka-raft/src/main/resources/AppendEntriesMessages.proto with 88% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/resources/Common.proto
opendaylight/md-sal/sal-clustering-commons/src/main/resources/KeyValueMessages.proto [moved from opendaylight/md-sal/sal-akka-raft/src/main/resources/KeyValueMessages.proto with 79% similarity]
opendaylight/md-sal/sal-clustering-commons/src/main/resources/MockPayload.proto [moved from opendaylight/md-sal/sal-akka-raft/src/test/resources/MockPayload.proto with 54% similarity]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeSerializerTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentSerializerTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializerTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/util/TestModel.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/common/actor/MeteredBoundedMailboxTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/resources/odl-datastore-test.yang
opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/akka.conf
opendaylight/md-sal/sal-distributed-datastore/pom.xml
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/CompositeModificationPayload.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListener.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistration.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreProperties.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardContext.java [new file with mode: 0644]
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/ShardReadTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardReadWriteTransaction.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/ShardWriteTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/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/utils/ActorContext.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedConfigDataStoreProviderModule.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/config/yang/config/distributed_datastore_provider/DistributedOperationalDataStoreProviderModule.java
opendaylight/md-sal/sal-distributed-datastore/src/main/resources/application.conf
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/BasicIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/CompositeModificationPayloadTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionChainTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionFailureTest.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/ThreePhaseCommitCohortFailureTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionChainProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/resources/application.conf
opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLAdapter.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/config/yang/inmemory_datastore_provider/InMemoryOperationalDataStoreProviderModule.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/yang/opendaylight-inmemory-datastore-provider.yang
opendaylight/md-sal/sal-karaf-xsql/pom.xml [new file with mode: 0644]
opendaylight/md-sal/sal-karaf-xsql/src/main/java/org/opendaylight/controller/xsql/xsql.java [new file with mode: 0644]
opendaylight/md-sal/sal-remoterpc-connector/pom.xml
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RpcManager.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistry.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/gossip/BucketStore.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/gossip/Gossiper.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/utils/ActorUtil.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/resources/application.conf
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RemoteRpcProviderTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RouteRpcListenerTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RpcListenerTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistryTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/utils/LatestEntryRoutingLogicTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/resources/application.conf
opendaylight/md-sal/sal-rest-connector/pom.xml
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfConstants.java [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/impl/AbstractIdentifierAwareJaxRsProvider.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonNormalizedNodeBodyReader.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/NormalizedNodeJsonBodyWriter.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/NormalizedNodeXmlBodyWriter.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfApplication.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/XmlNormalizedNodeBodyReader.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlToCompositeNodeReader.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlToNormalizedNodeReaderWithSchema.java [deleted file]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/BrokerFacade.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/InstanceIdentifierContext.java [moved from opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/InstanceIdWithSchemaNode.java with 71% similarity]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/NormalizedDataPrunner.java [new file with mode: 0644]
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/NormalizedNodeContext.java [new file with mode: 0644]
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/resources/WEB-INF/web.xml
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/RestGetAugmentedElementWhenEqualNamesTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfDocumentedExceptionMapperTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/TestUtils.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/URITest.java
opendaylight/md-sal/sal-rest-docgen/src/main/resources/WEB-INF/web.xml
opendaylight/md-sal/sal-rest-docgen/src/main/resources/explorer/index.html
opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyExporter.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/mapping/ObjectMapper.java
opendaylight/netconf/netconf-auth/pom.xml [new file with mode: 0644]
opendaylight/netconf/netconf-auth/src/main/java/org/opendaylight/controller/netconf/auth/AuthConstants.java [new file with mode: 0644]
opendaylight/netconf/netconf-auth/src/main/java/org/opendaylight/controller/netconf/auth/AuthProvider.java [moved from opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/authentication/AuthProvider.java with 56% similarity]
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITSecureTest.java
opendaylight/netconf/netconf-ssh/pom.xml
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/NetconfSSHServer.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/osgi/NetconfSSHActivator.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/threads/Handshaker.java
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/StubUserManager.java [deleted file]
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/SSHTest.java
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/ssh/authentication/SSHServerTest.java
opendaylight/netconf/netconf-usermanager/pom.xml [new file with mode: 0644]
opendaylight/netconf/netconf-usermanager/src/main/java/org/opendaylight/controller/netconf/auth/usermanager/AuthProviderActivator.java [new file with mode: 0644]
opendaylight/netconf/netconf-usermanager/src/main/java/org/opendaylight/controller/netconf/auth/usermanager/AuthProviderImpl.java [moved from opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/authentication/AuthProviderImpl.java with 65% similarity]
opendaylight/netconf/pom.xml
opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/Neutron_IPs.java
opendaylight/samples/northbound/loadbalancer/pom.xml

index 056d8ed72817439fd803d618b6422b633e809376..41f1eab488212d58e28e220080f001db932e7880 100644 (file)
       <type>xml</type>
       <classifier>config</classifier>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-rest-docgen</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-annotations</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.datatype</groupId>
+      <artifactId>jackson-datatype-json-org</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.module</groupId>
+      <artifactId>jackson-module-jaxb-annotations</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.jaxrs</groupId>
+      <artifactId>jackson-jaxrs-base</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.jaxrs</groupId>
+      <artifactId>jackson-jaxrs-json-provider</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.json</groupId>
+      <artifactId>json</artifactId>
+    </dependency>
     <!-- test to validate features.xml -->
     <dependency>
       <groupId>org.opendaylight.yangtools</groupId>
index 9e29fc84f813ffb15e4c55440824c2708785b538..0176a0388c76f46e57489a6d439446d632ced7e8 100644 (file)
         <bundle>mvn:org.opendaylight.controller/sal-dom-xsql/${project.version}</bundle>
         <configfile finalname="${config.configfile.directory}/${config.xsql.configfile}">mvn:org.opendaylight.controller/sal-dom-xsql-config/${project.version}/xml/config</configfile>
     </feature>
+    <feature name ='odl-mdsal-apidocs' version='${project.version}'>
+        <feature version='${project.version}'>odl-restconf</feature>
+        <bundle>mvn:org.opendaylight.controller/sal-rest-docgen/${project.version}</bundle>
+        <bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version}</bundle>
+        <bundle>mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version}</bundle>
+        <bundle>mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version}</bundle>
+        <bundle>mvn:com.fasterxml.jackson.datatype/jackson-datatype-json-org/${jackson.version}</bundle>
+        <bundle>mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/${jackson.version}</bundle>
+        <bundle>mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/${jackson.version}</bundle>
+        <bundle>mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/${jackson.version}</bundle>
+        <bundle>mvn:com.sun.jersey/jersey-core/${jersey.version}</bundle>
+        <bundle>mvn:com.sun.jersey/jersey-server/${jersey.version}</bundle>
+        <bundle>mvn:com.sun.jersey/jersey-servlet/${jersey.version}</bundle>
+        <bundle>wrap:mvn:org.json/json/${org.json.version}</bundle>
+    </feature>
 </features>
index db0f9ca57689bbd638a1ef908b85b5808c4edbee..1fc32b37d8a364b5e0536480044bed122172e2f2 100644 (file)
@@ -39,6 +39,7 @@
     <clustering.test.version>0.4.2-SNAPSHOT</clustering.test.version>
     <commmons.northbound.version>0.4.2-SNAPSHOT</commmons.northbound.version>
     <!-- Third Party Versions -->
+    <codahale.metrics.version>3.0.1</codahale.metrics.version>
     <commons.catalina>7.0.32.v201211201336</commons.catalina>
     <commons.catalina.ha>7.0.32.v201211201952</commons.catalina.ha>
     <commons.catalina.tribes>7.0.32.v201211201952</commons.catalina.tribes>
         <artifactId>logback-core</artifactId>
         <version>${logback.version}</version>
       </dependency>
+      <dependency>
+        <groupId>com.codahale.metrics</groupId>
+        <artifactId>metrics-core</artifactId>
+        <version>${codahale.metrics.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>com.codahale.metrics</groupId>
+        <artifactId>metrics-graphite</artifactId>
+        <version>${codahale.metrics.version}</version>
+      </dependency>
       <dependency>
         <groupId>com.fasterxml.jackson.core</groupId>
         <artifactId>jackson-annotations</artifactId>
         <version>${netconf.version}</version>
         <type>test-jar</type>
       </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>netconf-auth</artifactId>
+            <version>${netconf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>netconf-usermanager</artifactId>
+            <version>${netconf.version}</version>
+        </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>netconf-ssh</artifactId>
         <artifactId>yang-data-composite-node</artifactId>
         <version>${yangtools.version}</version>
       </dependency>
+      <dependency>
+        <groupId>org.opendaylight.yangtools</groupId>
+        <artifactId>yang-data-codec-gson</artifactId>
+        <version>${yangtools.version}</version>
+      </dependency>
 
       <!-- yangtools dependencies -->
       <dependency>
index 9a7677099dd8be04b4357b707c135a8279153a64..4ae35c905f122a6691072df720882ac88b68ddee 100644 (file)
           <groupId>org.opendaylight.controller</groupId>
           <artifactId>netconf-ssh</artifactId>
         </dependency>
+        <dependency>
+          <groupId>org.opendaylight.controller</groupId>
+          <artifactId>netconf-auth</artifactId>
+        </dependency>
+        <dependency>
+          <groupId>org.opendaylight.controller</groupId>
+          <artifactId>netconf-usermanager</artifactId>
+        </dependency>
         <dependency>
           <groupId>org.opendaylight.controller</groupId>
           <artifactId>netconf-tcp</artifactId>
           <groupId>org.opendaylight.yangtools</groupId>
           <artifactId>yang-parser-impl</artifactId>
         </dependency>
+        <dependency>
+          <groupId>org.opendaylight.yangtools</groupId>
+          <artifactId>yang-data-codec-gson</artifactId>
+        </dependency>
         <dependency>
           <groupId>org.opendaylight.yangtools</groupId>
           <artifactId>yang-data-composite-node</artifactId>
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/AbstractChangeListener.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/AbstractChangeListener.java
deleted file mode 100644 (file)
index 130c096..0000000
+++ /dev/null
@@ -1,173 +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.frm;
-
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * AbstractChangeListner implemented basic {@link AsyncDataChangeEvent} processing for
- * flow node subDataObject (flows, groups and meters).
- *
- * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
- *
- */
-public abstract class AbstractChangeListener implements DataChangeListener {
-
-    private final static Logger LOG = LoggerFactory.getLogger(AbstractChangeListener.class);
-
-    private final AtomicLong txNum = new AtomicLong();
-    private String transactionId;
-
-    @Override
-    public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> changeEvent) {
-        this.transactionId = this.newTransactionIdentifier().toString();
-        /* All DataObjects for create */
-        final Set<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> createdEntries =
-                changeEvent.getCreatedData().entrySet();
-        /* All DataObjects for updates - init HashSet */
-        final Set<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> updatedEntries = new HashSet<>();
-        /* Filtered DataObject for update processing only */
-        Set<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> updateConfigEntrySet =
-                changeEvent.getUpdatedData().entrySet();
-        updatedEntries.addAll(updateConfigEntrySet);
-        updatedEntries.removeAll(createdEntries);
-        /* All DataObjects for remove */
-        final Set<InstanceIdentifier<? extends DataObject>> removeEntriesInstanceIdentifiers =
-                changeEvent.getRemovedPaths();
-        /* Create DataObject processing (send to device) */
-        for (final Entry<InstanceIdentifier<? extends DataObject>, DataObject> createdEntry : createdEntries) {
-            InstanceIdentifier<? extends DataObject> entryKey = createdEntry.getKey();
-            DataObject entryValue = createdEntry.getValue();
-            if (preconditionForChange(entryKey, entryValue, null)) {
-                this.add(entryKey, entryValue);
-            }
-        }
-
-        for (final Entry<InstanceIdentifier<?>, DataObject> updatedEntrie : updatedEntries) {
-            Map<InstanceIdentifier<? extends DataObject>, DataObject> origConfigData =
-                    changeEvent.getOriginalData();
-
-            InstanceIdentifier<? extends Object> entryKey = updatedEntrie.getKey();
-            final DataObject original = origConfigData.get(entryKey);
-            final DataObject updated = updatedEntrie.getValue();
-            if (preconditionForChange(entryKey, original, updated)) {
-                this.update(entryKey, original, updated);
-            }
-        }
-
-        for (final InstanceIdentifier<?> instanceId : removeEntriesInstanceIdentifiers) {
-            Map<InstanceIdentifier<? extends DataObject>, DataObject> origConfigData =
-                    changeEvent.getOriginalData();
-
-            final DataObject removeValue = origConfigData.get(instanceId);
-            if (preconditionForChange(instanceId, removeValue, null)) {
-                this.remove(instanceId, removeValue);
-            }
-        }
-    }
-
-    /**
-     * Method returns generated transaction ID, which is unique for
-     * every transaction. ID is composite from prefix ("DOM") and unique number.
-     *
-     * @return String transactionID
-     */
-    public String getTransactionId() {
-        return this.transactionId;
-    }
-
-    private Object newTransactionIdentifier() {
-        return "DOM-" + txNum.getAndIncrement();
-    }
-
-    /**
-     * Method check all local preconditions for apply relevant changes.
-     *
-     * @param InstanceIdentifier identifier - the whole path to DataObject
-     * @param DataObject original - original DataObject (for update)
-     *                              or relevant DataObject (add/delete operations)
-     * @param DataObject update - changed DataObject (contain updates)
-     *                              or should be null for (add/delete operations)
-     *
-     * @return boolean - applicable
-     */
-    protected abstract boolean preconditionForChange(
-            final InstanceIdentifier<? extends DataObject> identifier,
-            final DataObject original, final DataObject update);
-
-    /**
-     * Method checks the node data path in DataStore/OPERATIONAL because
-     * without the Node Identifier in DataStore/OPERATIONAL, device
-     * is not connected and device pre-configuration is allowed only.
-     *
-     * @param InstanceIdentifier identifier - could be whole path to DataObject,
-     *            but parent Node.class InstanceIdentifier is used for a check only
-     *
-     * @return boolean - is the Node available in DataStore/OPERATIONAL (is connected)
-     */
-    protected boolean isNodeAvailable(final InstanceIdentifier<? extends DataObject> identifier,
-            final ReadOnlyTransaction readTrans) {
-        final InstanceIdentifier<Node> nodeInstanceId = identifier.firstIdentifierOf(Node.class);
-        try {
-            return readTrans.read(LogicalDatastoreType.OPERATIONAL, nodeInstanceId).get().isPresent();
-        }
-        catch (InterruptedException | ExecutionException e) {
-            LOG.error("Unexpected exception by reading Node ".concat(nodeInstanceId.toString()), e);
-            return false;
-        }
-        finally {
-            readTrans.close();
-        }
-    }
-
-    /**
-     * Method removes DataObject which is identified by InstanceIdentifier
-     * from device.
-     *
-     * @param InstanceIdentifier identifier - the whole path to DataObject
-     * @param DataObject remove - DataObject for removing
-     */
-    protected abstract void remove(final InstanceIdentifier<? extends DataObject> identifier,
-            final DataObject remove);
-
-    /**
-     * Method updates the original DataObject to the update DataObject
-     * in device. Both are identified by same InstanceIdentifier
-     *
-     * @param InstanceIdentifier identifier - the whole path to DataObject
-     * @param DataObject original - original DataObject (for update)
-     * @param DataObject update - changed DataObject (contain updates)
-     */
-    protected abstract void update(final InstanceIdentifier<? extends DataObject> identifier,
-            final DataObject original, final DataObject update);
-
-    /**
-     * Method adds the DataObject which is identified by InstanceIdentifier
-     * to device.
-     *
-     * @param InstanceIdentifier identifier - the whole path to new DataObject
-     * @param DataObject add - new DataObject
-     */
-    protected abstract void add(final InstanceIdentifier<? extends DataObject> identifier,
-            final DataObject add);
-}
index c75c644c008dfe0aad4849a98a13a80f053a6e80..9878d16e57bca8450f6217455d58fa3ef2e0a33f 100644 (file)
@@ -7,10 +7,7 @@
  */
 package org.opendaylight.controller.frm;
 
-import org.opendaylight.controller.frm.flow.FlowProvider;
-import org.opendaylight.controller.frm.group.GroupProvider;
-import org.opendaylight.controller.frm.meter.MeterProvider;
-import org.opendaylight.controller.frm.reconil.FlowNodeReconcilProvider;
+import org.opendaylight.controller.frm.impl.ForwardingRulesManagerImpl;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
@@ -21,8 +18,7 @@ import org.slf4j.LoggerFactory;
 /**
  * Forwarding Rules Manager Activator
  *
- * Activator manages all Providers ({@link FlowProvider}, {@link GroupProvider},
- * {@link MeterProvider} and the {@link FlowNodeReconcilProvider}).
+ * Activator {@link ForwardingRulesManager}.
  * It registers all listeners (DataChangeEvent, ReconcilNotification)
  * in the Session Initialization phase.
  *
@@ -33,56 +29,33 @@ public class FRMActivator extends AbstractBindingAwareProvider {
 
     private final static Logger LOG = LoggerFactory.getLogger(FRMActivator.class);
 
-    private final FlowProvider flowProvider;
-    private final GroupProvider groupProvider;
-    private final MeterProvider meterProvider;
-    private final FlowNodeReconcilProvider flowNodeReconcilProvider;
-
-    public FRMActivator() {
-        this.flowProvider = new FlowProvider();
-        this.groupProvider = new GroupProvider();
-        this.meterProvider = new MeterProvider();
-        this.flowNodeReconcilProvider = new FlowNodeReconcilProvider();
-    }
+    private ForwardingRulesManager  manager;
 
     @Override
-    public void onSessionInitiated(final ProviderContext session) {
+    public void onSessionInitiated(ProviderContext session) {
         LOG.info("FRMActivator initialization.");
-        /* Flow */
         try {
-            final DataBroker flowSalService = session.getSALService(DataBroker.class);
-            this.flowProvider.init(flowSalService);
-            this.flowProvider.start(session);
-            /* Group */
-            final DataBroker groupSalService = session.getSALService(DataBroker.class);
-            this.groupProvider.init(groupSalService);
-            this.groupProvider.start(session);
-            /* Meter */
-            final DataBroker meterSalService = session.getSALService(DataBroker.class);
-            this.meterProvider.init(meterSalService);
-            this.meterProvider.start(session);
-            /* FlowNode Reconciliation */
-            final DataBroker dbs = session.getSALService(DataBroker.class);
-            this.flowNodeReconcilProvider.init(dbs);
-            this.flowNodeReconcilProvider.start(session);
-
-            LOG.info("FRMActivator started successfully");
-        } catch (Exception e) {
-            String errMsg = "Unexpected error by starting FRMActivator";
-            LOG.error(errMsg, e);
-            throw new IllegalStateException(errMsg, e);
+            final DataBroker dataBroker = session.getSALService(DataBroker.class);
+            this.manager = new ForwardingRulesManagerImpl(dataBroker, session);
+            this.manager.start();
+            LOG.info("FRMActivator initialization successfull.");
+        }
+        catch (Exception e) {
+            LOG.error("Unexpected error by FRM initialization!", e);
+            this.stopImpl(null);
         }
     }
 
     @Override
     protected void stopImpl(final BundleContext context) {
-        try {
-            this.flowProvider.close();
-            this.groupProvider.close();
-            this.meterProvider.close();
-            this.flowNodeReconcilProvider.close();
-        } catch (Exception e) {
-            LOG.error("Unexpected error by stopping FRMActivator", e);
+        if (manager != null) {
+            try {
+                manager.close();
+            } catch (Exception e) {
+                LOG.error("Unexpected error by stopping FRMActivator", e);
+            }
+            manager = null;
+            LOG.info("FRMActivator stopped.");
         }
     }
   }
\ No newline at end of file
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/FlowCookieProducer.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/FlowCookieProducer.java
deleted file mode 100644 (file)
index d7b54e8..0000000
+++ /dev/null
@@ -1,79 +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.frm;
-
-import java.math.BigInteger;
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.AtomicLongMap;
-
-/**
- * forwardingrules-manager
- * org.opendaylight.controller.frm
- *
- * Singleton FlowCookieProducer contains a FlowCookie generator which is generated unique
- * flowCookie identifier for every flow in same Table. That could help with quick
- * identification of flow statistic because DataStore/CONFIGURATION could contains
- * a lot of flows with same flowCookie. So we are replacing original flowCookie
- * with unique and we are building final FlowCookieMap in DataStore/OPERATIONAL
- *
- * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
- *
- * Created: Jun 13, 2014
- */
-public enum FlowCookieProducer {
-
-    INSTANCE;
-
-    /* Flow_Cookie_Key and Flow_Ids MapHolder */
-    private static final AtomicLongMap<InstanceIdentifier<Table>> cookieKeys = AtomicLongMap.create();
-
-    /**
-     * Method returns the unique cookie for a node table.
-     * Flow Cookie Key signs List<FlowId> for a right flow statistic identification
-     * in the DataStore/operational.
-     * We need a List<FlowId> because system doesn't guarantee unique mapping
-     * from flow_cookie to flow_id. REST Operations doesn't used FRM yet, so
-     * cookie from user input could have a user input flow ID and an alien system ID
-     * which is generated by system.
-     *
-     * @param InstanceIdentifier<Table> tableIdentifier
-     * @return unique BigInteger flowCookie for a node table
-     */
-    public BigInteger getNewCookie(final InstanceIdentifier<Table> tableIdentifier) {
-        FlowCookieProducer.validationTableIdentifier(tableIdentifier);
-        if ( cookieKeys.containsKey(tableIdentifier)) {
-            /* new identifier always starts from ONE because
-             * ZERO is reserved for the NO_COOKIES flows */
-            return BigInteger.valueOf(cookieKeys.addAndGet(tableIdentifier, 1L));
-        } else {
-            return BigInteger.valueOf(cookieKeys.incrementAndGet(tableIdentifier));
-        }
-    }
-
-    /**
-     * Method cleans the node table flow_cookie_key for the disconnected Node.
-     *
-     * @param InstanceIdentifier<Table> tableIdentifier
-     */
-    public void clean(final InstanceIdentifier<Table> tableIdentifier) {
-        FlowCookieProducer.validationTableIdentifier(tableIdentifier);
-        cookieKeys.remove(tableIdentifier);
-    }
-
-    /*
-     * Help the TableIdentifer input validation method
-     */
-    private static void validationTableIdentifier(final InstanceIdentifier<Table> tableIdent) {
-        Preconditions.checkArgument(tableIdent != null, "Input validation exception: TableIdentifier can not be null !");
-    }
-}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/FlowNodeReconciliation.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/FlowNodeReconciliation.java
new file mode 100644 (file)
index 0000000..fb3178d
--- /dev/null
@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.frm;
+
+import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * forwardingrules-manager
+ * org.opendaylight.controller.frm
+ *
+ * FlowNodeReconciliation
+ * It represent Reconciliation functionality for every new device.
+ * So we have to read all possible pre-configured Flows, Meters and Groups from
+ * Config/DS and add all to new device.
+ * New device is represented by new {@link org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode}
+ * in Operational/DS. So we have to add listener for Wildcarded path in base data change scope.
+ *
+ * WildCarded InstanceIdentifier:
+ * {@code
+ *
+ * InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class)
+ *
+ * }
+ *
+ * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
+ *
+ * Created: Aug 26, 2014
+ */
+public interface FlowNodeReconciliation extends DataChangeListener, AutoCloseable {
+
+    /**
+     * Method contains Node registration to {@link ForwardingRulesManager} functionality
+     * as a prevention to use a validation check to the Operational/DS for identify
+     * pre-configure transaction and serious device commit in every transaction.
+     *
+     * Second part of functionality is own reconciliation pre-configure
+     * Flows, Meters and Groups.
+     *
+     * @param connectedNode - {@link org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier} to new Node
+     */
+    void flowNodeConnected(InstanceIdentifier<FlowCapableNode> connectedNode);
+
+    /**
+     * Method contains functionality for registered Node {@FlowCapableNode} removing
+     * from {@Link ForwardingRulesManager}
+     *
+     * @param disconnectedNode - {@link org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier} to removed Node
+     */
+    void flowNodeDisconnected(InstanceIdentifier<FlowCapableNode> disconnectedNode);
+}
+
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/ForwardingRulesCommiter.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/ForwardingRulesCommiter.java
new file mode 100644 (file)
index 0000000..2228785
--- /dev/null
@@ -0,0 +1,64 @@
+/**
+ * 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.frm;
+
+import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * forwardingrules-manager
+ * org.opendaylight.controller.frm
+ *
+ * ForwardingRulesCommiter
+ * It represent a contract between DataStore DataChangeEvent and relevant
+ * SalRpcService for device. Every implementation has to be registered for
+ * Configurational/DS tree path.
+ *
+ * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
+ *
+ * Created: Aug 25, 2014
+ */
+public interface ForwardingRulesCommiter <D extends DataObject> extends AutoCloseable, DataChangeListener {
+
+    /**
+     * Method removes DataObject which is identified by InstanceIdentifier
+     * from device.
+     *
+     * @param InstanceIdentifier identifier - the whole path to DataObject
+     * @param DataObject remove - DataObject for removing
+     * @param InstanceIdentifier<FlowCapableNode> parent Node InstanceIdentifier
+     */
+    void remove(InstanceIdentifier<D> identifier, D del,
+            InstanceIdentifier<FlowCapableNode> nodeIdent);
+
+    /**
+     * Method updates the original DataObject to the update DataObject
+     * in device. Both are identified by same InstanceIdentifier
+     *
+     * @param InstanceIdentifier identifier - the whole path to DataObject
+     * @param DataObject original - original DataObject (for update)
+     * @param DataObject update - changed DataObject (contain updates)
+     */
+    void update(InstanceIdentifier<D> identifier, D original, D update,
+            InstanceIdentifier<FlowCapableNode> nodeIdent);
+
+    /**
+     * Method adds the DataObject which is identified by InstanceIdentifier
+     * to device.
+     *
+     * @param InstanceIdentifier identifier - the whole path to new DataObject
+     * @param DataObject add - new DataObject
+     */
+    void add(InstanceIdentifier<D> identifier, D add,
+            InstanceIdentifier<FlowCapableNode> nodeIdent);
+
+}
+
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/ForwardingRulesManager.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/ForwardingRulesManager.java
new file mode 100644 (file)
index 0000000..504c108
--- /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.frm;
+
+import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * forwardingrules-manager
+ * org.opendaylight.controller.frm
+ *
+ * ForwardingRulesManager
+ * It represent a central point for whole modul. Implementation
+ * Flow Provider registers the link FlowChangeListener} and it holds all needed
+ * services for link FlowChangeListener}.
+ *
+ * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
+ *
+ * Created: Aug 25, 2014
+ */
+public interface ForwardingRulesManager extends AutoCloseable {
+
+    public void start();
+
+    /**
+     * Method returns information :
+     * "is Node with send InstanceIdentifier connected"?
+     *
+     * @param InstanceIdentifier<FlowCapableNode> ident - the key of the node
+     * @return boolean - is device connected
+     */
+    public boolean isNodeActive(InstanceIdentifier<FlowCapableNode> ident);
+
+    /**
+     * Method add new {@link FlowCapableNode} to active Node Holder.
+     * ActiveNodeHolder prevent unnecessary Operational/DS read for identify
+     * pre-configure and serious Configure/DS transactions.
+     *
+     * @param InstanceIdentifier<FlowCapableNode> ident - the key of the node
+     */
+    public void registrateNewNode(InstanceIdentifier<FlowCapableNode> ident);
+
+    /**
+     * Method remove disconnected {@link FlowCapableNode} from active Node
+     * Holder. And all next flows or groups or meters will stay in Config/DS
+     * only.
+     *
+     * @param InstanceIdentifier<FlowCapableNode> ident - the key of the node
+     */
+    public void unregistrateNode(InstanceIdentifier<FlowCapableNode> ident);
+
+    /**
+     * Method returns generated transaction ID, which is unique for
+     * every transaction. ID is composite from prefix ("DOM") and unique number.
+     *
+     * @return String transactionID for RPC transaction identification
+     */
+    public String getNewTransactionId();
+
+    /**
+     * Method returns Read Transacion. It is need for Node reconciliation only.
+     *
+     * @return ReadOnlyTransaction
+     */
+    public ReadOnlyTransaction getReadTranaction();
+
+    /**
+     * Flow RPC service
+     *
+     * @return
+     */
+    public SalFlowService getSalFlowService();
+
+    /**
+     * Group RPC service
+     *
+     * @return
+     */
+    public SalGroupService getSalGroupService();
+
+    /**
+     * Meter RPC service
+     *
+     * @return
+     */
+    public SalMeterService getSalMeterService();
+
+    /**
+     * Content definition method and prevent code duplicity in Reconcil
+     * @return ForwardingRulesCommiter<Flow>
+     */
+    public ForwardingRulesCommiter<Flow> getFlowCommiter();
+
+    /**
+     * Content definition method and prevent code duplicity in Reconcil
+     * @return ForwardingRulesCommiter<Group>
+     */
+    public ForwardingRulesCommiter<Group> getGroupCommiter();
+
+    /**
+     * Content definition method and prevent code duplicity
+     * @return ForwardingRulesCommiter<Meter>
+     */
+    public ForwardingRulesCommiter<Meter> getMeterCommiter();
+
+    /**
+     * Content definition method
+     * @return FlowNodeReconciliation
+     */
+    public FlowNodeReconciliation getFlowNodeReconciliation();
+}
+
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowChangeListener.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowChangeListener.java
deleted file mode 100644 (file)
index c10b0da..0000000
+++ /dev/null
@@ -1,126 +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.frm.flow;
-
-import java.math.BigInteger;
-
-import org.opendaylight.controller.frm.AbstractChangeListener;
-import org.opendaylight.controller.frm.FlowCookieProducer;
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
-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.flow.service.rev130819.AddFlowInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowTableRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.OriginalFlowBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.UpdatedFlowBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Preconditions;
-
-/**
- * Flow Change Listener
- *  add, update and remove {@link Flow} processing from {@link org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent}.
- *
- * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
- *
- */
-public class FlowChangeListener extends AbstractChangeListener {
-
-    private static final Logger LOG = LoggerFactory.getLogger(FlowChangeListener.class);
-
-    private final FlowProvider provider;
-
-    public FlowChangeListener (final FlowProvider provider) {
-        this.provider = Preconditions.checkNotNull(provider, "FlowProvider can not be null !");
-    }
-
-    @Override
-    protected void remove(final InstanceIdentifier<? extends DataObject> identifier,
-                          final DataObject removeDataObj) {
-
-        final Flow flow = ((Flow) removeDataObj);
-        final InstanceIdentifier<Table> tableIdent = identifier.firstIdentifierOf(Table.class);
-        final InstanceIdentifier<Node> nodeIdent = identifier.firstIdentifierOf(Node.class);
-        final RemoveFlowInputBuilder builder = new RemoveFlowInputBuilder(flow);
-
-        // use empty cookie mask in order to delete flow even with generated cookie
-        builder.setCookieMask(new FlowCookie(BigInteger.ZERO));
-
-        builder.setFlowRef(new FlowRef(identifier));
-        builder.setNode(new NodeRef(nodeIdent));
-        builder.setFlowTable(new FlowTableRef(tableIdent));
-
-        Uri uri = new Uri(this.getTransactionId());
-        builder.setTransactionUri(uri);
-        this.provider.getSalFlowService().removeFlow(builder.build());
-        LOG.debug("Transaction {} - Removed Flow has removed flow: {}", new Object[]{uri, removeDataObj});
-    }
-
-    @Override
-    protected void update(final InstanceIdentifier<? extends DataObject> identifier,
-                          final DataObject original, final DataObject update) {
-
-        final Flow originalFlow = ((Flow) original);
-        final Flow updatedFlow = ((Flow) update);
-        final InstanceIdentifier<Node> nodeIdent = identifier.firstIdentifierOf(Node.class);
-        final UpdateFlowInputBuilder builder = new UpdateFlowInputBuilder();
-
-        builder.setNode(new NodeRef(nodeIdent));
-        builder.setFlowRef(new FlowRef(identifier));
-
-        Uri uri = new Uri(this.getTransactionId());
-        builder.setTransactionUri(uri);
-
-        builder.setUpdatedFlow((new UpdatedFlowBuilder(updatedFlow)).build());
-        builder.setOriginalFlow((new OriginalFlowBuilder(originalFlow)).build());
-
-        this.provider.getSalFlowService().updateFlow(builder.build());
-        LOG.debug("Transaction {} - Update Flow has updated flow {} with {}", new Object[]{uri, original, update});
-    }
-
-    @Override
-    protected void add(final InstanceIdentifier<? extends DataObject> identifier,
-                       final DataObject addDataObj) {
-
-        final Flow flow = ((Flow) addDataObj);
-        final InstanceIdentifier<Table> tableIdent = identifier.firstIdentifierOf(Table.class);
-        final NodeRef nodeRef = new NodeRef(identifier.firstIdentifierOf(Node.class));
-        final FlowCookie flowCookie = new FlowCookie(FlowCookieProducer.INSTANCE.getNewCookie(tableIdent));
-        final AddFlowInputBuilder builder = new AddFlowInputBuilder(flow);
-
-        builder.setNode(nodeRef);
-        builder.setFlowRef(new FlowRef(identifier));
-        builder.setFlowTable(new FlowTableRef(tableIdent));
-        builder.setCookie( flowCookie );
-
-        Uri uri = new Uri(this.getTransactionId());
-        builder.setTransactionUri(uri);
-        this.provider.getSalFlowService().addFlow(builder.build());
-        LOG.debug("Transaction {} - Add Flow has added flow: {}", new Object[]{uri, addDataObj});
-    }
-
-    @Override
-    protected boolean preconditionForChange(final InstanceIdentifier<? extends DataObject> identifier,
-            final DataObject dataObj, final DataObject update) {
-
-        final ReadOnlyTransaction trans = this.provider.getDataService().newReadOnlyTransaction();
-        return update != null
-                ? (dataObj instanceof Flow && update instanceof Flow && isNodeAvailable(identifier, trans))
-                : (dataObj instanceof Flow && isNodeAvailable(identifier, trans));
-    }
-}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowProvider.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowProvider.java
deleted file mode 100644 (file)
index 8c248fa..0000000
+++ /dev/null
@@ -1,107 +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.frm.flow;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
-import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
-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.flow.service.rev130819.SalFlowService;
-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.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Preconditions;
-
-/**
- * Flow Provider registers the {@link FlowChangeListener} and it holds all needed
- * services for {@link FlowChangeListener}.
- *
- * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
- *
- */
-public class FlowProvider implements AutoCloseable {
-
-    private static final Logger LOG = LoggerFactory.getLogger(FlowProvider.class);
-
-    private SalFlowService salFlowService;
-    private DataBroker dataService;
-
-    /* DataChangeListener */
-    private DataChangeListener flowDataChangeListener;
-    private ListenerRegistration<DataChangeListener> flowDataChangeListenerRegistration;
-
-    /**
-     * Provider Initialization Phase.
-     *
-     * @param DataProviderService dataService
-     */
-    public void init (final DataBroker dataService) {
-        LOG.info("FRM Flow Config Provider initialization.");
-        this.dataService = Preconditions.checkNotNull(dataService, "DataProviderService can not be null !");
-    }
-
-    /**
-     * Listener Registration Phase
-     *
-     * @param RpcConsumerRegistry rpcRegistry
-     */
-    public void start(final RpcConsumerRegistry rpcRegistry) {
-        Preconditions.checkArgument(rpcRegistry != null, "RpcConsumerRegistry can not be null !");
-
-        this.salFlowService = Preconditions.checkNotNull(rpcRegistry.getRpcService(SalFlowService.class),
-                "RPC SalFlowService not found.");
-
-        /* Build Path */
-        InstanceIdentifier<Flow> flowIdentifier = InstanceIdentifier.create(Nodes.class)
-                .child(Node.class).augmentation(FlowCapableNode.class).child(Table.class).child(Flow.class);
-
-        /* DataChangeListener registration */
-        this.flowDataChangeListener = new FlowChangeListener(FlowProvider.this);
-        this.flowDataChangeListenerRegistration =
-                this.dataService.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION,
-                        flowIdentifier, flowDataChangeListener, DataChangeScope.SUBTREE);
-
-        LOG.info("FRM Flow Config Provider started.");
-    }
-
-    @Override
-    public void close() {
-        LOG.info("FRM Flow Config Provider stopped.");
-        if (flowDataChangeListenerRegistration != null) {
-            try {
-                flowDataChangeListenerRegistration.close();
-            } catch (Exception e) {
-                String errMsg = "Error by stop FRM Flow Config Provider.";
-                LOG.error(errMsg, e);
-                throw new IllegalStateException(errMsg, e);
-            } finally {
-                flowDataChangeListenerRegistration = null;
-            }
-        }
-    }
-
-    public DataChangeListener getFlowDataChangeListener() {
-        return flowDataChangeListener;
-    }
-
-    public SalFlowService getSalFlowService() {
-        return salFlowService;
-    }
-
-    public DataBroker getDataService() {
-        return dataService;
-    }
-}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupChangeListener.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupChangeListener.java
deleted file mode 100644 (file)
index 9b03eaa..0000000
+++ /dev/null
@@ -1,111 +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.frm.group;
-
-import org.opendaylight.controller.frm.AbstractChangeListener;
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.OriginalGroupBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.UpdatedGroupBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Preconditions;
-
-/**
- * Group Change Listener
- *  add, update and remove {@link Group} processing from {@link org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent}.
- *
- * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
- *
- */
-public class GroupChangeListener extends AbstractChangeListener {
-
-    private static final Logger LOG = LoggerFactory.getLogger(GroupChangeListener.class);
-
-    private final GroupProvider provider;
-
-    public GroupChangeListener(final GroupProvider provider) {
-        this.provider = Preconditions.checkNotNull(provider, "GroupProvider can not be null !");
-    }
-
-    @Override
-    protected void remove(final InstanceIdentifier<? extends DataObject> identifier,
-                          final DataObject removeDataObj) {
-
-        final Group group = ((Group) removeDataObj);
-        final InstanceIdentifier<Node> nodeInstanceId = identifier.<Node> firstIdentifierOf(Node.class);
-        final RemoveGroupInputBuilder builder = new RemoveGroupInputBuilder(group);
-
-        builder.setNode(new NodeRef(nodeInstanceId));
-        builder.setGroupRef(new GroupRef(identifier));
-
-        Uri uri = new Uri(this.getTransactionId());
-        builder.setTransactionUri(uri);
-        this.provider.getSalGroupService().removeGroup(builder.build());
-        LOG.debug("Transaction {} - Remove Group has removed group: {}", new Object[]{uri, removeDataObj});
-    }
-
-    @Override
-    protected void update(final InstanceIdentifier<? extends DataObject> identifier,
-                          final DataObject original, final DataObject update) {
-
-        final Group originalGroup = ((Group) original);
-        final Group updatedGroup = ((Group) update);
-        final InstanceIdentifier<Node> nodeInstanceId = identifier.<Node> firstIdentifierOf(Node.class);
-        final UpdateGroupInputBuilder builder = new UpdateGroupInputBuilder();
-
-        builder.setNode(new NodeRef(nodeInstanceId));
-        builder.setGroupRef(new GroupRef(identifier));
-
-        Uri uri = new Uri(this.getTransactionId());
-        builder.setTransactionUri(uri);
-
-        builder.setUpdatedGroup((new UpdatedGroupBuilder(updatedGroup)).build());
-        builder.setOriginalGroup((new OriginalGroupBuilder(originalGroup)).build());
-
-        this.provider.getSalGroupService().updateGroup(builder.build());
-        LOG.debug("Transaction {} - Update Group has updated group {} with group {}", new Object[]{uri, original, update});
-    }
-
-    @Override
-    protected void add(final InstanceIdentifier<? extends DataObject> identifier,
-                       final DataObject addDataObj) {
-
-        final Group group = ((Group) addDataObj);
-        final InstanceIdentifier<Node> nodeInstanceId = identifier.<Node> firstIdentifierOf(Node.class);
-        final AddGroupInputBuilder builder = new AddGroupInputBuilder(group);
-
-        builder.setNode(new NodeRef(nodeInstanceId));
-        builder.setGroupRef(new GroupRef(identifier));
-
-        Uri uri = new Uri(this.getTransactionId());
-        builder.setTransactionUri(uri);
-        this.provider.getSalGroupService().addGroup(builder.build());
-        LOG.debug("Transaction {} - Add Group has added group: {}", new Object[]{uri, addDataObj});
-    }
-
-    @Override
-    protected boolean preconditionForChange(final InstanceIdentifier<? extends DataObject> identifier,
-            final DataObject dataObj, final DataObject update) {
-
-        final ReadOnlyTransaction trans = this.provider.getDataService().newReadOnlyTransaction();
-        return update != null
-                ? (dataObj instanceof Group && update instanceof Group && isNodeAvailable(identifier, trans))
-                : (dataObj instanceof Group && isNodeAvailable(identifier, trans));
-    }
-}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupProvider.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupProvider.java
deleted file mode 100644 (file)
index a999242..0000000
+++ /dev/null
@@ -1,105 +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.frm.group;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
-import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
-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.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Preconditions;
-
-/**
- * Group Provider registers the {@link GroupChangeListener} and it holds all needed
- * services for {@link GroupChangeListener}.
- *
- * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
- *
- */
-public class GroupProvider implements AutoCloseable {
-
-    private static final Logger LOG = LoggerFactory.getLogger(GroupProvider.class);
-
-    private SalGroupService salGroupService;
-    private DataBroker dataService;
-
-    /* DataChangeListener */
-    private DataChangeListener groupDataChangeListener;
-    private ListenerRegistration<DataChangeListener> groupDataChangeListenerRegistration;
-
-    /**
-     * Provider Initialization Phase.
-     *
-     * @param DataProviderService dataService
-     */
-    public void init (final DataBroker dataService) {
-        LOG.info("FRM Group Config Provider initialization.");
-        this.dataService = Preconditions.checkNotNull(dataService, "DataService can not be null !");
-    }
-
-    /**
-     * Listener Registration Phase
-     *
-     * @param RpcConsumerRegistry rpcRegistry
-     */
-    public void start(final RpcConsumerRegistry rpcRegistry) {
-        Preconditions.checkArgument(rpcRegistry != null, "RpcConsumerRegistry can not be null !");
-
-        this.salGroupService = Preconditions.checkNotNull(rpcRegistry.getRpcService(SalGroupService.class),
-                "RPC SalGroupService not found.");
-
-        /* Build Path */
-        InstanceIdentifier<Group> groupIdentifier = InstanceIdentifier.create(Nodes.class)
-                .child(Node.class).augmentation(FlowCapableNode.class).child(Group.class);
-
-        /* DataChangeListener registration */
-        this.groupDataChangeListener = new GroupChangeListener(GroupProvider.this);
-        this.groupDataChangeListenerRegistration = this.dataService.registerDataChangeListener(
-                LogicalDatastoreType.CONFIGURATION, groupIdentifier, groupDataChangeListener, DataChangeScope.SUBTREE);
-
-        LOG.info("FRM Group Config Provider started.");
-    }
-
-    @Override
-    public void close() {
-        LOG.info("FRM Group Config Provider stopped.");
-        if (groupDataChangeListenerRegistration != null) {
-            try {
-                groupDataChangeListenerRegistration.close();
-            } catch (Exception e) {
-                String errMsg = "Error by stop FRM Group Config Provider.";
-                LOG.error(errMsg, e);
-                throw new IllegalStateException(errMsg, e);
-            } finally {
-                groupDataChangeListenerRegistration = null;
-            }
-        }
-    }
-
-    public DataChangeListener getGroupDataChangeListener() {
-        return groupDataChangeListener;
-    }
-
-    public SalGroupService getSalGroupService() {
-        return salGroupService;
-    }
-
-    public DataBroker getDataService() {
-        return dataService;
-    }
-}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/impl/AbstractListeningCommiter.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/impl/AbstractListeningCommiter.java
new file mode 100644 (file)
index 0000000..ec49e61
--- /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.frm.impl;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.frm.ForwardingRulesCommiter;
+import org.opendaylight.controller.frm.ForwardingRulesManager;
+import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * AbstractChangeListner implemented basic {@link AsyncDataChangeEvent} processing for
+ * flow node subDataObject (flows, groups and meters).
+ *
+ * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
+ *
+ */
+public abstract class AbstractListeningCommiter <T extends DataObject> implements ForwardingRulesCommiter<T> {
+
+    protected ForwardingRulesManager provider;
+
+    protected final Class<T> clazz;
+
+    public AbstractListeningCommiter (ForwardingRulesManager provider, Class<T> clazz) {
+        this.provider = Preconditions.checkNotNull(provider, "ForwardingRulesManager can not be null!");
+        this.clazz = Preconditions.checkNotNull(clazz, "Class can not be null!");
+    }
+
+    @Override
+    public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> changeEvent) {
+        Preconditions.checkNotNull(changeEvent,"Async ChangeEvent can not be null!");
+
+        /* All DataObjects for create */
+        final Map<InstanceIdentifier<?>, DataObject> createdData = changeEvent.getCreatedData() != null
+                ? changeEvent.getCreatedData() : Collections.<InstanceIdentifier<?>, DataObject> emptyMap();
+        /* All DataObjects for remove */
+        final Set<InstanceIdentifier<?>> removeData = changeEvent.getRemovedPaths() != null
+                ? changeEvent.getRemovedPaths() : Collections.<InstanceIdentifier<?>> emptySet();
+        /* All DataObjects for updates */
+        final Map<InstanceIdentifier<?>, DataObject> updateData = changeEvent.getUpdatedData() != null
+                ? changeEvent.getUpdatedData() : Collections.<InstanceIdentifier<?>, DataObject> emptyMap();
+        /* All Original DataObjects */
+        final Map<InstanceIdentifier<?>, DataObject> originalData = changeEvent.getOriginalData() != null
+                ? changeEvent.getOriginalData() : Collections.<InstanceIdentifier<?>, DataObject> emptyMap();
+
+        this.createData(createdData);
+        this.updateData(updateData, originalData);
+        this.removeData(removeData, originalData);
+    }
+
+    /**
+     * Method return wildCardPath for Listener registration
+     * and for identify the correct KeyInstanceIdentifier from data;
+     */
+    protected abstract InstanceIdentifier<T> getWildCardPath();
+
+
+
+    @SuppressWarnings("unchecked")
+    private void createData(final Map<InstanceIdentifier<?>, DataObject> createdData) {
+        final Set<InstanceIdentifier<?>> keys = createdData.keySet() != null
+                ? createdData.keySet() : Collections.<InstanceIdentifier<?>> emptySet();
+        for (InstanceIdentifier<?> key : keys) {
+            if (clazz.equals(key.getTargetType())) {
+                final InstanceIdentifier<FlowCapableNode> nodeIdent =
+                        key.firstIdentifierOf(FlowCapableNode.class);
+                if (preConfigurationCheck(nodeIdent)) {
+                    InstanceIdentifier<T> createKeyIdent = key.firstIdentifierOf(clazz);
+                    final Optional<DataObject> value = Optional.of(createdData.get(key));
+                    if (value.isPresent()) {
+                        this.add(createKeyIdent, (T)value.get(), nodeIdent);
+                    }
+                }
+            }
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    private void updateData(final Map<InstanceIdentifier<?>, DataObject> updateData,
+            final Map<InstanceIdentifier<?>, DataObject> originalData) {
+
+        final Set<InstanceIdentifier<?>> keys = updateData.keySet() != null
+                ? updateData.keySet() : Collections.<InstanceIdentifier<?>> emptySet();
+        for (InstanceIdentifier<?> key : keys) {
+            if (clazz.equals(key.getTargetType())) {
+                final InstanceIdentifier<FlowCapableNode> nodeIdent =
+                        key.firstIdentifierOf(FlowCapableNode.class);
+                if (preConfigurationCheck(nodeIdent)) {
+                    InstanceIdentifier<T> updateKeyIdent = key.firstIdentifierOf(clazz);
+                    final Optional<DataObject> value = Optional.of(updateData.get(key));
+                    final Optional<DataObject> original = Optional.of(originalData.get(key));
+                    if (value.isPresent() && original.isPresent()) {
+                        this.update(updateKeyIdent, (T)original.get(), (T)value.get(), nodeIdent);
+                    }
+                }
+            }
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    private void removeData(final Set<InstanceIdentifier<?>> removeData,
+            final Map<InstanceIdentifier<?>, DataObject> originalData) {
+
+        for (InstanceIdentifier<?> key : removeData) {
+            if (clazz.equals(key.getTargetType())) {
+                final InstanceIdentifier<FlowCapableNode> nodeIdent =
+                        key.firstIdentifierOf(FlowCapableNode.class);
+                if (preConfigurationCheck(nodeIdent)) {
+                    final InstanceIdentifier<T> ident = key.firstIdentifierOf(clazz);
+                    final DataObject removeValue = originalData.get(key);
+                    this.remove(ident, (T)removeValue, nodeIdent);
+                }
+            }
+        }
+    }
+
+    private boolean preConfigurationCheck(final InstanceIdentifier<FlowCapableNode> nodeIdent) {
+        Preconditions.checkNotNull(nodeIdent, "FlowCapableNode ident can not be null!");
+        return provider.isNodeActive(nodeIdent);
+    }
+}
+
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/impl/FlowForwarder.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/impl/FlowForwarder.java
new file mode 100644 (file)
index 0000000..fd0ddec
--- /dev/null
@@ -0,0 +1,140 @@
+/**ab
+ * 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.frm.impl;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.frm.ForwardingRulesManager;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
+import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
+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.TableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowTableRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.OriginalFlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.UpdatedFlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef;
+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.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * GroupForwarder
+ * It implements {@link org.opendaylight.controller.md.sal.binding.api.DataChangeListener}}
+ * for WildCardedPath to {@link Flow} and ForwardingRulesCommiter interface for methods:
+ *  add, update and remove {@link Flow} processing for
+ *  {@link org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent}.
+ *
+ * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
+ *
+ */
+public class FlowForwarder extends AbstractListeningCommiter<Flow> {
+
+    private static final Logger LOG = LoggerFactory.getLogger(FlowForwarder.class);
+
+    private ListenerRegistration<DataChangeListener> listenerRegistration;
+
+    public FlowForwarder (final ForwardingRulesManager manager, final DataBroker db) {
+        super(manager, Flow.class);
+        Preconditions.checkNotNull(db, "DataBroker can not be null!");
+        this.listenerRegistration = db.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION,
+                getWildCardPath(), FlowForwarder.this, DataChangeScope.BASE);
+    }
+
+    @Override
+    public void close() {
+        if (listenerRegistration != null) {
+            try {
+                listenerRegistration.close();
+            } catch (Exception e) {
+                LOG.error("Error by stop FRM FlowChangeListener.", e);
+            }
+            listenerRegistration = null;
+        }
+    }
+
+    @Override
+    public void remove(final InstanceIdentifier<Flow> identifier,
+                       final Flow removeDataObj,
+                       final InstanceIdentifier<FlowCapableNode> nodeIdent) {
+
+        final TableKey tableKey = identifier.firstKeyOf(Table.class, TableKey.class);
+        if (tableIdValidationPrecondition(tableKey, removeDataObj)) {
+            final RemoveFlowInputBuilder builder = new RemoveFlowInputBuilder(removeDataObj);
+            builder.setFlowRef(new FlowRef(identifier));
+            builder.setNode(new NodeRef(nodeIdent));
+            builder.setFlowTable(new FlowTableRef(nodeIdent.child(Table.class, tableKey)));
+            builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
+            this.provider.getSalFlowService().removeFlow(builder.build());
+        }
+    }
+
+    @Override
+    public void update(final InstanceIdentifier<Flow> identifier,
+                       final Flow original, final Flow update,
+                       final InstanceIdentifier<FlowCapableNode> nodeIdent) {
+
+        final TableKey tableKey = identifier.firstKeyOf(Table.class, TableKey.class);
+        if (tableIdValidationPrecondition(tableKey, update)) {
+            final UpdateFlowInputBuilder builder = new UpdateFlowInputBuilder();
+
+            builder.setNode(new NodeRef(nodeIdent));
+            builder.setFlowRef(new FlowRef(identifier));
+            builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
+            builder.setUpdatedFlow((new UpdatedFlowBuilder(update)).build());
+            builder.setOriginalFlow((new OriginalFlowBuilder(original)).build());
+
+            this.provider.getSalFlowService().updateFlow(builder.build());
+        }
+    }
+
+    @Override
+    public void add(final InstanceIdentifier<Flow> identifier,
+                    final Flow addDataObj,
+                    final InstanceIdentifier<FlowCapableNode> nodeIdent) {
+
+        final TableKey tableKey = identifier.firstKeyOf(Table.class, TableKey.class);
+        if (tableIdValidationPrecondition(tableKey, addDataObj)) {
+            final AddFlowInputBuilder builder = new AddFlowInputBuilder(addDataObj);
+
+            builder.setNode(new NodeRef(nodeIdent));
+            builder.setFlowRef(new FlowRef(identifier));
+            builder.setFlowTable(new FlowTableRef(nodeIdent.child(Table.class, tableKey)));
+            builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
+            this.provider.getSalFlowService().addFlow(builder.build());
+        }
+    }
+
+    @Override
+    protected InstanceIdentifier<Flow> getWildCardPath() {
+        return InstanceIdentifier.create(Nodes.class).child(Node.class)
+                .augmentation(FlowCapableNode.class).child(Table.class).child(Flow.class);
+    }
+
+    private boolean tableIdValidationPrecondition (final TableKey tableKey, final Flow flow) {
+        Preconditions.checkNotNull(tableKey, "TableKey can not be null or empty!");
+        Preconditions.checkNotNull(flow, "Flow can not be null or empty!");
+        if (flow.getTableId() != tableKey.getId()) {
+            LOG.error("TableID in URI tableId={} and in palyload tableId={} is not same.",
+                    flow.getTableId(), tableKey.getId());
+            return false;
+        }
+        return true;
+    }
+}
+
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/impl/FlowNodeReconciliationImpl.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/impl/FlowNodeReconciliationImpl.java
new file mode 100644 (file)
index 0000000..f1e8dfe
--- /dev/null
@@ -0,0 +1,171 @@
+/**
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.frm.impl;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import org.opendaylight.controller.frm.FlowNodeReconciliation;
+import org.opendaylight.controller.frm.ForwardingRulesManager;
+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.ReadOnlyTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
+import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey;
+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.TableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
+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.Nodes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+
+/**
+ * forwardingrules-manager
+ * org.opendaylight.controller.frm
+ *
+ * FlowNode Reconciliation Listener
+ * Reconciliation for a new FlowNode
+ *
+ * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
+ *
+ * Created: Jun 13, 2014
+ */
+public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
+
+    private static final Logger LOG = LoggerFactory.getLogger(FlowNodeReconciliationImpl.class);
+
+    private final ForwardingRulesManager provider;
+
+    private ListenerRegistration<DataChangeListener> listenerRegistration;
+
+    public FlowNodeReconciliationImpl (final ForwardingRulesManager manager, final DataBroker db) {
+        this.provider = Preconditions.checkNotNull(manager, "ForwardingRulesManager can not be null!");
+        Preconditions.checkNotNull(db, "DataBroker can not be null!");
+        /* Build Path */
+        InstanceIdentifier<FlowCapableNode> flowNodeWildCardIdentifier = InstanceIdentifier.create(Nodes.class)
+                .child(Node.class).augmentation(FlowCapableNode.class);
+        this.listenerRegistration = db.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL,
+                flowNodeWildCardIdentifier, FlowNodeReconciliationImpl.this, DataChangeScope.BASE);
+    }
+
+    @Override
+    public void close() {
+        if (listenerRegistration != null) {
+            try {
+                listenerRegistration.close();
+            } catch (Exception e) {
+                LOG.error("Error by stop FRM FlowNodeReconilListener.", e);
+            }
+            listenerRegistration = null;
+        }
+    }
+
+    @Override
+    public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> changeEvent) {
+        Preconditions.checkNotNull(changeEvent,"Async ChangeEvent can not be null!");
+        /* All DataObjects for create */
+        final Set<InstanceIdentifier<?>>  createdData = changeEvent.getCreatedData() != null
+                ? changeEvent.getCreatedData().keySet() : Collections.<InstanceIdentifier<?>> emptySet();
+        /* All DataObjects for remove */
+        final Set<InstanceIdentifier<?>> removeData = changeEvent.getRemovedPaths() != null
+                ? changeEvent.getRemovedPaths() : Collections.<InstanceIdentifier<?>> emptySet();
+
+        for (InstanceIdentifier<?> entryKey : removeData) {
+            final InstanceIdentifier<FlowCapableNode> nodeIdent = entryKey
+                    .firstIdentifierOf(FlowCapableNode.class);
+            if ( ! nodeIdent.isWildcarded()) {
+                flowNodeDisconnected(nodeIdent);
+            }
+        }
+        for (InstanceIdentifier<?> entryKey : createdData) {
+            final InstanceIdentifier<FlowCapableNode> nodeIdent = entryKey
+                    .firstIdentifierOf(FlowCapableNode.class);
+            if ( ! nodeIdent.isWildcarded()) {
+                flowNodeConnected(nodeIdent);
+            }
+        }
+    }
+
+    @Override
+    public void flowNodeDisconnected(InstanceIdentifier<FlowCapableNode> disconnectedNode) {
+        provider.unregistrateNode(disconnectedNode);
+    }
+
+    @Override
+    public void flowNodeConnected(InstanceIdentifier<FlowCapableNode> connectedNode) {
+        if ( ! provider.isNodeActive(connectedNode)) {
+            provider.registrateNewNode(connectedNode);
+            reconciliation(connectedNode);
+        }
+    }
+
+    private void reconciliation(final InstanceIdentifier<FlowCapableNode> nodeIdent) {
+
+        ReadOnlyTransaction trans = provider.getReadTranaction();
+        Optional<FlowCapableNode> flowNode = Optional.absent();
+
+        try {
+            flowNode = trans.read(LogicalDatastoreType.CONFIGURATION, nodeIdent).get();
+        }
+        catch (Exception e) {
+            LOG.error("Fail with read Config/DS for Node {} !", nodeIdent, e);
+        }
+
+        if (flowNode.isPresent()) {
+            /* Groups - have to be first */
+            List<Group> groups = flowNode.get().getGroup() != null
+                    ? flowNode.get().getGroup() : Collections.<Group> emptyList();
+            for (Group group : groups) {
+                final KeyedInstanceIdentifier<Group, GroupKey> groupIdent =
+                        nodeIdent.child(Group.class, group.getKey());
+                this.provider.getGroupCommiter().add(groupIdent, group, nodeIdent);
+            }
+            /* Meters */
+            List<Meter> meters = flowNode.get().getMeter() != null
+                    ? flowNode.get().getMeter() : Collections.<Meter> emptyList();
+            for (Meter meter : meters) {
+                final KeyedInstanceIdentifier<Meter, MeterKey> meterIdent =
+                        nodeIdent.child(Meter.class, meter.getKey());
+                this.provider.getMeterCommiter().add(meterIdent, meter, nodeIdent);
+            }
+            /* Flows */
+            List<Table> tables = flowNode.get().getTable() != null
+                    ? flowNode.get().getTable() : Collections.<Table> emptyList();
+            for (Table table : tables) {
+                final KeyedInstanceIdentifier<Table, TableKey> tableIdent =
+                        nodeIdent.child(Table.class, table.getKey());
+                List<Flow> flows = table.getFlow() != null ? table.getFlow() : Collections.<Flow> emptyList();
+                for (Flow flow : flows) {
+                    final KeyedInstanceIdentifier<Flow, FlowKey> flowIdent =
+                            tableIdent.child(Flow.class, flow.getKey());
+                    this.provider.getFlowCommiter().add(flowIdent, flow, nodeIdent);
+                }
+            }
+        }
+        /* clean transaction */
+        trans.close();
+    }
+}
+
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/impl/ForwardingRulesManagerImpl.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/impl/ForwardingRulesManagerImpl.java
new file mode 100644 (file)
index 0000000..7cb7acf
--- /dev/null
@@ -0,0 +1,185 @@
+/**
+ * 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.frm.impl;
+
+import java.util.Collections;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.opendaylight.controller.frm.FlowNodeReconciliation;
+import org.opendaylight.controller.frm.ForwardingRulesCommiter;
+import org.opendaylight.controller.frm.ForwardingRulesManager;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
+import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Sets;
+
+/**
+ * forwardingrules-manager
+ * org.opendaylight.controller.frm.impl
+ *
+ * Manager and middle point for whole module.
+ * It contains ActiveNodeHolder and provide all RPC services.
+ *
+ * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
+ *
+ * Created: Aug 25, 2014
+ */
+public class ForwardingRulesManagerImpl implements ForwardingRulesManager {
+
+    private static final Logger LOG = LoggerFactory.getLogger(ForwardingRulesManagerImpl.class);
+
+    private final AtomicLong txNum = new AtomicLong();
+    private final Object lockObj = new Object();
+    private Set<InstanceIdentifier<FlowCapableNode>> activeNodes = Collections.emptySet();
+
+    private final DataBroker dataService;
+    private final SalFlowService salFlowService;
+    private final SalGroupService salGroupService;
+    private final SalMeterService salMeterService;
+
+    private ForwardingRulesCommiter<Flow> flowListener;
+    private ForwardingRulesCommiter<Group> groupListener;
+    private ForwardingRulesCommiter<Meter> meterListener;
+    private FlowNodeReconciliation nodeListener;
+
+    public ForwardingRulesManagerImpl(final DataBroker dataBroker,
+            final RpcConsumerRegistry rpcRegistry) {
+        this.dataService = Preconditions.checkNotNull(dataBroker, "DataBroker can not be null!");
+
+        Preconditions.checkArgument(rpcRegistry != null, "RpcConsumerRegistry can not be null !");
+
+        this.salFlowService = Preconditions.checkNotNull(rpcRegistry.getRpcService(SalFlowService.class),
+                "RPC SalFlowService not found.");
+        this.salGroupService = Preconditions.checkNotNull(rpcRegistry.getRpcService(SalGroupService.class),
+                "RPC SalGroupService not found.");
+        this.salMeterService = Preconditions.checkNotNull(rpcRegistry.getRpcService(SalMeterService.class),
+                "RPC SalMeterService not found.");
+    }
+
+    @Override
+    public void start() {
+        this.flowListener = new FlowForwarder(this, dataService);
+        this.groupListener = new GroupForwarder(this, dataService);
+        this.meterListener = new MeterForwarder(this, dataService);
+        this.nodeListener = new FlowNodeReconciliationImpl(this, dataService);
+        LOG.info("ForwardingRulesManager has started successfull.");
+    }
+
+    @Override
+    public void close() throws Exception {
+        if(this.flowListener != null) {
+            this.flowListener.close();
+            this.flowListener = null;
+        }
+        if (this.groupListener != null) {
+            this.groupListener.close();
+            this.groupListener = null;
+        }
+        if (this.meterListener != null) {
+            this.meterListener.close();
+            this.meterListener = null;
+        }
+        if (this.nodeListener != null) {
+            this.nodeListener.close();
+            this.nodeListener = null;
+        }
+    }
+
+    @Override
+    public ReadOnlyTransaction getReadTranaction() {
+        return dataService.newReadOnlyTransaction();
+    }
+
+    @Override
+    public String getNewTransactionId() {
+        return "DOM-" + txNum.getAndIncrement();
+    }
+
+    @Override
+    public boolean isNodeActive(InstanceIdentifier<FlowCapableNode> ident) {
+        return activeNodes.contains(ident);
+    }
+
+    @Override
+    public void registrateNewNode(InstanceIdentifier<FlowCapableNode> ident) {
+        if ( ! activeNodes.contains(ident)) {
+            synchronized (lockObj) {
+                if ( ! activeNodes.contains(ident)) {
+                    Set<InstanceIdentifier<FlowCapableNode>> set =
+                            Sets.newHashSet(activeNodes);
+                    set.add(ident);
+                    activeNodes = Collections.unmodifiableSet(set);
+                }
+            }
+        }
+    }
+
+    @Override
+    public void unregistrateNode(InstanceIdentifier<FlowCapableNode> ident) {
+        if (activeNodes.contains(ident)) {
+            synchronized (lockObj) {
+                if (activeNodes.contains(ident)) {
+                    Set<InstanceIdentifier<FlowCapableNode>> set =
+                            Sets.newHashSet(activeNodes);
+                    set.remove(ident);
+                    activeNodes = Collections.unmodifiableSet(set);
+                }
+            }
+        }
+    }
+
+    @Override
+    public SalFlowService getSalFlowService() {
+        return salFlowService;
+    }
+
+    @Override
+    public SalGroupService getSalGroupService() {
+        return salGroupService;
+    }
+
+    @Override
+    public SalMeterService getSalMeterService() {
+        return salMeterService;
+    }
+
+    @Override
+    public ForwardingRulesCommiter<Flow> getFlowCommiter() {
+        return flowListener;
+    }
+
+    @Override
+    public ForwardingRulesCommiter<Group> getGroupCommiter() {
+        return groupListener;
+    }
+
+    @Override
+    public ForwardingRulesCommiter<Meter> getMeterCommiter() {
+        return meterListener;
+    }
+
+    @Override
+    public FlowNodeReconciliation getFlowNodeReconciliation() {
+        return nodeListener;
+    }
+}
+
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/impl/GroupForwarder.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/impl/GroupForwarder.java
new file mode 100644 (file)
index 0000000..77ef162
--- /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.frm.impl;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.frm.ForwardingRulesManager;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
+import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.OriginalGroupBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.UpdatedGroupBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
+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.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * GroupForwarder
+ * It implements {@link org.opendaylight.controller.md.sal.binding.api.DataChangeListener}}
+ * for WildCardedPath to {@link Group} and ForwardingRulesCommiter interface for methods:
+ *  add, update and remove {@link Group} processing for
+ *  {@link org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent}.
+ *
+ * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
+ *
+ */
+public class GroupForwarder extends AbstractListeningCommiter<Group> {
+
+    private static final Logger LOG = LoggerFactory.getLogger(GroupForwarder.class);
+
+    private ListenerRegistration<DataChangeListener> listenerRegistration;
+
+    public GroupForwarder (final ForwardingRulesManager manager, final DataBroker db) {
+        super(manager, Group.class);
+        Preconditions.checkNotNull(db, "DataBroker can not be null!");
+        this.listenerRegistration = db.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION,
+                getWildCardPath(), GroupForwarder.this, DataChangeScope.BASE);
+    }
+
+    @Override
+    public void close() {
+        if (listenerRegistration != null) {
+            try {
+                listenerRegistration.close();
+            } catch (Exception e) {
+                LOG.error("Error by stop FRM GroupChangeListener.", e);
+            }
+            listenerRegistration = null;
+        }
+    }
+
+    @Override
+    protected InstanceIdentifier<Group> getWildCardPath() {
+        return InstanceIdentifier.create(Nodes.class).child(Node.class)
+                .augmentation(FlowCapableNode.class).child(Group.class);
+    }
+
+    @Override
+    public void remove(final InstanceIdentifier<Group> identifier, final Group removeDataObj,
+                       final InstanceIdentifier<FlowCapableNode> nodeIdent) {
+
+        final Group group = (removeDataObj);
+        final RemoveGroupInputBuilder builder = new RemoveGroupInputBuilder(group);
+
+        builder.setNode(new NodeRef(nodeIdent));
+        builder.setGroupRef(new GroupRef(identifier));
+        builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
+        this.provider.getSalGroupService().removeGroup(builder.build());
+    }
+
+    @Override
+    public void update(final InstanceIdentifier<Group> identifier,
+                       final Group original, final Group update,
+                       final InstanceIdentifier<FlowCapableNode> nodeIdent) {
+
+        final Group originalGroup = (original);
+        final Group updatedGroup = (update);
+        final UpdateGroupInputBuilder builder = new UpdateGroupInputBuilder();
+
+        builder.setNode(new NodeRef(nodeIdent));
+        builder.setGroupRef(new GroupRef(identifier));
+        builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
+        builder.setUpdatedGroup((new UpdatedGroupBuilder(updatedGroup)).build());
+        builder.setOriginalGroup((new OriginalGroupBuilder(originalGroup)).build());
+
+        this.provider.getSalGroupService().updateGroup(builder.build());
+    }
+
+    @Override
+    public void add(final InstanceIdentifier<Group> identifier, final Group addDataObj,
+                    final InstanceIdentifier<FlowCapableNode> nodeIdent) {
+
+        final Group group = (addDataObj);
+        final AddGroupInputBuilder builder = new AddGroupInputBuilder(group);
+
+        builder.setNode(new NodeRef(nodeIdent));
+        builder.setGroupRef(new GroupRef(identifier));
+        builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
+        this.provider.getSalGroupService().addGroup(builder.build());
+    }
+}
+
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/impl/MeterForwarder.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/impl/MeterForwarder.java
new file mode 100644 (file)
index 0000000..9511fb8
--- /dev/null
@@ -0,0 +1,114 @@
+/**
+ * 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.frm.impl;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.frm.ForwardingRulesManager;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
+import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
+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.meter.service.rev130918.AddMeterInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.OriginalMeterBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeterBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * MeterForwarder
+ * It implements {@link org.opendaylight.controller.md.sal.binding.api.DataChangeListener}}
+ * for WildCardedPath to {@link Meter} and ForwardingRulesCommiter interface for methods:
+ *  add, update and remove {@link Meter} processing for
+ *  {@link org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent}.
+ *
+ * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
+ *
+ */
+public class MeterForwarder extends AbstractListeningCommiter<Meter> {
+
+    private static final Logger LOG = LoggerFactory.getLogger(MeterForwarder.class);
+
+    private ListenerRegistration<DataChangeListener> listenerRegistration;
+
+    public MeterForwarder (final ForwardingRulesManager manager, final DataBroker db) {
+        super(manager, Meter.class);
+        Preconditions.checkNotNull(db, "DataBroker can not be null!");
+        this.listenerRegistration = db.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION,
+                getWildCardPath(), MeterForwarder.this, DataChangeScope.BASE);
+    }
+
+    @Override
+    public void close() {
+        if (listenerRegistration != null) {
+            try {
+                listenerRegistration.close();
+            } catch (Exception e) {
+                LOG.error("Error by stop FRM MeterChangeListener.", e);
+            }
+            listenerRegistration = null;
+        }
+    }
+
+    @Override
+    protected InstanceIdentifier<Meter> getWildCardPath() {
+        return InstanceIdentifier.create(Nodes.class).child(Node.class)
+                .augmentation(FlowCapableNode.class).child(Meter.class);
+    }
+
+    @Override
+    public void remove(final InstanceIdentifier<Meter> identifier, final Meter removeDataObj,
+                       final InstanceIdentifier<FlowCapableNode> nodeIdent) {
+
+        final RemoveMeterInputBuilder builder = new RemoveMeterInputBuilder(removeDataObj);
+
+        builder.setNode(new NodeRef(nodeIdent));
+        builder.setMeterRef(new MeterRef(identifier));
+        builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
+        this.provider.getSalMeterService().removeMeter(builder.build());
+    }
+
+    @Override
+    public void update(final InstanceIdentifier<Meter> identifier,
+                       final Meter original, final Meter update,
+                       final InstanceIdentifier<FlowCapableNode> nodeIdent) {
+
+        final UpdateMeterInputBuilder builder = new UpdateMeterInputBuilder();
+
+        builder.setNode(new NodeRef(nodeIdent));
+        builder.setMeterRef(new MeterRef(identifier));
+        builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
+        builder.setUpdatedMeter((new UpdatedMeterBuilder(update)).build());
+        builder.setOriginalMeter((new OriginalMeterBuilder(original)).build());
+
+        this.provider.getSalMeterService().updateMeter(builder.build());
+    }
+
+    @Override
+    public void add(final InstanceIdentifier<Meter> identifier, final Meter addDataObj,
+                    final InstanceIdentifier<FlowCapableNode> nodeIdent) {
+
+        final AddMeterInputBuilder builder = new AddMeterInputBuilder(addDataObj);
+
+        builder.setNode(new NodeRef(nodeIdent));
+        builder.setMeterRef(new MeterRef(identifier));
+        builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
+        this.provider.getSalMeterService().addMeter(builder.build());
+    }
+}
+
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterChangeListener.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterChangeListener.java
deleted file mode 100644 (file)
index a2def84..0000000
+++ /dev/null
@@ -1,112 +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.frm.meter;
-
-import org.opendaylight.controller.frm.AbstractChangeListener;
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.OriginalMeterBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeterBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.Meter;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Preconditions;
-
-/**
- * Meter Change Listener
- *  add, update and remove {@link Meter} processing from {@link org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent}.
- *
- * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
- *
- */
-public class MeterChangeListener extends AbstractChangeListener {
-
-    private static final Logger LOG = LoggerFactory.getLogger(MeterChangeListener.class);
-
-    private final MeterProvider provider;
-
-    public MeterChangeListener (final MeterProvider provider) {
-        this.provider = Preconditions.checkNotNull(provider, "MeterProvider can not be null !");
-    }
-
-    @Override
-    protected void remove(final InstanceIdentifier<? extends DataObject> identifier,
-                          final DataObject removeDataObj) {
-
-        final Meter meter = ((Meter) removeDataObj);
-        final InstanceIdentifier<Node> nodeIdent = identifier.firstIdentifierOf(Node.class);
-        final RemoveMeterInputBuilder builder = new RemoveMeterInputBuilder(meter);
-
-        builder.setNode(new NodeRef(nodeIdent));
-        builder.setMeterRef(new MeterRef(identifier));
-
-        Uri uri = new Uri(this.getTransactionId());
-        builder.setTransactionUri(uri);
-        this.provider.getSalMeterService().removeMeter(builder.build());
-        LOG.debug("Transaction {} - Remove Meter has removed meter: {}", new Object[]{uri, removeDataObj});
-    }
-
-    @Override
-    protected void update(final InstanceIdentifier<? extends DataObject> identifier,
-                          final DataObject original, final DataObject update) {
-
-        final Meter originalMeter = ((Meter) original);
-        final Meter updatedMeter = ((Meter) update);
-        final InstanceIdentifier<Node> nodeInstanceId = identifier.firstIdentifierOf(Node.class);
-        final UpdateMeterInputBuilder builder = new UpdateMeterInputBuilder();
-
-        builder.setNode(new NodeRef(nodeInstanceId));
-        builder.setMeterRef(new MeterRef(identifier));
-
-        Uri uri = new Uri(this.getTransactionId());
-        builder.setTransactionUri(uri);
-
-        builder.setUpdatedMeter((new UpdatedMeterBuilder(updatedMeter)).build());
-        builder.setOriginalMeter((new OriginalMeterBuilder(originalMeter)).build());
-
-        this.provider.getSalMeterService().updateMeter(builder.build());
-        LOG.debug("Transaction {} - Update Meter has updated meter {} with {}", new Object[]{uri, original, update});
-
-    }
-
-    @Override
-    protected void add(final InstanceIdentifier<? extends DataObject> identifier,
-                       final DataObject addDataObj) {
-
-        final Meter meter = ((Meter) addDataObj);
-        final InstanceIdentifier<Node> nodeInstanceId = identifier.firstIdentifierOf(Node.class);
-        final AddMeterInputBuilder builder = new AddMeterInputBuilder(meter);
-
-        builder.setNode(new NodeRef(nodeInstanceId));
-        builder.setMeterRef(new MeterRef(identifier));
-
-        Uri uri = new Uri(this.getTransactionId());
-        builder.setTransactionUri(uri);
-        this.provider.getSalMeterService().addMeter(builder.build());
-        LOG.debug("Transaction {} - Add Meter has added meter: {}", new Object[]{uri, addDataObj});
-    }
-
-    @Override
-    protected boolean preconditionForChange(final InstanceIdentifier<? extends DataObject> identifier,
-            final DataObject dataObj, final DataObject update) {
-
-        final ReadOnlyTransaction trans = this.provider.getDataService().newReadOnlyTransaction();
-        return update != null
-                ? (dataObj instanceof Meter && update instanceof Meter && isNodeAvailable(identifier, trans))
-                : (dataObj instanceof Meter && isNodeAvailable(identifier, trans));
-    }
-}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterProvider.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterProvider.java
deleted file mode 100644 (file)
index 44de7af..0000000
+++ /dev/null
@@ -1,105 +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.frm.meter;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
-import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
-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.meter.service.rev130918.SalMeterService;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Preconditions;
-
-/**
- * Meter Provider registers the {@link MeterChangeListener} and it holds all needed
- * services for {@link MeterChangeListener}.
- *
- * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
- *
- */
-public class MeterProvider implements AutoCloseable {
-
-    private static final Logger LOG = LoggerFactory.getLogger(MeterProvider.class);
-
-    private SalMeterService salMeterService;
-    private DataBroker dataService;
-
-    /* DataChangeListener */
-    private DataChangeListener meterDataChangeListener;
-    private ListenerRegistration<DataChangeListener> meterDataChangeListenerRegistration;
-
-    /**
-     * Provider Initialization Phase.
-     *
-     * @param DataProviderService dataService
-     */
-    public void init(final DataBroker dataService) {
-        LOG.info("FRM Meter Config Provider initialization.");
-        this.dataService = Preconditions.checkNotNull(dataService, "DataProviderService can not be null !");
-    }
-
-    /**
-     * Listener Registration Phase
-     *
-     * @param RpcConsumerRegistry rpcRegistry
-     */
-    public void start(final RpcConsumerRegistry rpcRegistry) {
-        Preconditions.checkArgument(rpcRegistry != null, "RpcConsumerRegistry can not be null !");
-        this.salMeterService = Preconditions.checkNotNull(rpcRegistry.getRpcService(SalMeterService.class),
-                "RPC SalMeterService not found.");
-
-        /* Build Path */
-        InstanceIdentifier<Meter> meterIdentifier = InstanceIdentifier.create(Nodes.class)
-                .child(Node.class).augmentation(FlowCapableNode.class).child(Meter.class);
-
-        /* DataChangeListener registration */
-        this.meterDataChangeListener = new MeterChangeListener(MeterProvider.this);
-        this.meterDataChangeListenerRegistration =
-                this.dataService.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION,
-                        meterIdentifier, meterDataChangeListener, DataChangeScope.SUBTREE);
-
-        LOG.info("FRM Meter Config Provider started.");
-    }
-
-    @Override
-    public void close() {
-        LOG.info("FRM Meter Config Provider stopped.");
-        if (meterDataChangeListenerRegistration != null) {
-            try {
-                meterDataChangeListenerRegistration.close();
-            } catch (Exception e) {
-                String errMsg = "Error by stop FRM Meter Config Provider.";
-                LOG.error(errMsg, e);
-                throw new IllegalStateException(errMsg, e);
-            } finally {
-                meterDataChangeListenerRegistration = null;
-            }
-        }
-    }
-
-    public DataChangeListener getMeterDataChangeListener() {
-        return meterDataChangeListener;
-    }
-
-    public DataBroker getDataService() {
-        return dataService;
-    }
-
-    public SalMeterService getSalMeterService() {
-        return salMeterService;
-    }
-}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/reconil/FlowNodeReconcilListener.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/reconil/FlowNodeReconcilListener.java
deleted file mode 100644 (file)
index 6308f2a..0000000
+++ /dev/null
@@ -1,196 +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.frm.reconil;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.ListenableFuture;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-import org.opendaylight.controller.frm.AbstractChangeListener;
-import org.opendaylight.controller.frm.FlowCookieProducer;
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
-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.flow.service.rev130819.AddFlowInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowTableRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * forwardingrules-manager
- * org.opendaylight.controller.frm
- *
- * FlowNode Reconciliation Listener
- * Reconciliation for a new FlowNode
- * Remove CookieMapKey for removed FlowNode
- *
- * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
- *
- * Created: Jun 13, 2014
- */
-public class FlowNodeReconcilListener extends AbstractChangeListener {
-
-    private static final Logger LOG = LoggerFactory.getLogger(FlowNodeReconcilListener.class);
-
-    private final FlowNodeReconcilProvider provider;
-
-    public FlowNodeReconcilListener(final FlowNodeReconcilProvider provider) {
-        this.provider = Preconditions.checkNotNull(provider, "Flow Node Reconcil Provider can not be null!");
-    }
-
-    @Override
-    public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> changeEvent) {
-        /* FlowCapableNode DataObjects for reconciliation */
-        final Set<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> createdEntries =
-                changeEvent.getCreatedData().entrySet();
-        /* FlowCapableNode DataObjects for clean FlowCookieHolder */
-        final Set<InstanceIdentifier<? extends DataObject>> removeEntriesInstanceIdentifiers =
-                changeEvent.getRemovedPaths();
-        for (final Entry<InstanceIdentifier<? extends DataObject>, DataObject> createdEntry : createdEntries) {
-            InstanceIdentifier<? extends DataObject> entryKey = createdEntry.getKey();
-            DataObject entryValue = createdEntry.getValue();
-            if (preconditionForChange(entryKey, entryValue, null)) {
-                this.add(entryKey, entryValue);
-            }
-        }
-        for (final InstanceIdentifier<?> instanceId : removeEntriesInstanceIdentifiers) {
-            Map<InstanceIdentifier<? extends DataObject>, DataObject> origConfigData =
-                    changeEvent.getOriginalData();
-            final DataObject removeValue = origConfigData.get(instanceId);
-            if (preconditionForChange(instanceId, removeValue, null)) {
-                this.remove(instanceId, removeValue);
-            }
-        }
-    }
-
-    @Override
-    /* Cleaning FlowCookieManager holder for all node tables */
-    protected void remove(final InstanceIdentifier<? extends DataObject> identifier,
-                          final DataObject removeDataObj) {
-
-        final InstanceIdentifier<FlowCapableNode> flowNodeIdent =
-                identifier.firstIdentifierOf(FlowCapableNode.class);
-        final FlowCapableNode flowNode = ((FlowCapableNode) removeDataObj);
-
-        for (Table flowTable : flowNode.getTable()) {
-            final InstanceIdentifier<Table> tableIdent =
-                    flowNodeIdent.child(Table.class, flowTable.getKey());
-            FlowCookieProducer.INSTANCE.clean(tableIdent);
-        }
-    }
-
-    @Override
-    /* Reconciliation by connect new FlowCapableNode */
-    protected void add(final InstanceIdentifier<? extends DataObject> identifier,
-                       final DataObject addDataObj) {
-
-        final InstanceIdentifier<FlowCapableNode> flowNodeIdent =
-                identifier.firstIdentifierOf(FlowCapableNode.class);
-        final Optional<FlowCapableNode> flowCapNode = this.readFlowCapableNode(flowNodeIdent);
-
-        if (flowCapNode.isPresent()) {
-            final InstanceIdentifier<Node> nodeIdent = identifier.firstIdentifierOf(Node.class);
-            final NodeRef nodeRef = new NodeRef(nodeIdent);
-            /* Groups - have to be first */
-            List<Group> groups = flowCapNode.get().getGroup();
-            if(groups != null) {
-                for (Group group : groups) {
-                    final GroupRef groupRef = new GroupRef(flowNodeIdent.child(Group.class, group.getKey()));
-                    final AddGroupInputBuilder groupBuilder = new AddGroupInputBuilder(group);
-                    groupBuilder.setGroupRef(groupRef);
-                    groupBuilder.setNode(nodeRef);
-                    this.provider.getSalGroupService().addGroup(groupBuilder.build());
-                }
-            }
-            /* Meters */
-            List<Meter> meters = flowCapNode.get().getMeter();
-            if(meters != null) {
-                for (Meter meter : meters) {
-                    final MeterRef meterRef = new MeterRef(flowNodeIdent.child(Meter.class, meter.getKey()));
-                    final AddMeterInputBuilder meterBuilder = new AddMeterInputBuilder(meter);
-                    meterBuilder.setMeterRef(meterRef);
-                    meterBuilder.setNode(nodeRef);
-                    this.provider.getSalMeterService().addMeter(meterBuilder.build());
-                }
-            }
-            /* Flows */
-            List<Table> tables = flowCapNode.get().getTable();
-            if(tables != null) {
-                for (Table flowTable : tables) {
-                    final InstanceIdentifier<Table> tableIdent = flowNodeIdent.child(Table.class, flowTable.getKey());
-                    List<Flow> flows = flowTable.getFlow();
-                    if(flows != null) {
-                        for (Flow flow : flows) {
-                            final FlowCookie flowCookie = new FlowCookie(FlowCookieProducer.INSTANCE.getNewCookie(tableIdent));
-                            final FlowRef flowRef = new FlowRef(tableIdent.child(Flow.class, flow.getKey()));
-                            final FlowTableRef flowTableRef = new FlowTableRef(tableIdent);
-                            final AddFlowInputBuilder flowBuilder = new AddFlowInputBuilder(flow);
-                            flowBuilder.setCookie(flowCookie);
-                            flowBuilder.setNode(nodeRef);
-                            flowBuilder.setFlowTable(flowTableRef);
-                            flowBuilder.setFlowRef(flowRef);
-                            this.provider.getSalFlowService().addFlow(flowBuilder.build());
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    @Override
-    protected void update(final InstanceIdentifier<? extends DataObject> identifier,
-                          final DataObject original, final DataObject update) {
-        // NOOP - Listener is registered for DataChangeScope.BASE only
-    }
-
-    @Override
-    protected boolean preconditionForChange(final InstanceIdentifier<? extends DataObject> identifier,
-                                            final DataObject dataObj, final DataObject update) {
-        return (dataObj instanceof FlowCapableNode);
-    }
-
-    private Optional<FlowCapableNode> readFlowCapableNode(final InstanceIdentifier<FlowCapableNode> flowNodeIdent) {
-        ReadOnlyTransaction readTrans = this.provider.getDataService().newReadOnlyTransaction();
-        try {
-            ListenableFuture<Optional<FlowCapableNode>> confFlowNode =
-                    readTrans.read(LogicalDatastoreType.CONFIGURATION, flowNodeIdent);
-            if (confFlowNode.get().isPresent()) {
-                return Optional.<FlowCapableNode> of(confFlowNode.get().get());
-            } else {
-                return Optional.absent();
-            }
-        }
-        catch (InterruptedException | ExecutionException e) {
-            LOG.error("Unexpected exception by reading flow ".concat(flowNodeIdent.toString()), e);
-            return Optional.absent();
-        }
-        finally {
-            readTrans.close();
-        }
-    }
-}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/reconil/FlowNodeReconcilProvider.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/reconil/FlowNodeReconcilProvider.java
deleted file mode 100644 (file)
index ad970d6..0000000
+++ /dev/null
@@ -1,115 +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.frm.reconil;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
-import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
-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.meter.service.rev130918.SalMeterService;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Preconditions;
-
-/**
- * forwardingrules-manager
- * org.opendaylight.controller.frm
- *
- * FlowNode Reconciliation Provider registers the FlowNodeReconilListener
- * and it holds all needed services for FlowNodeReconcilListener.
- *
- * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
- *
- * Created: Jun 13, 2014
- */
-public class FlowNodeReconcilProvider implements AutoCloseable {
-
-    private static final Logger LOG = LoggerFactory.getLogger(FlowNodeReconcilProvider.class);
-
-    private SalFlowService salFlowService;
-    private SalMeterService salMeterService;
-    private SalGroupService salGroupService;
-    private DataBroker dataService;
-
-    /* DataChangeListener */
-    private DataChangeListener flowNodeReconcilListener;
-    private ListenerRegistration<DataChangeListener> flowNodeReconcilListenerRegistration;
-
-    public void init (final DataBroker dataService) {
-        LOG.info("FRM Flow Node Config Reconcil Provider initialization.");
-
-        this.dataService = Preconditions.checkNotNull(dataService, "DataProviderService can not be null !");
-    }
-
-    public void start( final RpcConsumerRegistry rpcRegistry ) {
-        Preconditions.checkArgument(rpcRegistry != null, "RpcConcumerRegistry can not be null !");
-
-        this.salFlowService = Preconditions.checkNotNull(rpcRegistry.getRpcService(SalFlowService.class),
-                "RPC SalFlowService not found.");
-        this.salMeterService = Preconditions.checkNotNull(rpcRegistry.getRpcService(SalMeterService.class),
-                "RPC SalMeterService not found.");
-        this.salGroupService = Preconditions.checkNotNull(rpcRegistry.getRpcService(SalGroupService.class),
-                "RPC SalGroupService not found.");
-
-        /* Build Path */
-        InstanceIdentifier<FlowCapableNode> flowCapableNodeIdent =
-                InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class);
-
-        /* ReconcilNotificationListener registration */
-        this.flowNodeReconcilListener = new FlowNodeReconcilListener(FlowNodeReconcilProvider.this);
-        this.flowNodeReconcilListenerRegistration = this.dataService.registerDataChangeListener(
-                LogicalDatastoreType.OPERATIONAL, flowCapableNodeIdent, flowNodeReconcilListener, DataChangeScope.BASE);
-        LOG.info("FRM Flow Node Config Reconcil Provider started.");
-    }
-
-    @Override
-    public void close() {
-        LOG.info("FRM Flow Node Config Reconcil Provider stopped.");
-        if (flowNodeReconcilListenerRegistration != null) {
-            try {
-                flowNodeReconcilListenerRegistration.close();
-            } catch (Exception e) {
-                String errMsg = "Error by stop FRM Flow Node Config Reconcil Provider.";
-                LOG.error(errMsg, e);
-                throw new IllegalStateException(errMsg, e);
-            } finally {
-                flowNodeReconcilListenerRegistration = null;
-            }
-        }
-    }
-
-    public DataChangeListener getFlowNodeReconcilListener() {
-        return flowNodeReconcilListener;
-    }
-
-    public DataBroker getDataService() {
-        return dataService;
-    }
-
-    public SalFlowService getSalFlowService() {
-        return salFlowService;
-    }
-
-    public SalMeterService getSalMeterService() {
-        return salMeterService;
-    }
-
-    public SalGroupService getSalGroupService() {
-        return salGroupService;
-    }
-}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/FlowListenerTest.java b/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/FlowListenerTest.java
new file mode 100644 (file)
index 0000000..85f4b14
--- /dev/null
@@ -0,0 +1,210 @@
+/**
+ * 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 test.mock;
+
+import org.junit.Test;
+import org.opendaylight.controller.frm.impl.ForwardingRulesManagerImpl;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
+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.TableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
+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.model.match.types.rev131026.match.IpMatch;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import test.mock.util.FRMTest;
+import test.mock.util.RpcProviderRegistryMock;
+import test.mock.util.SalFlowServiceMock;
+
+import java.util.Collections;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+public class FlowListenerTest extends FRMTest {
+    RpcProviderRegistry rpcProviderRegistryMock = new RpcProviderRegistryMock();
+    NodeKey s1Key = new NodeKey(new NodeId("S1"));
+    TableKey tableKey = new TableKey((short) 2);
+
+    @Test
+    public void addTwoFlowsTest() throws Exception {
+        ForwardingRulesManagerImpl forwardingRulesManager = new ForwardingRulesManagerImpl(getDataBroker(), rpcProviderRegistryMock);
+        forwardingRulesManager.start();
+
+        addFlowCapableNode(s1Key);
+
+        FlowKey flowKey = new FlowKey(new FlowId("test_Flow"));
+        InstanceIdentifier<Table> tableII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Table.class, tableKey);
+        InstanceIdentifier<Flow> flowII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Table.class, tableKey).child(Flow.class, flowKey);
+        Table table = new TableBuilder().setKey(tableKey).setFlow(Collections.<Flow>emptyList()).build();
+        Flow flow = new FlowBuilder().setKey(flowKey).setTableId((short) 2).build();
+
+        WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, tableII, table);
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, flowII, flow);
+        assertCommit(writeTx.submit());
+        SalFlowServiceMock salFlowService = (SalFlowServiceMock) forwardingRulesManager.getSalFlowService();
+        List<AddFlowInput> addFlowCalls = salFlowService.getAddFlowCalls();
+        assertEquals(1, addFlowCalls.size());
+        assertEquals("DOM-0", addFlowCalls.get(0).getTransactionUri().getValue());
+
+        flowKey = new FlowKey(new FlowId("test_Flow2"));
+        flowII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Table.class, tableKey).child(Flow.class, flowKey);
+        flow = new FlowBuilder().setKey(flowKey).setTableId((short) 2).build();
+        writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, flowII, flow);
+        assertCommit(writeTx.submit());
+        salFlowService = (SalFlowServiceMock) forwardingRulesManager.getSalFlowService();
+        addFlowCalls = salFlowService.getAddFlowCalls();
+        assertEquals(2, addFlowCalls.size());
+        assertEquals("DOM-1", addFlowCalls.get(1).getTransactionUri().getValue());
+        assertEquals(2, addFlowCalls.get(1).getTableId().intValue());
+        assertEquals(flowII, addFlowCalls.get(1).getFlowRef().getValue());
+
+        forwardingRulesManager.close();
+    }
+
+    @Test
+    public void updateFlowTest() throws Exception {
+        ForwardingRulesManagerImpl forwardingRulesManager = new ForwardingRulesManagerImpl(getDataBroker(), rpcProviderRegistryMock);
+        forwardingRulesManager.start();
+
+        addFlowCapableNode(s1Key);
+
+        FlowKey flowKey = new FlowKey(new FlowId("test_Flow"));
+        InstanceIdentifier<Table> tableII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Table.class, tableKey);
+        InstanceIdentifier<Flow> flowII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Table.class, tableKey).child(Flow.class, flowKey);
+        Table table = new TableBuilder().setKey(tableKey).setFlow(Collections.<Flow>emptyList()).build();
+        Flow flow = new FlowBuilder().setKey(flowKey).setTableId((short) 2).build();
+
+        WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, tableII, table);
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, flowII, flow);
+        assertCommit(writeTx.submit());
+        SalFlowServiceMock salFlowService = (SalFlowServiceMock) forwardingRulesManager.getSalFlowService();
+        List<AddFlowInput> addFlowCalls = salFlowService.getAddFlowCalls();
+        assertEquals(1, addFlowCalls.size());
+        assertEquals("DOM-0", addFlowCalls.get(0).getTransactionUri().getValue());
+
+        flowKey = new FlowKey(new FlowId("test_Flow"));
+        flowII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Table.class, tableKey).child(Flow.class, flowKey);
+        flow = new FlowBuilder().setKey(flowKey).setTableId((short) 2).setOutGroup((long) 5).build();
+        writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, flowII, flow);
+        assertCommit(writeTx.submit());
+        salFlowService = (SalFlowServiceMock) forwardingRulesManager.getSalFlowService();
+        List<UpdateFlowInput> updateFlowCalls = salFlowService.getUpdateFlowCalls();
+        assertEquals(1, updateFlowCalls.size());
+        assertEquals("DOM-1", updateFlowCalls.get(0).getTransactionUri().getValue());
+        assertEquals(flowII, updateFlowCalls.get(0).getFlowRef().getValue());
+
+        forwardingRulesManager.close();
+    }
+
+    @Test
+    public void updateFlowScopeTest() throws Exception {
+        ForwardingRulesManagerImpl forwardingRulesManager = new ForwardingRulesManagerImpl(getDataBroker(), rpcProviderRegistryMock);
+        forwardingRulesManager.start();
+
+        addFlowCapableNode(s1Key);
+
+        FlowKey flowKey = new FlowKey(new FlowId("test_Flow"));
+        InstanceIdentifier<Table> tableII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Table.class, tableKey);
+        InstanceIdentifier<Flow> flowII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Table.class, tableKey).child(Flow.class, flowKey);
+        Table table = new TableBuilder().setKey(tableKey).setFlow(Collections.<Flow>emptyList()).build();
+        IpMatch ipMatch = new IpMatchBuilder().setIpDscp(new Dscp((short)4)).build();
+        Match match = new MatchBuilder().setIpMatch(ipMatch).build();
+        Flow flow = new FlowBuilder().setMatch(match).setKey(flowKey).setTableId((short) 2).build();
+
+        WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, tableII, table);
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, flowII, flow);
+        assertCommit(writeTx.submit());
+        SalFlowServiceMock salFlowService = (SalFlowServiceMock) forwardingRulesManager.getSalFlowService();
+        List<AddFlowInput> addFlowCalls = salFlowService.getAddFlowCalls();
+        assertEquals(1, addFlowCalls.size());
+        assertEquals("DOM-0", addFlowCalls.get(0).getTransactionUri().getValue());
+
+        flowKey = new FlowKey(new FlowId("test_Flow"));
+        flowII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Table.class, tableKey).child(Flow.class, flowKey);
+        ipMatch = new IpMatchBuilder().setIpDscp(new Dscp((short)5)).build();
+        match = new MatchBuilder().setIpMatch(ipMatch).build();
+        flow = new FlowBuilder().setMatch(match).setKey(flowKey).setTableId((short) 2).build();
+        writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, flowII, flow);
+        assertCommit(writeTx.submit());
+        salFlowService = (SalFlowServiceMock) forwardingRulesManager.getSalFlowService();
+        List<UpdateFlowInput> updateFlowCalls = salFlowService.getUpdateFlowCalls();
+        assertEquals(1, updateFlowCalls.size());
+        assertEquals("DOM-1", updateFlowCalls.get(0).getTransactionUri().getValue());
+        assertEquals(flowII, updateFlowCalls.get(0).getFlowRef().getValue());
+        assertEquals(ipMatch, updateFlowCalls.get(0).getUpdatedFlow().getMatch().getIpMatch());
+        forwardingRulesManager.close();
+    }
+
+    @Test
+    public void deleteFlowTest() throws Exception {
+        ForwardingRulesManagerImpl forwardingRulesManager = new ForwardingRulesManagerImpl(getDataBroker(), rpcProviderRegistryMock);
+        forwardingRulesManager.start();
+
+        addFlowCapableNode(s1Key);
+
+        FlowKey flowKey = new FlowKey(new FlowId("test_Flow"));
+        InstanceIdentifier<Table> tableII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Table.class, tableKey);
+        InstanceIdentifier<Flow> flowII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Table.class, tableKey).child(Flow.class, flowKey);
+        Table table = new TableBuilder().setKey(tableKey).setFlow(Collections.<Flow>emptyList()).build();
+        Flow flow = new FlowBuilder().setKey(flowKey).setTableId((short) 2).build();
+
+        WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, tableII, table);
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, flowII, flow);
+        assertCommit(writeTx.submit());
+        SalFlowServiceMock salFlowService = (SalFlowServiceMock) forwardingRulesManager.getSalFlowService();
+        List<AddFlowInput> addFlowCalls = salFlowService.getAddFlowCalls();
+        assertEquals(1, addFlowCalls.size());
+        assertEquals("DOM-0", addFlowCalls.get(0).getTransactionUri().getValue());
+
+        writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.delete(LogicalDatastoreType.CONFIGURATION, flowII);
+        assertCommit(writeTx.submit());
+        salFlowService = (SalFlowServiceMock) forwardingRulesManager.getSalFlowService();
+        List<RemoveFlowInput> removeFlowCalls = salFlowService.getRemoveFlowCalls();
+        assertEquals(1, removeFlowCalls.size());
+        assertEquals("DOM-1", removeFlowCalls.get(0).getTransactionUri().getValue());
+        assertEquals(flowII, removeFlowCalls.get(0).getFlowRef().getValue());
+
+        forwardingRulesManager.close();
+    }
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/GroupListenerTest.java b/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/GroupListenerTest.java
new file mode 100644 (file)
index 0000000..97eb899
--- /dev/null
@@ -0,0 +1,137 @@
+/**
+ * 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 test.mock;
+
+import org.junit.Test;
+import org.opendaylight.controller.frm.impl.ForwardingRulesManagerImpl;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInput;
+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.GroupBuilder;
+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.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.yang.binding.InstanceIdentifier;
+import test.mock.util.FRMTest;
+import test.mock.util.RpcProviderRegistryMock;
+import test.mock.util.SalGroupServiceMock;
+
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+public class GroupListenerTest extends FRMTest {
+    RpcProviderRegistry rpcProviderRegistryMock = new RpcProviderRegistryMock();
+    NodeKey s1Key = new NodeKey(new NodeId("S1"));
+
+    @Test
+    public void addTwoGroupsTest() throws Exception {
+        ForwardingRulesManagerImpl forwardingRulesManager = new ForwardingRulesManagerImpl(getDataBroker(), rpcProviderRegistryMock);
+        forwardingRulesManager.start();
+
+        addFlowCapableNode(s1Key);
+
+        GroupKey groupKey = new GroupKey(new GroupId((long) 255));
+        InstanceIdentifier<Group> groupII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Group.class, groupKey);
+        Group group = new GroupBuilder().setKey(groupKey).setGroupName("Group1").build();
+
+        WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, groupII, group);
+        assertCommit(writeTx.submit());
+        SalGroupServiceMock salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
+        List<AddGroupInput> addGroupCalls = salGroupService.getAddGroupCalls();
+        assertEquals(1, addGroupCalls.size());
+        assertEquals("DOM-0", addGroupCalls.get(0).getTransactionUri().getValue());
+
+        groupKey = new GroupKey(new GroupId((long) 256));
+        groupII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Group.class, groupKey);
+        group = new GroupBuilder().setKey(groupKey).setGroupName("Group1").build();
+        writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, groupII, group);
+        assertCommit(writeTx.submit());
+        salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
+        addGroupCalls = salGroupService.getAddGroupCalls();
+        assertEquals(2, addGroupCalls.size());
+        assertEquals("DOM-1", addGroupCalls.get(1).getTransactionUri().getValue());
+
+        forwardingRulesManager.close();
+    }
+
+    @Test
+    public void updateGroupTest() throws Exception {
+        ForwardingRulesManagerImpl forwardingRulesManager = new ForwardingRulesManagerImpl(getDataBroker(), rpcProviderRegistryMock);
+        forwardingRulesManager.start();
+
+        addFlowCapableNode(s1Key);
+
+        GroupKey groupKey = new GroupKey(new GroupId((long) 255));
+        InstanceIdentifier<Group> groupII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Group.class, groupKey);
+        Group group = new GroupBuilder().setKey(groupKey).setGroupName("Group1").build();
+
+        WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, groupII, group);
+        assertCommit(writeTx.submit());
+        SalGroupServiceMock salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
+        List<AddGroupInput> addGroupCalls = salGroupService.getAddGroupCalls();
+        assertEquals(1, addGroupCalls.size());
+        assertEquals("DOM-0", addGroupCalls.get(0).getTransactionUri().getValue());
+
+        group = new GroupBuilder().setKey(groupKey).setGroupName("Group2").build();
+        writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, groupII, group);
+        assertCommit(writeTx.submit());
+        salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
+        List<UpdateGroupInput> updateGroupCalls = salGroupService.getUpdateGroupCalls();
+        assertEquals(1, updateGroupCalls.size());
+        assertEquals("DOM-1", updateGroupCalls.get(0).getTransactionUri().getValue());
+
+        forwardingRulesManager.close();
+    }
+
+    @Test
+    public void removeGroupTest() throws Exception {
+        ForwardingRulesManagerImpl forwardingRulesManager = new ForwardingRulesManagerImpl(getDataBroker(), rpcProviderRegistryMock);
+        forwardingRulesManager.start();
+
+        addFlowCapableNode(s1Key);
+
+        GroupKey groupKey = new GroupKey(new GroupId((long) 255));
+        InstanceIdentifier<Group> groupII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Group.class, groupKey);
+        Group group = new GroupBuilder().setKey(groupKey).setGroupName("Group1").build();
+
+        WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, groupII, group);
+        assertCommit(writeTx.submit());
+        SalGroupServiceMock salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
+        List<AddGroupInput> addGroupCalls = salGroupService.getAddGroupCalls();
+        assertEquals(1, addGroupCalls.size());
+        assertEquals("DOM-0", addGroupCalls.get(0).getTransactionUri().getValue());
+
+        writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.delete(LogicalDatastoreType.CONFIGURATION, groupII);
+        assertCommit(writeTx.submit());
+        salGroupService = (SalGroupServiceMock) forwardingRulesManager.getSalGroupService();
+        List<RemoveGroupInput> removeGroupCalls = salGroupService.getRemoveGroupCalls();
+        assertEquals(1, removeGroupCalls.size());
+        assertEquals("DOM-1", removeGroupCalls.get(0).getTransactionUri().getValue());
+
+        forwardingRulesManager.close();
+    }
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/MeterListenerTest.java b/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/MeterListenerTest.java
new file mode 100644 (file)
index 0000000..0d32f9f
--- /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 test.mock;
+
+import org.junit.Test;
+import org.opendaylight.controller.frm.impl.ForwardingRulesManagerImpl;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey;
+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.meter.service.rev130918.AddMeterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import test.mock.util.FRMTest;
+import test.mock.util.RpcProviderRegistryMock;
+import test.mock.util.SalMeterServiceMock;
+
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+public class MeterListenerTest extends FRMTest {
+    RpcProviderRegistry rpcProviderRegistryMock = new RpcProviderRegistryMock();
+    NodeKey s1Key = new NodeKey(new NodeId("S1"));
+
+    @Test
+    public void addTwoMetersTest() throws Exception {
+        ForwardingRulesManagerImpl forwardingRulesManager = new ForwardingRulesManagerImpl(getDataBroker(), rpcProviderRegistryMock);
+        forwardingRulesManager.start();
+
+        addFlowCapableNode(s1Key);
+
+        MeterKey meterKey = new MeterKey(new MeterId((long) 2000));
+        InstanceIdentifier<Meter> meterII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Meter.class, meterKey);
+        Meter meter = new MeterBuilder().setKey(meterKey).setMeterName("meter_one").build();
+
+        WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, meterII, meter);
+        assertCommit(writeTx.submit());
+        SalMeterServiceMock salMeterService = (SalMeterServiceMock) forwardingRulesManager.getSalMeterService();
+        List<AddMeterInput> addMeterCalls = salMeterService.getAddMeterCalls();
+        assertEquals(1, addMeterCalls.size());
+        assertEquals("DOM-0", addMeterCalls.get(0).getTransactionUri().getValue());
+
+        meterKey = new MeterKey(new MeterId((long) 2001));
+        meterII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Meter.class, meterKey);
+        meter = new MeterBuilder().setKey(meterKey).setMeterName("meter_two").setBarrier(true).build();
+        writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, meterII, meter);
+        assertCommit(writeTx.submit());
+        salMeterService = (SalMeterServiceMock) forwardingRulesManager.getSalMeterService();
+        addMeterCalls = salMeterService.getAddMeterCalls();
+        assertEquals(2, addMeterCalls.size());
+        assertEquals("DOM-1", addMeterCalls.get(1).getTransactionUri().getValue());
+        assertEquals(meterII, addMeterCalls.get(1).getMeterRef().getValue());
+
+        forwardingRulesManager.close();
+    }
+
+    @Test
+    public void updateMeterTest() throws Exception {
+        ForwardingRulesManagerImpl forwardingRulesManager = new ForwardingRulesManagerImpl(getDataBroker(), rpcProviderRegistryMock);
+        forwardingRulesManager.start();
+
+        addFlowCapableNode(s1Key);
+
+        MeterKey meterKey = new MeterKey(new MeterId((long) 2000));
+        InstanceIdentifier<Meter> meterII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Meter.class, meterKey);
+        Meter meter = new MeterBuilder().setKey(meterKey).setMeterName("meter_one").setBarrier(false).build();
+
+        WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, meterII, meter);
+        assertCommit(writeTx.submit());
+        SalMeterServiceMock salMeterService = (SalMeterServiceMock) forwardingRulesManager.getSalMeterService();
+        List<AddMeterInput> addMeterCalls = salMeterService.getAddMeterCalls();
+        assertEquals(1, addMeterCalls.size());
+        assertEquals("DOM-0", addMeterCalls.get(0).getTransactionUri().getValue());
+
+        meter = new MeterBuilder().setKey(meterKey).setMeterName("meter_two").setBarrier(true).build();
+        writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, meterII, meter);
+        assertCommit(writeTx.submit());
+        salMeterService = (SalMeterServiceMock) forwardingRulesManager.getSalMeterService();
+        List<UpdateMeterInput> updateMeterCalls = salMeterService.getUpdateMeterCalls();
+        assertEquals(1, updateMeterCalls.size());
+        assertEquals("DOM-1", updateMeterCalls.get(0).getTransactionUri().getValue());
+        assertEquals(meterII, updateMeterCalls.get(0).getMeterRef().getValue());
+
+        forwardingRulesManager.close();
+    }
+
+    @Test
+    public void removeMeterTest() throws Exception {
+        ForwardingRulesManagerImpl forwardingRulesManager = new ForwardingRulesManagerImpl(getDataBroker(), rpcProviderRegistryMock);
+        forwardingRulesManager.start();
+
+        addFlowCapableNode(s1Key);
+
+        MeterKey meterKey = new MeterKey(new MeterId((long) 2000));
+        InstanceIdentifier<Meter> meterII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class).child(Meter.class, meterKey);
+        Meter meter = new MeterBuilder().setKey(meterKey).setMeterName("meter_one").build();
+
+        WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, meterII, meter);
+        assertCommit(writeTx.submit());
+        SalMeterServiceMock salMeterService = (SalMeterServiceMock) forwardingRulesManager.getSalMeterService();
+        List<AddMeterInput> addMeterCalls = salMeterService.getAddMeterCalls();
+        assertEquals(1, addMeterCalls.size());
+        assertEquals("DOM-0", addMeterCalls.get(0).getTransactionUri().getValue());
+
+        writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.delete(LogicalDatastoreType.CONFIGURATION, meterII);
+        assertCommit(writeTx.submit());
+        salMeterService = (SalMeterServiceMock) forwardingRulesManager.getSalMeterService();
+        List<RemoveMeterInput> removeMeterCalls = salMeterService.getRemoveMeterCalls();
+        assertEquals(1, removeMeterCalls.size());
+        assertEquals("DOM-1", removeMeterCalls.get(0).getTransactionUri().getValue());
+        assertEquals(meterII, removeMeterCalls.get(0).getMeterRef().getValue());
+
+        forwardingRulesManager.close();
+    }
+
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/NodeListenerTest.java b/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/NodeListenerTest.java
new file mode 100644 (file)
index 0000000..3cf2e93
--- /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 test.mock;
+
+import org.junit.Test;
+import org.opendaylight.controller.frm.impl.ForwardingRulesManagerImpl;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+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.yang.binding.InstanceIdentifier;
+import test.mock.util.FRMTest;
+import test.mock.util.RpcProviderRegistryMock;
+
+import java.util.concurrent.ExecutionException;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class NodeListenerTest extends FRMTest {
+
+    RpcProviderRegistry rpcProviderRegistryMock = new RpcProviderRegistryMock();
+    NodeKey s1Key = new NodeKey(new NodeId("S1"));
+
+    @Test
+    public void addRemoveNodeTest() throws ExecutionException, InterruptedException {
+        ForwardingRulesManagerImpl forwardingRulesManager = new ForwardingRulesManagerImpl(getDataBroker(), rpcProviderRegistryMock);
+        forwardingRulesManager.start();
+
+        addFlowCapableNode(s1Key);
+
+        InstanceIdentifier<FlowCapableNode> nodeII = InstanceIdentifier.create(Nodes.class).child(Node.class, s1Key)
+                .augmentation(FlowCapableNode.class);
+
+        boolean nodeActive = forwardingRulesManager.isNodeActive(nodeII);
+        assertTrue(nodeActive);
+
+        removeNode(s1Key);
+
+        nodeActive = forwardingRulesManager.isNodeActive(nodeII);
+        assertFalse(nodeActive);
+    }
+
+
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/AbstractDataBrokerTest.java b/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/AbstractDataBrokerTest.java
new file mode 100644 (file)
index 0000000..f9efa51
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package test.mock.util;
+
+import com.google.common.util.concurrent.ListenableFuture;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+public class AbstractDataBrokerTest extends AbstractSchemaAwareTest {
+
+    private DataBrokerTestCustomizer testCustomizer;
+    private DataBroker dataBroker;
+    private DOMDataBroker domBroker;
+
+
+    @Override
+    protected void setupWithSchema(final SchemaContext context) {
+        testCustomizer = createDataBrokerTestCustomizer();
+        dataBroker = testCustomizer.createDataBroker();
+        domBroker = testCustomizer.createDOMDataBroker();
+        testCustomizer.updateSchema(context);
+        setupWithDataBroker(dataBroker);
+    }
+
+    protected void setupWithDataBroker(final DataBroker dataBroker) {
+        // Intentionally left No-op, subclasses may customize it
+    }
+
+   protected DataBrokerTestCustomizer createDataBrokerTestCustomizer() {
+        return new DataBrokerTestCustomizer();
+    }
+
+    public DataBroker getDataBroker() {
+        return dataBroker;
+    }
+
+    public DOMDataBroker getDomBroker() {
+        return domBroker;
+    }
+
+    protected static final void assertCommit(final ListenableFuture<Void> commit) {
+        try {
+            commit.get(500, TimeUnit.MILLISECONDS);
+        } catch (InterruptedException | ExecutionException | TimeoutException e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/AbstractSchemaAwareTest.java b/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/AbstractSchemaAwareTest.java
new file mode 100644 (file)
index 0000000..d520d59
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package test.mock.util;
+
+import org.junit.Before;
+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.model.api.SchemaContext;
+
+public abstract class AbstractSchemaAwareTest {
+
+    private Iterable<YangModuleInfo> moduleInfos;
+    private SchemaContext schemaContext;
+
+
+    protected Iterable<YangModuleInfo> getModuleInfos() {
+        return BindingReflections.loadModuleInfos();
+    }
+
+
+    @Before
+    public final void setup() {
+        moduleInfos = getModuleInfos();
+        ModuleInfoBackedContext moduleContext = ModuleInfoBackedContext.create();
+        moduleContext.addModuleInfos(moduleInfos);
+        schemaContext = moduleContext.tryToCreateSchemaContext().get();
+        setupWithSchema(schemaContext);
+    }
+
+    /**
+     * Setups test with Schema context.
+     * This method is called before {@link #setupWithSchemaService(SchemaService)}
+     *
+     * @param context
+     */
+    protected abstract void setupWithSchema(SchemaContext context);
+
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/DataBrokerTestCustomizer.java b/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/DataBrokerTestCustomizer.java
new file mode 100644 (file)
index 0000000..36ab41f
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * 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 test.mock.util;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
+import javassist.ClassPool;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
+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;
+import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
+import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.controller.sal.core.spi.data.DOMStore;
+import org.opendaylight.yangtools.binding.data.codec.gen.impl.DataObjectSerializerGenerator;
+import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
+import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
+import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy;
+import org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl;
+import org.opendaylight.yangtools.sal.binding.generator.util.JavassistUtils;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+public class DataBrokerTestCustomizer {
+
+    private DOMDataBroker domDataBroker;
+    private final RuntimeGeneratedMappingServiceImpl mappingService;
+    private final MockSchemaService schemaService;
+    private ImmutableMap<LogicalDatastoreType, DOMStore> datastores;
+    private final BindingToNormalizedNodeCodec bindingToNormalized ;
+
+    public ImmutableMap<LogicalDatastoreType, DOMStore> createDatastores() {
+        return ImmutableMap.<LogicalDatastoreType, DOMStore>builder()
+                .put(LogicalDatastoreType.OPERATIONAL, createOperationalDatastore())
+                .put(LogicalDatastoreType.CONFIGURATION,createConfigurationDatastore())
+                .build();
+    }
+
+    public DataBrokerTestCustomizer() {
+        schemaService = new MockSchemaService();
+        ClassPool pool = ClassPool.getDefault();
+        mappingService = new RuntimeGeneratedMappingServiceImpl(pool);
+        DataObjectSerializerGenerator generator = StreamWriterGenerator.create(JavassistUtils.forClassPool(pool));
+        BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(generator);
+        GeneratedClassLoadingStrategy loading = GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy();
+        bindingToNormalized = new BindingToNormalizedNodeCodec(loading, mappingService, codecRegistry);
+        schemaService.registerSchemaContextListener(bindingToNormalized);
+    }
+
+    public DOMStore createConfigurationDatastore() {
+        InMemoryDOMDataStore store = new InMemoryDOMDataStore("CFG",
+                MoreExecutors.sameThreadExecutor(), MoreExecutors.sameThreadExecutor());
+        schemaService.registerSchemaContextListener(store);
+        return store;
+    }
+
+    public DOMStore createOperationalDatastore() {
+        InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER",
+                MoreExecutors.sameThreadExecutor(), MoreExecutors.sameThreadExecutor());
+        schemaService.registerSchemaContextListener(store);
+        return store;
+    }
+
+    public DOMDataBroker createDOMDataBroker() {
+        return new DOMDataBrokerImpl(getDatastores(), getCommitCoordinatorExecutor());
+    }
+
+    public ListeningExecutorService getCommitCoordinatorExecutor() {
+        return MoreExecutors.sameThreadExecutor();
+    }
+
+    public DataBroker createDataBroker() {
+        return new ForwardedBindingDataBroker(getDOMDataBroker(), bindingToNormalized, schemaService );
+    }
+
+    public ForwardedBackwardsCompatibleDataBroker createBackwardsCompatibleDataBroker() {
+        return new ForwardedBackwardsCompatibleDataBroker(getDOMDataBroker(), bindingToNormalized, getSchemaService(), MoreExecutors.sameThreadExecutor());
+    }
+
+    private SchemaService getSchemaService() {
+        return schemaService;
+    }
+
+    private DOMDataBroker getDOMDataBroker() {
+        if(domDataBroker == null) {
+            domDataBroker = createDOMDataBroker();
+        }
+        return domDataBroker;
+    }
+
+    private synchronized ImmutableMap<LogicalDatastoreType, DOMStore> getDatastores() {
+        if (datastores == null) {
+            datastores = createDatastores();
+        }
+        return datastores;
+    }
+
+    public void updateSchema(final SchemaContext ctx) {
+        schemaService.changeSchema(ctx);
+        mappingService.onGlobalContextUpdated(ctx);
+    }
+
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/FRMTest.java b/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/FRMTest.java
new file mode 100644 (file)
index 0000000..811d6ca
--- /dev/null
@@ -0,0 +1,42 @@
+package test.mock.util;
+
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder;
+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;
+
+import java.util.Collections;
+import java.util.concurrent.ExecutionException;
+
+public abstract class FRMTest extends AbstractDataBrokerTest{
+
+    public void addFlowCapableNode(NodeKey nodeKey) throws ExecutionException, InterruptedException {
+        Nodes nodes = new NodesBuilder().setNode(Collections.<Node>emptyList()).build();
+        InstanceIdentifier<Node> flowNodeIdentifier = InstanceIdentifier.create(Nodes.class)
+                .child(Node.class, nodeKey);
+
+        FlowCapableNodeBuilder fcnBuilder = new FlowCapableNodeBuilder();
+        NodeBuilder nodeBuilder = new NodeBuilder();
+        nodeBuilder.setKey(nodeKey);
+        nodeBuilder.addAugmentation(FlowCapableNode.class, fcnBuilder.build());
+
+        WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.put(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Nodes.class), nodes);
+        writeTx.put(LogicalDatastoreType.OPERATIONAL, flowNodeIdentifier, nodeBuilder.build());
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Nodes.class), nodes);
+        writeTx.put(LogicalDatastoreType.CONFIGURATION, flowNodeIdentifier, nodeBuilder.build());
+        assertCommit(writeTx.submit());
+    }
+
+    public void removeNode(NodeKey nodeKey) throws ExecutionException, InterruptedException {
+        WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
+        writeTx.delete(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey));
+        writeTx.submit().get();
+    }
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/MockSchemaService.java b/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/MockSchemaService.java
new file mode 100644 (file)
index 0000000..b4876a3
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package test.mock.util;
+
+import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.controller.sal.dom.broker.impl.SchemaContextProvider;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.util.ListenerRegistry;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
+
+@SuppressWarnings("deprecation")
+public final class MockSchemaService implements SchemaService, SchemaContextProvider {
+
+    private SchemaContext schemaContext;
+
+    ListenerRegistry<SchemaContextListener> listeners = ListenerRegistry.create();
+
+    @Override
+    public void addModule(final Module module) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public synchronized SchemaContext getGlobalContext() {
+        return schemaContext;
+    }
+
+    @Override
+    public synchronized SchemaContext getSessionContext() {
+        return schemaContext;
+    }
+
+    @Override
+    public ListenerRegistration<SchemaContextListener> registerSchemaContextListener(
+            final SchemaContextListener listener) {
+        return listeners.register(listener);
+    }
+
+    @Override
+    public void removeModule(final Module module) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public synchronized SchemaContext getSchemaContext() {
+        return schemaContext;
+    }
+
+    public synchronized void changeSchema(final SchemaContext newContext) {
+        schemaContext = newContext;
+        for (ListenerRegistration<SchemaContextListener> listener : listeners) {
+            listener.getInstance().onGlobalContextUpdated(schemaContext);
+        }
+    }
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/RpcProviderRegistryMock.java b/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/RpcProviderRegistryMock.java
new file mode 100644 (file)
index 0000000..ff17a0c
--- /dev/null
@@ -0,0 +1,42 @@
+package test.mock.util;
+
+import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.RpcService;
+
+public class RpcProviderRegistryMock implements RpcProviderRegistry {
+    @Override
+    public <T extends RpcService> BindingAwareBroker.RpcRegistration<T> addRpcImplementation(Class<T> serviceInterface, T implementation) throws IllegalStateException {
+        return null;
+    }
+
+    @Override
+    public <T extends RpcService> BindingAwareBroker.RoutedRpcRegistration<T> addRoutedRpcImplementation(Class<T> serviceInterface, T implementation) throws IllegalStateException {
+        return null;
+    }
+
+    @Override
+    public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(L listener) {
+        return null;
+    }
+
+    @Override
+    public <T extends RpcService> T getRpcService(Class<T> serviceInterface) {
+        if (serviceInterface.equals(SalFlowService.class)) {
+            return (T) new SalFlowServiceMock();
+        } else if (serviceInterface.equals(SalGroupService.class)) {
+            return (T) new SalGroupServiceMock();
+        } else if (serviceInterface.equals(SalMeterService.class)) {
+            return (T) new SalMeterServiceMock();
+        } else {
+            return null;
+        }
+    }
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/SalFlowServiceMock.java b/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/SalFlowServiceMock.java
new file mode 100644 (file)
index 0000000..4bddc69
--- /dev/null
@@ -0,0 +1,51 @@
+package test.mock.util;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Future;
+
+public class SalFlowServiceMock implements SalFlowService{
+    private List<AddFlowInput> addFlowCalls = new ArrayList<>();
+    private List<RemoveFlowInput> removeFlowCalls = new ArrayList<>();
+    private List<UpdateFlowInput> updateFlowCalls = new ArrayList<>();
+
+    @Override
+    public Future<RpcResult<AddFlowOutput>> addFlow(AddFlowInput input) {
+        addFlowCalls.add(input);
+        return null;
+    }
+
+
+    @Override
+    public Future<RpcResult<RemoveFlowOutput>> removeFlow(RemoveFlowInput input) {
+        removeFlowCalls.add(input);
+        return null;
+    }
+
+    @Override
+    public Future<RpcResult<UpdateFlowOutput>> updateFlow(UpdateFlowInput input) {
+        updateFlowCalls.add(input);
+        return null;
+    }
+
+    public List<AddFlowInput> getAddFlowCalls() {
+        return addFlowCalls;
+    }
+
+    public List<RemoveFlowInput> getRemoveFlowCalls() {
+        return removeFlowCalls;
+    }
+
+    public List<UpdateFlowInput> getUpdateFlowCalls() {
+        return updateFlowCalls;
+    }
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/SalGroupServiceMock.java b/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/SalGroupServiceMock.java
new file mode 100644 (file)
index 0000000..9fa7b76
--- /dev/null
@@ -0,0 +1,50 @@
+package test.mock.util;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Future;
+
+public class SalGroupServiceMock implements SalGroupService {
+    private List<AddGroupInput> addGroupCalls = new ArrayList<>();
+    private List<RemoveGroupInput> removeGroupCalls = new ArrayList<>();
+    private List<UpdateGroupInput> updateGroupCalls = new ArrayList<>();
+
+    @Override
+    public Future<RpcResult<AddGroupOutput>> addGroup(AddGroupInput input) {
+        addGroupCalls.add(input);
+        return null;
+    }
+
+    @Override
+    public Future<RpcResult<RemoveGroupOutput>> removeGroup(RemoveGroupInput input) {
+        removeGroupCalls.add(input);
+        return null;
+    }
+
+    @Override
+    public Future<RpcResult<UpdateGroupOutput>> updateGroup(UpdateGroupInput input) {
+        updateGroupCalls.add(input);
+        return null;
+    }
+
+    public List<AddGroupInput> getAddGroupCalls() {
+        return addGroupCalls;
+    }
+
+    public List<RemoveGroupInput> getRemoveGroupCalls() {
+        return removeGroupCalls;
+    }
+
+    public List<UpdateGroupInput> getUpdateGroupCalls() {
+        return updateGroupCalls;
+    }
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/SalMeterServiceMock.java b/opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/SalMeterServiceMock.java
new file mode 100644 (file)
index 0000000..fb053cb
--- /dev/null
@@ -0,0 +1,50 @@
+package test.mock.util;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutput;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Future;
+
+public class SalMeterServiceMock implements SalMeterService {
+    private List<AddMeterInput> addMeterCalls = new ArrayList<>();
+    private List<RemoveMeterInput> removeMeterCalls = new ArrayList<>();
+    private List<UpdateMeterInput> updateMeterCalls = new ArrayList<>();
+
+    @Override
+    public Future<RpcResult<AddMeterOutput>> addMeter(AddMeterInput input) {
+        addMeterCalls.add(input);
+        return null;
+    }
+
+    @Override
+    public Future<RpcResult<RemoveMeterOutput>> removeMeter(RemoveMeterInput input) {
+        removeMeterCalls.add(input);
+        return null;
+    }
+
+    @Override
+    public Future<RpcResult<UpdateMeterOutput>> updateMeter(UpdateMeterInput input) {
+        updateMeterCalls.add(input);
+        return null;
+    }
+
+    public List<AddMeterInput> getAddMeterCalls() {
+        return addMeterCalls;
+    }
+
+    public List<RemoveMeterInput> getRemoveMeterCalls() {
+        return removeMeterCalls;
+    }
+
+    public List<UpdateMeterInput> getUpdateMeterCalls() {
+        return updateMeterCalls;
+    }
+}
index c58f6cb6abe414ec1778943a5d7bb0563920ca28..7664a9bfe4bc37db0241a37f5c3d4983d7435b28 100644 (file)
                 <module>
                     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider">prefix:inmemory-config-datastore-provider</type>
                     <name>config-store-service</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>
+                    <inmemory-config-datastore-provider xmlns="urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider">
+                        <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>
+                    </inmemory-config-datastore-provider>
                 </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>
-                    <operational-schema-service>
-                        <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
-                        <name>yang-schema-service</name>
-                    </operational-schema-service>
+                    <inmemory-operational-datastore-provider xmlns="urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider">
+                        <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>
+                    </inmemory-operational-datastore-provider>
                 </module>
                 <!--
                      Tree-based in-memory data store. This is the data store which is currently
index 084ef16f575ce67c8725031e2742a86f1f7105d5..325005b239f83cbdf2a28bd7e01fbd1e88eb1ebe 100644 (file)
@@ -11,9 +11,9 @@
 
   <dependencies>
     <dependency>
-      <groupId>com.google.protobuf</groupId>
-      <artifactId>protobuf-java</artifactId>
-      <version>2.5.0</version>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-clustering-commons</artifactId>
+      <version>1.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>com.google.guava</groupId>
index 560d5fc19461db3dc49c24a78c227659f4978576..db3e683130952ec9baeb785ec2feecd04b89a8a0 100644 (file)
@@ -9,9 +9,9 @@
 package org.opendaylight.controller.cluster.example.messages;
 
 import com.google.protobuf.GeneratedMessage;
-import org.opendaylight.controller.cluster.example.protobuff.messages.KeyValueMessages;
+import org.opendaylight.controller.protobuff.messages.cluster.example.KeyValueMessages;
 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
-import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
+import org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages;
 
 import java.io.Serializable;
 import java.util.HashMap;
index 94366efd5e897657744df37b0a475a847273e1b4..6665d7549b0d82abe752bcd50aed1826455b331e 100644 (file)
@@ -12,7 +12,7 @@ import com.google.protobuf.GeneratedMessage;
 import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
 import org.opendaylight.controller.cluster.raft.ReplicatedLogImplEntry;
 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
-import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
+import org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages;
 
 import java.util.ArrayList;
 import java.util.Iterator;
index 9a251cd64586741de2ec69ca288dc21189ca027e..502c338f2298ea34b443d0b0f1e8d3a4d36df721 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.controller.cluster.raft.protobuff.client.messages;
 
 
 import com.google.protobuf.GeneratedMessage;
-import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
+import org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages;
 
 import java.util.Map;
 
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/messages/VotingMessages.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/protobuff/messages/VotingMessages.java
deleted file mode 100644 (file)
index 5b3bd2b..0000000
+++ /dev/null
@@ -1,767 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: VotingMessages.proto
-
-package org.opendaylight.controller.cluster.raft.protobuff.messages;
-
-public final class VotingMessages {
-  private VotingMessages() {}
-  public static void registerAllExtensions(
-      com.google.protobuf.ExtensionRegistry registry) {
-  }
-  public interface RequestVoteOrBuilder
-      extends com.google.protobuf.MessageOrBuilder {
-
-    // optional int64 term = 1;
-    /**
-     * <code>optional int64 term = 1;</code>
-     */
-    boolean hasTerm();
-    /**
-     * <code>optional int64 term = 1;</code>
-     */
-    long getTerm();
-
-    // optional string candidateId = 2;
-    /**
-     * <code>optional string candidateId = 2;</code>
-     */
-    boolean hasCandidateId();
-    /**
-     * <code>optional string candidateId = 2;</code>
-     */
-    java.lang.String getCandidateId();
-    /**
-     * <code>optional string candidateId = 2;</code>
-     */
-    com.google.protobuf.ByteString
-        getCandidateIdBytes();
-
-    // optional int64 lastLongIndex = 3;
-    /**
-     * <code>optional int64 lastLongIndex = 3;</code>
-     */
-    boolean hasLastLongIndex();
-    /**
-     * <code>optional int64 lastLongIndex = 3;</code>
-     */
-    long getLastLongIndex();
-
-    // optional int64 lastLongTerm = 4;
-    /**
-     * <code>optional int64 lastLongTerm = 4;</code>
-     */
-    boolean hasLastLongTerm();
-    /**
-     * <code>optional int64 lastLongTerm = 4;</code>
-     */
-    long getLastLongTerm();
-  }
-  /**
-   * Protobuf type {@code org.opendaylight.controller.cluster.raft.RequestVote}
-   */
-  public static final class RequestVote extends
-      com.google.protobuf.GeneratedMessage
-      implements RequestVoteOrBuilder {
-    // Use RequestVote.newBuilder() to construct.
-    private RequestVote(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
-      super(builder);
-      this.unknownFields = builder.getUnknownFields();
-    }
-    private RequestVote(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
-    private static final RequestVote defaultInstance;
-    public static RequestVote getDefaultInstance() {
-      return defaultInstance;
-    }
-
-    public RequestVote getDefaultInstanceForType() {
-      return defaultInstance;
-    }
-
-    private final com.google.protobuf.UnknownFieldSet unknownFields;
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-        getUnknownFields() {
-      return this.unknownFields;
-    }
-    private RequestVote(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      initFields();
-      int mutable_bitField0_ = 0;
-      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
-          com.google.protobuf.UnknownFieldSet.newBuilder();
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
-            case 8: {
-              bitField0_ |= 0x00000001;
-              term_ = input.readInt64();
-              break;
-            }
-            case 18: {
-              bitField0_ |= 0x00000002;
-              candidateId_ = input.readBytes();
-              break;
-            }
-            case 24: {
-              bitField0_ |= 0x00000004;
-              lastLongIndex_ = input.readInt64();
-              break;
-            }
-            case 32: {
-              bitField0_ |= 0x00000008;
-              lastLongTerm_ = input.readInt64();
-              break;
-            }
-          }
-        }
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(this);
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(
-            e.getMessage()).setUnfinishedMessage(this);
-      } finally {
-        this.unknownFields = unknownFields.build();
-        makeExtensionsImmutable();
-      }
-    }
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.class, org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.Builder.class);
-    }
-
-    public static com.google.protobuf.Parser<RequestVote> PARSER =
-        new com.google.protobuf.AbstractParser<RequestVote>() {
-      public RequestVote parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-        return new RequestVote(input, extensionRegistry);
-      }
-    };
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<RequestVote> getParserForType() {
-      return PARSER;
-    }
-
-    private int bitField0_;
-    // optional int64 term = 1;
-    public static final int TERM_FIELD_NUMBER = 1;
-    private long term_;
-    /**
-     * <code>optional int64 term = 1;</code>
-     */
-    public boolean hasTerm() {
-      return ((bitField0_ & 0x00000001) == 0x00000001);
-    }
-    /**
-     * <code>optional int64 term = 1;</code>
-     */
-    public long getTerm() {
-      return term_;
-    }
-
-    // optional string candidateId = 2;
-    public static final int CANDIDATEID_FIELD_NUMBER = 2;
-    private java.lang.Object candidateId_;
-    /**
-     * <code>optional string candidateId = 2;</code>
-     */
-    public boolean hasCandidateId() {
-      return ((bitField0_ & 0x00000002) == 0x00000002);
-    }
-    /**
-     * <code>optional string candidateId = 2;</code>
-     */
-    public java.lang.String getCandidateId() {
-      java.lang.Object ref = candidateId_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        if (bs.isValidUtf8()) {
-          candidateId_ = s;
-        }
-        return s;
-      }
-    }
-    /**
-     * <code>optional string candidateId = 2;</code>
-     */
-    public com.google.protobuf.ByteString
-        getCandidateIdBytes() {
-      java.lang.Object ref = candidateId_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        candidateId_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    // optional int64 lastLongIndex = 3;
-    public static final int LASTLONGINDEX_FIELD_NUMBER = 3;
-    private long lastLongIndex_;
-    /**
-     * <code>optional int64 lastLongIndex = 3;</code>
-     */
-    public boolean hasLastLongIndex() {
-      return ((bitField0_ & 0x00000004) == 0x00000004);
-    }
-    /**
-     * <code>optional int64 lastLongIndex = 3;</code>
-     */
-    public long getLastLongIndex() {
-      return lastLongIndex_;
-    }
-
-    // optional int64 lastLongTerm = 4;
-    public static final int LASTLONGTERM_FIELD_NUMBER = 4;
-    private long lastLongTerm_;
-    /**
-     * <code>optional int64 lastLongTerm = 4;</code>
-     */
-    public boolean hasLastLongTerm() {
-      return ((bitField0_ & 0x00000008) == 0x00000008);
-    }
-    /**
-     * <code>optional int64 lastLongTerm = 4;</code>
-     */
-    public long getLastLongTerm() {
-      return lastLongTerm_;
-    }
-
-    private void initFields() {
-      term_ = 0L;
-      candidateId_ = "";
-      lastLongIndex_ = 0L;
-      lastLongTerm_ = 0L;
-    }
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized != -1) return isInitialized == 1;
-
-      memoizedIsInitialized = 1;
-      return true;
-    }
-
-    public void writeTo(com.google.protobuf.CodedOutputStream output)
-                        throws java.io.IOException {
-      getSerializedSize();
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        output.writeInt64(1, term_);
-      }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
-        output.writeBytes(2, getCandidateIdBytes());
-      }
-      if (((bitField0_ & 0x00000004) == 0x00000004)) {
-        output.writeInt64(3, lastLongIndex_);
-      }
-      if (((bitField0_ & 0x00000008) == 0x00000008)) {
-        output.writeInt64(4, lastLongTerm_);
-      }
-      getUnknownFields().writeTo(output);
-    }
-
-    private int memoizedSerializedSize = -1;
-    public int getSerializedSize() {
-      int size = memoizedSerializedSize;
-      if (size != -1) return size;
-
-      size = 0;
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeInt64Size(1, term_);
-      }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(2, getCandidateIdBytes());
-      }
-      if (((bitField0_ & 0x00000004) == 0x00000004)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeInt64Size(3, lastLongIndex_);
-      }
-      if (((bitField0_ & 0x00000008) == 0x00000008)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeInt64Size(4, lastLongTerm_);
-      }
-      size += getUnknownFields().getSerializedSize();
-      memoizedSerializedSize = size;
-      return size;
-    }
-
-    private static final long serialVersionUID = 0L;
-    @java.lang.Override
-    protected java.lang.Object writeReplace()
-        throws java.io.ObjectStreamException {
-      return super.writeReplace();
-    }
-
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
-        com.google.protobuf.ByteString data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input, extensionRegistry);
-    }
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseDelimitedFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseDelimitedFrom(input, extensionRegistry);
-    }
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input);
-    }
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parseFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return PARSER.parseFrom(input, extensionRegistry);
-    }
-
-    public static Builder newBuilder() { return Builder.create(); }
-    public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote prototype) {
-      return newBuilder().mergeFrom(prototype);
-    }
-    public Builder toBuilder() { return newBuilder(this); }
-
-    @java.lang.Override
-    protected Builder newBuilderForType(
-        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
-      Builder builder = new Builder(parent);
-      return builder;
-    }
-    /**
-     * Protobuf type {@code org.opendaylight.controller.cluster.raft.RequestVote}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVoteOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.class, org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.Builder.class);
-      }
-
-      // Construct using org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.newBuilder()
-      private Builder() {
-        maybeForceBuilderInitialization();
-      }
-
-      private Builder(
-          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
-        super(parent);
-        maybeForceBuilderInitialization();
-      }
-      private void maybeForceBuilderInitialization() {
-        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
-        }
-      }
-      private static Builder create() {
-        return new Builder();
-      }
-
-      public Builder clear() {
-        super.clear();
-        term_ = 0L;
-        bitField0_ = (bitField0_ & ~0x00000001);
-        candidateId_ = "";
-        bitField0_ = (bitField0_ & ~0x00000002);
-        lastLongIndex_ = 0L;
-        bitField0_ = (bitField0_ & ~0x00000004);
-        lastLongTerm_ = 0L;
-        bitField0_ = (bitField0_ & ~0x00000008);
-        return this;
-      }
-
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor;
-      }
-
-      public org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.getDefaultInstance();
-      }
-
-      public org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote build() {
-        org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote buildPartial() {
-        org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote result = new org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote(this);
-        int from_bitField0_ = bitField0_;
-        int to_bitField0_ = 0;
-        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
-          to_bitField0_ |= 0x00000001;
-        }
-        result.term_ = term_;
-        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
-          to_bitField0_ |= 0x00000002;
-        }
-        result.candidateId_ = candidateId_;
-        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
-          to_bitField0_ |= 0x00000004;
-        }
-        result.lastLongIndex_ = lastLongIndex_;
-        if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
-          to_bitField0_ |= 0x00000008;
-        }
-        result.lastLongTerm_ = lastLongTerm_;
-        result.bitField0_ = to_bitField0_;
-        onBuilt();
-        return result;
-      }
-
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote) {
-          return mergeFrom((org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote other) {
-        if (other == org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote.getDefaultInstance()) return this;
-        if (other.hasTerm()) {
-          setTerm(other.getTerm());
-        }
-        if (other.hasCandidateId()) {
-          bitField0_ |= 0x00000002;
-          candidateId_ = other.candidateId_;
-          onChanged();
-        }
-        if (other.hasLastLongIndex()) {
-          setLastLongIndex(other.getLastLongIndex());
-        }
-        if (other.hasLastLongTerm()) {
-          setLastLongTerm(other.getLastLongTerm());
-        }
-        this.mergeUnknownFields(other.getUnknownFields());
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        return true;
-      }
-
-      public Builder mergeFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws java.io.IOException {
-        org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.raft.protobuff.messages.VotingMessages.RequestVote) e.getUnfinishedMessage();
-          throw e;
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-      private int bitField0_;
-
-      // optional int64 term = 1;
-      private long term_ ;
-      /**
-       * <code>optional int64 term = 1;</code>
-       */
-      public boolean hasTerm() {
-        return ((bitField0_ & 0x00000001) == 0x00000001);
-      }
-      /**
-       * <code>optional int64 term = 1;</code>
-       */
-      public long getTerm() {
-        return term_;
-      }
-      /**
-       * <code>optional int64 term = 1;</code>
-       */
-      public Builder setTerm(long value) {
-        bitField0_ |= 0x00000001;
-        term_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional int64 term = 1;</code>
-       */
-      public Builder clearTerm() {
-        bitField0_ = (bitField0_ & ~0x00000001);
-        term_ = 0L;
-        onChanged();
-        return this;
-      }
-
-      // optional string candidateId = 2;
-      private java.lang.Object candidateId_ = "";
-      /**
-       * <code>optional string candidateId = 2;</code>
-       */
-      public boolean hasCandidateId() {
-        return ((bitField0_ & 0x00000002) == 0x00000002);
-      }
-      /**
-       * <code>optional string candidateId = 2;</code>
-       */
-      public java.lang.String getCandidateId() {
-        java.lang.Object ref = candidateId_;
-        if (!(ref instanceof java.lang.String)) {
-          java.lang.String s = ((com.google.protobuf.ByteString) ref)
-              .toStringUtf8();
-          candidateId_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>optional string candidateId = 2;</code>
-       */
-      public com.google.protobuf.ByteString
-          getCandidateIdBytes() {
-        java.lang.Object ref = candidateId_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          candidateId_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>optional string candidateId = 2;</code>
-       */
-      public Builder setCandidateId(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000002;
-        candidateId_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string candidateId = 2;</code>
-       */
-      public Builder clearCandidateId() {
-        bitField0_ = (bitField0_ & ~0x00000002);
-        candidateId_ = getDefaultInstance().getCandidateId();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string candidateId = 2;</code>
-       */
-      public Builder setCandidateIdBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000002;
-        candidateId_ = value;
-        onChanged();
-        return this;
-      }
-
-      // optional int64 lastLongIndex = 3;
-      private long lastLongIndex_ ;
-      /**
-       * <code>optional int64 lastLongIndex = 3;</code>
-       */
-      public boolean hasLastLongIndex() {
-        return ((bitField0_ & 0x00000004) == 0x00000004);
-      }
-      /**
-       * <code>optional int64 lastLongIndex = 3;</code>
-       */
-      public long getLastLongIndex() {
-        return lastLongIndex_;
-      }
-      /**
-       * <code>optional int64 lastLongIndex = 3;</code>
-       */
-      public Builder setLastLongIndex(long value) {
-        bitField0_ |= 0x00000004;
-        lastLongIndex_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional int64 lastLongIndex = 3;</code>
-       */
-      public Builder clearLastLongIndex() {
-        bitField0_ = (bitField0_ & ~0x00000004);
-        lastLongIndex_ = 0L;
-        onChanged();
-        return this;
-      }
-
-      // optional int64 lastLongTerm = 4;
-      private long lastLongTerm_ ;
-      /**
-       * <code>optional int64 lastLongTerm = 4;</code>
-       */
-      public boolean hasLastLongTerm() {
-        return ((bitField0_ & 0x00000008) == 0x00000008);
-      }
-      /**
-       * <code>optional int64 lastLongTerm = 4;</code>
-       */
-      public long getLastLongTerm() {
-        return lastLongTerm_;
-      }
-      /**
-       * <code>optional int64 lastLongTerm = 4;</code>
-       */
-      public Builder setLastLongTerm(long value) {
-        bitField0_ |= 0x00000008;
-        lastLongTerm_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional int64 lastLongTerm = 4;</code>
-       */
-      public Builder clearLastLongTerm() {
-        bitField0_ = (bitField0_ & ~0x00000008);
-        lastLongTerm_ = 0L;
-        onChanged();
-        return this;
-      }
-
-      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.cluster.raft.RequestVote)
-    }
-
-    static {
-      defaultInstance = new RequestVote(true);
-      defaultInstance.initFields();
-    }
-
-    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.cluster.raft.RequestVote)
-  }
-
-  private static com.google.protobuf.Descriptors.Descriptor
-    internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor;
-  private static
-    com.google.protobuf.GeneratedMessage.FieldAccessorTable
-      internal_static_org_opendaylight_controller_cluster_raft_RequestVote_fieldAccessorTable;
-
-  public static com.google.protobuf.Descriptors.FileDescriptor
-      getDescriptor() {
-    return descriptor;
-  }
-  private static com.google.protobuf.Descriptors.FileDescriptor
-      descriptor;
-  static {
-    java.lang.String[] descriptorData = {
-      "\n\024VotingMessages.proto\022(org.opendaylight" +
-      ".controller.cluster.raft\"]\n\013RequestVote\022" +
-      "\014\n\004term\030\001 \001(\003\022\023\n\013candidateId\030\002 \001(\t\022\025\n\rla" +
-      "stLongIndex\030\003 \001(\003\022\024\n\014lastLongTerm\030\004 \001(\003B" +
-      "O\n;org.opendaylight.controller.cluster.r" +
-      "aft.protobuff.messagesB\016VotingMessagesH\001"
-    };
-    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
-      new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
-        public com.google.protobuf.ExtensionRegistry assignDescriptors(
-            com.google.protobuf.Descriptors.FileDescriptor root) {
-          descriptor = root;
-          internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor =
-            getDescriptor().getMessageTypes().get(0);
-          internal_static_org_opendaylight_controller_cluster_raft_RequestVote_fieldAccessorTable = new
-            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
-              internal_static_org_opendaylight_controller_cluster_raft_RequestVote_descriptor,
-              new java.lang.String[] { "Term", "CandidateId", "LastLongIndex", "LastLongTerm", });
-          return null;
-        }
-      };
-    com.google.protobuf.Descriptors.FileDescriptor
-      .internalBuildGeneratedFileFrom(descriptorData,
-        new com.google.protobuf.Descriptors.FileDescriptor[] {
-        }, assigner);
-  }
-
-  // @@protoc_insertion_point(outer_class_scope)
-}
diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/resources/VotingMessages.proto b/opendaylight/md-sal/sal-akka-raft/src/main/resources/VotingMessages.proto
deleted file mode 100644 (file)
index 6a45a2b..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.opendaylight.controller.cluster.raft;
-
-option java_package = "org.opendaylight.controller.cluster.raft.protobuff.messages";
-option java_outer_classname = "VotingMessages";
-option optimize_for = SPEED;
-
-message RequestVote {
-    optional int64 term = 1;
-    optional string candidateId = 2;
-    optional int64 lastLongIndex = 3;
-    optional int64 lastLongTerm = 4;
-
-}
index 70671a6a21ab112b339a07b6ab37b4c56c176b47..ea3c9e759d51744fb2dd36212bf8372e2f06f0c8 100644 (file)
@@ -16,8 +16,8 @@ import akka.event.Logging;
 import akka.event.LoggingAdapter;
 import com.google.protobuf.GeneratedMessage;
 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
-import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
-import org.opendaylight.controller.cluster.raft.protobuff.messages.MockPayloadMessages;
+import org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages;
+import org.opendaylight.controller.protobuff.messages.cluster.raft.test.MockPayloadMessages;
 import com.google.common.base.Preconditions;
 
 import java.io.Serializable;
index ab6d56c15a5bdb696f5cb136965519206f40ef79..6be5f2d481515c1dd0b6fb140ff63fdf2e9d019b 100644 (file)
@@ -3,6 +3,12 @@ package org.opendaylight.controller.sal.binding.impl.connect.dom;
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkState;
 
+import com.google.common.base.Function;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+
 import java.lang.ref.WeakReference;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
@@ -21,13 +27,13 @@ import org.opendaylight.controller.sal.core.api.RpcImplementation;
 import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
 import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
 import org.opendaylight.yangtools.concepts.ObjectRegistration;
+import org.opendaylight.yangtools.util.ClassLoaderUtils;
 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
 import org.opendaylight.yangtools.yang.binding.BindingMapping;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
-import org.opendaylight.yangtools.yang.binding.util.ClassLoaderUtils;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
@@ -35,12 +41,6 @@ import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMapping
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Function;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-
 class DomToBindingRpcForwarder implements RpcImplementation, InvocationHandler {
 
     private final Logger LOG = LoggerFactory.getLogger(DomToBindingRpcForwarder.class);
@@ -65,8 +65,8 @@ class DomToBindingRpcForwarder implements RpcImplementation, InvocationHandler {
     static {
         try {
             EQUALS_METHOD = Object.class.getMethod("equals", Object.class);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
+        } catch (NoSuchMethodException | SecurityException e) {
+            throw new ExceptionInInitializerError(e);
         }
     }
 
@@ -94,7 +94,7 @@ class DomToBindingRpcForwarder implements RpcImplementation, InvocationHandler {
     }
 
     /**
-     * Constructor for Routed RPC Forwareder.
+     * Constructor for Routed RPC Forwarder.
      *
      * @param service
      * @param context
index 4419d19f527c9c096718496041dee08933275106..b8980cd0bea46b22676ccec1cb38def91239d275 100644 (file)
 
   <packaging>bundle</packaging>
 
-  <dependencies>
+    <dependencies>
+
+    <dependency>
+        <groupId>com.typesafe.akka</groupId>
+        <artifactId>akka-actor_${scala.version}</artifactId>
+    </dependency>
+
+    <dependency>
+        <groupId>com.typesafe.akka</groupId>
+        <artifactId>akka-cluster_${scala.version}</artifactId>
+    </dependency>
+
+    <dependency>
+        <groupId>com.typesafe.akka</groupId>
+        <artifactId>akka-persistence-experimental_${scala.version}</artifactId>
+    </dependency>
+
+    <dependency>
+        <groupId>com.typesafe.akka</groupId>
+        <artifactId>akka-remote_${scala.version}</artifactId>
+    </dependency>
+
+    <dependency>
+        <groupId>com.typesafe.akka</groupId>
+        <artifactId>akka-testkit_${scala.version}</artifactId>
+    </dependency>
+
+
+    <dependency>
+        <groupId>org.scala-lang</groupId>
+        <artifactId>scala-library</artifactId>
+    </dependency>
+
+
+    <dependency>
+        <groupId>com.typesafe.akka</groupId>
+        <artifactId>akka-slf4j_${scala.version}</artifactId>
+    </dependency>
+
+
     <dependency>
       <groupId>com.google.code.findbugs</groupId>
       <artifactId>jsr305</artifactId>
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-all</artifactId>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-simple</artifactId>
           <artifactId>yang-binding</artifactId>
       </dependency>
 
-      <dependency>
-          <groupId>org.opendaylight.controller</groupId>
-          <artifactId>sal-akka-raft</artifactId>
-          <version>1.1-SNAPSHOT</version>
-      </dependency>
 
       <dependency>
           <groupId>com.google.guava</groupId>
           <artifactId>jsr305</artifactId>
           <version>2.0.1</version>
       </dependency>
-
       <dependency>
           <groupId>com.codahale.metrics</groupId>
           <artifactId>metrics-core</artifactId>
-          <version>3.0.1</version>
+      </dependency>
+      <dependency>
+          <groupId>com.codahale.metrics</groupId>
+          <artifactId>metrics-graphite</artifactId>
       </dependency>
   </dependencies>
+  <build>
+      <plugins>
+          <plugin>
+              <groupId>org.jacoco</groupId>
+              <artifactId>jacoco-maven-plugin</artifactId>
+              <configuration>
+                  <includes>
+                      <include>org.opendaylight.controller.*</include>
+                  </includes>
+                  <excludes>
+                      <exclude>org.opendaylight.controller.protobuff.*</exclude>
+                  </excludes>
+                  <check>false</check>
+              </configuration>
+              <executions>
+                  <execution>
+                      <id>pre-test</id>
+                      <goals>
+                          <goal>prepare-agent</goal>
+                      </goals>
+                  </execution>
+                  <execution>
+                      <id>post-test</id>
+                      <goals>
+                          <goal>report</goal>
+                      </goals>
+                      <phase>test</phase>
+                  </execution>
+              </executions>
+          </plugin>
+      </plugins>
+  </build>
 
 </project>
index d1ae264c3b912839a4332fc74766076859b754db..4e76e37fa25c179ac3f2b196f97ee389261a8c97 100644 (file)
@@ -10,9 +10,9 @@
 
 package org.opendaylight.controller.cluster.datastore.node;
 
-import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
 import org.opendaylight.controller.cluster.datastore.node.utils.PathUtils;
-import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeSerializer;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -29,45 +29,27 @@ public class NormalizedNodeToNodeCodec {
     }
 
     public NormalizedNodeMessages.Container encode(YangInstanceIdentifier id, NormalizedNode node){
+
+        NormalizedNodeMessages.Container.Builder builder = NormalizedNodeMessages.Container.newBuilder();
         String parentPath = "";
 
         if(id != null){
             parentPath = PathUtils.getParentPath(PathUtils.toString(id));
         }
 
+        builder.setParentPath(parentPath);
+        if(node != null) {
+            builder.setNormalizedNode(NormalizedNodeSerializer.serialize(node));
+        }
 
-        NormalizedNodeToProtocolBufferNode encoder = new NormalizedNodeToProtocolBufferNode();
-        encoder.encode(parentPath, node);
-
-        return encoder.getContainer();
-
-
+        return builder.build();
     }
 
     public NormalizedNode<?,?> decode(YangInstanceIdentifier id, NormalizedNodeMessages.Node node){
-            NodeToNormalizedNodeBuilder currentOp = NodeToNormalizedNodeBuilder.from(ctx);
-
-            for(YangInstanceIdentifier.PathArgument pathArgument : id.getPathArguments()){
-                currentOp = currentOp.getChild(pathArgument);
-            }
-
-            QName nodeType = null;
-
-            if(id.getPath().size() < 1){
-                nodeType = null;
-            } else {
-                final YangInstanceIdentifier.PathArgument pathArgument = id.getPath().get(id.getPath().size() - 1);
-                if(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier){
-                    nodeType = null;
-                } else {
-                    nodeType = pathArgument.getNodeType();
-                }
-            }
-            if((node != null)&& (!node.getType().isEmpty())){
-               return currentOp.normalize(nodeType, node);
-            } else{
-              return null;
-            }
+        if(node.getIntType() < 0 || node.getSerializedSize() == 0){
+            return null;
+        }
+        return NormalizedNodeSerializer.deSerialize(node);
     }
 
 
diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeDeSerializationContext.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeDeSerializationContext.java
new file mode 100644 (file)
index 0000000..0ed1317
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore.node.utils.serialization;
+
+/**
+ * NormalizedNodeDeSerializationContext provides methods which help in decoding
+ * certain components of a NormalizedNode properly
+ */
+
+public interface NormalizedNodeDeSerializationContext {
+    String getNamespace(int namespace);
+    String getRevision(int revision);
+    String getLocalName(int localName);
+}
diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeSerializationContext.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeSerializationContext.java
new file mode 100644 (file)
index 0000000..660bc28
--- /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.node.utils.serialization;
+
+import java.net.URI;
+import java.util.Date;
+
+/**
+ * NormalizedNodeSerializationContext provides methods which help in encoding
+ * certain components of a NormalizedNode properly
+ */
+public interface NormalizedNodeSerializationContext {
+    int addNamespace(URI namespace);
+    int addRevision(Date revision);
+    int addLocalName(String localName);
+}
diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeSerializer.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeSerializer.java
new file mode 100644 (file)
index 0000000..3e1bd35
--- /dev/null
@@ -0,0 +1,551 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore.node.utils.serialization;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode;
+import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+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.LeafSetEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.OrderedMapNode;
+import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
+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.DataContainerNodeAttrBuilder;
+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.NormalizedNodeAttrBuilder;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeType.ANY_XML_NODE_TYPE;
+import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeType.AUGMENTATION_NODE_TYPE;
+import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeType.CHOICE_NODE_TYPE;
+import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeType.CONTAINER_NODE_TYPE;
+import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeType.LEAF_NODE_TYPE;
+import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeType.LEAF_SET_ENTRY_NODE_TYPE;
+import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeType.LEAF_SET_NODE_TYPE;
+import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeType.MAP_ENTRY_NODE_TYPE;
+import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeType.MAP_NODE_TYPE;
+import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeType.ORDERED_LEAF_SET_NODE_TYPE;
+import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeType.ORDERED_MAP_NODE_TYPE;
+import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeType.UNKEYED_LIST_ENTRY_NODE_TYPE;
+import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeType.UNKEYED_LIST_NODE_TYPE;
+import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeType.getSerializableNodeType;
+
+/**
+ * NormalizedNodeSerializer can be used to convert a Normalized node to and and
+ * from a protocol buffer message.
+ *
+ *
+ */
+public class NormalizedNodeSerializer {
+
+    /**
+     * Serialize a NormalizedNode into a protocol buffer message
+     * <p>
+     * The significant things to be aware of the Serialization process are
+     * <ul>
+     *     <li>Repeated strings like namespaces, revisions and localNames are
+     *     compressed to codes and stored in the top level of the normalized
+     *     node protocol buffer message
+     *     </li>
+     *     <li>All value types are encoded for each leaf value. This is so that
+     *     the deSerialization process does not need to use the schema context to
+     *     figure out how to decode values
+     *     </li>
+     * </ul>
+     *
+     * One question which may arise is why not use something like gzip to
+     * compress the protocol buffer message instead of rolling our own
+     * encoding scheme. This has to be explored further as it is a more
+     * general solution.
+     *
+     * @param node
+     * @return
+     */
+    public static NormalizedNodeMessages.Node serialize(NormalizedNode node){
+        Preconditions.checkNotNull(node, "node should not be null");
+        return new Serializer(node).serialize();
+    }
+
+
+    /**
+     * DeSerialize a protocol buffer message back into a NormalizedNode
+     *
+     * @param node
+     * @return
+     */
+    public static NormalizedNode deSerialize(NormalizedNodeMessages.Node node){
+        return new DeSerializer(node).deSerialize();
+    }
+
+    /**
+     * DeSerialize a PathArgument which is in the protocol buffer format into
+     * a yang PathArgument. The protocol buffer path argument is specially
+     * encoded and can only be interpreted in the context of a top level
+     * serialized NormalizedNode protocol buffer message. The reason for this
+     * is that during the NormalizedNode serialization process certain repeated
+     * strings are encoded into a "codes" list and the actual strings are
+     * replaced by an integer which is an index into that list.
+     *
+     * @param node
+     * @param pathArgument
+     * @return
+     */
+    public static YangInstanceIdentifier.PathArgument deSerialize(NormalizedNodeMessages.Node node, NormalizedNodeMessages.PathArgument pathArgument){
+        Preconditions.checkNotNull(node, "node should not be null");
+        Preconditions.checkNotNull(pathArgument, "pathArgument should not be null");
+        return new DeSerializer(node).deSerialize(pathArgument);
+    }
+
+    private static class Serializer implements NormalizedNodeSerializationContext {
+
+        private final NormalizedNode node;
+
+        private final Map<Object, Integer> codeMap = new HashMap<>();
+        private final List<String> codes = new ArrayList<>();
+
+        private Serializer(NormalizedNode node) {
+            this.node = node;
+        }
+
+        private NormalizedNodeMessages.Node serialize() {
+            return this.serialize(node).addAllCode(codes).build();
+        }
+
+        private NormalizedNodeMessages.Node.Builder serialize(
+            NormalizedNode node) {
+            NormalizedNodeMessages.Node.Builder builder =
+                NormalizedNodeMessages.Node.newBuilder();
+
+            builder.setPathArgument(PathArgumentSerializer.serialize(this, node.getIdentifier()));
+            Integer nodeType = getSerializableNodeType(node).ordinal();
+            builder.setIntType(nodeType);
+            Object value = node.getValue();
+
+            // We need to do a specific check of the type of the node here
+            // because if we looked at the value type alone we will not be
+            // able to distinguish if the value was supposed to be added
+            // as a child or whether the value should be added as a value of the
+            // node.
+            // One use case where this check is necessary when you have a node
+            // with a bits value. In that case the value of the node is a Set
+            // which is also a Collection. Without the following check being
+            // done first the code would flow into the Collection if condition
+            // and the Set would be added as child nodes
+            if(nodeType == NormalizedNodeType.LEAF_NODE_TYPE.ordinal() ||
+               nodeType == NormalizedNodeType.LEAF_SET_ENTRY_NODE_TYPE.ordinal()){
+
+                ValueSerializer.serialize(builder, this, value);
+
+            } else if (value instanceof Iterable) {
+                Iterable iterable = (Iterable) value;
+
+                for (Object o : iterable) {
+                    if (o instanceof NormalizedNode) {
+                        builder.addChild(serialize((NormalizedNode) o));
+                    }
+                }
+
+            } else if (value instanceof NormalizedNode) {
+
+                builder.addChild(serialize((NormalizedNode) value));
+
+            } else {
+
+                ValueSerializer.serialize(builder, this, value);
+            }
+
+            return builder;
+        }
+
+
+        @Override public int addNamespace(URI namespace) {
+            int namespaceInt = getCode(namespace);
+
+            if(namespaceInt == -1) {
+                namespaceInt = addCode(namespace, namespace.toString());
+            }
+            return namespaceInt;
+        }
+
+        @Override public int addRevision(Date revision) {
+            if(revision == null){
+                return -1;
+            }
+
+            int revisionInt = getCode(revision);
+            if(revisionInt == -1) {
+                String formattedRevision =
+                    SimpleDateFormatUtil.getRevisionFormat().format(revision);
+                revisionInt = addCode(revision, formattedRevision);
+            }
+            return revisionInt;
+        }
+
+        @Override public int addLocalName(String localName) {
+            int localNameInt = getCode(localName);
+            if(localNameInt == -1) {
+                localNameInt = addCode(localName, localName.toString());
+            }
+            return localNameInt;
+
+        }
+
+        public int addCode(Object code, String codeStr){
+            int count = codes.size();
+            codes.add(codeStr);
+            codeMap.put(code, Integer.valueOf(count));
+            return count;
+        }
+
+        public int getCode(Object code){
+            if(codeMap.containsKey(code)){
+                return codeMap.get(code);
+            }
+            return -1;
+        }
+    }
+
+    private static class DeSerializer implements NormalizedNodeDeSerializationContext {
+        private static Map<NormalizedNodeType, DeSerializationFunction>
+            deSerializationFunctions = new HashMap<>();
+
+        static {
+            deSerializationFunctions.put(CONTAINER_NODE_TYPE,
+                new DeSerializationFunction() {
+                    @Override public NormalizedNode apply(
+                        DeSerializer deSerializer,
+                        NormalizedNodeMessages.Node node) {
+                        DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode>
+                            builder = Builders.containerBuilder();
+
+                        builder
+                            .withNodeIdentifier(deSerializer.toNodeIdentifier(
+                                node.getPathArgument()));
+
+                        return deSerializer.buildDataContainer(builder, node);
+
+                    }
+
+                });
+
+            deSerializationFunctions.put(LEAF_NODE_TYPE,
+                new DeSerializationFunction() {
+                    @Override public NormalizedNode apply(
+                        DeSerializer deSerializer,
+                        NormalizedNodeMessages.Node node) {
+                        NormalizedNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>>
+                            builder = Builders.leafBuilder();
+
+                        builder
+                            .withNodeIdentifier(deSerializer.toNodeIdentifier(
+                                node.getPathArgument()));
+
+                        return deSerializer.buildNormalizedNode(builder, node);
+
+                    }
+                });
+
+            deSerializationFunctions.put(MAP_NODE_TYPE,
+                new DeSerializationFunction() {
+                    @Override public NormalizedNode apply(
+                        DeSerializer deSerializer,
+                        NormalizedNodeMessages.Node node) {
+                        CollectionNodeBuilder<MapEntryNode, MapNode>
+                            builder = Builders.mapBuilder();
+
+                        return deSerializer.buildCollectionNode(builder, node);
+                    }
+                });
+
+            deSerializationFunctions.put(MAP_ENTRY_NODE_TYPE,
+                new DeSerializationFunction() {
+                    @Override public NormalizedNode apply(
+                        DeSerializer deSerializer,
+                        NormalizedNodeMessages.Node node) {
+                        DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
+                            builder = Builders.mapEntryBuilder();
+
+                        builder.withNodeIdentifier(deSerializer.toNodeIdentifierWithPredicates(
+                            node.getPathArgument()));
+
+                        return deSerializer.buildDataContainer(builder, node);
+                    }
+                });
+
+            deSerializationFunctions.put(AUGMENTATION_NODE_TYPE,
+                new DeSerializationFunction() {
+                    @Override public NormalizedNode apply(
+                        DeSerializer deSerializer,
+                        NormalizedNodeMessages.Node node) {
+                        DataContainerNodeBuilder<YangInstanceIdentifier.AugmentationIdentifier, AugmentationNode>
+                            builder = Builders.augmentationBuilder();
+
+                        builder.withNodeIdentifier(
+                            deSerializer.toAugmentationIdentifier(
+                                node.getPathArgument()));
+
+                        return deSerializer.buildDataContainer(builder, node);
+                    }
+                });
+
+            deSerializationFunctions.put(LEAF_SET_NODE_TYPE,
+                new DeSerializationFunction() {
+                    @Override public NormalizedNode apply(
+                        DeSerializer deSerializer,
+                        NormalizedNodeMessages.Node node) {
+                        ListNodeBuilder<Object, LeafSetEntryNode<Object>>
+                            builder = Builders.leafSetBuilder();
+
+                        return deSerializer.buildListNode(builder, node);
+                    }
+                });
+
+            deSerializationFunctions.put(LEAF_SET_ENTRY_NODE_TYPE,
+                new DeSerializationFunction() {
+                    @Override public NormalizedNode apply(
+                        DeSerializer deSerializer,
+                        NormalizedNodeMessages.Node node) {
+                        NormalizedNodeAttrBuilder<YangInstanceIdentifier.NodeWithValue, Object, LeafSetEntryNode<Object>>
+                            builder = Builders.leafSetEntryBuilder();
+
+                        builder.withNodeIdentifier(deSerializer.toNodeWithValue(
+                            node.getPathArgument()));
+
+                        return deSerializer.buildNormalizedNode(builder, node);
+                    }
+                });
+
+            deSerializationFunctions.put(CHOICE_NODE_TYPE,
+                new DeSerializationFunction() {
+                    @Override public NormalizedNode apply(
+                        DeSerializer deSerializer,
+                        NormalizedNodeMessages.Node node) {
+                        DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ChoiceNode>
+                            builder =
+                            Builders.choiceBuilder();
+
+                        builder
+                            .withNodeIdentifier(deSerializer.toNodeIdentifier(
+                                node.getPathArgument()));
+
+                        return deSerializer.buildDataContainer(builder, node);
+                    }
+                });
+
+            deSerializationFunctions.put(ORDERED_LEAF_SET_NODE_TYPE,
+                new DeSerializationFunction() {
+                    @Override public NormalizedNode apply(
+                        DeSerializer deSerializer,
+                        NormalizedNodeMessages.Node node) {
+                        ListNodeBuilder<Object, LeafSetEntryNode<Object>>
+                            builder =
+                            Builders.orderedLeafSetBuilder();
+
+                        return deSerializer.buildListNode(builder, node);
+
+
+                    }
+                });
+
+            deSerializationFunctions.put(ORDERED_MAP_NODE_TYPE,
+                new DeSerializationFunction() {
+                    @Override public NormalizedNode apply(
+                        DeSerializer deSerializer,
+                        NormalizedNodeMessages.Node node) {
+                        CollectionNodeBuilder<MapEntryNode, OrderedMapNode>
+                            builder =
+                            Builders.orderedMapBuilder();
+
+                        return deSerializer.buildCollectionNode(builder, node);
+                    }
+                });
+
+            deSerializationFunctions.put(UNKEYED_LIST_NODE_TYPE,
+                new DeSerializationFunction() {
+                    @Override public NormalizedNode apply(
+                        DeSerializer deSerializer,
+                        NormalizedNodeMessages.Node node) {
+                        CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode>
+                            builder =
+                            Builders.unkeyedListBuilder();
+
+                        return deSerializer.buildCollectionNode(builder, node);
+                    }
+                });
+
+            deSerializationFunctions.put(UNKEYED_LIST_ENTRY_NODE_TYPE,
+                new DeSerializationFunction() {
+                    @Override public NormalizedNode apply(
+                        DeSerializer deSerializer,
+                        NormalizedNodeMessages.Node node) {
+                        DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode>
+                            builder =
+                            Builders.unkeyedListEntryBuilder();
+
+                        builder
+                            .withNodeIdentifier(deSerializer.toNodeIdentifier(
+                                node.getPathArgument()));
+
+                        return deSerializer.buildDataContainer(builder, node);
+                    }
+                });
+
+            deSerializationFunctions.put(ANY_XML_NODE_TYPE,
+                new DeSerializationFunction() {
+
+                    @Override public NormalizedNode apply(
+                        DeSerializer deSerializer,
+                        NormalizedNodeMessages.Node node) {
+                        NormalizedNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, Node<?>, AnyXmlNode>
+                            builder =
+                            Builders.anyXmlBuilder();
+
+                        builder
+                            .withNodeIdentifier(deSerializer.toNodeIdentifier(
+                                node.getPathArgument()));
+
+                        return deSerializer.buildNormalizedNode(builder, node);
+                    }
+                });
+
+        }
+
+        private final NormalizedNodeMessages.Node node;
+
+        public DeSerializer(NormalizedNodeMessages.Node node){
+            this.node = node;
+        }
+
+        public NormalizedNode deSerialize(){
+            return deSerialize(node);
+        }
+
+        private NormalizedNode deSerialize(NormalizedNodeMessages.Node node){
+            Preconditions.checkNotNull(node, "node should not be null");
+            DeSerializationFunction deSerializationFunction =
+                Preconditions.checkNotNull(deSerializationFunctions.get(NormalizedNodeType.values()[node.getIntType()]), "Unknown type " + node);
+
+            return deSerializationFunction.apply(this, node);
+        }
+
+
+        private NormalizedNode buildCollectionNode(
+            CollectionNodeBuilder builder,
+            NormalizedNodeMessages.Node node) {
+
+            builder.withNodeIdentifier(toNodeIdentifier(node.getPathArgument()));
+
+            for(NormalizedNodeMessages.Node child : node.getChildList()){
+                builder.withChild(deSerialize(child));
+            }
+
+            return builder.build();
+        }
+
+
+        private NormalizedNode buildListNode(
+            ListNodeBuilder<Object, LeafSetEntryNode<Object>> builder,
+            NormalizedNodeMessages.Node node) {
+            builder.withNodeIdentifier(toNodeIdentifier(node.getPathArgument()));
+
+            for(NormalizedNodeMessages.Node child : node.getChildList()){
+                builder.withChild((LeafSetEntryNode<Object>) deSerialize(child));
+            }
+
+            return builder.build();
+        }
+
+        private NormalizedNode buildDataContainer(DataContainerNodeBuilder builder, NormalizedNodeMessages.Node node){
+
+            for(NormalizedNodeMessages.Node child : node.getChildList()){
+                builder.withChild((DataContainerChild<?, ?>) deSerialize(child));
+            }
+
+            //TODO : Also handle attributes
+
+            return builder.build();
+        }
+
+        private NormalizedNode buildNormalizedNode(NormalizedNodeAttrBuilder builder, NormalizedNodeMessages.Node node){
+
+            builder.withValue(ValueSerializer.deSerialize(this, node));
+
+            //TODO : Also handle attributes
+
+            return builder.build();
+
+        }
+
+
+        private YangInstanceIdentifier.NodeIdentifierWithPredicates toNodeIdentifierWithPredicates(
+            NormalizedNodeMessages.PathArgument path) {
+            return (YangInstanceIdentifier.NodeIdentifierWithPredicates) PathArgumentSerializer.deSerialize(this, path);
+        }
+
+        private YangInstanceIdentifier.AugmentationIdentifier toAugmentationIdentifier(
+            NormalizedNodeMessages.PathArgument path) {
+            return (YangInstanceIdentifier.AugmentationIdentifier) PathArgumentSerializer.deSerialize(this, path);
+        }
+
+        private YangInstanceIdentifier.NodeWithValue toNodeWithValue(
+            NormalizedNodeMessages.PathArgument path) {
+            return (YangInstanceIdentifier.NodeWithValue) PathArgumentSerializer.deSerialize(
+                this, path);
+        }
+
+        private YangInstanceIdentifier.NodeIdentifier toNodeIdentifier(NormalizedNodeMessages.PathArgument path){
+            return (YangInstanceIdentifier.NodeIdentifier) PathArgumentSerializer.deSerialize(
+                this, path);
+        }
+
+        @Override public String getNamespace(int namespace) {
+            return node.getCode(namespace);
+        }
+
+        @Override public String getRevision(int revision) {
+            return node.getCode(revision);
+        }
+
+        @Override public String getLocalName(int localName) {
+            return node.getCode(localName);
+        }
+
+        public YangInstanceIdentifier.PathArgument deSerialize(
+            NormalizedNodeMessages.PathArgument pathArgument) {
+            return PathArgumentSerializer.deSerialize(this, pathArgument);
+        }
+
+        private static interface DeSerializationFunction {
+            NormalizedNode apply(DeSerializer deserializer, NormalizedNodeMessages.Node node);
+        }
+    }
+
+
+
+
+}
diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeType.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeType.java
new file mode 100644 (file)
index 0000000..eebd580
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore.node.utils.serialization;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode;
+import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.OrderedLeafSetNode;
+import org.opendaylight.yangtools.yang.data.api.schema.OrderedMapNode;
+import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
+
+public enum NormalizedNodeType {
+    CONTAINER_NODE_TYPE,
+    LEAF_NODE_TYPE,
+    MAP_NODE_TYPE,
+    MAP_ENTRY_NODE_TYPE,
+    AUGMENTATION_NODE_TYPE,
+    LEAF_SET_NODE_TYPE,
+    LEAF_SET_ENTRY_NODE_TYPE,
+    CHOICE_NODE_TYPE,
+    ORDERED_LEAF_SET_NODE_TYPE,
+    ORDERED_MAP_NODE_TYPE,
+    UNKEYED_LIST_NODE_TYPE,
+    UNKEYED_LIST_ENTRY_NODE_TYPE,
+    ANY_XML_NODE_TYPE;
+
+    public static NormalizedNodeType getSerializableNodeType(NormalizedNode node){
+        Preconditions.checkNotNull(node, "node should not be null");
+
+        if(node instanceof ContainerNode){
+            return CONTAINER_NODE_TYPE;
+        } else if(node instanceof LeafNode){
+            return LEAF_NODE_TYPE;
+        } else if(node instanceof MapNode){
+            return MAP_NODE_TYPE;
+        } else if(node instanceof MapEntryNode){
+            return MAP_ENTRY_NODE_TYPE;
+        } else if(node instanceof AugmentationNode){
+            return AUGMENTATION_NODE_TYPE;
+        } else if(node instanceof LeafSetNode){
+            return LEAF_SET_NODE_TYPE;
+        } else if(node instanceof LeafSetEntryNode){
+            return LEAF_SET_ENTRY_NODE_TYPE;
+        } else if(node instanceof ChoiceNode){
+            return CHOICE_NODE_TYPE;
+        } else if(node instanceof OrderedLeafSetNode){
+            return ORDERED_LEAF_SET_NODE_TYPE;
+        } else if(node instanceof OrderedMapNode){
+            return ORDERED_MAP_NODE_TYPE;
+        } else if(node instanceof UnkeyedListNode){
+            return UNKEYED_LIST_NODE_TYPE;
+        } else if(node instanceof UnkeyedListEntryNode){
+            return UNKEYED_LIST_ENTRY_NODE_TYPE;
+        } else if(node instanceof AnyXmlNode){
+            return ANY_XML_NODE_TYPE;
+        }
+        throw new IllegalArgumentException("Node type unknown : " + node.getClass().getSimpleName());
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentSerializer.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentSerializer.java
new file mode 100644 (file)
index 0000000..d7627c0
--- /dev/null
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore.node.utils.serialization;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.cluster.datastore.node.utils.NodeIdentifierFactory;
+import org.opendaylight.controller.cluster.datastore.node.utils.QNameFactory;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static org.opendaylight.controller.cluster.datastore.node.utils.serialization.PathArgumentType.getSerializablePathArgumentType;
+
+public class PathArgumentSerializer {
+    private static final Map<Class, PathArgumentAttributesGetter> pathArgumentAttributesGetters = new HashMap<>();
+
+    public static NormalizedNodeMessages.PathArgument serialize(NormalizedNodeSerializationContext context, YangInstanceIdentifier.PathArgument pathArgument){
+        Preconditions.checkNotNull(context, "context should not be null");
+        Preconditions.checkNotNull(pathArgument, "pathArgument should not be null");
+
+        QName nodeType = null;
+        if (!(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier)) {
+            nodeType = pathArgument.getNodeType();
+        }
+
+        NormalizedNodeMessages.PathArgument.Builder builder =
+            NormalizedNodeMessages.PathArgument.newBuilder();
+
+        NormalizedNodeMessages.PathArgument serializablePathArgument =
+            builder
+                .setIntType(getSerializablePathArgumentType(pathArgument))
+                .setNodeType(encodeQName(context, nodeType))
+                .addAllAttribute(getPathArgumentAttributes(context, pathArgument))
+                .build();
+
+        return serializablePathArgument;
+    }
+
+
+    public static YangInstanceIdentifier.PathArgument deSerialize(NormalizedNodeDeSerializationContext context, NormalizedNodeMessages.PathArgument pathArgument){
+        Preconditions.checkNotNull(context, "context should not be null");
+        Preconditions.checkNotNull(pathArgument, "pathArgument should not be null");
+
+        return parsePathArgument(context, pathArgument);
+    }
+
+
+    private static interface PathArgumentAttributesGetter {
+        Iterable<? extends NormalizedNodeMessages.PathArgumentAttribute> get(NormalizedNodeSerializationContext context,
+            YangInstanceIdentifier.PathArgument pathArgument);
+    }
+
+    static {
+        pathArgumentAttributesGetters.put(YangInstanceIdentifier.NodeWithValue.class, new PathArgumentAttributesGetter() {
+            @Override
+            public Iterable<? extends NormalizedNodeMessages.PathArgumentAttribute> get(
+                NormalizedNodeSerializationContext context,
+                YangInstanceIdentifier.PathArgument pathArgument) {
+                List<NormalizedNodeMessages.PathArgumentAttribute> attributes =
+                    new ArrayList<>();
+
+                YangInstanceIdentifier.NodeWithValue identifier
+                    = (YangInstanceIdentifier.NodeWithValue) pathArgument;
+
+                NormalizedNodeMessages.PathArgumentAttribute attribute =
+                    buildAttribute(context, null, identifier.getValue());
+
+                attributes.add(attribute);
+
+                return attributes;
+
+            }
+        });
+
+        pathArgumentAttributesGetters.put(YangInstanceIdentifier.NodeIdentifierWithPredicates.class, new PathArgumentAttributesGetter() {
+            @Override
+            public Iterable<? extends NormalizedNodeMessages.PathArgumentAttribute> get(
+                NormalizedNodeSerializationContext context,
+                YangInstanceIdentifier.PathArgument pathArgument) {
+
+                List<NormalizedNodeMessages.PathArgumentAttribute> attributes =
+                    new ArrayList<>();
+
+                YangInstanceIdentifier.NodeIdentifierWithPredicates identifier
+                    = (YangInstanceIdentifier.NodeIdentifierWithPredicates) pathArgument;
+
+                for (QName key : identifier.getKeyValues().keySet()) {
+                    Object value = identifier.getKeyValues().get(key);
+                    NormalizedNodeMessages.PathArgumentAttribute attribute =
+                        buildAttribute(context, key, value);
+
+                    attributes.add(attribute);
+
+                }
+
+                return attributes;
+
+            }
+        });
+
+        pathArgumentAttributesGetters.put(YangInstanceIdentifier.AugmentationIdentifier.class, new PathArgumentAttributesGetter() {
+            @Override
+            public Iterable<? extends NormalizedNodeMessages.PathArgumentAttribute> get(
+                NormalizedNodeSerializationContext context,
+                YangInstanceIdentifier.PathArgument pathArgument) {
+
+                List<NormalizedNodeMessages.PathArgumentAttribute> attributes =
+                    new ArrayList<>();
+
+                YangInstanceIdentifier.AugmentationIdentifier identifier
+                    = (YangInstanceIdentifier.AugmentationIdentifier) pathArgument;
+
+                for (QName key : identifier.getPossibleChildNames()) {
+                    Object value = key;
+                    NormalizedNodeMessages.PathArgumentAttribute attribute =
+                        buildAttribute(context, key, value);
+
+                    attributes.add(attribute);
+
+                }
+
+                return attributes;
+
+            }
+        });
+
+
+        pathArgumentAttributesGetters.put(YangInstanceIdentifier.NodeIdentifier.class, new PathArgumentAttributesGetter() {
+            @Override
+            public Iterable<? extends NormalizedNodeMessages.PathArgumentAttribute> get(
+                NormalizedNodeSerializationContext context,
+                YangInstanceIdentifier.PathArgument pathArgument) {
+                return Collections.emptyList();
+            }
+        });
+    }
+
+    private static NormalizedNodeMessages.PathArgumentAttribute buildAttribute(NormalizedNodeSerializationContext context,QName name, Object value){
+        NormalizedNodeMessages.PathArgumentAttribute.Builder builder =
+            NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+
+        builder.setName(encodeQName(context, name));
+        ValueSerializer.serialize(builder, context, value);
+
+        return builder.build();
+
+    }
+
+    private static NormalizedNodeMessages.QName.Builder encodeQName(NormalizedNodeSerializationContext context, QName qName){
+        if(qName == null){
+            return NormalizedNodeMessages.QName.getDefaultInstance().toBuilder();
+        }
+        NormalizedNodeMessages.QName.Builder qNameBuilder =
+            NormalizedNodeMessages.QName.newBuilder();
+
+        qNameBuilder.setNamespace(context.addNamespace(qName.getNamespace()));
+
+        qNameBuilder.setRevision(context.addRevision(qName.getRevision()));
+
+        qNameBuilder.setLocalName(context.addLocalName(qName.getLocalName()));
+
+        return qNameBuilder;
+    }
+
+    private static Iterable<? extends NormalizedNodeMessages.PathArgumentAttribute> getPathArgumentAttributes(
+            NormalizedNodeSerializationContext context,
+            YangInstanceIdentifier.PathArgument pathArgument) {
+
+        return pathArgumentAttributesGetters.get(pathArgument.getClass()).get(context, pathArgument);
+
+    }
+
+
+    private static String qNameToString(NormalizedNodeDeSerializationContext context,
+        NormalizedNodeMessages.QName qName){
+        // If this serializer is used qName cannot be null (see encodeQName)
+        // adding null check only in case someone tried to deSerialize a protocol buffer node
+        // that was not serialized using the PathArgumentSerializer
+        Preconditions.checkNotNull(qName, "qName should not be null");
+        Preconditions.checkArgument(!"".equals(qName.getLocalName()),
+            "qName.localName cannot be empty qName = " + qName.toString());
+        Preconditions.checkArgument(qName.getNamespace() != -1, "qName.namespace should be valid");
+
+        StringBuilder sb = new StringBuilder();
+        String namespace = context.getNamespace(qName.getNamespace());
+        String revision = "";
+        String localName = context.getLocalName(qName.getLocalName());
+        if(qName.getRevision() != -1){
+            revision = context.getRevision(qName.getRevision());
+            sb.append("(").append(namespace).append("?revision=").append(
+                revision).append(")").append(
+                localName);
+        } else {
+            sb.append("(").append(namespace).append(")").append(
+                localName);
+        }
+
+        return sb.toString();
+
+    }
+
+    /**
+     * Parse a protocol buffer PathArgument and return an MD-SAL PathArgument
+     *
+     * @param pathArgument protocol buffer PathArgument
+     * @return MD-SAL PathArgument
+     */
+    private static YangInstanceIdentifier.PathArgument parsePathArgument(
+        NormalizedNodeDeSerializationContext context,
+        NormalizedNodeMessages.PathArgument pathArgument) {
+
+        Preconditions.checkArgument(pathArgument.getIntType() >= 0
+            && pathArgument.getIntType() < PathArgumentType.values().length,
+            "Illegal PathArgumentType " + pathArgument.getIntType());
+
+        switch(PathArgumentType.values()[pathArgument.getIntType()]){
+            case NODE_IDENTIFIER_WITH_VALUE : {
+
+                YangInstanceIdentifier.NodeWithValue nodeWithValue =
+                    new YangInstanceIdentifier.NodeWithValue(
+                        QNameFactory.create(qNameToString(context, pathArgument.getNodeType())),
+                        parseAttribute(context, pathArgument.getAttribute(0)));
+
+                return nodeWithValue;
+            }
+
+            case NODE_IDENTIFIER_WITH_PREDICATES : {
+
+                YangInstanceIdentifier.NodeIdentifierWithPredicates
+                    nodeIdentifierWithPredicates =
+                    new YangInstanceIdentifier.NodeIdentifierWithPredicates(
+                        QNameFactory.create(qNameToString(context, pathArgument.getNodeType())),
+                        toAttributesMap(context, pathArgument.getAttributeList()));
+
+                return nodeIdentifierWithPredicates;
+            }
+
+            case AUGMENTATION_IDENTIFIER: {
+
+                Set<QName> qNameSet = new HashSet<>();
+
+                for(NormalizedNodeMessages.PathArgumentAttribute attribute : pathArgument.getAttributeList()){
+                    qNameSet.add(QNameFactory.create(qNameToString(context, attribute.getName())));
+                }
+
+                return new YangInstanceIdentifier.AugmentationIdentifier(qNameSet);
+
+            }
+            default: {
+                return NodeIdentifierFactory.getArgument(qNameToString(context,
+                    pathArgument.getNodeType()));
+            }
+
+        }
+    }
+
+    private static Map<QName, Object> toAttributesMap(
+        NormalizedNodeDeSerializationContext context,
+        List<NormalizedNodeMessages.PathArgumentAttribute> attributesList) {
+
+        Map<QName, Object> map = new HashMap<>();
+
+        for(NormalizedNodeMessages.PathArgumentAttribute attribute : attributesList){
+            NormalizedNodeMessages.QName name = attribute.getName();
+            Object value = parseAttribute(context, attribute);
+
+            map.put(QNameFactory.create(qNameToString(context, name)), value);
+        }
+
+        return map;
+    }
+
+    private static Object parseAttribute(NormalizedNodeDeSerializationContext context, NormalizedNodeMessages.PathArgumentAttribute attribute){
+        return ValueSerializer.deSerialize(context, attribute);
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentType.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentType.java
new file mode 100644 (file)
index 0000000..20009d8
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore.node.utils.serialization;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+public enum PathArgumentType {
+    AUGMENTATION_IDENTIFIER,
+    NODE_IDENTIFIER,
+    NODE_IDENTIFIER_WITH_VALUE,
+    NODE_IDENTIFIER_WITH_PREDICATES;
+
+    public static int getSerializablePathArgumentType(YangInstanceIdentifier.PathArgument pathArgument){
+        Preconditions.checkNotNull(pathArgument, "pathArgument should not be null");
+
+        if(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier){
+            return AUGMENTATION_IDENTIFIER.ordinal();
+        } else if(pathArgument instanceof YangInstanceIdentifier.NodeIdentifier){
+            return NODE_IDENTIFIER.ordinal();
+        } else if(pathArgument instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates){
+            return NODE_IDENTIFIER_WITH_PREDICATES.ordinal();
+        } else if(pathArgument instanceof YangInstanceIdentifier.NodeWithValue){
+            return NODE_IDENTIFIER_WITH_VALUE.ordinal();
+        }
+        throw new IllegalArgumentException("Unknown type of PathArgument = " + pathArgument.toString());
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializer.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializer.java
new file mode 100644 (file)
index 0000000..04c95d6
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore.node.utils.serialization;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.cluster.datastore.node.utils.QNameFactory;
+import org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.HashSet;
+import java.util.Set;
+
+public class ValueSerializer {
+    public static void serialize(NormalizedNodeMessages.Node.Builder builder,
+        NormalizedNodeSerializationContext context, Object value){
+        builder.setIntValueType(ValueType.getSerializableType(value).ordinal());
+
+        if(value instanceof YangInstanceIdentifier) {
+            builder.setInstanceIdentifierValue(
+                InstanceIdentifierUtils.toSerializable((YangInstanceIdentifier) value));
+        } else if(value instanceof Set) {
+            Set set = (Set) value;
+            if(!set.isEmpty()){
+                for(Object o : set){
+                    if(o instanceof String){
+                        builder.addBitsValue(o.toString());
+                    } else {
+                        throw new IllegalArgumentException("Expected value type to be Bits but was : " +
+                            value.toString());
+                    }
+                }
+            }
+        } else {
+            builder.setValue(value.toString());
+        }
+    }
+
+    public static void serialize(NormalizedNodeMessages.PathArgumentAttribute.Builder builder,
+        NormalizedNodeSerializationContext context, Object value){
+
+        builder.setType(ValueType.getSerializableType(value).ordinal());
+        builder.setValue(value.toString());
+    }
+
+    public static Object deSerialize(
+        NormalizedNodeDeSerializationContext context, NormalizedNodeMessages.Node node) {
+        if(node.getIntValueType() == ValueType.YANG_IDENTIFIER_TYPE.ordinal()){
+            return InstanceIdentifierUtils.fromSerializable(
+                node.getInstanceIdentifierValue());
+        } else if(node.getIntValueType() == ValueType.BITS_TYPE.ordinal()){
+            return new HashSet(node.getBitsValueList());
+        }
+        return deSerializeBasicTypes(node.getIntValueType(), node.getValue());
+    }
+
+    public static Object deSerialize(
+        NormalizedNodeDeSerializationContext context,
+        NormalizedNodeMessages.PathArgumentAttribute attribute) {
+        return deSerializeBasicTypes(attribute.getType(), attribute.getValue());
+    }
+
+
+    private static Object deSerializeBasicTypes(int valueType, String value) {
+        Preconditions.checkArgument(valueType >= 0 && valueType < ValueType.values().length,
+            "Illegal value type " + valueType );
+
+        switch(ValueType.values()[valueType]){
+           case SHORT_TYPE: {
+               return Short.valueOf(value);
+           }
+           case BOOL_TYPE: {
+               return Boolean.valueOf(value);
+           }
+           case BYTE_TYPE: {
+               return Byte.valueOf(value);
+           }
+           case INT_TYPE : {
+                return Integer.valueOf(value);
+           }
+           case LONG_TYPE: {
+               return Long.valueOf(value);
+           }
+           case QNAME_TYPE: {
+               return QNameFactory.create(value);
+           }
+           case BIG_INTEGER_TYPE: {
+               return new BigInteger(value);
+           }
+           case BIG_DECIMAL_TYPE: {
+               return new BigDecimal(value);
+           }
+           default: {
+               return value;
+           }
+        }
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueType.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueType.java
new file mode 100644 (file)
index 0000000..8724dfe
--- /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.cluster.datastore.node.utils.serialization;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+public enum ValueType {
+    SHORT_TYPE,
+    BYTE_TYPE,
+    INT_TYPE,
+    LONG_TYPE,
+    BOOL_TYPE,
+    QNAME_TYPE,
+    BITS_TYPE,
+    YANG_IDENTIFIER_TYPE,
+    STRING_TYPE,
+    BIG_INTEGER_TYPE,
+    BIG_DECIMAL_TYPE;
+
+    private static Map<Class, ValueType> types = new HashMap<>();
+
+    static {
+        types.put(String.class, STRING_TYPE);
+        types.put(Byte.class, BYTE_TYPE);
+        types.put(Integer.class, INT_TYPE);
+        types.put(Long.class, LONG_TYPE);
+        types.put(Boolean.class, BOOL_TYPE);
+        types.put(QName.class, QNAME_TYPE);
+        types.put(Set.class, BITS_TYPE);
+        types.put(YangInstanceIdentifier.class, YANG_IDENTIFIER_TYPE);
+        types.put(Short.class,SHORT_TYPE);
+        types.put(BigInteger.class, BIG_INTEGER_TYPE);
+        types.put(BigDecimal.class, BIG_DECIMAL_TYPE);
+    }
+
+    public static final ValueType getSerializableType(Object node){
+        Preconditions.checkNotNull(node, "node should not be null");
+
+        if(types.containsKey(node.getClass())) {
+            return types.get(node.getClass());
+        } else if(node instanceof Set){
+            return BITS_TYPE;
+        }
+
+        throw new IllegalArgumentException("Unknown value type " + node.getClass().getSimpleName());
+    }
+}
index 646431522e3c9d4ee3b7b3703839505b38f39bfd..c6d3625ac3ca4ba2cb5e093a64a8681e5c1b4b81 100644 (file)
@@ -11,9 +11,8 @@ package org.opendaylight.controller.common.actor;
 import akka.actor.ActorPath;
 import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
-import akka.dispatch.BoundedMailbox;
+import akka.dispatch.BoundedDequeBasedMailbox;
 import akka.dispatch.MailboxType;
-import akka.dispatch.MessageQueue;
 import akka.dispatch.ProducesMessageQueue;
 import com.codahale.metrics.Gauge;
 import com.codahale.metrics.MetricRegistry;
@@ -24,7 +23,7 @@ import scala.concurrent.duration.FiniteDuration;
 
 import java.util.concurrent.TimeUnit;
 
-public class MeteredBoundedMailbox implements MailboxType, ProducesMessageQueue<BoundedMailbox.MessageQueue> {
+public class MeteredBoundedMailbox implements MailboxType, ProducesMessageQueue<MeteredBoundedMailbox.MeteredMessageQueue> {
 
     private MeteredMessageQueue queue;
     private Integer capacity;
@@ -33,16 +32,18 @@ public class MeteredBoundedMailbox implements MailboxType, ProducesMessageQueue<
     private MetricsReporter reporter;
 
     private final String QUEUE_SIZE = "queue-size";
+    private final String CAPACITY = "mailbox-capacity";
+    private final String TIMEOUT  = "mailbox-push-timeout-time";
     private final Long DEFAULT_TIMEOUT = 10L;
 
     public MeteredBoundedMailbox(ActorSystem.Settings settings, Config config) {
         Preconditions.checkArgument( config.hasPath("mailbox-capacity"), "Missing configuration [mailbox-capacity]" );
-        this.capacity = config.getInt("mailbox-capacity");
+        this.capacity = config.getInt(CAPACITY);
         Preconditions.checkArgument( this.capacity > 0, "mailbox-capacity must be > 0");
 
         Long timeout = -1L;
-        if ( config.hasPath("mailbox-push-timeout-time") ){
-            timeout = config.getDuration("mailbox-push-timeout-time", TimeUnit.NANOSECONDS);
+        if ( config.hasPath(TIMEOUT) ){
+            timeout = config.getDuration(TIMEOUT, TimeUnit.NANOSECONDS);
         } else {
             timeout = DEFAULT_TIMEOUT;
         }
@@ -54,7 +55,7 @@ public class MeteredBoundedMailbox implements MailboxType, ProducesMessageQueue<
 
 
     @Override
-    public MessageQueue create(final scala.Option<ActorRef> owner, scala.Option<ActorSystem> system) {
+    public MeteredMessageQueue create(final scala.Option<ActorRef> owner, scala.Option<ActorSystem> system) {
         this.queue = new MeteredMessageQueue(this.capacity, this.pushTimeOut);
         monitorQueueSize(owner, this.queue);
         return this.queue;
@@ -65,14 +66,15 @@ public class MeteredBoundedMailbox implements MailboxType, ProducesMessageQueue<
             return; //there's no actor to monitor
         }
         actorPath = owner.get().path();
-        MetricRegistry registry = reporter.getMetricsRegistry();
+        String actorInstanceId = Integer.toString(owner.get().hashCode());
 
-        String actorName = registry.name(actorPath.toString(), QUEUE_SIZE);
+        MetricRegistry registry = reporter.getMetricsRegistry();
+        String actorName = registry.name(actorPath.toString(), actorInstanceId, QUEUE_SIZE);
 
         if (registry.getMetrics().containsKey(actorName))
             return; //already registered
 
-        reporter.getMetricsRegistry().register(actorName,
+        registry.register(actorName,
                 new Gauge<Integer>() {
                     @Override
                     public Integer getValue() {
@@ -82,7 +84,7 @@ public class MeteredBoundedMailbox implements MailboxType, ProducesMessageQueue<
     }
 
 
-    public static class MeteredMessageQueue extends BoundedMailbox.MessageQueue {
+    public static class MeteredMessageQueue extends BoundedDequeBasedMailbox.MessageQueue {
 
         public MeteredMessageQueue(int capacity, FiniteDuration pushTimeOut) {
             super(capacity, pushTimeOut);
@@ -1,14 +1,14 @@
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: KeyValueMessages.proto
 
-package org.opendaylight.controller.cluster.example.protobuff.messages;
+package org.opendaylight.controller.protobuff.messages.cluster.example;
 
 public final class KeyValueMessages {
   private KeyValueMessages() {}
   public static void registerAllExtensions(
       com.google.protobuf.ExtensionRegistry registry) {
-    registry.add(org.opendaylight.controller.cluster.example.protobuff.messages.KeyValueMessages.key);
-    registry.add(org.opendaylight.controller.cluster.example.protobuff.messages.KeyValueMessages.value);
+    registry.add(org.opendaylight.controller.protobuff.messages.cluster.example.KeyValueMessages.key);
+    registry.add(org.opendaylight.controller.protobuff.messages.cluster.example.KeyValueMessages.value);
   }
   public static final int KEY_FIELD_NUMBER = 2;
   /**
@@ -16,7 +16,7 @@ public final class KeyValueMessages {
    */
   public static final
     com.google.protobuf.GeneratedMessage.GeneratedExtension<
-      org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
+      org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
       java.lang.String> key = com.google.protobuf.GeneratedMessage
           .newFileScopedGeneratedExtension(
         java.lang.String.class,
@@ -27,7 +27,7 @@ public final class KeyValueMessages {
    */
   public static final
     com.google.protobuf.GeneratedMessage.GeneratedExtension<
-      org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
+      org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
       java.lang.String> value = com.google.protobuf.GeneratedMessage
           .newFileScopedGeneratedExtension(
         java.lang.String.class,
@@ -49,7 +49,7 @@ public final class KeyValueMessages {
       "e\022R.org.opendaylight.controller.cluster." +
       "raft.AppendEntries.ReplicatedLogEntry.Pa" +
       "yload\030\003 \001(\tBT\n>org.opendaylight.controll" +
-      "er.cluster.example.protobuff.messagesB\020K" +
+      "er.protobuff.messages.cluster.exampleB\020K" +
       "eyValueMessagesH\001"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
@@ -65,7 +65,7 @@ public final class KeyValueMessages {
     com.google.protobuf.Descriptors.FileDescriptor
       .internalBuildGeneratedFileFrom(descriptorData,
         new com.google.protobuf.Descriptors.FileDescriptor[] {
-          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.getDescriptor(),
+          org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.getDescriptor(),
         }, assigner);
   }
 
@@ -1,7 +1,7 @@
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: AppendEntriesMessages.proto
 
-package org.opendaylight.controller.cluster.raft.protobuff.messages;
+package org.opendaylight.controller.protobuff.messages.cluster.raft;
 
 public final class AppendEntriesMessages {
   private AppendEntriesMessages() {}
@@ -60,12 +60,12 @@ public final class AppendEntriesMessages {
     /**
      * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
      */
-    java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> 
+    java.util.List<org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry>
         getLogEntriesList();
     /**
      * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
      */
-    org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getLogEntries(int index);
+    org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getLogEntries(int index);
     /**
      * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
      */
@@ -73,12 +73,12 @@ public final class AppendEntriesMessages {
     /**
      * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
      */
-    java.util.List<? extends org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder> 
+    java.util.List<? extends org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder>
         getLogEntriesOrBuilderList();
     /**
      * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
      */
-    org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder getLogEntriesOrBuilder(
+    org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder getLogEntriesOrBuilder(
         int index);
 
     // optional int64 leaderCommit = 6;
@@ -164,10 +164,10 @@ public final class AppendEntriesMessages {
             }
             case 42: {
               if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
-                logEntries_ = new java.util.ArrayList<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry>();
+                logEntries_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry>();
                 mutable_bitField0_ |= 0x00000010;
               }
-              logEntries_.add(input.readMessage(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PARSER, extensionRegistry));
+              logEntries_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PARSER, extensionRegistry));
               break;
             }
             case 48: {
@@ -192,14 +192,14 @@ public final class AppendEntriesMessages {
     }
     public static final com.google.protobuf.Descriptors.Descriptor
         getDescriptor() {
-      return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor;
+      return org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor;
     }
 
     protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
         internalGetFieldAccessorTable() {
-      return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_fieldAccessorTable
+      return org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_fieldAccessorTable
           .ensureFieldAccessorsInitialized(
-              org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.Builder.class);
+              org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.class, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.Builder.class);
     }
 
     public static com.google.protobuf.Parser<AppendEntries> PARSER =
@@ -248,11 +248,11 @@ public final class AppendEntriesMessages {
       /**
        * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
        */
-      org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getData();
+      org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getData();
       /**
        * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
        */
-      org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder getDataOrBuilder();
+      org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder getDataOrBuilder();
     }
     /**
      * Protobuf type {@code org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry}
@@ -316,11 +316,11 @@ public final class AppendEntriesMessages {
                 break;
               }
               case 26: {
-                org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder subBuilder = null;
+                org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder subBuilder = null;
                 if (((bitField0_ & 0x00000004) == 0x00000004)) {
                   subBuilder = data_.toBuilder();
                 }
-                data_ = input.readMessage(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.PARSER, extensionRegistry);
+                data_ = input.readMessage(org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.PARSER, extensionRegistry);
                 if (subBuilder != null) {
                   subBuilder.mergeFrom(data_);
                   data_ = subBuilder.buildPartial();
@@ -342,14 +342,14 @@ public final class AppendEntriesMessages {
       }
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
-        return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor;
+        return org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor;
       }
 
       protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
           internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_fieldAccessorTable
+        return org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_fieldAccessorTable
             .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder.class);
+                org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.class, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder.class);
       }
 
       public static com.google.protobuf.Parser<ReplicatedLogEntry> PARSER =
@@ -393,7 +393,7 @@ public final class AppendEntriesMessages {
           com.google.protobuf.GeneratedMessage.ExtendableMessage<
             Payload> implements PayloadOrBuilder {
         // Use Payload.newBuilder() to construct.
-        private Payload(com.google.protobuf.GeneratedMessage.ExtendableBuilder<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, ?> builder) {
+        private Payload(com.google.protobuf.GeneratedMessage.ExtendableBuilder<org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, ?> builder) {
           super(builder);
           this.unknownFields = builder.getUnknownFields();
         }
@@ -456,14 +456,14 @@ public final class AppendEntriesMessages {
         }
         public static final com.google.protobuf.Descriptors.Descriptor
             getDescriptor() {
-          return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor;
+          return org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor;
         }
 
         protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
             internalGetFieldAccessorTable() {
-          return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_fieldAccessorTable
+          return org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_fieldAccessorTable
               .ensureFieldAccessorsInitialized(
-                  org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder.class);
+                  org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.class, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder.class);
         }
 
         public static com.google.protobuf.Parser<Payload> PARSER =
@@ -499,7 +499,7 @@ public final class AppendEntriesMessages {
           if (ref instanceof java.lang.String) {
             return (java.lang.String) ref;
           } else {
-            com.google.protobuf.ByteString bs = 
+            com.google.protobuf.ByteString bs =
                 (com.google.protobuf.ByteString) ref;
             java.lang.String s = bs.toStringUtf8();
             if (bs.isValidUtf8()) {
@@ -515,7 +515,7 @@ public final class AppendEntriesMessages {
             getClientPayloadClassNameBytes() {
           java.lang.Object ref = clientPayloadClassName_;
           if (ref instanceof java.lang.String) {
-            com.google.protobuf.ByteString b = 
+            com.google.protobuf.ByteString b =
                 com.google.protobuf.ByteString.copyFromUtf8(
                     (java.lang.String) ref);
             clientPayloadClassName_ = b;
@@ -545,7 +545,7 @@ public final class AppendEntriesMessages {
                             throws java.io.IOException {
           getSerializedSize();
           com.google.protobuf.GeneratedMessage
-            .ExtendableMessage<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload>.ExtensionWriter extensionWriter =
+            .ExtendableMessage<org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload>.ExtensionWriter extensionWriter =
               newExtensionWriter();
           if (((bitField0_ & 0x00000001) == 0x00000001)) {
             output.writeBytes(1, getClientPayloadClassNameBytes());
@@ -577,53 +577,53 @@ public final class AppendEntriesMessages {
           return super.writeReplace();
         }
 
-        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+        public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
             com.google.protobuf.ByteString data)
             throws com.google.protobuf.InvalidProtocolBufferException {
           return PARSER.parseFrom(data);
         }
-        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+        public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
             com.google.protobuf.ByteString data,
             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
             throws com.google.protobuf.InvalidProtocolBufferException {
           return PARSER.parseFrom(data, extensionRegistry);
         }
-        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(byte[] data)
+        public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(byte[] data)
             throws com.google.protobuf.InvalidProtocolBufferException {
           return PARSER.parseFrom(data);
         }
-        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+        public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
             byte[] data,
             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
             throws com.google.protobuf.InvalidProtocolBufferException {
           return PARSER.parseFrom(data, extensionRegistry);
         }
-        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(java.io.InputStream input)
+        public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(java.io.InputStream input)
             throws java.io.IOException {
           return PARSER.parseFrom(input);
         }
-        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+        public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
             java.io.InputStream input,
             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
             throws java.io.IOException {
           return PARSER.parseFrom(input, extensionRegistry);
         }
-        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseDelimitedFrom(java.io.InputStream input)
+        public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseDelimitedFrom(java.io.InputStream input)
             throws java.io.IOException {
           return PARSER.parseDelimitedFrom(input);
         }
-        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseDelimitedFrom(
+        public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseDelimitedFrom(
             java.io.InputStream input,
             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
             throws java.io.IOException {
           return PARSER.parseDelimitedFrom(input, extensionRegistry);
         }
-        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+        public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
             com.google.protobuf.CodedInputStream input)
             throws java.io.IOException {
           return PARSER.parseFrom(input);
         }
-        public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
+        public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parseFrom(
             com.google.protobuf.CodedInputStream input,
             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
             throws java.io.IOException {
@@ -632,7 +632,7 @@ public final class AppendEntriesMessages {
 
         public static Builder newBuilder() { return Builder.create(); }
         public Builder newBuilderForType() { return newBuilder(); }
-        public static Builder newBuilder(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload prototype) {
+        public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload prototype) {
           return newBuilder().mergeFrom(prototype);
         }
         public Builder toBuilder() { return newBuilder(this); }
@@ -648,20 +648,20 @@ public final class AppendEntriesMessages {
          */
         public static final class Builder extends
             com.google.protobuf.GeneratedMessage.ExtendableBuilder<
-              org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, Builder> implements org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder {
+              org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, Builder> implements org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder {
           public static final com.google.protobuf.Descriptors.Descriptor
               getDescriptor() {
-            return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor;
+            return org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor;
           }
 
           protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
               internalGetFieldAccessorTable() {
-            return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_fieldAccessorTable
+            return org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_fieldAccessorTable
                 .ensureFieldAccessorsInitialized(
-                    org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder.class);
+                    org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.class, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder.class);
           }
 
-          // Construct using org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.newBuilder()
+          // Construct using org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.newBuilder()
           private Builder() {
             maybeForceBuilderInitialization();
           }
@@ -692,23 +692,23 @@ public final class AppendEntriesMessages {
 
           public com.google.protobuf.Descriptors.Descriptor
               getDescriptorForType() {
-            return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor;
+            return org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_Payload_descriptor;
           }
 
-          public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getDefaultInstanceForType() {
-            return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+          public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getDefaultInstanceForType() {
+            return org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
           }
 
-          public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload build() {
-            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload result = buildPartial();
+          public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload build() {
+            org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload result = buildPartial();
             if (!result.isInitialized()) {
               throw newUninitializedMessageException(result);
             }
             return result;
           }
 
-          public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload buildPartial() {
-            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload result = new org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload(this);
+          public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload buildPartial() {
+            org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload result = new org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload(this);
             int from_bitField0_ = bitField0_;
             int to_bitField0_ = 0;
             if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
@@ -721,16 +721,16 @@ public final class AppendEntriesMessages {
           }
 
           public Builder mergeFrom(com.google.protobuf.Message other) {
-            if (other instanceof org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload) {
-              return mergeFrom((org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload)other);
+            if (other instanceof org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload) {
+              return mergeFrom((org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload)other);
             } else {
               super.mergeFrom(other);
               return this;
             }
           }
 
-          public Builder mergeFrom(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload other) {
-            if (other == org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance()) return this;
+          public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload other) {
+            if (other == org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance()) return this;
             if (other.hasClientPayloadClassName()) {
               bitField0_ |= 0x00000001;
               clientPayloadClassName_ = other.clientPayloadClassName_;
@@ -743,7 +743,7 @@ public final class AppendEntriesMessages {
 
           public final boolean isInitialized() {
             if (!extensionsAreInitialized()) {
-              
+
               return false;
             }
             return true;
@@ -753,11 +753,11 @@ public final class AppendEntriesMessages {
               com.google.protobuf.CodedInputStream input,
               com.google.protobuf.ExtensionRegistryLite extensionRegistry)
               throws java.io.IOException {
-            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parsedMessage = null;
+            org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload parsedMessage = null;
             try {
               parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
             } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-              parsedMessage = (org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload) e.getUnfinishedMessage();
+              parsedMessage = (org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload) e.getUnfinishedMessage();
               throw e;
             } finally {
               if (parsedMessage != null) {
@@ -797,7 +797,7 @@ public final class AppendEntriesMessages {
               getClientPayloadClassNameBytes() {
             java.lang.Object ref = clientPayloadClassName_;
             if (ref instanceof String) {
-              com.google.protobuf.ByteString b = 
+              com.google.protobuf.ByteString b =
                   com.google.protobuf.ByteString.copyFromUtf8(
                       (java.lang.String) ref);
               clientPayloadClassName_ = b;
@@ -888,7 +888,7 @@ public final class AppendEntriesMessages {
 
       // optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;
       public static final int DATA_FIELD_NUMBER = 3;
-      private org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload data_;
+      private org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload data_;
       /**
        * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
        */
@@ -898,20 +898,20 @@ public final class AppendEntriesMessages {
       /**
        * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
        */
-      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getData() {
+      public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getData() {
         return data_;
       }
       /**
        * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
        */
-      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder getDataOrBuilder() {
+      public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder getDataOrBuilder() {
         return data_;
       }
 
       private void initFields() {
         term_ = 0L;
         index_ = 0L;
-        data_ = org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+        data_ = org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
       }
       private byte memoizedIsInitialized = -1;
       public final boolean isInitialized() {
@@ -973,53 +973,53 @@ public final class AppendEntriesMessages {
         return super.writeReplace();
       }
 
-      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+      public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
           com.google.protobuf.ByteString data)
           throws com.google.protobuf.InvalidProtocolBufferException {
         return PARSER.parseFrom(data);
       }
-      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+      public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
           com.google.protobuf.ByteString data,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws com.google.protobuf.InvalidProtocolBufferException {
         return PARSER.parseFrom(data, extensionRegistry);
       }
-      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(byte[] data)
+      public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(byte[] data)
           throws com.google.protobuf.InvalidProtocolBufferException {
         return PARSER.parseFrom(data);
       }
-      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+      public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
           byte[] data,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws com.google.protobuf.InvalidProtocolBufferException {
         return PARSER.parseFrom(data, extensionRegistry);
       }
-      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(java.io.InputStream input)
+      public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(java.io.InputStream input)
           throws java.io.IOException {
         return PARSER.parseFrom(input);
       }
-      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+      public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
           java.io.InputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
         return PARSER.parseFrom(input, extensionRegistry);
       }
-      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseDelimitedFrom(java.io.InputStream input)
+      public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseDelimitedFrom(java.io.InputStream input)
           throws java.io.IOException {
         return PARSER.parseDelimitedFrom(input);
       }
-      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseDelimitedFrom(
+      public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseDelimitedFrom(
           java.io.InputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
         return PARSER.parseDelimitedFrom(input, extensionRegistry);
       }
-      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+      public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
           com.google.protobuf.CodedInputStream input)
           throws java.io.IOException {
         return PARSER.parseFrom(input);
       }
-      public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
+      public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parseFrom(
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
@@ -1028,7 +1028,7 @@ public final class AppendEntriesMessages {
 
       public static Builder newBuilder() { return Builder.create(); }
       public Builder newBuilderForType() { return newBuilder(); }
-      public static Builder newBuilder(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry prototype) {
+      public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry prototype) {
         return newBuilder().mergeFrom(prototype);
       }
       public Builder toBuilder() { return newBuilder(this); }
@@ -1044,20 +1044,20 @@ public final class AppendEntriesMessages {
        */
       public static final class Builder extends
           com.google.protobuf.GeneratedMessage.Builder<Builder>
-         implements org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder {
+         implements org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder {
         public static final com.google.protobuf.Descriptors.Descriptor
             getDescriptor() {
-          return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor;
+          return org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor;
         }
 
         protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
             internalGetFieldAccessorTable() {
-          return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_fieldAccessorTable
+          return org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_fieldAccessorTable
               .ensureFieldAccessorsInitialized(
-                  org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder.class);
+                  org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.class, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder.class);
         }
 
-        // Construct using org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.newBuilder()
+        // Construct using org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.newBuilder()
         private Builder() {
           maybeForceBuilderInitialization();
         }
@@ -1083,7 +1083,7 @@ public final class AppendEntriesMessages {
           index_ = 0L;
           bitField0_ = (bitField0_ & ~0x00000002);
           if (dataBuilder_ == null) {
-            data_ = org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+            data_ = org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
           } else {
             dataBuilder_.clear();
           }
@@ -1097,23 +1097,23 @@ public final class AppendEntriesMessages {
 
         public com.google.protobuf.Descriptors.Descriptor
             getDescriptorForType() {
-          return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor;
+          return org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_ReplicatedLogEntry_descriptor;
         }
 
-        public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getDefaultInstanceForType() {
-          return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance();
+        public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getDefaultInstanceForType() {
+          return org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance();
         }
 
-        public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry build() {
-          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry result = buildPartial();
+        public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry build() {
+          org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry result = buildPartial();
           if (!result.isInitialized()) {
             throw newUninitializedMessageException(result);
           }
           return result;
         }
 
-        public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry buildPartial() {
-          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry result = new org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry(this);
+        public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry buildPartial() {
+          org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry result = new org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry(this);
           int from_bitField0_ = bitField0_;
           int to_bitField0_ = 0;
           if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
@@ -1138,16 +1138,16 @@ public final class AppendEntriesMessages {
         }
 
         public Builder mergeFrom(com.google.protobuf.Message other) {
-          if (other instanceof org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry) {
-            return mergeFrom((org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry)other);
+          if (other instanceof org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry) {
+            return mergeFrom((org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry)other);
           } else {
             super.mergeFrom(other);
             return this;
           }
         }
 
-        public Builder mergeFrom(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry other) {
-          if (other == org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance()) return this;
+        public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry other) {
+          if (other == org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance()) return this;
           if (other.hasTerm()) {
             setTerm(other.getTerm());
           }
@@ -1164,7 +1164,7 @@ public final class AppendEntriesMessages {
         public final boolean isInitialized() {
           if (hasData()) {
             if (!getData().isInitialized()) {
-              
+
               return false;
             }
           }
@@ -1175,11 +1175,11 @@ public final class AppendEntriesMessages {
             com.google.protobuf.CodedInputStream input,
             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
             throws java.io.IOException {
-          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parsedMessage = null;
+          org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry parsedMessage = null;
           try {
             parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
           } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-            parsedMessage = (org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry) e.getUnfinishedMessage();
+            parsedMessage = (org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry) e.getUnfinishedMessage();
             throw e;
           } finally {
             if (parsedMessage != null) {
@@ -1257,9 +1257,9 @@ public final class AppendEntriesMessages {
         }
 
         // optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;
-        private org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload data_ = org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+        private org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload data_ = org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
         private com.google.protobuf.SingleFieldBuilder<
-            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder> dataBuilder_;
+            org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder> dataBuilder_;
         /**
          * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
          */
@@ -1269,7 +1269,7 @@ public final class AppendEntriesMessages {
         /**
          * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
          */
-        public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getData() {
+        public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload getData() {
           if (dataBuilder_ == null) {
             return data_;
           } else {
@@ -1279,7 +1279,7 @@ public final class AppendEntriesMessages {
         /**
          * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
          */
-        public Builder setData(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload value) {
+        public Builder setData(org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload value) {
           if (dataBuilder_ == null) {
             if (value == null) {
               throw new NullPointerException();
@@ -1296,7 +1296,7 @@ public final class AppendEntriesMessages {
          * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
          */
         public Builder setData(
-            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder builderForValue) {
+            org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder builderForValue) {
           if (dataBuilder_ == null) {
             data_ = builderForValue.build();
             onChanged();
@@ -1309,12 +1309,12 @@ public final class AppendEntriesMessages {
         /**
          * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
          */
-        public Builder mergeData(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload value) {
+        public Builder mergeData(org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload value) {
           if (dataBuilder_ == null) {
             if (((bitField0_ & 0x00000004) == 0x00000004) &&
-                data_ != org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance()) {
+                data_ != org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance()) {
               data_ =
-                org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.newBuilder(data_).mergeFrom(value).buildPartial();
+                org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.newBuilder(data_).mergeFrom(value).buildPartial();
             } else {
               data_ = value;
             }
@@ -1330,7 +1330,7 @@ public final class AppendEntriesMessages {
          */
         public Builder clearData() {
           if (dataBuilder_ == null) {
-            data_ = org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
+            data_ = org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.getDefaultInstance();
             onChanged();
           } else {
             dataBuilder_.clear();
@@ -1341,7 +1341,7 @@ public final class AppendEntriesMessages {
         /**
          * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
          */
-        public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder getDataBuilder() {
+        public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder getDataBuilder() {
           bitField0_ |= 0x00000004;
           onChanged();
           return getDataFieldBuilder().getBuilder();
@@ -1349,7 +1349,7 @@ public final class AppendEntriesMessages {
         /**
          * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
          */
-        public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder getDataOrBuilder() {
+        public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder getDataOrBuilder() {
           if (dataBuilder_ != null) {
             return dataBuilder_.getMessageOrBuilder();
           } else {
@@ -1360,11 +1360,11 @@ public final class AppendEntriesMessages {
          * <code>optional .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry.Payload data = 3;</code>
          */
         private com.google.protobuf.SingleFieldBuilder<
-            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder> 
+            org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder>
             getDataFieldBuilder() {
           if (dataBuilder_ == null) {
             dataBuilder_ = new com.google.protobuf.SingleFieldBuilder<
-                org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder>(
+                org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload.Builder, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.PayloadOrBuilder>(
                     data_,
                     getParentForChildren(),
                     isClean());
@@ -1418,7 +1418,7 @@ public final class AppendEntriesMessages {
       if (ref instanceof java.lang.String) {
         return (java.lang.String) ref;
       } else {
-        com.google.protobuf.ByteString bs = 
+        com.google.protobuf.ByteString bs =
             (com.google.protobuf.ByteString) ref;
         java.lang.String s = bs.toStringUtf8();
         if (bs.isValidUtf8()) {
@@ -1434,7 +1434,7 @@ public final class AppendEntriesMessages {
         getLeaderIdBytes() {
       java.lang.Object ref = leaderId_;
       if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
+        com.google.protobuf.ByteString b =
             com.google.protobuf.ByteString.copyFromUtf8(
                 (java.lang.String) ref);
         leaderId_ = b;
@@ -1478,17 +1478,17 @@ public final class AppendEntriesMessages {
 
     // repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;
     public static final int LOGENTRIES_FIELD_NUMBER = 5;
-    private java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> logEntries_;
+    private java.util.List<org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> logEntries_;
     /**
      * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
      */
-    public java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> getLogEntriesList() {
+    public java.util.List<org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> getLogEntriesList() {
       return logEntries_;
     }
     /**
      * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
      */
-    public java.util.List<? extends org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder> 
+    public java.util.List<? extends org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder>
         getLogEntriesOrBuilderList() {
       return logEntries_;
     }
@@ -1501,13 +1501,13 @@ public final class AppendEntriesMessages {
     /**
      * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
      */
-    public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getLogEntries(int index) {
+    public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getLogEntries(int index) {
       return logEntries_.get(index);
     }
     /**
      * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
      */
-    public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder getLogEntriesOrBuilder(
+    public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder getLogEntriesOrBuilder(
         int index) {
       return logEntries_.get(index);
     }
@@ -1617,53 +1617,53 @@ public final class AppendEntriesMessages {
       return super.writeReplace();
     }
 
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries parseFrom(
         com.google.protobuf.ByteString data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries parseFrom(
         com.google.protobuf.ByteString data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data, extensionRegistry);
     }
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(byte[] data)
+    public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries parseFrom(byte[] data)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data);
     }
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries parseFrom(
         byte[] data,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws com.google.protobuf.InvalidProtocolBufferException {
       return PARSER.parseFrom(data, extensionRegistry);
     }
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries parseFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries parseFrom(
         java.io.InputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
       return PARSER.parseFrom(input, extensionRegistry);
     }
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseDelimitedFrom(java.io.InputStream input)
+    public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries parseDelimitedFrom(java.io.InputStream input)
         throws java.io.IOException {
       return PARSER.parseDelimitedFrom(input);
     }
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseDelimitedFrom(
+    public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries parseDelimitedFrom(
         java.io.InputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
       return PARSER.parseDelimitedFrom(input, extensionRegistry);
     }
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries parseFrom(
         com.google.protobuf.CodedInputStream input)
         throws java.io.IOException {
       return PARSER.parseFrom(input);
     }
-    public static org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parseFrom(
+    public static org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries parseFrom(
         com.google.protobuf.CodedInputStream input,
         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
         throws java.io.IOException {
@@ -1672,7 +1672,7 @@ public final class AppendEntriesMessages {
 
     public static Builder newBuilder() { return Builder.create(); }
     public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries prototype) {
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries prototype) {
       return newBuilder().mergeFrom(prototype);
     }
     public Builder toBuilder() { return newBuilder(this); }
@@ -1688,20 +1688,20 @@ public final class AppendEntriesMessages {
      */
     public static final class Builder extends
         com.google.protobuf.GeneratedMessage.Builder<Builder>
-       implements org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntriesOrBuilder {
+       implements org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntriesOrBuilder {
       public static final com.google.protobuf.Descriptors.Descriptor
           getDescriptor() {
-        return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor;
+        return org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor;
       }
 
       protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
           internalGetFieldAccessorTable() {
-        return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_fieldAccessorTable
+        return org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_fieldAccessorTable
             .ensureFieldAccessorsInitialized(
-                org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.class, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.Builder.class);
+                org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.class, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.Builder.class);
       }
 
-      // Construct using org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.newBuilder()
+      // Construct using org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.newBuilder()
       private Builder() {
         maybeForceBuilderInitialization();
       }
@@ -1747,23 +1747,23 @@ public final class AppendEntriesMessages {
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
-        return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor;
+        return org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.internal_static_org_opendaylight_controller_cluster_raft_AppendEntries_descriptor;
       }
 
-      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries getDefaultInstanceForType() {
-        return org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.getDefaultInstance();
+      public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.getDefaultInstance();
       }
 
-      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries build() {
-        org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries result = buildPartial();
+      public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries build() {
+        org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries result = buildPartial();
         if (!result.isInitialized()) {
           throw newUninitializedMessageException(result);
         }
         return result;
       }
 
-      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries buildPartial() {
-        org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries result = new org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries(this);
+      public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries buildPartial() {
+        org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries result = new org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries(this);
         int from_bitField0_ = bitField0_;
         int to_bitField0_ = 0;
         if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
@@ -1801,16 +1801,16 @@ public final class AppendEntriesMessages {
       }
 
       public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries) {
-          return mergeFrom((org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries)other);
+        if (other instanceof org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries)other);
         } else {
           super.mergeFrom(other);
           return this;
         }
       }
 
-      public Builder mergeFrom(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries other) {
-        if (other == org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.getDefaultInstance()) return this;
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries other) {
+        if (other == org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.getDefaultInstance()) return this;
         if (other.hasTerm()) {
           setTerm(other.getTerm());
         }
@@ -1843,7 +1843,7 @@ public final class AppendEntriesMessages {
               logEntriesBuilder_ = null;
               logEntries_ = other.logEntries_;
               bitField0_ = (bitField0_ & ~0x00000010);
-              logEntriesBuilder_ = 
+              logEntriesBuilder_ =
                 com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
                    getLogEntriesFieldBuilder() : null;
             } else {
@@ -1861,7 +1861,7 @@ public final class AppendEntriesMessages {
       public final boolean isInitialized() {
         for (int i = 0; i < getLogEntriesCount(); i++) {
           if (!getLogEntries(i).isInitialized()) {
-            
+
             return false;
           }
         }
@@ -1872,11 +1872,11 @@ public final class AppendEntriesMessages {
           com.google.protobuf.CodedInputStream input,
           com.google.protobuf.ExtensionRegistryLite extensionRegistry)
           throws java.io.IOException {
-        org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries parsedMessage = null;
+        org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries parsedMessage = null;
         try {
           parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
         } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries) e.getUnfinishedMessage();
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries) e.getUnfinishedMessage();
           throw e;
         } finally {
           if (parsedMessage != null) {
@@ -1949,7 +1949,7 @@ public final class AppendEntriesMessages {
           getLeaderIdBytes() {
         java.lang.Object ref = leaderId_;
         if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
+          com.google.protobuf.ByteString b =
               com.google.protobuf.ByteString.copyFromUtf8(
                   (java.lang.String) ref);
           leaderId_ = b;
@@ -2061,22 +2061,22 @@ public final class AppendEntriesMessages {
       }
 
       // repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;
-      private java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> logEntries_ =
+      private java.util.List<org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> logEntries_ =
         java.util.Collections.emptyList();
       private void ensureLogEntriesIsMutable() {
         if (!((bitField0_ & 0x00000010) == 0x00000010)) {
-          logEntries_ = new java.util.ArrayList<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry>(logEntries_);
+          logEntries_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry>(logEntries_);
           bitField0_ |= 0x00000010;
          }
       }
 
       private com.google.protobuf.RepeatedFieldBuilder<
-          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder> logEntriesBuilder_;
+          org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder> logEntriesBuilder_;
 
       /**
        * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
        */
-      public java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> getLogEntriesList() {
+      public java.util.List<org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> getLogEntriesList() {
         if (logEntriesBuilder_ == null) {
           return java.util.Collections.unmodifiableList(logEntries_);
         } else {
@@ -2096,7 +2096,7 @@ public final class AppendEntriesMessages {
       /**
        * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
        */
-      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getLogEntries(int index) {
+      public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry getLogEntries(int index) {
         if (logEntriesBuilder_ == null) {
           return logEntries_.get(index);
         } else {
@@ -2107,7 +2107,7 @@ public final class AppendEntriesMessages {
        * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
        */
       public Builder setLogEntries(
-          int index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry value) {
+          int index, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry value) {
         if (logEntriesBuilder_ == null) {
           if (value == null) {
             throw new NullPointerException();
@@ -2124,7 +2124,7 @@ public final class AppendEntriesMessages {
        * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
        */
       public Builder setLogEntries(
-          int index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder builderForValue) {
+          int index, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder builderForValue) {
         if (logEntriesBuilder_ == null) {
           ensureLogEntriesIsMutable();
           logEntries_.set(index, builderForValue.build());
@@ -2137,7 +2137,7 @@ public final class AppendEntriesMessages {
       /**
        * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
        */
-      public Builder addLogEntries(org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry value) {
+      public Builder addLogEntries(org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry value) {
         if (logEntriesBuilder_ == null) {
           if (value == null) {
             throw new NullPointerException();
@@ -2154,7 +2154,7 @@ public final class AppendEntriesMessages {
        * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
        */
       public Builder addLogEntries(
-          int index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry value) {
+          int index, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry value) {
         if (logEntriesBuilder_ == null) {
           if (value == null) {
             throw new NullPointerException();
@@ -2171,7 +2171,7 @@ public final class AppendEntriesMessages {
        * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
        */
       public Builder addLogEntries(
-          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder builderForValue) {
+          org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder builderForValue) {
         if (logEntriesBuilder_ == null) {
           ensureLogEntriesIsMutable();
           logEntries_.add(builderForValue.build());
@@ -2185,7 +2185,7 @@ public final class AppendEntriesMessages {
        * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
        */
       public Builder addLogEntries(
-          int index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder builderForValue) {
+          int index, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder builderForValue) {
         if (logEntriesBuilder_ == null) {
           ensureLogEntriesIsMutable();
           logEntries_.add(index, builderForValue.build());
@@ -2199,7 +2199,7 @@ public final class AppendEntriesMessages {
        * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
        */
       public Builder addAllLogEntries(
-          java.lang.Iterable<? extends org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> values) {
+          java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry> values) {
         if (logEntriesBuilder_ == null) {
           ensureLogEntriesIsMutable();
           super.addAll(values, logEntries_);
@@ -2238,14 +2238,14 @@ public final class AppendEntriesMessages {
       /**
        * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
        */
-      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder getLogEntriesBuilder(
+      public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder getLogEntriesBuilder(
           int index) {
         return getLogEntriesFieldBuilder().getBuilder(index);
       }
       /**
        * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
        */
-      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder getLogEntriesOrBuilder(
+      public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder getLogEntriesOrBuilder(
           int index) {
         if (logEntriesBuilder_ == null) {
           return logEntries_.get(index);  } else {
@@ -2255,7 +2255,7 @@ public final class AppendEntriesMessages {
       /**
        * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
        */
-      public java.util.List<? extends org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder> 
+      public java.util.List<? extends org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder>
            getLogEntriesOrBuilderList() {
         if (logEntriesBuilder_ != null) {
           return logEntriesBuilder_.getMessageOrBuilderList();
@@ -2266,31 +2266,31 @@ public final class AppendEntriesMessages {
       /**
        * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
        */
-      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder addLogEntriesBuilder() {
+      public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder addLogEntriesBuilder() {
         return getLogEntriesFieldBuilder().addBuilder(
-            org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance());
+            org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance());
       }
       /**
        * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
        */
-      public org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder addLogEntriesBuilder(
+      public org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder addLogEntriesBuilder(
           int index) {
         return getLogEntriesFieldBuilder().addBuilder(
-            index, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance());
+            index, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.getDefaultInstance());
       }
       /**
        * <code>repeated .org.opendaylight.controller.cluster.raft.AppendEntries.ReplicatedLogEntry logEntries = 5;</code>
        */
-      public java.util.List<org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder> 
+      public java.util.List<org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder>
            getLogEntriesBuilderList() {
         return getLogEntriesFieldBuilder().getBuilderList();
       }
       private com.google.protobuf.RepeatedFieldBuilder<
-          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder> 
+          org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder>
           getLogEntriesFieldBuilder() {
         if (logEntriesBuilder_ == null) {
           logEntriesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
-              org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder, org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder>(
+              org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Builder, org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntryOrBuilder>(
                   logEntries_,
                   ((bitField0_ & 0x00000010) == 0x00000010),
                   getParentForChildren(),
@@ -2380,8 +2380,8 @@ public final class AppendEntriesMessages {
       "aylight.controller.cluster.raft.AppendEn",
       "tries.ReplicatedLogEntry.Payload\032/\n\007Payl" +
       "oad\022\036\n\026clientPayloadClassName\030\001 \001(\t*\004\010\002\020" +
-      "eBV\n;org.opendaylight.controller.cluster" +
-      ".raft.protobuff.messagesB\025AppendEntriesM" +
+      "eBV\n;org.opendaylight.controller.protobu" +
+      "ff.messages.cluster.raftB\025AppendEntriesM" +
       "essagesH\001"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
@@ -1,13 +1,13 @@
 // Generated by the protocol buffer compiler.  DO NOT EDIT!
 // source: MockPayload.proto
 
-package org.opendaylight.controller.cluster.raft.protobuff.messages;
+package org.opendaylight.controller.protobuff.messages.cluster.raft.test;
 
 public final class MockPayloadMessages {
   private MockPayloadMessages() {}
   public static void registerAllExtensions(
       com.google.protobuf.ExtensionRegistry registry) {
-    registry.add(org.opendaylight.controller.cluster.raft.protobuff.messages.MockPayloadMessages.value);
+    registry.add(org.opendaylight.controller.protobuff.messages.cluster.raft.test.MockPayloadMessages.value);
   }
   public static final int VALUE_FIELD_NUMBER = 2;
   /**
@@ -15,7 +15,7 @@ public final class MockPayloadMessages {
    */
   public static final
     com.google.protobuf.GeneratedMessage.GeneratedExtension<
-      org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
+      org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
       java.lang.String> value = com.google.protobuf.GeneratedMessage
           .newFileScopedGeneratedExtension(
         java.lang.String.class,
@@ -29,13 +29,14 @@ public final class MockPayloadMessages {
       descriptor;
   static {
     java.lang.String[] descriptorData = {
-      "\n\021MockPayload.proto\022(org.opendaylight.co" +
-      "ntroller.cluster.raft\032\033AppendEntriesMess" +
-      "ages.proto:a\n\005value\022R.org.opendaylight.c" +
-      "ontroller.cluster.raft.AppendEntries.Rep" +
-      "licatedLogEntry.Payload\030\002 \001(\tBR\n;org.ope" +
-      "ndaylight.controller.cluster.raft.protob" +
-      "uff.messagesB\023MockPayloadMessages"
+      "\n\021MockPayload.proto\022-org.opendaylight.co" +
+      "ntroller.cluster.raft.test\032\033AppendEntrie" +
+      "sMessages.proto:a\n\005value\022R.org.opendayli" +
+      "ght.controller.cluster.raft.AppendEntrie" +
+      "s.ReplicatedLogEntry.Payload\030\002 \001(\tBW\n@or" +
+      "g.opendaylight.controller.protobuff.mess" +
+      "ages.cluster.raft.testB\023MockPayloadMessa" +
+      "ges"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -49,7 +50,7 @@ public final class MockPayloadMessages {
     com.google.protobuf.Descriptors.FileDescriptor
       .internalBuildGeneratedFileFrom(descriptorData,
         new com.google.protobuf.Descriptors.FileDescriptor[] {
-          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.getDescriptor(),
+          org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.getDescriptor(),
         }, assigner);
   }
 
index 35c2940be3e05aa9e03d8c922ecffde2cd0e823a..3926bc7dc347d611a67854ab14015734424d749b 100644 (file)
@@ -799,23 +799,809 @@ public final class NormalizedNodeMessages {
     // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.Attribute)
   }
 
+  public interface PathArgumentAttributeOrBuilder
+      extends com.google.protobuf.MessageOrBuilder {
+
+    // optional .org.opendaylight.controller.mdsal.QName name = 1;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+     */
+    boolean hasName();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName getName();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNameOrBuilder();
+
+    // optional string value = 2;
+    /**
+     * <code>optional string value = 2;</code>
+     */
+    boolean hasValue();
+    /**
+     * <code>optional string value = 2;</code>
+     */
+    java.lang.String getValue();
+    /**
+     * <code>optional string value = 2;</code>
+     */
+    com.google.protobuf.ByteString
+        getValueBytes();
+
+    // optional int32 type = 3;
+    /**
+     * <code>optional int32 type = 3;</code>
+     */
+    boolean hasType();
+    /**
+     * <code>optional int32 type = 3;</code>
+     */
+    int getType();
+  }
+  /**
+   * Protobuf type {@code org.opendaylight.controller.mdsal.PathArgumentAttribute}
+   */
+  public static final class PathArgumentAttribute extends
+      com.google.protobuf.GeneratedMessage
+      implements PathArgumentAttributeOrBuilder {
+    // Use PathArgumentAttribute.newBuilder() to construct.
+    private PathArgumentAttribute(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
+      super(builder);
+      this.unknownFields = builder.getUnknownFields();
+    }
+    private PathArgumentAttribute(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
+
+    private static final PathArgumentAttribute defaultInstance;
+    public static PathArgumentAttribute getDefaultInstance() {
+      return defaultInstance;
+    }
+
+    public PathArgumentAttribute getDefaultInstanceForType() {
+      return defaultInstance;
+    }
+
+    private final com.google.protobuf.UnknownFieldSet unknownFields;
+    @java.lang.Override
+    public final com.google.protobuf.UnknownFieldSet
+        getUnknownFields() {
+      return this.unknownFields;
+    }
+    private PathArgumentAttribute(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      initFields();
+      int mutable_bitField0_ = 0;
+      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+          com.google.protobuf.UnknownFieldSet.newBuilder();
+      try {
+        boolean done = false;
+        while (!done) {
+          int tag = input.readTag();
+          switch (tag) {
+            case 0:
+              done = true;
+              break;
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                                     extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
+            case 10: {
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000001) == 0x00000001)) {
+                subBuilder = name_.toBuilder();
+              }
+              name_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(name_);
+                name_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000001;
+              break;
+            }
+            case 18: {
+              bitField0_ |= 0x00000002;
+              value_ = input.readBytes();
+              break;
+            }
+            case 24: {
+              bitField0_ |= 0x00000004;
+              type_ = input.readInt32();
+              break;
+            }
+          }
+        }
+      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+        throw e.setUnfinishedMessage(this);
+      } catch (java.io.IOException e) {
+        throw new com.google.protobuf.InvalidProtocolBufferException(
+            e.getMessage()).setUnfinishedMessage(this);
+      } finally {
+        this.unknownFields = unknownFields.build();
+        makeExtensionsImmutable();
+      }
+    }
+    public static final com.google.protobuf.Descriptors.Descriptor
+        getDescriptor() {
+      return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgumentAttribute_descriptor;
+    }
+
+    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+        internalGetFieldAccessorTable() {
+      return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgumentAttribute_fieldAccessorTable
+          .ensureFieldAccessorsInitialized(
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.Builder.class);
+    }
+
+    public static com.google.protobuf.Parser<PathArgumentAttribute> PARSER =
+        new com.google.protobuf.AbstractParser<PathArgumentAttribute>() {
+      public PathArgumentAttribute parsePartialFrom(
+          com.google.protobuf.CodedInputStream input,
+          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+          throws com.google.protobuf.InvalidProtocolBufferException {
+        return new PathArgumentAttribute(input, extensionRegistry);
+      }
+    };
+
+    @java.lang.Override
+    public com.google.protobuf.Parser<PathArgumentAttribute> getParserForType() {
+      return PARSER;
+    }
+
+    private int bitField0_;
+    // optional .org.opendaylight.controller.mdsal.QName name = 1;
+    public static final int NAME_FIELD_NUMBER = 1;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName name_;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+     */
+    public boolean hasName() {
+      return ((bitField0_ & 0x00000001) == 0x00000001);
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName getName() {
+      return name_;
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNameOrBuilder() {
+      return name_;
+    }
+
+    // optional string value = 2;
+    public static final int VALUE_FIELD_NUMBER = 2;
+    private java.lang.Object value_;
+    /**
+     * <code>optional string value = 2;</code>
+     */
+    public boolean hasValue() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>optional string value = 2;</code>
+     */
+    public java.lang.String getValue() {
+      java.lang.Object ref = value_;
+      if (ref instanceof java.lang.String) {
+        return (java.lang.String) ref;
+      } else {
+        com.google.protobuf.ByteString bs =
+            (com.google.protobuf.ByteString) ref;
+        java.lang.String s = bs.toStringUtf8();
+        if (bs.isValidUtf8()) {
+          value_ = s;
+        }
+        return s;
+      }
+    }
+    /**
+     * <code>optional string value = 2;</code>
+     */
+    public com.google.protobuf.ByteString
+        getValueBytes() {
+      java.lang.Object ref = value_;
+      if (ref instanceof java.lang.String) {
+        com.google.protobuf.ByteString b =
+            com.google.protobuf.ByteString.copyFromUtf8(
+                (java.lang.String) ref);
+        value_ = b;
+        return b;
+      } else {
+        return (com.google.protobuf.ByteString) ref;
+      }
+    }
+
+    // optional int32 type = 3;
+    public static final int TYPE_FIELD_NUMBER = 3;
+    private int type_;
+    /**
+     * <code>optional int32 type = 3;</code>
+     */
+    public boolean hasType() {
+      return ((bitField0_ & 0x00000004) == 0x00000004);
+    }
+    /**
+     * <code>optional int32 type = 3;</code>
+     */
+    public int getType() {
+      return type_;
+    }
+
+    private void initFields() {
+      name_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+      value_ = "";
+      type_ = 0;
+    }
+    private byte memoizedIsInitialized = -1;
+    public final boolean isInitialized() {
+      byte isInitialized = memoizedIsInitialized;
+      if (isInitialized != -1) return isInitialized == 1;
+
+      memoizedIsInitialized = 1;
+      return true;
+    }
+
+    public void writeTo(com.google.protobuf.CodedOutputStream output)
+                        throws java.io.IOException {
+      getSerializedSize();
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeMessage(1, name_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeBytes(2, getValueBytes());
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        output.writeInt32(3, type_);
+      }
+      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, name_);
+      }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeBytesSize(2, getValueBytes());
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(3, type_);
+      }
+      size += getUnknownFields().getSerializedSize();
+      memoizedSerializedSize = size;
+      return size;
+    }
+
+    private static final long serialVersionUID = 0L;
+    @java.lang.Override
+    protected java.lang.Object writeReplace()
+        throws java.io.ObjectStreamException {
+      return super.writeReplace();
+    }
+
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute parseFrom(
+        com.google.protobuf.ByteString data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute parseFrom(
+        com.google.protobuf.ByteString data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute parseFrom(byte[] data)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute parseFrom(
+        byte[] data,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws com.google.protobuf.InvalidProtocolBufferException {
+      return PARSER.parseFrom(data, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute parseFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute parseFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute parseDelimitedFrom(java.io.InputStream input)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute parseDelimitedFrom(
+        java.io.InputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseDelimitedFrom(input, extensionRegistry);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute parseFrom(
+        com.google.protobuf.CodedInputStream input)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input);
+    }
+    public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute parseFrom(
+        com.google.protobuf.CodedInputStream input,
+        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+        throws java.io.IOException {
+      return PARSER.parseFrom(input, extensionRegistry);
+    }
+
+    public static Builder newBuilder() { return Builder.create(); }
+    public Builder newBuilderForType() { return newBuilder(); }
+    public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute 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.PathArgumentAttribute}
+     */
+    public static final class Builder extends
+        com.google.protobuf.GeneratedMessage.Builder<Builder>
+       implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttributeOrBuilder {
+      public static final com.google.protobuf.Descriptors.Descriptor
+          getDescriptor() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgumentAttribute_descriptor;
+      }
+
+      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+          internalGetFieldAccessorTable() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgumentAttribute_fieldAccessorTable
+            .ensureFieldAccessorsInitialized(
+                org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.Builder.class);
+      }
+
+      // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.newBuilder()
+      private Builder() {
+        maybeForceBuilderInitialization();
+      }
+
+      private Builder(
+          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+        super(parent);
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getNameFieldBuilder();
+        }
+      }
+      private static Builder create() {
+        return new Builder();
+      }
+
+      public Builder clear() {
+        super.clear();
+        if (nameBuilder_ == null) {
+          name_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+        } else {
+          nameBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000001);
+        value_ = "";
+        bitField0_ = (bitField0_ & ~0x00000002);
+        type_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000004);
+        return this;
+      }
+
+      public Builder clone() {
+        return create().mergeFrom(buildPartial());
+      }
+
+      public com.google.protobuf.Descriptors.Descriptor
+          getDescriptorForType() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgumentAttribute_descriptor;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute getDefaultInstanceForType() {
+        return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.getDefaultInstance();
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute build() {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute result = buildPartial();
+        if (!result.isInitialized()) {
+          throw newUninitializedMessageException(result);
+        }
+        return result;
+      }
+
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute buildPartial() {
+        org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute(this);
+        int from_bitField0_ = bitField0_;
+        int to_bitField0_ = 0;
+        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+          to_bitField0_ |= 0x00000001;
+        }
+        if (nameBuilder_ == null) {
+          result.name_ = name_;
+        } else {
+          result.name_ = nameBuilder_.build();
+        }
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.value_ = value_;
+        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+          to_bitField0_ |= 0x00000004;
+        }
+        result.type_ = type_;
+        result.bitField0_ = to_bitField0_;
+        onBuilt();
+        return result;
+      }
+
+      public Builder mergeFrom(com.google.protobuf.Message other) {
+        if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute) {
+          return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute)other);
+        } else {
+          super.mergeFrom(other);
+          return this;
+        }
+      }
+
+      public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute other) {
+        if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.getDefaultInstance()) return this;
+        if (other.hasName()) {
+          mergeName(other.getName());
+        }
+        if (other.hasValue()) {
+          bitField0_ |= 0x00000002;
+          value_ = other.value_;
+          onChanged();
+        }
+        if (other.hasType()) {
+          setType(other.getType());
+        }
+        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.common.NormalizedNodeMessages.PathArgumentAttribute parsedMessage = null;
+        try {
+          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+          parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute) e.getUnfinishedMessage();
+          throw e;
+        } finally {
+          if (parsedMessage != null) {
+            mergeFrom(parsedMessage);
+          }
+        }
+        return this;
+      }
+      private int bitField0_;
+
+      // optional .org.opendaylight.controller.mdsal.QName name = 1;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName name_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder> nameBuilder_;
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+       */
+      public boolean hasName() {
+        return ((bitField0_ & 0x00000001) == 0x00000001);
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName getName() {
+        if (nameBuilder_ == null) {
+          return name_;
+        } else {
+          return nameBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+       */
+      public Builder setName(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName value) {
+        if (nameBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          name_ = value;
+          onChanged();
+        } else {
+          nameBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000001;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+       */
+      public Builder setName(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder builderForValue) {
+        if (nameBuilder_ == null) {
+          name_ = builderForValue.build();
+          onChanged();
+        } else {
+          nameBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000001;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+       */
+      public Builder mergeName(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName value) {
+        if (nameBuilder_ == null) {
+          if (((bitField0_ & 0x00000001) == 0x00000001) &&
+              name_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance()) {
+            name_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.newBuilder(name_).mergeFrom(value).buildPartial();
+          } else {
+            name_ = value;
+          }
+          onChanged();
+        } else {
+          nameBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000001;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+       */
+      public Builder clearName() {
+        if (nameBuilder_ == null) {
+          name_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+          onChanged();
+        } else {
+          nameBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000001);
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder getNameBuilder() {
+        bitField0_ |= 0x00000001;
+        onChanged();
+        return getNameFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNameOrBuilder() {
+        if (nameBuilder_ != null) {
+          return nameBuilder_.getMessageOrBuilder();
+        } else {
+          return name_;
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>
+          getNameFieldBuilder() {
+        if (nameBuilder_ == null) {
+          nameBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>(
+                  name_,
+                  getParentForChildren(),
+                  isClean());
+          name_ = null;
+        }
+        return nameBuilder_;
+      }
+
+      // optional string value = 2;
+      private java.lang.Object value_ = "";
+      /**
+       * <code>optional string value = 2;</code>
+       */
+      public boolean hasValue() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>optional string value = 2;</code>
+       */
+      public java.lang.String getValue() {
+        java.lang.Object ref = value_;
+        if (!(ref instanceof java.lang.String)) {
+          java.lang.String s = ((com.google.protobuf.ByteString) ref)
+              .toStringUtf8();
+          value_ = s;
+          return s;
+        } else {
+          return (java.lang.String) ref;
+        }
+      }
+      /**
+       * <code>optional string value = 2;</code>
+       */
+      public com.google.protobuf.ByteString
+          getValueBytes() {
+        java.lang.Object ref = value_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b =
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          value_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string value = 2;</code>
+       */
+      public Builder setValue(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        value_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string value = 2;</code>
+       */
+      public Builder clearValue() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        value_ = getDefaultInstance().getValue();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string value = 2;</code>
+       */
+      public Builder setValueBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000002;
+        value_ = value;
+        onChanged();
+        return this;
+      }
+
+      // optional int32 type = 3;
+      private int type_ ;
+      /**
+       * <code>optional int32 type = 3;</code>
+       */
+      public boolean hasType() {
+        return ((bitField0_ & 0x00000004) == 0x00000004);
+      }
+      /**
+       * <code>optional int32 type = 3;</code>
+       */
+      public int getType() {
+        return type_;
+      }
+      /**
+       * <code>optional int32 type = 3;</code>
+       */
+      public Builder setType(int value) {
+        bitField0_ |= 0x00000004;
+        type_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 type = 3;</code>
+       */
+      public Builder clearType() {
+        bitField0_ = (bitField0_ & ~0x00000004);
+        type_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.PathArgumentAttribute)
+    }
+
+    static {
+      defaultInstance = new PathArgumentAttribute(true);
+      defaultInstance.initFields();
+    }
+
+    // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.PathArgumentAttribute)
+  }
+
   public interface QNameOrBuilder
       extends com.google.protobuf.MessageOrBuilder {
 
-    // required string value = 1;
+    // optional string value = 1;
+    /**
+     * <code>optional string value = 1;</code>
+     *
+     * <pre>
+     * @deprecated
+     * </pre>
+     */
+    boolean hasValue();
+    /**
+     * <code>optional string value = 1;</code>
+     *
+     * <pre>
+     * @deprecated
+     * </pre>
+     */
+    java.lang.String getValue();
+    /**
+     * <code>optional string value = 1;</code>
+     *
+     * <pre>
+     * @deprecated
+     * </pre>
+     */
+    com.google.protobuf.ByteString
+        getValueBytes();
+
+    // optional int32 namespace = 2;
     /**
-     * <code>required string value = 1;</code>
+     * <code>optional int32 namespace = 2;</code>
      */
-    boolean hasValue();
+    boolean hasNamespace();
     /**
-     * <code>required string value = 1;</code>
+     * <code>optional int32 namespace = 2;</code>
      */
-    java.lang.String getValue();
+    int getNamespace();
+
+    // optional int32 revision = 3;
     /**
-     * <code>required string value = 1;</code>
+     * <code>optional int32 revision = 3;</code>
      */
-    com.google.protobuf.ByteString
-        getValueBytes();
+    boolean hasRevision();
+    /**
+     * <code>optional int32 revision = 3;</code>
+     */
+    int getRevision();
+
+    // optional int32 localName = 4;
+    /**
+     * <code>optional int32 localName = 4;</code>
+     */
+    boolean hasLocalName();
+    /**
+     * <code>optional int32 localName = 4;</code>
+     */
+    int getLocalName();
   }
   /**
    * Protobuf type {@code org.opendaylight.controller.mdsal.QName}
@@ -873,6 +1659,21 @@ public final class NormalizedNodeMessages {
               value_ = input.readBytes();
               break;
             }
+            case 16: {
+              bitField0_ |= 0x00000002;
+              namespace_ = input.readInt32();
+              break;
+            }
+            case 24: {
+              bitField0_ |= 0x00000004;
+              revision_ = input.readInt32();
+              break;
+            }
+            case 32: {
+              bitField0_ |= 0x00000008;
+              localName_ = input.readInt32();
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -913,17 +1714,25 @@ public final class NormalizedNodeMessages {
     }
 
     private int bitField0_;
-    // required string value = 1;
+    // optional string value = 1;
     public static final int VALUE_FIELD_NUMBER = 1;
     private java.lang.Object value_;
     /**
-     * <code>required string value = 1;</code>
+     * <code>optional string value = 1;</code>
+     *
+     * <pre>
+     * @deprecated
+     * </pre>
      */
     public boolean hasValue() {
       return ((bitField0_ & 0x00000001) == 0x00000001);
     }
     /**
-     * <code>required string value = 1;</code>
+     * <code>optional string value = 1;</code>
+     *
+     * <pre>
+     * @deprecated
+     * </pre>
      */
     public java.lang.String getValue() {
       java.lang.Object ref = value_;
@@ -940,7 +1749,11 @@ public final class NormalizedNodeMessages {
       }
     }
     /**
-     * <code>required string value = 1;</code>
+     * <code>optional string value = 1;</code>
+     *
+     * <pre>
+     * @deprecated
+     * </pre>
      */
     public com.google.protobuf.ByteString
         getValueBytes() {
@@ -956,18 +1769,65 @@ public final class NormalizedNodeMessages {
       }
     }
 
+    // optional int32 namespace = 2;
+    public static final int NAMESPACE_FIELD_NUMBER = 2;
+    private int namespace_;
+    /**
+     * <code>optional int32 namespace = 2;</code>
+     */
+    public boolean hasNamespace() {
+      return ((bitField0_ & 0x00000002) == 0x00000002);
+    }
+    /**
+     * <code>optional int32 namespace = 2;</code>
+     */
+    public int getNamespace() {
+      return namespace_;
+    }
+
+    // optional int32 revision = 3;
+    public static final int REVISION_FIELD_NUMBER = 3;
+    private int revision_;
+    /**
+     * <code>optional int32 revision = 3;</code>
+     */
+    public boolean hasRevision() {
+      return ((bitField0_ & 0x00000004) == 0x00000004);
+    }
+    /**
+     * <code>optional int32 revision = 3;</code>
+     */
+    public int getRevision() {
+      return revision_;
+    }
+
+    // optional int32 localName = 4;
+    public static final int LOCALNAME_FIELD_NUMBER = 4;
+    private int localName_;
+    /**
+     * <code>optional int32 localName = 4;</code>
+     */
+    public boolean hasLocalName() {
+      return ((bitField0_ & 0x00000008) == 0x00000008);
+    }
+    /**
+     * <code>optional int32 localName = 4;</code>
+     */
+    public int getLocalName() {
+      return localName_;
+    }
+
     private void initFields() {
       value_ = "";
+      namespace_ = 0;
+      revision_ = 0;
+      localName_ = 0;
     }
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
       if (isInitialized != -1) return isInitialized == 1;
 
-      if (!hasValue()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
       memoizedIsInitialized = 1;
       return true;
     }
@@ -978,6 +1838,15 @@ public final class NormalizedNodeMessages {
       if (((bitField0_ & 0x00000001) == 0x00000001)) {
         output.writeBytes(1, getValueBytes());
       }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeInt32(2, namespace_);
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        output.writeInt32(3, revision_);
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        output.writeInt32(4, localName_);
+      }
       getUnknownFields().writeTo(output);
     }
 
@@ -991,6 +1860,18 @@ public final class NormalizedNodeMessages {
         size += com.google.protobuf.CodedOutputStream
           .computeBytesSize(1, getValueBytes());
       }
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(2, namespace_);
+      }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(3, revision_);
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(4, localName_);
+      }
       size += getUnknownFields().getSerializedSize();
       memoizedSerializedSize = size;
       return size;
@@ -1109,6 +1990,12 @@ public final class NormalizedNodeMessages {
         super.clear();
         value_ = "";
         bitField0_ = (bitField0_ & ~0x00000001);
+        namespace_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000002);
+        revision_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000004);
+        localName_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000008);
         return this;
       }
 
@@ -1141,6 +2028,18 @@ public final class NormalizedNodeMessages {
           to_bitField0_ |= 0x00000001;
         }
         result.value_ = value_;
+        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+          to_bitField0_ |= 0x00000002;
+        }
+        result.namespace_ = namespace_;
+        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+          to_bitField0_ |= 0x00000004;
+        }
+        result.revision_ = revision_;
+        if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
+          to_bitField0_ |= 0x00000008;
+        }
+        result.localName_ = localName_;
         result.bitField0_ = to_bitField0_;
         onBuilt();
         return result;
@@ -1162,15 +2061,20 @@ public final class NormalizedNodeMessages {
           value_ = other.value_;
           onChanged();
         }
+        if (other.hasNamespace()) {
+          setNamespace(other.getNamespace());
+        }
+        if (other.hasRevision()) {
+          setRevision(other.getRevision());
+        }
+        if (other.hasLocalName()) {
+          setLocalName(other.getLocalName());
+        }
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
 
       public final boolean isInitialized() {
-        if (!hasValue()) {
-
-          return false;
-        }
         return true;
       }
 
@@ -1193,16 +2097,24 @@ public final class NormalizedNodeMessages {
       }
       private int bitField0_;
 
-      // required string value = 1;
+      // optional string value = 1;
       private java.lang.Object value_ = "";
       /**
-       * <code>required string value = 1;</code>
+       * <code>optional string value = 1;</code>
+       *
+       * <pre>
+       * @deprecated
+       * </pre>
        */
       public boolean hasValue() {
         return ((bitField0_ & 0x00000001) == 0x00000001);
       }
       /**
-       * <code>required string value = 1;</code>
+       * <code>optional string value = 1;</code>
+       *
+       * <pre>
+       * @deprecated
+       * </pre>
        */
       public java.lang.String getValue() {
         java.lang.Object ref = value_;
@@ -1216,7 +2128,11 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>required string value = 1;</code>
+       * <code>optional string value = 1;</code>
+       *
+       * <pre>
+       * @deprecated
+       * </pre>
        */
       public com.google.protobuf.ByteString
           getValueBytes() {
@@ -1232,7 +2148,11 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>required string value = 1;</code>
+       * <code>optional string value = 1;</code>
+       *
+       * <pre>
+       * @deprecated
+       * </pre>
        */
       public Builder setValue(
           java.lang.String value) {
@@ -1245,7 +2165,11 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>required string value = 1;</code>
+       * <code>optional string value = 1;</code>
+       *
+       * <pre>
+       * @deprecated
+       * </pre>
        */
       public Builder clearValue() {
         bitField0_ = (bitField0_ & ~0x00000001);
@@ -1254,7 +2178,11 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>required string value = 1;</code>
+       * <code>optional string value = 1;</code>
+       *
+       * <pre>
+       * @deprecated
+       * </pre>
        */
       public Builder setValueBytes(
           com.google.protobuf.ByteString value) {
@@ -1267,6 +2195,105 @@ public final class NormalizedNodeMessages {
         return this;
       }
 
+      // optional int32 namespace = 2;
+      private int namespace_ ;
+      /**
+       * <code>optional int32 namespace = 2;</code>
+       */
+      public boolean hasNamespace() {
+        return ((bitField0_ & 0x00000002) == 0x00000002);
+      }
+      /**
+       * <code>optional int32 namespace = 2;</code>
+       */
+      public int getNamespace() {
+        return namespace_;
+      }
+      /**
+       * <code>optional int32 namespace = 2;</code>
+       */
+      public Builder setNamespace(int value) {
+        bitField0_ |= 0x00000002;
+        namespace_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 namespace = 2;</code>
+       */
+      public Builder clearNamespace() {
+        bitField0_ = (bitField0_ & ~0x00000002);
+        namespace_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // optional int32 revision = 3;
+      private int revision_ ;
+      /**
+       * <code>optional int32 revision = 3;</code>
+       */
+      public boolean hasRevision() {
+        return ((bitField0_ & 0x00000004) == 0x00000004);
+      }
+      /**
+       * <code>optional int32 revision = 3;</code>
+       */
+      public int getRevision() {
+        return revision_;
+      }
+      /**
+       * <code>optional int32 revision = 3;</code>
+       */
+      public Builder setRevision(int value) {
+        bitField0_ |= 0x00000004;
+        revision_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 revision = 3;</code>
+       */
+      public Builder clearRevision() {
+        bitField0_ = (bitField0_ & ~0x00000004);
+        revision_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // optional int32 localName = 4;
+      private int localName_ ;
+      /**
+       * <code>optional int32 localName = 4;</code>
+       */
+      public boolean hasLocalName() {
+        return ((bitField0_ & 0x00000008) == 0x00000008);
+      }
+      /**
+       * <code>optional int32 localName = 4;</code>
+       */
+      public int getLocalName() {
+        return localName_;
+      }
+      /**
+       * <code>optional int32 localName = 4;</code>
+       */
+      public Builder setLocalName(int value) {
+        bitField0_ |= 0x00000008;
+        localName_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 localName = 4;</code>
+       */
+      public Builder clearLocalName() {
+        bitField0_ = (bitField0_ & ~0x00000008);
+        localName_ = 0;
+        onChanged();
+        return this;
+      }
+
       // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.QName)
     }
 
@@ -1281,17 +2308,29 @@ public final class NormalizedNodeMessages {
   public interface PathArgumentOrBuilder
       extends com.google.protobuf.MessageOrBuilder {
 
-    // required string value = 1;
+    // optional string value = 1;
     /**
-     * <code>required string value = 1;</code>
+     * <code>optional string value = 1;</code>
+     *
+     * <pre>
+     * @deprecated
+     * </pre>
      */
     boolean hasValue();
     /**
-     * <code>required string value = 1;</code>
+     * <code>optional string value = 1;</code>
+     *
+     * <pre>
+     * @deprecated
+     * </pre>
      */
     java.lang.String getValue();
     /**
-     * <code>required string value = 1;</code>
+     * <code>optional string value = 1;</code>
+     *
+     * <pre>
+     * @deprecated
+     * </pre>
      */
     com.google.protobuf.ByteString
         getValueBytes();
@@ -1301,7 +2340,7 @@ public final class NormalizedNodeMessages {
      * <code>optional string type = 2;</code>
      *
      * <pre>
-     *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+     * @deprecated
      * </pre>
      */
     boolean hasType();
@@ -1309,7 +2348,7 @@ public final class NormalizedNodeMessages {
      * <code>optional string type = 2;</code>
      *
      * <pre>
-     *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+     * @deprecated
      * </pre>
      */
     java.lang.String getType();
@@ -1317,7 +2356,7 @@ public final class NormalizedNodeMessages {
      * <code>optional string type = 2;</code>
      *
      * <pre>
-     *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+     * @deprecated
      * </pre>
      */
     com.google.protobuf.ByteString
@@ -1337,30 +2376,85 @@ public final class NormalizedNodeMessages {
      */
     org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNodeTypeOrBuilder();
 
-    // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;
+    // repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+     */
+    java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute>
+        getAttributeList();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute getAttribute(int index);
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+     */
+    int getAttributeCount();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+     */
+    java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttributeOrBuilder>
+        getAttributeOrBuilderList();
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttributeOrBuilder getAttributeOrBuilder(
+        int index);
+
+    // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+     *
+     * <pre>
+     * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+     * </pre>
      */
     java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>
         getAttributesList();
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+     *
+     * <pre>
+     * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+     * </pre>
      */
     org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index);
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+     *
+     * <pre>
+     * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+     * </pre>
      */
     int getAttributesCount();
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+     *
+     * <pre>
+     * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+     * </pre>
      */
     java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
         getAttributesOrBuilderList();
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+     *
+     * <pre>
+     * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+     * </pre>
      */
     org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder(
         int index);
+
+    // optional int32 intType = 6;
+    /**
+     * <code>optional int32 intType = 6;</code>
+     */
+    boolean hasIntType();
+    /**
+     * <code>optional int32 intType = 6;</code>
+     */
+    int getIntType();
   }
   /**
    * Protobuf type {@code org.opendaylight.controller.mdsal.PathArgument}
@@ -1438,12 +2532,25 @@ public final class NormalizedNodeMessages {
             }
             case 34: {
               if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
-                attributes_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>();
+                attribute_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute>();
                 mutable_bitField0_ |= 0x00000008;
               }
+              attribute_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.PARSER, extensionRegistry));
+              break;
+            }
+            case 42: {
+              if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
+                attributes_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>();
+                mutable_bitField0_ |= 0x00000010;
+              }
               attributes_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.PARSER, extensionRegistry));
               break;
             }
+            case 48: {
+              bitField0_ |= 0x00000008;
+              intType_ = input.readInt32();
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -1453,6 +2560,9 @@ public final class NormalizedNodeMessages {
             e.getMessage()).setUnfinishedMessage(this);
       } finally {
         if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
+          attribute_ = java.util.Collections.unmodifiableList(attribute_);
+        }
+        if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
           attributes_ = java.util.Collections.unmodifiableList(attributes_);
         }
         this.unknownFields = unknownFields.build();
@@ -1487,17 +2597,25 @@ public final class NormalizedNodeMessages {
     }
 
     private int bitField0_;
-    // required string value = 1;
+    // optional string value = 1;
     public static final int VALUE_FIELD_NUMBER = 1;
     private java.lang.Object value_;
     /**
-     * <code>required string value = 1;</code>
+     * <code>optional string value = 1;</code>
+     *
+     * <pre>
+     * @deprecated
+     * </pre>
      */
     public boolean hasValue() {
       return ((bitField0_ & 0x00000001) == 0x00000001);
     }
     /**
-     * <code>required string value = 1;</code>
+     * <code>optional string value = 1;</code>
+     *
+     * <pre>
+     * @deprecated
+     * </pre>
      */
     public java.lang.String getValue() {
       java.lang.Object ref = value_;
@@ -1514,7 +2632,11 @@ public final class NormalizedNodeMessages {
       }
     }
     /**
-     * <code>required string value = 1;</code>
+     * <code>optional string value = 1;</code>
+     *
+     * <pre>
+     * @deprecated
+     * </pre>
      */
     public com.google.protobuf.ByteString
         getValueBytes() {
@@ -1537,7 +2659,7 @@ public final class NormalizedNodeMessages {
      * <code>optional string type = 2;</code>
      *
      * <pre>
-     *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+     * @deprecated
      * </pre>
      */
     public boolean hasType() {
@@ -1547,7 +2669,7 @@ public final class NormalizedNodeMessages {
      * <code>optional string type = 2;</code>
      *
      * <pre>
-     *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+     * @deprecated
      * </pre>
      */
     public java.lang.String getType() {
@@ -1568,7 +2690,7 @@ public final class NormalizedNodeMessages {
      * <code>optional string type = 2;</code>
      *
      * <pre>
-     *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+     * @deprecated
      * </pre>
      */
     public com.google.protobuf.ByteString
@@ -1584,86 +2706,150 @@ public final class NormalizedNodeMessages {
         return (com.google.protobuf.ByteString) ref;
       }
     }
-
-    // optional .org.opendaylight.controller.mdsal.QName nodeType = 3;
-    public static final int NODETYPE_FIELD_NUMBER = 3;
-    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName nodeType_;
+
+    // optional .org.opendaylight.controller.mdsal.QName nodeType = 3;
+    public static final int NODETYPE_FIELD_NUMBER = 3;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName nodeType_;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+     */
+    public boolean hasNodeType() {
+      return ((bitField0_ & 0x00000004) == 0x00000004);
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName getNodeType() {
+      return nodeType_;
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNodeTypeOrBuilder() {
+      return nodeType_;
+    }
+
+    // repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;
+    public static final int ATTRIBUTE_FIELD_NUMBER = 4;
+    private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute> attribute_;
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+     */
+    public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute> getAttributeList() {
+      return attribute_;
+    }
+    /**
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+     */
+    public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttributeOrBuilder>
+        getAttributeOrBuilderList() {
+      return attribute_;
+    }
     /**
-     * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
      */
-    public boolean hasNodeType() {
-      return ((bitField0_ & 0x00000004) == 0x00000004);
+    public int getAttributeCount() {
+      return attribute_.size();
     }
     /**
-     * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
      */
-    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName getNodeType() {
-      return nodeType_;
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute getAttribute(int index) {
+      return attribute_.get(index);
     }
     /**
-     * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
      */
-    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNodeTypeOrBuilder() {
-      return nodeType_;
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttributeOrBuilder getAttributeOrBuilder(
+        int index) {
+      return attribute_.get(index);
     }
 
-    // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;
-    public static final int ATTRIBUTES_FIELD_NUMBER = 4;
+    // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;
+    public static final int ATTRIBUTES_FIELD_NUMBER = 5;
     private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> attributes_;
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+     *
+     * <pre>
+     * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+     * </pre>
      */
     public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> getAttributesList() {
       return attributes_;
     }
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+     *
+     * <pre>
+     * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+     * </pre>
      */
     public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
         getAttributesOrBuilderList() {
       return attributes_;
     }
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+     *
+     * <pre>
+     * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+     * </pre>
      */
     public int getAttributesCount() {
       return attributes_.size();
     }
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+     *
+     * <pre>
+     * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+     * </pre>
      */
     public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index) {
       return attributes_.get(index);
     }
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+     *
+     * <pre>
+     * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+     * </pre>
      */
     public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder(
         int index) {
       return attributes_.get(index);
     }
 
+    // optional int32 intType = 6;
+    public static final int INTTYPE_FIELD_NUMBER = 6;
+    private int intType_;
+    /**
+     * <code>optional int32 intType = 6;</code>
+     */
+    public boolean hasIntType() {
+      return ((bitField0_ & 0x00000008) == 0x00000008);
+    }
+    /**
+     * <code>optional int32 intType = 6;</code>
+     */
+    public int getIntType() {
+      return intType_;
+    }
+
     private void initFields() {
       value_ = "";
       type_ = "";
       nodeType_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+      attribute_ = java.util.Collections.emptyList();
       attributes_ = java.util.Collections.emptyList();
+      intType_ = 0;
     }
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
       if (isInitialized != -1) return isInitialized == 1;
 
-      if (!hasValue()) {
-        memoizedIsInitialized = 0;
-        return false;
-      }
-      if (hasNodeType()) {
-        if (!getNodeType().isInitialized()) {
-          memoizedIsInitialized = 0;
-          return false;
-        }
-      }
       for (int i = 0; i < getAttributesCount(); i++) {
         if (!getAttributes(i).isInitialized()) {
           memoizedIsInitialized = 0;
@@ -1686,8 +2872,14 @@ public final class NormalizedNodeMessages {
       if (((bitField0_ & 0x00000004) == 0x00000004)) {
         output.writeMessage(3, nodeType_);
       }
+      for (int i = 0; i < attribute_.size(); i++) {
+        output.writeMessage(4, attribute_.get(i));
+      }
       for (int i = 0; i < attributes_.size(); i++) {
-        output.writeMessage(4, attributes_.get(i));
+        output.writeMessage(5, attributes_.get(i));
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        output.writeInt32(6, intType_);
       }
       getUnknownFields().writeTo(output);
     }
@@ -1710,9 +2902,17 @@ public final class NormalizedNodeMessages {
         size += com.google.protobuf.CodedOutputStream
           .computeMessageSize(3, nodeType_);
       }
+      for (int i = 0; i < attribute_.size(); i++) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(4, attribute_.get(i));
+      }
       for (int i = 0; i < attributes_.size(); i++) {
         size += com.google.protobuf.CodedOutputStream
-          .computeMessageSize(4, attributes_.get(i));
+          .computeMessageSize(5, attributes_.get(i));
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(6, intType_);
       }
       size += getUnknownFields().getSerializedSize();
       memoizedSerializedSize = size;
@@ -1823,6 +3023,7 @@ public final class NormalizedNodeMessages {
       private void maybeForceBuilderInitialization() {
         if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
           getNodeTypeFieldBuilder();
+          getAttributeFieldBuilder();
           getAttributesFieldBuilder();
         }
       }
@@ -1842,12 +3043,20 @@ public final class NormalizedNodeMessages {
           nodeTypeBuilder_.clear();
         }
         bitField0_ = (bitField0_ & ~0x00000004);
+        if (attributeBuilder_ == null) {
+          attribute_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000008);
+        } else {
+          attributeBuilder_.clear();
+        }
         if (attributesBuilder_ == null) {
           attributes_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x00000008);
+          bitField0_ = (bitField0_ & ~0x00000010);
         } else {
           attributesBuilder_.clear();
         }
+        intType_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000020);
         return this;
       }
 
@@ -1892,15 +3101,28 @@ public final class NormalizedNodeMessages {
         } else {
           result.nodeType_ = nodeTypeBuilder_.build();
         }
-        if (attributesBuilder_ == null) {
+        if (attributeBuilder_ == null) {
           if (((bitField0_ & 0x00000008) == 0x00000008)) {
-            attributes_ = java.util.Collections.unmodifiableList(attributes_);
+            attribute_ = java.util.Collections.unmodifiableList(attribute_);
             bitField0_ = (bitField0_ & ~0x00000008);
           }
+          result.attribute_ = attribute_;
+        } else {
+          result.attribute_ = attributeBuilder_.build();
+        }
+        if (attributesBuilder_ == null) {
+          if (((bitField0_ & 0x00000010) == 0x00000010)) {
+            attributes_ = java.util.Collections.unmodifiableList(attributes_);
+            bitField0_ = (bitField0_ & ~0x00000010);
+          }
           result.attributes_ = attributes_;
         } else {
           result.attributes_ = attributesBuilder_.build();
         }
+        if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
+          to_bitField0_ |= 0x00000008;
+        }
+        result.intType_ = intType_;
         result.bitField0_ = to_bitField0_;
         onBuilt();
         return result;
@@ -1930,11 +3152,37 @@ public final class NormalizedNodeMessages {
         if (other.hasNodeType()) {
           mergeNodeType(other.getNodeType());
         }
+        if (attributeBuilder_ == null) {
+          if (!other.attribute_.isEmpty()) {
+            if (attribute_.isEmpty()) {
+              attribute_ = other.attribute_;
+              bitField0_ = (bitField0_ & ~0x00000008);
+            } else {
+              ensureAttributeIsMutable();
+              attribute_.addAll(other.attribute_);
+            }
+            onChanged();
+          }
+        } else {
+          if (!other.attribute_.isEmpty()) {
+            if (attributeBuilder_.isEmpty()) {
+              attributeBuilder_.dispose();
+              attributeBuilder_ = null;
+              attribute_ = other.attribute_;
+              bitField0_ = (bitField0_ & ~0x00000008);
+              attributeBuilder_ =
+                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
+                   getAttributeFieldBuilder() : null;
+            } else {
+              attributeBuilder_.addAllMessages(other.attribute_);
+            }
+          }
+        }
         if (attributesBuilder_ == null) {
           if (!other.attributes_.isEmpty()) {
             if (attributes_.isEmpty()) {
               attributes_ = other.attributes_;
-              bitField0_ = (bitField0_ & ~0x00000008);
+              bitField0_ = (bitField0_ & ~0x00000010);
             } else {
               ensureAttributesIsMutable();
               attributes_.addAll(other.attributes_);
@@ -1947,7 +3195,7 @@ public final class NormalizedNodeMessages {
               attributesBuilder_.dispose();
               attributesBuilder_ = null;
               attributes_ = other.attributes_;
-              bitField0_ = (bitField0_ & ~0x00000008);
+              bitField0_ = (bitField0_ & ~0x00000010);
               attributesBuilder_ =
                 com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
                    getAttributesFieldBuilder() : null;
@@ -1956,21 +3204,14 @@ public final class NormalizedNodeMessages {
             }
           }
         }
+        if (other.hasIntType()) {
+          setIntType(other.getIntType());
+        }
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
 
       public final boolean isInitialized() {
-        if (!hasValue()) {
-
-          return false;
-        }
-        if (hasNodeType()) {
-          if (!getNodeType().isInitialized()) {
-
-            return false;
-          }
-        }
         for (int i = 0; i < getAttributesCount(); i++) {
           if (!getAttributes(i).isInitialized()) {
 
@@ -1999,16 +3240,24 @@ public final class NormalizedNodeMessages {
       }
       private int bitField0_;
 
-      // required string value = 1;
+      // optional string value = 1;
       private java.lang.Object value_ = "";
       /**
-       * <code>required string value = 1;</code>
+       * <code>optional string value = 1;</code>
+       *
+       * <pre>
+       * @deprecated
+       * </pre>
        */
       public boolean hasValue() {
         return ((bitField0_ & 0x00000001) == 0x00000001);
       }
       /**
-       * <code>required string value = 1;</code>
+       * <code>optional string value = 1;</code>
+       *
+       * <pre>
+       * @deprecated
+       * </pre>
        */
       public java.lang.String getValue() {
         java.lang.Object ref = value_;
@@ -2022,7 +3271,11 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>required string value = 1;</code>
+       * <code>optional string value = 1;</code>
+       *
+       * <pre>
+       * @deprecated
+       * </pre>
        */
       public com.google.protobuf.ByteString
           getValueBytes() {
@@ -2038,7 +3291,11 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>required string value = 1;</code>
+       * <code>optional string value = 1;</code>
+       *
+       * <pre>
+       * @deprecated
+       * </pre>
        */
       public Builder setValue(
           java.lang.String value) {
@@ -2051,7 +3308,11 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>required string value = 1;</code>
+       * <code>optional string value = 1;</code>
+       *
+       * <pre>
+       * @deprecated
+       * </pre>
        */
       public Builder clearValue() {
         bitField0_ = (bitField0_ & ~0x00000001);
@@ -2060,7 +3321,11 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>required string value = 1;</code>
+       * <code>optional string value = 1;</code>
+       *
+       * <pre>
+       * @deprecated
+       * </pre>
        */
       public Builder setValueBytes(
           com.google.protobuf.ByteString value) {
@@ -2079,7 +3344,7 @@ public final class NormalizedNodeMessages {
        * <code>optional string type = 2;</code>
        *
        * <pre>
-       *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+       * @deprecated
        * </pre>
        */
       public boolean hasType() {
@@ -2089,7 +3354,7 @@ public final class NormalizedNodeMessages {
        * <code>optional string type = 2;</code>
        *
        * <pre>
-       *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+       * @deprecated
        * </pre>
        */
       public java.lang.String getType() {
@@ -2107,7 +3372,7 @@ public final class NormalizedNodeMessages {
        * <code>optional string type = 2;</code>
        *
        * <pre>
-       *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+       * @deprecated
        * </pre>
        */
       public com.google.protobuf.ByteString
@@ -2127,7 +3392,7 @@ public final class NormalizedNodeMessages {
        * <code>optional string type = 2;</code>
        *
        * <pre>
-       *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+       * @deprecated
        * </pre>
        */
       public Builder setType(
@@ -2144,7 +3409,7 @@ public final class NormalizedNodeMessages {
        * <code>optional string type = 2;</code>
        *
        * <pre>
-       *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+       * @deprecated
        * </pre>
        */
       public Builder clearType() {
@@ -2157,7 +3422,7 @@ public final class NormalizedNodeMessages {
        * <code>optional string type = 2;</code>
        *
        * <pre>
-       *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+       * @deprecated
        * </pre>
        */
       public Builder setTypeBytes(
@@ -2216,85 +3481,325 @@ public final class NormalizedNodeMessages {
           nodeType_ = builderForValue.build();
           onChanged();
         } else {
-          nodeTypeBuilder_.setMessage(builderForValue.build());
+          nodeTypeBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000004;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       */
+      public Builder mergeNodeType(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName value) {
+        if (nodeTypeBuilder_ == null) {
+          if (((bitField0_ & 0x00000004) == 0x00000004) &&
+              nodeType_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance()) {
+            nodeType_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.newBuilder(nodeType_).mergeFrom(value).buildPartial();
+          } else {
+            nodeType_ = value;
+          }
+          onChanged();
+        } else {
+          nodeTypeBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000004;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       */
+      public Builder clearNodeType() {
+        if (nodeTypeBuilder_ == null) {
+          nodeType_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+          onChanged();
+        } else {
+          nodeTypeBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000004);
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder getNodeTypeBuilder() {
+        bitField0_ |= 0x00000004;
+        onChanged();
+        return getNodeTypeFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNodeTypeOrBuilder() {
+        if (nodeTypeBuilder_ != null) {
+          return nodeTypeBuilder_.getMessageOrBuilder();
+        } else {
+          return nodeType_;
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>
+          getNodeTypeFieldBuilder() {
+        if (nodeTypeBuilder_ == null) {
+          nodeTypeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>(
+                  nodeType_,
+                  getParentForChildren(),
+                  isClean());
+          nodeType_ = null;
+        }
+        return nodeTypeBuilder_;
+      }
+
+      // repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;
+      private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute> attribute_ =
+        java.util.Collections.emptyList();
+      private void ensureAttributeIsMutable() {
+        if (!((bitField0_ & 0x00000008) == 0x00000008)) {
+          attribute_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute>(attribute_);
+          bitField0_ |= 0x00000008;
+         }
+      }
+
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttributeOrBuilder> attributeBuilder_;
+
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+       */
+      public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute> getAttributeList() {
+        if (attributeBuilder_ == null) {
+          return java.util.Collections.unmodifiableList(attribute_);
+        } else {
+          return attributeBuilder_.getMessageList();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+       */
+      public int getAttributeCount() {
+        if (attributeBuilder_ == null) {
+          return attribute_.size();
+        } else {
+          return attributeBuilder_.getCount();
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute getAttribute(int index) {
+        if (attributeBuilder_ == null) {
+          return attribute_.get(index);
+        } else {
+          return attributeBuilder_.getMessage(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+       */
+      public Builder setAttribute(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute value) {
+        if (attributeBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureAttributeIsMutable();
+          attribute_.set(index, value);
+          onChanged();
+        } else {
+          attributeBuilder_.setMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+       */
+      public Builder setAttribute(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.Builder builderForValue) {
+        if (attributeBuilder_ == null) {
+          ensureAttributeIsMutable();
+          attribute_.set(index, builderForValue.build());
+          onChanged();
+        } else {
+          attributeBuilder_.setMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+       */
+      public Builder addAttribute(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute value) {
+        if (attributeBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureAttributeIsMutable();
+          attribute_.add(value);
+          onChanged();
+        } else {
+          attributeBuilder_.addMessage(value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+       */
+      public Builder addAttribute(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute value) {
+        if (attributeBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          ensureAttributeIsMutable();
+          attribute_.add(index, value);
+          onChanged();
+        } else {
+          attributeBuilder_.addMessage(index, value);
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+       */
+      public Builder addAttribute(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.Builder builderForValue) {
+        if (attributeBuilder_ == null) {
+          ensureAttributeIsMutable();
+          attribute_.add(builderForValue.build());
+          onChanged();
+        } else {
+          attributeBuilder_.addMessage(builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+       */
+      public Builder addAttribute(
+          int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.Builder builderForValue) {
+        if (attributeBuilder_ == null) {
+          ensureAttributeIsMutable();
+          attribute_.add(index, builderForValue.build());
+          onChanged();
+        } else {
+          attributeBuilder_.addMessage(index, builderForValue.build());
+        }
+        return this;
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+       */
+      public Builder addAllAttribute(
+          java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute> values) {
+        if (attributeBuilder_ == null) {
+          ensureAttributeIsMutable();
+          super.addAll(values, attribute_);
+          onChanged();
+        } else {
+          attributeBuilder_.addAllMessages(values);
         }
-        bitField0_ |= 0x00000004;
         return this;
       }
       /**
-       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
        */
-      public Builder mergeNodeType(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName value) {
-        if (nodeTypeBuilder_ == null) {
-          if (((bitField0_ & 0x00000004) == 0x00000004) &&
-              nodeType_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance()) {
-            nodeType_ =
-              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.newBuilder(nodeType_).mergeFrom(value).buildPartial();
-          } else {
-            nodeType_ = value;
-          }
+      public Builder clearAttribute() {
+        if (attributeBuilder_ == null) {
+          attribute_ = java.util.Collections.emptyList();
+          bitField0_ = (bitField0_ & ~0x00000008);
           onChanged();
         } else {
-          nodeTypeBuilder_.mergeFrom(value);
+          attributeBuilder_.clear();
         }
-        bitField0_ |= 0x00000004;
         return this;
       }
       /**
-       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
        */
-      public Builder clearNodeType() {
-        if (nodeTypeBuilder_ == null) {
-          nodeType_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+      public Builder removeAttribute(int index) {
+        if (attributeBuilder_ == null) {
+          ensureAttributeIsMutable();
+          attribute_.remove(index);
           onChanged();
         } else {
-          nodeTypeBuilder_.clear();
+          attributeBuilder_.remove(index);
         }
-        bitField0_ = (bitField0_ & ~0x00000004);
         return this;
       }
       /**
-       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
        */
-      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder getNodeTypeBuilder() {
-        bitField0_ |= 0x00000004;
-        onChanged();
-        return getNodeTypeFieldBuilder().getBuilder();
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.Builder getAttributeBuilder(
+          int index) {
+        return getAttributeFieldBuilder().getBuilder(index);
       }
       /**
-       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
        */
-      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNodeTypeOrBuilder() {
-        if (nodeTypeBuilder_ != null) {
-          return nodeTypeBuilder_.getMessageOrBuilder();
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttributeOrBuilder getAttributeOrBuilder(
+          int index) {
+        if (attributeBuilder_ == null) {
+          return attribute_.get(index);  } else {
+          return attributeBuilder_.getMessageOrBuilder(index);
+        }
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+       */
+      public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttributeOrBuilder>
+           getAttributeOrBuilderList() {
+        if (attributeBuilder_ != null) {
+          return attributeBuilder_.getMessageOrBuilderList();
         } else {
-          return nodeType_;
+          return java.util.Collections.unmodifiableList(attribute_);
         }
       }
       /**
-       * <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
        */
-      private com.google.protobuf.SingleFieldBuilder<
-          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>
-          getNodeTypeFieldBuilder() {
-        if (nodeTypeBuilder_ == null) {
-          nodeTypeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
-              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>(
-                  nodeType_,
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.Builder addAttributeBuilder() {
+        return getAttributeFieldBuilder().addBuilder(
+            org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.Builder addAttributeBuilder(
+          int index) {
+        return getAttributeFieldBuilder().addBuilder(
+            index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.getDefaultInstance());
+      }
+      /**
+       * <code>repeated .org.opendaylight.controller.mdsal.PathArgumentAttribute attribute = 4;</code>
+       */
+      public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.Builder>
+           getAttributeBuilderList() {
+        return getAttributeFieldBuilder().getBuilderList();
+      }
+      private com.google.protobuf.RepeatedFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttributeOrBuilder>
+          getAttributeFieldBuilder() {
+        if (attributeBuilder_ == null) {
+          attributeBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentAttributeOrBuilder>(
+                  attribute_,
+                  ((bitField0_ & 0x00000008) == 0x00000008),
                   getParentForChildren(),
                   isClean());
-          nodeType_ = null;
+          attribute_ = null;
         }
-        return nodeTypeBuilder_;
+        return attributeBuilder_;
       }
 
-      // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;
+      // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;
       private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> attributes_ =
         java.util.Collections.emptyList();
       private void ensureAttributesIsMutable() {
-        if (!((bitField0_ & 0x00000008) == 0x00000008)) {
+        if (!((bitField0_ & 0x00000010) == 0x00000010)) {
           attributes_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>(attributes_);
-          bitField0_ |= 0x00000008;
+          bitField0_ |= 0x00000010;
          }
       }
 
@@ -2302,7 +3807,11 @@ public final class NormalizedNodeMessages {
           org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> attributesBuilder_;
 
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+       *
+       * <pre>
+       * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+       * </pre>
        */
       public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> getAttributesList() {
         if (attributesBuilder_ == null) {
@@ -2312,7 +3821,11 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+       *
+       * <pre>
+       * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+       * </pre>
        */
       public int getAttributesCount() {
         if (attributesBuilder_ == null) {
@@ -2322,7 +3835,11 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+       *
+       * <pre>
+       * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+       * </pre>
        */
       public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index) {
         if (attributesBuilder_ == null) {
@@ -2332,7 +3849,11 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+       *
+       * <pre>
+       * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+       * </pre>
        */
       public Builder setAttributes(
           int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) {
@@ -2349,7 +3870,11 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+       *
+       * <pre>
+       * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+       * </pre>
        */
       public Builder setAttributes(
           int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) {
@@ -2363,7 +3888,11 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+       *
+       * <pre>
+       * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+       * </pre>
        */
       public Builder addAttributes(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) {
         if (attributesBuilder_ == null) {
@@ -2379,7 +3908,11 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+       *
+       * <pre>
+       * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+       * </pre>
        */
       public Builder addAttributes(
           int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) {
@@ -2396,7 +3929,11 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+       *
+       * <pre>
+       * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+       * </pre>
        */
       public Builder addAttributes(
           org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) {
@@ -2410,7 +3947,11 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+       *
+       * <pre>
+       * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+       * </pre>
        */
       public Builder addAttributes(
           int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) {
@@ -2424,7 +3965,11 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+       *
+       * <pre>
+       * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+       * </pre>
        */
       public Builder addAllAttributes(
           java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> values) {
@@ -2438,12 +3983,16 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+       *
+       * <pre>
+       * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+       * </pre>
        */
       public Builder clearAttributes() {
         if (attributesBuilder_ == null) {
           attributes_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x00000008);
+          bitField0_ = (bitField0_ & ~0x00000010);
           onChanged();
         } else {
           attributesBuilder_.clear();
@@ -2451,7 +4000,11 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+       *
+       * <pre>
+       * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+       * </pre>
        */
       public Builder removeAttributes(int index) {
         if (attributesBuilder_ == null) {
@@ -2464,14 +4017,22 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+       *
+       * <pre>
+       * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+       * </pre>
        */
       public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder getAttributesBuilder(
           int index) {
         return getAttributesFieldBuilder().getBuilder(index);
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+       *
+       * <pre>
+       * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+       * </pre>
        */
       public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder(
           int index) {
@@ -2481,7 +4042,11 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+       *
+       * <pre>
+       * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+       * </pre>
        */
       public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
            getAttributesOrBuilderList() {
@@ -2492,14 +4057,22 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+       *
+       * <pre>
+       * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+       * </pre>
        */
       public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder addAttributesBuilder() {
         return getAttributesFieldBuilder().addBuilder(
             org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance());
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+       *
+       * <pre>
+       * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+       * </pre>
        */
       public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder addAttributesBuilder(
           int index) {
@@ -2507,7 +4080,11 @@ public final class NormalizedNodeMessages {
             index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance());
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
+       *
+       * <pre>
+       * @deprecated For backward compatibility (see InstanceIdentifierUtils)
+       * </pre>
        */
       public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder>
            getAttributesBuilderList() {
@@ -2520,7 +4097,7 @@ public final class NormalizedNodeMessages {
           attributesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
               org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>(
                   attributes_,
-                  ((bitField0_ & 0x00000008) == 0x00000008),
+                  ((bitField0_ & 0x00000010) == 0x00000010),
                   getParentForChildren(),
                   isClean());
           attributes_ = null;
@@ -2528,6 +4105,39 @@ public final class NormalizedNodeMessages {
         return attributesBuilder_;
       }
 
+      // optional int32 intType = 6;
+      private int intType_ ;
+      /**
+       * <code>optional int32 intType = 6;</code>
+       */
+      public boolean hasIntType() {
+        return ((bitField0_ & 0x00000020) == 0x00000020);
+      }
+      /**
+       * <code>optional int32 intType = 6;</code>
+       */
+      public int getIntType() {
+        return intType_;
+      }
+      /**
+       * <code>optional int32 intType = 6;</code>
+       */
+      public Builder setIntType(int value) {
+        bitField0_ |= 0x00000020;
+        intType_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 intType = 6;</code>
+       */
+      public Builder clearIntType() {
+        bitField0_ = (bitField0_ & ~0x00000020);
+        intType_ = 0;
+        onChanged();
+        return this;
+      }
+
       // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.PathArgument)
     }
 
@@ -3231,14 +4841,26 @@ public final class NormalizedNodeMessages {
     // optional string path = 1;
     /**
      * <code>optional string path = 1;</code>
+     *
+     * <pre>
+     * @deprecated(use pathArgument)
+     * </pre>
      */
     boolean hasPath();
     /**
      * <code>optional string path = 1;</code>
+     *
+     * <pre>
+     * @deprecated(use pathArgument)
+     * </pre>
      */
     java.lang.String getPath();
     /**
      * <code>optional string path = 1;</code>
+     *
+     * <pre>
+     * @deprecated(use pathArgument)
+     * </pre>
      */
     com.google.protobuf.ByteString
         getPathBytes();
@@ -3246,131 +4868,261 @@ public final class NormalizedNodeMessages {
     // optional string type = 2;
     /**
      * <code>optional string type = 2;</code>
+     *
+     * <pre>
+     * @deprecated(use intType)
+     * </pre>
      */
     boolean hasType();
     /**
      * <code>optional string type = 2;</code>
+     *
+     * <pre>
+     * @deprecated(use intType)
+     * </pre>
      */
     java.lang.String getType();
     /**
      * <code>optional string type = 2;</code>
+     *
+     * <pre>
+     * @deprecated(use intType)
+     * </pre>
      */
     com.google.protobuf.ByteString
         getTypeBytes();
 
-    // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;
+    // optional .org.opendaylight.controller.mdsal.PathArgument pathArgument = 3;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.PathArgument pathArgument = 3;</code>
+     */
+    boolean hasPathArgument();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.PathArgument pathArgument = 3;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument getPathArgument();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.PathArgument pathArgument = 3;</code>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder getPathArgumentOrBuilder();
+
+    // optional int32 intType = 4;
+    /**
+     * <code>optional int32 intType = 4;</code>
+     */
+    boolean hasIntType();
+    /**
+     * <code>optional int32 intType = 4;</code>
+     */
+    int getIntType();
+
+    // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
      */
     java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>
         getAttributesList();
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
      */
     org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index);
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
      */
     int getAttributesCount();
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
      */
     java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
         getAttributesOrBuilderList();
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
      */
     org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder(
         int index);
 
-    // repeated .org.opendaylight.controller.mdsal.Node child = 4;
+    // repeated .org.opendaylight.controller.mdsal.Node child = 6;
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
      */
     java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node>
         getChildList();
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
      */
     org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getChild(int index);
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
      */
     int getChildCount();
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
      */
     java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
         getChildOrBuilderList();
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
      */
     org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getChildOrBuilder(
         int index);
 
-    // optional string value = 5;
+    // optional string value = 7;
     /**
-     * <code>optional string value = 5;</code>
+     * <code>optional string value = 7;</code>
      */
     boolean hasValue();
     /**
-     * <code>optional string value = 5;</code>
+     * <code>optional string value = 7;</code>
      */
     java.lang.String getValue();
     /**
-     * <code>optional string value = 5;</code>
+     * <code>optional string value = 7;</code>
      */
     com.google.protobuf.ByteString
         getValueBytes();
 
-    // optional string valueType = 6;
+    // optional string valueType = 8;
     /**
-     * <code>optional string valueType = 6;</code>
+     * <code>optional string valueType = 8;</code>
+     *
+     * <pre>
+     * @deprecated(use intValueType)
+     * </pre>
      */
     boolean hasValueType();
     /**
-     * <code>optional string valueType = 6;</code>
+     * <code>optional string valueType = 8;</code>
+     *
+     * <pre>
+     * @deprecated(use intValueType)
+     * </pre>
      */
     java.lang.String getValueType();
     /**
-     * <code>optional string valueType = 6;</code>
+     * <code>optional string valueType = 8;</code>
+     *
+     * <pre>
+     * @deprecated(use intValueType)
+     * </pre>
      */
     com.google.protobuf.ByteString
         getValueTypeBytes();
 
-    // repeated string bitsValue = 7;
+    // optional int32 intValueType = 9;
+    /**
+     * <code>optional int32 intValueType = 9;</code>
+     *
+     * <pre>
+     * instead of valueType
+     * </pre>
+     */
+    boolean hasIntValueType();
+    /**
+     * <code>optional int32 intValueType = 9;</code>
+     *
+     * <pre>
+     * instead of valueType
+     * </pre>
+     */
+    int getIntValueType();
+
+    // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 10;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 10;</code>
+     *
+     * <pre>
+     * Specific values
+     * </pre>
+     */
+    boolean hasInstanceIdentifierValue();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 10;</code>
+     *
+     * <pre>
+     * Specific values
+     * </pre>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue();
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 10;</code>
+     *
+     * <pre>
+     * Specific values
+     * </pre>
+     */
+    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder();
+
+    // repeated string bitsValue = 11;
     /**
-     * <code>repeated string bitsValue = 7;</code>
+     * <code>repeated string bitsValue = 11;</code>
+     *
+     * <pre>
+     * intValueType = Bits
+     * </pre>
      */
     java.util.List<java.lang.String>
     getBitsValueList();
     /**
-     * <code>repeated string bitsValue = 7;</code>
+     * <code>repeated string bitsValue = 11;</code>
+     *
+     * <pre>
+     * intValueType = Bits
+     * </pre>
      */
     int getBitsValueCount();
     /**
-     * <code>repeated string bitsValue = 7;</code>
+     * <code>repeated string bitsValue = 11;</code>
+     *
+     * <pre>
+     * intValueType = Bits
+     * </pre>
      */
     java.lang.String getBitsValue(int index);
     /**
-     * <code>repeated string bitsValue = 7;</code>
+     * <code>repeated string bitsValue = 11;</code>
+     *
+     * <pre>
+     * intValueType = Bits
+     * </pre>
      */
     com.google.protobuf.ByteString
         getBitsValueBytes(int index);
 
-    // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;
+    // repeated string code = 12;
     /**
-     * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+     * <code>repeated string code = 12;</code>
+     *
+     * <pre>
+     * A list of string codes which can be used for any repeated strings in the NormalizedNode
+     * </pre>
      */
-    boolean hasInstanceIdentifierValue();
+    java.util.List<java.lang.String>
+    getCodeList();
     /**
-     * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+     * <code>repeated string code = 12;</code>
+     *
+     * <pre>
+     * A list of string codes which can be used for any repeated strings in the NormalizedNode
+     * </pre>
      */
-    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue();
+    int getCodeCount();
     /**
-     * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+     * <code>repeated string code = 12;</code>
+     *
+     * <pre>
+     * A list of string codes which can be used for any repeated strings in the NormalizedNode
+     * </pre>
      */
-    org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder();
+    java.lang.String getCode(int index);
+    /**
+     * <code>repeated string code = 12;</code>
+     *
+     * <pre>
+     * A list of string codes which can be used for any repeated strings in the NormalizedNode
+     * </pre>
+     */
+    com.google.protobuf.ByteString
+        getCodeBytes(int index);
   }
   /**
    * Protobuf type {@code org.opendaylight.controller.mdsal.Node}
@@ -3434,42 +5186,57 @@ public final class NormalizedNodeMessages {
               break;
             }
             case 26: {
-              if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder subBuilder = null;
+              if (((bitField0_ & 0x00000004) == 0x00000004)) {
+                subBuilder = pathArgument_.toBuilder();
+              }
+              pathArgument_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.PARSER, extensionRegistry);
+              if (subBuilder != null) {
+                subBuilder.mergeFrom(pathArgument_);
+                pathArgument_ = subBuilder.buildPartial();
+              }
+              bitField0_ |= 0x00000004;
+              break;
+            }
+            case 32: {
+              bitField0_ |= 0x00000008;
+              intType_ = input.readInt32();
+              break;
+            }
+            case 42: {
+              if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
                 attributes_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>();
-                mutable_bitField0_ |= 0x00000004;
+                mutable_bitField0_ |= 0x00000010;
               }
               attributes_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.PARSER, extensionRegistry));
               break;
             }
-            case 34: {
-              if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
+            case 50: {
+              if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
                 child_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node>();
-                mutable_bitField0_ |= 0x00000008;
+                mutable_bitField0_ |= 0x00000020;
               }
               child_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry));
               break;
             }
-            case 42: {
-              bitField0_ |= 0x00000004;
+            case 58: {
+              bitField0_ |= 0x00000010;
               value_ = input.readBytes();
               break;
             }
-            case 50: {
-              bitField0_ |= 0x00000008;
+            case 66: {
+              bitField0_ |= 0x00000020;
               valueType_ = input.readBytes();
               break;
             }
-            case 58: {
-              if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) {
-                bitsValue_ = new com.google.protobuf.LazyStringArrayList();
-                mutable_bitField0_ |= 0x00000040;
-              }
-              bitsValue_.add(input.readBytes());
+            case 72: {
+              bitField0_ |= 0x00000040;
+              intValueType_ = input.readInt32();
               break;
             }
-            case 66: {
+            case 82: {
               org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
-              if (((bitField0_ & 0x00000010) == 0x00000010)) {
+              if (((bitField0_ & 0x00000080) == 0x00000080)) {
                 subBuilder = instanceIdentifierValue_.toBuilder();
               }
               instanceIdentifierValue_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
@@ -3477,7 +5244,23 @@ public final class NormalizedNodeMessages {
                 subBuilder.mergeFrom(instanceIdentifierValue_);
                 instanceIdentifierValue_ = subBuilder.buildPartial();
               }
-              bitField0_ |= 0x00000010;
+              bitField0_ |= 0x00000080;
+              break;
+            }
+            case 90: {
+              if (!((mutable_bitField0_ & 0x00000400) == 0x00000400)) {
+                bitsValue_ = new com.google.protobuf.LazyStringArrayList();
+                mutable_bitField0_ |= 0x00000400;
+              }
+              bitsValue_.add(input.readBytes());
+              break;
+            }
+            case 98: {
+              if (!((mutable_bitField0_ & 0x00000800) == 0x00000800)) {
+                code_ = new com.google.protobuf.LazyStringArrayList();
+                mutable_bitField0_ |= 0x00000800;
+              }
+              code_.add(input.readBytes());
               break;
             }
           }
@@ -3488,15 +5271,18 @@ public final class NormalizedNodeMessages {
         throw new com.google.protobuf.InvalidProtocolBufferException(
             e.getMessage()).setUnfinishedMessage(this);
       } finally {
-        if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
+        if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
           attributes_ = java.util.Collections.unmodifiableList(attributes_);
         }
-        if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
+        if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
           child_ = java.util.Collections.unmodifiableList(child_);
         }
-        if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) {
+        if (((mutable_bitField0_ & 0x00000400) == 0x00000400)) {
           bitsValue_ = new com.google.protobuf.UnmodifiableLazyStringList(bitsValue_);
         }
+        if (((mutable_bitField0_ & 0x00000800) == 0x00000800)) {
+          code_ = new com.google.protobuf.UnmodifiableLazyStringList(code_);
+        }
         this.unknownFields = unknownFields.build();
         makeExtensionsImmutable();
       }
@@ -3534,12 +5320,20 @@ public final class NormalizedNodeMessages {
     private java.lang.Object path_;
     /**
      * <code>optional string path = 1;</code>
+     *
+     * <pre>
+     * @deprecated(use pathArgument)
+     * </pre>
      */
     public boolean hasPath() {
       return ((bitField0_ & 0x00000001) == 0x00000001);
     }
     /**
      * <code>optional string path = 1;</code>
+     *
+     * <pre>
+     * @deprecated(use pathArgument)
+     * </pre>
      */
     public java.lang.String getPath() {
       java.lang.Object ref = path_;
@@ -3557,6 +5351,10 @@ public final class NormalizedNodeMessages {
     }
     /**
      * <code>optional string path = 1;</code>
+     *
+     * <pre>
+     * @deprecated(use pathArgument)
+     * </pre>
      */
     public com.google.protobuf.ByteString
         getPathBytes() {
@@ -3577,12 +5375,20 @@ public final class NormalizedNodeMessages {
     private java.lang.Object type_;
     /**
      * <code>optional string type = 2;</code>
+     *
+     * <pre>
+     * @deprecated(use intType)
+     * </pre>
      */
     public boolean hasType() {
       return ((bitField0_ & 0x00000002) == 0x00000002);
     }
     /**
      * <code>optional string type = 2;</code>
+     *
+     * <pre>
+     * @deprecated(use intType)
+     * </pre>
      */
     public java.lang.String getType() {
       java.lang.Object ref = type_;
@@ -3600,6 +5406,10 @@ public final class NormalizedNodeMessages {
     }
     /**
      * <code>optional string type = 2;</code>
+     *
+     * <pre>
+     * @deprecated(use intType)
+     * </pre>
      */
     public com.google.protobuf.ByteString
         getTypeBytes() {
@@ -3615,89 +5425,127 @@ public final class NormalizedNodeMessages {
       }
     }
 
-    // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;
-    public static final int ATTRIBUTES_FIELD_NUMBER = 3;
+    // optional .org.opendaylight.controller.mdsal.PathArgument pathArgument = 3;
+    public static final int PATHARGUMENT_FIELD_NUMBER = 3;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument pathArgument_;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.PathArgument pathArgument = 3;</code>
+     */
+    public boolean hasPathArgument() {
+      return ((bitField0_ & 0x00000004) == 0x00000004);
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.PathArgument pathArgument = 3;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument getPathArgument() {
+      return pathArgument_;
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.PathArgument pathArgument = 3;</code>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder getPathArgumentOrBuilder() {
+      return pathArgument_;
+    }
+
+    // optional int32 intType = 4;
+    public static final int INTTYPE_FIELD_NUMBER = 4;
+    private int intType_;
+    /**
+     * <code>optional int32 intType = 4;</code>
+     */
+    public boolean hasIntType() {
+      return ((bitField0_ & 0x00000008) == 0x00000008);
+    }
+    /**
+     * <code>optional int32 intType = 4;</code>
+     */
+    public int getIntType() {
+      return intType_;
+    }
+
+    // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;
+    public static final int ATTRIBUTES_FIELD_NUMBER = 5;
     private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> attributes_;
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
      */
     public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> getAttributesList() {
       return attributes_;
     }
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
      */
     public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
         getAttributesOrBuilderList() {
       return attributes_;
     }
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
      */
     public int getAttributesCount() {
       return attributes_.size();
     }
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
      */
     public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index) {
       return attributes_.get(index);
     }
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
      */
     public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder(
         int index) {
       return attributes_.get(index);
     }
 
-    // repeated .org.opendaylight.controller.mdsal.Node child = 4;
-    public static final int CHILD_FIELD_NUMBER = 4;
+    // repeated .org.opendaylight.controller.mdsal.Node child = 6;
+    public static final int CHILD_FIELD_NUMBER = 6;
     private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node> child_;
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
      */
     public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node> getChildList() {
       return child_;
     }
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
      */
     public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
         getChildOrBuilderList() {
       return child_;
     }
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
      */
     public int getChildCount() {
       return child_.size();
     }
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
      */
     public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getChild(int index) {
       return child_.get(index);
     }
     /**
-     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+     * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
      */
     public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getChildOrBuilder(
         int index) {
       return child_.get(index);
     }
 
-    // optional string value = 5;
-    public static final int VALUE_FIELD_NUMBER = 5;
+    // optional string value = 7;
+    public static final int VALUE_FIELD_NUMBER = 7;
     private java.lang.Object value_;
     /**
-     * <code>optional string value = 5;</code>
+     * <code>optional string value = 7;</code>
      */
     public boolean hasValue() {
-      return ((bitField0_ & 0x00000004) == 0x00000004);
+      return ((bitField0_ & 0x00000010) == 0x00000010);
     }
     /**
-     * <code>optional string value = 5;</code>
+     * <code>optional string value = 7;</code>
      */
     public java.lang.String getValue() {
       java.lang.Object ref = value_;
@@ -3714,7 +5562,7 @@ public final class NormalizedNodeMessages {
       }
     }
     /**
-     * <code>optional string value = 5;</code>
+     * <code>optional string value = 7;</code>
      */
     public com.google.protobuf.ByteString
         getValueBytes() {
@@ -3730,17 +5578,25 @@ public final class NormalizedNodeMessages {
       }
     }
 
-    // optional string valueType = 6;
-    public static final int VALUETYPE_FIELD_NUMBER = 6;
+    // optional string valueType = 8;
+    public static final int VALUETYPE_FIELD_NUMBER = 8;
     private java.lang.Object valueType_;
     /**
-     * <code>optional string valueType = 6;</code>
+     * <code>optional string valueType = 8;</code>
+     *
+     * <pre>
+     * @deprecated(use intValueType)
+     * </pre>
      */
     public boolean hasValueType() {
-      return ((bitField0_ & 0x00000008) == 0x00000008);
+      return ((bitField0_ & 0x00000020) == 0x00000020);
     }
     /**
-     * <code>optional string valueType = 6;</code>
+     * <code>optional string valueType = 8;</code>
+     *
+     * <pre>
+     * @deprecated(use intValueType)
+     * </pre>
      */
     public java.lang.String getValueType() {
       java.lang.Object ref = valueType_;
@@ -3757,7 +5613,11 @@ public final class NormalizedNodeMessages {
       }
     }
     /**
-     * <code>optional string valueType = 6;</code>
+     * <code>optional string valueType = 8;</code>
+     *
+     * <pre>
+     * @deprecated(use intValueType)
+     * </pre>
      */
     public com.google.protobuf.ByteString
         getValueTypeBytes() {
@@ -3773,73 +5633,181 @@ public final class NormalizedNodeMessages {
       }
     }
 
-    // repeated string bitsValue = 7;
-    public static final int BITSVALUE_FIELD_NUMBER = 7;
+    // optional int32 intValueType = 9;
+    public static final int INTVALUETYPE_FIELD_NUMBER = 9;
+    private int intValueType_;
+    /**
+     * <code>optional int32 intValueType = 9;</code>
+     *
+     * <pre>
+     * instead of valueType
+     * </pre>
+     */
+    public boolean hasIntValueType() {
+      return ((bitField0_ & 0x00000040) == 0x00000040);
+    }
+    /**
+     * <code>optional int32 intValueType = 9;</code>
+     *
+     * <pre>
+     * instead of valueType
+     * </pre>
+     */
+    public int getIntValueType() {
+      return intValueType_;
+    }
+
+    // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 10;
+    public static final int INSTANCEIDENTIFIERVALUE_FIELD_NUMBER = 10;
+    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierValue_;
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 10;</code>
+     *
+     * <pre>
+     * Specific values
+     * </pre>
+     */
+    public boolean hasInstanceIdentifierValue() {
+      return ((bitField0_ & 0x00000080) == 0x00000080);
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 10;</code>
+     *
+     * <pre>
+     * Specific values
+     * </pre>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue() {
+      return instanceIdentifierValue_;
+    }
+    /**
+     * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 10;</code>
+     *
+     * <pre>
+     * Specific values
+     * </pre>
+     */
+    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder() {
+      return instanceIdentifierValue_;
+    }
+
+    // repeated string bitsValue = 11;
+    public static final int BITSVALUE_FIELD_NUMBER = 11;
     private com.google.protobuf.LazyStringList bitsValue_;
     /**
-     * <code>repeated string bitsValue = 7;</code>
+     * <code>repeated string bitsValue = 11;</code>
+     *
+     * <pre>
+     * intValueType = Bits
+     * </pre>
      */
     public java.util.List<java.lang.String>
         getBitsValueList() {
       return bitsValue_;
     }
     /**
-     * <code>repeated string bitsValue = 7;</code>
+     * <code>repeated string bitsValue = 11;</code>
+     *
+     * <pre>
+     * intValueType = Bits
+     * </pre>
      */
     public int getBitsValueCount() {
       return bitsValue_.size();
     }
     /**
-     * <code>repeated string bitsValue = 7;</code>
+     * <code>repeated string bitsValue = 11;</code>
+     *
+     * <pre>
+     * intValueType = Bits
+     * </pre>
      */
     public java.lang.String getBitsValue(int index) {
       return bitsValue_.get(index);
     }
     /**
-     * <code>repeated string bitsValue = 7;</code>
+     * <code>repeated string bitsValue = 11;</code>
+     *
+     * <pre>
+     * intValueType = Bits
+     * </pre>
      */
     public com.google.protobuf.ByteString
         getBitsValueBytes(int index) {
       return bitsValue_.getByteString(index);
     }
 
-    // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;
-    public static final int INSTANCEIDENTIFIERVALUE_FIELD_NUMBER = 8;
-    private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierValue_;
+    // repeated string code = 12;
+    public static final int CODE_FIELD_NUMBER = 12;
+    private com.google.protobuf.LazyStringList code_;
     /**
-     * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+     * <code>repeated string code = 12;</code>
+     *
+     * <pre>
+     * A list of string codes which can be used for any repeated strings in the NormalizedNode
+     * </pre>
      */
-    public boolean hasInstanceIdentifierValue() {
-      return ((bitField0_ & 0x00000010) == 0x00000010);
+    public java.util.List<java.lang.String>
+        getCodeList() {
+      return code_;
+    }
+    /**
+     * <code>repeated string code = 12;</code>
+     *
+     * <pre>
+     * A list of string codes which can be used for any repeated strings in the NormalizedNode
+     * </pre>
+     */
+    public int getCodeCount() {
+      return code_.size();
     }
     /**
-     * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+     * <code>repeated string code = 12;</code>
+     *
+     * <pre>
+     * A list of string codes which can be used for any repeated strings in the NormalizedNode
+     * </pre>
      */
-    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue() {
-      return instanceIdentifierValue_;
+    public java.lang.String getCode(int index) {
+      return code_.get(index);
     }
     /**
-     * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+     * <code>repeated string code = 12;</code>
+     *
+     * <pre>
+     * A list of string codes which can be used for any repeated strings in the NormalizedNode
+     * </pre>
      */
-    public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder() {
-      return instanceIdentifierValue_;
+    public com.google.protobuf.ByteString
+        getCodeBytes(int index) {
+      return code_.getByteString(index);
     }
 
     private void initFields() {
       path_ = "";
       type_ = "";
+      pathArgument_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.getDefaultInstance();
+      intType_ = 0;
       attributes_ = java.util.Collections.emptyList();
       child_ = java.util.Collections.emptyList();
       value_ = "";
       valueType_ = "";
-      bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+      intValueType_ = 0;
       instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+      bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+      code_ = com.google.protobuf.LazyStringArrayList.EMPTY;
     }
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
       byte isInitialized = memoizedIsInitialized;
       if (isInitialized != -1) return isInitialized == 1;
 
+      if (hasPathArgument()) {
+        if (!getPathArgument().isInitialized()) {
+          memoizedIsInitialized = 0;
+          return false;
+        }
+      }
       for (int i = 0; i < getAttributesCount(); i++) {
         if (!getAttributes(i).isInitialized()) {
           memoizedIsInitialized = 0;
@@ -3871,23 +5839,35 @@ public final class NormalizedNodeMessages {
       if (((bitField0_ & 0x00000002) == 0x00000002)) {
         output.writeBytes(2, getTypeBytes());
       }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        output.writeMessage(3, pathArgument_);
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        output.writeInt32(4, intType_);
+      }
       for (int i = 0; i < attributes_.size(); i++) {
-        output.writeMessage(3, attributes_.get(i));
+        output.writeMessage(5, attributes_.get(i));
       }
       for (int i = 0; i < child_.size(); i++) {
-        output.writeMessage(4, child_.get(i));
+        output.writeMessage(6, child_.get(i));
       }
-      if (((bitField0_ & 0x00000004) == 0x00000004)) {
-        output.writeBytes(5, getValueBytes());
+      if (((bitField0_ & 0x00000010) == 0x00000010)) {
+        output.writeBytes(7, getValueBytes());
       }
-      if (((bitField0_ & 0x00000008) == 0x00000008)) {
-        output.writeBytes(6, getValueTypeBytes());
+      if (((bitField0_ & 0x00000020) == 0x00000020)) {
+        output.writeBytes(8, getValueTypeBytes());
+      }
+      if (((bitField0_ & 0x00000040) == 0x00000040)) {
+        output.writeInt32(9, intValueType_);
+      }
+      if (((bitField0_ & 0x00000080) == 0x00000080)) {
+        output.writeMessage(10, instanceIdentifierValue_);
       }
       for (int i = 0; i < bitsValue_.size(); i++) {
-        output.writeBytes(7, bitsValue_.getByteString(i));
+        output.writeBytes(11, bitsValue_.getByteString(i));
       }
-      if (((bitField0_ & 0x00000010) == 0x00000010)) {
-        output.writeMessage(8, instanceIdentifierValue_);
+      for (int i = 0; i < code_.size(); i++) {
+        output.writeBytes(12, code_.getByteString(i));
       }
       getUnknownFields().writeTo(output);
     }
@@ -3906,21 +5886,37 @@ public final class NormalizedNodeMessages {
         size += com.google.protobuf.CodedOutputStream
           .computeBytesSize(2, getTypeBytes());
       }
+      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(3, pathArgument_);
+      }
+      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(4, intType_);
+      }
       for (int i = 0; i < attributes_.size(); i++) {
         size += com.google.protobuf.CodedOutputStream
-          .computeMessageSize(3, attributes_.get(i));
+          .computeMessageSize(5, attributes_.get(i));
       }
       for (int i = 0; i < child_.size(); i++) {
         size += com.google.protobuf.CodedOutputStream
-          .computeMessageSize(4, child_.get(i));
+          .computeMessageSize(6, child_.get(i));
       }
-      if (((bitField0_ & 0x00000004) == 0x00000004)) {
+      if (((bitField0_ & 0x00000010) == 0x00000010)) {
         size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(5, getValueBytes());
+          .computeBytesSize(7, getValueBytes());
       }
-      if (((bitField0_ & 0x00000008) == 0x00000008)) {
+      if (((bitField0_ & 0x00000020) == 0x00000020)) {
         size += com.google.protobuf.CodedOutputStream
-          .computeBytesSize(6, getValueTypeBytes());
+          .computeBytesSize(8, getValueTypeBytes());
+      }
+      if (((bitField0_ & 0x00000040) == 0x00000040)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeInt32Size(9, intValueType_);
+      }
+      if (((bitField0_ & 0x00000080) == 0x00000080)) {
+        size += com.google.protobuf.CodedOutputStream
+          .computeMessageSize(10, instanceIdentifierValue_);
       }
       {
         int dataSize = 0;
@@ -3931,9 +5927,14 @@ public final class NormalizedNodeMessages {
         size += dataSize;
         size += 1 * getBitsValueList().size();
       }
-      if (((bitField0_ & 0x00000010) == 0x00000010)) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeMessageSize(8, instanceIdentifierValue_);
+      {
+        int dataSize = 0;
+        for (int i = 0; i < code_.size(); i++) {
+          dataSize += com.google.protobuf.CodedOutputStream
+            .computeBytesSizeNoTag(code_.getByteString(i));
+        }
+        size += dataSize;
+        size += 1 * getCodeList().size();
       }
       size += getUnknownFields().getSerializedSize();
       memoizedSerializedSize = size;
@@ -4043,6 +6044,7 @@ public final class NormalizedNodeMessages {
       }
       private void maybeForceBuilderInitialization() {
         if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+          getPathArgumentFieldBuilder();
           getAttributesFieldBuilder();
           getChildFieldBuilder();
           getInstanceIdentifierValueFieldBuilder();
@@ -4058,30 +6060,42 @@ public final class NormalizedNodeMessages {
         bitField0_ = (bitField0_ & ~0x00000001);
         type_ = "";
         bitField0_ = (bitField0_ & ~0x00000002);
+        if (pathArgumentBuilder_ == null) {
+          pathArgument_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.getDefaultInstance();
+        } else {
+          pathArgumentBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000004);
+        intType_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000008);
         if (attributesBuilder_ == null) {
           attributes_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x00000004);
+          bitField0_ = (bitField0_ & ~0x00000010);
         } else {
           attributesBuilder_.clear();
         }
         if (childBuilder_ == null) {
           child_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x00000008);
+          bitField0_ = (bitField0_ & ~0x00000020);
         } else {
           childBuilder_.clear();
         }
         value_ = "";
-        bitField0_ = (bitField0_ & ~0x00000010);
-        valueType_ = "";
-        bitField0_ = (bitField0_ & ~0x00000020);
-        bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
         bitField0_ = (bitField0_ & ~0x00000040);
+        valueType_ = "";
+        bitField0_ = (bitField0_ & ~0x00000080);
+        intValueType_ = 0;
+        bitField0_ = (bitField0_ & ~0x00000100);
         if (instanceIdentifierValueBuilder_ == null) {
           instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
         } else {
           instanceIdentifierValueBuilder_.clear();
         }
-        bitField0_ = (bitField0_ & ~0x00000080);
+        bitField0_ = (bitField0_ & ~0x00000200);
+        bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+        bitField0_ = (bitField0_ & ~0x00000400);
+        code_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+        bitField0_ = (bitField0_ & ~0x00000800);
         return this;
       }
 
@@ -4118,46 +6132,68 @@ public final class NormalizedNodeMessages {
           to_bitField0_ |= 0x00000002;
         }
         result.type_ = type_;
+        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
+          to_bitField0_ |= 0x00000004;
+        }
+        if (pathArgumentBuilder_ == null) {
+          result.pathArgument_ = pathArgument_;
+        } else {
+          result.pathArgument_ = pathArgumentBuilder_.build();
+        }
+        if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
+          to_bitField0_ |= 0x00000008;
+        }
+        result.intType_ = intType_;
         if (attributesBuilder_ == null) {
-          if (((bitField0_ & 0x00000004) == 0x00000004)) {
+          if (((bitField0_ & 0x00000010) == 0x00000010)) {
             attributes_ = java.util.Collections.unmodifiableList(attributes_);
-            bitField0_ = (bitField0_ & ~0x00000004);
+            bitField0_ = (bitField0_ & ~0x00000010);
           }
           result.attributes_ = attributes_;
         } else {
           result.attributes_ = attributesBuilder_.build();
         }
         if (childBuilder_ == null) {
-          if (((bitField0_ & 0x00000008) == 0x00000008)) {
+          if (((bitField0_ & 0x00000020) == 0x00000020)) {
             child_ = java.util.Collections.unmodifiableList(child_);
-            bitField0_ = (bitField0_ & ~0x00000008);
+            bitField0_ = (bitField0_ & ~0x00000020);
           }
           result.child_ = child_;
         } else {
           result.child_ = childBuilder_.build();
         }
-        if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
-          to_bitField0_ |= 0x00000004;
+        if (((from_bitField0_ & 0x00000040) == 0x00000040)) {
+          to_bitField0_ |= 0x00000010;
         }
         result.value_ = value_;
-        if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
-          to_bitField0_ |= 0x00000008;
+        if (((from_bitField0_ & 0x00000080) == 0x00000080)) {
+          to_bitField0_ |= 0x00000020;
         }
         result.valueType_ = valueType_;
-        if (((bitField0_ & 0x00000040) == 0x00000040)) {
-          bitsValue_ = new com.google.protobuf.UnmodifiableLazyStringList(
-              bitsValue_);
-          bitField0_ = (bitField0_ & ~0x00000040);
+        if (((from_bitField0_ & 0x00000100) == 0x00000100)) {
+          to_bitField0_ |= 0x00000040;
         }
-        result.bitsValue_ = bitsValue_;
-        if (((from_bitField0_ & 0x00000080) == 0x00000080)) {
-          to_bitField0_ |= 0x00000010;
+        result.intValueType_ = intValueType_;
+        if (((from_bitField0_ & 0x00000200) == 0x00000200)) {
+          to_bitField0_ |= 0x00000080;
         }
         if (instanceIdentifierValueBuilder_ == null) {
           result.instanceIdentifierValue_ = instanceIdentifierValue_;
         } else {
           result.instanceIdentifierValue_ = instanceIdentifierValueBuilder_.build();
         }
+        if (((bitField0_ & 0x00000400) == 0x00000400)) {
+          bitsValue_ = new com.google.protobuf.UnmodifiableLazyStringList(
+              bitsValue_);
+          bitField0_ = (bitField0_ & ~0x00000400);
+        }
+        result.bitsValue_ = bitsValue_;
+        if (((bitField0_ & 0x00000800) == 0x00000800)) {
+          code_ = new com.google.protobuf.UnmodifiableLazyStringList(
+              code_);
+          bitField0_ = (bitField0_ & ~0x00000800);
+        }
+        result.code_ = code_;
         result.bitField0_ = to_bitField0_;
         onBuilt();
         return result;
@@ -4184,11 +6220,17 @@ public final class NormalizedNodeMessages {
           type_ = other.type_;
           onChanged();
         }
+        if (other.hasPathArgument()) {
+          mergePathArgument(other.getPathArgument());
+        }
+        if (other.hasIntType()) {
+          setIntType(other.getIntType());
+        }
         if (attributesBuilder_ == null) {
           if (!other.attributes_.isEmpty()) {
             if (attributes_.isEmpty()) {
               attributes_ = other.attributes_;
-              bitField0_ = (bitField0_ & ~0x00000004);
+              bitField0_ = (bitField0_ & ~0x00000010);
             } else {
               ensureAttributesIsMutable();
               attributes_.addAll(other.attributes_);
@@ -4201,7 +6243,7 @@ public final class NormalizedNodeMessages {
               attributesBuilder_.dispose();
               attributesBuilder_ = null;
               attributes_ = other.attributes_;
-              bitField0_ = (bitField0_ & ~0x00000004);
+              bitField0_ = (bitField0_ & ~0x00000010);
               attributesBuilder_ =
                 com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
                    getAttributesFieldBuilder() : null;
@@ -4214,7 +6256,7 @@ public final class NormalizedNodeMessages {
           if (!other.child_.isEmpty()) {
             if (child_.isEmpty()) {
               child_ = other.child_;
-              bitField0_ = (bitField0_ & ~0x00000008);
+              bitField0_ = (bitField0_ & ~0x00000020);
             } else {
               ensureChildIsMutable();
               child_.addAll(other.child_);
@@ -4227,7 +6269,7 @@ public final class NormalizedNodeMessages {
               childBuilder_.dispose();
               childBuilder_ = null;
               child_ = other.child_;
-              bitField0_ = (bitField0_ & ~0x00000008);
+              bitField0_ = (bitField0_ & ~0x00000020);
               childBuilder_ =
                 com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
                    getChildFieldBuilder() : null;
@@ -4237,33 +6279,52 @@ public final class NormalizedNodeMessages {
           }
         }
         if (other.hasValue()) {
-          bitField0_ |= 0x00000010;
+          bitField0_ |= 0x00000040;
           value_ = other.value_;
           onChanged();
         }
         if (other.hasValueType()) {
-          bitField0_ |= 0x00000020;
+          bitField0_ |= 0x00000080;
           valueType_ = other.valueType_;
           onChanged();
         }
+        if (other.hasIntValueType()) {
+          setIntValueType(other.getIntValueType());
+        }
+        if (other.hasInstanceIdentifierValue()) {
+          mergeInstanceIdentifierValue(other.getInstanceIdentifierValue());
+        }
         if (!other.bitsValue_.isEmpty()) {
           if (bitsValue_.isEmpty()) {
             bitsValue_ = other.bitsValue_;
-            bitField0_ = (bitField0_ & ~0x00000040);
+            bitField0_ = (bitField0_ & ~0x00000400);
           } else {
             ensureBitsValueIsMutable();
             bitsValue_.addAll(other.bitsValue_);
           }
           onChanged();
         }
-        if (other.hasInstanceIdentifierValue()) {
-          mergeInstanceIdentifierValue(other.getInstanceIdentifierValue());
+        if (!other.code_.isEmpty()) {
+          if (code_.isEmpty()) {
+            code_ = other.code_;
+            bitField0_ = (bitField0_ & ~0x00000800);
+          } else {
+            ensureCodeIsMutable();
+            code_.addAll(other.code_);
+          }
+          onChanged();
         }
         this.mergeUnknownFields(other.getUnknownFields());
         return this;
       }
 
       public final boolean isInitialized() {
+        if (hasPathArgument()) {
+          if (!getPathArgument().isInitialized()) {
+
+            return false;
+          }
+        }
         for (int i = 0; i < getAttributesCount(); i++) {
           if (!getAttributes(i).isInitialized()) {
 
@@ -4308,12 +6369,20 @@ public final class NormalizedNodeMessages {
       private java.lang.Object path_ = "";
       /**
        * <code>optional string path = 1;</code>
+       *
+       * <pre>
+       * @deprecated(use pathArgument)
+       * </pre>
        */
       public boolean hasPath() {
         return ((bitField0_ & 0x00000001) == 0x00000001);
       }
       /**
        * <code>optional string path = 1;</code>
+       *
+       * <pre>
+       * @deprecated(use pathArgument)
+       * </pre>
        */
       public java.lang.String getPath() {
         java.lang.Object ref = path_;
@@ -4328,6 +6397,10 @@ public final class NormalizedNodeMessages {
       }
       /**
        * <code>optional string path = 1;</code>
+       *
+       * <pre>
+       * @deprecated(use pathArgument)
+       * </pre>
        */
       public com.google.protobuf.ByteString
           getPathBytes() {
@@ -4344,6 +6417,10 @@ public final class NormalizedNodeMessages {
       }
       /**
        * <code>optional string path = 1;</code>
+       *
+       * <pre>
+       * @deprecated(use pathArgument)
+       * </pre>
        */
       public Builder setPath(
           java.lang.String value) {
@@ -4357,6 +6434,10 @@ public final class NormalizedNodeMessages {
       }
       /**
        * <code>optional string path = 1;</code>
+       *
+       * <pre>
+       * @deprecated(use pathArgument)
+       * </pre>
        */
       public Builder clearPath() {
         bitField0_ = (bitField0_ & ~0x00000001);
@@ -4366,6 +6447,10 @@ public final class NormalizedNodeMessages {
       }
       /**
        * <code>optional string path = 1;</code>
+       *
+       * <pre>
+       * @deprecated(use pathArgument)
+       * </pre>
        */
       public Builder setPathBytes(
           com.google.protobuf.ByteString value) {
@@ -4382,12 +6467,20 @@ public final class NormalizedNodeMessages {
       private java.lang.Object type_ = "";
       /**
        * <code>optional string type = 2;</code>
+       *
+       * <pre>
+       * @deprecated(use intType)
+       * </pre>
        */
       public boolean hasType() {
         return ((bitField0_ & 0x00000002) == 0x00000002);
       }
       /**
        * <code>optional string type = 2;</code>
+       *
+       * <pre>
+       * @deprecated(use intType)
+       * </pre>
        */
       public java.lang.String getType() {
         java.lang.Object ref = type_;
@@ -4402,6 +6495,10 @@ public final class NormalizedNodeMessages {
       }
       /**
        * <code>optional string type = 2;</code>
+       *
+       * <pre>
+       * @deprecated(use intType)
+       * </pre>
        */
       public com.google.protobuf.ByteString
           getTypeBytes() {
@@ -4418,6 +6515,10 @@ public final class NormalizedNodeMessages {
       }
       /**
        * <code>optional string type = 2;</code>
+       *
+       * <pre>
+       * @deprecated(use intType)
+       * </pre>
        */
       public Builder setType(
           java.lang.String value) {
@@ -4431,6 +6532,10 @@ public final class NormalizedNodeMessages {
       }
       /**
        * <code>optional string type = 2;</code>
+       *
+       * <pre>
+       * @deprecated(use intType)
+       * </pre>
        */
       public Builder clearType() {
         bitField0_ = (bitField0_ & ~0x00000002);
@@ -4440,6 +6545,10 @@ public final class NormalizedNodeMessages {
       }
       /**
        * <code>optional string type = 2;</code>
+       *
+       * <pre>
+       * @deprecated(use intType)
+       * </pre>
        */
       public Builder setTypeBytes(
           com.google.protobuf.ByteString value) {
@@ -4452,13 +6561,163 @@ public final class NormalizedNodeMessages {
         return this;
       }
 
-      // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;
+      // optional .org.opendaylight.controller.mdsal.PathArgument pathArgument = 3;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument pathArgument_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder> pathArgumentBuilder_;
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.PathArgument pathArgument = 3;</code>
+       */
+      public boolean hasPathArgument() {
+        return ((bitField0_ & 0x00000004) == 0x00000004);
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.PathArgument pathArgument = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument getPathArgument() {
+        if (pathArgumentBuilder_ == null) {
+          return pathArgument_;
+        } else {
+          return pathArgumentBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.PathArgument pathArgument = 3;</code>
+       */
+      public Builder setPathArgument(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument value) {
+        if (pathArgumentBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          pathArgument_ = value;
+          onChanged();
+        } else {
+          pathArgumentBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000004;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.PathArgument pathArgument = 3;</code>
+       */
+      public Builder setPathArgument(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder builderForValue) {
+        if (pathArgumentBuilder_ == null) {
+          pathArgument_ = builderForValue.build();
+          onChanged();
+        } else {
+          pathArgumentBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000004;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.PathArgument pathArgument = 3;</code>
+       */
+      public Builder mergePathArgument(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument value) {
+        if (pathArgumentBuilder_ == null) {
+          if (((bitField0_ & 0x00000004) == 0x00000004) &&
+              pathArgument_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.getDefaultInstance()) {
+            pathArgument_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.newBuilder(pathArgument_).mergeFrom(value).buildPartial();
+          } else {
+            pathArgument_ = value;
+          }
+          onChanged();
+        } else {
+          pathArgumentBuilder_.mergeFrom(value);
+        }
+        bitField0_ |= 0x00000004;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.PathArgument pathArgument = 3;</code>
+       */
+      public Builder clearPathArgument() {
+        if (pathArgumentBuilder_ == null) {
+          pathArgument_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.getDefaultInstance();
+          onChanged();
+        } else {
+          pathArgumentBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000004);
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.PathArgument pathArgument = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder getPathArgumentBuilder() {
+        bitField0_ |= 0x00000004;
+        onChanged();
+        return getPathArgumentFieldBuilder().getBuilder();
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.PathArgument pathArgument = 3;</code>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder getPathArgumentOrBuilder() {
+        if (pathArgumentBuilder_ != null) {
+          return pathArgumentBuilder_.getMessageOrBuilder();
+        } else {
+          return pathArgument_;
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.PathArgument pathArgument = 3;</code>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder>
+          getPathArgumentFieldBuilder() {
+        if (pathArgumentBuilder_ == null) {
+          pathArgumentBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder>(
+                  pathArgument_,
+                  getParentForChildren(),
+                  isClean());
+          pathArgument_ = null;
+        }
+        return pathArgumentBuilder_;
+      }
+
+      // optional int32 intType = 4;
+      private int intType_ ;
+      /**
+       * <code>optional int32 intType = 4;</code>
+       */
+      public boolean hasIntType() {
+        return ((bitField0_ & 0x00000008) == 0x00000008);
+      }
+      /**
+       * <code>optional int32 intType = 4;</code>
+       */
+      public int getIntType() {
+        return intType_;
+      }
+      /**
+       * <code>optional int32 intType = 4;</code>
+       */
+      public Builder setIntType(int value) {
+        bitField0_ |= 0x00000008;
+        intType_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 intType = 4;</code>
+       */
+      public Builder clearIntType() {
+        bitField0_ = (bitField0_ & ~0x00000008);
+        intType_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;
       private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> attributes_ =
         java.util.Collections.emptyList();
       private void ensureAttributesIsMutable() {
-        if (!((bitField0_ & 0x00000004) == 0x00000004)) {
+        if (!((bitField0_ & 0x00000010) == 0x00000010)) {
           attributes_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>(attributes_);
-          bitField0_ |= 0x00000004;
+          bitField0_ |= 0x00000010;
          }
       }
 
@@ -4466,7 +6725,7 @@ public final class NormalizedNodeMessages {
           org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> attributesBuilder_;
 
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
        */
       public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> getAttributesList() {
         if (attributesBuilder_ == null) {
@@ -4476,7 +6735,7 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
        */
       public int getAttributesCount() {
         if (attributesBuilder_ == null) {
@@ -4486,7 +6745,7 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
        */
       public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index) {
         if (attributesBuilder_ == null) {
@@ -4496,7 +6755,7 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
        */
       public Builder setAttributes(
           int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) {
@@ -4513,7 +6772,7 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
        */
       public Builder setAttributes(
           int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) {
@@ -4527,7 +6786,7 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
        */
       public Builder addAttributes(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) {
         if (attributesBuilder_ == null) {
@@ -4543,7 +6802,7 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
        */
       public Builder addAttributes(
           int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) {
@@ -4560,7 +6819,7 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
        */
       public Builder addAttributes(
           org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) {
@@ -4574,7 +6833,7 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
        */
       public Builder addAttributes(
           int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) {
@@ -4588,7 +6847,7 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
        */
       public Builder addAllAttributes(
           java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute> values) {
@@ -4602,12 +6861,12 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
        */
       public Builder clearAttributes() {
         if (attributesBuilder_ == null) {
           attributes_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x00000004);
+          bitField0_ = (bitField0_ & ~0x00000010);
           onChanged();
         } else {
           attributesBuilder_.clear();
@@ -4615,7 +6874,7 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
        */
       public Builder removeAttributes(int index) {
         if (attributesBuilder_ == null) {
@@ -4628,14 +6887,14 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
        */
       public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder getAttributesBuilder(
           int index) {
         return getAttributesFieldBuilder().getBuilder(index);
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
        */
       public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder(
           int index) {
@@ -4645,7 +6904,7 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
        */
       public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
            getAttributesOrBuilderList() {
@@ -4656,14 +6915,14 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
        */
       public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder addAttributesBuilder() {
         return getAttributesFieldBuilder().addBuilder(
             org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance());
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
        */
       public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder addAttributesBuilder(
           int index) {
@@ -4671,7 +6930,7 @@ public final class NormalizedNodeMessages {
             index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance());
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 5;</code>
        */
       public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder>
            getAttributesBuilderList() {
@@ -4684,7 +6943,7 @@ public final class NormalizedNodeMessages {
           attributesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
               org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>(
                   attributes_,
-                  ((bitField0_ & 0x00000004) == 0x00000004),
+                  ((bitField0_ & 0x00000010) == 0x00000010),
                   getParentForChildren(),
                   isClean());
           attributes_ = null;
@@ -4692,13 +6951,13 @@ public final class NormalizedNodeMessages {
         return attributesBuilder_;
       }
 
-      // repeated .org.opendaylight.controller.mdsal.Node child = 4;
+      // repeated .org.opendaylight.controller.mdsal.Node child = 6;
       private java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node> child_ =
         java.util.Collections.emptyList();
       private void ensureChildIsMutable() {
-        if (!((bitField0_ & 0x00000008) == 0x00000008)) {
+        if (!((bitField0_ & 0x00000020) == 0x00000020)) {
           child_ = new java.util.ArrayList<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node>(child_);
-          bitField0_ |= 0x00000008;
+          bitField0_ |= 0x00000020;
          }
       }
 
@@ -4706,7 +6965,7 @@ public final class NormalizedNodeMessages {
           org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> childBuilder_;
 
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
        */
       public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node> getChildList() {
         if (childBuilder_ == null) {
@@ -4716,7 +6975,7 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
        */
       public int getChildCount() {
         if (childBuilder_ == null) {
@@ -4726,7 +6985,7 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
        */
       public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getChild(int index) {
         if (childBuilder_ == null) {
@@ -4736,7 +6995,7 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
        */
       public Builder setChild(
           int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
@@ -4753,7 +7012,7 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
        */
       public Builder setChild(
           int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
@@ -4767,7 +7026,7 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
        */
       public Builder addChild(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
         if (childBuilder_ == null) {
@@ -4783,7 +7042,7 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
        */
       public Builder addChild(
           int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) {
@@ -4800,7 +7059,7 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
        */
       public Builder addChild(
           org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
@@ -4814,7 +7073,7 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
        */
       public Builder addChild(
           int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) {
@@ -4828,7 +7087,7 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
        */
       public Builder addAllChild(
           java.lang.Iterable<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node> values) {
@@ -4842,12 +7101,12 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
        */
       public Builder clearChild() {
         if (childBuilder_ == null) {
           child_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x00000008);
+          bitField0_ = (bitField0_ & ~0x00000020);
           onChanged();
         } else {
           childBuilder_.clear();
@@ -4855,7 +7114,7 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
        */
       public Builder removeChild(int index) {
         if (childBuilder_ == null) {
@@ -4868,14 +7127,14 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
        */
       public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getChildBuilder(
           int index) {
         return getChildFieldBuilder().getBuilder(index);
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
        */
       public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getChildOrBuilder(
           int index) {
@@ -4885,7 +7144,7 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
        */
       public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
            getChildOrBuilderList() {
@@ -4896,14 +7155,14 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
        */
       public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder addChildBuilder() {
         return getChildFieldBuilder().addBuilder(
             org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance());
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
        */
       public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder addChildBuilder(
           int index) {
@@ -4911,7 +7170,7 @@ public final class NormalizedNodeMessages {
             index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance());
       }
       /**
-       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
+       * <code>repeated .org.opendaylight.controller.mdsal.Node child = 6;</code>
        */
       public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder>
            getChildBuilderList() {
@@ -4924,7 +7183,7 @@ public final class NormalizedNodeMessages {
           childBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
               org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>(
                   child_,
-                  ((bitField0_ & 0x00000008) == 0x00000008),
+                  ((bitField0_ & 0x00000020) == 0x00000020),
                   getParentForChildren(),
                   isClean());
           child_ = null;
@@ -4932,16 +7191,16 @@ public final class NormalizedNodeMessages {
         return childBuilder_;
       }
 
-      // optional string value = 5;
+      // optional string value = 7;
       private java.lang.Object value_ = "";
       /**
-       * <code>optional string value = 5;</code>
+       * <code>optional string value = 7;</code>
        */
       public boolean hasValue() {
-        return ((bitField0_ & 0x00000010) == 0x00000010);
+        return ((bitField0_ & 0x00000040) == 0x00000040);
       }
       /**
-       * <code>optional string value = 5;</code>
+       * <code>optional string value = 7;</code>
        */
       public java.lang.String getValue() {
         java.lang.Object ref = value_;
@@ -4955,7 +7214,7 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>optional string value = 5;</code>
+       * <code>optional string value = 7;</code>
        */
       public com.google.protobuf.ByteString
           getValueBytes() {
@@ -4971,51 +7230,59 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>optional string value = 5;</code>
+       * <code>optional string value = 7;</code>
        */
       public Builder setValue(
           java.lang.String value) {
         if (value == null) {
     throw new NullPointerException();
   }
-  bitField0_ |= 0x00000010;
+  bitField0_ |= 0x00000040;
         value_ = value;
         onChanged();
         return this;
       }
       /**
-       * <code>optional string value = 5;</code>
+       * <code>optional string value = 7;</code>
        */
       public Builder clearValue() {
-        bitField0_ = (bitField0_ & ~0x00000010);
+        bitField0_ = (bitField0_ & ~0x00000040);
         value_ = getDefaultInstance().getValue();
         onChanged();
         return this;
       }
       /**
-       * <code>optional string value = 5;</code>
+       * <code>optional string value = 7;</code>
        */
       public Builder setValueBytes(
           com.google.protobuf.ByteString value) {
         if (value == null) {
     throw new NullPointerException();
   }
-  bitField0_ |= 0x00000010;
+  bitField0_ |= 0x00000040;
         value_ = value;
         onChanged();
         return this;
       }
 
-      // optional string valueType = 6;
+      // optional string valueType = 8;
       private java.lang.Object valueType_ = "";
       /**
-       * <code>optional string valueType = 6;</code>
+       * <code>optional string valueType = 8;</code>
+       *
+       * <pre>
+       * @deprecated(use intValueType)
+       * </pre>
        */
       public boolean hasValueType() {
-        return ((bitField0_ & 0x00000020) == 0x00000020);
+        return ((bitField0_ & 0x00000080) == 0x00000080);
       }
       /**
-       * <code>optional string valueType = 6;</code>
+       * <code>optional string valueType = 8;</code>
+       *
+       * <pre>
+       * @deprecated(use intValueType)
+       * </pre>
        */
       public java.lang.String getValueType() {
         java.lang.Object ref = valueType_;
@@ -5029,93 +7296,331 @@ public final class NormalizedNodeMessages {
         }
       }
       /**
-       * <code>optional string valueType = 6;</code>
+       * <code>optional string valueType = 8;</code>
+       *
+       * <pre>
+       * @deprecated(use intValueType)
+       * </pre>
+       */
+      public com.google.protobuf.ByteString
+          getValueTypeBytes() {
+        java.lang.Object ref = valueType_;
+        if (ref instanceof String) {
+          com.google.protobuf.ByteString b =
+              com.google.protobuf.ByteString.copyFromUtf8(
+                  (java.lang.String) ref);
+          valueType_ = b;
+          return b;
+        } else {
+          return (com.google.protobuf.ByteString) ref;
+        }
+      }
+      /**
+       * <code>optional string valueType = 8;</code>
+       *
+       * <pre>
+       * @deprecated(use intValueType)
+       * </pre>
+       */
+      public Builder setValueType(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000080;
+        valueType_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string valueType = 8;</code>
+       *
+       * <pre>
+       * @deprecated(use intValueType)
+       * </pre>
+       */
+      public Builder clearValueType() {
+        bitField0_ = (bitField0_ & ~0x00000080);
+        valueType_ = getDefaultInstance().getValueType();
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional string valueType = 8;</code>
+       *
+       * <pre>
+       * @deprecated(use intValueType)
+       * </pre>
+       */
+      public Builder setValueTypeBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000080;
+        valueType_ = value;
+        onChanged();
+        return this;
+      }
+
+      // optional int32 intValueType = 9;
+      private int intValueType_ ;
+      /**
+       * <code>optional int32 intValueType = 9;</code>
+       *
+       * <pre>
+       * instead of valueType
+       * </pre>
+       */
+      public boolean hasIntValueType() {
+        return ((bitField0_ & 0x00000100) == 0x00000100);
+      }
+      /**
+       * <code>optional int32 intValueType = 9;</code>
+       *
+       * <pre>
+       * instead of valueType
+       * </pre>
+       */
+      public int getIntValueType() {
+        return intValueType_;
+      }
+      /**
+       * <code>optional int32 intValueType = 9;</code>
+       *
+       * <pre>
+       * instead of valueType
+       * </pre>
+       */
+      public Builder setIntValueType(int value) {
+        bitField0_ |= 0x00000100;
+        intValueType_ = value;
+        onChanged();
+        return this;
+      }
+      /**
+       * <code>optional int32 intValueType = 9;</code>
+       *
+       * <pre>
+       * instead of valueType
+       * </pre>
+       */
+      public Builder clearIntValueType() {
+        bitField0_ = (bitField0_ & ~0x00000100);
+        intValueType_ = 0;
+        onChanged();
+        return this;
+      }
+
+      // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 10;
+      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierValueBuilder_;
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 10;</code>
+       *
+       * <pre>
+       * Specific values
+       * </pre>
+       */
+      public boolean hasInstanceIdentifierValue() {
+        return ((bitField0_ & 0x00000200) == 0x00000200);
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 10;</code>
+       *
+       * <pre>
+       * Specific values
+       * </pre>
+       */
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue() {
+        if (instanceIdentifierValueBuilder_ == null) {
+          return instanceIdentifierValue_;
+        } else {
+          return instanceIdentifierValueBuilder_.getMessage();
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 10;</code>
+       *
+       * <pre>
+       * Specific values
+       * </pre>
+       */
+      public Builder setInstanceIdentifierValue(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (instanceIdentifierValueBuilder_ == null) {
+          if (value == null) {
+            throw new NullPointerException();
+          }
+          instanceIdentifierValue_ = value;
+          onChanged();
+        } else {
+          instanceIdentifierValueBuilder_.setMessage(value);
+        }
+        bitField0_ |= 0x00000200;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 10;</code>
+       *
+       * <pre>
+       * Specific values
+       * </pre>
+       */
+      public Builder setInstanceIdentifierValue(
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+        if (instanceIdentifierValueBuilder_ == null) {
+          instanceIdentifierValue_ = builderForValue.build();
+          onChanged();
+        } else {
+          instanceIdentifierValueBuilder_.setMessage(builderForValue.build());
+        }
+        bitField0_ |= 0x00000200;
+        return this;
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 10;</code>
+       *
+       * <pre>
+       * Specific values
+       * </pre>
        */
-      public com.google.protobuf.ByteString
-          getValueTypeBytes() {
-        java.lang.Object ref = valueType_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b =
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          valueType_ = b;
-          return b;
+      public Builder mergeInstanceIdentifierValue(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+        if (instanceIdentifierValueBuilder_ == null) {
+          if (((bitField0_ & 0x00000200) == 0x00000200) &&
+              instanceIdentifierValue_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+            instanceIdentifierValue_ =
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierValue_).mergeFrom(value).buildPartial();
+          } else {
+            instanceIdentifierValue_ = value;
+          }
+          onChanged();
         } else {
-          return (com.google.protobuf.ByteString) ref;
+          instanceIdentifierValueBuilder_.mergeFrom(value);
         }
+        bitField0_ |= 0x00000200;
+        return this;
       }
       /**
-       * <code>optional string valueType = 6;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 10;</code>
+       *
+       * <pre>
+       * Specific values
+       * </pre>
        */
-      public Builder setValueType(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000020;
-        valueType_ = value;
-        onChanged();
+      public Builder clearInstanceIdentifierValue() {
+        if (instanceIdentifierValueBuilder_ == null) {
+          instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+          onChanged();
+        } else {
+          instanceIdentifierValueBuilder_.clear();
+        }
+        bitField0_ = (bitField0_ & ~0x00000200);
         return this;
       }
       /**
-       * <code>optional string valueType = 6;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 10;</code>
+       *
+       * <pre>
+       * Specific values
+       * </pre>
        */
-      public Builder clearValueType() {
-        bitField0_ = (bitField0_ & ~0x00000020);
-        valueType_ = getDefaultInstance().getValueType();
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierValueBuilder() {
+        bitField0_ |= 0x00000200;
         onChanged();
-        return this;
+        return getInstanceIdentifierValueFieldBuilder().getBuilder();
       }
       /**
-       * <code>optional string valueType = 6;</code>
+       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 10;</code>
+       *
+       * <pre>
+       * Specific values
+       * </pre>
        */
-      public Builder setValueTypeBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  bitField0_ |= 0x00000020;
-        valueType_ = value;
-        onChanged();
-        return this;
+      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder() {
+        if (instanceIdentifierValueBuilder_ != null) {
+          return instanceIdentifierValueBuilder_.getMessageOrBuilder();
+        } else {
+          return instanceIdentifierValue_;
+        }
+      }
+      /**
+       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 10;</code>
+       *
+       * <pre>
+       * Specific values
+       * </pre>
+       */
+      private com.google.protobuf.SingleFieldBuilder<
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+          getInstanceIdentifierValueFieldBuilder() {
+        if (instanceIdentifierValueBuilder_ == null) {
+          instanceIdentifierValueBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+                  instanceIdentifierValue_,
+                  getParentForChildren(),
+                  isClean());
+          instanceIdentifierValue_ = null;
+        }
+        return instanceIdentifierValueBuilder_;
       }
 
-      // repeated string bitsValue = 7;
+      // repeated string bitsValue = 11;
       private com.google.protobuf.LazyStringList bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
       private void ensureBitsValueIsMutable() {
-        if (!((bitField0_ & 0x00000040) == 0x00000040)) {
+        if (!((bitField0_ & 0x00000400) == 0x00000400)) {
           bitsValue_ = new com.google.protobuf.LazyStringArrayList(bitsValue_);
-          bitField0_ |= 0x00000040;
+          bitField0_ |= 0x00000400;
          }
       }
       /**
-       * <code>repeated string bitsValue = 7;</code>
+       * <code>repeated string bitsValue = 11;</code>
+       *
+       * <pre>
+       * intValueType = Bits
+       * </pre>
        */
       public java.util.List<java.lang.String>
           getBitsValueList() {
         return java.util.Collections.unmodifiableList(bitsValue_);
       }
       /**
-       * <code>repeated string bitsValue = 7;</code>
+       * <code>repeated string bitsValue = 11;</code>
+       *
+       * <pre>
+       * intValueType = Bits
+       * </pre>
        */
       public int getBitsValueCount() {
         return bitsValue_.size();
       }
       /**
-       * <code>repeated string bitsValue = 7;</code>
+       * <code>repeated string bitsValue = 11;</code>
+       *
+       * <pre>
+       * intValueType = Bits
+       * </pre>
        */
       public java.lang.String getBitsValue(int index) {
         return bitsValue_.get(index);
       }
       /**
-       * <code>repeated string bitsValue = 7;</code>
+       * <code>repeated string bitsValue = 11;</code>
+       *
+       * <pre>
+       * intValueType = Bits
+       * </pre>
        */
       public com.google.protobuf.ByteString
           getBitsValueBytes(int index) {
         return bitsValue_.getByteString(index);
       }
       /**
-       * <code>repeated string bitsValue = 7;</code>
+       * <code>repeated string bitsValue = 11;</code>
+       *
+       * <pre>
+       * intValueType = Bits
+       * </pre>
        */
       public Builder setBitsValue(
           int index, java.lang.String value) {
@@ -5128,7 +7633,11 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated string bitsValue = 7;</code>
+       * <code>repeated string bitsValue = 11;</code>
+       *
+       * <pre>
+       * intValueType = Bits
+       * </pre>
        */
       public Builder addBitsValue(
           java.lang.String value) {
@@ -5141,7 +7650,11 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated string bitsValue = 7;</code>
+       * <code>repeated string bitsValue = 11;</code>
+       *
+       * <pre>
+       * intValueType = Bits
+       * </pre>
        */
       public Builder addAllBitsValue(
           java.lang.Iterable<java.lang.String> values) {
@@ -5151,16 +7664,24 @@ public final class NormalizedNodeMessages {
         return this;
       }
       /**
-       * <code>repeated string bitsValue = 7;</code>
+       * <code>repeated string bitsValue = 11;</code>
+       *
+       * <pre>
+       * intValueType = Bits
+       * </pre>
        */
       public Builder clearBitsValue() {
         bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-        bitField0_ = (bitField0_ & ~0x00000040);
+        bitField0_ = (bitField0_ & ~0x00000400);
         onChanged();
         return this;
       }
       /**
-       * <code>repeated string bitsValue = 7;</code>
+       * <code>repeated string bitsValue = 11;</code>
+       *
+       * <pre>
+       * intValueType = Bits
+       * </pre>
        */
       public Builder addBitsValueBytes(
           com.google.protobuf.ByteString value) {
@@ -5173,121 +7694,133 @@ public final class NormalizedNodeMessages {
         return this;
       }
 
-      // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;
-      private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
-      private com.google.protobuf.SingleFieldBuilder<
-          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierValueBuilder_;
+      // repeated string code = 12;
+      private com.google.protobuf.LazyStringList code_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+      private void ensureCodeIsMutable() {
+        if (!((bitField0_ & 0x00000800) == 0x00000800)) {
+          code_ = new com.google.protobuf.LazyStringArrayList(code_);
+          bitField0_ |= 0x00000800;
+         }
+      }
       /**
-       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+       * <code>repeated string code = 12;</code>
+       *
+       * <pre>
+       * A list of string codes which can be used for any repeated strings in the NormalizedNode
+       * </pre>
        */
-      public boolean hasInstanceIdentifierValue() {
-        return ((bitField0_ & 0x00000080) == 0x00000080);
+      public java.util.List<java.lang.String>
+          getCodeList() {
+        return java.util.Collections.unmodifiableList(code_);
       }
       /**
-       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+       * <code>repeated string code = 12;</code>
+       *
+       * <pre>
+       * A list of string codes which can be used for any repeated strings in the NormalizedNode
+       * </pre>
        */
-      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue() {
-        if (instanceIdentifierValueBuilder_ == null) {
-          return instanceIdentifierValue_;
-        } else {
-          return instanceIdentifierValueBuilder_.getMessage();
-        }
+      public int getCodeCount() {
+        return code_.size();
       }
       /**
-       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+       * <code>repeated string code = 12;</code>
+       *
+       * <pre>
+       * A list of string codes which can be used for any repeated strings in the NormalizedNode
+       * </pre>
        */
-      public Builder setInstanceIdentifierValue(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
-        if (instanceIdentifierValueBuilder_ == null) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          instanceIdentifierValue_ = value;
-          onChanged();
-        } else {
-          instanceIdentifierValueBuilder_.setMessage(value);
-        }
-        bitField0_ |= 0x00000080;
-        return this;
+      public java.lang.String getCode(int index) {
+        return code_.get(index);
       }
       /**
-       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+       * <code>repeated string code = 12;</code>
+       *
+       * <pre>
+       * A list of string codes which can be used for any repeated strings in the NormalizedNode
+       * </pre>
        */
-      public Builder setInstanceIdentifierValue(
-          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
-        if (instanceIdentifierValueBuilder_ == null) {
-          instanceIdentifierValue_ = builderForValue.build();
-          onChanged();
-        } else {
-          instanceIdentifierValueBuilder_.setMessage(builderForValue.build());
-        }
-        bitField0_ |= 0x00000080;
-        return this;
+      public com.google.protobuf.ByteString
+          getCodeBytes(int index) {
+        return code_.getByteString(index);
       }
       /**
-       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+       * <code>repeated string code = 12;</code>
+       *
+       * <pre>
+       * A list of string codes which can be used for any repeated strings in the NormalizedNode
+       * </pre>
        */
-      public Builder mergeInstanceIdentifierValue(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
-        if (instanceIdentifierValueBuilder_ == null) {
-          if (((bitField0_ & 0x00000080) == 0x00000080) &&
-              instanceIdentifierValue_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
-            instanceIdentifierValue_ =
-              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierValue_).mergeFrom(value).buildPartial();
-          } else {
-            instanceIdentifierValue_ = value;
-          }
-          onChanged();
-        } else {
-          instanceIdentifierValueBuilder_.mergeFrom(value);
-        }
-        bitField0_ |= 0x00000080;
+      public Builder setCode(
+          int index, java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  ensureCodeIsMutable();
+        code_.set(index, value);
+        onChanged();
         return this;
       }
       /**
-       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+       * <code>repeated string code = 12;</code>
+       *
+       * <pre>
+       * A list of string codes which can be used for any repeated strings in the NormalizedNode
+       * </pre>
        */
-      public Builder clearInstanceIdentifierValue() {
-        if (instanceIdentifierValueBuilder_ == null) {
-          instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
-          onChanged();
-        } else {
-          instanceIdentifierValueBuilder_.clear();
-        }
-        bitField0_ = (bitField0_ & ~0x00000080);
+      public Builder addCode(
+          java.lang.String value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  ensureCodeIsMutable();
+        code_.add(value);
+        onChanged();
         return this;
       }
       /**
-       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+       * <code>repeated string code = 12;</code>
+       *
+       * <pre>
+       * A list of string codes which can be used for any repeated strings in the NormalizedNode
+       * </pre>
        */
-      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierValueBuilder() {
-        bitField0_ |= 0x00000080;
+      public Builder addAllCode(
+          java.lang.Iterable<java.lang.String> values) {
+        ensureCodeIsMutable();
+        super.addAll(values, code_);
         onChanged();
-        return getInstanceIdentifierValueFieldBuilder().getBuilder();
+        return this;
       }
       /**
-       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+       * <code>repeated string code = 12;</code>
+       *
+       * <pre>
+       * A list of string codes which can be used for any repeated strings in the NormalizedNode
+       * </pre>
        */
-      public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder() {
-        if (instanceIdentifierValueBuilder_ != null) {
-          return instanceIdentifierValueBuilder_.getMessageOrBuilder();
-        } else {
-          return instanceIdentifierValue_;
-        }
+      public Builder clearCode() {
+        code_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+        bitField0_ = (bitField0_ & ~0x00000800);
+        onChanged();
+        return this;
       }
       /**
-       * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
+       * <code>repeated string code = 12;</code>
+       *
+       * <pre>
+       * A list of string codes which can be used for any repeated strings in the NormalizedNode
+       * </pre>
        */
-      private com.google.protobuf.SingleFieldBuilder<
-          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
-          getInstanceIdentifierValueFieldBuilder() {
-        if (instanceIdentifierValueBuilder_ == null) {
-          instanceIdentifierValueBuilder_ = new com.google.protobuf.SingleFieldBuilder<
-              org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
-                  instanceIdentifierValue_,
-                  getParentForChildren(),
-                  isClean());
-          instanceIdentifierValue_ = null;
-        }
-        return instanceIdentifierValueBuilder_;
+      public Builder addCodeBytes(
+          com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  ensureCodeIsMutable();
+        code_.add(value);
+        onChanged();
+        return this;
       }
 
       // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.Node)
@@ -7402,6 +9935,11 @@ public final class NormalizedNodeMessages {
   private static
     com.google.protobuf.GeneratedMessage.FieldAccessorTable
       internal_static_org_opendaylight_controller_mdsal_Attribute_fieldAccessorTable;
+  private static com.google.protobuf.Descriptors.Descriptor
+    internal_static_org_opendaylight_controller_mdsal_PathArgumentAttribute_descriptor;
+  private static
+    com.google.protobuf.GeneratedMessage.FieldAccessorTable
+      internal_static_org_opendaylight_controller_mdsal_PathArgumentAttribute_fieldAccessorTable;
   private static com.google.protobuf.Descriptors.Descriptor
     internal_static_org_opendaylight_controller_mdsal_QName_descriptor;
   private static
@@ -7448,32 +9986,42 @@ public final class NormalizedNodeMessages {
     java.lang.String[] descriptorData = {
       "\n\014Common.proto\022!org.opendaylight.control" +
       "ler.mdsal\"6\n\tAttribute\022\014\n\004name\030\001 \002(\t\022\r\n\005" +
-      "value\030\002 \001(\t\022\014\n\004type\030\003 \001(\t\"\026\n\005QName\022\r\n\005va" +
-      "lue\030\001 \002(\t\"\251\001\n\014PathArgument\022\r\n\005value\030\001 \002(" +
-      "\t\022\014\n\004type\030\002 \001(\t\022:\n\010nodeType\030\003 \001(\0132(.org." +
-      "opendaylight.controller.mdsal.QName\022@\n\na" +
-      "ttributes\030\004 \003(\0132,.org.opendaylight.contr" +
-      "oller.mdsal.Attribute\"X\n\022InstanceIdentif" +
-      "ier\022B\n\targuments\030\001 \003(\0132/.org.opendayligh" +
-      "t.controller.mdsal.PathArgument\"\251\002\n\004Node",
-      "\022\014\n\004path\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022@\n\nattribut" +
-      "es\030\003 \003(\0132,.org.opendaylight.controller.m" +
-      "dsal.Attribute\0226\n\005child\030\004 \003(\0132\'.org.open" +
-      "daylight.controller.mdsal.Node\022\r\n\005value\030" +
-      "\005 \001(\t\022\021\n\tvalueType\030\006 \001(\t\022\021\n\tbitsValue\030\007 " +
-      "\003(\t\022V\n\027instanceIdentifierValue\030\010 \001(\01325.o" +
-      "rg.opendaylight.controller.mdsal.Instanc" +
-      "eIdentifier\"`\n\tContainer\022\022\n\nparentPath\030\001" +
-      " \002(\t\022?\n\016normalizedNode\030\002 \001(\0132\'.org.opend" +
-      "aylight.controller.mdsal.Node\"\246\001\n\014NodeMa",
-      "pEntry\022U\n\026instanceIdentifierPath\030\001 \002(\01325" +
-      ".org.opendaylight.controller.mdsal.Insta" +
-      "nceIdentifier\022?\n\016normalizedNode\030\002 \001(\0132\'." +
-      "org.opendaylight.controller.mdsal.Node\"N" +
-      "\n\007NodeMap\022C\n\nmapEntries\030\001 \003(\0132/.org.open" +
-      "daylight.controller.mdsal.NodeMapEntryBO" +
-      "\n5org.opendaylight.controller.protobuff." +
-      "messages.commonB\026NormalizedNodeMessages"
+      "value\030\002 \001(\t\022\014\n\004type\030\003 \001(\t\"l\n\025PathArgumen" +
+      "tAttribute\0226\n\004name\030\001 \001(\0132(.org.opendayli" +
+      "ght.controller.mdsal.QName\022\r\n\005value\030\002 \001(" +
+      "\t\022\014\n\004type\030\003 \001(\005\"N\n\005QName\022\r\n\005value\030\001 \001(\t\022" +
+      "\021\n\tnamespace\030\002 \001(\005\022\020\n\010revision\030\003 \001(\005\022\021\n\t" +
+      "localName\030\004 \001(\005\"\207\002\n\014PathArgument\022\r\n\005valu" +
+      "e\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022:\n\010nodeType\030\003 \001(\0132" +
+      "(.org.opendaylight.controller.mdsal.QNam",
+      "e\022K\n\tattribute\030\004 \003(\01328.org.opendaylight." +
+      "controller.mdsal.PathArgumentAttribute\022@" +
+      "\n\nattributes\030\005 \003(\0132,.org.opendaylight.co" +
+      "ntroller.mdsal.Attribute\022\017\n\007intType\030\006 \001(" +
+      "\005\"X\n\022InstanceIdentifier\022B\n\targuments\030\001 \003" +
+      "(\0132/.org.opendaylight.controller.mdsal.P" +
+      "athArgument\"\245\003\n\004Node\022\014\n\004path\030\001 \001(\t\022\014\n\004ty" +
+      "pe\030\002 \001(\t\022E\n\014pathArgument\030\003 \001(\0132/.org.ope" +
+      "ndaylight.controller.mdsal.PathArgument\022" +
+      "\017\n\007intType\030\004 \001(\005\022@\n\nattributes\030\005 \003(\0132,.o",
+      "rg.opendaylight.controller.mdsal.Attribu" +
+      "te\0226\n\005child\030\006 \003(\0132\'.org.opendaylight.con" +
+      "troller.mdsal.Node\022\r\n\005value\030\007 \001(\t\022\021\n\tval" +
+      "ueType\030\010 \001(\t\022\024\n\014intValueType\030\t \001(\005\022V\n\027in" +
+      "stanceIdentifierValue\030\n \001(\01325.org.openda" +
+      "ylight.controller.mdsal.InstanceIdentifi" +
+      "er\022\021\n\tbitsValue\030\013 \003(\t\022\014\n\004code\030\014 \003(\t\"`\n\tC" +
+      "ontainer\022\022\n\nparentPath\030\001 \002(\t\022?\n\016normaliz" +
+      "edNode\030\002 \001(\0132\'.org.opendaylight.controll" +
+      "er.mdsal.Node\"\246\001\n\014NodeMapEntry\022U\n\026instan",
+      "ceIdentifierPath\030\001 \002(\01325.org.opendayligh" +
+      "t.controller.mdsal.InstanceIdentifier\022?\n" +
+      "\016normalizedNode\030\002 \001(\0132\'.org.opendaylight" +
+      ".controller.mdsal.Node\"N\n\007NodeMap\022C\n\nmap" +
+      "Entries\030\001 \003(\0132/.org.opendaylight.control" +
+      "ler.mdsal.NodeMapEntryBO\n5org.opendaylig" +
+      "ht.controller.protobuff.messages.commonB" +
+      "\026NormalizedNodeMessages"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -7486,44 +10034,50 @@ public final class NormalizedNodeMessages {
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_org_opendaylight_controller_mdsal_Attribute_descriptor,
               new java.lang.String[] { "Name", "Value", "Type", });
-          internal_static_org_opendaylight_controller_mdsal_QName_descriptor =
+          internal_static_org_opendaylight_controller_mdsal_PathArgumentAttribute_descriptor =
             getDescriptor().getMessageTypes().get(1);
+          internal_static_org_opendaylight_controller_mdsal_PathArgumentAttribute_fieldAccessorTable = new
+            com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+              internal_static_org_opendaylight_controller_mdsal_PathArgumentAttribute_descriptor,
+              new java.lang.String[] { "Name", "Value", "Type", });
+          internal_static_org_opendaylight_controller_mdsal_QName_descriptor =
+            getDescriptor().getMessageTypes().get(2);
           internal_static_org_opendaylight_controller_mdsal_QName_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_org_opendaylight_controller_mdsal_QName_descriptor,
-              new java.lang.String[] { "Value", });
+              new java.lang.String[] { "Value", "Namespace", "Revision", "LocalName", });
           internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor =
-            getDescriptor().getMessageTypes().get(2);
+            getDescriptor().getMessageTypes().get(3);
           internal_static_org_opendaylight_controller_mdsal_PathArgument_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor,
-              new java.lang.String[] { "Value", "Type", "NodeType", "Attributes", });
+              new java.lang.String[] { "Value", "Type", "NodeType", "Attribute", "Attributes", "IntType", });
           internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor =
-            getDescriptor().getMessageTypes().get(3);
+            getDescriptor().getMessageTypes().get(4);
           internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor,
               new java.lang.String[] { "Arguments", });
           internal_static_org_opendaylight_controller_mdsal_Node_descriptor =
-            getDescriptor().getMessageTypes().get(4);
+            getDescriptor().getMessageTypes().get(5);
           internal_static_org_opendaylight_controller_mdsal_Node_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_org_opendaylight_controller_mdsal_Node_descriptor,
-              new java.lang.String[] { "Path", "Type", "Attributes", "Child", "Value", "ValueType", "BitsValue", "InstanceIdentifierValue", });
+              new java.lang.String[] { "Path", "Type", "PathArgument", "IntType", "Attributes", "Child", "Value", "ValueType", "IntValueType", "InstanceIdentifierValue", "BitsValue", "Code", });
           internal_static_org_opendaylight_controller_mdsal_Container_descriptor =
-            getDescriptor().getMessageTypes().get(5);
+            getDescriptor().getMessageTypes().get(6);
           internal_static_org_opendaylight_controller_mdsal_Container_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_org_opendaylight_controller_mdsal_Container_descriptor,
               new java.lang.String[] { "ParentPath", "NormalizedNode", });
           internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor =
-            getDescriptor().getMessageTypes().get(6);
+            getDescriptor().getMessageTypes().get(7);
           internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor,
               new java.lang.String[] { "InstanceIdentifierPath", "NormalizedNode", });
           internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor =
-            getDescriptor().getMessageTypes().get(7);
+            getDescriptor().getMessageTypes().get(8);
           internal_static_org_opendaylight_controller_mdsal_NodeMap_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor,
index d354348da8fb3ade21939c7be442d859479640f0..fcf1f45bc26d5216ab8e06c4105e38d312bd1a73 100644 (file)
@@ -1640,7 +1640,7 @@ public final class PersistentMessages {
       .internalBuildGeneratedFileFrom(descriptorData,
         new com.google.protobuf.Descriptors.FileDescriptor[] {
           org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.getDescriptor(),
-          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.getDescriptor(),
+          org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.getDescriptor(),
         }, assigner);
   }
 
index ca578a88aad2ae6c0155a98bd949de2e09d1fa44..5a9cb9d3245f6de808a9db0596810706cb2604e0 100644 (file)
@@ -15,7 +15,7 @@ public final class CompositeModificationPayload {
    */
   public static final
     com.google.protobuf.GeneratedMessage.GeneratedExtension<
-      org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
+      org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.AppendEntries.ReplicatedLogEntry.Payload,
       org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification> modification = com.google.protobuf.GeneratedMessage
           .newFileScopedGeneratedExtension(
         org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.class,
@@ -51,7 +51,7 @@ public final class CompositeModificationPayload {
     com.google.protobuf.Descriptors.FileDescriptor
       .internalBuildGeneratedFileFrom(descriptorData,
         new com.google.protobuf.Descriptors.FileDescriptor[] {
-          org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages.getDescriptor(),
+          org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages.getDescriptor(),
           org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.getDescriptor(),
           org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.getDescriptor(),
         }, assigner);
index bdd66d3aba25e4766960ed0611362cf813d5360c..ded80713fb3feba577065da17410d3408786046e 100644 (file)
@@ -6945,11 +6945,11 @@ public final class ShardTransactionMessages {
 
       public final boolean isInitialized() {
         if (!hasInstanceIdentifierPathArguments()) {
-          
+
           return false;
         }
         if (!getInstanceIdentifierPathArguments().isInitialized()) {
-          
+
           return false;
         }
         return true;
@@ -7078,7 +7078,7 @@ public final class ShardTransactionMessages {
        * <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
        */
       private com.google.protobuf.SingleFieldBuilder<
-          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> 
+          org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
           getInstanceIdentifierPathArgumentsFieldBuilder() {
         if (instanceIdentifierPathArgumentsBuilder_ == null) {
           instanceIdentifierPathArgumentsBuilder_ = new com.google.protobuf.SingleFieldBuilder<
@@ -7437,7 +7437,7 @@ public final class ShardTransactionMessages {
 
       public final boolean isInitialized() {
         if (!hasExists()) {
-          
+
           return false;
         }
         return true;
similarity index 88%
rename from opendaylight/md-sal/sal-akka-raft/src/main/resources/AppendEntriesMessages.proto
rename to opendaylight/md-sal/sal-clustering-commons/src/main/resources/AppendEntriesMessages.proto
index ab591ea0797fdd92e94c435562a4aecc40179856..4df56ff79dcf1791abc9838d828eaa62f7932861 100644 (file)
@@ -1,6 +1,6 @@
 package org.opendaylight.controller.cluster.raft;
 
-option java_package = "org.opendaylight.controller.cluster.raft.protobuff.messages";
+option java_package = "org.opendaylight.controller.protobuff.messages.cluster.raft";
 option java_outer_classname = "AppendEntriesMessages";
 option optimize_for = SPEED;
 
index 59d78dd04d483c8157d142a7bc7a04958e55db25..0b3ff21eb78737aa58450db900f5877b217718b1 100644 (file)
@@ -10,16 +10,29 @@ message Attribute{
   optional string type=3;
 }
 
+message PathArgumentAttribute{
+    optional QName name =1;
+    optional string value=2;
+    optional int32 type=3;
+}
+
+
 message QName {
-    required string value=1;
+    optional string value=1; // @deprecated
+    optional int32 namespace=2;
+    optional int32 revision=3;
+    optional int32 localName=4;
 }
 
 message PathArgument {
-  required string value=1;
-  optional string type=2; //NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+  optional string value=1; // @deprecated
+  optional string type=2; // @deprecated
+
   optional QName nodeType=3;
-  repeated Attribute attributes=4;
 
+  repeated PathArgumentAttribute attribute=4;
+  repeated Attribute attributes=5; // @deprecated For backward compatibility (see InstanceIdentifierUtils)
+  optional int32 intType = 6;
 }
 
 message InstanceIdentifier {
@@ -27,14 +40,24 @@ message InstanceIdentifier {
 }
 
 message Node{
-  optional string path = 1;
-  optional string type = 2;
-  repeated Attribute attributes = 3;
-  repeated Node child=4;
-  optional string value = 5;
-  optional string valueType = 6;
-  repeated string bitsValue = 7;
-  optional InstanceIdentifier instanceIdentifierValue = 8;
+  optional string path = 1; // @deprecated(use pathArgument)
+  optional string type = 2; // @deprecated(use intType)
+  optional PathArgument pathArgument = 3;
+  optional int32 intType = 4;
+
+  repeated Attribute attributes = 5;
+
+  repeated Node child = 6;
+
+  optional string value = 7;
+  optional string valueType = 8; // @deprecated(use intValueType)
+  optional int32 intValueType = 9; // instead of valueType
+
+  // Specific values
+  optional InstanceIdentifier instanceIdentifierValue = 10; // intValueType = YangInstanceIdentifier
+  repeated string bitsValue = 11; // intValueType = Bits
+
+  repeated string code = 12; // A list of string codes which can be used for any repeated strings in the NormalizedNode
 }
 
 message Container{
similarity index 79%
rename from opendaylight/md-sal/sal-akka-raft/src/main/resources/KeyValueMessages.proto
rename to opendaylight/md-sal/sal-clustering-commons/src/main/resources/KeyValueMessages.proto
index 7ee0b215eeb1a0ac2b3bee44b46c2dd24ca89e05..8dc790b3dd3a9e331a83b01ba87bfd8c5d00e3fb 100644 (file)
@@ -2,7 +2,7 @@ package org.opendaylight.controller.cluster.raft;
 
 import "AppendEntriesMessages.proto";
 
-option java_package = "org.opendaylight.controller.cluster.example.protobuff.messages";
+option java_package = "org.opendaylight.controller.protobuff.messages.cluster.example";
 option java_outer_classname = "KeyValueMessages";
 option optimize_for = SPEED;
 
similarity index 54%
rename from opendaylight/md-sal/sal-akka-raft/src/test/resources/MockPayload.proto
rename to opendaylight/md-sal/sal-clustering-commons/src/main/resources/MockPayload.proto
index 0e0c6044891e931f541b917480f90e3920f957f1..ce29db4e3f28a2f302890099dde1a8a2a486a3ff 100644 (file)
@@ -1,8 +1,8 @@
 import "AppendEntriesMessages.proto";
 
-package org.opendaylight.controller.cluster.raft;
+package org.opendaylight.controller.cluster.raft.test;
 
-option java_package = "org.opendaylight.controller.cluster.raft.protobuff.messages";
+option java_package = "org.opendaylight.controller.protobuff.messages.cluster.raft.test";
 option java_outer_classname = "MockPayloadMessages";
 
 extend AppendEntries.ReplicatedLogEntry.Payload {
index c42865c659192e0584ebe93a147fee655ab284c4..a9f9c722deefd942f3259fea3f05a929d42aa827 100644 (file)
 
 package org.opendaylight.controller.cluster.datastore.node;
 
-import junit.framework.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeGetter;
 import org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeNavigator;
 import org.opendaylight.controller.cluster.datastore.node.utils.PathUtils;
+import org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeSerializer;
 import org.opendaylight.controller.cluster.datastore.util.TestModel;
 import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container;
 import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node;
@@ -28,6 +28,7 @@ import java.util.List;
 
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 public class NormalizedNodeToNodeCodecTest {
 
@@ -74,7 +75,8 @@ public class NormalizedNodeToNodeCodecTest {
 
     assertNotNull(container);
     assertEquals(id, container.getParentPath() + "/"
-        + container.getNormalizedNode().getPath());
+        + NormalizedNodeSerializer.deSerialize(container.getNormalizedNode(),
+        container.getNormalizedNode().getPathArgument()));
 
     // Decode the normalized node from the ProtocolBuffer form
     // first get the node representation of normalized node
@@ -109,7 +111,7 @@ public class NormalizedNodeToNodeCodecTest {
             .decode(
                 instanceIdentifierFromString("/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test"),
                 container.getNormalizedNode());
-    assertNotNull(decode != null);
+    assertNotNull(decode);
 
     // let us ensure that the return decode normalized node encode returns same container
     Container containerResult =
@@ -117,10 +119,8 @@ public class NormalizedNodeToNodeCodecTest {
             .build(), decode);
 
     assertEquals(container.getParentPath(), containerResult.getParentPath());
-    assertEquals(container.getNormalizedNode().getChildCount(), container
-        .getNormalizedNode().getChildCount());
 
-    Assert.assertEquals(containerResult.getNormalizedNode().getChildCount(),
+    assertEquals(containerResult.getNormalizedNode().getChildCount(),
         container.getNormalizedNode().getChildCount());
 
     // check first level children are proper
@@ -140,13 +140,22 @@ public class NormalizedNodeToNodeCodecTest {
     for (Node resultChild : childrenResult) {
       bFound = false;
       for (Node originalChild : childrenOriginal) {
-        if (originalChild.getPath().equals(resultChild.getPath())
-            && resultChild.getType().equals(resultChild.getType())) {
+
+        YangInstanceIdentifier.PathArgument result = NormalizedNodeSerializer.deSerialize(
+              containerResult.getNormalizedNode(),
+              resultChild.getPathArgument());
+
+          YangInstanceIdentifier.PathArgument original = NormalizedNodeSerializer.deSerialize(
+              container.getNormalizedNode(),
+              originalChild.getPathArgument());
+
+        if (original.equals(result)
+            && resultChild.getIntType() == resultChild.getIntType()) {
           bFound = true;
           break;
         }
       }
-      Assert.assertTrue(bFound);
+      assertTrue(bFound);
     }
 
   }
diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeSerializerTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/NormalizedNodeSerializerTest.java
new file mode 100644 (file)
index 0000000..cdb2e69
--- /dev/null
@@ -0,0 +1,127 @@
+package org.opendaylight.controller.cluster.datastore.node.utils.serialization;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.opendaylight.controller.cluster.datastore.util.TestModel;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class NormalizedNodeSerializerTest {
+
+    @Rule
+    public ExpectedException expectedException = ExpectedException.none();
+
+    @Test
+    public void testSerializeDeSerialize(){
+
+        // This test basically serializes and deSerializes a largish document
+        // which contains most of the types of nodes that go into a normalized
+        // node and uses several value types as well. It is in general a good
+        // sanity test which could be augmented with specific unit tests.
+
+        long start = System.nanoTime();
+
+        NormalizedNode<?, ?> expectedNode =
+            TestModel.createDocumentOne(TestModel.createTestContext());
+
+        NormalizedNodeMessages.Node expected = NormalizedNodeSerializer
+            .serialize(expectedNode);
+
+        System.out.println("Serialize Time = " + (System.nanoTime() - start)/1000000);
+
+        System.out.println("Serialized Size = " + expected.getSerializedSize());
+
+        System.out.println(expected.toString());
+
+        start = System.nanoTime();
+
+        NormalizedNode actualNode =
+            NormalizedNodeSerializer.deSerialize(expected);
+
+        System.out.println("DeSerialize Time = " + (System.nanoTime() - start)/1000000);
+
+        // Compare the original normalized node to the normalized node that was
+        // created by serializing the original node and deSerializing it back.
+        assertEquals(expectedNode, actualNode);
+
+    }
+
+    @Test(expected = NullPointerException.class)
+    public void testSerializeNullNormalizedNode(){
+        assertNotNull(NormalizedNodeSerializer.serialize(null));
+    }
+
+    @Test
+    public void testDeSerializeNullProtocolBufferNode(){
+        expectedException.expect(NullPointerException.class);
+        expectedException.expectMessage("node should not be null");
+
+        NormalizedNodeSerializer.deSerialize(null);
+    }
+
+    @Test
+    public void testDeSerializePathArgumentNullNode(){
+        expectedException.expect(NullPointerException.class);
+        expectedException.expectMessage("node should not be null");
+
+        NormalizedNodeSerializer
+            .deSerialize(null, NormalizedNodeMessages.PathArgument.getDefaultInstance());
+    }
+
+    @Test
+    public void testDeSerializePathArgumentNullPathArgument(){
+        expectedException.expect(NullPointerException.class);
+        expectedException.expectMessage("pathArgument should not be null");
+
+        NormalizedNodeSerializer.deSerialize(NormalizedNodeMessages.Node.getDefaultInstance() , null);
+    }
+
+    @Test
+    public void testDeSerializePathArgument(){
+
+        NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
+
+        nodeBuilder.addCode("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test1");
+        nodeBuilder.addCode("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test");
+
+
+        nodeBuilder.addCode("2014-04-13");
+        nodeBuilder.addCode("2014-05-13");
+        nodeBuilder.addCode("2014-03-13");
+
+        nodeBuilder.addCode("dummy1");
+        nodeBuilder.addCode("dummy2");
+        nodeBuilder.addCode("dummy3");
+        nodeBuilder.addCode("capability");
+
+
+
+        NormalizedNodeMessages.PathArgument.Builder pathBuilder = NormalizedNodeMessages.PathArgument.newBuilder();
+
+        pathBuilder.setIntType(PathArgumentType.NODE_IDENTIFIER.ordinal());
+
+        NormalizedNodeMessages.QName.Builder qNameBuilder = NormalizedNodeMessages.QName.newBuilder();
+        qNameBuilder.setNamespace(1);
+        qNameBuilder.setRevision(4);
+        qNameBuilder.setLocalName(8);
+
+        pathBuilder.setNodeType(qNameBuilder);
+
+        YangInstanceIdentifier.PathArgument pathArgument =
+            NormalizedNodeSerializer
+                .deSerialize(nodeBuilder.build(), pathBuilder.build());
+
+        assertNotNull(pathArgument);
+
+        assertEquals("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test", pathArgument.getNodeType().getNamespace().toString());
+        assertEquals("2014-03-13", pathArgument.getNodeType().getFormattedRevision());
+        assertEquals("capability", pathArgument.getNodeType().getLocalName());
+    }
+
+
+}
diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentSerializerTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/PathArgumentSerializerTest.java
new file mode 100644 (file)
index 0000000..d1f21ee
--- /dev/null
@@ -0,0 +1,280 @@
+package org.opendaylight.controller.cluster.datastore.node.utils.serialization;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.opendaylight.controller.cluster.datastore.util.TestModel;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+import java.net.URI;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class PathArgumentSerializerTest{
+
+    @Rule
+    public ExpectedException expectedException = ExpectedException.none();
+
+    @Test
+    public void testSerializeNullContext(){
+        expectedException.expect(NullPointerException.class);
+        expectedException.expectMessage("context should not be null");
+
+        PathArgumentSerializer.serialize(null, mock(
+            YangInstanceIdentifier.PathArgument.class));
+    }
+
+    @Test
+    public void testSerializeNullPathArgument(){
+        expectedException.expect(NullPointerException.class);
+        expectedException.expectMessage("pathArgument should not be null");
+
+        PathArgumentSerializer.serialize(mock(
+            NormalizedNodeSerializationContext.class), null);
+
+    }
+
+    @Test
+    public void testDeSerializeNullContext(){
+        expectedException.expect(NullPointerException.class);
+        expectedException.expectMessage("context should not be null");
+
+        PathArgumentSerializer.deSerialize(null, NormalizedNodeMessages.PathArgument.getDefaultInstance());
+
+    }
+
+    @Test
+    public void testDeSerializeNullPathArgument(){
+        expectedException.expect(NullPointerException.class);
+        expectedException.expectMessage("pathArgument should not be null");
+
+        PathArgumentSerializer.deSerialize(mock(NormalizedNodeDeSerializationContext.class), null);
+
+    }
+
+    @Test
+    public void testSerializeNodeIdentifier(){
+        NormalizedNodeSerializationContext serializationContext =
+            mock(NormalizedNodeSerializationContext.class);
+
+        when(serializationContext.addLocalName(anyString())).thenReturn(5);
+        when(serializationContext.addNamespace(any(URI.class))).thenReturn(10);
+        when(serializationContext.addRevision(any(Date.class))).thenReturn(11);
+
+        NormalizedNodeMessages.PathArgument actual = PathArgumentSerializer
+            .serialize(serializationContext,
+                new YangInstanceIdentifier.NodeIdentifier(
+                    TestModel.TEST_QNAME));
+
+        assertEquals(PathArgumentType.NODE_IDENTIFIER.ordinal(), actual.getIntType());
+        assertEquals(5, actual.getNodeType().getLocalName());
+        assertEquals(10, actual.getNodeType().getNamespace());
+        assertEquals(11, actual.getNodeType().getRevision());
+
+
+    }
+
+    @Test
+    public void testSerializeNodeIdentifierWithValue(){
+        NormalizedNodeSerializationContext serializationContext =
+            mock(NormalizedNodeSerializationContext.class);
+
+        when(serializationContext.addLocalName(anyString())).thenReturn(5);
+        when(serializationContext.addNamespace(any(URI.class))).thenReturn(10);
+        when(serializationContext.addRevision(any(Date.class))).thenReturn(11);
+
+        NormalizedNodeMessages.PathArgument actual = PathArgumentSerializer
+            .serialize(serializationContext,
+                new YangInstanceIdentifier.NodeWithValue(
+                    TestModel.TEST_QNAME, "foo"));
+
+        assertEquals(PathArgumentType.NODE_IDENTIFIER_WITH_VALUE.ordinal(), actual.getIntType());
+        assertEquals(5, actual.getNodeType().getLocalName());
+        assertEquals(10, actual.getNodeType().getNamespace());
+        assertEquals(11, actual.getNodeType().getRevision());
+        assertEquals("foo", actual.getAttribute(0).getValue());
+
+
+    }
+
+    @Test
+    public void testSerializeNodeIdentifierWithPredicates(){
+        NormalizedNodeSerializationContext serializationContext =
+            mock(NormalizedNodeSerializationContext.class);
+
+
+        when(serializationContext.addLocalName("test")).thenReturn(5);
+        when(serializationContext.addLocalName("child-name")).thenReturn(55);
+
+        when(serializationContext.addNamespace(TestModel.TEST_QNAME.getNamespace())).thenReturn(
+            10);
+        when(serializationContext.addNamespace(TestModel.CHILD_NAME_QNAME.getNamespace())).thenReturn(66);
+
+        when(serializationContext.addRevision(TestModel.TEST_QNAME.getRevision())).thenReturn(
+            11);
+        when(serializationContext.addRevision(TestModel.CHILD_NAME_QNAME.getRevision())).thenReturn(77);
+
+        Map<QName, Object> predicates = new HashMap<>();
+
+        predicates.put(TestModel.CHILD_NAME_QNAME, "foobar");
+
+        NormalizedNodeMessages.PathArgument actual = PathArgumentSerializer
+            .serialize(serializationContext,
+                new YangInstanceIdentifier.NodeIdentifierWithPredicates(
+                    TestModel.TEST_QNAME, predicates));
+
+        assertEquals(PathArgumentType.NODE_IDENTIFIER_WITH_PREDICATES.ordinal(), actual.getIntType());
+        assertEquals(5, actual.getNodeType().getLocalName());
+        assertEquals(10, actual.getNodeType().getNamespace());
+        assertEquals(11, actual.getNodeType().getRevision());
+
+        assertEquals(55, actual.getAttribute(0).getName().getLocalName());
+        assertEquals(66, actual.getAttribute(0).getName().getNamespace());
+        assertEquals(77, actual.getAttribute(0).getName().getRevision());
+
+        assertEquals("foobar", actual.getAttribute(0).getValue());
+
+
+    }
+
+    @Test
+    public void testSerializeAugmentationIdentifier(){
+        NormalizedNodeSerializationContext serializationContext =
+            mock(NormalizedNodeSerializationContext.class);
+
+        when(serializationContext.addLocalName(anyString())).thenReturn(55);
+        when(serializationContext.addNamespace(any(URI.class))).thenReturn(66);
+        when(serializationContext.addRevision(any(Date.class))).thenReturn(77);
+
+        NormalizedNodeMessages.PathArgument actual = PathArgumentSerializer
+            .serialize(serializationContext,
+                new YangInstanceIdentifier.AugmentationIdentifier(
+                    ImmutableSet.of(TestModel.TEST_QNAME)));
+
+        assertEquals(PathArgumentType.AUGMENTATION_IDENTIFIER.ordinal(), actual.getIntType());
+
+        assertEquals(55, actual.getAttribute(0).getName().getLocalName());
+        assertEquals(66, actual.getAttribute(0).getName().getNamespace());
+        assertEquals(77, actual.getAttribute(0).getName().getRevision());
+
+    }
+
+    @Test
+    public void testDeSerializeNodeIdentifier(){
+
+        NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
+        NormalizedNodeMessages.PathArgument.Builder pathBuilder = NormalizedNodeMessages.PathArgument.newBuilder();
+        NormalizedNodeMessages.QName.Builder qNameBuilder = NormalizedNodeMessages.QName.newBuilder();
+
+        qNameBuilder.setNamespace(0);
+        qNameBuilder.setRevision(1);
+        qNameBuilder.setLocalName(2);
+
+        pathBuilder.setNodeType(qNameBuilder);
+        pathBuilder.setIntType(PathArgumentType.NODE_IDENTIFIER.ordinal());
+
+        nodeBuilder.addCode(TestModel.TEST_QNAME.getNamespace().toString());
+        nodeBuilder.addCode(TestModel.TEST_QNAME.getFormattedRevision());
+        nodeBuilder.addCode(TestModel.TEST_QNAME.getLocalName());
+
+        YangInstanceIdentifier.PathArgument pathArgument =
+            NormalizedNodeSerializer
+                .deSerialize(nodeBuilder.build(), pathBuilder.build());
+
+        assertEquals(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME), pathArgument);
+
+    }
+
+    @Test
+    public void testDeSerializeNodeWithValue(){
+        NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
+        NormalizedNodeMessages.PathArgument.Builder pathBuilder = NormalizedNodeMessages.PathArgument.newBuilder();
+        NormalizedNodeMessages.QName.Builder qNameBuilder = NormalizedNodeMessages.QName.newBuilder();
+
+        qNameBuilder.setNamespace(0);
+        qNameBuilder.setRevision(1);
+        qNameBuilder.setLocalName(2);
+
+        pathBuilder.setNodeType(qNameBuilder);
+        pathBuilder.setIntType(PathArgumentType.NODE_IDENTIFIER_WITH_VALUE.ordinal());
+        pathBuilder.addAttribute(
+            NormalizedNodeMessages.PathArgumentAttribute.newBuilder()
+                .setValue("foo").setType(ValueType.STRING_TYPE.ordinal()));
+
+        nodeBuilder.addCode(TestModel.TEST_QNAME.getNamespace().toString());
+        nodeBuilder.addCode(TestModel.TEST_QNAME.getFormattedRevision());
+        nodeBuilder.addCode(TestModel.TEST_QNAME.getLocalName());
+
+        YangInstanceIdentifier.PathArgument pathArgument =
+            NormalizedNodeSerializer
+                .deSerialize(nodeBuilder.build(), pathBuilder.build());
+
+        assertEquals(new YangInstanceIdentifier.NodeWithValue(TestModel.TEST_QNAME, "foo"), pathArgument);
+
+    }
+    @Test
+    public void testDeSerializeNodeIdentifierWithPredicates(){
+        NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
+        NormalizedNodeMessages.PathArgument.Builder pathBuilder = NormalizedNodeMessages.PathArgument.newBuilder();
+        NormalizedNodeMessages.QName.Builder qNameBuilder = NormalizedNodeMessages.QName.newBuilder();
+
+        qNameBuilder.setNamespace(0);
+        qNameBuilder.setRevision(1);
+        qNameBuilder.setLocalName(2);
+
+        pathBuilder.setNodeType(qNameBuilder);
+        pathBuilder.setIntType(PathArgumentType.NODE_IDENTIFIER_WITH_PREDICATES.ordinal());
+        pathBuilder.addAttribute(NormalizedNodeMessages.PathArgumentAttribute.newBuilder().setName(qNameBuilder).setValue(
+            "foo").setType(ValueType.STRING_TYPE.ordinal()));
+
+        nodeBuilder.addCode(TestModel.TEST_QNAME.getNamespace().toString());
+        nodeBuilder.addCode(TestModel.TEST_QNAME.getFormattedRevision());
+        nodeBuilder.addCode(TestModel.TEST_QNAME.getLocalName());
+
+        YangInstanceIdentifier.PathArgument pathArgument =
+            NormalizedNodeSerializer
+                .deSerialize(nodeBuilder.build(), pathBuilder.build());
+
+        assertEquals(new YangInstanceIdentifier.NodeIdentifierWithPredicates(TestModel.TEST_QNAME,
+            ImmutableMap.<QName, Object>of(TestModel.TEST_QNAME, "foo")), pathArgument);
+
+    }
+    @Test
+    public void testDeSerializeNodeAugmentationIdentifier(){
+        NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
+        NormalizedNodeMessages.PathArgument.Builder pathBuilder = NormalizedNodeMessages.PathArgument.newBuilder();
+        NormalizedNodeMessages.QName.Builder qNameBuilder = NormalizedNodeMessages.QName.newBuilder();
+
+        qNameBuilder.setNamespace(0);
+        qNameBuilder.setRevision(1);
+        qNameBuilder.setLocalName(2);
+
+        pathBuilder.setIntType(PathArgumentType.AUGMENTATION_IDENTIFIER.ordinal());
+        pathBuilder.addAttribute(NormalizedNodeMessages.PathArgumentAttribute.newBuilder().setName(qNameBuilder).setType(ValueType.STRING_TYPE.ordinal()));
+
+        nodeBuilder.addCode(TestModel.TEST_QNAME.getNamespace().toString());
+        nodeBuilder.addCode(TestModel.TEST_QNAME.getFormattedRevision());
+        nodeBuilder.addCode(TestModel.TEST_QNAME.getLocalName());
+
+        YangInstanceIdentifier.PathArgument pathArgument =
+            NormalizedNodeSerializer
+                .deSerialize(nodeBuilder.build(), pathBuilder.build());
+
+        assertEquals(new YangInstanceIdentifier.AugmentationIdentifier(ImmutableSet.of(TestModel.TEST_QNAME)), pathArgument);
+
+    }
+
+
+
+}
diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializerTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueSerializerTest.java
new file mode 100644 (file)
index 0000000..af7a385
--- /dev/null
@@ -0,0 +1,449 @@
+package org.opendaylight.controller.cluster.datastore.node.utils.serialization;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.opendaylight.controller.cluster.datastore.util.TestModel;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Set;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+
+public class ValueSerializerTest{
+
+    @Rule
+    public ExpectedException expectedException = ExpectedException.none();
+
+    @Test
+    public void testSerializeShort(){
+        short v1 = 5;
+        NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder();
+        ValueSerializer.serialize(builder, mock(NormalizedNodeSerializationContext.class), v1);
+
+        assertEquals(ValueType.SHORT_TYPE.ordinal(), builder.getIntValueType());
+        assertEquals("5", builder.getValue());
+
+        NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+
+        ValueSerializer.serialize(builder1, mock(NormalizedNodeSerializationContext.class), v1);
+
+        assertEquals(ValueType.SHORT_TYPE.ordinal(), builder1.getType());
+        assertEquals("5", builder.getValue());
+
+    }
+
+    @Test
+    public void testSerializeInteger(){
+        String hexNumber = "f3";
+
+        Integer expected = Integer.valueOf(hexNumber, 16);
+
+
+        NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder();
+        ValueSerializer.serialize(builder, mock(
+            NormalizedNodeSerializationContext.class), expected);
+
+        assertEquals(ValueType.INT_TYPE.ordinal(), builder.getIntValueType());
+        assertEquals("243", builder.getValue());
+
+        NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+
+        ValueSerializer.serialize(builder1, mock(
+            NormalizedNodeSerializationContext.class), expected);
+
+        assertEquals(ValueType.INT_TYPE.ordinal(), builder1.getType());
+        assertEquals("243", builder1.getValue());
+
+
+    }
+
+
+    @Test
+    public void testSerializeLong(){
+        long v1 = 5;
+        NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder();
+        ValueSerializer.serialize(builder, mock(
+            NormalizedNodeSerializationContext.class), v1);
+
+        assertEquals(ValueType.LONG_TYPE.ordinal(), builder.getIntValueType());
+        assertEquals("5", builder.getValue());
+
+        NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+
+        ValueSerializer.serialize(builder1, mock(
+            NormalizedNodeSerializationContext.class), v1);
+
+        assertEquals(ValueType.LONG_TYPE.ordinal(), builder1.getType());
+        assertEquals("5", builder1.getValue());
+
+    }
+
+    @Test
+    public void testSerializeByte(){
+        byte v1 = 5;
+        NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder();
+        ValueSerializer.serialize(builder, mock(
+            NormalizedNodeSerializationContext.class), v1);
+
+        assertEquals(ValueType.BYTE_TYPE.ordinal(), builder.getIntValueType());
+        assertEquals("5", builder.getValue());
+
+        NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+
+        ValueSerializer.serialize(builder1, mock(
+            NormalizedNodeSerializationContext.class), v1);
+
+        assertEquals(ValueType.BYTE_TYPE.ordinal(), builder1.getType());
+        assertEquals("5", builder1.getValue());
+
+    }
+
+    @Test
+    public void testSerializeBits(){
+        NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder();
+        ValueSerializer.serialize(builder, mock(
+            NormalizedNodeSerializationContext.class),
+            ImmutableSet.of("foo", "bar"));
+
+        assertEquals(ValueType.BITS_TYPE.ordinal(), builder.getIntValueType());
+        assertTrue( "foo not in bits", builder.getBitsValueList().contains("foo"));
+        assertTrue( "bar not in bits", builder.getBitsValueList().contains("bar"));
+
+        NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+
+        ValueSerializer.serialize(builder1, mock(
+            NormalizedNodeSerializationContext.class),
+            ImmutableSet.of("foo", "bar"));
+
+        assertEquals(ValueType.BITS_TYPE.ordinal(), builder1.getType());
+        assertEquals("[foo, bar]", builder1.getValue());
+
+    }
+
+    @Test
+    public void testSerializeWrongTypeOfSet(){
+        expectedException.expect(IllegalArgumentException.class);
+        expectedException.expectMessage("Expected value type to be Bits but was :");
+        NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder();
+        ValueSerializer.serialize(builder, mock(
+                NormalizedNodeSerializationContext.class),
+            ImmutableSet.of(1, 2));
+
+    }
+
+    @Test
+    public void testSerializeEmptyString(){
+        NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder();
+        ValueSerializer.serialize(builder, mock(
+            NormalizedNodeSerializationContext.class),"");
+
+        assertEquals(ValueType.STRING_TYPE.ordinal(), builder.getIntValueType());
+        assertEquals("", builder.getValue());
+
+        NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+
+        ValueSerializer.serialize(builder1, mock(
+            NormalizedNodeSerializationContext.class),"");
+
+        assertEquals(ValueType.STRING_TYPE.ordinal(), builder1.getType());
+        assertEquals("", builder1.getValue());
+
+    }
+
+    @Test
+    public void testSerializeString(){
+        NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder();
+        ValueSerializer.serialize(builder, mock(
+            NormalizedNodeSerializationContext.class),"foo");
+
+        assertEquals(ValueType.STRING_TYPE.ordinal(), builder.getIntValueType());
+        assertEquals("foo", builder.getValue());
+
+        NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+
+        ValueSerializer.serialize(builder1, mock(
+            NormalizedNodeSerializationContext.class),"foo");
+
+        assertEquals(ValueType.STRING_TYPE.ordinal(), builder1.getType());
+        assertEquals("foo", builder1.getValue());
+
+    }
+
+
+    @Test
+    public void testSerializeBoolean(){
+        boolean v1 = true;
+        NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder();
+        ValueSerializer.serialize(builder, mock(
+            NormalizedNodeSerializationContext.class), v1);
+
+        assertEquals(ValueType.BOOL_TYPE.ordinal(), builder.getIntValueType());
+        assertEquals("true", builder.getValue());
+
+        NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+        ValueSerializer.serialize(builder1, mock(
+            NormalizedNodeSerializationContext.class), v1);
+
+        assertEquals(ValueType.BOOL_TYPE.ordinal(), builder1.getType());
+        assertEquals("true", builder1.getValue());
+    }
+
+    @Test
+    public void testSerializeQName(){
+        QName v1 = TestModel.TEST_QNAME;
+        NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder();
+        ValueSerializer.serialize(builder, mock(
+            NormalizedNodeSerializationContext.class), v1);
+
+        assertEquals(ValueType.QNAME_TYPE.ordinal(), builder.getIntValueType());
+        assertEquals("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test", builder.getValue());
+
+        NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+
+        ValueSerializer.serialize(builder1, mock(
+            NormalizedNodeSerializationContext.class), v1);
+
+        assertEquals(ValueType.QNAME_TYPE.ordinal(), builder1.getType());
+        assertEquals("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test", builder1.getValue());
+
+    }
+
+    @Test
+    public void testSerializeYangIdentifier(){
+        YangInstanceIdentifier v1 = TestModel.TEST_PATH;
+
+        NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder();
+        ValueSerializer.serialize(builder, mock(
+            NormalizedNodeSerializationContext.class), v1);
+
+
+        assertEquals(ValueType.YANG_IDENTIFIER_TYPE.ordinal(), builder.getIntValueType());
+        NormalizedNodeMessages.InstanceIdentifier serializedYangInstanceIdentifier =
+            builder.getInstanceIdentifierValue();
+
+        assertEquals(1, serializedYangInstanceIdentifier.getArgumentsCount());
+        assertEquals(TestModel.TEST_QNAME.toString(), serializedYangInstanceIdentifier.getArguments(0).getNodeType().getValue());
+    }
+
+    @Test
+    public void testSerializeBigInteger(){
+        BigInteger v1 = new BigInteger("1000000000000000000000000");
+        NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder();
+        ValueSerializer.serialize(builder, mock(
+            NormalizedNodeSerializationContext.class), v1);
+
+        assertEquals(ValueType.BIG_INTEGER_TYPE.ordinal(), builder.getIntValueType());
+        assertEquals("1000000000000000000000000", builder.getValue());
+
+        NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+
+        ValueSerializer.serialize(builder1, mock(
+            NormalizedNodeSerializationContext.class), v1);
+
+        assertEquals(ValueType.BIG_INTEGER_TYPE.ordinal(), builder1.getType());
+        assertEquals("1000000000000000000000000", builder1.getValue());
+
+    }
+
+    @Test
+    public void testSerializeBigDecimal(){
+        BigDecimal v1 = new BigDecimal("1000000000000000000000000.51616");
+        NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder();
+        ValueSerializer.serialize(builder, mock(
+            NormalizedNodeSerializationContext.class), v1);
+
+        assertEquals(ValueType.BIG_DECIMAL_TYPE.ordinal(), builder.getIntValueType());
+        assertEquals("1000000000000000000000000.51616", builder.getValue());
+
+        NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+        ValueSerializer.serialize(builder1, mock(
+            NormalizedNodeSerializationContext.class), v1);
+
+        assertEquals(ValueType.BIG_DECIMAL_TYPE.ordinal(), builder1.getType());
+        assertEquals("1000000000000000000000000.51616", builder1.getValue());
+
+    }
+
+    @Test
+    public void testDeSerializeShort(){
+        NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
+        nodeBuilder.setIntValueType(ValueType.SHORT_TYPE.ordinal());
+        nodeBuilder.setValue("25");
+
+        Object o = ValueSerializer
+            .deSerialize(mock(NormalizedNodeDeSerializationContext.class),
+                nodeBuilder.build());
+
+        assertTrue(o instanceof Short);
+        assertEquals(25, ((Short) o).shortValue());
+    }
+
+    @Test
+    public void testDeSerializeByte(){
+        NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
+        nodeBuilder.setIntValueType(ValueType.BYTE_TYPE.ordinal());
+        nodeBuilder.setValue("25");
+
+        Object o = ValueSerializer
+            .deSerialize(mock(NormalizedNodeDeSerializationContext.class),
+                nodeBuilder.build());
+
+        assertTrue(o instanceof Byte);
+        assertEquals(25, ((Byte) o).byteValue());
+
+    }
+
+    @Test
+    public void testDeSerializeInteger(){
+        NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
+        nodeBuilder.setIntValueType(ValueType.INT_TYPE.ordinal());
+        nodeBuilder.setValue("25");
+
+        Object o = ValueSerializer
+            .deSerialize(mock(NormalizedNodeDeSerializationContext.class),
+                nodeBuilder.build());
+
+        assertTrue(o instanceof Integer);
+        assertEquals(25, ((Integer) o).intValue());
+
+    }
+
+    @Test
+    public void testDeSerializeLong(){
+        NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
+        nodeBuilder.setIntValueType(ValueType.LONG_TYPE.ordinal());
+        nodeBuilder.setValue("25");
+
+        Object o = ValueSerializer
+            .deSerialize(mock(NormalizedNodeDeSerializationContext.class),
+                nodeBuilder.build());
+
+        assertTrue(o instanceof Long);
+        assertEquals(25, ((Long) o).longValue());
+
+    }
+
+    @Test
+    public void testDeSerializeBoolean(){
+        NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
+        nodeBuilder.setIntValueType(ValueType.BOOL_TYPE.ordinal());
+        nodeBuilder.setValue("false");
+
+        Object o = ValueSerializer
+            .deSerialize(mock(NormalizedNodeDeSerializationContext.class),
+                nodeBuilder.build());
+
+        assertTrue(o instanceof Boolean);
+        assertEquals(false, ((Boolean) o).booleanValue());
+
+    }
+
+    @Test
+    public void testDeSerializeQName(){
+        NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
+        nodeBuilder.setIntValueType(ValueType.QNAME_TYPE.ordinal());
+        nodeBuilder.setValue(TestModel.TEST_QNAME.toString());
+
+        Object o = ValueSerializer
+            .deSerialize(mock(NormalizedNodeDeSerializationContext.class),
+                nodeBuilder.build());
+
+        assertTrue(o instanceof QName);
+        assertEquals(TestModel.TEST_QNAME, o);
+
+    }
+
+    @Test
+    public void testDeSerializeBits(){
+        NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
+        nodeBuilder.setIntValueType(ValueType.BITS_TYPE.ordinal());
+        nodeBuilder.addAllBitsValue(ImmutableList.of("foo", "bar"));
+
+        Object o = ValueSerializer
+            .deSerialize(mock(NormalizedNodeDeSerializationContext.class),
+                nodeBuilder.build());
+
+        assertTrue(o instanceof Set);
+        assertTrue(((Set)o).contains("foo"));
+        assertTrue(((Set) o).contains("bar"));
+
+    }
+
+    @Test
+    public void testDeSerializeYangIdentifier(){
+        NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
+        NormalizedNodeMessages.InstanceIdentifier.Builder idBuilder = NormalizedNodeMessages.InstanceIdentifier.newBuilder();
+        NormalizedNodeMessages.PathArgument.Builder pathBuilder = NormalizedNodeMessages.PathArgument.newBuilder();
+
+        pathBuilder.setValue(TestModel.TEST_QNAME.toString());
+        pathBuilder.setIntType(PathArgumentType.NODE_IDENTIFIER.ordinal());
+
+        idBuilder.addArguments(pathBuilder);
+
+        nodeBuilder.setIntValueType(ValueType.YANG_IDENTIFIER_TYPE.ordinal());
+        nodeBuilder.setInstanceIdentifierValue(idBuilder);
+
+        Object o = ValueSerializer
+            .deSerialize(mock(NormalizedNodeDeSerializationContext.class),
+                nodeBuilder.build());
+
+        assertTrue(o instanceof YangInstanceIdentifier);
+        assertEquals(TestModel.TEST_PATH, o);
+
+    }
+
+    @Test
+    public void testDeSerializeString(){
+        NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
+        nodeBuilder.setIntValueType(ValueType.STRING_TYPE.ordinal());
+        nodeBuilder.setValue("25");
+
+        Object o = ValueSerializer
+            .deSerialize(mock(NormalizedNodeDeSerializationContext.class),
+                nodeBuilder.build());
+
+        assertTrue(o instanceof String);
+        assertEquals("25", o);
+
+    }
+
+    @Test
+    public void testDeSerializeBigInteger(){
+        NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
+        nodeBuilder.setIntValueType(ValueType.BIG_INTEGER_TYPE.ordinal());
+        nodeBuilder.setValue("25");
+
+        Object o = ValueSerializer
+            .deSerialize(mock(NormalizedNodeDeSerializationContext.class),
+                nodeBuilder.build());
+
+        assertTrue(o instanceof BigInteger);
+        assertEquals(new BigInteger("25"), o);
+
+    }
+
+    @Test
+    public void testDeSerializeBigDecimal(){
+        NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
+        nodeBuilder.setIntValueType(ValueType.BIG_DECIMAL_TYPE.ordinal());
+        nodeBuilder.setValue("25");
+
+        Object o = ValueSerializer
+            .deSerialize(mock(NormalizedNodeDeSerializationContext.class),
+                nodeBuilder.build());
+
+        assertTrue(o instanceof BigDecimal);
+        assertEquals(new BigDecimal("25"), o);
+
+    }
+
+}
index 3eeb06f93ca6cead53174dac1cd4f436b15fd46f..cda4b06e2926cf42bb8c975c8e4b7fd79a89b781 100644 (file)
 
 package org.opendaylight.controller.cluster.datastore.util;
 
+import com.google.common.collect.ImmutableSet;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.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;
@@ -24,6 +26,7 @@ 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.api.NormalizedNodeAttrBuilder;
 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;
@@ -355,12 +358,20 @@ public class TestModel {
     // Create augmentations
     MapEntryNode mapEntry = createAugmentedListEntry(1, "First Test");
 
+    // Create a bits leaf
+      NormalizedNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>>
+          myBits = Builders.leafBuilder().withNodeIdentifier(
+          new YangInstanceIdentifier.NodeIdentifier(
+              QName.create(TEST_QNAME, "my-bits"))).withValue(
+          ImmutableSet.of("foo", "bar"));
 
-    // Create the document
+
+      // Create the document
     return ImmutableContainerNodeBuilder
         .create()
         .withNodeIdentifier(
             new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME))
+        .withChild(myBits.build())
         .withChild(ImmutableNodes.leafNode(DESC_QNAME, DESC))
         .withChild(ImmutableNodes.leafNode(POINTER_QNAME, "pointer"))
         .withChild(
index 1e60803f05af52d965a3b927b2423bd22e023064..0f96c1002de540fa0071a4cb7d96710c591bfd23 100644 (file)
@@ -44,7 +44,8 @@ public class MeteredBoundedMailboxTest {
         actorSystem.eventStream().subscribe(mockReceiver.getRef(), DeadLetter.class);
 
 
-        final FiniteDuration TEN_SEC = new FiniteDuration(10, TimeUnit.SECONDS);
+        final FiniteDuration TWENTY_SEC = new FiniteDuration(20, TimeUnit.SECONDS);
+
         String boundedMailBox = actorSystem.name() + ".bounded-mailbox";
         ActorRef pingPongActor = actorSystem.actorOf(PingPongActor.props(lock).withMailbox(boundedMailBox),
                                                      "pingpongactor");
@@ -59,11 +60,11 @@ public class MeteredBoundedMailboxTest {
             pingPongActor.tell("ping", mockReceiver.getRef());
         }
 
-        mockReceiver.expectMsgClass(TEN_SEC, DeadLetter.class);
+        mockReceiver.expectMsgClass(TWENTY_SEC, DeadLetter.class);
 
         lock.unlock();
 
-        Object[] eleven = mockReceiver.receiveN(11, TEN_SEC);
+        Object[] eleven = mockReceiver.receiveN(11, TWENTY_SEC);
     }
 
     /**
@@ -89,8 +90,12 @@ public class MeteredBoundedMailboxTest {
         @Override
         public void onReceive(Object message) throws Exception {
             lock.lock();
-            if ("ping".equals(message))
-                getSender().tell("pong", getSelf());
+            try {
+                if ("ping".equals(message))
+                    getSender().tell("pong", getSelf());
+            } finally {
+                lock.unlock();
+            }
         }
     }
 }
\ No newline at end of file
index e4eca7b71738df8e06ec7bde21f0344160c68b40..246cc682cd7ae277f36e152392209c8577c3785d 100644 (file)
@@ -11,6 +11,27 @@ module odl-datastore-test {
     }
 
     container test {
+        leaf my-bits {
+            type bits {
+                bit ten-mb-hd;
+                bit ten-mb-fd;
+                bit hundred-mb-hd;
+                bit hundred-mb-fd;
+                bit one-gb-hd;
+                bit one-gb-fd;
+                bit ten-gb-fd;
+                bit forty-gb-fd;
+                bit hundred-gb-fd;
+                bit one-tb-fd;
+                bit other;
+                bit copper;
+                bit fiber;
+                bit autoeng;
+                bit pause;
+                bit pause-asym;
+            }
+        }
+
         leaf desc {
             type string;
         }
index 0535179aadf79c4196a8f606433c1cd8b4e89949..05322137aafc2d62b6b18e548a419be91446aeeb 100644 (file)
@@ -1,5 +1,10 @@
 
 odl-cluster-data {
+  bounded-mailbox {
+    mailbox-type = "org.opendaylight.controller.common.actor.MeteredBoundedMailbox"
+    mailbox-capacity = 1000
+    mailbox-push-timeout-time = 100ms
+  }    
   akka {
     actor {
       provider = "akka.cluster.ClusterActorRefProvider"
@@ -33,6 +38,11 @@ odl-cluster-data {
 }
 
 odl-cluster-rpc {
+  bounded-mailbox {
+    mailbox-type = "org.opendaylight.controller.common.actor.MeteredBoundedMailbox"
+    mailbox-capacity = 1000
+    mailbox-push-timeout-time = 100ms
+  }
   akka {
     actor {
       provider = "akka.cluster.ClusterActorRefProvider"
index 9c5129d6a4eb932f764a158530e304808dbb375d..31b0bb80c05ca221fc865b6d8de467a4e43ebac8 100644 (file)
       <dependency>
           <groupId>com.codahale.metrics</groupId>
           <artifactId>metrics-core</artifactId>
-          <version>3.0.1</version>
+      </dependency>
+
+      <dependency>
+          <groupId>com.codahale.metrics</groupId>
+          <artifactId>metrics-graphite</artifactId>
       </dependency>
     <!-- Test Dependencies -->
     <dependency>
         <configuration>
           <includes>
             <include>org.opendaylight.controller.*</include>
+
           </includes>
+          <excludes>
+              <exclude>org.opendaylight.controller.config.yang.config.*</exclude>
+          </excludes>
           <check>false</check>
         </configuration>
         <executions>
index 36c0447b6e90d35c8f54f8844cf762c3fc0e1897..2e822f1d437f4328be6c5b4a39a82380247b3bdf 100644 (file)
@@ -13,7 +13,7 @@ import com.google.protobuf.GeneratedMessage;
 import com.google.protobuf.InvalidProtocolBufferException;
 import com.google.protobuf.UnknownFieldSet;
 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
-import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
+import org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages;
 import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages;
 
 import java.io.Serializable;
index 1dab285679474378b47c1c0a1c488ebf89d66fea..b3283a18b1baaf4c3c7530570b8ae8a09512211f 100644 (file)
@@ -10,7 +10,9 @@ package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.Props;
 import akka.japi.Creator;
+
 import com.google.common.base.Preconditions;
+
 import org.opendaylight.controller.cluster.datastore.messages.DataChanged;
 import org.opendaylight.controller.cluster.datastore.messages.DataChangedReply;
 import org.opendaylight.controller.cluster.datastore.messages.EnableNotification;
@@ -18,20 +20,14 @@ 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.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 public class DataChangeListener extends AbstractUntypedActor {
     private final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> listener;
-    private final SchemaContext schemaContext;
-    private final YangInstanceIdentifier pathId;
-    private boolean notificationsEnabled = false;
+    private volatile boolean notificationsEnabled = false;
 
-    public DataChangeListener(SchemaContext schemaContext,
-                              AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> listener, YangInstanceIdentifier pathId) {
-
-        this.schemaContext = Preconditions.checkNotNull(schemaContext, "schemaContext should not be null");
+    public DataChangeListener(AsyncDataChangeListener<YangInstanceIdentifier,
+                                                      NormalizedNode<?, ?>> listener) {
         this.listener = Preconditions.checkNotNull(listener, "listener should not be null");
-        this.pathId  = Preconditions.checkNotNull(pathId, "pathId should not be null");
     }
 
     @Override public void handleReceive(Object message) throws Exception {
@@ -63,14 +59,24 @@ public class DataChangeListener extends AbstractUntypedActor {
         }
     }
 
-    public static Props props(final SchemaContext schemaContext, final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> listener, final YangInstanceIdentifier pathId) {
-        return Props.create(new Creator<DataChangeListener>() {
-            @Override
-            public DataChangeListener create() throws Exception {
-                return new DataChangeListener(schemaContext,listener,pathId );
-            }
+    public static Props props(final AsyncDataChangeListener<YangInstanceIdentifier,
+                                                            NormalizedNode<?, ?>> listener) {
+        return Props.create(new DataChangeListenerCreator(listener));
+    }
+
+    private static class DataChangeListenerCreator implements Creator<DataChangeListener> {
+        private static final long serialVersionUID = 1L;
+
+        final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> listener;
 
-        });
+        DataChangeListenerCreator(
+                AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> listener) {
+            this.listener = listener;
+        }
 
+        @Override
+        public DataChangeListener create() throws Exception {
+            return new DataChangeListener(listener);
+        }
     }
 }
index 6d835498afa2af24ec915e3b010e67710f685d51..a1b6b9252eb452082f101fe1bb748fb2d6b28536 100644 (file)
@@ -9,7 +9,9 @@
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorSelection;
+
 import com.google.common.base.Preconditions;
+
 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;
@@ -24,13 +26,13 @@ public class DataChangeListenerProxy implements AsyncDataChangeListener<YangInst
     private final ActorSelection dataChangeListenerActor;
     private final SchemaContext schemaContext;
 
-    public DataChangeListenerProxy(SchemaContext schemaContext,ActorSelection dataChangeListenerActor) {
+    public DataChangeListenerProxy(SchemaContext schemaContext, ActorSelection dataChangeListenerActor) {
         this.dataChangeListenerActor = Preconditions.checkNotNull(dataChangeListenerActor, "dataChangeListenerActor should not be null");
         this.schemaContext = schemaContext;
     }
 
     @Override public void onDataChanged(
         AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
-        dataChangeListenerActor.tell(new DataChanged(schemaContext,change), null);
+        dataChangeListenerActor.tell(new DataChanged(schemaContext, change), null);
     }
 }
index 9e50b5b332babf4bcc033aeea3778fed850681d3..818f73392d1d880ad0dde5d84704c1e4c9d15c17 100644 (file)
@@ -11,19 +11,21 @@ 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.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 public class DataChangeListenerRegistration extends AbstractUntypedActor {
 
-    private final org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>>
+    private final ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>>
         registration;
 
     public DataChangeListenerRegistration(
-        org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> registration) {
+        ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> registration) {
         this.registration = registration;
     }
 
@@ -36,14 +38,8 @@ public class DataChangeListenerRegistration extends AbstractUntypedActor {
     }
 
     public static Props props(
-        final org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> registration) {
-        return Props.create(new Creator<DataChangeListenerRegistration>() {
-
-            @Override
-            public DataChangeListenerRegistration create() throws Exception {
-                return new DataChangeListenerRegistration(registration);
-            }
-        });
+        final ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> registration) {
+        return Props.create(new DataChangeListenerRegistrationCreator(registration));
     }
 
     private void closeListenerRegistration(
@@ -53,4 +49,21 @@ public class DataChangeListenerRegistration extends AbstractUntypedActor {
             .tell(new CloseDataChangeListenerRegistrationReply().toSerializable(), getSelf());
         getSelf().tell(PoisonPill.getInstance(), getSelf());
     }
+
+    private static class DataChangeListenerRegistrationCreator
+                                            implements Creator<DataChangeListenerRegistration> {
+        final ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier,
+                                                           NormalizedNode<?, ?>>> registration;
+
+        DataChangeListenerRegistrationCreator(
+                ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier,
+                                                             NormalizedNode<?, ?>>> registration) {
+            this.registration = registration;
+        }
+
+        @Override
+        public DataChangeListenerRegistration create() throws Exception {
+            return new DataChangeListenerRegistration(registration);
+        }
+    }
 }
index 404a4e02033ea1c89f9fada4135cfe0e4b6a935e..b97164839277279e35479ea8f69b5cd8c459d418 100644 (file)
@@ -8,14 +8,16 @@
 
 package org.opendaylight.controller.cluster.datastore;
 
+import java.util.concurrent.TimeUnit;
+
 import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
 
 import com.google.common.base.Preconditions;
+
 import org.opendaylight.controller.cluster.datastore.identifiers.ShardManagerIdentifier;
 import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListener;
 import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListenerReply;
-import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext;
 import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory;
 import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
@@ -34,6 +36,8 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import scala.concurrent.duration.Duration;
+
 /**
  *
  */
@@ -42,11 +46,10 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, Au
     private static final Logger LOG = LoggerFactory.getLogger(DistributedDataStore.class);
 
     private final ActorContext actorContext;
-
-    private SchemaContext schemaContext;
+    private final ShardContext shardContext;
 
     public DistributedDataStore(ActorSystem actorSystem, String type, ClusterWrapper cluster,
-            Configuration configuration, InMemoryDOMDataStoreConfigProperties dataStoreProperties) {
+            Configuration configuration, DistributedDataStoreProperties dataStoreProperties) {
         Preconditions.checkNotNull(actorSystem, "actorSystem should not be null");
         Preconditions.checkNotNull(type, "type should not be null");
         Preconditions.checkNotNull(cluster, "cluster should not be null");
@@ -57,13 +60,23 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, Au
 
         LOG.info("Creating ShardManager : {}", shardManagerId);
 
-        this.actorContext = new ActorContext(actorSystem, actorSystem
-            .actorOf(ShardManager.props(type, cluster, configuration, dataStoreProperties),
-                shardManagerId ), cluster, configuration);
+        shardContext = new ShardContext(InMemoryDOMDataStoreConfigProperties.create(
+                dataStoreProperties.getMaxShardDataChangeExecutorPoolSize(),
+                dataStoreProperties.getMaxShardDataChangeExecutorQueueSize(),
+                dataStoreProperties.getMaxShardDataChangeListenerQueueSize()),
+                Duration.create(dataStoreProperties.getShardTransactionIdleTimeoutInMinutes(),
+                        TimeUnit.MINUTES));
+
+        actorContext
+                = new ActorContext(
+                    actorSystem, actorSystem.actorOf(
+                        ShardManager.props(type, cluster, configuration, shardContext).
+                            withMailbox(ActorContext.MAILBOX), shardManagerId ), cluster, configuration);
     }
 
     public DistributedDataStore(ActorContext actorContext) {
         this.actorContext = Preconditions.checkNotNull(actorContext, "actorContext should not be null");
+        this.shardContext = new ShardContext();
     }
 
 
@@ -80,7 +93,7 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, Au
         LOG.debug("Registering listener: {} for path: {} scope: {}", listener, path, scope);
 
         ActorRef dataChangeListenerActor = actorContext.getActorSystem().actorOf(
-            DataChangeListener.props(schemaContext,listener,path ));
+            DataChangeListener.props(listener ));
 
         String shardName = ShardStrategyFactory.getStrategy(path).findShard(path);
 
@@ -104,35 +117,31 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, Au
 
     @Override
     public DOMStoreTransactionChain createTransactionChain() {
-        return new TransactionChainProxy(actorContext, schemaContext);
+        return new TransactionChainProxy(actorContext);
     }
 
     @Override
     public DOMStoreReadTransaction newReadOnlyTransaction() {
-        return new TransactionProxy(actorContext, TransactionProxy.TransactionType.READ_ONLY,
-            schemaContext);
+        return new TransactionProxy(actorContext, TransactionProxy.TransactionType.READ_ONLY);
     }
 
     @Override
     public DOMStoreWriteTransaction newWriteOnlyTransaction() {
-        return new TransactionProxy(actorContext, TransactionProxy.TransactionType.WRITE_ONLY,
-            schemaContext);
+        return new TransactionProxy(actorContext, TransactionProxy.TransactionType.WRITE_ONLY);
     }
 
     @Override
     public DOMStoreReadWriteTransaction newReadWriteTransaction() {
-        return new TransactionProxy(actorContext, TransactionProxy.TransactionType.READ_WRITE,
-            schemaContext);
+        return new TransactionProxy(actorContext, TransactionProxy.TransactionType.READ_WRITE);
     }
 
-    @Override public void onGlobalContextUpdated(SchemaContext schemaContext) {
-        this.schemaContext = schemaContext;
-        actorContext.getShardManager().tell(
-            new UpdateSchemaContext(schemaContext), null);
+    @Override
+    public void onGlobalContextUpdated(SchemaContext schemaContext) {
+        actorContext.setSchemaContext(schemaContext);
     }
 
-    @Override public void close() throws Exception {
+    @Override
+    public void close() throws Exception {
         actorContext.shutdown();
-
     }
 }
index a1a3e87510e78d151b769fd579c2602503ec656c..65a39a60e6c0819fe7f14543c268997a53fddff0 100644 (file)
@@ -11,12 +11,11 @@ package org.opendaylight.controller.cluster.datastore;
 import akka.actor.ActorSystem;
 
 import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory;
-import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreConfigProperties;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
 
 public class DistributedDataStoreFactory {
     public static DistributedDataStore createInstance(String name, SchemaService schemaService,
-            InMemoryDOMDataStoreConfigProperties dataStoreProperties) {
+            DistributedDataStoreProperties dataStoreProperties) {
 
         ActorSystem actorSystem = ActorSystemFactory.getInstance();
         Configuration config = new ConfigurationImpl("module-shards.conf", "modules.conf");
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreProperties.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreProperties.java
new file mode 100644 (file)
index 0000000..eb6a536
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore;
+
+/**
+ * Wrapper class for DistributedDataStore configuration properties.
+ *
+ * @author Thomas Pantelis
+ */
+public class DistributedDataStoreProperties {
+    private final int maxShardDataChangeListenerQueueSize;
+    private final int maxShardDataChangeExecutorQueueSize;
+    private final int maxShardDataChangeExecutorPoolSize;
+    private final int shardTransactionIdleTimeoutInMinutes;
+
+    public DistributedDataStoreProperties() {
+        maxShardDataChangeListenerQueueSize = 1000;
+        maxShardDataChangeExecutorQueueSize = 1000;
+        maxShardDataChangeExecutorPoolSize = 20;
+        shardTransactionIdleTimeoutInMinutes = 10;
+    }
+
+    public DistributedDataStoreProperties(int maxShardDataChangeListenerQueueSize,
+            int maxShardDataChangeExecutorQueueSize, int maxShardDataChangeExecutorPoolSize,
+            int shardTransactionIdleTimeoutInMinutes) {
+        this.maxShardDataChangeListenerQueueSize = maxShardDataChangeListenerQueueSize;
+        this.maxShardDataChangeExecutorQueueSize = maxShardDataChangeExecutorQueueSize;
+        this.maxShardDataChangeExecutorPoolSize = maxShardDataChangeExecutorPoolSize;
+        this.shardTransactionIdleTimeoutInMinutes = shardTransactionIdleTimeoutInMinutes;
+    }
+
+    public int getMaxShardDataChangeListenerQueueSize() {
+        return maxShardDataChangeListenerQueueSize;
+    }
+
+    public int getMaxShardDataChangeExecutorQueueSize() {
+        return maxShardDataChangeExecutorQueueSize;
+    }
+
+    public int getMaxShardDataChangeExecutorPoolSize() {
+        return maxShardDataChangeExecutorPoolSize;
+    }
+
+    public int getShardTransactionIdleTimeoutInMinutes() {
+        return shardTransactionIdleTimeoutInMinutes;
+    }
+}
index 75f540ade088e6bb45b10e9b92bc4af8789b0218..abcde747b93b132f8c492f25ac8af43f96c84a26 100644 (file)
@@ -15,11 +15,13 @@ import akka.event.Logging;
 import akka.event.LoggingAdapter;
 import akka.japi.Creator;
 import akka.serialization.Serialization;
+
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
+
 import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier;
 import org.opendaylight.controller.cluster.datastore.identifiers.ShardTransactionIdentifier;
 import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardMBeanFactory;
@@ -43,14 +45,15 @@ import org.opendaylight.controller.cluster.raft.RaftActor;
 import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
-import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreConfigProperties;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreFactory;
 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.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
 import scala.concurrent.duration.FiniteDuration;
 
 import java.util.ArrayList;
@@ -89,17 +92,20 @@ public class Shard extends RaftActor {
     /// The name of this shard
     private final ShardIdentifier name;
 
-    private volatile SchemaContext schemaContext;
-
     private final ShardStats shardMBean;
 
     private final List<ActorSelection> dataChangeListeners = new ArrayList<>();
 
+    private final ShardContext shardContext;
+
+    private SchemaContext schemaContext;
+
     private Shard(ShardIdentifier name, Map<ShardIdentifier, String> peerAddresses,
-            InMemoryDOMDataStoreConfigProperties dataStoreProperties) {
+            ShardContext shardContext) {
         super(name.toString(), mapPeerAddresses(peerAddresses), Optional.of(configParams));
 
         this.name = name;
+        this.shardContext = shardContext;
 
         String setting = System.getProperty("shard.persistent");
 
@@ -107,7 +113,8 @@ public class Shard extends RaftActor {
 
         LOG.info("Shard created : {} persistent : {}", name, persistent);
 
-        store = InMemoryDOMDataStoreFactory.create(name.toString(), null, dataStoreProperties);
+        store = InMemoryDOMDataStoreFactory.create(name.toString(), null,
+                shardContext.getDataStoreProperties());
 
         shardMBean = ShardMBeanFactory.getShardStatsMBean(name.toString());
 
@@ -125,27 +132,16 @@ public class Shard extends RaftActor {
         return map;
     }
 
-
-
-
     public static Props props(final ShardIdentifier name,
         final Map<ShardIdentifier, String> peerAddresses,
-        final InMemoryDOMDataStoreConfigProperties dataStoreProperties) {
+        ShardContext shardContext) {
         Preconditions.checkNotNull(name, "name should not be null");
-        Preconditions
-            .checkNotNull(peerAddresses, "peerAddresses should not be null");
+        Preconditions.checkNotNull(peerAddresses, "peerAddresses should not be null");
+        Preconditions.checkNotNull(shardContext, "shardContext should not be null");
 
-        return Props.create(new Creator<Shard>() {
-
-            @Override
-            public Shard create() throws Exception {
-                return new Shard(name, peerAddresses, dataStoreProperties);
-            }
-
-        });
+        return Props.create(new ShardCreator(name, peerAddresses, shardContext));
     }
 
-
     @Override public void onReceiveCommand(Object message) {
         LOG.debug("Received message {} from {}", message.getClass().toString(),
             getSender());
@@ -188,9 +184,8 @@ public class Shard extends RaftActor {
             shardMBean.incrementReadOnlyTransactionCount();
 
             return getContext().actorOf(
-                ShardTransaction
-                    .props(store.newReadOnlyTransaction(), getSelf(),
-                        schemaContext), transactionId.toString());
+                ShardTransaction.props(store.newReadOnlyTransaction(), getSelf(),
+                        schemaContext, shardContext), transactionId.toString());
 
         } else if (createTransaction.getTransactionType()
             == TransactionProxy.TransactionType.READ_WRITE.ordinal()) {
@@ -198,9 +193,8 @@ public class Shard extends RaftActor {
             shardMBean.incrementReadWriteTransactionCount();
 
             return getContext().actorOf(
-                ShardTransaction
-                    .props(store.newReadWriteTransaction(), getSelf(),
-                        schemaContext), transactionId.toString());
+                ShardTransaction.props(store.newReadWriteTransaction(), getSelf(),
+                        schemaContext, shardContext), transactionId.toString());
 
 
         } else if (createTransaction.getTransactionType()
@@ -209,9 +203,8 @@ public class Shard extends RaftActor {
             shardMBean.incrementWriteOnlyTransactionCount();
 
             return getContext().actorOf(
-                ShardTransaction
-                    .props(store.newWriteOnlyTransaction(), getSelf(),
-                        schemaContext), transactionId.toString());
+                ShardTransaction.props(store.newWriteOnlyTransaction(), getSelf(),
+                        schemaContext, shardContext), transactionId.toString());
         } else {
             throw new IllegalArgumentException(
                 "Shard="+name + ":CreateTransaction message has unidentified transaction type="
@@ -269,12 +262,14 @@ public class Shard extends RaftActor {
         final ActorRef self = getSelf();
 
         Futures.addCallback(future, new FutureCallback<Void>() {
+            @Override
             public void onSuccess(Void v) {
                sender.tell(new CommitTransactionReply().toSerializable(),self);
                shardMBean.incrementCommittedTransactionCount();
                shardMBean.setLastCommittedTransactionTime(new Date());
             }
 
+            @Override
             public void onFailure(Throwable t) {
                 LOG.error(t, "An exception happened during commit");
                 shardMBean.incrementFailedTransactionsCount();
@@ -327,12 +322,10 @@ public class Shard extends RaftActor {
         dataChangeListeners.add(dataChangeListenerPath);
 
         AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>
-            listener =
-            new DataChangeListenerProxy(schemaContext, dataChangeListenerPath);
+            listener = new DataChangeListenerProxy(schemaContext, dataChangeListenerPath);
 
-        org.opendaylight.yangtools.concepts.ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>>
-            registration =
-            store.registerChangeListener(registerChangeListener.getPath(),
+        ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>>
+            registration = store.registerChangeListener(registerChangeListener.getPath(),
                 listener, registerChangeListener.getScope());
         ActorRef listenerRegistration =
             getContext().actorOf(
@@ -349,12 +342,9 @@ public class Shard extends RaftActor {
 
     private void createTransactionChain() {
         DOMStoreTransactionChain chain = store.createTransactionChain();
-        ActorRef transactionChain =
-            getContext().actorOf(
-                ShardTransactionChain.props(chain, schemaContext));
-        getSender()
-            .tell(new CreateTransactionChainReply(transactionChain.path())
-                    .toSerializable(),
+        ActorRef transactionChain = getContext().actorOf(
+                ShardTransactionChain.props(chain, schemaContext, shardContext));
+        getSender().tell(new CreateTransactionChainReply(transactionChain.path()).toSerializable(),
                 getSelf());
     }
 
@@ -426,4 +416,25 @@ public class Shard extends RaftActor {
             return HEART_BEAT_INTERVAL;
         }
     }
+
+    private static class ShardCreator implements Creator<Shard> {
+
+        private static final long serialVersionUID = 1L;
+
+        final ShardIdentifier name;
+        final Map<ShardIdentifier, String> peerAddresses;
+        final ShardContext shardContext;
+
+        ShardCreator(ShardIdentifier name, Map<ShardIdentifier, String> peerAddresses,
+                ShardContext shardContext) {
+            this.name = name;
+            this.peerAddresses = peerAddresses;
+            this.shardContext = shardContext;
+        }
+
+        @Override
+        public Shard create() throws Exception {
+            return new Shard(name, peerAddresses, shardContext);
+        }
+    }
 }
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardContext.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardContext.java
new file mode 100644 (file)
index 0000000..02bff77
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.cluster.datastore;
+
+import java.util.concurrent.TimeUnit;
+
+import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreConfigProperties;
+import com.google.common.base.Preconditions;
+
+import scala.concurrent.duration.Duration;
+
+/**
+ * Contains contextual data for shards.
+ *
+ * @author Thomas Pantelis
+ */
+public class ShardContext {
+
+    private final InMemoryDOMDataStoreConfigProperties dataStoreProperties;
+    private final Duration shardTransactionIdleTimeout;
+
+    public ShardContext() {
+        this.dataStoreProperties = null;
+        this.shardTransactionIdleTimeout = Duration.create(10, TimeUnit.MINUTES);
+    }
+
+    public ShardContext(InMemoryDOMDataStoreConfigProperties dataStoreProperties,
+            Duration shardTransactionIdleTimeout) {
+        this.dataStoreProperties = Preconditions.checkNotNull(dataStoreProperties);
+        this.shardTransactionIdleTimeout = Preconditions.checkNotNull(shardTransactionIdleTimeout);
+    }
+
+    public InMemoryDOMDataStoreConfigProperties getDataStoreProperties() {
+        return dataStoreProperties;
+    }
+
+    public Duration getShardTransactionIdleTimeout() {
+        return shardTransactionIdleTimeout;
+    }
+}
index 2972772a4840cf5117ef3b9c9ca2cb4947d2352c..186f2cff41351a97f9d1852396a149047bd345cc 100644 (file)
@@ -17,7 +17,9 @@ import akka.actor.SupervisorStrategy;
 import akka.cluster.ClusterEvent;
 import akka.japi.Creator;
 import akka.japi.Function;
+
 import com.google.common.base.Preconditions;
+
 import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier;
 import org.opendaylight.controller.cluster.datastore.identifiers.ShardManagerIdentifier;
 import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shardmanager.ShardManagerInfo;
@@ -30,8 +32,8 @@ import org.opendaylight.controller.cluster.datastore.messages.PeerAddressResolve
 import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound;
 import org.opendaylight.controller.cluster.datastore.messages.PrimaryNotFound;
 import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext;
-import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreConfigProperties;
 
+import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
 import scala.concurrent.duration.Duration;
 
 import java.util.ArrayList;
@@ -70,19 +72,19 @@ public class ShardManager extends AbstractUntypedActor {
 
     private ShardManagerInfoMBean mBean;
 
-    private final InMemoryDOMDataStoreConfigProperties dataStoreProperties;
+    private final ShardContext shardContext;
 
     /**
      * @param type defines the kind of data that goes into shards created by this shard manager. Examples of type would be
      *             configuration or operational
      */
     private ShardManager(String type, ClusterWrapper cluster, Configuration configuration,
-            InMemoryDOMDataStoreConfigProperties dataStoreProperties) {
+            ShardContext shardContext) {
 
         this.type = Preconditions.checkNotNull(type, "type should not be null");
         this.cluster = Preconditions.checkNotNull(cluster, "cluster should not be null");
         this.configuration = Preconditions.checkNotNull(configuration, "configuration should not be null");
-        this.dataStoreProperties = dataStoreProperties;
+        this.shardContext = shardContext;
 
         // Subscribe this actor to cluster member events
         cluster.subscribeToMemberEvents(getSelf());
@@ -95,22 +97,15 @@ public class ShardManager extends AbstractUntypedActor {
     public static Props props(final String type,
         final ClusterWrapper cluster,
         final Configuration configuration,
-        final InMemoryDOMDataStoreConfigProperties dataStoreProperties) {
+        final ShardContext shardContext) {
 
         Preconditions.checkNotNull(type, "type should not be null");
         Preconditions.checkNotNull(cluster, "cluster should not be null");
         Preconditions.checkNotNull(configuration, "configuration should not be null");
 
-        return Props.create(new Creator<ShardManager>() {
-
-            @Override
-            public ShardManager create() throws Exception {
-                return new ShardManager(type, cluster, configuration, dataStoreProperties);
-            }
-        });
+        return Props.create(new ShardManagerCreator(type, cluster, configuration, shardContext));
     }
 
-
     @Override
     public void handleReceive(Object message) throws Exception {
         if (message.getClass().equals(FindPrimary.SERIALIZABLE_CLASS)) {
@@ -250,8 +245,9 @@ public class ShardManager extends AbstractUntypedActor {
             ShardIdentifier shardId = getShardIdentifier(memberName, shardName);
             Map<ShardIdentifier, String> peerAddresses = getPeerAddresses(shardName);
             ActorRef actor = getContext()
-                .actorOf(Shard.props(shardId, peerAddresses, dataStoreProperties),
-                    shardId.toString());
+                .actorOf(Shard.props(shardId, peerAddresses, shardContext).
+                    withMailbox(ActorContext.MAILBOX), shardId.toString());
+
             localShardActorNames.add(shardId.toString());
             localShards.put(shardName, new ShardInformation(shardName, actor, peerAddresses));
         }
@@ -351,6 +347,28 @@ public class ShardManager extends AbstractUntypedActor {
             }
         }
     }
+
+    private static class ShardManagerCreator implements Creator<ShardManager> {
+        private static final long serialVersionUID = 1L;
+
+        final String type;
+        final ClusterWrapper cluster;
+        final Configuration configuration;
+        final ShardContext shardContext;
+
+        ShardManagerCreator(String type, ClusterWrapper cluster,
+                Configuration configuration, ShardContext shardContext) {
+            this.type = type;
+            this.cluster = cluster;
+            this.configuration = configuration;
+            this.shardContext = shardContext;
+        }
+
+        @Override
+        public ShardManager create() throws Exception {
+            return new ShardManager(type, cluster, configuration, shardContext);
+        }
+    }
 }
 
 
index 1328d466f34b6fff82a91b98379cd815b488155c..c54d3739b22c3b42d2a93c368afd3eb947ce681b 100644 (file)
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorRef;
-import akka.actor.PoisonPill;
-import akka.event.Logging;
-import akka.event.LoggingAdapter;
-import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction;
-import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionReply;
+
 import org.opendaylight.controller.cluster.datastore.messages.DataExists;
 import org.opendaylight.controller.cluster.datastore.messages.ReadData;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
+import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransaction;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 /**
@@ -27,40 +23,27 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
  * Date: 8/6/14
  */
 public class ShardReadTransaction extends ShardTransaction {
-  private final DOMStoreReadTransaction transaction;
-  private final LoggingAdapter log =
-      Logging.getLogger(getContext().system(), this);
-
-  public ShardReadTransaction(DOMStoreReadTransaction transaction, ActorRef shardActor, SchemaContext schemaContext) {
-    super(shardActor, schemaContext);
-    this.transaction = transaction;
-
-  }
+    private final DOMStoreReadTransaction transaction;
 
-  public ShardReadTransaction(DOMStoreTransactionChain transactionChain, DOMStoreReadTransaction transaction, ActorRef shardActor, SchemaContext schemaContext) {
-    super(transactionChain, shardActor, schemaContext);
-    this.transaction = transaction;
-  }
-
-  @Override
-  public void handleReceive(Object message) throws Exception {
-    if (ReadData.SERIALIZABLE_CLASS.equals(message.getClass())) {
-        readData(transaction, ReadData.fromSerializable(message));
-    } else if(DataExists.SERIALIZABLE_CLASS.equals(message.getClass())) {
-        dataExists(transaction, DataExists.fromSerializable(message));
-    } else {
-      super.handleReceive(message);
+    public ShardReadTransaction(DOMStoreReadTransaction transaction, ActorRef shardActor,
+            SchemaContext schemaContext) {
+        super(shardActor, schemaContext);
+        this.transaction = transaction;
     }
-  }
-  protected void closeTransaction(CloseTransaction message) {
-    transaction.close();
-    getSender().tell(new CloseTransactionReply().toSerializable(), getSelf());
-    getSelf().tell(PoisonPill.getInstance(), getSelf());
-  }
 
-  //default scope test method to check if we get correct exception
-  void forUnitTestOnlyExplicitTransactionClose(){
-      transaction.close();
-  }
+    @Override
+    public void handleReceive(Object message) throws Exception {
+        if(ReadData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+            readData(transaction, ReadData.fromSerializable(message));
+        } else if(DataExists.SERIALIZABLE_CLASS.equals(message.getClass())) {
+            dataExists(transaction, DataExists.fromSerializable(message));
+        } else {
+            super.handleReceive(message);
+        }
+    }
 
+    @Override
+    protected DOMStoreTransaction getDOMStoreTransaction() {
+        return transaction;
+    }
 }
index 49c7b7e78f52295e9b3b1fc5b1ae2ea10926def2..1dc9ce0a3ecd99f552c13cf19ec9ff393ebdfd51 100644 (file)
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorRef;
-import akka.actor.PoisonPill;
-import akka.event.Logging;
-import akka.event.LoggingAdapter;
-import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction;
-import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionReply;
+
 import org.opendaylight.controller.cluster.datastore.messages.DataExists;
 import org.opendaylight.controller.cluster.datastore.messages.DeleteData;
 import org.opendaylight.controller.cluster.datastore.messages.MergeData;
@@ -23,7 +19,7 @@ import org.opendaylight.controller.cluster.datastore.messages.ReadData;
 import org.opendaylight.controller.cluster.datastore.messages.ReadyTransaction;
 import org.opendaylight.controller.cluster.datastore.messages.WriteData;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
+import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransaction;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 /**
@@ -31,50 +27,35 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
  * Date: 8/6/14
  */
 public class ShardReadWriteTransaction extends ShardTransaction {
-  private final DOMStoreReadWriteTransaction transaction;
-  private final LoggingAdapter log =
-      Logging.getLogger(getContext().system(), this);
-  public ShardReadWriteTransaction(DOMStoreTransactionChain transactionChain, DOMStoreReadWriteTransaction transaction, ActorRef shardActor, SchemaContext schemaContext) {
-    super(transactionChain,  shardActor, schemaContext);
-    this.transaction = transaction;
-  }
-
-  public ShardReadWriteTransaction(DOMStoreReadWriteTransaction transaction, ActorRef shardActor, SchemaContext schemaContext) {
-    super( shardActor, schemaContext);
-    this.transaction = transaction;
-  }
+    private final DOMStoreReadWriteTransaction transaction;
 
-  @Override
-  public void handleReceive(Object message) throws Exception {
-    if (ReadData.SERIALIZABLE_CLASS.equals(message.getClass())) {
-      readData(transaction,ReadData.fromSerializable(message));
-    }else if (WriteData.SERIALIZABLE_CLASS.equals(message.getClass())) {
-      writeData(transaction, WriteData.fromSerializable(message, schemaContext));
-    } else if (MergeData.SERIALIZABLE_CLASS.equals(message.getClass())) {
-      mergeData(transaction, MergeData.fromSerializable(message, schemaContext));
-    } else if (DeleteData.SERIALIZABLE_CLASS.equals(message.getClass())) {
-      deleteData(transaction,DeleteData.fromSerializable(message));
-    } else if (ReadyTransaction.SERIALIZABLE_CLASS.equals(message.getClass())) {
-      readyTransaction(transaction,new ReadyTransaction());
-    } else if(DataExists.SERIALIZABLE_CLASS.equals(message.getClass())) {
-        dataExists(transaction, DataExists.fromSerializable(message));
-    }else {
-      super.handleReceive(message);
+    public ShardReadWriteTransaction(DOMStoreReadWriteTransaction transaction, ActorRef shardActor,
+            SchemaContext schemaContext) {
+        super(shardActor, schemaContext);
+        this.transaction = transaction;
     }
-  }
 
-  protected void closeTransaction(CloseTransaction message) {
-    transaction.close();
-    getSender().tell(new CloseTransactionReply().toSerializable(), getSelf());
-    getSelf().tell(PoisonPill.getInstance(), getSelf());
-  }
+    @Override
+    public void handleReceive(Object message) throws Exception {
+        if(ReadData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+            readData(transaction, ReadData.fromSerializable(message));
+        } else if(WriteData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+            writeData(transaction, WriteData.fromSerializable(message, schemaContext));
+        } else if(MergeData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+            mergeData(transaction, MergeData.fromSerializable(message, schemaContext));
+        } else if(DeleteData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+            deleteData(transaction, DeleteData.fromSerializable(message));
+        } else if(ReadyTransaction.SERIALIZABLE_CLASS.equals(message.getClass())) {
+            readyTransaction(transaction, new ReadyTransaction());
+        } else if(DataExists.SERIALIZABLE_CLASS.equals(message.getClass())) {
+            dataExists(transaction, DataExists.fromSerializable(message));
+        } else {
+            super.handleReceive(message);
+        }
+    }
 
-    /**
-     * The following method is used in unit testing only
-     * hence the default scope.
-     * This is done to test out failure cases.
-     */
-    public void forUnitTestOnlyExplicitTransactionClose() {
-        transaction.close();
+    @Override
+    protected DOMStoreTransaction getDOMStoreTransaction() {
+        return transaction;
     }
 }
index 360a10722c06df2c3e357631b43d89eac801a3d3..365960713dc84754258b364765d0c0f0b794d83b 100644 (file)
@@ -9,14 +9,17 @@
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorRef;
+import akka.actor.PoisonPill;
 import akka.actor.Props;
-import akka.event.Logging;
-import akka.event.LoggingAdapter;
+import akka.actor.ReceiveTimeout;
 import akka.japi.Creator;
+
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
+
 import org.opendaylight.controller.cluster.datastore.exceptions.UnknownMessageException;
 import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction;
+import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionReply;
 import org.opendaylight.controller.cluster.datastore.messages.DataExists;
 import org.opendaylight.controller.cluster.datastore.messages.DataExistsReply;
 import org.opendaylight.controller.cluster.datastore.messages.DeleteData;
@@ -39,7 +42,7 @@ import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
+import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
@@ -69,142 +72,74 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
  */
 public abstract class ShardTransaction extends AbstractUntypedActor {
 
-  private final ActorRef shardActor;
-  protected final SchemaContext schemaContext;
-
-  // FIXME : see below
-  // If transactionChain is not null then this transaction is part of a
-  // transactionChain. Not really clear as to what that buys us
-  private final DOMStoreTransactionChain transactionChain;
-
-
-  private final MutableCompositeModification modification =
-      new MutableCompositeModification();
-
-  private final LoggingAdapter log =
-      Logging.getLogger(getContext().system(), this);
-
-  protected ShardTransaction(
-                          ActorRef shardActor, SchemaContext schemaContext) {
-    this(null,  shardActor, schemaContext);
-  }
-
-  protected ShardTransaction(DOMStoreTransactionChain transactionChain,
-                          ActorRef shardActor, SchemaContext schemaContext) {
-    this.transactionChain = transactionChain;
-    this.shardActor = shardActor;
-    this.schemaContext = schemaContext;
-  }
-
-
-
-  public static Props props(final DOMStoreReadTransaction transaction,
-                            final ActorRef shardActor, final SchemaContext schemaContext) {
-    return Props.create(new Creator<ShardTransaction>() {
-
-      @Override
-      public ShardTransaction create() throws Exception {
-        return new ShardReadTransaction(transaction, shardActor, schemaContext);
-      }
-    });
-  }
-
-  public static Props props(final DOMStoreTransactionChain transactionChain, final DOMStoreReadTransaction transaction,
-                            final ActorRef shardActor, final SchemaContext schemaContext) {
-    return Props.create(new Creator<ShardTransaction>() {
-
-      @Override
-      public ShardTransaction create() throws Exception {
-        return new ShardReadTransaction(transactionChain, transaction, shardActor, schemaContext);
-      }
-    });
-  }
-
-  public static Props props(final DOMStoreReadWriteTransaction transaction,
-                            final ActorRef shardActor, final SchemaContext schemaContext) {
-    return Props.create(new Creator<ShardTransaction>() {
-
-      @Override
-      public ShardTransaction create() throws Exception {
-        return new ShardReadWriteTransaction(transaction, shardActor, schemaContext);
-      }
-    });
-  }
-
-  public static Props props(final DOMStoreTransactionChain transactionChain, final DOMStoreReadWriteTransaction transaction,
-                            final ActorRef shardActor, final SchemaContext schemaContext) {
-    return Props.create(new Creator<ShardTransaction>() {
-
-      @Override
-      public ShardTransaction create() throws Exception {
-        return new ShardReadWriteTransaction(transactionChain, transaction, shardActor, schemaContext);
-      }
-    });
-  }
-
-
-  public static Props props(final DOMStoreWriteTransaction transaction,
-                            final ActorRef shardActor, final SchemaContext schemaContext) {
-    return Props.create(new Creator<ShardTransaction>() {
-
-      @Override
-      public ShardTransaction create() throws Exception {
-        return new ShardWriteTransaction(transaction, shardActor, schemaContext);
-      }
-    });
-  }
-
-  public static Props props(final DOMStoreTransactionChain transactionChain, final DOMStoreWriteTransaction transaction,
-                            final ActorRef shardActor, final SchemaContext schemaContext) {
-    return Props.create(new Creator<ShardTransaction>() {
-
-      @Override
-      public ShardTransaction create() throws Exception {
-        return new ShardWriteTransaction(transactionChain, transaction, shardActor, schemaContext);
-      }
-    });
-  }
-
-
-  @Override
-  public void handleReceive(Object message) throws Exception {
-     if (message.getClass().equals(CloseTransaction.SERIALIZABLE_CLASS)) {
-      closeTransaction(new CloseTransaction());
-    } else if (message instanceof GetCompositedModification) {
-      // This is here for testing only
-      getSender().tell(new GetCompositeModificationReply(
-          new ImmutableCompositeModification(modification)), getSelf());
-    }else{
-         throw new UnknownMessageException(message);
+    private final ActorRef shardActor;
+    protected final SchemaContext schemaContext;
+
+    private final MutableCompositeModification modification = new MutableCompositeModification();
+
+    protected ShardTransaction(ActorRef shardActor, SchemaContext schemaContext) {
+        this.shardActor = shardActor;
+        this.schemaContext = schemaContext;
     }
-  }
 
-  abstract protected  void closeTransaction(CloseTransaction message);
+    public static Props props(DOMStoreTransaction transaction, ActorRef shardActor,
+            SchemaContext schemaContext, ShardContext shardContext) {
+        return Props.create(new ShardTransactionCreator(transaction, shardActor, schemaContext,
+                shardContext));
+    }
 
-  protected void readData(DOMStoreReadTransaction transaction,ReadData message) {
-    final ActorRef sender = getSender();
-    final ActorRef self = getSelf();
-    final YangInstanceIdentifier path = message.getPath();
-    final CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> future =
-          transaction.read(path);
+    protected abstract DOMStoreTransaction getDOMStoreTransaction();
+
+    @Override
+    public void handleReceive(Object message) throws Exception {
+        if (message.getClass().equals(CloseTransaction.SERIALIZABLE_CLASS)) {
+            closeTransaction(true);
+        } else if (message instanceof GetCompositedModification) {
+            // This is here for testing only
+            getSender().tell(new GetCompositeModificationReply(
+                    new ImmutableCompositeModification(modification)), getSelf());
+        } else if (message instanceof ReceiveTimeout) {
+            LOG.debug("Got ReceiveTimeout for inactivity - closing Tx");
+            closeTransaction(false);
+        } else {
+            throw new UnknownMessageException(message);
+        }
+    }
 
-      future.addListener(new Runnable() {
-      @Override
-      public void run() {
-        try {
-          Optional<NormalizedNode<?, ?>> optional = future.checkedGet();
-          if (optional.isPresent()) {
-            sender.tell(new ReadDataReply(schemaContext,optional.get()).toSerializable(), self);
-          } else {
-            sender.tell(new ReadDataReply(schemaContext,null).toSerializable(), self);
-          }
-        } catch (Exception e) {
-            sender.tell(new akka.actor.Status.Failure(e),self);
+    private void closeTransaction(boolean sendReply) {
+        getDOMStoreTransaction().close();
+
+        if(sendReply) {
+            getSender().tell(new CloseTransactionReply().toSerializable(), getSelf());
         }
 
-      }
-    }, getContext().dispatcher());
-  }
+        getSelf().tell(PoisonPill.getInstance(), getSelf());
+    }
+
+    protected void readData(DOMStoreReadTransaction transaction,ReadData message) {
+        final ActorRef sender = getSender();
+        final ActorRef self = getSelf();
+        final YangInstanceIdentifier path = message.getPath();
+        final CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> future =
+                transaction.read(path);
+
+        future.addListener(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    Optional<NormalizedNode<?, ?>> optional = future.checkedGet();
+                    if (optional.isPresent()) {
+                        sender.tell(new ReadDataReply(schemaContext,optional.get()).toSerializable(), self);
+                    } else {
+                        sender.tell(new ReadDataReply(schemaContext,null).toSerializable(), self);
+                    }
+                } catch (Exception e) {
+                    sender.tell(new akka.actor.Status.Failure(e),self);
+                }
+
+            }
+        }, getContext().dispatcher());
+    }
 
     protected void dataExists(DOMStoreReadTransaction transaction, DataExists message) {
         final YangInstanceIdentifier path = message.getPath();
@@ -218,71 +153,104 @@ public abstract class ShardTransaction extends AbstractUntypedActor {
 
     }
 
-  protected void writeData(DOMStoreWriteTransaction transaction, WriteData message) {
-    modification.addModification(
-        new WriteModification(message.getPath(), message.getData(),schemaContext));
-    LOG.debug("writeData at path : " + message.getPath().toString());
+    protected void writeData(DOMStoreWriteTransaction transaction, WriteData message) {
+        modification.addModification(
+                new WriteModification(message.getPath(), message.getData(),schemaContext));
+        LOG.debug("writeData at path : " + message.getPath().toString());
 
-    try {
-        transaction.write(message.getPath(), message.getData());
-        getSender().tell(new WriteDataReply().toSerializable(), getSelf());
-    }catch(Exception e){
-        getSender().tell(new akka.actor.Status.Failure(e), getSelf());
+        try {
+            transaction.write(message.getPath(), message.getData());
+            getSender().tell(new WriteDataReply().toSerializable(), getSelf());
+        }catch(Exception e){
+            getSender().tell(new akka.actor.Status.Failure(e), getSelf());
+        }
     }
-  }
-
-  protected void mergeData(DOMStoreWriteTransaction transaction, MergeData message) {
-    modification.addModification(
-        new MergeModification(message.getPath(), message.getData(), schemaContext));
-    LOG.debug("mergeData at path : " + message.getPath().toString());
-    try {
-        transaction.merge(message.getPath(), message.getData());
-        getSender().tell(new MergeDataReply().toSerializable(), getSelf());
-    }catch(Exception e){
-        getSender().tell(new akka.actor.Status.Failure(e), getSelf());
+
+    protected void mergeData(DOMStoreWriteTransaction transaction, MergeData message) {
+        modification.addModification(
+                new MergeModification(message.getPath(), message.getData(), schemaContext));
+        LOG.debug("mergeData at path : " + message.getPath().toString());
+        try {
+            transaction.merge(message.getPath(), message.getData());
+            getSender().tell(new MergeDataReply().toSerializable(), getSelf());
+        }catch(Exception e){
+            getSender().tell(new akka.actor.Status.Failure(e), getSelf());
+        }
     }
-  }
-
-  protected void deleteData(DOMStoreWriteTransaction transaction, DeleteData message) {
-    LOG.debug("deleteData at path : " + message.getPath().toString());
-    modification.addModification(new DeleteModification(message.getPath()));
-    try {
-        transaction.delete(message.getPath());
-        getSender().tell(new DeleteDataReply().toSerializable(), getSelf());
-    }catch(Exception e){
-        getSender().tell(new akka.actor.Status.Failure(e), getSelf());
+
+    protected void deleteData(DOMStoreWriteTransaction transaction, DeleteData message) {
+        LOG.debug("deleteData at path : " + message.getPath().toString());
+        modification.addModification(new DeleteModification(message.getPath()));
+        try {
+            transaction.delete(message.getPath());
+            getSender().tell(new DeleteDataReply().toSerializable(), getSelf());
+        }catch(Exception e){
+            getSender().tell(new akka.actor.Status.Failure(e), getSelf());
+        }
     }
-  }
 
-  protected void readyTransaction(DOMStoreWriteTransaction transaction, ReadyTransaction message) {
-    DOMStoreThreePhaseCommitCohort cohort =  transaction.ready();
-    ActorRef cohortActor = getContext().actorOf(
-        ThreePhaseCommitCohort.props(cohort, shardActor, modification), "cohort");
-    getSender()
+    protected void readyTransaction(DOMStoreWriteTransaction transaction, ReadyTransaction message) {
+        DOMStoreThreePhaseCommitCohort cohort =  transaction.ready();
+        ActorRef cohortActor = getContext().actorOf(
+                ThreePhaseCommitCohort.props(cohort, shardActor, modification), "cohort");
+        getSender()
         .tell(new ReadyTransactionReply(cohortActor.path()).toSerializable(), getSelf());
 
-  }
+    }
 
+    private static class ShardTransactionCreator implements Creator<ShardTransaction> {
 
-  // These classes are in here for test purposes only
+        private static final long serialVersionUID = 1L;
 
+        final DOMStoreTransaction transaction;
+        final ActorRef shardActor;
+        final SchemaContext schemaContext;
+        final ShardContext shardContext;
 
-  static class GetCompositedModification {
+        ShardTransactionCreator(DOMStoreTransaction transaction, ActorRef shardActor,
+                SchemaContext schemaContext, ShardContext actorContext) {
+            this.transaction = transaction;
+            this.shardActor = shardActor;
+            this.shardContext = actorContext;
+            this.schemaContext = schemaContext;
+        }
 
-  }
+        @Override
+        public ShardTransaction create() throws Exception {
+            ShardTransaction tx;
+            if(transaction instanceof DOMStoreReadWriteTransaction) {
+                tx = new ShardReadWriteTransaction((DOMStoreReadWriteTransaction)transaction,
+                        shardActor, schemaContext);
+            } else if(transaction instanceof DOMStoreReadTransaction) {
+                tx = new ShardReadTransaction((DOMStoreReadTransaction)transaction, shardActor,
+                        schemaContext);
+            } else {
+                tx = new ShardWriteTransaction((DOMStoreWriteTransaction)transaction,
+                        shardActor, schemaContext);
+            }
+
+            tx.getContext().setReceiveTimeout(shardContext.getShardTransactionIdleTimeout());
+            return tx;
+        }
+    }
 
+    // These classes are in here for test purposes only
 
-  static class GetCompositeModificationReply {
-    private final CompositeModification modification;
+    static class GetCompositedModification {
+    }
 
 
-    GetCompositeModificationReply(CompositeModification modification) {
-      this.modification = modification;
-    }
+    static class GetCompositeModificationReply {
+        private final CompositeModification modification;
 
 
-    public CompositeModification getModification() {
-      return modification;
+        GetCompositeModificationReply(CompositeModification modification) {
+            this.modification = modification;
+        }
+
+
+        public CompositeModification getModification() {
+            return modification;
+        }
     }
-  }
 }
index c508255ea490ee09b370dae8a49320495166c820..42bd257ad1cdb97b3d28ab2588bbe6161894b8e9 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.controller.cluster.datastore;
 import akka.actor.ActorRef;
 import akka.actor.Props;
 import akka.japi.Creator;
+
 import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChain;
 import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChainReply;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
@@ -24,10 +25,13 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 public class ShardTransactionChain extends AbstractUntypedActor {
 
     private final DOMStoreTransactionChain chain;
+    private final ShardContext shardContext;
     private final SchemaContext schemaContext;
 
-    public ShardTransactionChain(DOMStoreTransactionChain chain, SchemaContext schemaContext) {
+    public ShardTransactionChain(DOMStoreTransactionChain chain, SchemaContext schemaContext,
+            ShardContext shardContext) {
         this.chain = chain;
+        this.shardContext = shardContext;
         this.schemaContext = schemaContext;
     }
 
@@ -48,23 +52,29 @@ public class ShardTransactionChain extends AbstractUntypedActor {
         return getContext().parent();
     }
 
-  private ActorRef createTypedTransactionActor(CreateTransaction createTransaction,String transactionId){
-    if(createTransaction.getTransactionType()== TransactionProxy.TransactionType.READ_ONLY.ordinal()){
-      return getContext().actorOf(
-          ShardTransaction.props( chain.newReadOnlyTransaction(), getShardActor(), schemaContext), transactionId);
-
-    }else if (createTransaction.getTransactionType()== TransactionProxy.TransactionType.READ_WRITE.ordinal()){
-      return getContext().actorOf(
-          ShardTransaction.props( chain.newReadWriteTransaction(), getShardActor(), schemaContext), transactionId);
-
-
-    }else if (createTransaction.getTransactionType()== TransactionProxy.TransactionType.WRITE_ONLY.ordinal()){
-      return getContext().actorOf(
-          ShardTransaction.props( chain.newWriteOnlyTransaction(), getShardActor(), schemaContext), transactionId);
-    }else{
-      throw new IllegalArgumentException ("CreateTransaction message has unidentified transaction type="+createTransaction.getTransactionType()) ;
+    private ActorRef createTypedTransactionActor(CreateTransaction createTransaction,
+            String transactionId) {
+        if(createTransaction.getTransactionType() ==
+                TransactionProxy.TransactionType.READ_ONLY.ordinal()) {
+            return getContext().actorOf(
+                    ShardTransaction.props( chain.newReadOnlyTransaction(), getShardActor(),
+                            schemaContext, shardContext), transactionId);
+        } else if (createTransaction.getTransactionType() ==
+                TransactionProxy.TransactionType.READ_WRITE.ordinal()) {
+            return getContext().actorOf(
+                    ShardTransaction.props( chain.newReadWriteTransaction(), getShardActor(),
+                            schemaContext, shardContext), transactionId);
+        } else if (createTransaction.getTransactionType() ==
+                TransactionProxy.TransactionType.WRITE_ONLY.ordinal()) {
+            return getContext().actorOf(
+                    ShardTransaction.props( chain.newWriteOnlyTransaction(), getShardActor(),
+                            schemaContext, shardContext), transactionId);
+        } else {
+            throw new IllegalArgumentException (
+                    "CreateTransaction message has unidentified transaction type=" +
+                             createTransaction.getTransactionType());
+        }
     }
-  }
 
     private void createTransaction(CreateTransaction createTransaction) {
 
@@ -74,13 +84,28 @@ public class ShardTransactionChain extends AbstractUntypedActor {
                 getSelf());
     }
 
-    public static Props props(final DOMStoreTransactionChain chain, final SchemaContext schemaContext) {
-        return Props.create(new Creator<ShardTransactionChain>() {
+    public static Props props(DOMStoreTransactionChain chain, SchemaContext schemaContext,
+            ShardContext shardContext) {
+        return Props.create(new ShardTransactionChainCreator(chain, schemaContext, shardContext));
+    }
 
-            @Override
-            public ShardTransactionChain create() throws Exception {
-                return new ShardTransactionChain(chain, schemaContext);
-            }
-        });
+    private static class ShardTransactionChainCreator implements Creator<ShardTransactionChain> {
+        private static final long serialVersionUID = 1L;
+
+        final DOMStoreTransactionChain chain;
+        final ShardContext shardContext;
+        final SchemaContext schemaContext;
+
+        ShardTransactionChainCreator(DOMStoreTransactionChain chain, SchemaContext schemaContext,
+                ShardContext shardContext) {
+            this.chain = chain;
+            this.shardContext = shardContext;
+            this.schemaContext = schemaContext;
+        }
+
+        @Override
+        public ShardTransactionChain create() throws Exception {
+            return new ShardTransactionChain(chain, schemaContext, shardContext);
+        }
     }
 }
index b01fe7d4ac11a4a0eea7cfa28b16f5bea8e7aec5..8b4d576163c94b873a3fd09ed99bd580392813bc 100644 (file)
 package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorRef;
-import akka.actor.PoisonPill;
-import akka.event.Logging;
-import akka.event.LoggingAdapter;
-import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction;
-import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionReply;
+
 import org.opendaylight.controller.cluster.datastore.messages.DeleteData;
 import org.opendaylight.controller.cluster.datastore.messages.MergeData;
 import org.opendaylight.controller.cluster.datastore.messages.ReadyTransaction;
 import org.opendaylight.controller.cluster.datastore.messages.WriteData;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
+import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
@@ -29,47 +25,31 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
  * Date: 8/6/14
  */
 public class ShardWriteTransaction extends ShardTransaction {
-  private final DOMStoreWriteTransaction transaction;
-  private final LoggingAdapter log =
-      Logging.getLogger(getContext().system(), this);
-  public ShardWriteTransaction(DOMStoreWriteTransaction transaction, ActorRef shardActor, SchemaContext schemaContext) {
-    super( shardActor, schemaContext);
-    this.transaction = transaction;
-
-  }
+    private final DOMStoreWriteTransaction transaction;
 
-  public ShardWriteTransaction(DOMStoreTransactionChain transactionChain, DOMStoreWriteTransaction transaction, ActorRef shardActor, SchemaContext schemaContext) {
-    super(transactionChain, shardActor, schemaContext);
-    this.transaction = transaction;
-  }
-
-  @Override
-  public void handleReceive(Object message) throws Exception {
-    if (WriteData.SERIALIZABLE_CLASS.equals(message.getClass())) {
-      writeData(transaction, WriteData.fromSerializable(message, schemaContext));
-    } else if (MergeData.SERIALIZABLE_CLASS.equals(message.getClass())) {
-      mergeData(transaction, MergeData.fromSerializable(message, schemaContext));
-    } else if (DeleteData.SERIALIZABLE_CLASS.equals(message.getClass())) {
-      deleteData(transaction,DeleteData.fromSerializable(message));
-    } else if (ReadyTransaction.SERIALIZABLE_CLASS.equals(message.getClass())) {
-      readyTransaction(transaction,new ReadyTransaction());
-    }else {
-      super.handleReceive(message);
+    public ShardWriteTransaction(DOMStoreWriteTransaction transaction, ActorRef shardActor,
+            SchemaContext schemaContext) {
+        super(shardActor, schemaContext);
+        this.transaction = transaction;
     }
-  }
 
-  protected void closeTransaction(CloseTransaction message) {
-    transaction.close();
-    getSender().tell(new CloseTransactionReply().toSerializable(), getSelf());
-    getSelf().tell(PoisonPill.getInstance(), getSelf());
-  }
+    @Override
+    public void handleReceive(Object message) throws Exception {
+        if(WriteData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+            writeData(transaction, WriteData.fromSerializable(message, schemaContext));
+        } else if(MergeData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+            mergeData(transaction, MergeData.fromSerializable(message, schemaContext));
+        } else if(DeleteData.SERIALIZABLE_CLASS.equals(message.getClass())) {
+            deleteData(transaction, DeleteData.fromSerializable(message));
+        } else if(ReadyTransaction.SERIALIZABLE_CLASS.equals(message.getClass())) {
+            readyTransaction(transaction, new ReadyTransaction());
+        } else {
+            super.handleReceive(message);
+        }
+    }
 
-    /**
-     * The following method is used in unit testing only
-     * hence the default scope.
-     * This is done to test out failure cases.
-     */
-    public void forUnitTestOnlyExplicitTransactionClose() {
-        transaction.close();
+    @Override
+    protected DOMStoreTransaction getDOMStoreTransaction() {
+        return transaction;
     }
 }
index 34d35312838fd4346e7446161cd4f1f1c8f9cc74..d0c29294cbea9b992644817436ad21fb5f81d46b 100644 (file)
@@ -14,9 +14,11 @@ import akka.actor.Props;
 import akka.event.Logging;
 import akka.event.LoggingAdapter;
 import akka.japi.Creator;
+
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
+
 import org.opendaylight.controller.cluster.datastore.messages.AbortTransaction;
 import org.opendaylight.controller.cluster.datastore.messages.AbortTransactionReply;
 import org.opendaylight.controller.cluster.datastore.messages.CanCommitTransaction;
@@ -46,16 +48,9 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor {
 
     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);
-            }
-        });
+        return Props.create(new ThreePhaseCommitCohortCreator(cohort, shardActor, modification));
     }
 
-
     @Override
     public void handleReceive(Object message) throws Exception {
         if (message.getClass()
@@ -81,12 +76,14 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor {
         final ActorRef self = getSelf();
 
         Futures.addCallback(future, new FutureCallback<Void>() {
+            @Override
             public void onSuccess(Void v) {
                 sender
                     .tell(new AbortTransactionReply().toSerializable(),
                         self);
             }
 
+            @Override
             public void onFailure(Throwable t) {
                 LOG.error(t, "An exception happened during abort");
                 sender
@@ -110,12 +107,14 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor {
         final ActorRef sender = getSender();
         final ActorRef self = getSelf();
         Futures.addCallback(future, new FutureCallback<Void>() {
+            @Override
             public void onSuccess(Void v) {
                 sender
                     .tell(new PreCommitTransactionReply().toSerializable(),
                         self);
             }
 
+            @Override
             public void onFailure(Throwable t) {
                 LOG.error(t, "An exception happened during pre-commit");
                 sender
@@ -130,18 +129,36 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor {
         final ActorRef sender = getSender();
         final ActorRef self = getSelf();
         Futures.addCallback(future, new FutureCallback<Boolean>() {
+            @Override
             public void onSuccess(Boolean canCommit) {
                 sender.tell(new CanCommitTransactionReply(canCommit)
                     .toSerializable(), self);
             }
 
+            @Override
             public void onFailure(Throwable t) {
                 LOG.error(t, "An exception happened during canCommit");
                 sender
                     .tell(new akka.actor.Status.Failure(t), self);
             }
         });
+    }
+
+    private static class ThreePhaseCommitCohortCreator implements Creator<ThreePhaseCommitCohort> {
+        final DOMStoreThreePhaseCommitCohort cohort;
+        final ActorRef shardActor;
+        final CompositeModification modification;
 
+        ThreePhaseCommitCohortCreator(DOMStoreThreePhaseCommitCohort cohort,
+                ActorRef shardActor, CompositeModification modification) {
+            this.cohort = cohort;
+            this.shardActor = shardActor;
+            this.modification = modification;
+        }
 
+        @Override
+        public ThreePhaseCommitCohort create() throws Exception {
+            return new ThreePhaseCommitCohort(cohort, shardActor, modification);
+        }
     }
 }
index 76bbef713c350ad975c9dbb256bdef83bd1e4915..9b4610a99c4a6e5977115f560d12b551131e9be5 100644 (file)
@@ -13,36 +13,33 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 /**
  * TransactionChainProxy acts as a proxy for a DOMStoreTransactionChain created on a remote shard
  */
 public class TransactionChainProxy implements DOMStoreTransactionChain{
     private final ActorContext actorContext;
-    private final SchemaContext schemaContext;
 
-    public TransactionChainProxy(ActorContext actorContext, SchemaContext schemaContext) {
+    public TransactionChainProxy(ActorContext actorContext) {
         this.actorContext = actorContext;
-        this.schemaContext = schemaContext;
     }
 
     @Override
     public DOMStoreReadTransaction newReadOnlyTransaction() {
         return new TransactionProxy(actorContext,
-            TransactionProxy.TransactionType.READ_ONLY, schemaContext);
+            TransactionProxy.TransactionType.READ_ONLY);
     }
 
     @Override
     public DOMStoreReadWriteTransaction newReadWriteTransaction() {
         return new TransactionProxy(actorContext,
-            TransactionProxy.TransactionType.READ_WRITE, schemaContext);
+            TransactionProxy.TransactionType.READ_WRITE);
     }
 
     @Override
     public DOMStoreWriteTransaction newWriteOnlyTransaction() {
         return new TransactionProxy(actorContext,
-            TransactionProxy.TransactionType.WRITE_ONLY, schemaContext);
+            TransactionProxy.TransactionType.WRITE_ONLY);
     }
 
     @Override
index 2e7b2feb85bd97c7b80d09b8156f4b44c6fb343e..f447f3c718980285d32e79c5a9b2579e26309971 100644 (file)
@@ -13,6 +13,8 @@ import akka.actor.ActorSelection;
 import akka.dispatch.OnComplete;
 
 import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.FinalizablePhantomReference;
+import com.google.common.base.FinalizableReferenceQueue;
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
@@ -52,6 +54,8 @@ import scala.runtime.AbstractFunction1;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicLong;
 
 /**
@@ -87,18 +91,98 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction {
         LOG = LoggerFactory.getLogger(TransactionProxy.class);
 
 
+    /**
+     * Used to enqueue the PhantomReferences for read-only TransactionProxy instances. The
+     * FinalizableReferenceQueue is safe to use statically in an OSGi environment as it uses some
+     * trickery to clean up its internal thread when the bundle is unloaded.
+     */
+    private static final FinalizableReferenceQueue phantomReferenceQueue =
+                                                                  new FinalizableReferenceQueue();
+
+    /**
+     * This stores the TransactionProxyCleanupPhantomReference instances statically, This is
+     * necessary because PhantomReferences need a hard reference so they're not garbage collected.
+     * Once finalized, the TransactionProxyCleanupPhantomReference removes itself from this map
+     * and thus becomes eligible for garbage collection.
+     */
+    private static final Map<TransactionProxyCleanupPhantomReference,
+                             TransactionProxyCleanupPhantomReference> phantomReferenceCache =
+                                                                        new ConcurrentHashMap<>();
+
+    /**
+     * A PhantomReference that closes remote transactions for a TransactionProxy when it's
+     * garbage collected. This is used for read-only transactions as they're not explicitly closed
+     * by clients. So the only way to detect that a transaction is no longer in use and it's safe
+     * to clean up is when it's garbage collected. It's inexact as to when an instance will be GC'ed
+     * but TransactionProxy instances should generally be short-lived enough to avoid being moved
+     * to the old generation space and thus should be cleaned up in a timely manner as the GC
+     * runs on the young generation (eden, swap1...) space much more frequently.
+     */
+    private static class TransactionProxyCleanupPhantomReference
+                                           extends FinalizablePhantomReference<TransactionProxy> {
+
+        private final List<ActorSelection> remoteTransactionActors;
+        private final AtomicBoolean remoteTransactionActorsMB;
+        private final ActorContext actorContext;
+        private final TransactionIdentifier identifier;
+
+        protected TransactionProxyCleanupPhantomReference(TransactionProxy referent) {
+            super(referent, phantomReferenceQueue);
+
+            // Note we need to cache the relevant fields from the TransactionProxy as we can't
+            // have a hard reference to the TransactionProxy instance itself.
+
+            remoteTransactionActors = referent.remoteTransactionActors;
+            remoteTransactionActorsMB = referent.remoteTransactionActorsMB;
+            actorContext = referent.actorContext;
+            identifier = referent.identifier;
+        }
+
+        @Override
+        public void finalizeReferent() {
+            LOG.trace("Cleaning up {} Tx actors for TransactionProxy {}",
+                    remoteTransactionActors.size(), identifier);
+
+            phantomReferenceCache.remove(this);
+
+            // Access the memory barrier volatile to ensure all previous updates to the
+            // remoteTransactionActors list are visible to this thread.
+
+            if(remoteTransactionActorsMB.get()) {
+                for(ActorSelection actor : remoteTransactionActors) {
+                    LOG.trace("Sending CloseTransaction to {}", actor);
+                    actorContext.sendRemoteOperationAsync(actor,
+                            new CloseTransaction().toSerializable());
+                }
+            }
+        }
+    }
+
+    /**
+     * Stores the remote Tx actors for each requested data store path to be used by the
+     * PhantomReference to close the remote Tx's. This is only used for read-only Tx's. The
+     * remoteTransactionActorsMB volatile serves as a memory barrier to publish updates to the
+     * remoteTransactionActors list so they will be visible to the thread accessing the
+     * PhantomReference.
+     */
+    private List<ActorSelection> remoteTransactionActors;
+    private AtomicBoolean remoteTransactionActorsMB;
+
+    private final Map<String, TransactionContext> remoteTransactionPaths = new HashMap<>();
+
     private final TransactionType transactionType;
     private final ActorContext actorContext;
-    private final Map<String, TransactionContext> remoteTransactionPaths = new HashMap<>();
     private final TransactionIdentifier identifier;
     private final SchemaContext schemaContext;
     private boolean inReadyState;
 
-    public TransactionProxy(ActorContext actorContext, TransactionType transactionType,
-            SchemaContext schemaContext) {
-        this.actorContext = Preconditions.checkNotNull(actorContext, "actorContext should not be null");
-        this.transactionType = Preconditions.checkNotNull(transactionType, "transactionType should not be null");
-        this.schemaContext = Preconditions.checkNotNull(schemaContext, "schemaContext should not be null");
+    public TransactionProxy(ActorContext actorContext, TransactionType transactionType) {
+        this.actorContext = Preconditions.checkNotNull(actorContext,
+                "actorContext should not be null");
+        this.transactionType = Preconditions.checkNotNull(transactionType,
+                "transactionType should not be null");
+        this.schemaContext = Preconditions.checkNotNull(actorContext.getSchemaContext(),
+                "schemaContext should not be null");
 
         String memberName = actorContext.getCurrentMemberName();
         if(memberName == null){
@@ -108,8 +192,20 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction {
         this.identifier = TransactionIdentifier.builder().memberName(memberName).counter(
                 counter.getAndIncrement()).build();
 
-        LOG.debug("Created txn {} of type {}", identifier, transactionType);
+        if(transactionType == TransactionType.READ_ONLY) {
+            // Read-only Tx's aren't explicitly closed by the client so we create a PhantomReference
+            // to close the remote Tx's when this instance is no longer in use and is garbage
+            // collected.
 
+            remoteTransactionActors = Lists.newArrayList();
+            remoteTransactionActorsMB = new AtomicBoolean();
+
+            TransactionProxyCleanupPhantomReference cleanup =
+                                              new TransactionProxyCleanupPhantomReference(this);
+            phantomReferenceCache.put(cleanup, cleanup);
+        }
+
+        LOG.debug("Created txn {} of type {}", identifier, transactionType);
     }
 
     @VisibleForTesting
@@ -226,6 +322,13 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction {
         for(TransactionContext transactionContext : remoteTransactionPaths.values()) {
             transactionContext.closeTransaction();
         }
+
+        remoteTransactionPaths.clear();
+
+        if(transactionType == TransactionType.READ_ONLY) {
+            remoteTransactionActors.clear();
+            remoteTransactionActorsMB.set(true);
+        }
     }
 
     private TransactionContext transactionContext(YangInstanceIdentifier path){
@@ -260,11 +363,20 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction {
 
                 LOG.debug("Tx {} Received transaction path = {}", identifier, transactionPath);
 
-                ActorSelection transactionActor =
-                    actorContext.actorSelection(transactionPath);
-                transactionContext =
-                    new TransactionContextImpl(shardName, transactionPath,
-                        transactionActor);
+                ActorSelection transactionActor = actorContext.actorSelection(transactionPath);
+
+                if(transactionType == TransactionType.READ_ONLY) {
+                    // Add the actor to the remoteTransactionActors list for access by the
+                    // cleanup PhantonReference.
+                    remoteTransactionActors.add(transactionActor);
+
+                    // Write to the memory barrier volatile to publish the above update to the
+                    // remoteTransactionActors list for thread visibility.
+                    remoteTransactionActorsMB.set(true);
+                }
+
+                transactionContext = new TransactionContextImpl(shardName, transactionPath,
+                        transactionActor, identifier, actorContext, schemaContext);
 
                 remoteTransactionPaths.put(shardName, transactionContext);
             } else {
@@ -273,7 +385,7 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction {
             }
         } catch(Exception e){
             LOG.debug("Tx {} Creating NoOpTransaction because of : {}", identifier, e.getMessage());
-            remoteTransactionPaths.put(shardName, new NoOpTransactionContext(shardName, e));
+            remoteTransactionPaths.put(shardName, new NoOpTransactionContext(shardName, e, identifier));
         }
     }
 
@@ -298,13 +410,15 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction {
         List<Future<Object>> getRecordedOperationFutures();
     }
 
-    private abstract class AbstractTransactionContext implements TransactionContext {
+    private static abstract class AbstractTransactionContext implements TransactionContext {
 
+        protected final TransactionIdentifier identifier;
         protected final String shardName;
         protected final List<Future<Object>> recordedOperationFutures = Lists.newArrayList();
 
-        AbstractTransactionContext(String shardName) {
+        AbstractTransactionContext(String shardName, TransactionIdentifier identifier) {
             this.shardName = shardName;
+            this.identifier = identifier;
         }
 
         @Override
@@ -318,17 +432,22 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction {
         }
     }
 
-    private class TransactionContextImpl extends AbstractTransactionContext {
+    private static class TransactionContextImpl extends AbstractTransactionContext {
         private final Logger LOG = LoggerFactory.getLogger(TransactionContextImpl.class);
 
+        private final ActorContext actorContext;
+        private final SchemaContext schemaContext;
         private final String actorPath;
         private final ActorSelection actor;
 
         private TransactionContextImpl(String shardName, String actorPath,
-            ActorSelection actor) {
-            super(shardName);
+                ActorSelection actor, TransactionIdentifier identifier, ActorContext actorContext,
+                SchemaContext schemaContext) {
+            super(shardName, identifier);
             this.actorPath = actorPath;
             this.actor = actor;
+            this.actorContext = actorContext;
+            this.schemaContext = schemaContext;
         }
 
         private ActorSelection getActor() {
@@ -600,14 +719,15 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction {
         }
     }
 
-    private class NoOpTransactionContext extends AbstractTransactionContext {
+    private static class NoOpTransactionContext extends AbstractTransactionContext {
 
         private final Logger LOG = LoggerFactory.getLogger(NoOpTransactionContext.class);
 
         private final Exception failure;
 
-        public NoOpTransactionContext(String shardName, Exception failure){
-            super(shardName);
+        public NoOpTransactionContext(String shardName, Exception failure,
+                TransactionIdentifier identifier){
+            super(shardName, identifier);
             this.failure = failure;
         }
 
index e12a9663d1fca8a969c25166f38986ea19eab51a..818a8ca8b390ec2fcb33f2cad91ad597fa7ca758 100644 (file)
@@ -23,6 +23,8 @@ import org.opendaylight.controller.cluster.datastore.messages.FindLocalShard;
 import org.opendaylight.controller.cluster.datastore.messages.FindPrimary;
 import org.opendaylight.controller.cluster.datastore.messages.LocalShardFound;
 import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound;
+import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -50,10 +52,13 @@ public class ActorContext {
     public static final Duration AWAIT_DURATION =
         Duration.create(5, TimeUnit.SECONDS);
 
+    public static final String MAILBOX = "bounded-mailbox";
+
     private final ActorSystem actorSystem;
     private final ActorRef shardManager;
     private final ClusterWrapper clusterWrapper;
     private final Configuration configuration;
+    private volatile SchemaContext schemaContext;
 
     public ActorContext(ActorSystem actorSystem, ActorRef shardManager,
         ClusterWrapper clusterWrapper,
@@ -80,6 +85,17 @@ public class ActorContext {
         return actorSystem.actorSelection(actorPath);
     }
 
+    public void setSchemaContext(SchemaContext schemaContext) {
+        this.schemaContext = schemaContext;
+
+        if(shardManager != null) {
+            shardManager.tell(new UpdateSchemaContext(schemaContext), null);
+        }
+    }
+
+    public SchemaContext getSchemaContext() {
+        return schemaContext;
+    }
 
     /**
      * Finds the primary for a given shard
index ce31c3ad5738edc81db36f8666c67dc309cbdfb7..f5a0d3783ab011728ab0688db60b404a9c53719e 100644 (file)
@@ -1,7 +1,7 @@
 package org.opendaylight.controller.config.yang.config.distributed_datastore_provider;
 
 import org.opendaylight.controller.cluster.datastore.DistributedDataStoreFactory;
-import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreConfigProperties;
+import org.opendaylight.controller.cluster.datastore.DistributedDataStoreProperties;
 
 public class DistributedConfigDataStoreProviderModule extends
     org.opendaylight.controller.config.yang.config.distributed_datastore_provider.AbstractDistributedConfigDataStoreProviderModule {
@@ -26,10 +26,16 @@ public class DistributedConfigDataStoreProviderModule extends
 
     @Override
     public java.lang.AutoCloseable createInstance() {
+
+        ConfigProperties props = getConfigProperties();
+        if(props == null) {
+            props = new ConfigProperties();
+        }
+
         return DistributedDataStoreFactory.createInstance("config", getConfigSchemaServiceDependency(),
-                InMemoryDOMDataStoreConfigProperties.create(getConfigMaxShardDataChangeExecutorPoolSize(),
-                        getConfigMaxShardDataChangeExecutorQueueSize(),
-                        getConfigMaxShardDataChangeListenerQueueSize()));
+                new DistributedDataStoreProperties(props.getMaxShardDataChangeExecutorPoolSize(),
+                        props.getMaxShardDataChangeExecutorQueueSize(),
+                        props.getMaxShardDataChangeListenerQueueSize(),
+                        props.getShardTransactionIdleTimeoutInMinutes()));
     }
-
 }
index 4d5b07420f7cda5d0a0c1d74740026cde5e74eab..443334d11f65378871da7a6f2ae97097d4c2eb87 100644 (file)
@@ -1,7 +1,7 @@
 package org.opendaylight.controller.config.yang.config.distributed_datastore_provider;
 
 import org.opendaylight.controller.cluster.datastore.DistributedDataStoreFactory;
-import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreConfigProperties;
+import org.opendaylight.controller.cluster.datastore.DistributedDataStoreProperties;
 
 public class DistributedOperationalDataStoreProviderModule extends
     org.opendaylight.controller.config.yang.config.distributed_datastore_provider.AbstractDistributedOperationalDataStoreProviderModule {
@@ -26,11 +26,18 @@ public class DistributedOperationalDataStoreProviderModule extends
 
     @Override
     public java.lang.AutoCloseable createInstance() {
+
+        OperationalProperties props = getOperationalProperties();
+        if(props == null) {
+            props = new OperationalProperties();
+        }
+
         return DistributedDataStoreFactory.createInstance("operational",
                 getOperationalSchemaServiceDependency(),
-                InMemoryDOMDataStoreConfigProperties.create(getOperationalMaxShardDataChangeExecutorPoolSize(),
-                        getOperationalMaxShardDataChangeExecutorQueueSize(),
-                        getOperationalMaxShardDataChangeListenerQueueSize()));
+                new DistributedDataStoreProperties(props.getMaxShardDataChangeExecutorPoolSize(),
+                        props.getMaxShardDataChangeExecutorQueueSize(),
+                        props.getMaxShardDataChangeListenerQueueSize(),
+                        props.getShardTransactionIdleTimeoutInMinutes()));
     }
 
 }
index 8af9bd07d793cfb0eb0dae33414b6631d109e4a9..c29f93bb073cb712df045bf4839cc247a2b49111 100644 (file)
@@ -1,5 +1,10 @@
 
 odl-cluster-data {
+  bounded-mailbox {
+    mailbox-type = "org.opendaylight.controller.common.actor.MeteredBoundedMailbox"
+    mailbox-capacity = 1000
+    mailbox-push-timeout-time = 100ms
+  }
   akka {
     loggers = ["akka.event.slf4j.Slf4jLogger"]
     cluster {
index 6bca5ce25cefe5dbcea73279fa5395f359bb8916..a9a8a1ad986c65835018f80773707561473934b8 100644 (file)
@@ -36,36 +36,48 @@ module distributed-datastore-provider {
                 config:java-name-prefix DistributedOperationalDataStoreProvider;
      }
 
+    grouping data-store-properties {
+        leaf max-shard-data-change-executor-queue-size {
+            default 1000;
+            type uint16;
+            description "The maximum queue size for each shard's data store data change notification executor.";
+         }
+
+         leaf max-shard-data-change-executor-pool-size {
+            default 20;
+            type uint16;
+            description "The maximum thread pool size for each shard's data store data change notification executor.";
+         }
+
+         leaf max-shard-data-change-listener-queue-size {
+            default 1000;
+            type uint16;
+            description "The maximum queue size for each shard's data store data change listeners.";
+         }
+         
+         leaf shard-transaction-idle-timeout-in-minutes {
+            default 10;
+            type uint16;
+            description "The maximum amount of time a shard transaction can be idle without receiving any messages before it self-destructs.";
+         }
+    }
+    
     // Augments the 'configuration' choice node under modules/module.
     augment "/config:modules/config:module/config:configuration" {
         case distributed-config-datastore-provider {
             when "/config:modules/config:module/config:type = 'distributed-config-datastore-provider'";
-            container config-schema-service {
-                uses config:service-ref {
-                    refine type {
-                        mandatory false;
-                        config:required-identity sal:schema-service;
+                container config-schema-service {
+                    uses config:service-ref {
+                        refine type {
+                            mandatory false;
+                            config:required-identity sal:schema-service;
+                        }
                     }
                 }
-            }
 
-            leaf config-max-shard-data-change-executor-queue-size {
-                default 1000;
-                type uint16;
-                description "The maximum queue size for each shard's data store data change notification executor.";
-            }
-
-            leaf config-max-shard-data-change-executor-pool-size {
-                default 20;
-                type uint16;
-                description "The maximum thread pool size for each shard's data store data change notification executor.";
-            }
-
-            leaf config-max-shard-data-change-listener-queue-size {
-                default 1000;
-                type uint16;
-                description "The maximum queue size for each shard's data store data change listeners.";
-            }
+                container config-properties {
+                    uses data-store-properties;
+                }
         }
     }
 
@@ -82,23 +94,9 @@ module distributed-datastore-provider {
                     }
                 }
 
-            leaf operational-max-shard-data-change-executor-queue-size {
-                default 1000;
-                type uint16;
-                description "The maximum queue size for each shard's data store data change notification executor.";
-            }
-
-            leaf operational-max-shard-data-change-executor-pool-size {
-                default 20;
-                type uint16;
-                description "The maximum thread pool size for each shard's data store data change notification executor.";
-            }
-
-            leaf operational-max-shard-data-change-listener-queue-size {
-                default 1000;
-                type uint16;
-                description "The maximum queue size for each shard's data store data change listeners.";
-            }
-            }
+                container operational-properties {
+                    uses data-store-properties;
+                }
         }
+    }
 }
index 036b00a4c94bd46e77c480c32a16b7ad0b71b3f6..e70453f2d629857dd92ef24b919395af91c9b742 100644 (file)
@@ -14,6 +14,7 @@ import akka.actor.ActorSelection;
 import akka.actor.Props;
 import akka.event.Logging;
 import akka.testkit.JavaTestKit;
+
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier;
 import org.opendaylight.controller.cluster.datastore.messages.CommitTransaction;
@@ -30,6 +31,8 @@ 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 org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
 import scala.concurrent.Await;
 import scala.concurrent.Future;
 import scala.concurrent.duration.FiniteDuration;
@@ -58,22 +61,23 @@ public class BasicIntegrationTest extends AbstractActorTest {
                 ShardIdentifier.builder().memberName("member-1")
                     .shardName("inventory").type("config").build();
 
-            final Props props = Shard.props(identifier, Collections.EMPTY_MAP, null);
+            final SchemaContext schemaContext = TestModel.createTestContext();
+            ShardContext shardContext = new ShardContext();
+
+            final Props props = Shard.props(identifier, Collections.EMPTY_MAP, shardContext);
             final ActorRef shard = getSystem().actorOf(props);
 
-            new Within(duration("5 seconds")) {
+            new Within(duration("10 seconds")) {
+                @Override
                 protected void run() {
-
-
-                    shard.tell(
-                        new UpdateSchemaContext(TestModel.createTestContext()),
-                        getRef());
+                    shard.tell(new UpdateSchemaContext(schemaContext), getRef());
 
 
                     // Wait for a specific log message to show up
                     final boolean result =
                         new JavaTestKit.EventFilter<Boolean>(Logging.Info.class
                         ) {
+                            @Override
                             protected Boolean run() {
                                 return true;
                             }
@@ -87,7 +91,8 @@ public class BasicIntegrationTest extends AbstractActorTest {
                     shard.tell(new CreateTransactionChain().toSerializable(), getRef());
 
                     final ActorSelection transactionChain =
-                        new ExpectMsg<ActorSelection>(duration("1 seconds"), "CreateTransactionChainReply") {
+                        new ExpectMsg<ActorSelection>(duration("3 seconds"), "CreateTransactionChainReply") {
+                            @Override
                             protected ActorSelection match(Object in) {
                                 if (in.getClass().equals(CreateTransactionChainReply.SERIALIZABLE_CLASS)) {
                                     ActorPath transactionChainPath =
@@ -109,7 +114,8 @@ public class BasicIntegrationTest extends AbstractActorTest {
                     transactionChain.tell(new CreateTransaction("txn-1", TransactionProxy.TransactionType.WRITE_ONLY.ordinal() ).toSerializable(), getRef());
 
                     final ActorSelection transaction =
-                        new ExpectMsg<ActorSelection>(duration("1 seconds"), "CreateTransactionReply") {
+                        new ExpectMsg<ActorSelection>(duration("3 seconds"), "CreateTransactionReply") {
+                            @Override
                             protected ActorSelection match(Object in) {
                                 if (CreateTransactionReply.SERIALIZABLE_CLASS.equals(in.getClass())) {
                                     CreateTransactionReply reply = CreateTransactionReply.fromSerializable(in);
@@ -128,10 +134,11 @@ public class BasicIntegrationTest extends AbstractActorTest {
 
                     // 3. Write some data
                     transaction.tell(new WriteData(TestModel.TEST_PATH,
-                        ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext()).toSerializable(),
+                        ImmutableNodes.containerNode(TestModel.TEST_QNAME), schemaContext).toSerializable(),
                         getRef());
 
-                    Boolean writeDone = new ExpectMsg<Boolean>(duration("1 seconds"), "WriteDataReply") {
+                    Boolean writeDone = new ExpectMsg<Boolean>(duration("3 seconds"), "WriteDataReply") {
+                        @Override
                         protected Boolean match(Object in) {
                             if (in.getClass().equals(WriteDataReply.SERIALIZABLE_CLASS)) {
                                 return true;
@@ -150,7 +157,8 @@ public class BasicIntegrationTest extends AbstractActorTest {
                     transaction.tell(new ReadyTransaction().toSerializable(), getRef());
 
                     final ActorSelection cohort =
-                        new ExpectMsg<ActorSelection>(duration("1 seconds"), "ReadyTransactionReply") {
+                        new ExpectMsg<ActorSelection>(duration("3 seconds"), "ReadyTransactionReply") {
+                            @Override
                             protected ActorSelection match(Object in) {
                                 if (in.getClass().equals(ReadyTransactionReply.SERIALIZABLE_CLASS)) {
                                     ActorPath cohortPath =
@@ -173,7 +181,8 @@ public class BasicIntegrationTest extends AbstractActorTest {
                     cohort.tell(new PreCommitTransaction().toSerializable(), getRef());
 
                     Boolean preCommitDone =
-                        new ExpectMsg<Boolean>(duration("1 seconds"), "PreCommitTransactionReply") {
+                        new ExpectMsg<Boolean>(duration("3 seconds"), "PreCommitTransactionReply") {
+                            @Override
                             protected Boolean match(Object in) {
                                 if (in.getClass().equals(PreCommitTransactionReply.SERIALIZABLE_CLASS)) {
                                     return true;
index 400eab1d8eb26f8857508ff244668370eb3d9b13..be43911fe12f26caca64c82b0cfc7ca43d8e505d 100644 (file)
@@ -8,7 +8,7 @@ import org.opendaylight.controller.cluster.datastore.modification.WriteModificat
 import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
 import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
-import org.opendaylight.controller.cluster.raft.protobuff.messages.AppendEntriesMessages;
+import org.opendaylight.controller.protobuff.messages.cluster.raft.AppendEntriesMessages;
 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 
index b2ee4a49fee1b40ee86730da0044f5f987b090a9..e653c3d3717351182a6a57cf570c4a6bf6449500 100644 (file)
@@ -3,7 +3,7 @@ package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorRef;
 import akka.actor.Props;
-import junit.framework.Assert;
+import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.messages.DataChanged;
 import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
@@ -47,7 +47,7 @@ public class DataChangeListenerProxyTest extends AbstractActorTest {
 
     @Override
     public Set<YangInstanceIdentifier> getRemovedPaths() {
-      Set<YangInstanceIdentifier>ids = new HashSet();
+      Set<YangInstanceIdentifier>ids = new HashSet<>();
       ids.add( CompositeModel.TEST_PATH);
       return ids;
     }
@@ -73,9 +73,8 @@ public class DataChangeListenerProxyTest extends AbstractActorTest {
         final Props props = Props.create(MessageCollectorActor.class);
         final ActorRef actorRef = getSystem().actorOf(props);
 
-        DataChangeListenerProxy dataChangeListenerProxy =
-            new DataChangeListenerProxy(TestModel.createTestContext(),
-                getSystem().actorSelection(actorRef.path()));
+        DataChangeListenerProxy dataChangeListenerProxy = new DataChangeListenerProxy(
+                TestModel.createTestContext(), getSystem().actorSelection(actorRef.path()));
 
         dataChangeListenerProxy.onDataChanged(new MockDataChangedEvent());
 
index 26ec583b3e058108f9cc18517f5f6909847f5cd6..b39cc84ceff6943d045c7a609afcbb996e212b31 100644 (file)
@@ -24,9 +24,9 @@ import static org.junit.Assert.assertTrue;
 public class DataChangeListenerTest extends AbstractActorTest {
 
     private static class MockDataChangedEvent implements AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> {
-       Map<YangInstanceIdentifier,NormalizedNode<?,?>> createdData = new HashMap();
-       Map<YangInstanceIdentifier,NormalizedNode<?,?>> updatedData = new HashMap();
-       Map<YangInstanceIdentifier,NormalizedNode<?,?>> originalData = new HashMap();
+       Map<YangInstanceIdentifier,NormalizedNode<?,?>> createdData = new HashMap<>();
+       Map<YangInstanceIdentifier,NormalizedNode<?,?>> updatedData = new HashMap<>();
+       Map<YangInstanceIdentifier,NormalizedNode<?,?>> originalData = new HashMap<>();
 
 
 
@@ -90,11 +90,12 @@ public class DataChangeListenerTest extends AbstractActorTest {
     public void testDataChangedWhenNotificationsAreEnabled(){
         new JavaTestKit(getSystem()) {{
             final MockDataChangeListener listener = new MockDataChangeListener();
-            final Props props = DataChangeListener.props(CompositeModel.createTestContext(),listener,CompositeModel.FAMILY_PATH );
+            final Props props = DataChangeListener.props(listener);
             final ActorRef subject =
                 getSystem().actorOf(props, "testDataChangedNotificationsEnabled");
 
             new Within(duration("1 seconds")) {
+                @Override
                 protected void run() {
 
                     // Let the DataChangeListener know that notifications should
@@ -107,6 +108,7 @@ public class DataChangeListenerTest extends AbstractActorTest {
 
                     final Boolean out = new ExpectMsg<Boolean>(duration("800 millis"), "dataChanged") {
                         // do not put code outside this method, will run afterwards
+                        @Override
                         protected Boolean match(Object in) {
                             if (in != null && in.getClass().equals(DataChangedReply.class)) {
 
@@ -123,8 +125,6 @@ public class DataChangeListenerTest extends AbstractActorTest {
 
                     expectNoMsg();
                 }
-
-
             };
         }};
     }
@@ -133,11 +133,12 @@ public class DataChangeListenerTest extends AbstractActorTest {
     public void testDataChangedWhenNotificationsAreDisabled(){
         new JavaTestKit(getSystem()) {{
             final MockDataChangeListener listener = new MockDataChangeListener();
-            final Props props = DataChangeListener.props(CompositeModel.createTestContext(),listener,CompositeModel.FAMILY_PATH );
+            final Props props = DataChangeListener.props(listener);
             final ActorRef subject =
                 getSystem().actorOf(props, "testDataChangedNotificationsDisabled");
 
             new Within(duration("1 seconds")) {
+                @Override
                 protected void run() {
 
                     subject.tell(
@@ -146,8 +147,6 @@ public class DataChangeListenerTest extends AbstractActorTest {
 
                     expectNoMsg();
                 }
-
-
             };
         }};
     }
index 49408b741019c98debbe70b37857d871d0f80b8b..21aa00e9e0b98c60b2d117fa67f36864e0c7700a 100644 (file)
@@ -3,9 +3,12 @@ package org.opendaylight.controller.cluster.datastore;
 import akka.actor.ActorSystem;
 import akka.event.Logging;
 import akka.testkit.JavaTestKit;
+
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.ListenableFuture;
+
 import junit.framework.Assert;
+
 import org.apache.commons.io.FileUtils;
 import org.junit.After;
 import org.junit.Before;
@@ -69,10 +72,13 @@ public class DistributedDataStoreIntegrationTest {
             {
 
                 new Within(duration("10 seconds")) {
+                    @Override
                     protected void run() {
                         try {
                             final DistributedDataStore distributedDataStore =
-                                new DistributedDataStore(getSystem(), "config", new MockClusterWrapper(), configuration, null);
+                                new DistributedDataStore(getSystem(), "config",
+                                        new MockClusterWrapper(), configuration,
+                                        new DistributedDataStoreProperties());
 
                             distributedDataStore.onGlobalContextUpdated(TestModel.createTestContext());
 
@@ -80,6 +86,7 @@ public class DistributedDataStoreIntegrationTest {
                             final boolean result =
                                 new JavaTestKit.EventFilter<Boolean>(Logging.Info.class
                                     ) {
+                                    @Override
                                     protected Boolean run() {
                                         return true;
                                     }
@@ -150,6 +157,7 @@ public class DistributedDataStoreIntegrationTest {
             {
 
                 new Within(duration("10 seconds")) {
+                    @Override
                     protected void run() {
                         try {
                             final DistributedDataStore distributedDataStore =
@@ -164,6 +172,7 @@ public class DistributedDataStoreIntegrationTest {
                                 new JavaTestKit.EventFilter<Boolean>(
                                     Logging.Info.class
                                 ) {
+                                    @Override
                                     protected Boolean run() {
                                         return true;
                                     }
index 69590e62fb1b5886fc0b5fb1223706d02c1706cd..cb473cb9360e03656ea83d0212ef18b70237a92e 100644 (file)
@@ -3,6 +3,7 @@ package org.opendaylight.controller.cluster.datastore;
 import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
 import akka.actor.Props;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -63,12 +64,14 @@ public class DistributedDataStoreTest extends AbstractActorTest{
 
     }
 
+    @SuppressWarnings("resource")
     @Test
     public void testConstructor(){
         ActorSystem actorSystem = mock(ActorSystem.class);
 
         new DistributedDataStore(actorSystem, "config",
-            mock(ClusterWrapper.class), mock(Configuration.class), null);
+            mock(ClusterWrapper.class), mock(Configuration.class),
+            new DistributedDataStoreProperties());
 
         verify(actorSystem).actorOf(any(Props.class), eq("shardmanager-config"));
     }
index 499b4e1f3111d097cc0696aa7cd23367fc4c591d..d16e4f53de7552bd23a1be0ca8d022071bd07245 100644 (file)
@@ -42,11 +42,12 @@ public class ShardManagerTest {
         new JavaTestKit(system) {{
             final Props props = ShardManager
                 .props("config", new MockClusterWrapper(),
-                    new MockConfiguration(), null);
+                    new MockConfiguration(), new ShardContext());
             final TestActorRef<ShardManager> subject =
                 TestActorRef.create(system, props);
 
-            new Within(duration("1 seconds")) {
+            new Within(duration("10 seconds")) {
+                @Override
                 protected void run() {
 
                     subject.tell(new FindPrimary("inventory").toSerializable(), getRef());
@@ -66,11 +67,12 @@ public class ShardManagerTest {
         new JavaTestKit(system) {{
             final Props props = ShardManager
                 .props("config", new MockClusterWrapper(),
-                    new MockConfiguration(), null);
+                    new MockConfiguration(), new ShardContext());
             final TestActorRef<ShardManager> subject =
                 TestActorRef.create(system, props);
 
-            new Within(duration("1 seconds")) {
+            new Within(duration("10 seconds")) {
+                @Override
                 protected void run() {
 
                     subject.tell(new FindPrimary(Shard.DEFAULT_NAME).toSerializable(), getRef());
@@ -89,16 +91,18 @@ public class ShardManagerTest {
         new JavaTestKit(system) {{
             final Props props = ShardManager
                 .props("config", new MockClusterWrapper(),
-                    new MockConfiguration(), null);
+                    new MockConfiguration(), new ShardContext());
             final TestActorRef<ShardManager> subject =
                 TestActorRef.create(system, props);
 
-            new Within(duration("1 seconds")) {
+            new Within(duration("10 seconds")) {
+                @Override
                 protected void run() {
 
                     subject.tell(new FindLocalShard("inventory"), getRef());
 
-                    final String out = new ExpectMsg<String>(duration("1 seconds"), "find local") {
+                    final String out = new ExpectMsg<String>(duration("10 seconds"), "find local") {
+                        @Override
                         protected String match(Object in) {
                             if (in instanceof LocalShardNotFound) {
                                 return ((LocalShardNotFound) in).getShardName();
@@ -124,16 +128,18 @@ public class ShardManagerTest {
         new JavaTestKit(system) {{
             final Props props = ShardManager
                 .props("config", mockClusterWrapper,
-                    new MockConfiguration(), null);
+                    new MockConfiguration(), new ShardContext());
             final TestActorRef<ShardManager> subject =
                 TestActorRef.create(system, props);
 
-            new Within(duration("1 seconds")) {
+            new Within(duration("10 seconds")) {
+                @Override
                 protected void run() {
 
                     subject.tell(new FindLocalShard(Shard.DEFAULT_NAME), getRef());
 
-                    final ActorRef out = new ExpectMsg<ActorRef>(duration("1 seconds"), "find local") {
+                    final ActorRef out = new ExpectMsg<ActorRef>(duration("10 seconds"), "find local") {
+                        @Override
                         protected ActorRef match(Object in) {
                             if (in instanceof LocalShardFound) {
                                 return ((LocalShardFound) in).getPath();
@@ -158,12 +164,13 @@ public class ShardManagerTest {
         new JavaTestKit(system) {{
             final Props props = ShardManager
                 .props("config", new MockClusterWrapper(),
-                    new MockConfiguration(), null);
+                    new MockConfiguration(), new ShardContext());
             final TestActorRef<ShardManager> subject =
                 TestActorRef.create(system, props);
 
             // the run() method needs to finish within 3 seconds
-            new Within(duration("1 seconds")) {
+            new Within(duration("10 seconds")) {
+                @Override
                 protected void run() {
 
                     MockClusterWrapper.sendMemberUp(subject, "member-2", getRef().path().toString());
@@ -172,6 +179,7 @@ public class ShardManagerTest {
 
                     final String out = new ExpectMsg<String>(duration("1 seconds"), "primary found") {
                         // do not put code outside this method, will run afterwards
+                        @Override
                         protected String match(Object in) {
                             if (in.getClass().equals(PrimaryFound.SERIALIZABLE_CLASS)) {
                                 PrimaryFound f = PrimaryFound.fromSerializable(in);
@@ -196,12 +204,13 @@ public class ShardManagerTest {
         new JavaTestKit(system) {{
             final Props props = ShardManager
                 .props("config", new MockClusterWrapper(),
-                    new MockConfiguration(), null);
+                    new MockConfiguration(), new ShardContext());
             final TestActorRef<ShardManager> subject =
                 TestActorRef.create(system, props);
 
             // the run() method needs to finish within 3 seconds
-            new Within(duration("1 seconds")) {
+            new Within(duration("10 seconds")) {
+                @Override
                 protected void run() {
 
                     MockClusterWrapper.sendMemberUp(subject, "member-2", getRef().path().toString());
index 7740b8e667a974c10b53d0e436edb41455e40cf5..fc45efcdea854bea791c44b12a4437c2c74bc2f1 100644 (file)
@@ -4,7 +4,8 @@ import akka.actor.ActorRef;
 import akka.actor.Props;
 import akka.event.Logging;
 import akka.testkit.JavaTestKit;
-import junit.framework.Assert;
+
+import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
@@ -28,11 +29,14 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
-import static junit.framework.Assert.assertFalse;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 public class ShardTest extends AbstractActorTest {
+
+    private static final ShardContext shardContext = new ShardContext();
+
     @Test
     public void testOnReceiveCreateTransactionChain() throws Exception {
         new JavaTestKit(getSystem()) {{
@@ -40,7 +44,7 @@ public class ShardTest extends AbstractActorTest {
                 ShardIdentifier.builder().memberName("member-1")
                     .shardName("inventory").type("config").build();
 
-            final Props props = Shard.props(identifier, Collections.EMPTY_MAP, null);
+            final Props props = Shard.props(identifier, Collections.EMPTY_MAP, shardContext);
             final ActorRef subject =
                 getSystem().actorOf(props, "testCreateTransactionChain");
 
@@ -49,6 +53,7 @@ public class ShardTest extends AbstractActorTest {
             final boolean result =
                 new JavaTestKit.EventFilter<Boolean>(Logging.Info.class
                 ) {
+                    @Override
                     protected Boolean run() {
                         return true;
                     }
@@ -58,13 +63,15 @@ public class ShardTest extends AbstractActorTest {
 
             Assert.assertEquals(true, result);
 
-            new Within(duration("1 seconds")) {
+            new Within(duration("3 seconds")) {
+                @Override
                 protected void run() {
 
                     subject.tell(new CreateTransactionChain().toSerializable(), getRef());
 
-                    final String out = new ExpectMsg<String>(duration("1 seconds"), "match hint") {
+                    final String out = new ExpectMsg<String>(duration("3 seconds"), "match hint") {
                         // do not put code outside this method, will run afterwards
+                        @Override
                         protected String match(Object in) {
                             if (in.getClass().equals(CreateTransactionChainReply.SERIALIZABLE_CLASS)){
                                 CreateTransactionChainReply reply =
@@ -96,11 +103,12 @@ public class ShardTest extends AbstractActorTest {
                 ShardIdentifier.builder().memberName("member-1")
                     .shardName("inventory").type("config").build();
 
-            final Props props = Shard.props(identifier, Collections.EMPTY_MAP, null);
+            final Props props = Shard.props(identifier, Collections.EMPTY_MAP, shardContext);
             final ActorRef subject =
                 getSystem().actorOf(props, "testRegisterChangeListener");
 
-            new Within(duration("1 seconds")) {
+            new Within(duration("3 seconds")) {
+                @Override
                 protected void run() {
 
                     subject.tell(
@@ -111,8 +119,10 @@ public class ShardTest extends AbstractActorTest {
                         getRef().path(), AsyncDataBroker.DataChangeScope.BASE),
                         getRef());
 
-                    final Boolean notificationEnabled = new ExpectMsg<Boolean>("enable notification") {
+                    final Boolean notificationEnabled = new ExpectMsg<Boolean>(
+                                                   duration("3 seconds"), "enable notification") {
                         // do not put code outside this method, will run afterwards
+                        @Override
                         protected Boolean match(Object in) {
                             if(in instanceof EnableNotification){
                                 return ((EnableNotification) in).isEnabled();
@@ -124,8 +134,9 @@ public class ShardTest extends AbstractActorTest {
 
                     assertFalse(notificationEnabled);
 
-                    final String out = new ExpectMsg<String>(duration("1 seconds"), "match hint") {
+                    final String out = new ExpectMsg<String>(duration("3 seconds"), "match hint") {
                         // do not put code outside this method, will run afterwards
+                        @Override
                         protected String match(Object in) {
                             if (in.getClass().equals(RegisterChangeListenerReply.class)) {
                                 RegisterChangeListenerReply reply =
@@ -154,15 +165,15 @@ public class ShardTest extends AbstractActorTest {
                 ShardIdentifier.builder().memberName("member-1")
                     .shardName("inventory").type("config").build();
 
-            final Props props = Shard.props(identifier, Collections.EMPTY_MAP, null);
+            final Props props = Shard.props(identifier, Collections.EMPTY_MAP, shardContext);
             final ActorRef subject =
                 getSystem().actorOf(props, "testCreateTransaction");
 
-
             // Wait for a specific log message to show up
             final boolean result =
                 new JavaTestKit.EventFilter<Boolean>(Logging.Info.class
                 ) {
+                    @Override
                     protected Boolean run() {
                         return true;
                     }
@@ -172,7 +183,8 @@ public class ShardTest extends AbstractActorTest {
 
             Assert.assertEquals(true, result);
 
-            new Within(duration("1 seconds")) {
+            new Within(duration("3 seconds")) {
+                @Override
                 protected void run() {
 
                     subject.tell(
@@ -182,8 +194,9 @@ public class ShardTest extends AbstractActorTest {
                     subject.tell(new CreateTransaction("txn-1", TransactionProxy.TransactionType.READ_ONLY.ordinal() ).toSerializable(),
                         getRef());
 
-                    final String out = new ExpectMsg<String>(duration("1 seconds"), "match hint") {
+                    final String out = new ExpectMsg<String>(duration("3 seconds"), "match hint") {
                         // do not put code outside this method, will run afterwards
+                        @Override
                         protected String match(Object in) {
                             if (in instanceof CreateTransactionReply) {
                                 CreateTransactionReply reply =
@@ -200,8 +213,6 @@ public class ShardTest extends AbstractActorTest {
                         out.contains("akka://test/user/testCreateTransaction/shard-txn-1"));
                     expectNoMsg();
                 }
-
-
             };
         }};
     }
@@ -216,11 +227,12 @@ public class ShardTest extends AbstractActorTest {
                     .shardName("inventory").type("config").build();
 
             peerAddresses.put(identifier, null);
-            final Props props = Shard.props(identifier, peerAddresses, null);
+            final Props props = Shard.props(identifier, peerAddresses, shardContext);
             final ActorRef subject =
                 getSystem().actorOf(props, "testPeerAddressResolved");
 
-            new Within(duration("1 seconds")) {
+            new Within(duration("3 seconds")) {
+                @Override
                 protected void run() {
 
                     subject.tell(
@@ -229,8 +241,6 @@ public class ShardTest extends AbstractActorTest {
 
                     expectNoMsg();
                 }
-
-
             };
         }};
     }
index d468af6664981d08ad603b1a841fefbdaccc8d47..0262b8c1457a171c262f5da83dc755d9bcbb174d 100644 (file)
@@ -3,8 +3,11 @@ package org.opendaylight.controller.cluster.datastore;
 import akka.actor.ActorRef;
 import akka.actor.Props;
 import akka.testkit.JavaTestKit;
+
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
+
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChain;
 import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChainReply;
@@ -12,87 +15,96 @@ import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction;
 import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply;
 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 import static org.junit.Assert.assertEquals;
 
 public class ShardTransactionChainTest extends AbstractActorTest {
 
-  private static ListeningExecutorService storeExecutor = MoreExecutors.listeningDecorator(MoreExecutors.sameThreadExecutor());
-
-  private static final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", storeExecutor,
-          MoreExecutors.sameThreadExecutor());
-
-  static {
-    store.onGlobalContextUpdated(TestModel.createTestContext());
-  }
-  @Test
-  public void testOnReceiveCreateTransaction() throws Exception {
-    new JavaTestKit(getSystem()) {{
-      final Props props = ShardTransactionChain.props(store.createTransactionChain(), TestModel.createTestContext());
-      final ActorRef subject = getSystem().actorOf(props, "testCreateTransaction");
-
-     new Within(duration("1 seconds")) {
-        @Override
-        protected void run() {
-
-          subject.tell(new CreateTransaction("txn-1", TransactionProxy.TransactionType.READ_ONLY.ordinal() ).toSerializable(), getRef());
-
-          final String out = new ExpectMsg<String>(duration("1 seconds"), "match hint") {
-            // do not put code outside this method, will run afterwards
-            @Override
-            protected String match(Object in) {
-              if (in.getClass().equals(CreateTransactionReply.SERIALIZABLE_CLASS)) {
-                return CreateTransactionReply.fromSerializable(in).getTransactionPath();
-              }else{
-                throw noMatch();
-              }
-            }
-          }.get(); // this extracts the received message
-
-          assertEquals("Unexpected transaction path " + out,
-              "akka://test/user/testCreateTransaction/shard-txn-1",
-              out);
-
-          // Will wait for the rest of the 3 seconds
-          expectNoMsg();
-        }
-
-
-      };
-    }};
-  }
-
-  @Test
-  public void testOnReceiveCloseTransactionChain() throws Exception {
-    new JavaTestKit(getSystem()) {{
-      final Props props = ShardTransactionChain.props(store.createTransactionChain(), TestModel.createTestContext());
-      final ActorRef subject = getSystem().actorOf(props, "testCloseTransactionChain");
-
-      new Within(duration("1 seconds")) {
-        @Override
-        protected void run() {
-
-          subject.tell(new CloseTransactionChain().toSerializable(), getRef());
-
-          final String out = new ExpectMsg<String>(duration("1 seconds"), "match hint") {
-            // do not put code outside this method, will run afterwards
-            @Override
-            protected String match(Object in) {
-              if (in.getClass().equals(CloseTransactionChainReply.SERIALIZABLE_CLASS)) {
-                return "match";
-              } else {
-                throw noMatch();
-              }
-            }
-          }.get(); // this extracts the received message
-
-          assertEquals("match", out);
-          // Will wait for the rest of the 3 seconds
-          expectNoMsg();
-        }
-
-
-      };
-    }};
-  }
+    private static ListeningExecutorService storeExecutor = MoreExecutors.listeningDecorator(MoreExecutors.sameThreadExecutor());
+
+    private static final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", storeExecutor,
+            MoreExecutors.sameThreadExecutor());
+
+    private static final SchemaContext testSchemaContext = TestModel.createTestContext();
+
+    private static final ShardContext shardContext = new ShardContext();
+
+    @BeforeClass
+    public static void staticSetup() {
+        store.onGlobalContextUpdated(testSchemaContext);
+    }
+
+    @Test
+    public void testOnReceiveCreateTransaction() throws Exception {
+        new JavaTestKit(getSystem()) {{
+            final Props props = ShardTransactionChain.props(store.createTransactionChain(),
+                    testSchemaContext, shardContext);
+            final ActorRef subject = getSystem().actorOf(props, "testCreateTransaction");
+
+            new Within(duration("1 seconds")) {
+                @Override
+                protected void run() {
+
+                    subject.tell(new CreateTransaction("txn-1", TransactionProxy.TransactionType.READ_ONLY.ordinal() ).toSerializable(), getRef());
+
+                    final String out = new ExpectMsg<String>(duration("1 seconds"), "match hint") {
+                        // do not put code outside this method, will run afterwards
+                        @Override
+                        protected String match(Object in) {
+                            if (in.getClass().equals(CreateTransactionReply.SERIALIZABLE_CLASS)) {
+                                return CreateTransactionReply.fromSerializable(in).getTransactionPath();
+                            }else{
+                                throw noMatch();
+                            }
+                        }
+                    }.get(); // this extracts the received message
+
+                    assertEquals("Unexpected transaction path " + out,
+                            "akka://test/user/testCreateTransaction/shard-txn-1",
+                            out);
+
+                    // Will wait for the rest of the 3 seconds
+                    expectNoMsg();
+                }
+
+
+            };
+        }};
+    }
+
+    @Test
+    public void testOnReceiveCloseTransactionChain() throws Exception {
+        new JavaTestKit(getSystem()) {{
+            final Props props = ShardTransactionChain.props(store.createTransactionChain(),
+                    testSchemaContext, shardContext);
+            final ActorRef subject = getSystem().actorOf(props, "testCloseTransactionChain");
+
+            new Within(duration("1 seconds")) {
+                @Override
+                protected void run() {
+
+                    subject.tell(new CloseTransactionChain().toSerializable(), getRef());
+
+                    final String out = new ExpectMsg<String>(duration("1 seconds"), "match hint") {
+                        // do not put code outside this method, will run afterwards
+                        @Override
+                        protected String match(Object in) {
+                            if (in.getClass().equals(CloseTransactionChainReply.SERIALIZABLE_CLASS)) {
+                                return "match";
+                            } else {
+                                throw noMatch();
+                            }
+                        }
+                    }.get(); // this extracts the received message
+
+                    assertEquals("match", out);
+                    // Will wait for the rest of the 3 seconds
+                    expectNoMsg();
+                }
+
+
+            };
+        }};
+    }
 }
index 16b73040a5b6e5375a24570fb5b1617240eadb04..8a6534b87ef5f2e21d735d6299aad58ba3ae24e1 100644 (file)
@@ -13,23 +13,29 @@ package org.opendaylight.controller.cluster.datastore;
 import akka.actor.ActorRef;
 import akka.actor.Props;
 import akka.testkit.TestActorRef;
+
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
+
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier;
+import org.opendaylight.controller.cluster.datastore.node.utils.serialization.NormalizedNodeSerializer;
 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
 import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
 import scala.concurrent.Await;
 import scala.concurrent.Future;
 import scala.concurrent.duration.Duration;
 
 import java.util.Collections;
-
-import static org.junit.Assert.assertTrue;
+import java.util.concurrent.TimeUnit;
 
 /**
  * Covers negative test cases
@@ -51,20 +57,21 @@ public class ShardTransactionFailureTest extends AbstractActorTest {
         ShardIdentifier.builder().memberName("member-1")
             .shardName("inventory").type("operational").build();
 
-    static {
+    private final ShardContext shardContext = new ShardContext();
+
+    @BeforeClass
+    public static void staticSetup() {
         store.onGlobalContextUpdated(testSchemaContext);
     }
 
-
     @Test(expected = ReadFailedException.class)
     public void testNegativeReadWithReadOnlyTransactionClosed()
         throws Throwable {
 
         final ActorRef shard =
-            getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, null));
-        final Props props =
-            ShardTransaction.props(store.newReadOnlyTransaction(), shard,
-                TestModel.createTestContext());
+            getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, new ShardContext()));
+        final Props props = ShardTransaction.props(store.newReadOnlyTransaction(), shard,
+                testSchemaContext, shardContext);
 
         final TestActorRef<ShardTransaction> subject = TestActorRef
             .create(getSystem(), props,
@@ -78,32 +85,27 @@ public class ShardTransactionFailureTest extends AbstractActorTest {
                 ).build();
         Future<Object> future =
             akka.pattern.Patterns.ask(subject, readData, 3000);
-        assertTrue(future.isCompleted());
-        Await.result(future, Duration.Zero());
+        Await.result(future, Duration.create(3, TimeUnit.SECONDS));
 
-        ((ShardReadTransaction) subject.underlyingActor())
-            .forUnitTestOnlyExplicitTransactionClose();
+        subject.underlyingActor().getDOMStoreTransaction().close();
 
         future = akka.pattern.Patterns.ask(subject, readData, 3000);
-        Await.result(future, Duration.Zero());
-
-
+        Await.result(future, Duration.create(3, TimeUnit.SECONDS));
     }
 
 
     @Test(expected = ReadFailedException.class)
-    public void testNegativeReadWithReadWriteOnlyTransactionClosed()
+    public void testNegativeReadWithReadWriteTransactionClosed()
         throws Throwable {
 
         final ActorRef shard =
-            getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP,null));
-        final Props props =
-            ShardTransaction.props(store.newReadWriteTransaction(), shard,
-                TestModel.createTestContext());
+            getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, new ShardContext()));
+        final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
+                testSchemaContext, shardContext);
 
         final TestActorRef<ShardTransaction> subject = TestActorRef
             .create(getSystem(), props,
-                "testNegativeReadWithReadWriteOnlyTransactionClosed");
+                "testNegativeReadWithReadWriteTransactionClosed");
 
         ShardTransactionMessages.ReadData readData =
             ShardTransactionMessages.ReadData.newBuilder()
@@ -111,33 +113,29 @@ public class ShardTransactionFailureTest extends AbstractActorTest {
                     NormalizedNodeMessages.InstanceIdentifier.newBuilder()
                         .build()
                 ).build();
+
         Future<Object> future =
             akka.pattern.Patterns.ask(subject, readData, 3000);
-        assertTrue(future.isCompleted());
-        Await.result(future, Duration.Zero());
+        Await.result(future, Duration.create(3, TimeUnit.SECONDS));
 
-        ((ShardReadWriteTransaction) subject.underlyingActor())
-            .forUnitTestOnlyExplicitTransactionClose();
+        subject.underlyingActor().getDOMStoreTransaction().close();
 
         future = akka.pattern.Patterns.ask(subject, readData, 3000);
-        Await.result(future, Duration.Zero());
-
-
+        Await.result(future, Duration.create(3, TimeUnit.SECONDS));
     }
 
     @Test(expected = ReadFailedException.class)
-    public void testNegativeExistsWithReadWriteOnlyTransactionClosed()
+    public void testNegativeExistsWithReadWriteTransactionClosed()
         throws Throwable {
 
         final ActorRef shard =
-            getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP,null));
-        final Props props =
-            ShardTransaction.props(store.newReadWriteTransaction(), shard,
-                TestModel.createTestContext());
+            getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, new ShardContext()));
+        final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
+                testSchemaContext, shardContext);
 
         final TestActorRef<ShardTransaction> subject = TestActorRef
             .create(getSystem(), props,
-                "testNegativeExistsWithReadWriteOnlyTransactionClosed");
+                "testNegativeExistsWithReadWriteTransactionClosed");
 
         ShardTransactionMessages.DataExists dataExists =
             ShardTransactionMessages.DataExists.newBuilder()
@@ -148,16 +146,12 @@ public class ShardTransactionFailureTest extends AbstractActorTest {
 
         Future<Object> future =
             akka.pattern.Patterns.ask(subject, dataExists, 3000);
-        assertTrue(future.isCompleted());
-        Await.result(future, Duration.Zero());
+        Await.result(future, Duration.create(3, TimeUnit.SECONDS));
 
-        ((ShardReadWriteTransaction) subject.underlyingActor())
-            .forUnitTestOnlyExplicitTransactionClose();
+        subject.underlyingActor().getDOMStoreTransaction().close();
 
         future = akka.pattern.Patterns.ask(subject, dataExists, 3000);
-        Await.result(future, Duration.Zero());
-
-
+        Await.result(future, Duration.create(3, TimeUnit.SECONDS));
     }
 
     @Test(expected = IllegalStateException.class)
@@ -165,10 +159,9 @@ public class ShardTransactionFailureTest extends AbstractActorTest {
 
 
         final ActorRef shard =
-            getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP,null));
-        final Props props =
-            ShardTransaction.props(store.newWriteOnlyTransaction(), shard,
-                TestModel.createTestContext());
+            getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, new ShardContext()));
+        final Props props = ShardTransaction.props(store.newWriteOnlyTransaction(), shard,
+                testSchemaContext, shardContext);
 
         final TestActorRef<ShardTransaction> subject = TestActorRef
             .create(getSystem(), props,
@@ -179,35 +172,29 @@ public class ShardTransactionFailureTest extends AbstractActorTest {
 
         Future<Object> future =
             akka.pattern.Patterns.ask(subject, readyTransaction, 3000);
-        assertTrue(future.isCompleted());
-        Await.result(future, Duration.Zero());
+        Await.result(future, Duration.create(3, TimeUnit.SECONDS));
 
         ShardTransactionMessages.WriteData writeData =
             ShardTransactionMessages.WriteData.newBuilder()
                 .setInstanceIdentifierPathArguments(
                     NormalizedNodeMessages.InstanceIdentifier.newBuilder()
                         .build()).setNormalizedNode(
-                NormalizedNodeMessages.Node.newBuilder().build()
+                buildNormalizedNode()
 
             ).build();
 
         future = akka.pattern.Patterns.ask(subject, writeData, 3000);
-        assertTrue(future.isCompleted());
-        Await.result(future, Duration.Zero());
-
-
+        Await.result(future, Duration.create(3, TimeUnit.SECONDS));
     }
 
-
     @Test(expected = IllegalStateException.class)
     public void testNegativeReadWriteWithTransactionReady() throws Exception {
 
 
         final ActorRef shard =
-            getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP,null));
-        final Props props =
-            ShardTransaction.props(store.newReadWriteTransaction(), shard,
-                TestModel.createTestContext());
+            getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, new ShardContext()));
+        final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
+                testSchemaContext, shardContext);
 
         final TestActorRef<ShardTransaction> subject = TestActorRef
             .create(getSystem(), props,
@@ -218,23 +205,24 @@ public class ShardTransactionFailureTest extends AbstractActorTest {
 
         Future<Object> future =
             akka.pattern.Patterns.ask(subject, readyTransaction, 3000);
-        assertTrue(future.isCompleted());
-        Await.result(future, Duration.Zero());
+        Await.result(future, Duration.create(3, TimeUnit.SECONDS));
 
         ShardTransactionMessages.WriteData writeData =
             ShardTransactionMessages.WriteData.newBuilder()
                 .setInstanceIdentifierPathArguments(
                     NormalizedNodeMessages.InstanceIdentifier.newBuilder()
-                        .build()).setNormalizedNode(
-                NormalizedNodeMessages.Node.newBuilder().build()
-
-            ).build();
+                        .build()
+                )
+                .setNormalizedNode(buildNormalizedNode())
+                .build();
 
         future = akka.pattern.Patterns.ask(subject, writeData, 3000);
-        assertTrue(future.isCompleted());
-        Await.result(future, Duration.Zero());
-
+        Await.result(future, Duration.create(3, TimeUnit.SECONDS));
+    }
 
+    private NormalizedNodeMessages.Node buildNormalizedNode() {
+        return NormalizedNodeSerializer
+            .serialize(Builders.containerBuilder().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME)).build());
     }
 
     @Test(expected = IllegalStateException.class)
@@ -242,10 +230,9 @@ public class ShardTransactionFailureTest extends AbstractActorTest {
 
 
         final ActorRef shard =
-            getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP,null));
-        final Props props =
-            ShardTransaction.props(store.newReadWriteTransaction(), shard,
-                TestModel.createTestContext());
+            getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, new ShardContext()));
+        final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
+                testSchemaContext, shardContext);
 
         final TestActorRef<ShardTransaction> subject = TestActorRef
             .create(getSystem(), props, "testNegativeMergeTransactionReady");
@@ -255,23 +242,19 @@ public class ShardTransactionFailureTest extends AbstractActorTest {
 
         Future<Object> future =
             akka.pattern.Patterns.ask(subject, readyTransaction, 3000);
-        assertTrue(future.isCompleted());
-        Await.result(future, Duration.Zero());
+        Await.result(future, Duration.create(3, TimeUnit.SECONDS));
 
         ShardTransactionMessages.MergeData mergeData =
             ShardTransactionMessages.MergeData.newBuilder()
                 .setInstanceIdentifierPathArguments(
                     NormalizedNodeMessages.InstanceIdentifier.newBuilder()
                         .build()).setNormalizedNode(
-                NormalizedNodeMessages.Node.newBuilder().build()
+                buildNormalizedNode()
 
             ).build();
 
         future = akka.pattern.Patterns.ask(subject, mergeData, 3000);
-        assertTrue(future.isCompleted());
-        Await.result(future, Duration.Zero());
-
-
+        Await.result(future, Duration.create(3, TimeUnit.SECONDS));
     }
 
 
@@ -280,10 +263,9 @@ public class ShardTransactionFailureTest extends AbstractActorTest {
 
 
         final ActorRef shard =
-            getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP,null));
-        final Props props =
-            ShardTransaction.props(store.newReadWriteTransaction(), shard,
-                TestModel.createTestContext());
+            getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, new ShardContext()));
+        final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
+                testSchemaContext, shardContext);
 
         final TestActorRef<ShardTransaction> subject = TestActorRef
             .create(getSystem(), props,
@@ -294,8 +276,7 @@ public class ShardTransactionFailureTest extends AbstractActorTest {
 
         Future<Object> future =
             akka.pattern.Patterns.ask(subject, readyTransaction, 3000);
-        assertTrue(future.isCompleted());
-        Await.result(future, Duration.Zero());
+        Await.result(future, Duration.create(3, TimeUnit.SECONDS));
 
         ShardTransactionMessages.DeleteData deleteData =
             ShardTransactionMessages.DeleteData.newBuilder()
@@ -304,9 +285,6 @@ public class ShardTransactionFailureTest extends AbstractActorTest {
                         .build()).build();
 
         future = akka.pattern.Patterns.ask(subject, deleteData, 3000);
-        assertTrue(future.isCompleted());
-        Await.result(future, Duration.Zero());
-
-
+        Await.result(future, Duration.create(3, TimeUnit.SECONDS));
     }
 }
index 8f5d0c28d603c39a008f9638ece377aacdf6f1f8..1dd824568a81820d21f50fd820d47eeef68c73e9 100644 (file)
@@ -5,9 +5,11 @@ import akka.actor.Props;
 import akka.actor.Terminated;
 import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
+
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
-import org.junit.Assert;
+
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.exceptions.UnknownMessageException;
 import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier;
@@ -32,11 +34,15 @@ import org.opendaylight.controller.cluster.datastore.modification.Modification;
 import org.opendaylight.controller.cluster.datastore.modification.WriteModification;
 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
+import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreConfigProperties;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
+import scala.concurrent.duration.Duration;
+
 import java.util.Collections;
+import java.util.concurrent.TimeUnit;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -54,17 +60,20 @@ public class ShardTransactionTest extends AbstractActorTest {
         ShardIdentifier.builder().memberName("member-1")
             .shardName("inventory").type("config").build();
 
+    private ShardContext shardContext = new ShardContext();
 
-    static {
+    @BeforeClass
+    public static void staticSetup() {
         store.onGlobalContextUpdated(testSchemaContext);
     }
 
     @Test
     public void testOnReceiveReadData() throws Exception {
         new JavaTestKit(getSystem()) {{
-            final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, null));
-            final Props props =
-                ShardTransaction.props(store.newReadOnlyTransaction(), shard, testSchemaContext);
+            final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER,
+                    Collections.EMPTY_MAP, new ShardContext()));
+            final Props props = ShardTransaction.props(store.newReadOnlyTransaction(), shard,
+                    testSchemaContext, shardContext);
             final ActorRef subject = getSystem().actorOf(props, "testReadData");
 
             new Within(duration("1 seconds")) {
@@ -104,9 +113,10 @@ public class ShardTransactionTest extends AbstractActorTest {
     @Test
     public void testOnReceiveReadDataWhenDataNotFound() throws Exception {
         new JavaTestKit(getSystem()) {{
-            final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, null));
-            final Props props =
-                ShardTransaction.props( store.newReadOnlyTransaction(), shard, testSchemaContext);
+            final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER,
+                    Collections.EMPTY_MAP, new ShardContext()));
+            final Props props = ShardTransaction.props( store.newReadOnlyTransaction(), shard,
+                    testSchemaContext, shardContext);
             final ActorRef subject = getSystem().actorOf(props, "testReadDataWhenDataNotFound");
 
             new Within(duration("1 seconds")) {
@@ -147,9 +157,10 @@ public class ShardTransactionTest extends AbstractActorTest {
     @Test
     public void testOnReceiveDataExistsPositive() throws Exception {
         new JavaTestKit(getSystem()) {{
-            final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, null));
-            final Props props =
-                ShardTransaction.props(store.newReadOnlyTransaction(), shard, testSchemaContext);
+            final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER,
+                    Collections.EMPTY_MAP, new ShardContext()));
+            final Props props = ShardTransaction.props(store.newReadOnlyTransaction(), shard,
+                    testSchemaContext, shardContext);
             final ActorRef subject = getSystem().actorOf(props, "testDataExistsPositive");
 
             new Within(duration("1 seconds")) {
@@ -190,9 +201,9 @@ public class ShardTransactionTest extends AbstractActorTest {
     public void testOnReceiveDataExistsNegative() throws Exception {
         new JavaTestKit(getSystem()) {{
             final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER,
-                    Collections.EMPTY_MAP, null));
-            final Props props =
-                ShardTransaction.props(store.newReadOnlyTransaction(), shard, testSchemaContext);
+                    Collections.EMPTY_MAP, new ShardContext()));
+            final Props props = ShardTransaction.props(store.newReadOnlyTransaction(), shard,
+                    testSchemaContext, shardContext);
             final ActorRef subject = getSystem().actorOf(props, "testDataExistsNegative");
 
             new Within(duration("1 seconds")) {
@@ -267,9 +278,10 @@ public class ShardTransactionTest extends AbstractActorTest {
     @Test
     public void testOnReceiveWriteData() throws Exception {
         new JavaTestKit(getSystem()) {{
-            final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, null));
-            final Props props =
-                ShardTransaction.props(store.newWriteOnlyTransaction(), shard, TestModel.createTestContext());
+            final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER,
+                    Collections.EMPTY_MAP, new ShardContext()));
+            final Props props = ShardTransaction.props(store.newWriteOnlyTransaction(), shard,
+                    testSchemaContext, shardContext);
             final ActorRef subject =
                 getSystem().actorOf(props, "testWriteData");
 
@@ -307,9 +319,10 @@ public class ShardTransactionTest extends AbstractActorTest {
     @Test
     public void testOnReceiveMergeData() throws Exception {
         new JavaTestKit(getSystem()) {{
-            final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, null));
-            final Props props =
-                ShardTransaction.props(store.newReadWriteTransaction(), shard, testSchemaContext);
+            final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER,
+                    Collections.EMPTY_MAP, new ShardContext()));
+            final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
+                    testSchemaContext, shardContext);
             final ActorRef subject =
                 getSystem().actorOf(props, "testMergeData");
 
@@ -348,9 +361,10 @@ public class ShardTransactionTest extends AbstractActorTest {
     @Test
     public void testOnReceiveDeleteData() throws Exception {
         new JavaTestKit(getSystem()) {{
-            final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, null));
-            final Props props =
-                ShardTransaction.props( store.newWriteOnlyTransaction(), shard, TestModel.createTestContext());
+            final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER,
+                    Collections.EMPTY_MAP, new ShardContext()));
+            final Props props = ShardTransaction.props( store.newWriteOnlyTransaction(), shard,
+                    testSchemaContext, shardContext);
             final ActorRef subject =
                 getSystem().actorOf(props, "testDeleteData");
 
@@ -387,9 +401,10 @@ public class ShardTransactionTest extends AbstractActorTest {
     @Test
     public void testOnReceiveReadyTransaction() throws Exception {
         new JavaTestKit(getSystem()) {{
-            final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, null));
-            final Props props =
-                ShardTransaction.props( store.newReadWriteTransaction(), shard, TestModel.createTestContext());
+            final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER,
+                    Collections.EMPTY_MAP, new ShardContext()));
+            final Props props = ShardTransaction.props( store.newReadWriteTransaction(), shard,
+                    testSchemaContext, shardContext);
             final ActorRef subject =
                 getSystem().actorOf(props, "testReadyTransaction");
 
@@ -425,24 +440,26 @@ public class ShardTransactionTest extends AbstractActorTest {
     @Test
     public void testOnReceiveCloseTransaction() throws Exception {
         new JavaTestKit(getSystem()) {{
-            final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, null));
-            final Props props =
-                ShardTransaction.props(store.newReadWriteTransaction(), shard, TestModel.createTestContext());
+            final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER,
+                    Collections.EMPTY_MAP, new ShardContext()));
+            final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
+                    testSchemaContext, shardContext);
             final ActorRef subject =
                 getSystem().actorOf(props, "testCloseTransaction");
 
             watch(subject);
 
-            new Within(duration("2 seconds")) {
+            new Within(duration("6 seconds")) {
                 @Override
                 protected void run() {
 
                     subject.tell(new CloseTransaction().toSerializable(), getRef());
 
-                    final String out = new ExpectMsg<String>(duration("1 seconds"), "match hint") {
+                    final String out = new ExpectMsg<String>(duration("3 seconds"), "match hint") {
                         // do not put code outside this method, will run afterwards
                         @Override
                         protected String match(Object in) {
+                            System.out.println("!!!IN match 1: "+(in!=null?in.getClass():"NULL"));
                             if (in.getClass().equals(CloseTransactionReply.SERIALIZABLE_CLASS)) {
                                 return "match";
                             } else {
@@ -453,10 +470,11 @@ public class ShardTransactionTest extends AbstractActorTest {
 
                     assertEquals("match", out);
 
-                    final String termination = new ExpectMsg<String>(duration("1 seconds"), "match hint") {
+                    final String termination = new ExpectMsg<String>(duration("3 seconds"), "match hint") {
                         // do not put code outside this method, will run afterwards
                         @Override
                         protected String match(Object in) {
+                            System.out.println("!!!IN match 2: "+(in!=null?in.getClass():"NULL"));
                             if (in instanceof Terminated) {
                                 return "match";
                             } else {
@@ -465,33 +483,54 @@ public class ShardTransactionTest extends AbstractActorTest {
                         }
                     }.get(); // this extracts the received message
 
-
-                    expectNoMsg();
+                    assertEquals("match", termination);
                 }
-
-
             };
         }};
+    }
 
+    @Test(expected=UnknownMessageException.class)
+    public void testNegativePerformingWriteOperationOnReadTransaction() throws Exception {
+        final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER,
+                Collections.EMPTY_MAP, new ShardContext()));
+        final Props props = ShardTransaction.props(store.newReadOnlyTransaction(), shard,
+                testSchemaContext, shardContext);
+        final TestActorRef subject = TestActorRef.apply(props,getSystem());
+
+        subject.receive(new DeleteData(TestModel.TEST_PATH).toSerializable(), ActorRef.noSender());
     }
 
+    @Test
+    public void testShardTransactionInactivity() {
+
+        shardContext = new ShardContext(InMemoryDOMDataStoreConfigProperties.getDefault(),
+                Duration.create(500, TimeUnit.MILLISECONDS));
 
-  @Test
-  public void testNegativePerformingWriteOperationOnReadTransaction() throws Exception {
-    try {
+        new JavaTestKit(getSystem()) {{
+            final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER,
+                    Collections.EMPTY_MAP, new ShardContext()));
+            final Props props = ShardTransaction.props(store.newReadWriteTransaction(), shard,
+                    testSchemaContext, shardContext);
+            final ActorRef subject =
+                getSystem().actorOf(props, "testShardTransactionInactivity");
 
-        final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, null));
-        final Props props =
-            ShardTransaction.props(store.newReadOnlyTransaction(), shard, TestModel.createTestContext());
-         final TestActorRef subject = TestActorRef.apply(props,getSystem());
+            watch(subject);
 
-        subject.receive(new DeleteData(TestModel.TEST_PATH).toSerializable(), ActorRef.noSender());
-        Assert.assertFalse(true);
+            // The shard Tx actor should receive a ReceiveTimeout message and self-destruct.
 
+            final String termination = new ExpectMsg<String>(duration("3 seconds"), "match hint") {
+                // do not put code outside this method, will run afterwards
+                @Override
+                protected String match(Object in) {
+                    if (in instanceof Terminated) {
+                        return "match";
+                    } else {
+                        throw noMatch();
+                    }
+                }
+            }.get(); // this extracts the received message
 
-    } catch (Exception cs) {
-      assertEquals(UnknownMessageException.class.getSimpleName(), cs.getClass().getSimpleName());
-      assertTrue(cs.getMessage(), cs.getMessage().startsWith("Unknown message received "));
+            assertEquals("match", termination);
+        }};
     }
-  }
 }
index 34697977a5a4639e4b507dde478302834eae5ad5..672166c4424c7ea0a8fd5c7ddd2e07b057e572b2 100644 (file)
@@ -13,9 +13,12 @@ package org.opendaylight.controller.cluster.datastore;
 import akka.actor.ActorRef;
 import akka.actor.Props;
 import akka.testkit.TestActorRef;
+
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
+
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.mockito.Mockito;
 import org.opendaylight.controller.cluster.datastore.identifiers.ShardIdentifier;
@@ -31,6 +34,7 @@ import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessa
 import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
 import scala.concurrent.Await;
 import scala.concurrent.Future;
 import scala.concurrent.duration.Duration;
@@ -59,19 +63,21 @@ public class ThreePhaseCommitCohortFailureTest extends AbstractActorTest {
         ShardIdentifier.builder().memberName("member-1")
             .shardName("inventory").type("config").build();
 
-    static {
+    private final ShardContext shardContext = new ShardContext();
+
+    @BeforeClass
+    public static void staticSetup() {
         store.onGlobalContextUpdated(testSchemaContext);
     }
 
-    private FiniteDuration ASK_RESULT_DURATION = Duration.create(5000, TimeUnit.MILLISECONDS);
+    private final FiniteDuration ASK_RESULT_DURATION = Duration.create(5000, TimeUnit.MILLISECONDS);
 
 
     @Test(expected = TestException.class)
     public void testNegativeAbortResultsInException() throws Exception {
 
-        final ActorRef shard =
-            getSystem()
-                .actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP,null));
+        final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER,
+                Collections.EMPTY_MAP, shardContext));
         final DOMStoreThreePhaseCommitCohort mockCohort = Mockito
             .mock(DOMStoreThreePhaseCommitCohort.class);
         final CompositeModification mockComposite =
@@ -93,18 +99,14 @@ public class ThreePhaseCommitCohortFailureTest extends AbstractActorTest {
         assertTrue(future.isCompleted());
 
         Await.result(future, ASK_RESULT_DURATION);
-
-
-
     }
 
 
     @Test(expected = OptimisticLockFailedException.class)
     public void testNegativeCanCommitResultsInException() throws Exception {
 
-        final ActorRef shard =
-            getSystem()
-                .actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP,null));
+        final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER,
+                Collections.EMPTY_MAP, shardContext));
         final DOMStoreThreePhaseCommitCohort mockCohort = Mockito
             .mock(DOMStoreThreePhaseCommitCohort.class);
         final CompositeModification mockComposite =
@@ -135,9 +137,8 @@ public class ThreePhaseCommitCohortFailureTest extends AbstractActorTest {
     @Test(expected = TestException.class)
     public void testNegativePreCommitResultsInException() throws Exception {
 
-        final ActorRef shard =
-            getSystem()
-                .actorOf(Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP,null));
+        final ActorRef shard = getSystem().actorOf(Shard.props(SHARD_IDENTIFIER,
+                Collections.EMPTY_MAP, shardContext));
         final DOMStoreThreePhaseCommitCohort mockCohort = Mockito
             .mock(DOMStoreThreePhaseCommitCohort.class);
         final CompositeModification mockComposite =
@@ -166,15 +167,13 @@ public class ThreePhaseCommitCohortFailureTest extends AbstractActorTest {
     @Test(expected = TestException.class)
     public void testNegativeCommitResultsInException() throws Exception {
 
-        final TestActorRef<Shard> subject = TestActorRef
-            .create(getSystem(),
-                Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP,null),
+        final TestActorRef<Shard> subject = TestActorRef.create(getSystem(),
+                Shard.props(SHARD_IDENTIFIER, Collections.EMPTY_MAP, shardContext),
                 "testNegativeCommitResultsInException");
 
         final ActorRef shardTransaction =
-            getSystem().actorOf(
-                ShardTransaction.props(store.newReadWriteTransaction(), subject,
-                    TestModel.createTestContext()));
+            getSystem().actorOf(ShardTransaction.props(store.newReadWriteTransaction(), subject,
+                    testSchemaContext, shardContext));
 
         ShardTransactionMessages.WriteData writeData =
             ShardTransactionMessages.WriteData.newBuilder()
@@ -221,12 +220,8 @@ public class ThreePhaseCommitCohortFailureTest extends AbstractActorTest {
                 mockForwardCommitTransaction
                 , 3000);
         Await.result(future, ASK_RESULT_DURATION);
-
-
     }
 
     private class TestException extends Exception {
     }
-
-
 }
index 9b7039764f57ba56eb9469354446cad35a6b7537..93145bdd6d86360070dce5102dbd968c6ebc0629 100644 (file)
 
 package org.opendaylight.controller.cluster.datastore;
 
+import static org.mockito.Mockito.doReturn;
+
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mockito;
 import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
@@ -23,30 +26,39 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 public class TransactionChainProxyTest {
     ActorContext actorContext = Mockito.mock(ActorContext.class);
     SchemaContext schemaContext = Mockito.mock(SchemaContext.class);
+
+    @Before
+    public void setUp() {
+        doReturn(schemaContext).when(actorContext).getSchemaContext();
+    }
+
+    @SuppressWarnings("resource")
     @Test
     public void testNewReadOnlyTransaction() throws Exception {
 
-     DOMStoreTransaction dst = new TransactionChainProxy(actorContext, schemaContext).newReadOnlyTransaction();
+     DOMStoreTransaction dst = new TransactionChainProxy(actorContext).newReadOnlyTransaction();
          Assert.assertTrue(dst instanceof DOMStoreReadTransaction);
 
     }
 
+    @SuppressWarnings("resource")
     @Test
     public void testNewReadWriteTransaction() throws Exception {
-        DOMStoreTransaction dst = new TransactionChainProxy(actorContext, schemaContext).newReadWriteTransaction();
+        DOMStoreTransaction dst = new TransactionChainProxy(actorContext).newReadWriteTransaction();
         Assert.assertTrue(dst instanceof DOMStoreReadWriteTransaction);
 
     }
 
+    @SuppressWarnings("resource")
     @Test
     public void testNewWriteOnlyTransaction() throws Exception {
-        DOMStoreTransaction dst = new TransactionChainProxy(actorContext, schemaContext).newWriteOnlyTransaction();
+        DOMStoreTransaction dst = new TransactionChainProxy(actorContext).newWriteOnlyTransaction();
         Assert.assertTrue(dst instanceof DOMStoreWriteTransaction);
 
     }
 
     @Test(expected=UnsupportedOperationException.class)
     public void testClose() throws Exception {
-        new TransactionChainProxy(actorContext, schemaContext).close();
+        new TransactionChainProxy(actorContext).close();
     }
 }
index 6b11a24e9cedbb3a8234fb6e337f7750a413721f..f69ae88ec873ed044ab40c36a63e6f0b68b9db67 100644 (file)
@@ -99,6 +99,7 @@ public class TransactionProxyTest extends AbstractActorTest {
 
         doReturn(getSystem()).when(mockActorContext).getActorSystem();
         doReturn(memberName).when(mockActorContext).getCurrentMemberName();
+        doReturn(schemaContext).when(mockActorContext).getSchemaContext();
 
         ShardStrategyFactory.setConfiguration(configuration);
     }
@@ -255,7 +256,7 @@ public class TransactionProxyTest extends AbstractActorTest {
         ActorRef actorRef = setupActorContextWithInitialCreateTransaction(READ_ONLY);
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                READ_ONLY, schemaContext);
+                READ_ONLY);
 
         doReturn(readDataReply(null)).when(mockActorContext).executeRemoteOperationAsync(
                 eq(actorSelection(actorRef)), eqReadData(), anyDuration());
@@ -285,7 +286,7 @@ public class TransactionProxyTest extends AbstractActorTest {
                 executeRemoteOperationAsync(any(ActorSelection.class), any(), anyDuration());
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                READ_ONLY, schemaContext);
+                READ_ONLY);
 
         transactionProxy.read(TestModel.TEST_PATH).checkedGet(5, TimeUnit.SECONDS);
     }
@@ -298,7 +299,7 @@ public class TransactionProxyTest extends AbstractActorTest {
                 executeRemoteOperationAsync(any(ActorSelection.class), any(), anyDuration());
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                READ_ONLY, schemaContext);
+                READ_ONLY);
 
         propagateReadFailedExceptionCause(transactionProxy.read(TestModel.TEST_PATH));
     }
@@ -310,7 +311,7 @@ public class TransactionProxyTest extends AbstractActorTest {
                 anyString(), any(), anyDuration());
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                READ_ONLY, schemaContext);
+                READ_ONLY);
 
         propagateReadFailedExceptionCause(invoker.invoke(transactionProxy));
     }
@@ -357,7 +358,7 @@ public class TransactionProxyTest extends AbstractActorTest {
                 eq(actorSelection(actorRef)), eqReadData(), anyDuration());
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                READ_WRITE, schemaContext);
+                READ_WRITE);
 
         transactionProxy.write(TestModel.TEST_PATH, nodeToWrite);
 
@@ -384,7 +385,7 @@ public class TransactionProxyTest extends AbstractActorTest {
                 eq(actorSelection(actorRef)), eqReadData(), anyDuration());
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                READ_WRITE, schemaContext);
+                READ_WRITE);
 
         transactionProxy.write(TestModel.TEST_PATH, expectedNode);
 
@@ -400,7 +401,7 @@ public class TransactionProxyTest extends AbstractActorTest {
     public void testReadPreConditionCheck() {
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                WRITE_ONLY, schemaContext);
+                WRITE_ONLY);
 
         transactionProxy.read(TestModel.TEST_PATH);
     }
@@ -410,7 +411,7 @@ public class TransactionProxyTest extends AbstractActorTest {
         ActorRef actorRef = setupActorContextWithInitialCreateTransaction(READ_ONLY);
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                READ_ONLY, schemaContext);
+                READ_ONLY);
 
         doReturn(dataExistsReply(false)).when(mockActorContext).executeRemoteOperationAsync(
                 eq(actorSelection(actorRef)), eqDataExists(), anyDuration());
@@ -445,7 +446,7 @@ public class TransactionProxyTest extends AbstractActorTest {
                 executeRemoteOperationAsync(any(ActorSelection.class), any(), anyDuration());
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                READ_ONLY, schemaContext);
+                READ_ONLY);
 
         transactionProxy.exists(TestModel.TEST_PATH).checkedGet(5, TimeUnit.SECONDS);
     }
@@ -458,7 +459,7 @@ public class TransactionProxyTest extends AbstractActorTest {
                 executeRemoteOperationAsync(any(ActorSelection.class), any(), anyDuration());
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                READ_ONLY, schemaContext);
+                READ_ONLY);
 
         propagateReadFailedExceptionCause(transactionProxy.exists(TestModel.TEST_PATH));
     }
@@ -480,7 +481,7 @@ public class TransactionProxyTest extends AbstractActorTest {
                 eq(actorSelection(actorRef)), eqDataExists(), anyDuration());
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                READ_WRITE, schemaContext);
+                READ_WRITE);
 
         transactionProxy.write(TestModel.TEST_PATH, nodeToWrite);
 
@@ -507,7 +508,7 @@ public class TransactionProxyTest extends AbstractActorTest {
                 eq(actorSelection(actorRef)), eqDataExists(), anyDuration());
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                READ_WRITE, schemaContext);
+                READ_WRITE);
 
         transactionProxy.write(TestModel.TEST_PATH, nodeToWrite);
 
@@ -520,7 +521,7 @@ public class TransactionProxyTest extends AbstractActorTest {
     public void testxistsPreConditionCheck() {
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                WRITE_ONLY, schemaContext);
+                WRITE_ONLY);
 
         transactionProxy.exists(TestModel.TEST_PATH);
     }
@@ -558,7 +559,7 @@ public class TransactionProxyTest extends AbstractActorTest {
                 eq(actorSelection(actorRef)), eqWriteData(nodeToWrite), anyDuration());
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                WRITE_ONLY, schemaContext);
+                WRITE_ONLY);
 
         transactionProxy.write(TestModel.TEST_PATH, nodeToWrite);
 
@@ -573,7 +574,7 @@ public class TransactionProxyTest extends AbstractActorTest {
     public void testWritePreConditionCheck() {
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                READ_ONLY, schemaContext);
+                READ_ONLY);
 
         transactionProxy.write(TestModel.TEST_PATH,
                 ImmutableNodes.containerNode(TestModel.TEST_QNAME));
@@ -583,7 +584,7 @@ public class TransactionProxyTest extends AbstractActorTest {
     public void testWriteAfterReadyPreConditionCheck() {
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                WRITE_ONLY, schemaContext);
+                WRITE_ONLY);
 
         transactionProxy.ready();
 
@@ -601,7 +602,7 @@ public class TransactionProxyTest extends AbstractActorTest {
                 eq(actorSelection(actorRef)), eqMergeData(nodeToWrite), anyDuration());
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                WRITE_ONLY, schemaContext);
+                WRITE_ONLY);
 
         transactionProxy.merge(TestModel.TEST_PATH, nodeToWrite);
 
@@ -620,7 +621,7 @@ public class TransactionProxyTest extends AbstractActorTest {
                 eq(actorSelection(actorRef)), eqDeleteData(), anyDuration());
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                WRITE_ONLY, schemaContext);
+                WRITE_ONLY);
 
         transactionProxy.delete(TestModel.TEST_PATH);
 
@@ -673,7 +674,7 @@ public class TransactionProxyTest extends AbstractActorTest {
                 eq(actorSelection(actorRef)), isA(ReadyTransaction.SERIALIZABLE_CLASS), anyDuration());
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                READ_WRITE, schemaContext);
+                READ_WRITE);
 
         transactionProxy.read(TestModel.TEST_PATH);
 
@@ -709,7 +710,7 @@ public class TransactionProxyTest extends AbstractActorTest {
                 eq(actorSelection(actorRef)), isA(ReadyTransaction.SERIALIZABLE_CLASS), anyDuration());
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                WRITE_ONLY, schemaContext);
+                WRITE_ONLY);
 
         transactionProxy.merge(TestModel.TEST_PATH, nodeToWrite);
 
@@ -742,7 +743,7 @@ public class TransactionProxyTest extends AbstractActorTest {
                         isA(ReadyTransaction.SERIALIZABLE_CLASS), anyDuration());
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                WRITE_ONLY, schemaContext);
+                WRITE_ONLY);
 
         transactionProxy.merge(TestModel.TEST_PATH, nodeToWrite);
 
@@ -765,7 +766,7 @@ public class TransactionProxyTest extends AbstractActorTest {
                 anyString(), any(), anyDuration());
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                WRITE_ONLY, schemaContext);
+                WRITE_ONLY);
 
         NormalizedNode<?, ?> nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
 
@@ -799,7 +800,7 @@ public class TransactionProxyTest extends AbstractActorTest {
                         isA(ReadyTransaction.SERIALIZABLE_CLASS), anyDuration());
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                WRITE_ONLY, schemaContext);
+                WRITE_ONLY);
 
         transactionProxy.write(TestModel.TEST_PATH, nodeToWrite);
 
@@ -816,7 +817,7 @@ public class TransactionProxyTest extends AbstractActorTest {
     public void testGetIdentifier() {
         setupActorContextWithInitialCreateTransaction(READ_ONLY);
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                TransactionProxy.TransactionType.READ_ONLY, schemaContext);
+                TransactionProxy.TransactionType.READ_ONLY);
 
         Object id = transactionProxy.getIdentifier();
         assertNotNull("getIdentifier returned null", id);
@@ -832,7 +833,7 @@ public class TransactionProxyTest extends AbstractActorTest {
                 eq(actorSelection(actorRef)), eqReadData(), anyDuration());
 
         TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
-                READ_WRITE, schemaContext);
+                READ_WRITE);
 
         transactionProxy.read(TestModel.TEST_PATH);
 
index 27b0374bacbaa6b224c52ceaf7d33a83ffa554fb..6851b1b72ce39d4c011cb0771b95014bb31ade32 100644 (file)
@@ -14,3 +14,8 @@ akka {
         }
     }
 }
+bounded-mailbox {
+  mailbox-type = "org.opendaylight.controller.common.actor.MeteredBoundedMailbox"
+  mailbox-capacity = 1000
+  mailbox-push-timeout-time = 100ms
+}
index 6d4400fe20f1f115d5e09ef56cc9a8fc749c8bfd..496f27ecaa1defe4f49d1cd724b58e8a3f673794 100644 (file)
@@ -200,8 +200,7 @@ public class XSQLAdapter extends Thread implements SchemaContextListener {
 
     }
 
-    protected void processCommand(StringBuffer inputString, PrintStream sout,
-            TelnetConnection tc) {
+    public void processCommand(StringBuffer inputString, PrintStream sout) {
         if (inputString.toString().trim().equals("r")) {
             sout.println(lastInputString);
             inputString = lastInputString;
@@ -263,25 +262,6 @@ public class XSQLAdapter extends Thread implements SchemaContextListener {
             for (int i = 0; i < iNames.length; i++) {
                 sout.println(iNames[i]);
             }
-        } else if (input.startsWith("cd sid")) {
-            String substr = input.substring("cd sid".length()).trim();
-            for (NEEntry e : elements.values()) {
-                if (((Module) e.ne).getName().equals(substr)) {
-                    tc.currentModule = (Module) e.ne;
-                }
-            }
-        } else if (input.equals("list sid")) {
-            String arr[] = new String[elements.size()];
-
-            int i = 0;
-            for (NEEntry entry : elements.values()) {
-                arr[i] = entry.toString();
-                i++;
-            }
-            Arrays.sort(arr);
-            for (String s : arr) {
-                sout.println(s);
-            }
         } else if (input.equals("help") || input.equals("?")) {
             // sout.println(getLongDescription());
         } else if (input.equals("avmdata")) {
@@ -517,7 +497,7 @@ public class XSQLAdapter extends Thread implements SchemaContextListener {
                         }
                     }
 
-                    processCommand(inputString, out, this);
+                    processCommand(inputString, out);
                     inputString = new StringBuffer();
                 }
             } catch (Exception err) {
index 7026b03022ff47b548743b34efb3f0f35d6d6e94..6596acb4e1bbb8caf9336a7e31cad98b521b0948 100644 (file)
@@ -20,7 +20,7 @@ public class InMemoryOperationalDataStoreProviderModule extends org.opendaylight
 
     @Override
     public java.lang.AutoCloseable createInstance() {
-        return InMemoryDOMDataStoreFactory.create("DOM-OPER", getOperationalSchemaServiceDependency(),
+        return InMemoryDOMDataStoreFactory.create("DOM-OPER", getSchemaServiceDependency(),
                 InMemoryDOMDataStoreConfigProperties.create(getMaxDataChangeExecutorPoolSize(),
                         getMaxDataChangeExecutorQueueSize(), getMaxDataChangeListenerQueueSize()));
     }
index 1292d3772a6a9d99fb9527fa8688d1925f83a599..17c86716d8c65183cf89130bbf9e8aa6c4f561e1 100644 (file)
@@ -34,21 +34,7 @@ module opendaylight-inmemory-datastore-provider {
              config:java-name-prefix InMemoryOperationalDataStoreProvider;
       }
 
-
-    // Augments the 'configuration' choice node under modules/module.
-    augment "/config:modules/config:module/config:configuration" {
-        case inmemory-config-datastore-provider {
-            when "/config:modules/config:module/config:type = 'inmemory-config-datastore-provider'";
-
-            container schema-service {
-                uses config:service-ref {
-                   refine type {
-                          mandatory false;
-                          config:required-identity sal:schema-service;
-                    }
-                }
-            }
-
+    grouping datastore-configuration {
             leaf max-data-change-executor-queue-size {
                 default 1000;
                 type uint16;
@@ -66,42 +52,42 @@ module opendaylight-inmemory-datastore-provider {
                 type uint16;
                 description "The maximum queue size for the data change listeners.";
             }
-        }
     }
 
     // Augments the 'configuration' choice node under modules/module.
     augment "/config:modules/config:module/config:configuration" {
-        case inmemory-operational-datastore-provider {
-            when "/config:modules/config:module/config:type = 'inmemory-operational-datastore-provider'";
+        case inmemory-config-datastore-provider {
+            when "/config:modules/config:module/config:type = 'inmemory-config-datastore-provider'";
 
-            // Yang does not allow two cases from same namespaces with same children
-            // Schema-service dependency renamed to operational-schema-service
-            // to prevent conflict with schema-service container from inmemory-config-datastore-provider
-            container operational-schema-service {
-                uses config:service-ref {
-                    refine type {
-                        mandatory false;
-                        config:required-identity sal:schema-service;
+            container inmemory-config-datastore-provider {
+                container schema-service {
+                    uses config:service-ref {
+                        refine type {
+                            mandatory false;
+                            config:required-identity sal:schema-service;
+                        }
                     }
                 }
+                uses datastore-configuration;
             }
+        }
+    }
 
-            leaf max-data-change-executor-queue-size {
-                default 1000;
-                type uint16;
-                description "The maximum queue size for the data change notification executor.";
-            }
-
-            leaf max-data-change-executor-pool-size {
-                default 20;
-                type uint16;
-                description "The maximum thread pool size for the data change notification executor.";
-            }
+    // Augments the 'configuration' choice node under modules/module.
+    augment "/config:modules/config:module/config:configuration" {
+        case inmemory-operational-datastore-provider {
+            when "/config:modules/config:module/config:type = 'inmemory-operational-datastore-provider'";
 
-            leaf max-data-change-listener-queue-size {
-                default 1000;
-                type uint16;
-                description "The maximum queue size for the data change listeners.";
+            container inmemory-operational-datastore-provider {
+                container schema-service {
+                    uses config:service-ref {
+                        refine type {
+                            mandatory false;
+                            config:required-identity sal:schema-service;
+                        }
+                    }
+                }
+                uses datastore-configuration;
             }
         }
     }
diff --git a/opendaylight/md-sal/sal-karaf-xsql/pom.xml b/opendaylight/md-sal/sal-karaf-xsql/pom.xml
new file mode 100644 (file)
index 0000000..c32d960
--- /dev/null
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<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">\r
+\r
+    <!--
+        Licensed to the Apache Software Foundation (ASF) under one or more
+        contributor license agreements.  See the NOTICE file distributed with
+        this work for additional information regarding copyright ownership.
+        The ASF licenses this file to You under the Apache License, Version 2.0
+        (the "License"); you may not use this file except in compliance with
+        the License.  You may obtain a copy of the License at
+
+            http://www.apache.org/licenses/LICENSE-2.0
+
+        Unless required by applicable law or agreed to in writing, software
+        distributed under the License is distributed on an "AS IS" BASIS,
+        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+        See the License for the specific language governing permissions and
+        limitations under the License.
+    -->\r
+\r
+    <modelVersion>4.0.0</modelVersion>\r
+\r
+    <parent>\r
+    <artifactId>sal-parent</artifactId>\r
+    <groupId>org.opendaylight.controller</groupId>\r
+    <version>1.1-SNAPSHOT</version>\r
+  </parent>\r
+\r
+    <groupId>xsqlcommand</groupId>\r
+    <artifactId>xsqlcommand</artifactId>\r
+    <packaging>bundle</packaging>\r
+    <version>1.0.0-SNAPSHOT</version>\r
+    <name>Apache Karaf :: Shell odl/xsql Commands</name>\r
+\r
+    <description>Provides the OSGi odl commands</description>\r
+\r
+    <dependencies>\r
+        <dependency>\r
+            <groupId>org.apache.karaf.shell</groupId>\r
+            <artifactId>org.apache.karaf.shell.console</artifactId>\r
+            <version>3.0.1</version>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>org.osgi</groupId>\r
+            <artifactId>org.osgi.core</artifactId>\r
+            <version>5.0.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>org.osgi</groupId>\r
+            <artifactId>org.osgi.compendium</artifactId>\r
+            <version>5.0.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>junit</groupId>\r
+            <artifactId>junit</artifactId>\r
+            <version>4.11</version>\r
+            <scope>test</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.opendaylight.controller</groupId>\r
+            <artifactId>sal-dom-xsql</artifactId>\r
+            <type>bundle</type>\r
+            <version>1.1-SNAPSHOT</version>\r
+        </dependency>\r
+    </dependencies>\r
+\r
+    <build>\r
+        <plugins>\r
+            <plugin>\r
+                <artifactId>maven-compiler-plugin</artifactId>\r
+                <inherited>true</inherited>\r
+                <version>2.3.2</version>\r
+                <configuration>\r
+                    <source>1.5</source>\r
+                    <target>1.5</target>\r
+                </configuration>\r
+            </plugin>\r
+            <plugin>\r
+                <groupId>org.apache.felix</groupId>\r
+                <artifactId>maven-bundle-plugin</artifactId>\r
+                <version>2.4.0</version>\r
+                <extensions>true</extensions>\r
+                <configuration>\r
+                    <instructions>\r
+                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>\r
+                        <Export-Package>org.opendaylight.controller.xsql*;version=${project.version}</Export-Package>\r
+                        <Import-Package>!org.opendaylight.controller.xsql*,\r
+                            org.apache.aries.blueprint,\r
+                            org.osgi.service.blueprint.container,\r
+                            org.osgi.service.blueprint.reflect,\r
+                            org.apache.felix.service.command,\r
+                            org.apache.karaf.shell.commands,\r
+                            org.apache.karaf.shell.console,\r
+                            *</Import-Package>\r
+                    </instructions>\r
+                </configuration>\r
+            </plugin>\r
+        </plugins>\r
+    </build>\r
+\r
+</project>\r
diff --git a/opendaylight/md-sal/sal-karaf-xsql/src/main/java/org/opendaylight/controller/xsql/xsql.java b/opendaylight/md-sal/sal-karaf-xsql/src/main/java/org/opendaylight/controller/xsql/xsql.java
new file mode 100644 (file)
index 0000000..b7994dc
--- /dev/null
@@ -0,0 +1,23 @@
+package org.opendaylight.controller.xsql;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter;
+
+@Command(scope = "odl", name = "xsql", description = "XSQL Karaf Command")
+public class xsql extends OsgiCommandSupport {
+
+    @Option(name = "-o", aliases = { "--option" }, description = "An option to the command", required = false, multiValued = false)
+    private String option;
+
+    @Argument(name = "argument", description = "Argument to the command", required = false, multiValued = false)
+    private String argument;
+
+    protected Object doExecute() throws Exception {
+        XSQLAdapter.getInstance().processCommand(new StringBuffer(argument),
+                System.out);
+        return null;
+    }
+}
index 4e007f4c5d8e4447c1ea683312f40302bc91f2d9..08450b3e789892429bc37aa1f68b015fae2271fb 100644 (file)
     <dependency>
       <groupId>org.opendaylight.yangtools</groupId>
       <artifactId>yang-data-api</artifactId>
-
     </dependency>
       <dependency>
           <groupId>org.opendaylight.yangtools</groupId>
           <artifactId>yang-model-api</artifactId>
-
       </dependency>
-
     <dependency>
       <groupId>org.opendaylight.yangtools</groupId>
       <artifactId>yang-data-impl</artifactId>
-
     </dependency>
-
     <dependency>
       <groupId>org.opendaylight.yangtools</groupId>
       <artifactId>yang-common</artifactId>
-
     </dependency>
-
-
     <dependency>
       <groupId>org.osgi</groupId>
       <artifactId>org.osgi.core</artifactId>
     </dependency>
-
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
     </dependency>
-
     <dependency>
       <groupId>org.scala-lang</groupId>
       <artifactId>scala-library</artifactId>
     <dependency>
       <groupId>com.codahale.metrics</groupId>
       <artifactId>metrics-core</artifactId>
-      <version>3.0.1</version>
     </dependency>
+
+      <dependency>
+          <groupId>com.codahale.metrics</groupId>
+          <artifactId>metrics-graphite</artifactId>
+      </dependency>
     <!-- Test Dependencies -->
     <dependency>
       <groupId>junit</groupId>
 
   <build>
     <plugins>
+        <plugin>
+            <groupId>org.jacoco</groupId>
+            <artifactId>jacoco-maven-plugin</artifactId>
+            <configuration>
+                <includes>
+                    <include>org.opendaylight.controller.*</include>
+                </includes>
+                <excludes>
+                    <exclude>org.opendaylight.controller.config.yang.config.*</exclude>
+                </excludes>
+                <check>false</check>
+            </configuration>
+            <executions>
+                <execution>
+                    <id>pre-test</id>
+                    <goals>
+                        <goal>prepare-agent</goal>
+                    </goals>
+                </execution>
+                <execution>
+                    <id>post-test</id>
+                    <goals>
+                        <goal>report</goal>
+                    </goals>
+                    <phase>test</phase>
+                </execution>
+            </executions>
+        </plugin>
 
       <plugin>
         <groupId>org.apache.felix</groupId>
index 96f24724286192131c08177943a572c45dba5a96..d4da226b9dc4278cd508e83082283a3163c6615c 100644 (file)
@@ -15,8 +15,11 @@ import akka.actor.Props;
 import akka.actor.SupervisorStrategy;
 import akka.japi.Creator;
 import akka.japi.Function;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
 import org.opendaylight.controller.remote.rpc.messages.UpdateSchemaContext;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry;
+import org.opendaylight.controller.remote.rpc.utils.ActorUtil;
 import org.opendaylight.controller.sal.core.api.Broker;
 import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -69,10 +72,16 @@ public class RpcManager extends AbstractUntypedActor {
   private void createRpcActors() {
     LOG.debug("Create rpc registry and broker actors");
 
+      Config conf = ConfigFactory.load();
 
-    rpcRegistry = getContext().actorOf(Props.create(RpcRegistry.class), ActorConstants.RPC_REGISTRY);
+    rpcRegistry =
+            getContext().actorOf(Props.create(RpcRegistry.class).
+                withMailbox(ActorUtil.MAILBOX), ActorConstants.RPC_REGISTRY);
+
+    rpcBroker =
+            getContext().actorOf(RpcBroker.props(brokerSession, rpcRegistry, schemaContext).
+                withMailbox(ActorUtil.MAILBOX),ActorConstants.RPC_BROKER);
 
-    rpcBroker = getContext().actorOf(RpcBroker.props(brokerSession, rpcRegistry, schemaContext), ActorConstants.RPC_BROKER);
     RpcRegistry.Messages.SetLocalRouter localRouter = new RpcRegistry.Messages.SetLocalRouter(rpcBroker);
     rpcRegistry.tell(localRouter, self());
   }
index 76f59304576b731f1a15df9c277628ad9ff611d6..5109d316446b13158e3739824e653e0259929135 100644 (file)
@@ -20,6 +20,7 @@ import akka.pattern.Patterns;
 import com.google.common.base.Preconditions;
 import org.opendaylight.controller.remote.rpc.registry.gossip.Bucket;
 import org.opendaylight.controller.remote.rpc.registry.gossip.BucketStore;
+import org.opendaylight.controller.remote.rpc.utils.ActorUtil;
 import org.opendaylight.controller.sal.connector.api.RpcRouter;
 import scala.concurrent.Future;
 
@@ -107,7 +108,7 @@ public class RpcRegistry extends UntypedActor {
 
         Preconditions.checkState(localRouter != null, "Router must be set first");
 
-        Future<Object> futureReply = Patterns.ask(bucketStore, new GetLocalBucket(), 1000);
+        Future<Object> futureReply = Patterns.ask(bucketStore, new GetLocalBucket(), ActorUtil.ASK_DURATION.toMillis());
         futureReply.map(getMapperToAddRoutes(msg.getRouteIdentifiers()), getContext().dispatcher());
     }
 
@@ -116,7 +117,7 @@ public class RpcRegistry extends UntypedActor {
      */
     private void receiveRemoveRoutes(RemoveRoutes msg) {
 
-        Future<Object> futureReply = Patterns.ask(bucketStore, new GetLocalBucket(), 1000);
+        Future<Object> futureReply = Patterns.ask(bucketStore, new GetLocalBucket(), ActorUtil.ASK_DURATION.toMillis());
         futureReply.map(getMapperToRemoveRoutes(msg.getRouteIdentifiers()), getContext().dispatcher());
 
     }
@@ -129,7 +130,7 @@ public class RpcRegistry extends UntypedActor {
     private void receiveGetRouter(FindRouters msg) {
         final ActorRef sender = getSender();
 
-        Future<Object> futureReply = Patterns.ask(bucketStore, new GetAllBuckets(), 1000);
+        Future<Object> futureReply = Patterns.ask(bucketStore, new GetAllBuckets(), ActorUtil.ASK_DURATION.toMillis());
         futureReply.map(getMapperToGetRouter(msg.getRouteIdentifier(), sender), getContext().dispatcher());
     }
 
index 3b078aa062fdf1fc3feaca7fa10147de8c3503cc..ff51f4fcfa671ff4ae71be72c6403b741e3de8dd 100644 (file)
@@ -16,6 +16,7 @@ import akka.actor.UntypedActor;
 import akka.cluster.ClusterActorRefProvider;
 import akka.event.Logging;
 import akka.event.LoggingAdapter;
+import org.opendaylight.controller.remote.rpc.utils.ActorUtil;
 import org.opendaylight.controller.utils.ConditionalProbe;
 
 import java.util.HashMap;
@@ -76,7 +77,7 @@ public class BucketStore extends UntypedActor {
         selfAddress = provider.getDefaultAddress();
 
         if ( provider instanceof ClusterActorRefProvider)
-            getContext().actorOf(Props.create(Gossiper.class), "gossiper");
+            getContext().actorOf(Props.create(Gossiper.class).withMailbox(ActorUtil.MAILBOX), "gossiper");
     }
 
     @Override
index a8bc25c40ba14b2ecf8c45926f7871f189dbdafa..f6ce5e55f3ee63602fc92529e92d6e93d0ff9bb3 100644 (file)
@@ -21,6 +21,7 @@ import akka.dispatch.Mapper;
 import akka.event.Logging;
 import akka.event.LoggingAdapter;
 import akka.pattern.Patterns;
+import org.opendaylight.controller.remote.rpc.utils.ActorUtil;
 import scala.concurrent.Future;
 import scala.concurrent.duration.FiniteDuration;
 
@@ -105,7 +106,7 @@ public class Gossiper extends UntypedActor {
         if (autoStartGossipTicks) {
             gossipTask = getContext().system().scheduler().schedule(
                     new FiniteDuration(1, TimeUnit.SECONDS),        //initial delay
-                    new FiniteDuration(500, TimeUnit.MILLISECONDS), //interval
+                    ActorUtil.GOSSIP_TICK_INTERVAL,                 //interval
                     getSelf(),                                       //target
                     new Messages.GossiperMessages.GossipTick(),      //message
                     getContext().dispatcher(),                       //execution context
@@ -227,7 +228,9 @@ public class Gossiper extends UntypedActor {
             return;
 
         final ActorRef sender = getSender();
-        Future<Object> futureReply = Patterns.ask(getContext().parent(), new GetBucketVersions(), 1000);
+        Future<Object> futureReply =
+                Patterns.ask(getContext().parent(), new GetBucketVersions(), ActorUtil.ASK_DURATION.toMillis());
+
         futureReply.map(getMapperToProcessRemoteStatus(sender, status), getContext().dispatcher());
 
     }
@@ -267,7 +270,8 @@ public class Gossiper extends UntypedActor {
      */
     void sendGossipTo(final ActorRef remote, final Set<Address> addresses){
 
-        Future<Object> futureReply = Patterns.ask(getContext().parent(), new GetBucketsByMembers(addresses), 1000);
+        Future<Object> futureReply =
+                Patterns.ask(getContext().parent(), new GetBucketsByMembers(addresses), ActorUtil.ASK_DURATION.toMillis());
         futureReply.map(getMapperToSendGossip(remote), getContext().dispatcher());
     }
 
@@ -279,7 +283,10 @@ public class Gossiper extends UntypedActor {
     void getLocalStatusAndSendTo(Address remoteActorSystemAddress){
 
         //Get local status from bucket store and send to remote
-        Future<Object> futureReply = Patterns.ask(getContext().parent(), new GetBucketVersions(), 1000);
+        Future<Object> futureReply =
+                Patterns.ask(getContext().parent(), new GetBucketVersions(), ActorUtil.ASK_DURATION.toMillis());
+
+        //Find gossiper on remote system
         ActorSelection remoteRef = getContext().system().actorSelection(
                 remoteActorSystemAddress.toString() + getSelf().path().toStringWithoutAddress());
 
index b7b2216a08b0293fccc733836355ed8e4bd5767a..ca14fecb4c4bc65d4d56f66b67b2533fd802ce2a 100644 (file)
@@ -20,28 +20,32 @@ import java.util.concurrent.TimeUnit;
 import static akka.pattern.Patterns.ask;
 
 public class ActorUtil {
-  public static final FiniteDuration LOCAL_ASK_DURATION = Duration.create(2, TimeUnit.SECONDS);
-  public static final FiniteDuration REMOTE_ASK_DURATION = Duration.create(15, TimeUnit.SECONDS);
-  public static final FiniteDuration ASK_DURATION = Duration.create(17, TimeUnit.SECONDS);
-  public static final FiniteDuration LOCAL_AWAIT_DURATION = Duration.create(2, TimeUnit.SECONDS);
-  public static final FiniteDuration REMOTE_AWAIT_DURATION = Duration.create(15, TimeUnit.SECONDS);
-  public static final FiniteDuration AWAIT_DURATION = Duration.create(17, TimeUnit.SECONDS);
-
-  /**
-   * Executes an operation on a local actor and wait for it's response
-   * @param actor
-   * @param message
-   * @param askDuration
-   * @param awaitDuration
-   * @return The response of the operation
-   */
-  public static Object executeOperation(ActorRef actor, Object message,
-                                        FiniteDuration askDuration, FiniteDuration awaitDuration) throws Exception{
-    Future<Object> future =
-        ask(actor, message, new Timeout(askDuration));
-
-      return Await.result(future, awaitDuration);
-  }
+    public static final FiniteDuration LOCAL_ASK_DURATION = Duration.create(2, TimeUnit.SECONDS);
+    public static final FiniteDuration REMOTE_ASK_DURATION = Duration.create(15, TimeUnit.SECONDS);
+    public static final FiniteDuration ASK_DURATION = Duration.create(17, TimeUnit.SECONDS);
+    public static final FiniteDuration LOCAL_AWAIT_DURATION = Duration.create(2, TimeUnit.SECONDS);
+    public static final FiniteDuration REMOTE_AWAIT_DURATION = Duration.create(15, TimeUnit.SECONDS);
+    public static final FiniteDuration AWAIT_DURATION = Duration.create(17, TimeUnit.SECONDS);
+    public static final FiniteDuration GOSSIP_TICK_INTERVAL = Duration.create(500, TimeUnit.MILLISECONDS);
+    public static final String MAILBOX = "bounded-mailbox";
+
+
+    /**
+     * Executes an operation on a local actor and wait for it's response
+     *
+     * @param actor
+     * @param message
+     * @param askDuration
+     * @param awaitDuration
+     * @return The response of the operation
+     */
+    public static Object executeOperation(ActorRef actor, Object message,
+                                          FiniteDuration askDuration, FiniteDuration awaitDuration) throws Exception {
+        Future<Object> future =
+                ask(actor, message, new Timeout(askDuration));
+
+        return Await.result(future, awaitDuration);
+    }
 
 
 }
index 711ae1c48b75c794bad3cb93de12e397632bcbfd..266832a0ab0491dfd5d58d2c0414c2733ef0300b 100644 (file)
@@ -38,10 +38,15 @@ odl-cluster-data {
 }
 
 odl-cluster-rpc {
+  bounded-mailbox {
+    mailbox-type = "org.opendaylight.controller.common.actor.MeteredBoundedMailbox"
+    mailbox-capacity = 1000
+    mailbox-push-timeout-time = 100ms
+  }
+
   akka {
     actor {
       provider = "akka.cluster.ClusterActorRefProvider"
-
     }
     remote {
       log-remote-lifecycle-events = off
index 17ad237ad7e4302065c08ff8796a058cd78d7885..8a7e4a039846205846e1b54b21981f78af843783 100644 (file)
@@ -14,8 +14,8 @@ import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
 import akka.testkit.JavaTestKit;
 import com.typesafe.config.ConfigFactory;
-import junit.framework.Assert;
 import org.junit.AfterClass;
+import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.controller.sal.core.api.Broker;
@@ -25,7 +25,6 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import scala.concurrent.Await;
 import scala.concurrent.duration.Duration;
 
-
 import java.util.concurrent.TimeUnit;
 
 import static org.mockito.Mockito.mock;
@@ -38,7 +37,7 @@ public class RemoteRpcProviderTest {
 
   @BeforeClass
   public static void setup() throws InterruptedException {
-    system = ActorSystem.create("opendaylight-rpc", ConfigFactory.load().getConfig("odl-cluster"));
+    system = ActorSystem.create("odl-cluster-rpc", ConfigFactory.load().getConfig("odl-cluster-rpc"));
   }
 
   @AfterClass
@@ -59,7 +58,4 @@ public class RemoteRpcProviderTest {
         Duration.create(2, TimeUnit.SECONDS));
     Assert.assertTrue(actorRef.path().toString().contains(ActorConstants.RPC_MANAGER_PATH));
   }
-
-
-
 }
index 9b6215addd841633cf1dd57ce42c635d1dae89b7..98a33bf4e64a680adcc40d2dd3e92823a86c5fb6 100644 (file)
@@ -32,7 +32,7 @@ public class RouteRpcListenerTest {
 
   @BeforeClass
   public static void setup() throws InterruptedException {
-    system = ActorSystem.create("opendaylight-rpc", ConfigFactory.load().getConfig("odl-cluster"));
+    system = ActorSystem.create("opendaylight-rpc", ConfigFactory.load().getConfig("odl-cluster-rpc"));
   }
 
   @AfterClass
index 7b5a968866ca1ecca306b42fc09d76b0a6aaf20a..956e1599904ccc52303ff380892bc3531861cd5b 100644 (file)
@@ -28,7 +28,7 @@ public class RpcListenerTest {
 
   @BeforeClass
   public static void setup() throws InterruptedException {
-    system = ActorSystem.create("opendaylight-rpc", ConfigFactory.load().getConfig("odl-cluster"));
+    system = ActorSystem.create("opendaylight-rpc", ConfigFactory.load().getConfig("odl-cluster-rpc"));
   }
 
   @AfterClass
index e6793741a3ec2ef9030a2e469058ab92de93c153..83f52930b2b07ac32c75f83f437f1048132b54df 100644 (file)
@@ -10,10 +10,8 @@ import akka.actor.Props;
 import akka.testkit.JavaTestKit;
 import com.google.common.base.Predicate;
 import com.typesafe.config.ConfigFactory;
-
 import org.junit.After;
 import org.junit.AfterClass;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -22,8 +20,6 @@ import org.opendaylight.controller.remote.rpc.registry.gossip.Messages;
 import org.opendaylight.controller.sal.connector.api.RpcRouter;
 import org.opendaylight.controller.utils.ConditionalProbe;
 import org.opendaylight.yangtools.yang.common.QName;
-import scala.concurrent.Await;
-import scala.concurrent.Future;
 import scala.concurrent.duration.FiniteDuration;
 
 import javax.annotation.Nullable;
@@ -33,9 +29,9 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 
-import static org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.SetLocalRouter;
 import static org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.AddOrUpdateRoutes;
 import static org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.RemoveRoutes;
+import static org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.SetLocalRouter;
 
 public class RpcRegistryTest {
 
@@ -95,7 +91,6 @@ public class RpcRegistryTest {
    */
   @Test
   public void testAddRemoveRpcOnSameNode() throws URISyntaxException, InterruptedException {
-    validateSystemStartup();
 
     final JavaTestKit mockBroker = new JavaTestKit(node1);
 
@@ -137,8 +132,6 @@ public class RpcRegistryTest {
   @Test
   public void testRpcAddRemoveInCluster() throws URISyntaxException, InterruptedException {
 
-    validateSystemStartup();
-
     final JavaTestKit mockBroker1 = new JavaTestKit(node1);
 
     //install probe on node2's bucket store
@@ -146,7 +139,6 @@ public class RpcRegistryTest {
     final JavaTestKit probe2 = createProbeForMessage(
         node2, bucketStorePath, Messages.BucketStoreMessages.UpdateRemoteBuckets.class);
 
-
     //Add rpc on node 1
     registry1.tell(new SetLocalRouter(mockBroker1.getRef()), mockBroker1.getRef());
     registry1.tell(getAddRouteMessage(), mockBroker1.getRef());
@@ -175,8 +167,6 @@ public class RpcRegistryTest {
   @Test
   public void testRpcAddedOnMultiNodes() throws Exception {
 
-    validateSystemStartup();
-
     final JavaTestKit mockBroker1 = new JavaTestKit(node1);
     final JavaTestKit mockBroker2 = new JavaTestKit(node2);
     final JavaTestKit mockBroker3 = new JavaTestKit(node3);
@@ -225,49 +215,6 @@ public class RpcRegistryTest {
 
   }
 
-  private void validateSystemStartup() throws InterruptedException {
-
-    ActorPath gossiper1Path = new ChildActorPath(new ChildActorPath(registry1.path(), "store"), "gossiper");
-    ActorPath gossiper2Path = new ChildActorPath(new ChildActorPath(registry2.path(), "store"), "gossiper");
-    ActorPath gossiper3Path = new ChildActorPath(new ChildActorPath(registry3.path(), "store"), "gossiper");
-
-    ActorSelection gossiper1 = node1.actorSelection(gossiper1Path);
-    ActorSelection gossiper2 = node2.actorSelection(gossiper2Path);
-    ActorSelection gossiper3 = node3.actorSelection(gossiper3Path);
-
-
-    if (!resolveReference(gossiper1, gossiper2, gossiper3))
-      Assert.fail("Could not find gossipers");
-  }
-
-  private Boolean resolveReference(ActorSelection... gossipers) {
-
-    Boolean resolved = true;
-    for (int i = 0; i < 5; i++) {
-
-      resolved = true;
-      System.out.println(System.currentTimeMillis() + " Resolving gossipers; trial #" + i);
-
-      for (ActorSelection gossiper : gossipers) {
-        ActorRef ref = null;
-
-        try {
-          Future<ActorRef> future = gossiper.resolveOne(new FiniteDuration(15000, TimeUnit.MILLISECONDS));
-          ref = Await.result(future, new FiniteDuration(10000, TimeUnit.MILLISECONDS));
-        } catch (Exception e) {
-          System.out.println("Could not find gossiper in attempt#" + i + ". Got exception " + e.getMessage());
-        }
-
-        if (ref == null)
-          resolved = false;
-      }
-
-      if (resolved) break;
-
-    }
-    return resolved;
-  }
-
   private AddOrUpdateRoutes getAddRouteMessage() throws URISyntaxException {
     return new AddOrUpdateRoutes(createRouteIds());
   }
index b21f0f0069e3db4d62a7e024c7c3d5ff513067d2..cd031a1d0abcf330b3c63c90a576b65dc2cd2d1d 100644 (file)
@@ -30,7 +30,7 @@ public class LatestEntryRoutingLogicTest {
 
   @BeforeClass
   public static void setup() throws InterruptedException {
-    system = ActorSystem.create("opendaylight-rpc", ConfigFactory.load().getConfig("odl-cluster"));
+    system = ActorSystem.create("opendaylight-rpc", ConfigFactory.load().getConfig("odl-cluster-rpc"));
   }
 
   @AfterClass
index 8100ed35abd580a13367922ff255e42c61369f93..5c4af8d3da457c99344c0a26942c9d3456694f75 100644 (file)
@@ -1,6 +1,12 @@
-odl-cluster{
+odl-cluster-rpc{
+  bounded-mailbox {
+    mailbox-type = "org.opendaylight.controller.common.actor.MeteredBoundedMailbox"
+    mailbox-capacity = 1000
+    mailbox-push-timeout-time = 10ms
+  }
+
   akka {
-    loglevel = "DEBUG"
+    loglevel = "INFO"
     #log-config-on-start = on
 
     actor {
@@ -34,12 +40,22 @@ unit-test{
     loglevel = "INFO"
     #loggers = ["akka.event.slf4j.Slf4jLogger"]
   }
+  bounded-mailbox {
+    mailbox-type = "org.opendaylight.controller.common.actor.MeteredBoundedMailbox"
+    mailbox-capacity = 1000
+    mailbox-push-timeout-time = 10ms
+  }
 }
 
 memberA{
+  bounded-mailbox {
+    mailbox-type = "org.opendaylight.controller.common.actor.MeteredBoundedMailbox"
+    mailbox-capacity = 1000
+    mailbox-push-timeout-time = 10ms
+  }
   akka {
     loglevel = "INFO"
-    loggers = ["akka.event.slf4j.Slf4jLogger"]
+    #loggers = ["akka.event.slf4j.Slf4jLogger"]
     actor {
       provider = "akka.cluster.ClusterActorRefProvider"
       debug {
@@ -65,11 +81,20 @@ memberA{
   }
 }
 memberB{
+  bounded-mailbox {
+    mailbox-type = "org.opendaylight.controller.common.actor.MeteredBoundedMailbox"
+    mailbox-capacity = 1000
+    mailbox-push-timeout-time = 10ms
+  }
   akka {
     loglevel = "INFO"
-    loggers = ["akka.event.slf4j.Slf4jLogger"]
+    #loggers = ["akka.event.slf4j.Slf4jLogger"]
+
     actor {
       provider = "akka.cluster.ClusterActorRefProvider"
+      debug {
+        #lifecycle = on
+      }
     }
     remote {
       log-received-messages = off
@@ -90,11 +115,19 @@ memberB{
   }
 }
 memberC{
+  bounded-mailbox {
+    mailbox-type = "org.opendaylight.controller.common.actor.MeteredBoundedMailbox"
+    mailbox-capacity = 1000
+    mailbox-push-timeout-time = 10ms
+  }
   akka {
     loglevel = "INFO"
-    loggers = ["akka.event.slf4j.Slf4jLogger"]
+    #loggers = ["akka.event.slf4j.Slf4jLogger"]
     actor {
       provider = "akka.cluster.ClusterActorRefProvider"
+      debug {
+        #lifecycle = on
+      }
     }
     remote {
       log-received-messages = off
@@ -113,4 +146,5 @@ memberC{
       auto-down-unreachable-after = 10s
     }
   }
-}
\ No newline at end of file
+}
+
index e61cafa70b40c83f922460572ee232f5043ed4ea..fe5c9f39d8251e903c1ed5d9f173ced7df5f0f5b 100644 (file)
       <artifactId>jaxrs-api</artifactId>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-core-spi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-data-composite-node</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-data-codec-gson</artifactId>
+    </dependency>
+
     <dependency>
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-classic</artifactId>
       <artifactId>mockito-all</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>sal-core-spi</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.yangtools</groupId>
-      <artifactId>yang-data-composite-node</artifactId>
-      <version>0.6.2-SNAPSHOT</version>
-    </dependency>
   </dependencies>
 
   <build>
diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfConstants.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/api/RestconfConstants.java
new file mode 100644 (file)
index 0000000..1ec1c29
--- /dev/null
@@ -0,0 +1,7 @@
+package org.opendaylight.controller.sal.rest.api;
+
+public interface RestconfConstants {
+
+
+    public static String IDENTIFIER = "identifier";
+}
index 9c149a21e60e70ff88c0371e936e3844c05b5985..4a46a3c26712c8e54da6650bd4e68b2de9ad91ca 100644 (file)
@@ -21,10 +21,12 @@ 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.NormalizedNodeContext;
 import org.opendaylight.controller.sal.restconf.impl.StructuredData;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 import org.opendaylight.yangtools.yang.data.api.Node;
 
+
 /**
  * The URI hierarchy for the RESTCONF resources consists of an entry point container, 4 top-level resources, and 1
  * field.
@@ -109,14 +111,14 @@ public interface RestconfService {
     @Path("/config/{identifier:.+}")
     @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,
+    public NormalizedNodeContext readConfigurationData(@Encoded @PathParam("identifier") String identifier,
             @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,
+    public NormalizedNodeContext readOperationalData(@Encoded @PathParam("identifier") String identifier,
             @Context UriInfo uriInfo);
 
     @PUT
diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/AbstractIdentifierAwareJaxRsProvider.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/AbstractIdentifierAwareJaxRsProvider.java
new file mode 100644 (file)
index 0000000..978ae0d
--- /dev/null
@@ -0,0 +1,30 @@
+package org.opendaylight.controller.sal.rest.impl;
+
+import com.google.common.base.Optional;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.UriInfo;
+import org.opendaylight.controller.sal.rest.api.RestconfConstants;
+import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
+import org.opendaylight.controller.sal.restconf.impl.InstanceIdentifierContext;
+
+public class AbstractIdentifierAwareJaxRsProvider {
+
+    @Context
+    private UriInfo uriInfo;
+
+    protected final String getIdentifier() {
+        return uriInfo.getPathParameters().getFirst(RestconfConstants.IDENTIFIER);
+    }
+
+    protected final Optional<InstanceIdentifierContext> getIdentifierWithSchema() {
+        return Optional.of(getInstanceIdentifierContext());
+    }
+
+    protected InstanceIdentifierContext getInstanceIdentifierContext() {
+        return ControllerContext.getInstance().toInstanceIdentifier(getIdentifier());
+    }
+
+    protected UriInfo getUriInfo() {
+        return uriInfo;
+    }
+}
diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonNormalizedNodeBodyReader.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonNormalizedNodeBodyReader.java
new file mode 100644 (file)
index 0000000..dc989d2
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.sal.rest.impl;
+
+import com.google.common.base.Optional;
+import com.google.gson.stream.JsonReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+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.InstanceIdentifierContext;
+import org.opendaylight.controller.sal.restconf.impl.NormalizedNodeContext;
+import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
+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.schema.stream.NormalizedNodeStreamWriter;
+import org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream;
+import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeStreamWriter;
+import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Provider
+@Consumes({ Draft02.MediaTypes.DATA + RestconfService.JSON, Draft02.MediaTypes.OPERATION + RestconfService.JSON,
+        MediaType.APPLICATION_JSON })
+public class JsonNormalizedNodeBodyReader extends AbstractIdentifierAwareJaxRsProvider implements MessageBodyReader<NormalizedNodeContext> {
+
+    private final static Logger LOG = LoggerFactory.getLogger(JsonNormalizedNodeBodyReader.class);
+
+    @Override
+    public boolean isReadable(final Class<?> type, final Type genericType, final Annotation[] annotations,
+            final MediaType mediaType) {
+        return true;
+    }
+
+    @Override
+    public NormalizedNodeContext readFrom(final Class<NormalizedNodeContext> type, final Type genericType,
+            final Annotation[] annotations, final MediaType mediaType,
+            final MultivaluedMap<String, String> httpHeaders, final InputStream entityStream) throws IOException,
+            WebApplicationException {
+        try {
+            Optional<InstanceIdentifierContext> path = getIdentifierWithSchema();
+            NormalizedNodeResult resultHolder = new NormalizedNodeResult();
+            NormalizedNodeStreamWriter writer = ImmutableNormalizedNodeStreamWriter.from(resultHolder);
+            JsonParserStream jsonParser = JsonParserStream.create(writer, path.get().getSchemaContext());
+            JsonReader reader = new JsonReader(new InputStreamReader(entityStream));
+            jsonParser.parse(reader);
+            return new NormalizedNodeContext(path.get(),resultHolder.getResult());
+        } catch (Exception e) {
+            LOG.debug("Error parsing json input", e);
+
+            throw new RestconfDocumentedException("Error parsing input: " + e.getMessage(), ErrorType.PROTOCOL,
+                    ErrorTag.MALFORMED_MESSAGE);
+        }
+    }
+}
+
diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/NormalizedNodeJsonBodyWriter.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/NormalizedNodeJsonBodyWriter.java
new file mode 100644 (file)
index 0000000..cebd326
--- /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.sal.rest.impl;
+
+import com.google.common.base.Charsets;
+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;
+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.InstanceIdentifierContext;
+import org.opendaylight.controller.sal.restconf.impl.NormalizedNodeContext;
+import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
+import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
+import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
+import org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter;
+
+@Provider
+@Produces({ Draft02.MediaTypes.API + RestconfService.JSON, Draft02.MediaTypes.DATA + RestconfService.JSON,
+    Draft02.MediaTypes.OPERATION + RestconfService.JSON, MediaType.APPLICATION_JSON })
+public class NormalizedNodeJsonBodyWriter implements MessageBodyWriter<NormalizedNodeContext> {
+
+    @Override
+    public boolean isWriteable(final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType) {
+        return type.equals(NormalizedNodeContext.class);
+    }
+
+    @Override
+    public long getSize(final NormalizedNodeContext t, final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType) {
+        return -1;
+    }
+
+    @Override
+    public void writeTo(final NormalizedNodeContext t, final Class<?> type, final Type genericType, final Annotation[] annotations,
+            final MediaType mediaType, final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream)
+                    throws IOException, WebApplicationException {
+        if (t.getData() == null) {
+            throw new RestconfDocumentedException(Response.Status.NOT_FOUND);
+        }
+
+        InstanceIdentifierContext pathContext = t.getInstanceIdentifierContext();
+        OutputStreamWriter ouWriter = new OutputStreamWriter(entityStream, Charsets.UTF_8);
+        NormalizedNodeStreamWriter jsonWriter = JSONNormalizedNodeStreamWriter.create(pathContext.getSchemaContext(),ouWriter);
+        NormalizedNodeWriter nnWriter = NormalizedNodeWriter.forStreamWriter(jsonWriter);
+
+        nnWriter.write(t.getData());
+        nnWriter.flush();
+    }
+}
diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/NormalizedNodeXmlBodyWriter.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/NormalizedNodeXmlBodyWriter.java
new file mode 100644 (file)
index 0000000..ef12f93
--- /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.sal.rest.impl;
+
+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;
+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 javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import org.opendaylight.controller.sal.rest.api.Draft02;
+import org.opendaylight.controller.sal.rest.api.RestconfService;
+import org.opendaylight.controller.sal.restconf.impl.InstanceIdentifierContext;
+import org.opendaylight.controller.sal.restconf.impl.NormalizedNodeContext;
+import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
+import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
+import org.opendaylight.yangtools.yang.data.impl.codec.xml.XMLStreamNormalizedNodeStreamWriter;
+import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+
+@Provider
+@Produces({ Draft02.MediaTypes.API + RestconfService.XML, Draft02.MediaTypes.DATA + RestconfService.XML,
+    Draft02.MediaTypes.OPERATION + RestconfService.XML, MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+
+public class NormalizedNodeXmlBodyWriter implements MessageBodyWriter<NormalizedNodeContext> {
+
+
+    private static final XMLOutputFactory XML_FACTORY;
+
+    static {
+        XML_FACTORY  = XMLOutputFactory.newFactory();
+        XML_FACTORY.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
+    }
+
+
+    @Override
+    public boolean isWriteable(final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType) {
+        return type.equals(NormalizedNodeContext.class);
+    }
+
+    @Override
+    public long getSize(final NormalizedNodeContext t, final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType) {
+        return -1;
+    }
+
+    @Override
+    public void writeTo(final NormalizedNodeContext t, final Class<?> type, final Type genericType, final Annotation[] annotations,
+            final MediaType mediaType, final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream)
+                    throws IOException, WebApplicationException {
+        InstanceIdentifierContext pathContext = t.getInstanceIdentifierContext();
+        if (t.getData() == null) {
+            throw new RestconfDocumentedException(Response.Status.NOT_FOUND);
+        }
+
+        XMLStreamWriter xmlWriter;
+        try {
+            xmlWriter = XML_FACTORY.createXMLStreamWriter(entityStream);
+        } catch (XMLStreamException e) {
+            throw new IllegalStateException(e);
+        } catch (FactoryConfigurationError e) {
+            throw new IllegalStateException(e);
+        }
+        NormalizedNode<?, ?> data = t.getData();
+        SchemaPath schemaPath = pathContext.getSchemaNode().getPath().getParent();
+        if(data instanceof MapEntryNode) {
+            data = ImmutableNodes.mapNodeBuilder(data.getNodeType()).addChild((MapEntryNode) data).build();
+            //schemaPath = pathContext.getSchemaNode().getPath();
+        }
+
+        NormalizedNodeStreamWriter jsonWriter = XMLStreamNormalizedNodeStreamWriter.create(xmlWriter,pathContext.getSchemaContext(),schemaPath);
+        NormalizedNodeWriter nnWriter = NormalizedNodeWriter.forStreamWriter(jsonWriter);
+
+        nnWriter.write(data);
+        nnWriter.flush();
+    }
+}
index b4b2a1f9ef7249734e128456a33876abc3862ae8..a298f4b0937ae71c146c9baada15a14535b7de9d 100644 (file)
@@ -19,7 +19,13 @@ public class RestconfApplication extends Application {
 
     @Override
     public Set<Class<?>> getClasses() {
-        return ImmutableSet.<Class<?>> of(RestconfDocumentedExceptionMapper.class);
+        return ImmutableSet.<Class<?>> builder()
+                .add(RestconfDocumentedExceptionMapper.class)
+                .add(XmlNormalizedNodeBodyReader.class)
+                .add(JsonNormalizedNodeBodyReader.class)
+                .add(NormalizedNodeJsonBodyWriter.class)
+                .add(NormalizedNodeXmlBodyWriter.class)
+                .build();
     }
 
     @Override
@@ -33,10 +39,10 @@ public class RestconfApplication extends Application {
         singletons.add(controllerContext);
         singletons.add(brokerFacade);
         singletons.add(restconfImpl);
-        singletons.add(XmlToCompositeNodeProvider.INSTANCE);
         singletons.add(StructuredDataToXmlProvider.INSTANCE);
-        singletons.add(JsonToCompositeNodeProvider.INSTANCE);
         singletons.add(StructuredDataToJsonProvider.INSTANCE);
+        singletons.add(JsonToCompositeNodeProvider.INSTANCE);
+        singletons.add(XmlToCompositeNodeProvider.INSTANCE);
         return singletons;
     }
 
index 933ed0f849e7171b7c16c423c5462aa8de1bb25a..063d2f51afffdd0c7094d7363d95795182b5cd8e 100644 (file)
@@ -30,27 +30,24 @@ import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
 
 @Provider
 @Produces({ Draft02.MediaTypes.API + RestconfService.JSON, Draft02.MediaTypes.DATA + RestconfService.JSON,
-        Draft02.MediaTypes.OPERATION + RestconfService.JSON, MediaType.APPLICATION_JSON })
+    Draft02.MediaTypes.OPERATION + RestconfService.JSON, MediaType.APPLICATION_JSON })
 public enum StructuredDataToJsonProvider implements MessageBodyWriter<StructuredData> {
     INSTANCE;
 
     @Override
-    public boolean isWriteable(final Class<?> type, final Type genericType, final Annotation[] annotations,
-            final MediaType mediaType) {
+    public boolean isWriteable(final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType) {
         return type.equals(StructuredData.class);
     }
 
     @Override
-    public long getSize(final StructuredData t, final Class<?> type, final Type genericType,
-            final Annotation[] annotations, final MediaType mediaType) {
+    public long getSize(final StructuredData t, final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType) {
         return -1;
     }
 
     @Override
-    public void writeTo(final StructuredData t, final Class<?> type, final Type genericType,
-            final Annotation[] annotations, final MediaType mediaType,
-            final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream) throws IOException,
-            WebApplicationException {
+    public void writeTo(final StructuredData t, final Class<?> type, final Type genericType, final Annotation[] annotations,
+            final MediaType mediaType, final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream)
+                    throws IOException, WebApplicationException {
         CompositeNode data = t.getData();
         if (data == null) {
             throw new RestconfDocumentedException(Response.Status.NOT_FOUND);
diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlNormalizedNodeBodyReader.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlNormalizedNodeBodyReader.java
new file mode 100644 (file)
index 0000000..062a448
--- /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.sal.rest.impl;
+
+import com.google.common.base.Optional;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.List;
+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 javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import org.opendaylight.controller.sal.rest.api.Draft02;
+import org.opendaylight.controller.sal.rest.api.RestconfService;
+import org.opendaylight.controller.sal.restconf.impl.InstanceIdentifierContext;
+import org.opendaylight.controller.sal.restconf.impl.NormalizedNodeContext;
+import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
+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.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlUtils;
+import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.parser.DomToNormalizedNodeParserFactory;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+@Provider
+@Consumes({ Draft02.MediaTypes.DATA + RestconfService.XML, Draft02.MediaTypes.OPERATION + RestconfService.XML,
+    MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+public class XmlNormalizedNodeBodyReader extends AbstractIdentifierAwareJaxRsProvider implements MessageBodyReader<NormalizedNodeContext> {
+
+    private final static Logger LOG = LoggerFactory.getLogger(XmlNormalizedNodeBodyReader.class);
+    private final static DomToNormalizedNodeParserFactory DOM_PARSER_FACTORY = DomToNormalizedNodeParserFactory.getInstance(XmlUtils.DEFAULT_XML_CODEC_PROVIDER);
+    private static final DocumentBuilderFactory BUILDERFACTORY;
+
+    static {
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        factory.setNamespaceAware(true);
+        factory.setCoalescing(true);
+        factory.setIgnoringElementContentWhitespace(true);
+        factory.setIgnoringComments(true);
+        BUILDERFACTORY = factory;
+    }
+
+    @Override
+    public boolean isReadable(final Class<?> type, final Type genericType, final Annotation[] annotations,
+            final MediaType mediaType) {
+        return true;
+    }
+
+    @Override
+    public NormalizedNodeContext readFrom(final Class<NormalizedNodeContext> type, final Type genericType,
+            final Annotation[] annotations, final MediaType mediaType,
+            final MultivaluedMap<String, String> httpHeaders, final InputStream entityStream) throws IOException,
+            WebApplicationException {
+        try {
+            Optional<InstanceIdentifierContext> path = getIdentifierWithSchema();
+
+            final DocumentBuilder dBuilder;
+            try {
+                dBuilder = BUILDERFACTORY.newDocumentBuilder();
+            } catch (ParserConfigurationException e) {
+                throw new RuntimeException("Failed to parse XML document", e);
+            }
+            Document doc = dBuilder.parse(entityStream);
+
+            NormalizedNode<?, ?> result = parse(path.get(),doc);
+            return new NormalizedNodeContext(path.get(),result);
+        } catch (Exception e) {
+            LOG.debug("Error parsing json input", e);
+
+            throw new RestconfDocumentedException("Error parsing input: " + e.getMessage(), ErrorType.PROTOCOL,
+                    ErrorTag.MALFORMED_MESSAGE);
+        }
+    }
+
+    private static NormalizedNode<?,?> parse(InstanceIdentifierContext pathContext,Document doc) {
+        List<Element> elements = Collections.singletonList(doc.getDocumentElement());
+        DataSchemaNode schemaNode = pathContext.getSchemaNode();
+        if(schemaNode instanceof ContainerSchemaNode) {
+            return DOM_PARSER_FACTORY.getContainerNodeParser().parse(Collections.singletonList(doc.getDocumentElement()), (ContainerSchemaNode) schemaNode);
+        } else if(schemaNode instanceof ListSchemaNode) {
+            ListSchemaNode casted = (ListSchemaNode) schemaNode;
+            return DOM_PARSER_FACTORY.getMapEntryNodeParser().parse(elements, casted);
+        }
+        return null;
+    }
+}
+
index 5944d6003e9e1e33dba8a0b482a60de5f01ac4c0..6b9da80c685f913cce59edb19bc4588b16e0ed57 100644 (file)
@@ -28,6 +28,7 @@ import org.opendaylight.controller.sal.restconf.impl.NodeWrapper;
 import org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper;
 import org.opendaylight.yangtools.yang.data.api.Node;
 
+@Deprecated
 public class XmlToCompositeNodeReader {
 
     private final static XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
@@ -45,7 +46,6 @@ public class XmlToCompositeNodeReader {
         }
 
         eventReader = xmlInputFactory.createXMLEventReader(entityStream);
-
         if (eventReader.hasNext()) {
             XMLEvent element = eventReader.peek();
             if (element.isStartDocument()) {
@@ -110,7 +110,7 @@ public class XmlToCompositeNodeReader {
         return entityStream;
     }
 
-    private boolean isInputStreamEmpty(InputStream entityStream) throws IOException {
+    private boolean isInputStreamEmpty(final InputStream entityStream) throws IOException {
         boolean isEmpty = false;
         entityStream.mark(1);
         if (entityStream.read() == -1) {
@@ -180,7 +180,7 @@ public class XmlToCompositeNodeReader {
                 resolveValueOfElement(data, startElement));
     }
 
-    private String getValueOf(StartElement startElement) throws XMLStreamException {
+    private String getValueOf(final StartElement startElement) throws XMLStreamException {
         String data = null;
         if (eventReader.hasNext()) {
             final XMLEvent innerEvent = eventReader.peek();
@@ -201,7 +201,7 @@ public class XmlToCompositeNodeReader {
         return data == null ? null : data.trim();
     }
 
-    private String getAdditionalData(XMLEvent event) throws XMLStreamException {
+    private String getAdditionalData(final XMLEvent event) throws XMLStreamException {
         String data = "";
         if (eventReader.hasNext()) {
             final XMLEvent innerEvent = eventReader.peek();
@@ -216,16 +216,16 @@ public class XmlToCompositeNodeReader {
         return data;
     }
 
-    private String getLocalNameFor(StartElement startElement) {
+    private String getLocalNameFor(final StartElement startElement) {
         return startElement.getName().getLocalPart();
     }
 
-    private URI getNamespaceFor(StartElement startElement) {
+    private URI getNamespaceFor(final StartElement startElement) {
         String namespaceURI = startElement.getName().getNamespaceURI();
         return namespaceURI.isEmpty() ? null : URI.create(namespaceURI);
     }
 
-    private Object resolveValueOfElement(String value, StartElement startElement) {
+    private Object resolveValueOfElement(final String value, final StartElement startElement) {
         // it could be instance-identifier Built-In Type
         if (value.startsWith("/")) {
             IdentityValuesDTO iiValue = RestUtil.asInstanceIdentifier(value, new RestUtil.PrefixMapingFromXml(
diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlToNormalizedNodeReaderWithSchema.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlToNormalizedNodeReaderWithSchema.java
deleted file mode 100644 (file)
index 935d96c..0000000
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.rest.impl;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Stack;
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.events.Characters;
-import javax.xml.stream.events.StartElement;
-import javax.xml.stream.events.XMLEvent;
-import org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper;
-import org.opendaylight.controller.sal.restconf.impl.IdentityValuesDTO;
-import org.opendaylight.controller.sal.restconf.impl.InstanceIdWithSchemaNode;
-import org.opendaylight.controller.sal.restconf.impl.NodeWrapper;
-import org.opendaylight.controller.sal.restconf.impl.RestCodec;
-import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
-import org.opendaylight.controller.sal.restconf.impl.RestconfError.ErrorTag;
-import org.opendaylight.controller.sal.restconf.impl.RestconfError.ErrorType;
-import org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.Node;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-
-public class XmlToNormalizedNodeReaderWithSchema {
-
-    private final static XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
-    private XMLEventReader eventReader;
-    private InstanceIdWithSchemaNode iiWithSchema;
-
-    public XmlToNormalizedNodeReaderWithSchema(final InstanceIdWithSchemaNode iiWithSchema) {
-        this.iiWithSchema = iiWithSchema;
-    }
-
-    public Node<?> 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)) {
-            return null;
-        }
-
-        eventReader = xmlInputFactory.createXMLEventReader(entityStream);
-        if (eventReader.hasNext()) {
-            XMLEvent element = eventReader.peek();
-            if (element.isStartDocument()) {
-                eventReader.nextEvent();
-            }
-        }
-
-        final Stack<NodeWrapper<?>> processingQueue = new Stack<>();
-        NodeWrapper<?> root = null;
-        NodeWrapper<?> element = null;
-        Stack<DataSchemaNode> processingQueueSchema = new Stack<>();
-
-        while (eventReader.hasNext()) {
-            final XMLEvent event = eventReader.nextEvent();
-
-            if (event.isStartElement()) {
-                final StartElement startElement = event.asStartElement();
-                CompositeNodeWrapper compParentNode = null;
-                if (!processingQueue.isEmpty() && processingQueue.peek() instanceof CompositeNodeWrapper) {
-                    compParentNode = (CompositeNodeWrapper) processingQueue.peek();
-                    findSchemaNodeForElement(startElement, processingQueueSchema);
-                } else {
-                    processingQueueSchema = checkElementAndSchemaNodeNameAndNamespace(startElement,
-                            iiWithSchema.getSchemaNode());
-                    DataSchemaNode currentSchemaNode = processingQueueSchema.peek();
-                    if (!(currentSchemaNode instanceof ListSchemaNode)
-                            && !(currentSchemaNode instanceof ContainerSchemaNode)) {
-                        throw new UnsupportedFormatException(
-                                "Top level element has to be of type list or container schema node.");
-                    }
-                }
-
-                NodeWrapper<?> newNode = null;
-                if (isCompositeNodeEvent(event)) {
-                    newNode = resolveCompositeNodeFromStartElement(processingQueueSchema.peek().getQName());
-                    if (root == null) {
-                        root = newNode;
-                    }
-                } else if (isSimpleNodeEvent(event)) {
-                    newNode = resolveSimpleNodeFromStartElement(processingQueueSchema.peek(), getValueOf(startElement));
-                    if (root == null) {
-                        root = newNode;
-                    }
-                }
-
-                if (newNode != null) {
-                    processingQueue.push(newNode);
-                    if (compParentNode != null) {
-                        compParentNode.addValue(newNode);
-                    }
-                }
-            } else if (event.isEndElement()) {
-                element = processingQueue.pop();
-//                if(((EndElement)event).getName().getLocalPart().equals
-                processingQueueSchema.pop();
-            }
-        }
-
-        if (!root.getLocalName().equals(element.getLocalName())) {
-            throw new UnsupportedFormatException("XML should contain only one root element");
-        }
-
-        return root.unwrap();
-    }
-
-    private void findSchemaNodeForElement(StartElement element, Stack<DataSchemaNode> processingQueueSchema) {
-        DataSchemaNode currentSchemaNode = processingQueueSchema.peek();
-        if (currentSchemaNode instanceof DataNodeContainer) {
-            final URI realNamespace = getNamespaceFor(element);
-            final String realName = getLocalNameFor(element);
-            Map<URI, DataSchemaNode> childNamesakes = resolveChildsWithNameAsElement(
-                    ((DataNodeContainer) currentSchemaNode), realName);
-            DataSchemaNode childDataSchemaNode = childNamesakes.get(realNamespace);
-            if (childDataSchemaNode == null) {
-                throw new RestconfDocumentedException("Element " + realName + " has namespace " + realNamespace
-                        + ". Available namespaces are: " + childNamesakes.keySet(), ErrorType.APPLICATION,
-                        ErrorTag.INVALID_VALUE);
-            }
-            processingQueueSchema.push(childDataSchemaNode);
-        } else {
-            throw new RestconfDocumentedException("Element " + processingQueueSchema.peek().getQName().getLocalName()
-                    + " should be data node container .", ErrorType.APPLICATION, ErrorTag.INVALID_VALUE);
-        }
-
-    }
-
-    /**
-     * Returns map of data schema node which are accesible by URI which have equal name
-     */
-    private Map<URI, DataSchemaNode> resolveChildsWithNameAsElement(final DataNodeContainer dataNodeContainer,
-            final String realName) {
-        final Map<URI, DataSchemaNode> namespaceToDataSchemaNode = new HashMap<URI, DataSchemaNode>();
-        for (DataSchemaNode dataSchemaNode : dataNodeContainer.getChildNodes()) {
-            if (dataSchemaNode.equals(realName)) {
-                namespaceToDataSchemaNode.put(dataSchemaNode.getQName().getNamespace(), dataSchemaNode);
-            }
-        }
-        return namespaceToDataSchemaNode;
-    }
-
-    private final Stack<DataSchemaNode> checkElementAndSchemaNodeNameAndNamespace(final StartElement startElement,
-            final DataSchemaNode node) {
-        checkArgument(startElement != null, "Start Element cannot be NULL!");
-        final String expectedName = node.getQName().getLocalName();
-        final String xmlName = getLocalNameFor(startElement);
-        final URI expectedNamespace = node.getQName().getNamespace();
-        final URI xmlNamespace = getNamespaceFor(startElement);
-        if (!expectedName.equals(xmlName)) {
-            throw new RestconfDocumentedException("Xml element name: " + xmlName + "\nSchema node name: "
-                    + expectedName, org.opendaylight.controller.sal.restconf.impl.RestconfError.ErrorType.APPLICATION,
-                    ErrorTag.INVALID_VALUE);
-        }
-
-        if (xmlNamespace != null && !expectedNamespace.equals(xmlNamespace)) {
-            throw new RestconfDocumentedException("Xml element ns: " + xmlNamespace + "\nSchema node ns: "
-                    + expectedNamespace,
-                    org.opendaylight.controller.sal.restconf.impl.RestconfError.ErrorType.APPLICATION,
-                    ErrorTag.INVALID_VALUE);
-        }
-        Stack<DataSchemaNode> processingQueueSchema = new Stack<>();
-        processingQueueSchema.push(node);
-        return processingQueueSchema;
-    }
-
-    /**
-     * 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);
-        }
-        return entityStream;
-    }
-
-    private boolean isInputStreamEmpty(final InputStream entityStream) throws IOException {
-        boolean isEmpty = false;
-        entityStream.mark(1);
-        if (entityStream.read() == -1) {
-            isEmpty = true;
-        }
-        entityStream.reset();
-        return isEmpty;
-    }
-
-    private boolean isSimpleNodeEvent(final XMLEvent event) throws XMLStreamException {
-        checkArgument(event != null, "XML Event cannot be NULL!");
-        if (event.isStartElement()) {
-            XMLEvent innerEvent = skipCommentsAndWhitespace();
-            if (innerEvent != null && (innerEvent.isCharacters() || innerEvent.isEndElement())) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private boolean isCompositeNodeEvent(final XMLEvent event) throws XMLStreamException {
-        checkArgument(event != null, "XML Event cannot be NULL!");
-        if (event.isStartElement()) {
-            XMLEvent innerEvent = skipCommentsAndWhitespace();
-            if (innerEvent != null) {
-                if (innerEvent.isStartElement()) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    private XMLEvent skipCommentsAndWhitespace() throws XMLStreamException {
-        while (eventReader.hasNext()) {
-            XMLEvent event = eventReader.peek();
-            if (event.getEventType() == XMLStreamConstants.COMMENT) {
-                eventReader.nextEvent();
-                continue;
-            }
-
-            if (event.isCharacters()) {
-                Characters chars = event.asCharacters();
-                if (chars.isWhiteSpace()) {
-                    eventReader.nextEvent();
-                    continue;
-                }
-            }
-            return event;
-        }
-        return null;
-    }
-
-    private CompositeNodeWrapper resolveCompositeNodeFromStartElement(final QName qName) {
-        // checkArgument(startElement != null, "Start Element cannot be NULL!");
-        CompositeNodeWrapper compositeNodeWrapper = new CompositeNodeWrapper("dummy");
-        compositeNodeWrapper.setQname(qName);
-        return compositeNodeWrapper;
-
-    }
-
-    private SimpleNodeWrapper resolveSimpleNodeFromStartElement(final DataSchemaNode node, final String value)
-            throws XMLStreamException {
-        // checkArgument(startElement != null, "Start Element cannot be NULL!");
-        Object deserializedValue = null;
-
-        if (node instanceof LeafSchemaNode) {
-            TypeDefinition<?> baseType = RestUtil.resolveBaseTypeFrom(((LeafSchemaNode) node).getType());
-            deserializedValue = RestCodec.from(baseType, iiWithSchema.getMountPoint()).deserialize(value);
-        } else if (node instanceof LeafListSchemaNode) {
-            TypeDefinition<?> baseType = RestUtil.resolveBaseTypeFrom(((LeafListSchemaNode) node).getType());
-            deserializedValue = RestCodec.from(baseType, iiWithSchema.getMountPoint()).deserialize(value);
-        }
-        // String data;
-        // if (data == null) {
-        // return new EmptyNodeWrapper(getNamespaceFor(startElement), getLocalNameFor(startElement));
-        // }
-        SimpleNodeWrapper simpleNodeWrapper = new SimpleNodeWrapper("dummy", deserializedValue);
-        simpleNodeWrapper.setQname(node.getQName());
-        return simpleNodeWrapper;
-    }
-
-    private String getValueOf(final StartElement startElement) throws XMLStreamException {
-        String data = null;
-        if (eventReader.hasNext()) {
-            final XMLEvent innerEvent = eventReader.peek();
-            if (innerEvent.isCharacters()) {
-                final Characters chars = innerEvent.asCharacters();
-                if (!chars.isWhiteSpace()) {
-                    data = innerEvent.asCharacters().getData();
-                    data = data + getAdditionalData(eventReader.nextEvent());
-                }
-            } else if (innerEvent.isEndElement()) {
-                if (startElement.getLocation().getCharacterOffset() == innerEvent.getLocation().getCharacterOffset()) {
-                    data = null;
-                } else {
-                    data = "";
-                }
-            }
-        }
-        return data == null ? null : data.trim();
-    }
-
-    private String getAdditionalData(final XMLEvent event) throws XMLStreamException {
-        String data = "";
-        if (eventReader.hasNext()) {
-            final XMLEvent innerEvent = eventReader.peek();
-            if (innerEvent.isCharacters() && !innerEvent.isEndElement()) {
-                final Characters chars = innerEvent.asCharacters();
-                if (!chars.isWhiteSpace()) {
-                    data = innerEvent.asCharacters().getData();
-                    data = data + getAdditionalData(eventReader.nextEvent());
-                }
-            }
-        }
-        return data;
-    }
-
-    private String getLocalNameFor(final StartElement startElement) {
-        return startElement.getName().getLocalPart();
-    }
-
-    private URI getNamespaceFor(final StartElement startElement) {
-        String namespaceURI = startElement.getName().getNamespaceURI();
-        return namespaceURI.isEmpty() ? null : URI.create(namespaceURI);
-    }
-
-    private Object resolveValueOfElement(final String value, final StartElement startElement) {
-        // it could be instance-identifier Built-In Type
-        if (value.startsWith("/")) {
-            IdentityValuesDTO iiValue = RestUtil.asInstanceIdentifier(value, new RestUtil.PrefixMapingFromXml(
-                    startElement));
-            if (iiValue != null) {
-                return iiValue;
-            }
-        }
-        // it could be identityref Built-In Type
-        String[] namespaceAndValue = value.split(":");
-        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);
-            }
-        }
-        // it is not "prefix:value" but just "value"
-        return value;
-    }
-
-}
index f11e25c046feab69fe3c41f229dfdbadd496e18d..8dbc5b50ee5dbd8ac374ef7d1452384442923085 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.sal.restconf.impl;
 
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.ListenableFuture;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@ -40,6 +41,7 @@ import javax.ws.rs.core.Response.Status;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 
 import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION;
@@ -176,31 +178,39 @@ public class BrokerFacade {
     private NormalizedNode<?, ?> readDataViaTransaction(final DOMDataReadTransaction transaction,
             LogicalDatastoreType datastore, YangInstanceIdentifier path) {
         LOG.trace("Read " + datastore.name() + " via Restconf: {}", path);
-        final CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> listenableFuture =
-                                                                 transaction.read(datastore, path);
+        final ListenableFuture<Optional<NormalizedNode<?, ?>>> listenableFuture = transaction.read(datastore, path);
+        if (listenableFuture != null) {
+            Optional<NormalizedNode<?, ?>> optional;
+            try {
+                LOG.debug("Reading result data from transaction.");
+                optional = listenableFuture.get();
+            } catch (InterruptedException | ExecutionException e) {
+                throw new RestconfDocumentedException("Problem to get data from transaction.", e.getCause());
 
-        try {
-            Optional<NormalizedNode<?, ?>> optional = listenableFuture.checkedGet();
-            return optional.isPresent() ? optional.get() : null;
-        } catch(ReadFailedException e) {
-            throw new RestconfDocumentedException(e.getMessage(), e, e.getErrorList());
+            }
+            if (optional != null) {
+                if (optional.isPresent()) {
+                    return optional.get();
+                }
+            }
         }
+        return null;
     }
 
     private CheckedFuture<Void, TransactionCommitFailedException> postDataViaTransaction(
             final DOMDataReadWriteTransaction rWTransaction, final LogicalDatastoreType datastore,
             final YangInstanceIdentifier path, final NormalizedNode<?, ?> payload, DataNormalizationOperation<?> root) {
-        CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> futureDatastoreData =
-                                                               rWTransaction.read(datastore, path);
+        ListenableFuture<Optional<NormalizedNode<?, ?>>> futureDatastoreData = rWTransaction.read(datastore, path);
         try {
-            final Optional<NormalizedNode<?, ?>> optionalDatastoreData = futureDatastoreData.checkedGet();
+            final Optional<NormalizedNode<?, ?>> optionalDatastoreData = futureDatastoreData.get();
             if (optionalDatastoreData.isPresent() && payload.equals(optionalDatastoreData.get())) {
-                LOG.trace("Post Configuration via Restconf was not executed because data already exists :{}", path);
+                String errMsg = "Post Configuration via Restconf was not executed because data already exists";
+                LOG.trace(errMsg + ":{}", path);
                 throw new RestconfDocumentedException("Data already exists for path: " + path, ErrorType.PROTOCOL,
                         ErrorTag.DATA_EXISTS);
             }
-        } catch(ReadFailedException e) {
-            LOG.warn("Error reading from datastore with path: " + path, e);
+        } catch (InterruptedException | ExecutionException e) {
+            LOG.trace("It wasn't possible to get data loaded from datastore at path " + path);
         }
 
         ensureParentsByMerge(datastore, path, rWTransaction, root);
@@ -241,21 +251,27 @@ public class BrokerFacade {
             try {
                 currentOp = currentOp.getChild(currentArg);
             } catch (DataNormalizationException e) {
-                throw new RestconfDocumentedException(
-                        String.format("Error normalizing data for path %s", normalizedPath), e);
+                throw new IllegalArgumentException(
+                        String.format("Invalid child encountered in path %s", normalizedPath), e);
             }
             currentArguments.add(currentArg);
             YangInstanceIdentifier currentPath = YangInstanceIdentifier.create(currentArguments);
 
+            final Boolean exists;
+
             try {
 
-                boolean exists = rwTx.exists(store, currentPath).checkedGet();
-                if (!exists && iterator.hasNext()) {
-                    rwTx.merge(store, currentPath, currentOp.createDefault(currentArg));
-                }
+                CheckedFuture<Boolean, ReadFailedException> future =
+                    rwTx.exists(store, currentPath);
+                exists = future.checkedGet();
             } catch (ReadFailedException e) {
                 LOG.error("Failed to read pre-existing data from store {} path {}", store, currentPath, e);
-                throw new RestconfDocumentedException("Failed to read pre-existing data", e);
+                throw new IllegalStateException("Failed to read pre-existing data", e);
+            }
+
+
+            if (!exists && iterator.hasNext()) {
+                rwTx.merge(store, currentPath, currentOp.createDefault(currentArg));
             }
         }
     }
index 93e6a2c0e98504e169703423837177078992c2a4..b0a6e0d6f3885f20242d483044c0cfa92af1dea6 100644 (file)
@@ -118,15 +118,19 @@ public class ControllerContext implements SchemaContextListener {
         this.onGlobalContextUpdated(schemas);
     }
 
-    public InstanceIdWithSchemaNode toInstanceIdentifier(final String restconfInstance) {
+    public InstanceIdentifierContext toInstanceIdentifier(final String restconfInstance) {
         return this.toIdentifier(restconfInstance, false);
     }
 
-    public InstanceIdWithSchemaNode toMountPointIdentifier(final String restconfInstance) {
+    public SchemaContext getGlobalSchema() {
+        return globalSchema;
+    }
+
+    public InstanceIdentifierContext toMountPointIdentifier(final String restconfInstance) {
         return this.toIdentifier(restconfInstance, true);
     }
 
-    private InstanceIdWithSchemaNode toIdentifier(final String restconfInstance, final boolean toMountPointIdentifier) {
+    private InstanceIdentifierContext toIdentifier(final String restconfInstance, final boolean toMountPointIdentifier) {
         this.checkPreconditions();
 
         final List<String> pathArgs = urlPathArgsDecode(SLASH_SPLITTER.split(restconfInstance));
@@ -144,7 +148,7 @@ public class ControllerContext implements SchemaContextListener {
 
         InstanceIdentifierBuilder builder = YangInstanceIdentifier.builder();
         Module latestModule = globalSchema.findModuleByName(startModule, null);
-        InstanceIdWithSchemaNode iiWithSchemaNode = this.collectPathArguments(builder, pathArgs, latestModule, null,
+        InstanceIdentifierContext iiWithSchemaNode = this.collectPathArguments(builder, pathArgs, latestModule, null,
                 toMountPointIdentifier);
 
         if (iiWithSchemaNode == null) {
@@ -462,7 +466,7 @@ public class ControllerContext implements SchemaContextListener {
         return object == null ? "" : URLEncoder.encode(object.toString(), ControllerContext.URI_ENCODING_CHAR_SET);
     }
 
-    private InstanceIdWithSchemaNode collectPathArguments(final InstanceIdentifierBuilder builder,
+    private InstanceIdentifierContext collectPathArguments(final InstanceIdentifierBuilder builder,
             final List<String> strings, final DataNodeContainer parentNode, final DOMMountPoint mountPoint,
             final boolean returnJustMountPoint) {
         Preconditions.<List<String>> checkNotNull(strings);
@@ -472,7 +476,7 @@ public class ControllerContext implements SchemaContextListener {
         }
 
         if (strings.isEmpty()) {
-            return new InstanceIdWithSchemaNode(builder.toInstance(), ((DataSchemaNode) parentNode), mountPoint);
+            return new InstanceIdentifierContext(builder.toInstance(), ((DataSchemaNode) parentNode), mountPoint,mountPoint != null ? mountPoint.getSchemaContext() : globalSchema);
         }
 
         String head = strings.iterator().next();
@@ -511,12 +515,12 @@ public class ControllerContext implements SchemaContextListener {
 
                 if (returnJustMountPoint) {
                     YangInstanceIdentifier instance = YangInstanceIdentifier.builder().toInstance();
-                    return new InstanceIdWithSchemaNode(instance, mountPointSchema, mount);
+                    return new InstanceIdentifierContext(instance, mountPointSchema, mount,mountPointSchema);
                 }
 
                 if (strings.size() == 1) {
                     YangInstanceIdentifier instance = YangInstanceIdentifier.builder().toInstance();
-                    return new InstanceIdWithSchemaNode(instance, mountPointSchema, mount);
+                    return new InstanceIdentifierContext(instance, mountPointSchema, mount,mountPointSchema);
                 }
 
                 final String moduleNameBehindMountPoint = toModuleName(strings.get(1));
@@ -632,7 +636,7 @@ public class ControllerContext implements SchemaContextListener {
                     returnJustMountPoint);
         }
 
-        return new InstanceIdWithSchemaNode(builder.toInstance(), targetNode, mountPoint);
+        return new InstanceIdentifierContext(builder.toInstance(), targetNode, mountPoint,mountPoint != null ? mountPoint.getSchemaContext() : globalSchema);
     }
 
     public static DataSchemaNode findInstanceDataChildByNameAndNamespace(final DataNodeContainer container, final String name,
@@ -10,18 +10,21 @@ package org.opendaylight.controller.sal.restconf.impl;
 import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
-public class InstanceIdWithSchemaNode {
+public class InstanceIdentifierContext {
 
     private final YangInstanceIdentifier instanceIdentifier;
     private final DataSchemaNode schemaNode;
     private final DOMMountPoint mountPoint;
+    private final SchemaContext schemaContext;
 
-    public InstanceIdWithSchemaNode(YangInstanceIdentifier instanceIdentifier, DataSchemaNode schemaNode,
-            DOMMountPoint mountPoint) {
+    public InstanceIdentifierContext(YangInstanceIdentifier instanceIdentifier, DataSchemaNode schemaNode,
+            DOMMountPoint mountPoint,SchemaContext context) {
         this.instanceIdentifier = instanceIdentifier;
         this.schemaNode = schemaNode;
         this.mountPoint = mountPoint;
+        this.schemaContext = context;
     }
 
     public YangInstanceIdentifier getInstanceIdentifier() {
@@ -36,4 +39,8 @@ public class InstanceIdWithSchemaNode {
         return mountPoint;
     }
 
+    public SchemaContext getSchemaContext() {
+        return schemaContext;
+    }
+
 }
diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/NormalizedDataPrunner.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/NormalizedDataPrunner.java
new file mode 100644 (file)
index 0000000..5d0185b
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.sal.restconf.impl;
+
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode;
+import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
+import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MixinNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.OrderedLeafSetNode;
+import org.opendaylight.yangtools.yang.data.api.schema.OrderedMapNode;
+import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
+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.DataContainerNodeAttrBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
+
+class NormalizedDataPrunner {
+
+    public DataContainerChild<?, ?> pruneDataAtDepth(final DataContainerChild<?, ?> node, final Integer depth) {
+        if (depth == null) {
+            return node;
+        }
+
+        if (node instanceof LeafNode || node instanceof LeafSetNode || node instanceof AnyXmlNode
+                || node instanceof OrderedLeafSetNode) {
+            return node;
+        } else if (node instanceof MixinNode) {
+            return processMixinNode(node, depth);
+        } else if (node instanceof DataContainerNode) {
+            return processContainerNode(node, depth);
+        }
+        throw new IllegalStateException("Unexpected Mixin node occured why pruning data to requested depth");
+    }
+
+    private DataContainerChild<?, ?> processMixinNode(final NormalizedNode<?, ?> node, final Integer depth) {
+        if (node instanceof AugmentationNode) {
+            return processAugmentationNode(node, depth);
+        } else if (node instanceof ChoiceNode) {
+            return processChoiceNode(node, depth);
+        } else if (node instanceof OrderedMapNode) {
+            return processOrderedMapNode(node, depth);
+        } else if (node instanceof MapNode) {
+            return processMapNode(node, depth);
+        } else if (node instanceof UnkeyedListNode) {
+            return processUnkeyedListNode(node, depth);
+        }
+        throw new IllegalStateException("Unexpected Mixin node occured why pruning data to requested depth");
+    }
+
+    private DataContainerChild<?, ?> processContainerNode(final NormalizedNode<?, ?> node, final Integer depth) {
+        final ContainerNode containerNode = (ContainerNode) node;
+        DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> newContainerBuilder = Builders.containerBuilder()
+                .withNodeIdentifier(containerNode.getIdentifier());
+        if (depth > 1) {
+            processDataContainerChild((DataContainerNode<?>) node, depth, newContainerBuilder);
+        }
+        return newContainerBuilder.build();
+    }
+
+    private DataContainerChild<?, ?> processChoiceNode(final NormalizedNode<?, ?> node, final Integer depth) {
+        final ChoiceNode choiceNode = (ChoiceNode) node;
+        DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> newChoiceBuilder = Builders.choiceBuilder()
+                .withNodeIdentifier(choiceNode.getIdentifier());
+
+        processDataContainerChild((DataContainerNode<?>) node, depth, newChoiceBuilder);
+
+        return newChoiceBuilder.build();
+    }
+
+    private DataContainerChild<?, ?> processAugmentationNode(final NormalizedNode<?, ?> node, final Integer depth) {
+        final AugmentationNode augmentationNode = (AugmentationNode) node;
+        DataContainerNodeBuilder<AugmentationIdentifier, ? extends DataContainerChild<?, ?>> newAugmentationBuilder = Builders
+                .augmentationBuilder().withNodeIdentifier(augmentationNode.getIdentifier());
+
+        processDataContainerChild((DataContainerNode<?>) node, depth, newAugmentationBuilder);
+
+        return newAugmentationBuilder.build();
+    }
+
+    private void processDataContainerChild(
+            final DataContainerNode<?> node,
+            final Integer depth,
+            final DataContainerNodeBuilder<? extends YangInstanceIdentifier.PathArgument, ? extends DataContainerNode<?>> newBuilder) {
+
+        for (DataContainerChild<? extends PathArgument, ?> nodeValue : node.getValue()) {
+            newBuilder.withChild(pruneDataAtDepth(nodeValue, depth - 1));
+        }
+
+    }
+
+    private DataContainerChild<?, ?> processUnkeyedListNode(final NormalizedNode<?, ?> node, final Integer depth) {
+        CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> newUnkeyedListBuilder = Builders
+                .unkeyedListBuilder();
+        if (depth > 1) {
+            for (UnkeyedListEntryNode oldUnkeyedListEntry : ((UnkeyedListNode) node).getValue()) {
+                DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> newUnkeyedListEntry = Builders
+                        .unkeyedListEntryBuilder().withNodeIdentifier(oldUnkeyedListEntry.getIdentifier());
+                for (DataContainerChild<? extends PathArgument, ?> oldUnkeyedListEntryValue : oldUnkeyedListEntry
+                        .getValue()) {
+                    newUnkeyedListEntry.withChild(pruneDataAtDepth(oldUnkeyedListEntryValue, depth - 1));
+                }
+                newUnkeyedListBuilder.addChild(newUnkeyedListEntry.build());
+            }
+        }
+        return newUnkeyedListBuilder.build();
+    }
+
+    private DataContainerChild<?, ?> processOrderedMapNode(final NormalizedNode<?, ?> node, final Integer depth) {
+        CollectionNodeBuilder<MapEntryNode, OrderedMapNode> newOrderedMapNodeBuilder = Builders.orderedMapBuilder();
+        processMapEntries(node, depth, newOrderedMapNodeBuilder);
+        return newOrderedMapNodeBuilder.build();
+    }
+
+    private DataContainerChild<?, ?> processMapNode(final NormalizedNode<?, ?> node, final Integer depth) {
+        CollectionNodeBuilder<MapEntryNode, MapNode> newMapNodeBuilder = Builders.mapBuilder();
+        processMapEntries(node, depth, newMapNodeBuilder);
+        return newMapNodeBuilder.build();
+    }
+
+    private void processMapEntries(final NormalizedNode<?, ?> node, final Integer depth,
+            CollectionNodeBuilder<MapEntryNode, ? extends MapNode> newOrderedMapNodeBuilder) {
+        if (depth > 1) {
+            for (MapEntryNode oldMapEntryNode : ((MapNode) node).getValue()) {
+                DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> newMapEntryNodeBuilder = Builders
+                        .mapEntryBuilder().withNodeIdentifier(oldMapEntryNode.getIdentifier());
+                for (DataContainerChild<? extends PathArgument, ?> mapEntryNodeValue : oldMapEntryNode.getValue()) {
+                    newMapEntryNodeBuilder.withChild(pruneDataAtDepth(mapEntryNodeValue, depth - 1));
+                }
+                newOrderedMapNodeBuilder.withChild(newMapEntryNodeBuilder.build());
+            }
+        }
+    }
+
+
+}
diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/NormalizedNodeContext.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/NormalizedNodeContext.java
new file mode 100644 (file)
index 0000000..e698693
--- /dev/null
@@ -0,0 +1,22 @@
+package org.opendaylight.controller.sal.restconf.impl;
+
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+
+public class NormalizedNodeContext {
+
+    private final InstanceIdentifierContext context;
+    private final NormalizedNode<?,?> data;
+
+    public NormalizedNodeContext(InstanceIdentifierContext context, NormalizedNode<?, ?> data) {
+        this.context = context;
+        this.data = data;
+    }
+
+    public InstanceIdentifierContext getInstanceIdentifierContext() {
+        return context;
+    }
+
+    public NormalizedNode<?, ?> getData() {
+        return data;
+    }
+}
index b94f6a6166c47f3b1308f7dc4696341fe5ec202b..adad26e141d2315af5287c9ff2b49a02f16f68ac 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;
@@ -32,7 +31,6 @@ 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.data.AsyncDataBroker.DataChangeScope;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -205,7 +203,7 @@ public class RestconfImpl implements RestconfService {
         Set<Module> modules = null;
         DOMMountPoint mountPoint = null;
         if (identifier.contains(ControllerContext.MOUNT)) {
-            InstanceIdWithSchemaNode mountPointIdentifier = this.controllerContext.toMountPointIdentifier(identifier);
+            InstanceIdentifierContext mountPointIdentifier = this.controllerContext.toMountPointIdentifier(identifier);
             mountPoint = mountPointIdentifier.getMountPoint();
             modules = this.controllerContext.getAllModules(mountPoint);
         } else {
@@ -236,7 +234,7 @@ public class RestconfImpl implements RestconfService {
         Module module = null;
         DOMMountPoint mountPoint = null;
         if (identifier.contains(ControllerContext.MOUNT)) {
-            InstanceIdWithSchemaNode mountPointIdentifier = this.controllerContext.toMountPointIdentifier(identifier);
+            InstanceIdentifierContext mountPointIdentifier = this.controllerContext.toMountPointIdentifier(identifier);
             mountPoint = mountPointIdentifier.getMountPoint();
             module = this.controllerContext.findModuleByNameAndRevision(mountPoint, moduleNameAndRevision);
         } else {
@@ -267,7 +265,7 @@ public class RestconfImpl implements RestconfService {
         Set<Module> modules = null;
         DOMMountPoint mountPoint = null;
         if (identifier.contains(ControllerContext.MOUNT)) {
-            InstanceIdWithSchemaNode mountPointIdentifier = this.controllerContext.toMountPointIdentifier(identifier);
+            InstanceIdentifierContext mountPointIdentifier = this.controllerContext.toMountPointIdentifier(identifier);
             mountPoint = mountPointIdentifier.getMountPoint();
             modules = this.controllerContext.getAllModules(mountPoint);
         } else {
@@ -518,7 +516,7 @@ public class RestconfImpl implements RestconfService {
         DOMMountPoint mountPoint = null;
         if (identifier.contains(ControllerContext.MOUNT)) {
             // mounted RPC call - look up mount instance.
-            InstanceIdWithSchemaNode mountPointId = controllerContext.toMountPointIdentifier(identifier);
+            InstanceIdentifierContext mountPointId = controllerContext.toMountPointIdentifier(identifier);
             mountPoint = mountPointId.getMountPoint();
 
             int startOfRemoteRpcName = identifier.lastIndexOf(ControllerContext.MOUNT)
@@ -615,8 +613,8 @@ public class RestconfImpl implements RestconfService {
     }
 
     @Override
-    public StructuredData readConfigurationData(final String identifier, final UriInfo uriInfo) {
-        final InstanceIdWithSchemaNode iiWithData = controllerContext.toInstanceIdentifier(identifier);
+    public NormalizedNodeContext readConfigurationData(final String identifier, final UriInfo uriInfo) {
+        final InstanceIdentifierContext iiWithData = controllerContext.toInstanceIdentifier(identifier);
         DOMMountPoint mountPoint = iiWithData.getMountPoint();
         NormalizedNode<?, ?> data = null;
         YangInstanceIdentifier normalizedII;
@@ -628,12 +626,7 @@ public class RestconfImpl implements RestconfService {
             normalizedII = controllerContext.toNormalized(iiWithData.getInstanceIdentifier());
             data = broker.readConfigurationData(normalizedII);
         }
-
-        final CompositeNode compositeNode = datastoreNormalizedNodeToCompositeNode(data, iiWithData.getSchemaNode());
-        final CompositeNode prunedCompositeNode = pruneDataAtDepth(compositeNode, parseDepthParameter(uriInfo));
-
-        final boolean prettyPrintMode = parsePrettyPrintParameter(uriInfo);
-        return new StructuredData(prunedCompositeNode, iiWithData.getSchemaNode(), mountPoint, prettyPrintMode);
+        return new NormalizedNodeContext(iiWithData, data);
     }
 
     @SuppressWarnings("unchecked")
@@ -679,8 +672,8 @@ public class RestconfImpl implements RestconfService {
     }
 
     @Override
-    public StructuredData readOperationalData(final String identifier, final UriInfo info) {
-        final InstanceIdWithSchemaNode iiWithData = controllerContext.toInstanceIdentifier(identifier);
+    public NormalizedNodeContext readOperationalData(final String identifier, final UriInfo info) {
+        final InstanceIdentifierContext iiWithData = controllerContext.toInstanceIdentifier(identifier);
         DOMMountPoint mountPoint = iiWithData.getMountPoint();
         NormalizedNode<?, ?> data = null;
         YangInstanceIdentifier normalizedII;
@@ -693,11 +686,7 @@ public class RestconfImpl implements RestconfService {
             data = broker.readOperationalData(normalizedII);
         }
 
-        final CompositeNode compositeNode = datastoreNormalizedNodeToCompositeNode(data, iiWithData.getSchemaNode());
-        final CompositeNode prunedCompositeNode = pruneDataAtDepth(compositeNode, parseDepthParameter(info));
-
-        final boolean prettyPrintMode = parsePrettyPrintParameter(info);
-        return new StructuredData(prunedCompositeNode, iiWithData.getSchemaNode(), mountPoint, prettyPrintMode);
+        return new NormalizedNodeContext(iiWithData, data);
     }
 
     private boolean parsePrettyPrintParameter(final UriInfo info) {
@@ -707,7 +696,7 @@ public class RestconfImpl implements RestconfService {
 
     @Override
     public Response updateConfigurationData(final String identifier, final Node<?> payload) {
-        final InstanceIdWithSchemaNode iiWithData = this.controllerContext.toInstanceIdentifier(identifier);
+        final InstanceIdentifierContext iiWithData = this.controllerContext.toInstanceIdentifier(identifier);
 
         validateInput(iiWithData.getSchemaNode(), payload);
 
@@ -774,7 +763,7 @@ public class RestconfImpl implements RestconfService {
      *             if key values or key count in payload and URI isn't equal
      *
      */
-    private void validateListKeysEqualityInPayloadAndUri(final InstanceIdWithSchemaNode iiWithData,
+    private void validateListKeysEqualityInPayloadAndUri(final InstanceIdentifierContext iiWithData,
             final CompositeNode payload) {
         if (iiWithData.getSchemaNode() instanceof ListSchemaNode) {
             final List<QName> keyDefinitions = ((ListSchemaNode) iiWithData.getSchemaNode()).getKeyDefinition();
@@ -825,7 +814,7 @@ public class RestconfImpl implements RestconfService {
                     ErrorType.PROTOCOL, ErrorTag.UNKNOWN_NAMESPACE);
         }
 
-        InstanceIdWithSchemaNode iiWithData = null;
+        InstanceIdentifierContext iiWithData = null;
         CompositeNode value = null;
         if (this.representsMountPointRootData(payload)) {
             // payload represents mount point data and URI represents path to the mount point
@@ -841,7 +830,7 @@ public class RestconfImpl implements RestconfService {
 
             value = this.normalizeNode(payload, iiWithData.getSchemaNode(), iiWithData.getMountPoint());
         } else {
-            final InstanceIdWithSchemaNode incompleteInstIdWithData = this.controllerContext
+            final InstanceIdentifierContext incompleteInstIdWithData = this.controllerContext
                     .toInstanceIdentifier(identifier);
             final DataNodeContainer parentSchema = (DataNodeContainer) incompleteInstIdWithData.getSchemaNode();
             DOMMountPoint mountPoint = incompleteInstIdWithData.getMountPoint();
@@ -856,7 +845,7 @@ public class RestconfImpl implements RestconfService {
                     parentSchema, payloadName, module.getNamespace());
             value = this.normalizeNode(payload, schemaNode, mountPoint);
 
-            iiWithData = addLastIdentifierFromData(incompleteInstIdWithData, value, schemaNode);
+            iiWithData = addLastIdentifierFromData(incompleteInstIdWithData, value, schemaNode,incompleteInstIdWithData.getSchemaContext());
         }
 
         final NormalizedNode<?, ?> datastoreNormalizedData = compositeNodeToDatastoreNormalizedNode(value,
@@ -906,7 +895,7 @@ public class RestconfImpl implements RestconfService {
         final DataSchemaNode schemaNode = ControllerContext.findInstanceDataChildByNameAndNamespace(module,
                 payloadName, module.getNamespace());
         final CompositeNode value = this.normalizeNode(payload, schemaNode, null);
-        final InstanceIdWithSchemaNode iiWithData = this.addLastIdentifierFromData(null, value, schemaNode);
+        final InstanceIdentifierContext iiWithData = this.addLastIdentifierFromData(null, value, schemaNode,ControllerContext.getInstance().getGlobalSchema());
         final NormalizedNode<?, ?> datastoreNormalizedData = compositeNodeToDatastoreNormalizedNode(value, schemaNode);
         DOMMountPoint mountPoint = iiWithData.getMountPoint();
         YangInstanceIdentifier normalizedII;
@@ -932,7 +921,7 @@ public class RestconfImpl implements RestconfService {
 
     @Override
     public Response deleteConfigurationData(final String identifier) {
-        final InstanceIdWithSchemaNode iiWithData = controllerContext.toInstanceIdentifier(identifier);
+        final InstanceIdentifierContext iiWithData = controllerContext.toInstanceIdentifier(identifier);
         DOMMountPoint mountPoint = iiWithData.getMountPoint();
         YangInstanceIdentifier normalizedII;
 
@@ -1098,8 +1087,8 @@ public class RestconfImpl implements RestconfService {
         return module;
     }
 
-    private InstanceIdWithSchemaNode addLastIdentifierFromData(final InstanceIdWithSchemaNode identifierWithSchemaNode,
-            final CompositeNode data, final DataSchemaNode schemaOfData) {
+    private InstanceIdentifierContext addLastIdentifierFromData(final InstanceIdentifierContext identifierWithSchemaNode,
+            final CompositeNode data, final DataSchemaNode schemaOfData, SchemaContext schemaContext) {
         YangInstanceIdentifier instanceIdentifier = null;
         if (identifierWithSchemaNode != null) {
             instanceIdentifier = identifierWithSchemaNode.getInstanceIdentifier();
@@ -1122,11 +1111,12 @@ public class RestconfImpl implements RestconfService {
 
         YangInstanceIdentifier instance = iiBuilder.toInstance();
         DOMMountPoint mountPoint = null;
+        SchemaContext schemaCtx = null;
         if (identifierWithSchemaNode != null) {
             mountPoint = identifierWithSchemaNode.getMountPoint();
         }
 
-        return new InstanceIdWithSchemaNode(instance, schemaOfData, mountPoint);
+        return new InstanceIdentifierContext(instance, schemaOfData, mountPoint,schemaContext);
     }
 
     private HashMap<QName, Object> resolveKeysFromData(final ListSchemaNode listNode, final CompositeNode dataNode) {
@@ -1514,16 +1504,16 @@ public class RestconfImpl implements RestconfService {
                 "It wasn't possible to translate specified data to datastore readable form."));
     }
 
-    private InstanceIdWithSchemaNode normalizeInstanceIdentifierWithSchemaNode(
-            final InstanceIdWithSchemaNode iiWithSchemaNode) {
+    private InstanceIdentifierContext normalizeInstanceIdentifierWithSchemaNode(
+            final InstanceIdentifierContext iiWithSchemaNode) {
         return normalizeInstanceIdentifierWithSchemaNode(iiWithSchemaNode, false);
     }
 
-    private InstanceIdWithSchemaNode normalizeInstanceIdentifierWithSchemaNode(
-            final InstanceIdWithSchemaNode iiWithSchemaNode, final boolean unwrapLastListNode) {
-        return new InstanceIdWithSchemaNode(instanceIdentifierToReadableFormForNormalizeNode(
+    private InstanceIdentifierContext normalizeInstanceIdentifierWithSchemaNode(
+            final InstanceIdentifierContext iiWithSchemaNode, final boolean unwrapLastListNode) {
+        return new InstanceIdentifierContext(instanceIdentifierToReadableFormForNormalizeNode(
                 iiWithSchemaNode.getInstanceIdentifier(), unwrapLastListNode), iiWithSchemaNode.getSchemaNode(),
-                iiWithSchemaNode.getMountPoint());
+                iiWithSchemaNode.getMountPoint(),iiWithSchemaNode.getSchemaContext());
     }
 
     private YangInstanceIdentifier instanceIdentifierToReadableFormForNormalizeNode(
index f39eae45424941355b2d9a7291d62eea744048a4..60c3378471f6b0989967c707462c132d7418218f 100644 (file)
             <param-name>javax.ws.rs.Application</param-name>
             <param-value>org.opendaylight.controller.sal.rest.impl.RestconfApplication</param-value>
         </init-param>
+        <!-- AAA Auth Filter -->
+        <init-param>
+            <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
+            <param-value> org.opendaylight.aaa.sts.TokenAuthFilter</param-value>
+        </init-param>
         <load-on-startup>1</load-on-startup>
     </servlet>
 
index 2f045ce381ca0572cbeff4ad43147834fb59d2cf..559a6b9e8e4a8a88aed3f4c4c3b9a34d5ea377ae 100644 (file)
@@ -40,7 +40,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
 import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
 import org.opendaylight.controller.sal.restconf.impl.BrokerFacade;
 import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
-import org.opendaylight.controller.sal.restconf.impl.InstanceIdWithSchemaNode;
+import org.opendaylight.controller.sal.restconf.impl.InstanceIdentifierContext;
 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;
@@ -324,7 +324,7 @@ public class InvokeRpcMethodTest {
         when(mockMountPoint.getService(eq(RpcProvisionRegistry.class))).thenReturn(Optional.of(mockedRpcProvisionRegistry));
         when(mockMountPoint.getSchemaContext()).thenReturn(TestUtils.loadSchemaContext("/invoke-rpc"));
 
-        InstanceIdWithSchemaNode mockedInstanceId = mock(InstanceIdWithSchemaNode.class);
+        InstanceIdentifierContext mockedInstanceId = mock(InstanceIdentifierContext.class);
         when(mockedInstanceId.getMountPoint()).thenReturn(mockMountPoint);
 
         ControllerContext mockedContext = mock(ControllerContext.class);
index bab06e92451985b5a0d95032e99174adb91ba4b0..856d8c006b6c40349d2a1fd646cc70db6bd5fd62 100644 (file)
@@ -17,7 +17,7 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
-import org.opendaylight.controller.sal.restconf.impl.InstanceIdWithSchemaNode;
+import org.opendaylight.controller.sal.restconf.impl.InstanceIdentifierContext;
 import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
@@ -36,7 +36,7 @@ public class RestGetAugmentedElementWhenEqualNamesTest {
 
     @Test
     public void augmentedNodesInUri() {
-        InstanceIdWithSchemaNode iiWithData = controllerContext.toInstanceIdentifier("main:cont/augment-main-a:cont1");
+        InstanceIdentifierContext iiWithData = controllerContext.toInstanceIdentifier("main:cont/augment-main-a:cont1");
         assertEquals("ns:augment:main:a", iiWithData.getSchemaNode().getQName().getNamespace().toString());
         iiWithData = controllerContext.toInstanceIdentifier("main:cont/augment-main-b:cont1");
         assertEquals("ns:augment:main:b", iiWithData.getSchemaNode().getQName().getNamespace().toString());
index 539248a147cd4eea16dca9f4725cf26e9b185496..06cfd84b05048513249462de9245871da3905c5f 100644 (file)
@@ -44,12 +44,14 @@ import javax.ws.rs.core.UriInfo;
 import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.test.JerseyTest;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
 import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
 import org.opendaylight.controller.sal.rest.impl.JsonToCompositeNodeProvider;
+import org.opendaylight.controller.sal.rest.impl.RestconfApplication;
 import org.opendaylight.controller.sal.rest.impl.RestconfDocumentedExceptionMapper;
 import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider;
 import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider;
@@ -130,6 +132,7 @@ public class RestGetOperationTest extends JerseyTest {
                 StructuredDataToJsonProvider.INSTANCE, XmlToCompositeNodeProvider.INSTANCE,
                 JsonToCompositeNodeProvider.INSTANCE);
         resourceConfig.registerClasses(RestconfDocumentedExceptionMapper.class);
+        resourceConfig.registerClasses(new RestconfApplication().getClasses());
         return resourceConfig;
     }
 
@@ -717,6 +720,7 @@ public class RestGetOperationTest extends JerseyTest {
     }
 
     @Test
+    @Ignore
     public void getDataWithUriDepthParameterTest() throws UnsupportedEncodingException {
 
         ControllerContext.getInstance().setGlobalSchema(schemaContextModules);
@@ -903,6 +907,7 @@ public class RestGetOperationTest extends JerseyTest {
      * Tests behavior when invalid value of depth URI parameter
      */
     @Test
+    @Ignore
     public void getDataWithInvalidDepthParameterTest() {
 
         ControllerContext.getInstance().setGlobalSchema(schemaContextModules);
@@ -930,7 +935,7 @@ public class RestGetOperationTest extends JerseyTest {
         try {
             QName qNameDepth1Cont = QName.create("urn:nested:module", "2014-06-3", "depth1-cont");
             YangInstanceIdentifier ii = YangInstanceIdentifier.builder().node(qNameDepth1Cont).build();
-            NormalizedNode value = (NormalizedNode<?,?>)(Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(qNameDepth1Cont)).build());
+            NormalizedNode value = (Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(qNameDepth1Cont)).build());
             when(brokerFacade.readConfigurationData(eq(ii))).thenReturn(value);
             restconfImpl.readConfigurationData("nested-module:depth1-cont", uriInfo);
             fail("Expected RestconfDocumentedException");
index 4e9c96ac3e8acef126077d7b932e737caae1e4f3..3a16b18efcf26e8704a06900fb16a36d32cb5a00 100644 (file)
@@ -53,6 +53,7 @@ import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.test.JerseyTest;
 import org.junit.Before;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.opendaylight.controller.sal.rest.api.Draft02;
 import org.opendaylight.controller.sal.rest.api.RestconfService;
@@ -60,11 +61,11 @@ import org.opendaylight.controller.sal.rest.impl.RestconfDocumentedExceptionMapp
 import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider;
 import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider;
 import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
+import org.opendaylight.controller.sal.restconf.impl.NormalizedNodeContext;
 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.controller.sal.restconf.impl.StructuredData;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -679,13 +680,14 @@ public class RestconfDocumentedExceptionMapperTest extends JerseyTest {
     }
 
     @Test
+    @Ignore
     public void testToResponseWithStatusOnly() throws Exception {
 
         // The StructuredDataToJsonProvider should throw a
         // RestconfDocumentedException with no data
 
         when(mockRestConf.readOperationalData(any(String.class), any(UriInfo.class))).thenReturn(
-                new StructuredData(null, null, null));
+                new NormalizedNodeContext(null, null));
 
         Response resp = target("/operational/foo").request(MediaType.APPLICATION_JSON).get();
 
index c2b153f02bd27b6729dbba2a89a201a306763a99..15d73e3e7a301ca5a70879a851941eab0e4b35b3 100644 (file)
@@ -402,7 +402,7 @@ public final class TestUtils {
         return interfaceBuilder.toInstance();
     }
 
-    static NormalizedNode prepareNormalizedNodeWithIetfInterfacesInterfacesData() throws ParseException {
+    static NormalizedNode<?,?> prepareNormalizedNodeWithIetfInterfacesInterfacesData() throws ParseException {
         String ietfInterfacesDate = "2013-07-04";
         String namespace = "urn:ietf:params:xml:ns:yang:ietf-interfaces";
         DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> mapEntryNode = ImmutableMapEntryNodeBuilder.create();
index ed871bb52727895c5cdf69dd80e0caa2433cacef..4900e6a66f1ab9d9d3324c85e6ca5c98f103e5ba 100644 (file)
@@ -26,7 +26,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
 import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
 import org.opendaylight.controller.sal.restconf.impl.BrokerFacade;
 import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
-import org.opendaylight.controller.sal.restconf.impl.InstanceIdWithSchemaNode;
+import org.opendaylight.controller.sal.restconf.impl.InstanceIdentifierContext;
 import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
 import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -51,7 +51,7 @@ public class URITest {
 
     @Test
     public void testToInstanceIdentifierList() throws FileNotFoundException {
-        InstanceIdWithSchemaNode instanceIdentifier = controllerContext
+        InstanceIdentifierContext instanceIdentifier = controllerContext
                 .toInstanceIdentifier("simple-nodes:userWithoutClass/foo");
         assertEquals(instanceIdentifier.getSchemaNode().getQName().getLocalName(), "userWithoutClass");
 
@@ -80,7 +80,7 @@ public class URITest {
 
     @Test
     public void testToInstanceIdentifierContainer() throws FileNotFoundException {
-        InstanceIdWithSchemaNode instanceIdentifier = controllerContext.toInstanceIdentifier("simple-nodes:users");
+        InstanceIdentifierContext instanceIdentifier = controllerContext.toInstanceIdentifier("simple-nodes:users");
         assertEquals(instanceIdentifier.getSchemaNode().getQName().getLocalName(), "users");
         assertTrue(instanceIdentifier.getSchemaNode() instanceof ContainerSchemaNode);
         assertEquals(2, ((ContainerSchemaNode) instanceIdentifier.getSchemaNode()).getChildNodes().size());
@@ -88,7 +88,7 @@ public class URITest {
 
     @Test
     public void testToInstanceIdentifierChoice() throws FileNotFoundException {
-        InstanceIdWithSchemaNode instanceIdentifier = controllerContext
+        InstanceIdentifierContext instanceIdentifier = controllerContext
                 .toInstanceIdentifier("simple-nodes:food/nonalcoholic");
         assertEquals(instanceIdentifier.getSchemaNode().getQName().getLocalName(), "nonalcoholic");
     }
@@ -120,7 +120,7 @@ public class URITest {
     @Test
     public void testMountPointWithExternModul() throws FileNotFoundException {
         initMountService(true);
-        InstanceIdWithSchemaNode instanceIdentifier = controllerContext
+        InstanceIdentifierContext instanceIdentifier = controllerContext
                 .toInstanceIdentifier("simple-nodes:users/yang-ext:mount/test-interface2:class/student/name");
         assertEquals(
                 "[(urn:ietf:params:xml:ns:yang:test-interface2?revision=2014-08-01)class, (urn:ietf:params:xml:ns:yang:test-interface2?revision=2014-08-01)student[{(urn:ietf:params:xml:ns:yang:test-interface2?revision=2014-08-01)name=name}]]",
@@ -130,7 +130,7 @@ public class URITest {
     @Test
     public void testMountPointWithoutExternModul() throws FileNotFoundException {
         initMountService(true);
-        InstanceIdWithSchemaNode instanceIdentifier = controllerContext
+        InstanceIdentifierContext instanceIdentifier = controllerContext
                 .toInstanceIdentifier("simple-nodes:users/yang-ext:mount/");
         assertTrue(Iterables.isEmpty(instanceIdentifier.getInstanceIdentifier().getPathArguments()));
     }
@@ -140,7 +140,7 @@ public class URITest {
         exception.expect(RestconfDocumentedException.class);
 
         controllerContext.setMountService(null);
-        InstanceIdWithSchemaNode instanceIdentifier = controllerContext
+        InstanceIdentifierContext instanceIdentifier = controllerContext
                 .toInstanceIdentifier("simple-nodes:users/yang-ext:mount/test-interface2:class/student/name");
     }
 
@@ -149,7 +149,7 @@ public class URITest {
         initMountService(false);
         exception.expect(RestconfDocumentedException.class);
 
-        InstanceIdWithSchemaNode instanceIdentifier = controllerContext
+        InstanceIdentifierContext instanceIdentifier = controllerContext
                 .toInstanceIdentifier("simple-nodes:users/yang-ext:mount/test-interface2:class");
     }
 
index 2a778180d4448dd33ce7cabb17f911e77151df9f..c470b3237ea7fe2dd69f37254cae4b38439c8861 100644 (file)
@@ -2,7 +2,9 @@
 <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
     version="3.0">
-
+    <welcome-file-list>
+        <welcome-file>index.html</welcome-file>
+    </welcome-file-list>
     <servlet>
         <servlet-name>JAXRSApiDoc</servlet-name>
         <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
index 05a76a4cb7ca0551d0bb55322b4603f78eb7fd4b..f12616bc4b910d8127fc7269ea8bd5bc6b863dd5 100644 (file)
@@ -32,7 +32,7 @@
        var loadMount = function(mountIndex, mountPath) {\r
                $("#message").empty();\r
                $("#message").append( "<p>Loading...</p>" );\r
-               loadSwagger("http://localhost:8080/apidoc/apis/mounts/" + mountIndex,\r
+               loadSwagger("/apidoc/apis/mounts/" + mountIndex,\r
                                "swagger-ui-container");\r
                $("#message").empty();\r
                $("#message").append( "<h2><b>Showing mount points for " + mountPath + "</b></h2>");\r
@@ -48,7 +48,7 @@
        //loads the root swagger documenation (which comes from RestConf)\r
        var loadRootSwagger = function() {\r
                $("#message").empty();\r
-               loadSwagger("http://localhost:8080/apidoc/apis", "swagger-ui-container");\r
+               loadSwagger("/apidoc/apis", "swagger-ui-container");\r
        }\r
 \r
        //main method to initialize the mount list / swagger docs / tabs on page load\r
index 10aec4ca2e85038cdc7ff21dd0ebd4dc4b6cddf6..c1996f4691632637abc9fc7dffacce0bcb12f2ad 100644 (file)
@@ -151,7 +151,7 @@ class FlowCapableTopologyExporter implements FlowTopologyDiscoveryListener, Open
             public void applyOperation(final ReadWriteTransaction transaction) {
                 final Link link = toTopologyLink(notification);
                 final InstanceIdentifier<Link> path = linkPath(link);
-                transaction.put(LogicalDatastoreType.OPERATIONAL, path, link);
+                transaction.merge(LogicalDatastoreType.OPERATIONAL, path, link, true);
             }
         });
     }
index 4d984acee0206c1cce11b23f6f4f0dd1415506f8..b50a035be2f20d2d1c850701a845b2f766b11443 100644 (file)
@@ -42,6 +42,9 @@ public class ObjectMapper extends AttributeIfcSwitchStatement<AttributeMappingSt
         if(attributeIfc instanceof DependencyAttribute) {
             serviceNameOfDepAttr = ((DependencyAttribute)attributeIfc).getDependency().getSie().getQName().getLocalName();
             namespaceOfDepAttr = ((DependencyAttribute)attributeIfc).getDependency().getSie().getQName().getNamespace().toString();
+        } else if (attributeIfc instanceof ListDependenciesAttribute) {
+            serviceNameOfDepAttr = ((ListDependenciesAttribute)attributeIfc).getDependency().getSie().getQName().getLocalName();
+            namespaceOfDepAttr = ((ListDependenciesAttribute)attributeIfc).getDependency().getSie().getQName().getNamespace().toString();
         }
 
         return switchAttribute(attributeIfc);
diff --git a/opendaylight/netconf/netconf-auth/pom.xml b/opendaylight/netconf/netconf-auth/pom.xml
new file mode 100644 (file)
index 0000000..e19359a
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+  ~
+  ~ This program and the accompanying materials are made available under the
+  ~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+  ~ and is available at http://www.eclipse.org/legal/epl-v10.html
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>netconf-subsystem</artifactId>
+        <version>0.2.5-SNAPSHOT</version>
+        <relativePath>../</relativePath>
+    </parent>
+    <artifactId>netconf-auth</artifactId>
+    <packaging>bundle</packaging>
+    <name>${project.artifactId}</name>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/opendaylight/netconf/netconf-auth/src/main/java/org/opendaylight/controller/netconf/auth/AuthConstants.java b/opendaylight/netconf/netconf-auth/src/main/java/org/opendaylight/controller/netconf/auth/AuthConstants.java
new file mode 100644 (file)
index 0000000..de5bdd6
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.netconf.auth;
+
+public class AuthConstants {
+
+    /**
+     * This property should be set for every implementation of AuthService published to OSGi.
+     * Netconf SSH will pick the service with highest preference in case of multiple services present in OSGi.
+     */
+    public static final String SERVICE_PREFERENCE_KEY = "preference";
+}
@@ -6,11 +6,20 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.controller.netconf.ssh.authentication;
+package org.opendaylight.controller.netconf.auth;
 
+/**
+ * Authentication Service definition for netconf.
+ */
 public interface AuthProvider {
 
+    /**
+     * Authenticate user by username/password.
+     *
+     * @param username username
+     * @param password password
+     * @return true if authentication is successful, false otherwise
+     */
     boolean authenticated(String username, String password);
 
-    char[] getPEMAsCharArray();
 }
index a9e8dbe86b06b76087c902521022ff06e239b870..e5e34548b3a4e7b4f0d6049920cb9cde56a3a25d 100644 (file)
@@ -14,12 +14,6 @@ import static org.mockito.Matchers.anyString;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 
-import com.google.common.collect.Lists;
-import io.netty.channel.EventLoopGroup;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.util.concurrent.Future;
-import io.netty.util.concurrent.GenericFutureListener;
-import io.netty.util.concurrent.GlobalEventExecutor;
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.management.ManagementFactory;
@@ -27,13 +21,16 @@ import java.net.InetSocketAddress;
 import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
+
 import junit.framework.Assert;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
 import org.opendaylight.controller.config.spi.ModuleFactory;
 import org.opendaylight.controller.netconf.api.NetconfMessage;
+import org.opendaylight.controller.netconf.auth.AuthProvider;
 import org.opendaylight.controller.netconf.client.NetconfClientDispatcher;
 import org.opendaylight.controller.netconf.client.NetconfClientDispatcherImpl;
 import org.opendaylight.controller.netconf.client.SimpleNetconfClientSessionListener;
@@ -48,8 +45,6 @@ import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFact
 import org.opendaylight.controller.netconf.nettyutil.handler.ssh.authentication.AuthenticationHandler;
 import org.opendaylight.controller.netconf.nettyutil.handler.ssh.authentication.LoginPassword;
 import org.opendaylight.controller.netconf.ssh.NetconfSSHServer;
-import org.opendaylight.controller.netconf.ssh.authentication.AuthProvider;
-import org.opendaylight.controller.netconf.ssh.authentication.AuthProviderImpl;
 import org.opendaylight.controller.netconf.ssh.authentication.PEMGenerator;
 import org.opendaylight.controller.netconf.util.messages.NetconfMessageUtil;
 import org.opendaylight.controller.netconf.util.osgi.NetconfConfigUtil;
@@ -57,6 +52,15 @@ import org.opendaylight.controller.netconf.util.test.XmlFileLoader;
 import org.opendaylight.controller.netconf.util.xml.XmlUtil;
 import org.opendaylight.protocol.framework.NeverReconnectStrategy;
 
+import com.google.common.collect.Lists;
+
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.util.concurrent.Future;
+import io.netty.util.concurrent.GenericFutureListener;
+import io.netty.util.concurrent.GlobalEventExecutor;
+
 public class NetconfITSecureTest extends AbstractNetconfConfigTest {
 
     private static final InetSocketAddress tlsAddress = new InetSocketAddress("127.0.0.1", 12024);
@@ -79,9 +83,13 @@ public class NetconfITSecureTest extends AbstractNetconfConfigTest {
 
 
         final NetconfServerDispatcher dispatchS = createDispatcher(factoriesListener);
-        dispatchS.createLocalServer(NetconfConfigUtil.getNetconfLocalAddress()).await();
-        final EventLoopGroup bossGroup  = new NioEventLoopGroup();
-        sshServer = NetconfSSHServer.start(tlsAddress.getPort(), NetconfConfigUtil.getNetconfLocalAddress(), getAuthProvider(), bossGroup);
+        ChannelFuture s = dispatchS.createLocalServer(NetconfConfigUtil.getNetconfLocalAddress());
+        s.await();
+        EventLoopGroup bossGroup  = new NioEventLoopGroup();
+
+        final char[] pem = PEMGenerator.generate().toCharArray();
+        sshServer = NetconfSSHServer.start(tlsAddress.getPort(), NetconfConfigUtil.getNetconfLocalAddress(), bossGroup, pem);
+        sshServer.setAuthProvider(getAuthProvider());
     }
 
     private NetconfServerDispatcher createDispatcher(final NetconfOperationServiceFactoryListenerImpl factoriesListener) {
@@ -172,9 +180,8 @@ public class NetconfITSecureTest extends AbstractNetconfConfigTest {
     }
 
     public AuthProvider getAuthProvider() throws Exception {
-        final AuthProvider mock = mock(AuthProviderImpl.class);
+        AuthProvider mock = mock(AuthProvider.class);
         doReturn(true).when(mock).authenticated(anyString(), anyString());
-        doReturn(PEMGenerator.generate().toCharArray()).when(mock).getPEMAsCharArray();
         return mock;
     }
 
index 8d48077f93174dbf211d4ac5be0568a9b6cfab9b..6dd23776ce0c0b2f642ffb71d833b577bae10fa8 100644 (file)
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>netconf-api</artifactId>
+    </dependency>
+      <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>netconf-auth</artifactId>
     </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <groupId>org.bouncycastle</groupId>
       <artifactId>bcprov-jdk15on</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>usermanager</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller.thirdparty</groupId>
       <artifactId>ganymed</artifactId>
       <groupId>org.apache.sshd</groupId>
       <artifactId>sshd-core</artifactId>
     </dependency>
+      <dependency>
+          <groupId>com.google.guava</groupId>
+          <artifactId>guava</artifactId>
+      </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
         <configuration>
           <instructions>
             <Bundle-Activator>org.opendaylight.controller.netconf.ssh.osgi.NetconfSSHActivator</Bundle-Activator>
-            <Import-Package>com.google.common.base,
-              ch.ethz.ssh2,
-              ch.ethz.ssh2.signature,
-              org.apache.commons.io,
-              org.opendaylight.controller.netconf.util.osgi,
-              org.opendaylight.controller.usermanager,
-              org.opendaylight.controller.sal.authorization,
-              org.opendaylight.controller.sal.utils,
-              org.osgi.framework,
-              org.osgi.util.tracker,
-              org.slf4j,
-              org.bouncycastle.openssl,
-              io.netty.bootstrap, io.netty.buffer, io.netty.channel, io.netty.channel.local, io.netty.channel.nio,
-              io.netty.handler.stream, io.netty.util.concurrent, org.apache.commons.lang3,
-              org.opendaylight.controller.netconf.util.messages</Import-Package>
+            <Import-Package>*</Import-Package>
           </instructions>
         </configuration>
       </plugin>
index 670f50ddd09f9b3b80d855ce244f4a4cce47da14..86206a7d5cad932c3b8510a7c2518d36c06c4f51 100644 (file)
@@ -7,9 +7,7 @@
  */
 package org.opendaylight.controller.netconf.ssh;
 
-import com.google.common.annotations.VisibleForTesting;
-import io.netty.channel.EventLoopGroup;
-import io.netty.channel.local.LocalAddress;
+import com.google.common.base.Preconditions;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.ServerSocket;
@@ -17,12 +15,20 @@ import java.net.Socket;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.atomic.AtomicLong;
+
 import javax.annotation.concurrent.ThreadSafe;
-import org.opendaylight.controller.netconf.ssh.authentication.AuthProvider;
+
+import org.opendaylight.controller.netconf.auth.AuthProvider;
 import org.opendaylight.controller.netconf.ssh.threads.Handshaker;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Optional;
+
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.local.LocalAddress;
+
 /**
  * Thread that accepts client connections. Accepted socket is forwarded to {@link org.opendaylight.controller.netconf.ssh.threads.Handshaker},
  * which is executed in {@link #handshakeExecutor}.
@@ -36,13 +42,15 @@ public final class NetconfSSHServer extends Thread implements AutoCloseable {
     private final ServerSocket serverSocket;
     private final LocalAddress localAddress;
     private final EventLoopGroup bossGroup;
-    private final AuthProvider authProvider;
+    private Optional<AuthProvider> authProvider = Optional.absent();
     private final ExecutorService handshakeExecutor;
+    private final char[] pem;
     private volatile boolean up;
 
-    private NetconfSSHServer(int serverPort, LocalAddress localAddress, AuthProvider authProvider, EventLoopGroup bossGroup) throws IOException {
+    private NetconfSSHServer(final int serverPort, final LocalAddress localAddress, final EventLoopGroup bossGroup, final char[] pem) throws IOException {
         super(NetconfSSHServer.class.getSimpleName());
         this.bossGroup = bossGroup;
+        this.pem = pem;
         logger.trace("Creating SSH server socket on port {}", serverPort);
         this.serverSocket = new ServerSocket(serverPort);
         if (serverSocket.isBound() == false) {
@@ -50,17 +58,28 @@ public final class NetconfSSHServer extends Thread implements AutoCloseable {
         }
         logger.trace("Server socket created.");
         this.localAddress = localAddress;
-        this.authProvider = authProvider;
         this.up = true;
         handshakeExecutor = Executors.newFixedThreadPool(10);
     }
 
-    public static NetconfSSHServer start(int serverPort, LocalAddress localAddress, AuthProvider authProvider, EventLoopGroup bossGroup) throws IOException {
-        NetconfSSHServer netconfSSHServer = new NetconfSSHServer(serverPort, localAddress, authProvider, bossGroup);
+    public static NetconfSSHServer start(final int serverPort, final LocalAddress localAddress, final EventLoopGroup bossGroup, final char[] pemArray) throws IOException {
+        final NetconfSSHServer netconfSSHServer = new NetconfSSHServer(serverPort, localAddress, bossGroup, pemArray);
         netconfSSHServer.start();
         return netconfSSHServer;
     }
 
+    public synchronized AuthProvider getAuthProvider() {
+        Preconditions.checkState(authProvider.isPresent(), "AuthenticationProvider is not set up, cannot authenticate user");
+        return authProvider.get();
+    }
+
+    public synchronized void setAuthProvider(final AuthProvider authProvider) {
+        if(this.authProvider != null) {
+            logger.debug("Changing auth provider to {}", authProvider);
+        }
+        this.authProvider = Optional.fromNullable(authProvider);
+    }
+
     @Override
     public void close() throws IOException {
         up = false;
@@ -81,7 +100,7 @@ public final class NetconfSSHServer extends Thread implements AutoCloseable {
             Socket acceptedSocket = null;
             try {
                 acceptedSocket = serverSocket.accept();
-            } catch (IOException e) {
+            } catch (final IOException e) {
                 if (up == false) {
                     logger.trace("Exiting server thread", e);
                 } else {
@@ -90,18 +109,26 @@ public final class NetconfSSHServer extends Thread implements AutoCloseable {
             }
             if (acceptedSocket != null) {
                 try {
-                    Handshaker task = new Handshaker(acceptedSocket, localAddress, sessionIdCounter.incrementAndGet(), authProvider, bossGroup);
+                    final Handshaker task = new Handshaker(acceptedSocket, localAddress, sessionIdCounter.incrementAndGet(), getAuthProvider(), bossGroup, pem);
                     handshakeExecutor.submit(task);
-                } catch (IOException e) {
+                } catch (final IOException e) {
                     logger.warn("Cannot set PEMHostKey, closing connection", e);
-                    try {
-                        acceptedSocket.close();
-                    } catch (IOException e1) {
-                        logger.warn("Ignoring exception while closing socket", e);
-                    }
+                    closeSocket(acceptedSocket);
+                } catch (final IllegalStateException e) {
+                    logger.warn("Cannot accept connection, closing", e);
+                    closeSocket(acceptedSocket);
                 }
             }
         }
         logger.debug("Server thread is exiting");
     }
+
+    private void closeSocket(final Socket acceptedSocket) {
+        try {
+            acceptedSocket.close();
+        } catch (final IOException e) {
+            logger.warn("Ignoring exception while closing socket", e);
+        }
+    }
+
 }
index 503e764409e37d848ffeaf444c5e34e529bd6849..c686bcbc66fcb849da3f357bdd3bea2df7f62f2e 100644 (file)
@@ -9,26 +9,33 @@ package org.opendaylight.controller.netconf.ssh.osgi;
 
 import static com.google.common.base.Preconditions.checkState;
 
-import com.google.common.base.Optional;
-import io.netty.channel.EventLoopGroup;
-import io.netty.channel.local.LocalAddress;
-import io.netty.channel.nio.NioEventLoopGroup;
+import com.google.common.base.Preconditions;
 import java.io.File;
 import java.io.IOException;
 import java.net.InetSocketAddress;
+
 import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.lang3.StringUtils;
+import org.opendaylight.controller.netconf.auth.AuthConstants;
+import org.opendaylight.controller.netconf.auth.AuthProvider;
 import org.opendaylight.controller.netconf.ssh.NetconfSSHServer;
-import org.opendaylight.controller.netconf.ssh.authentication.AuthProvider;
-import org.opendaylight.controller.netconf.ssh.authentication.AuthProviderImpl;
 import org.opendaylight.controller.netconf.ssh.authentication.PEMGenerator;
 import org.opendaylight.controller.netconf.util.osgi.NetconfConfigUtil;
 import org.opendaylight.controller.netconf.util.osgi.NetconfConfigUtil.InfixProp;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Optional;
+import com.google.common.base.Strings;
+
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.local.LocalAddress;
+import io.netty.channel.nio.NioEventLoopGroup;
+
 /**
  * Activator for netconf SSH bundle which creates SSH bridge between netconf client and netconf server. Activator
  * starts SSH Server in its own thread. This thread is closed when activator calls stop() method. Server opens socket
@@ -41,6 +48,7 @@ import org.slf4j.LoggerFactory;
  */
 public class NetconfSSHActivator implements BundleActivator {
     private static final Logger logger = LoggerFactory.getLogger(NetconfSSHActivator.class);
+    private static AuthProviderTracker authProviderTracker;
 
     private NetconfSSHServer server;
 
@@ -50,39 +58,115 @@ public class NetconfSSHActivator implements BundleActivator {
     }
 
     @Override
-    public void stop(BundleContext context) throws IOException {
+    public void stop(final BundleContext context) throws IOException {
         if (server != null) {
             server.close();
         }
+
+        if(authProviderTracker != null) {
+            authProviderTracker.stop();
+        }
     }
 
-    private static NetconfSSHServer startSSHServer(BundleContext bundleContext) throws IOException {
-        Optional<InetSocketAddress> maybeSshSocketAddress = NetconfConfigUtil.extractNetconfServerAddress(bundleContext,
+    private static NetconfSSHServer startSSHServer(final BundleContext bundleContext) throws IOException {
+        final Optional<InetSocketAddress> maybeSshSocketAddress = NetconfConfigUtil.extractNetconfServerAddress(bundleContext,
                 InfixProp.ssh);
 
         if (maybeSshSocketAddress.isPresent() == false) {
             logger.trace("SSH bridge not configured");
             return null;
         }
-        InetSocketAddress sshSocketAddress = maybeSshSocketAddress.get();
-        logger.trace("Starting netconf SSH  bridge at {}", sshSocketAddress);
 
-        LocalAddress localAddress = NetconfConfigUtil.getNetconfLocalAddress();
+        final InetSocketAddress sshSocketAddress = maybeSshSocketAddress.get();
+        logger.trace("Starting netconf SSH bridge at {}", sshSocketAddress);
+
+        final LocalAddress localAddress = NetconfConfigUtil.getNetconfLocalAddress();
 
-        String path = FilenameUtils.separatorsToSystem(NetconfConfigUtil.getPrivateKeyPath(bundleContext));
-        checkState(StringUtils.isNotBlank(path), "Path to ssh private key is blank. Reconfigure %s", NetconfConfigUtil.getPrivateKeyKey());
-        String privateKeyPEMString = PEMGenerator.readOrGeneratePK(new File(path));
+        final String path = FilenameUtils.separatorsToSystem(NetconfConfigUtil.getPrivateKeyPath(bundleContext));
+        checkState(!Strings.isNullOrEmpty(path), "Path to ssh private key is blank. Reconfigure %s", NetconfConfigUtil.getPrivateKeyKey());
+        final String privateKeyPEMString = PEMGenerator.readOrGeneratePK(new File(path));
 
-        final AuthProvider authProvider = new AuthProviderImpl(privateKeyPEMString, bundleContext);
-        EventLoopGroup bossGroup  = new NioEventLoopGroup();
-        NetconfSSHServer server = NetconfSSHServer.start(sshSocketAddress.getPort(), localAddress, authProvider, bossGroup);
+        final EventLoopGroup bossGroup  = new NioEventLoopGroup();
+        final NetconfSSHServer server = NetconfSSHServer.start(sshSocketAddress.getPort(), localAddress, bossGroup, privateKeyPEMString.toCharArray());
+
+        authProviderTracker = new AuthProviderTracker(bundleContext, server);
+
+        return server;
+    }
 
+    private static Thread runNetconfSshThread(final NetconfSSHServer server) {
         final Thread serverThread = new Thread(server, "netconf SSH server thread");
         serverThread.setDaemon(true);
         serverThread.start();
         logger.trace("Netconf SSH  bridge up and running.");
-        return server;
+        return serverThread;
     }
 
+    private static class AuthProviderTracker implements ServiceTrackerCustomizer<AuthProvider, AuthProvider> {
+        private final BundleContext bundleContext;
+        private final NetconfSSHServer server;
+
+        private Integer maxPreference;
+        private Thread sshThread;
+        private final ServiceTracker<AuthProvider, AuthProvider> listenerTracker;
+
+        public AuthProviderTracker(final BundleContext bundleContext, final NetconfSSHServer server) {
+            this.bundleContext = bundleContext;
+            this.server = server;
+            listenerTracker = new ServiceTracker<>(bundleContext, AuthProvider.class, this);
+            listenerTracker.open();
+        }
+
+        @Override
+        public AuthProvider addingService(final ServiceReference<AuthProvider> reference) {
+            logger.trace("Service {} added", reference);
+            final AuthProvider authService = bundleContext.getService(reference);
+            final Integer newServicePreference = getPreference(reference);
+            if(isBetter(newServicePreference)) {
+                server.setAuthProvider(authService);
+                if(sshThread == null) {
+                    sshThread = runNetconfSshThread(server);
+                }
+            }
+            return authService;
+        }
+
+        private Integer getPreference(final ServiceReference<AuthProvider> reference) {
+            final Object preferenceProperty = reference.getProperty(AuthConstants.SERVICE_PREFERENCE_KEY);
+            return preferenceProperty == null ? Integer.MIN_VALUE : Integer.valueOf(preferenceProperty.toString());
+        }
+
+        private boolean isBetter(final Integer newServicePreference) {
+            Preconditions.checkNotNull(newServicePreference);
+            if(maxPreference == null) {
+                return true;
+            }
 
+            return newServicePreference > maxPreference;
+        }
+
+        @Override
+        public void modifiedService(final ServiceReference<AuthProvider> reference, final AuthProvider service) {
+            final AuthProvider authService = bundleContext.getService(reference);
+            final Integer newServicePreference = getPreference(reference);
+            if(isBetter(newServicePreference)) {
+                logger.trace("Replacing modified service {} in netconf SSH.", reference);
+                server.setAuthProvider(authService);
+            }
+        }
+
+        @Override
+        public void removedService(final ServiceReference<AuthProvider> reference, final AuthProvider service) {
+            logger.trace("Removing service {} from netconf SSH. " +
+                    "SSH won't authenticate users until AuthProvider service will be started.", reference);
+            maxPreference = null;
+            server.setAuthProvider(null);
+        }
+
+        public void stop() {
+            listenerTracker.close();
+            // sshThread should finish normally since sshServer.close stops processing
+        }
+
+    }
 }
index 3fffbb2d2c7b03cf6249c000d8610adb386b1bba..eec6c3a0971d8a3369ee05a863540bed4b85f8b2 100644 (file)
@@ -10,6 +10,20 @@ package org.opendaylight.controller.netconf.ssh.threads;
 import static com.google.common.base.Preconditions.checkNotNull;
 import static com.google.common.base.Preconditions.checkState;
 
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Socket;
+
+import javax.annotation.concurrent.NotThreadSafe;
+import javax.annotation.concurrent.ThreadSafe;
+
+import org.opendaylight.controller.netconf.auth.AuthProvider;
+import org.opendaylight.controller.netconf.util.messages.NetconfHelloMessageAdditionalHeader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import ch.ethz.ssh2.AuthenticationResult;
 import ch.ethz.ssh2.PtySettings;
 import ch.ethz.ssh2.ServerAuthenticationCallback;
@@ -18,7 +32,9 @@ import ch.ethz.ssh2.ServerConnectionCallback;
 import ch.ethz.ssh2.ServerSession;
 import ch.ethz.ssh2.ServerSessionCallback;
 import ch.ethz.ssh2.SimpleServerSessionCallback;
+
 import com.google.common.base.Supplier;
+
 import io.netty.bootstrap.Bootstrap;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufProcessor;
@@ -32,17 +48,6 @@ import io.netty.channel.EventLoopGroup;
 import io.netty.channel.local.LocalAddress;
 import io.netty.channel.local.LocalChannel;
 import io.netty.handler.stream.ChunkedStream;
-import java.io.BufferedOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.Socket;
-import javax.annotation.concurrent.NotThreadSafe;
-import javax.annotation.concurrent.ThreadSafe;
-import org.opendaylight.controller.netconf.ssh.authentication.AuthProvider;
-import org.opendaylight.controller.netconf.util.messages.NetconfHelloMessageAdditionalHeader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * One instance represents per connection, responsible for ssh handshake.
@@ -58,7 +63,7 @@ public class Handshaker implements Runnable {
 
 
     public Handshaker(Socket socket, LocalAddress localAddress, long sessionId, AuthProvider authProvider,
-                      EventLoopGroup bossGroup) throws IOException {
+                      EventLoopGroup bossGroup, final char[] pem) throws IOException {
 
         this.session = "Session " + sessionId;
 
@@ -83,7 +88,7 @@ public class Handshaker implements Runnable {
                 getGanymedAutoCloseable(ganymedConnection), localAddress, bossGroup);
 
         // initialize ganymed
-        ganymedConnection.setPEMHostKey(authProvider.getPEMAsCharArray(), null);
+        ganymedConnection.setPEMHostKey(pem, null);
         ganymedConnection.setAuthenticationCallback(serverAuthenticationCallback);
         ganymedConnection.setServerConnectionCallback(serverConnectionCallback);
     }
diff --git a/opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/StubUserManager.java b/opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/StubUserManager.java
deleted file mode 100644 (file)
index 6628310..0000000
+++ /dev/null
@@ -1,184 +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.netconf;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.opendaylight.controller.sal.authorization.AuthResultEnum;
-import org.opendaylight.controller.sal.authorization.UserLevel;
-import org.opendaylight.controller.sal.utils.Status;
-import org.opendaylight.controller.sal.utils.StatusCode;
-import org.opendaylight.controller.usermanager.AuthorizationConfig;
-import org.opendaylight.controller.usermanager.ISessionManager;
-import org.opendaylight.controller.usermanager.IUserManager;
-import org.opendaylight.controller.usermanager.ServerConfig;
-import org.opendaylight.controller.usermanager.UserConfig;
-import org.springframework.security.core.userdetails.UserDetails;
-import org.springframework.security.core.userdetails.UsernameNotFoundException;
-import org.springframework.security.web.context.SecurityContextRepository;
-
-public class StubUserManager implements IUserManager{
-
-
-    private static String user;
-    private static String password;
-
-    public StubUserManager(String user, String password){
-        StubUserManager.user = user;
-        StubUserManager.password = password;
-    }
-    @Override
-    public List<String> getUserRoles(String userName) {
-        return null;
-    }
-
-    @Override
-    public AuthResultEnum authenticate(String username, String password) {
-        if (StubUserManager.user.equals(username) && StubUserManager.password.equals(password)){
-            return AuthResultEnum.AUTH_ACCEPT_LOC;
-        }
-        return AuthResultEnum.AUTH_REJECT_LOC;
-    }
-
-    @Override
-    public Status addAAAServer(ServerConfig configObject) {
-        return null;
-    }
-
-    @Override
-    public Status removeAAAServer(ServerConfig configObject) {
-        return null;
-    }
-
-    @Override
-    public Status addLocalUser(UserConfig configObject) {
-        return new Status(StatusCode.SUCCESS);
-    }
-
-    @Override
-    public Status modifyLocalUser(UserConfig configObject) {
-        return null;
-    }
-
-    @Override
-    public Status removeLocalUser(UserConfig configObject) {
-        return null;
-    }
-
-    @Override
-    public Status removeLocalUser(String userName) {
-        return null;
-    }
-
-    @Override
-    public Status addAuthInfo(AuthorizationConfig AAAconf) {
-        return null;
-    }
-
-    @Override
-    public Status removeAuthInfo(AuthorizationConfig AAAconf) {
-        return null;
-    }
-
-    @Override
-    public List<AuthorizationConfig> getAuthorizationList() {
-        return null;
-    }
-
-    @Override
-    public Set<String> getAAAProviderNames() {
-        return null;
-    }
-
-    @Override
-    public Status changeLocalUserPassword(String user, String curPassword, String newPassword) {
-        return null;
-    }
-
-    @Override
-    public List<ServerConfig> getAAAServerList() {
-        return null;
-    }
-
-    @Override
-    public List<UserConfig> getLocalUserList() {
-        return null;
-    }
-
-    @Override
-    public Status saveLocalUserList() {
-        return null;
-    }
-
-    @Override
-    public Status saveAAAServerList() {
-        return null;
-    }
-
-    @Override
-    public Status saveAuthorizationList() {
-        return null;
-    }
-
-    @Override
-    public void userLogout(String username) {
-
-    }
-
-    @Override
-    public void userTimedOut(String username) {
-
-    }
-
-    @Override
-    public Map<String, List<String>> getUserLoggedIn() {
-        return null;
-    }
-
-    @Override
-    public String getAccessDate(String user) {
-        return null;
-    }
-
-    @Override
-    public UserLevel getUserLevel(String userName) {
-        return null;
-    }
-
-    @Override
-    public List<UserLevel> getUserLevels(String userName) {
-        return null;
-    }
-
-    @Override
-    public SecurityContextRepository getSecurityContextRepo() {
-        return null;
-    }
-
-    @Override
-    public ISessionManager getSessionManager() {
-        return null;
-    }
-
-    @Override
-    public boolean isRoleInUse(String role) {
-        return false;
-    }
-
-    @Override
-    public String getPassword(String username) {
-        return null;
-    }
-
-    @Override
-    public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
-        return null;
-    }
-
-}
index b3478c36931a7286f06a7eea4d9bc56bd6ccc7eb..ce1400bbcb24a5d455ad179a93da6098530c5790 100644 (file)
@@ -27,12 +27,11 @@ import java.util.concurrent.TimeUnit;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.opendaylight.controller.netconf.auth.AuthProvider;
 import org.opendaylight.controller.netconf.netty.EchoClientHandler.State;
 import org.opendaylight.controller.netconf.nettyutil.handler.ssh.authentication.LoginPassword;
 import org.opendaylight.controller.netconf.nettyutil.handler.ssh.client.AsyncSshHandler;
 import org.opendaylight.controller.netconf.ssh.NetconfSSHServer;
-import org.opendaylight.controller.netconf.ssh.authentication.AuthProvider;
-import org.opendaylight.controller.netconf.ssh.authentication.AuthProviderImpl;
 import org.opendaylight.controller.netconf.ssh.authentication.PEMGenerator;
 import org.opendaylight.controller.netconf.util.osgi.NetconfConfigUtil;
 import org.slf4j.Logger;
@@ -59,13 +58,13 @@ public class SSHTest {
     @Test
     public void test() throws Exception {
         new Thread(new EchoServer(), "EchoServer").start();
-        AuthProvider authProvider = mock(AuthProviderImpl.class);
-        doReturn(PEMGenerator.generate().toCharArray()).when(authProvider).getPEMAsCharArray();
+        AuthProvider authProvider = mock(AuthProvider.class);
         doReturn(true).when(authProvider).authenticated(anyString(), anyString());
         doReturn("auth").when(authProvider).toString();
 
         NetconfSSHServer netconfSSHServer = NetconfSSHServer.start(10831, NetconfConfigUtil.getNetconfLocalAddress(),
-                authProvider, new NioEventLoopGroup());
+                new NioEventLoopGroup(), PEMGenerator.generate().toCharArray());
+        netconfSSHServer.setAuthProvider(authProvider);
 
         InetSocketAddress address = netconfSSHServer.getLocalSocketAddress();
         final EchoClientHandler echoClientHandler = connectClient(address);
index 75d18566eec79c775d7861d86fd0aaf2ddda2dbb..1151abcdf2767de1aa5a70fd19aa3219f9b23b1c 100644 (file)
@@ -23,7 +23,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
-import org.opendaylight.controller.netconf.StubUserManager;
+import org.opendaylight.controller.netconf.auth.AuthProvider;
 import org.opendaylight.controller.netconf.ssh.NetconfSSHServer;
 import org.opendaylight.controller.netconf.util.osgi.NetconfConfigUtil;
 import org.osgi.framework.BundleContext;
@@ -55,16 +55,21 @@ public class SSHServerTest {
         doReturn(new ServiceReference[0]).when(mockedContext).getServiceReferences(anyString(), anyString());
 
         logger.info("Creating SSH server");
-        StubUserManager um = new StubUserManager(USER, PASSWORD);
         String pem;
         try (InputStream is = getClass().getResourceAsStream("/RSA.pk")) {
             pem = IOUtils.toString(is);
         }
-        AuthProviderImpl ap = new AuthProviderImpl(pem, mockedContext);
-        ap.setNullableUserManager(um);
+
+
         EventLoopGroup bossGroup = new NioEventLoopGroup();
         NetconfSSHServer server = NetconfSSHServer.start(PORT, NetconfConfigUtil.getNetconfLocalAddress(),
-                ap, bossGroup);
+                bossGroup, pem.toCharArray());
+        server.setAuthProvider(new AuthProvider() {
+            @Override
+            public boolean authenticated(final String username, final String password) {
+                return true;
+            }
+        });
 
         sshServerThread = new Thread(server);
         sshServerThread.setDaemon(true);
diff --git a/opendaylight/netconf/netconf-usermanager/pom.xml b/opendaylight/netconf/netconf-usermanager/pom.xml
new file mode 100644 (file)
index 0000000..f8c3e5a
--- /dev/null
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+  ~
+  ~ This program and the accompanying materials are made available under the
+  ~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+  ~ and is available at http://www.eclipse.org/legal/epl-v10.html
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>netconf-subsystem</artifactId>
+        <version>0.2.5-SNAPSHOT</version>
+        <relativePath>../</relativePath>
+    </parent>
+    <artifactId>netconf-usermanager</artifactId>
+    <packaging>bundle</packaging>
+    <name>${project.artifactId}</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>netconf-auth</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>usermanager</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Bundle-Activator>org.opendaylight.controller.netconf.auth.usermanager.AuthProviderActivator</Bundle-Activator>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+
+</project>
diff --git a/opendaylight/netconf/netconf-usermanager/src/main/java/org/opendaylight/controller/netconf/auth/usermanager/AuthProviderActivator.java b/opendaylight/netconf/netconf-usermanager/src/main/java/org/opendaylight/controller/netconf/auth/usermanager/AuthProviderActivator.java
new file mode 100644 (file)
index 0000000..528d8ff
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.netconf.auth.usermanager;
+
+import java.util.Hashtable;
+import org.opendaylight.controller.netconf.auth.AuthConstants;
+import org.opendaylight.controller.netconf.auth.AuthProvider;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+public class AuthProviderActivator implements BundleActivator {
+
+    public static final int PREFERENCE = 0;
+    private ServiceRegistration<AuthProvider> authProviderServiceRegistration;
+
+    @Override
+    public void start(final BundleContext context) throws Exception {
+        final AuthProvider authProvider = new AuthProviderImpl(context);
+        // Set preference of this service to 0
+        final Hashtable<String, Object> properties = new Hashtable<>(1);
+        properties.put(AuthConstants.SERVICE_PREFERENCE_KEY, PREFERENCE);
+
+        authProviderServiceRegistration = context.registerService(AuthProvider.class, authProvider, properties);
+    }
+
+    @Override
+    public void stop(final BundleContext context) throws Exception {
+        if(authProviderServiceRegistration != null) {
+            authProviderServiceRegistration.unregister();
+        }
+    }
+}
@@ -5,11 +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.netconf.ssh.authentication;
+package org.opendaylight.controller.netconf.auth.usermanager;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.annotations.VisibleForTesting;
+import org.opendaylight.controller.netconf.auth.AuthProvider;
 import org.opendaylight.controller.sal.authorization.AuthResultEnum;
 import org.opendaylight.controller.usermanager.IUserManager;
 import org.osgi.framework.BundleContext;
@@ -19,40 +17,41 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.annotations.VisibleForTesting;
+
+/**
+ * AuthProvider implementation delegating to AD-SAL UserManager instance.
+ */
 public class AuthProviderImpl implements AuthProvider {
     private static final Logger logger = LoggerFactory.getLogger(AuthProviderImpl.class);
 
-    private final String pem;
     private IUserManager nullableUserManager;
 
-    public AuthProviderImpl(String pemCertificate, final BundleContext bundleContext) {
-        checkNotNull(pemCertificate, "Parameter 'pemCertificate' is null");
-        pem = pemCertificate;
+    public AuthProviderImpl(final BundleContext bundleContext) {
 
-        ServiceTrackerCustomizer<IUserManager, IUserManager> customizer = new ServiceTrackerCustomizer<IUserManager, IUserManager>() {
+        final ServiceTrackerCustomizer<IUserManager, IUserManager> customizer = new ServiceTrackerCustomizer<IUserManager, IUserManager>() {
             @Override
             public IUserManager addingService(final ServiceReference<IUserManager> reference) {
-                logger.trace("Service {} added", reference);
+                logger.trace("UerManager {} added", reference);
                 nullableUserManager = bundleContext.getService(reference);
                 return nullableUserManager;
             }
 
             @Override
             public void modifiedService(final ServiceReference<IUserManager> reference, final IUserManager service) {
-                logger.trace("Replacing modified service {} in netconf SSH.", reference);
+                logger.trace("Replacing modified UerManager {}", reference);
                 nullableUserManager = service;
             }
 
             @Override
             public void removedService(final ServiceReference<IUserManager> reference, final IUserManager service) {
-                logger.trace("Removing service {} from netconf SSH. " +
-                        "SSH won't authenticate users until IUserManager service will be started.", reference);
+                logger.trace("Removing UerManager {}. This AuthProvider will fail to authenticate every time", reference);
                 synchronized (AuthProviderImpl.this) {
                     nullableUserManager = null;
                 }
             }
         };
-        ServiceTracker<IUserManager, IUserManager> listenerTracker = new ServiceTracker<>(bundleContext, IUserManager.class, customizer);
+        final ServiceTracker<IUserManager, IUserManager> listenerTracker = new ServiceTracker<>(bundleContext, IUserManager.class, customizer);
         listenerTracker.open();
     }
 
@@ -61,23 +60,18 @@ public class AuthProviderImpl implements AuthProvider {
      * available, IllegalStateException is thrown.
      */
     @Override
-    public synchronized boolean authenticated(String username, String password) {
+    public synchronized boolean authenticated(final String username, final String password) {
         if (nullableUserManager == null) {
             logger.warn("Cannot authenticate user '{}', user manager service is missing", username);
             throw new IllegalStateException("User manager service is not available");
         }
-        AuthResultEnum authResult = nullableUserManager.authenticate(username, password);
+        final AuthResultEnum authResult = nullableUserManager.authenticate(username, password);
         logger.debug("Authentication result for user '{}' : {}", username, authResult);
         return authResult.equals(AuthResultEnum.AUTH_ACCEPT) || authResult.equals(AuthResultEnum.AUTH_ACCEPT_LOC);
     }
 
-    @Override
-    public char[] getPEMAsCharArray() {
-        return pem.toCharArray();
-    }
-
     @VisibleForTesting
-    void setNullableUserManager(IUserManager nullableUserManager) {
+    void setNullableUserManager(final IUserManager nullableUserManager) {
         this.nullableUserManager = nullableUserManager;
     }
 }
index b1b410a1fcb9971cadcb0e973d2381cbbdf3d04e..8abf67ec8c5fe198315be84d8f8d5d9d424347e0 100644 (file)
@@ -35,6 +35,8 @@
     <module>ietf-netconf-monitoring</module>
     <module>ietf-netconf-monitoring-extension</module>
     <module>netconf-connector-config</module>
+    <module>netconf-auth</module>
+    <module>netconf-usermanager</module>
   </modules>
 
   <dependencies>
index b79e4325500d01549363e24e97cbc58c8581f7a0..1292c2995b2d119a4d6803a5684ff8be2ccd6424 100644 (file)
@@ -52,4 +52,11 @@ public class Neutron_IPs extends ConfigurationObject implements Serializable {
     public void setSubnetUUID(String subnetUUID) {
         this.subnetUUID = subnetUUID;
     }
+
+    @Override
+    public String toString() {
+        return "Neutron_IPs{" +
+               "ipAddress='" + ipAddress + '\'' +
+               ", subnetUUID='" + subnetUUID + '\'' + "}";
+    }
 }
index 5854d5577fe007be058adc5db033c4746d220dc3..d39241757fea07732c7920340fd3fdd5ebf37c7d 100644 (file)
@@ -81,7 +81,7 @@
           <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal</artifactId>
-            <version>0.7.1-SNAPSHOT</version>
+            <version>${sal.version}</version>
           </dependency>
         </dependencies>
       </plugin>