From: Moiz Raja Date: Thu, 10 Jul 2014 10:39:22 +0000 (-0700) Subject: Serialization/Deserialization and a host of other fixes X-Git-Tag: release/helium~393^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=516a4b2ea78179c9bd6ebb584862e8fc686ebf08 Serialization/Deserialization and a host of other fixes - Hande Cluster MemberUp and MemberRemoved events in ShardManager - Cohort messages and close listener messages switched to use protobuff - Distributed Datastore switch messages to use protobuff CreateTransaction CreateTransactionReply CreateTransactionChain CreateTransactionChainReply distributed datastore messages switched to protobuff - ShardManager messages switch to protobuff - DataChanged and other messages switch to protobuf in distributed datastore - Fixed few things found during testing 1. ShardStrategy - setting of configuration 2. NodeToNormalizedNodeBuilder - leaf node/leafsetentry node checks 3. DataChanged event - passing of scope instanceidentifier used during deserialization - Introducing JMX MBeans for distributed datastore -Fixed issues which were preventing remote Shards from talking to each other - Fixed a number of issues related to deserialization - Add distributed datastore to the build - Switch from InstanceIdentifier to YangInstanceIdentifier Change-Id: I0d15dc482cb2b0fb2170b1344bad9fa3b421e8e0 Signed-off-by: Moiz Raja --- diff --git a/opendaylight/md-sal/pom.xml b/opendaylight/md-sal/pom.xml index 2cddbbf354..bfa7e26b58 100644 --- a/opendaylight/md-sal/pom.xml +++ b/opendaylight/md-sal/pom.xml @@ -64,6 +64,9 @@ sal-protocolbuffer-encoding + + sal-distributed-datastore + sal-test-model diff --git a/opendaylight/md-sal/sal-distributed-datastore/pom.xml b/opendaylight/md-sal/sal-distributed-datastore/pom.xml index 3dd44bb850..16b97b7855 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/pom.xml +++ b/opendaylight/md-sal/sal-distributed-datastore/pom.xml @@ -159,6 +159,7 @@ !*snappy;!org.jboss.*;* + sal-protocolbuffer-encoding; !sal*; !*config-api*; !*testkit*; diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractUntypedActor.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractUntypedActor.java index 0f10258e9e..ce0516064e 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractUntypedActor.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractUntypedActor.java @@ -27,9 +27,9 @@ public abstract class AbstractUntypedActor extends UntypedActor { } @Override public void onReceive(Object message) throws Exception { - LOG.debug("Received message {}", message); + LOG.debug("Received message {}", message.getClass().getSimpleName()); handleReceive(message); - LOG.debug("Done handling message {}", message); + LOG.debug("Done handling message {}", message.getClass().getSimpleName()); } protected abstract void handleReceive(Object message) throws Exception; diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ConfigurationImpl.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ConfigurationImpl.java index 9a9ac2c725..34590025d5 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ConfigurationImpl.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ConfigurationImpl.java @@ -15,7 +15,10 @@ import com.typesafe.config.ConfigObject; import org.opendaylight.controller.cluster.datastore.shardstrategy.DefaultShardStrategy; import org.opendaylight.controller.cluster.datastore.shardstrategy.ModuleShardStrategy; import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -28,11 +31,34 @@ public class ConfigurationImpl implements Configuration { private final List modules = new ArrayList<>(); + private static final Logger + LOG = LoggerFactory.getLogger(DistributedDataStore.class); + public ConfigurationImpl(String moduleShardsConfigPath, + String modulesConfigPath){ - Config moduleShardsConfig = ConfigFactory.load(moduleShardsConfigPath); - Config modulesConfig = ConfigFactory.load(modulesConfigPath); + + File moduleShardsFile = new File("./configuration/initial/" + moduleShardsConfigPath); + File modulesFile = new File("./configuration/initial/" + modulesConfigPath); + + Config moduleShardsConfig = null; + if(moduleShardsFile.exists()) { + LOG.info("module shards config file exists - reading config from it"); + moduleShardsConfig = ConfigFactory.parseFile(moduleShardsFile); + } else { + LOG.warn("module shards configuration read from resource"); + moduleShardsConfig = ConfigFactory.load(moduleShardsConfigPath); + } + + Config modulesConfig = null; + if(modulesFile.exists()) { + LOG.info("modules config file exists - reading config from it"); + modulesConfig = ConfigFactory.parseFile(modulesFile); + } else { + LOG.warn("modules configuration read from resource"); + modulesConfig = ConfigFactory.load(modulesConfigPath); + } readModuleShards(moduleShardsConfig); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListener.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListener.java index fd4f9f75b5..3af6f56a2c 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListener.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListener.java @@ -14,36 +14,41 @@ import org.opendaylight.controller.cluster.datastore.messages.DataChanged; import org.opendaylight.controller.cluster.datastore.messages.DataChangedReply; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; public class DataChangeListener extends AbstractUntypedActor { - private final AsyncDataChangeListener> listener; + private final AsyncDataChangeListener> listener; + private final SchemaContext schemaContext; + private final YangInstanceIdentifier pathId; - public DataChangeListener( - AsyncDataChangeListener> listener) { + public DataChangeListener(SchemaContext schemaContext, + AsyncDataChangeListener> listener, YangInstanceIdentifier pathId) { this.listener = listener; + this.schemaContext = schemaContext; + this.pathId = pathId; } @Override public void handleReceive(Object message) throws Exception { - if(message instanceof DataChanged){ - DataChanged reply = (DataChanged) message; - AsyncDataChangeEvent> + if(message.getClass().equals(DataChanged.SERIALIZABLE_CLASS)){ + DataChanged reply = DataChanged.fromSerialize(schemaContext,message, pathId); + AsyncDataChangeEvent> change = reply.getChange(); this.listener.onDataChanged(change); if(getSender() != null){ - getSender().tell(new DataChangedReply(), getSelf()); + getSender().tell(new DataChangedReply().toSerializable(), getSelf()); } } } - public static Props props(final AsyncDataChangeListener> listener) { + public static Props props(final SchemaContext schemaContext, final AsyncDataChangeListener> listener, final YangInstanceIdentifier pathId) { return Props.create(new Creator() { @Override public DataChangeListener create() throws Exception { - return new DataChangeListener(listener); + return new DataChangeListener(schemaContext,listener,pathId ); } }); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxy.java index 8423b9853d..cd9c330268 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxy.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxy.java @@ -12,21 +12,24 @@ import akka.actor.ActorSelection; import org.opendaylight.controller.cluster.datastore.messages.DataChanged; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; /** * DataChangeListenerProxy represents a single remote DataChangeListener */ -public class DataChangeListenerProxy implements AsyncDataChangeListener>{ +public class DataChangeListenerProxy implements AsyncDataChangeListener>{ private final ActorSelection dataChangeListenerActor; + private final SchemaContext schemaContext; - public DataChangeListenerProxy(ActorSelection dataChangeListenerActor) { + public DataChangeListenerProxy(SchemaContext schemaContext,ActorSelection dataChangeListenerActor) { this.dataChangeListenerActor = dataChangeListenerActor; + this.schemaContext = schemaContext; } @Override public void onDataChanged( - AsyncDataChangeEvent> change) { - dataChangeListenerActor.tell(new DataChanged(change), null); + AsyncDataChangeEvent> change) { + dataChangeListenerActor.tell(new DataChanged(schemaContext,change).toSerializable(), null); } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistration.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistration.java index dca9735487..9e50b5b332 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistration.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistration.java @@ -14,29 +14,29 @@ import akka.japi.Creator; import org.opendaylight.controller.cluster.datastore.messages.CloseDataChangeListenerRegistration; import org.opendaylight.controller.cluster.datastore.messages.CloseDataChangeListenerRegistrationReply; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; public class DataChangeListenerRegistration extends AbstractUntypedActor { - private final org.opendaylight.yangtools.concepts.ListenerRegistration>> + private final org.opendaylight.yangtools.concepts.ListenerRegistration>> registration; public DataChangeListenerRegistration( - org.opendaylight.yangtools.concepts.ListenerRegistration>> registration) { + org.opendaylight.yangtools.concepts.ListenerRegistration>> registration) { this.registration = registration; } @Override public void handleReceive(Object message) throws Exception { - if (message instanceof CloseDataChangeListenerRegistration) { + if (message.getClass().equals(CloseDataChangeListenerRegistration.SERIALIZABLE_CLASS)) { closeListenerRegistration( - (CloseDataChangeListenerRegistration) message); + new CloseDataChangeListenerRegistration()); } } public static Props props( - final org.opendaylight.yangtools.concepts.ListenerRegistration>> registration) { + final org.opendaylight.yangtools.concepts.ListenerRegistration>> registration) { return Props.create(new Creator() { @Override @@ -50,7 +50,7 @@ public class DataChangeListenerRegistration extends AbstractUntypedActor { CloseDataChangeListenerRegistration message) { registration.close(); getSender() - .tell(new CloseDataChangeListenerRegistrationReply(), getSelf()); + .tell(new CloseDataChangeListenerRegistrationReply().toSerializable(), getSelf()); getSelf().tell(PoisonPill.getInstance(), getSelf()); } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxy.java index 83737cfac5..e3cdbb4ee1 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxy.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxy.java @@ -14,7 +14,7 @@ import akka.actor.PoisonPill; import org.opendaylight.controller.cluster.datastore.messages.CloseDataChangeListenerRegistration; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener; import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; /** @@ -29,7 +29,7 @@ public class DataChangeListenerRegistrationProxy implements ListenerRegistration private final AsyncDataChangeListener listener; private final ActorRef dataChangeListenerActor; - public >> + public >> DataChangeListenerRegistrationProxy( ActorSelection listenerRegistrationActor, L listener, ActorRef dataChangeListenerActor) { @@ -45,7 +45,7 @@ public class DataChangeListenerRegistrationProxy implements ListenerRegistration @Override public void close() { - listenerRegistrationActor.tell(new CloseDataChangeListenerRegistration(), null); + listenerRegistrationActor.tell(new CloseDataChangeListenerRegistration().toSerializable(), null); dataChangeListenerActor.tell(PoisonPill.getInstance(), null); } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java index 0c4fae0fc6..2ef8e5f449 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java @@ -23,7 +23,7 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransactio import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain; import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.opendaylight.yangtools.yang.model.api.SchemaContextListener; @@ -61,7 +61,9 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, Au Executors.newFixedThreadPool(10); public DistributedDataStore(ActorSystem actorSystem, String type, ClusterWrapper cluster, Configuration configuration) { - this(new ActorContext(actorSystem, actorSystem.actorOf(ShardManager.props(type, cluster, configuration), "shardmanager-" + type), configuration), type); + this(new ActorContext(actorSystem, actorSystem + .actorOf(ShardManager.props(type, cluster, configuration), + "shardmanager-" + type), cluster, configuration), type); } public DistributedDataStore(ActorContext actorContext, String type) { @@ -71,18 +73,18 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, Au @Override - public >> ListenerRegistration registerChangeListener( - InstanceIdentifier path, L listener, + public >> ListenerRegistration registerChangeListener( + YangInstanceIdentifier path, L listener, AsyncDataBroker.DataChangeScope scope) { ActorRef dataChangeListenerActor = actorContext.getActorSystem().actorOf( - DataChangeListener.props(listener)); + DataChangeListener.props(schemaContext,listener,path )); String shardName = ShardStrategyFactory.getStrategy(path).findShard(path); Object result = actorContext.executeShardOperation(shardName, new RegisterChangeListener(path, dataChangeListenerActor.path(), - AsyncDataBroker.DataChangeScope.BASE).toSerializable(), + scope).toSerializable(), ActorContext.ASK_DURATION ); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreFactory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreFactory.java index 907b856c07..692d1b4954 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreFactory.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreFactory.java @@ -9,13 +9,16 @@ package org.opendaylight.controller.cluster.datastore; import akka.actor.ActorSystem; +import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory; import org.opendaylight.controller.sal.core.api.model.SchemaService; public class DistributedDataStoreFactory { public static DistributedDataStore createInstance(String name, SchemaService schemaService){ ActorSystem actorSystem = ActorSystemFactory.getInstance(); + Configuration config = new ConfigurationImpl("module-shards.conf", "modules.conf"); final DistributedDataStore dataStore = - new DistributedDataStore(actorSystem, name, new ClusterWrapperImpl(actorSystem), new ConfigurationImpl("module-shards.conf", "modules.conf")); + new DistributedDataStore(actorSystem, name, new ClusterWrapperImpl(actorSystem),config ); + ShardStrategyFactory.setConfiguration(config); schemaService .registerSchemaServiceListener(dataStore); return dataStore; diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java index 9e40a69907..d6ad553cf3 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java @@ -15,10 +15,13 @@ import akka.event.Logging; import akka.event.LoggingAdapter; import akka.japi.Creator; import akka.persistence.Persistent; +import akka.persistence.RecoveryCompleted; import akka.persistence.UntypedProcessor; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; +import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardMBeanFactory; +import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStats; import org.opendaylight.controller.cluster.datastore.messages.CommitTransactionReply; import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction; import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChain; @@ -36,7 +39,7 @@ import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore; import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction; import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort; import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; @@ -63,7 +66,7 @@ public class Shard extends UntypedProcessor { private final Map modificationToCohort = new HashMap<>(); - private final LoggingAdapter log = + private final LoggingAdapter LOG = Logging.getLogger(getContext().system(), this); // By default persistent will be true and can be turned off using the system @@ -72,14 +75,20 @@ public class Shard extends UntypedProcessor { private SchemaContext schemaContext; + private final ShardStats shardMBean; + private Shard(String name) { String setting = System.getProperty("shard.persistent"); + this.persistent = !"false".equals(setting); - log.info("Creating shard : {} persistent : {}", name , persistent); + LOG.info("Creating shard : {} persistent : {}", name, persistent); store = new InMemoryDOMDataStore(name, storeExecutor); + + shardMBean = ShardMBeanFactory.getShardStatsMBean(name); + } public static Props props(final String name) { @@ -96,14 +105,14 @@ public class Shard extends UntypedProcessor { @Override public void onReceive(Object message) throws Exception { - log.debug("Received message {}", message); + LOG.debug("Received message " + message.getClass().toString()); if(!recoveryFinished()){ // FIXME : Properly handle recovery return; } - if (message instanceof CreateTransactionChain) { + if (message.getClass().equals(CreateTransactionChain.SERIALIZABLE_CLASS)) { createTransactionChain(); } else if (message.getClass().equals(RegisterChangeListener.SERIALIZABLE_CLASS)) { registerChangeListener(RegisterChangeListener.fromSerializable(getContext().system(), message)); @@ -113,12 +122,15 @@ public class Shard extends UntypedProcessor { handleForwardedCommit((ForwardedCommitTransaction) message); } else if (message instanceof Persistent) { commit(((Persistent)message).payload()); - } else if (message instanceof CreateTransaction) { - createTransaction((CreateTransaction) message); + } else if (message.getClass().equals(CreateTransaction.SERIALIZABLE_CLASS)) { + createTransaction(CreateTransaction.fromSerializable(message)); } else if(message instanceof NonPersistent){ commit(((NonPersistent)message).payload()); - } else { - throw new Exception("Not recognized message in Shard::OnReceive"+message); + }else if (message instanceof RecoveryCompleted) { + //FIXME: PROPERLY HANDLE RECOVERY COMPLETED + + }else { + throw new Exception("Not recognized message found message=" + message); } } @@ -137,11 +149,12 @@ public class Shard extends UntypedProcessor { DOMStoreThreePhaseCommitCohort cohort = modificationToCohort.remove(serialized); if (cohort == null) { - log.error( + LOG.error( "Could not find cohort for modification : " + modification); return; } final ListenableFuture future = cohort.commit(); + shardMBean.incrementCommittedTransactionCount(); final ActorRef sender = getSender(); final ActorRef self = getSelf(); future.addListener(new Runnable() { @@ -149,10 +162,10 @@ public class Shard extends UntypedProcessor { public void run() { try { future.get(); - sender.tell(new CommitTransactionReply(), self); + sender.tell(new CommitTransactionReply().toSerializable(), self); } catch (InterruptedException | ExecutionException e) { // FIXME : Handle this properly - log.error(e, "An exception happened when committing"); + LOG.error(e, "An exception happened when committing"); } } }, getContext().dispatcher()); @@ -180,19 +193,25 @@ public class Shard extends UntypedProcessor { private void registerChangeListener( RegisterChangeListener registerChangeListener) { + LOG.debug("registerDataChangeListener for " + registerChangeListener.getPath()); + + ActorSelection dataChangeListenerPath = getContext() .system().actorSelection(registerChangeListener.getDataChangeListenerPath()); - AsyncDataChangeListener> - listener = new DataChangeListenerProxy(dataChangeListenerPath); + AsyncDataChangeListener> + listener = new DataChangeListenerProxy(schemaContext,dataChangeListenerPath); - org.opendaylight.yangtools.concepts.ListenerRegistration>> + org.opendaylight.yangtools.concepts.ListenerRegistration>> registration = store.registerChangeListener(registerChangeListener.getPath(), listener, registerChangeListener.getScope()); ActorRef listenerRegistration = getContext().actorOf( DataChangeListenerRegistration.props(registration)); + + LOG.debug("registerDataChangeListener sending reply, listenerRegistrationPath = " + listenerRegistration.path().toString()); + getSender() .tell(new RegisterChangeListenerReply(listenerRegistration.path()).toSerializable(), getSelf()); @@ -203,7 +222,7 @@ public class Shard extends UntypedProcessor { ActorRef transactionChain = getContext().actorOf(ShardTransactionChain.props(chain, schemaContext)); getSender() - .tell(new CreateTransactionChainReply(transactionChain.path()), + .tell(new CreateTransactionChainReply(transactionChain.path()).toSerializable(), getSelf()); } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java index 3e0c97f6af..0363b3ceb3 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java @@ -11,14 +11,18 @@ package org.opendaylight.controller.cluster.datastore; import akka.actor.ActorPath; import akka.actor.ActorRef; import akka.actor.Address; +import akka.actor.OneForOneStrategy; import akka.actor.Props; -import akka.event.Logging; -import akka.event.LoggingAdapter; +import akka.actor.SupervisorStrategy; +import akka.cluster.ClusterEvent; import akka.japi.Creator; +import akka.japi.Function; +import com.google.common.base.Preconditions; import org.opendaylight.controller.cluster.datastore.messages.FindPrimary; import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound; import org.opendaylight.controller.cluster.datastore.messages.PrimaryNotFound; import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext; +import scala.concurrent.duration.Duration; import java.util.HashMap; import java.util.List; @@ -49,21 +53,9 @@ import java.util.Map; */ public class ShardManager extends AbstractUntypedActor { - // Stores a mapping between a shard name and the address of the current primary - private final Map shardNameToPrimaryAddress = - new HashMap<>(); - // Stores a mapping between a member name and the address of the member private final Map memberNameToAddress = new HashMap<>(); - // Stores a mapping between the shard name and all the members on which a replica of that shard are available - private final Map> shardNameToMembers = - new HashMap<>(); - - private final LoggingAdapter log = - Logging.getLogger(getContext().system(), this); - - private final Map localShards = new HashMap<>(); @@ -78,20 +70,17 @@ public class ShardManager extends AbstractUntypedActor { * configuration or operational */ private ShardManager(String type, ClusterWrapper cluster, Configuration configuration) { - this.type = type; - this.cluster = cluster; - this.configuration = configuration; - String memberName = cluster.getCurrentMemberName(); - List memberShardNames = - configuration.getMemberShardNames(memberName); - for(String shardName : memberShardNames){ - String shardActorName = getShardActorName(memberName, shardName); - ActorRef actor = getContext() - .actorOf(Shard.props(shardActorName), shardActorName); - ActorPath path = actor.path(); - localShards.put(shardName, path); - } + this.type = Preconditions.checkNotNull(type, "type should not be null"); + this.cluster = Preconditions.checkNotNull(cluster, "cluster should not be null"); + this.configuration = Preconditions.checkNotNull(configuration, "configuration should not be null"); + + // Subscribe this actor to cluster member events + cluster.subscribeToMemberEvents(getSelf()); + + // Create all the local Shards and make them a child of the ShardManager + // TODO: This may need to be initiated when we first get the schema context + createLocalShards(); } public static Props props(final String type, @@ -106,55 +95,113 @@ public class ShardManager extends AbstractUntypedActor { }); } + @Override public void handleReceive(Object message) throws Exception { - if (message instanceof FindPrimary) { - FindPrimary msg = ((FindPrimary) message); - String shardName = msg.getShardName(); - - List members = - configuration.getMembersFromShardName(shardName); - - for(String memberName : members) { - if (memberName.equals(cluster.getCurrentMemberName())) { - // This is a local shard - ActorPath shardPath = localShards.get(shardName); - // FIXME: This check may be redundant - if (shardPath == null) { - getSender() - .tell(new PrimaryNotFound(shardName), getSelf()); - return; - } - getSender().tell(new PrimaryFound(shardPath.toString()), - getSelf()); - return; - } else { - Address address = memberNameToAddress.get(shardName); - if(address != null){ - String path = - address.toString() + "/user/" + getShardActorName( - memberName, shardName); - getSender().tell(new PrimaryFound(path), getSelf()); - } + if (message.getClass().equals(FindPrimary.SERIALIZABLE_CLASS)) { + findPrimary( + FindPrimary.fromSerializable(message)); + + } else if (message instanceof UpdateSchemaContext) { + updateSchemaContext(message); + } else if (message instanceof ClusterEvent.MemberUp){ + memberUp((ClusterEvent.MemberUp) message); + } else if(message instanceof ClusterEvent.MemberRemoved) { + memberRemoved((ClusterEvent.MemberRemoved) message); + } else if(message instanceof ClusterEvent.UnreachableMember) { + ignoreMessage(message); + } else{ + throw new Exception ("Not recognized message received, message="+message); + } + + } + + private void ignoreMessage(Object message){ + LOG.debug("Unhandled message : " + message); + } + + private void memberRemoved(ClusterEvent.MemberRemoved message) { + memberNameToAddress.remove(message.member().roles().head()); + } + + private void memberUp(ClusterEvent.MemberUp message) { + memberNameToAddress.put(message.member().roles().head(), message.member().address()); + } + private void updateSchemaContext(Object message) { + for(ActorPath path : localShards.values()){ + getContext().system().actorSelection(path) + .forward(message, + getContext()); + } + } + + private void findPrimary(FindPrimary message) { + String shardName = message.getShardName(); + + List members = + configuration.getMembersFromShardName(shardName); + for(String memberName : members) { + if (memberName.equals(cluster.getCurrentMemberName())) { + // This is a local shard + ActorPath shardPath = localShards.get(shardName); + if (shardPath == null) { + getSender() + .tell(new PrimaryNotFound(shardName).toSerializable(), getSelf()); + return; + } + getSender().tell(new PrimaryFound(shardPath.toString()).toSerializable(), + getSelf()); + return; + } else { + Address address = memberNameToAddress.get(memberName); + if(address != null){ + String path = + address.toString() + "/user/shardmanager-" + this.type + "/" + getShardActorName( + memberName, shardName); + getSender().tell(new PrimaryFound(path).toSerializable(), getSelf()); + return; } - } - getSender().tell(new PrimaryNotFound(shardName), getSelf()); - } else if (message instanceof UpdateSchemaContext) { - for(ActorPath path : localShards.values()){ - getContext().system().actorSelection(path) - .forward(message, - getContext()); } } + + getSender().tell(new PrimaryNotFound(shardName).toSerializable(), getSelf()); } private String getShardActorName(String memberName, String shardName){ return memberName + "-shard-" + shardName + "-" + this.type; } + // Create the shards that are local to this member + private void createLocalShards() { + String memberName = this.cluster.getCurrentMemberName(); + List memberShardNames = + this.configuration.getMemberShardNames(memberName); + for(String shardName : memberShardNames){ + String shardActorName = getShardActorName(memberName, shardName); + ActorRef actor = getContext() + .actorOf(Shard.props(shardActorName), shardActorName); + ActorPath path = actor.path(); + localShards.put(shardName, path); + } + + } + + + @Override + public SupervisorStrategy supervisorStrategy() { + return new OneForOneStrategy(10, Duration.create("1 minute"), + new Function() { + @Override + public SupervisorStrategy.Directive apply(Throwable t) { + return SupervisorStrategy.resume(); + } + } + ); + + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransaction.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransaction.java index 7a0b19742e..737f57bf5d 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransaction.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransaction.java @@ -37,7 +37,7 @@ import org.opendaylight.controller.cluster.datastore.modification.WriteModificat import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction; import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort; import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; @@ -131,23 +131,23 @@ public class ShardTransaction extends AbstractUntypedActor { mergeData(MergeData.fromSerializable(message, schemaContext)); } else if (DeleteData.SERIALIZABLE_CLASS.equals(message.getClass())) { deleteData(DeleteData.fromSerizalizable(message)); - } else if (message instanceof ReadyTransaction) { - readyTransaction((ReadyTransaction) message); - } else if (message instanceof CloseTransaction) { - closeTransaction((CloseTransaction) message); + } else if (ReadyTransaction.SERIALIZABLE_CLASS.equals(message.getClass())) { + readyTransaction(new ReadyTransaction()); + } else if (message.getClass().equals(CloseTransaction.SERIALIZABLE_CLASS)) { + closeTransaction(new CloseTransaction()); } else if (message instanceof GetCompositedModification) { // This is here for testing only getSender().tell(new GetCompositeModificationReply( new ImmutableCompositeModification(modification)), getSelf()); }else{ - throw new Exception ("handleRecieve received an unknown mesages"+message); + throw new Exception ("Shard:handleRecieve received an unknown message"+message); } } private void readData(ReadData message) { final ActorRef sender = getSender(); final ActorRef self = getSelf(); - final InstanceIdentifier path = message.getPath(); + final YangInstanceIdentifier path = message.getPath(); final ListenableFuture>> future = transaction.read(path); @@ -175,21 +175,23 @@ public class ShardTransaction extends AbstractUntypedActor { private void writeData(WriteData message) { modification.addModification( new WriteModification(message.getPath(), message.getData(),schemaContext)); + LOG.debug("writeData at path : " + message.getPath().toString()); transaction.write(message.getPath(), message.getData()); - getSender().tell(new WriteDataReply(), getSelf()); + getSender().tell(new WriteDataReply().toSerializable(), getSelf()); } private void mergeData(MergeData message) { modification.addModification( new MergeModification(message.getPath(), message.getData(), schemaContext)); + LOG.debug("mergeData at path : " + message.getPath().toString()); transaction.merge(message.getPath(), message.getData()); - getSender().tell(new MergeDataReply(), getSelf()); + getSender().tell(new MergeDataReply().toSerializable(), getSelf()); } private void deleteData(DeleteData message) { modification.addModification(new DeleteModification(message.getPath())); transaction.delete(message.getPath()); - getSender().tell(new DeleteDataReply(), getSelf()); + getSender().tell(new DeleteDataReply().toSerializable(), getSelf()); } private void readyTransaction(ReadyTransaction message) { @@ -197,13 +199,13 @@ public class ShardTransaction extends AbstractUntypedActor { ActorRef cohortActor = getContext().actorOf( ThreePhaseCommitCohort.props(cohort, shardActor, modification), "cohort"); getSender() - .tell(new ReadyTransactionReply(cohortActor.path()), getSelf()); + .tell(new ReadyTransactionReply(cohortActor.path()).toSerializable(), getSelf()); } private void closeTransaction(CloseTransaction message) { transaction.close(); - getSender().tell(new CloseTransactionReply(), getSelf()); + getSender().tell(new CloseTransactionReply().toSerializable(), getSelf()); getSelf().tell(PoisonPill.getInstance(), getSelf()); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionChain.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionChain.java index 2991a7742a..50042411b1 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionChain.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionChain.java @@ -14,7 +14,7 @@ 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; -import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; +import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply; import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction; import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain; import org.opendaylight.yangtools.yang.model.api.SchemaContext; @@ -34,12 +34,14 @@ public class ShardTransactionChain extends AbstractUntypedActor { @Override public void handleReceive(Object message) throws Exception { - if (message instanceof CreateTransaction) { - CreateTransaction createTransaction = (CreateTransaction) message; + if (message.getClass().equals(CreateTransaction.SERIALIZABLE_CLASS)) { + CreateTransaction createTransaction = CreateTransaction.fromSerializable( message); createTransaction(createTransaction); - } else if (message instanceof CloseTransactionChain) { + } else if (message.getClass().equals(CloseTransactionChain.SERIALIZABLE_CLASS)) { chain.close(); - getSender().tell(new CloseTransactionChainReply(), getSelf()); + getSender().tell(new CloseTransactionChainReply().toSerializable(), getSelf()); + }else{ + throw new Exception("Not recognized message recieved="+message); } } @@ -49,10 +51,7 @@ public class ShardTransactionChain extends AbstractUntypedActor { ActorRef transactionActor = getContext().actorOf(ShardTransaction .props(chain, transaction, getContext().parent(), schemaContext), "shard-" + createTransaction.getTransactionId()); getSender() - .tell(ShardTransactionMessages.CreateTransactionReply.newBuilder() - .setTransactionActorPath(transactionActor.path().toString()) - .setTransactionId(createTransaction.getTransactionId()) - .build(), + .tell(new CreateTransactionReply(transactionActor.path().toString(),createTransaction.getTransactionId()).toSerializable(), getSelf()); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohort.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohort.java index 060c9d6b50..a8deb0153a 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohort.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohort.java @@ -58,14 +58,16 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor { @Override public void handleReceive(Object message) throws Exception { - if (message instanceof CanCommitTransaction) { - canCommit((CanCommitTransaction) message); - } else if (message instanceof PreCommitTransaction) { - preCommit((PreCommitTransaction) message); - } else if (message instanceof CommitTransaction) { - commit((CommitTransaction) message); - } else if (message instanceof AbortTransaction) { - abort((AbortTransaction) message); + if (message.getClass().equals(CanCommitTransaction.SERIALIZABLE_CLASS)) { + canCommit(new CanCommitTransaction()); + } else if (message.getClass().equals(PreCommitTransaction.SERIALIZABLE_CLASS)) { + preCommit(new PreCommitTransaction()); + } else if (message.getClass().equals(CommitTransaction.SERIALIZABLE_CLASS)) { + commit(new CommitTransaction()); + } else if (message.getClass().equals(AbortTransaction.SERIALIZABLE_CLASS)) { + abort(new AbortTransaction()); + } else { + throw new Exception ("Not recognized message received,message="+message); } } @@ -79,7 +81,7 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor { public void run() { try { future.get(); - sender.tell(new AbortTransactionReply(), self); + sender.tell(new AbortTransactionReply().toSerializable(), self); } catch (InterruptedException | ExecutionException e) { log.error(e, "An exception happened when aborting"); } @@ -107,7 +109,7 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor { public void run() { try { future.get(); - sender.tell(new PreCommitTransactionReply(), self); + sender.tell(new PreCommitTransactionReply().toSerializable(), self); } catch (InterruptedException | ExecutionException e) { log.error(e, "An exception happened when preCommitting"); } @@ -126,7 +128,7 @@ public class ThreePhaseCommitCohort extends AbstractUntypedActor { public void run() { try { Boolean canCommit = future.get(); - sender.tell(new CanCommitTransactionReply(canCommit), self); + sender.tell(new CanCommitTransactionReply(canCommit).toSerializable(), self); } catch (InterruptedException | ExecutionException e) { log.error(e, "An exception happened when aborting"); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java index 279ecba409..b56dc9432f 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java @@ -67,12 +67,12 @@ public class ThreePhaseCommitCohortProxy implements try { Object response = actorContext.executeRemoteOperation(cohort, - new CanCommitTransaction(), + new CanCommitTransaction().toSerializable(), ActorContext.ASK_DURATION); - if (response instanceof CanCommitTransactionReply) { + if (response.getClass().equals(CanCommitTransactionReply.SERIALIZABLE_CLASS)) { CanCommitTransactionReply reply = - (CanCommitTransactionReply) response; + CanCommitTransactionReply.fromSerializable(response); if (!reply.getCanCommit()) { return false; } @@ -97,15 +97,15 @@ public class ThreePhaseCommitCohortProxy implements } @Override public ListenableFuture preCommit() { - return voidOperation(new PreCommitTransaction(), PreCommitTransactionReply.class); + return voidOperation(new PreCommitTransaction().toSerializable(), PreCommitTransactionReply.SERIALIZABLE_CLASS); } @Override public ListenableFuture abort() { - return voidOperation(new AbortTransaction(), AbortTransactionReply.class); + return voidOperation(new AbortTransaction().toSerializable(), AbortTransactionReply.SERIALIZABLE_CLASS); } @Override public ListenableFuture commit() { - return voidOperation(new CommitTransaction(), CommitTransactionReply.class); + return voidOperation(new CommitTransaction().toSerializable(), CommitTransactionReply.SERIALIZABLE_CLASS); } private ListenableFuture voidOperation(final Object message, final Class expectedResponseClass){ diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java index 2f784dc950..5a0049aa6d 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java @@ -15,6 +15,7 @@ import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFutureTask; import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction; import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction; +import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply; import org.opendaylight.controller.cluster.datastore.messages.DeleteData; import org.opendaylight.controller.cluster.datastore.messages.MergeData; import org.opendaylight.controller.cluster.datastore.messages.ReadData; @@ -24,10 +25,9 @@ import org.opendaylight.controller.cluster.datastore.messages.ReadyTransactionRe import org.opendaylight.controller.cluster.datastore.messages.WriteData; import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory; import org.opendaylight.controller.cluster.datastore.utils.ActorContext; -import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply; import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction; import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; @@ -62,7 +62,7 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { private final TransactionType transactionType; private final ActorContext actorContext; - private final Map remoteTransactionPaths = new HashMap<>(); + private final Map remoteTransactionPaths = new HashMap<>(); private final String identifier; private final ExecutorService executor; private final SchemaContext schemaContext; @@ -74,7 +74,7 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { SchemaContext schemaContext ) { - this.identifier = "txn-" + counter.getAndIncrement(); + this.identifier = actorContext.getCurrentMemberName() + "-txn-" + counter.getAndIncrement(); this.transactionType = transactionType; this.actorContext = actorContext; this.executor = executor; @@ -84,7 +84,7 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { } @Override - public ListenableFuture>> read(final InstanceIdentifier path) { + public ListenableFuture>> read(final YangInstanceIdentifier path) { createTransactionIfMissing(actorContext, path); @@ -118,7 +118,7 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { } @Override - public void write(InstanceIdentifier path, NormalizedNode data) { + public void write(YangInstanceIdentifier path, NormalizedNode data) { createTransactionIfMissing(actorContext, path); @@ -127,7 +127,7 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { } @Override - public void merge(InstanceIdentifier path, NormalizedNode data) { + public void merge(YangInstanceIdentifier path, NormalizedNode data) { createTransactionIfMissing(actorContext, path); @@ -136,7 +136,7 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { } @Override - public void delete(InstanceIdentifier path) { + public void delete(YangInstanceIdentifier path) { createTransactionIfMissing(actorContext, path); @@ -148,15 +148,17 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { public DOMStoreThreePhaseCommitCohort ready() { List cohortPaths = new ArrayList<>(); - for(ActorSelection remoteTransaction : remoteTransactionPaths.values()) { - Object result = actorContext.executeRemoteOperation(remoteTransaction, - new ReadyTransaction(), + for(TransactionContext transactionContext : remoteTransactionPaths.values()) { + Object result = actorContext.executeRemoteOperation(transactionContext.getActor(), + new ReadyTransaction().toSerializable(), ActorContext.ASK_DURATION ); - if(result instanceof ReadyTransactionReply){ - ReadyTransactionReply reply = (ReadyTransactionReply) result; - cohortPaths.add(reply.getCohortPath()); + if(result.getClass().equals(ReadyTransactionReply.SERIALIZABLE_CLASS)){ + ReadyTransactionReply reply = ReadyTransactionReply.fromSerializable(actorContext.getActorSystem(),result); + String resolvedCohortPath = transactionContext + .getResolvedCohortPath(reply.getCohortPath().toString()); + cohortPaths.add(actorContext.actorFor(resolvedCohortPath)); } } @@ -170,37 +172,74 @@ public class TransactionProxy implements DOMStoreReadWriteTransaction { @Override public void close() { - for(ActorSelection remoteTransaction : remoteTransactionPaths.values()) { - remoteTransaction.tell(new CloseTransaction(), null); + for(TransactionContext transactionContext : remoteTransactionPaths.values()) { + transactionContext.getActor().tell( + new CloseTransaction().toSerializable(), null); } } - private ActorSelection remoteTransactionFromIdentifier(InstanceIdentifier path){ + private ActorSelection remoteTransactionFromIdentifier(YangInstanceIdentifier path){ String shardName = shardNameFromIdentifier(path); - return remoteTransactionPaths.get(shardName); + return remoteTransactionPaths.get(shardName).getActor(); } - private String shardNameFromIdentifier(InstanceIdentifier path){ + private String shardNameFromIdentifier(YangInstanceIdentifier path){ return ShardStrategyFactory.getStrategy(path).findShard(path); } - private void createTransactionIfMissing(ActorContext actorContext, InstanceIdentifier path) { + private void createTransactionIfMissing(ActorContext actorContext, YangInstanceIdentifier path) { String shardName = ShardStrategyFactory.getStrategy(path).findShard(path); - ActorSelection actorSelection = + TransactionContext transactionContext = remoteTransactionPaths.get(shardName); - if(actorSelection != null){ + if(transactionContext != null){ // A transaction already exists with that shard return; } - Object response = actorContext.executeShardOperation(shardName, new CreateTransaction(identifier), ActorContext.ASK_DURATION); - if(response instanceof CreateTransactionReply){ - CreateTransactionReply reply = (CreateTransactionReply) response; - remoteTransactionPaths.put(shardName, actorContext.actorSelection(reply.getTransactionActorPath())); + Object response = actorContext.executeShardOperation(shardName, new CreateTransaction(identifier).toSerializable(), ActorContext.ASK_DURATION); + if(response.getClass().equals(CreateTransactionReply.SERIALIZABLE_CLASS)){ + CreateTransactionReply reply = CreateTransactionReply.fromSerializable(response); + String transactionPath = actorContext.getRemoteActorPath(shardName, reply.getTransactionPath()); + + ActorSelection transactionActor = actorContext.actorSelection(transactionPath); + transactionContext = new TransactionContext(shardName, transactionPath, transactionActor); + + remoteTransactionPaths.put(shardName, transactionContext); } } + private class TransactionContext { + private final String shardName; + private final String actorPath; + private final ActorSelection actor; + + + private TransactionContext(String shardName, String actorPath, + ActorSelection actor) { + this.shardName = shardName; + this.actorPath = actorPath; + this.actor = actor; + } + + + public String getShardName() { + return shardName; + } + + public String getActorPath() { + return actorPath; + } + + public ActorSelection getActor() { + return actor; + } + + public String getResolvedCohortPath(String cohortPath){ + return actorContext.resolvePath(actorPath, cohortPath); + } + } + } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/AbstractBaseMBean.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/AbstractBaseMBean.java new file mode 100644 index 0000000000..de1ac18533 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/AbstractBaseMBean.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + + +package org.opendaylight.controller.cluster.datastore.jmx.mbeans; + + +import com.google.common.base.Preconditions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.management.InstanceNotFoundException; +import javax.management.MBeanRegistrationException; +import javax.management.MBeanServer; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; +import java.lang.management.ManagementFactory; + +/** + * All MBeans should extend this class that help in registering and + * unregistering the MBeans. + * + */ + + +public abstract class AbstractBaseMBean { + + + public static String BASE_JMX_PREFIX = "org.opendaylight.controller:"; + public static String JMX_TYPE_DISTRIBUTED_DATASTORE = "DistributedDatastore"; + public static String JMX_CATEGORY_SHARD = "Shard"; + + private static final Logger LOG = LoggerFactory + .getLogger(AbstractBaseMBean.class); + + MBeanServer server = ManagementFactory.getPlatformMBeanServer(); + /** + * gets the MBean ObjectName + * + * @return Object name of the MBean + * @throws MalformedObjectNameException - The bean name does not have the right format. + * @throws NullPointerException - The bean name is null + */ + protected ObjectName getMBeanObjectName() + throws MalformedObjectNameException, NullPointerException { + String name = BASE_JMX_PREFIX + "type="+getMBeanType()+",Category="+ + getMBeanCategory() + ",name="+ + getMBeanName(); + + + return new ObjectName(name); + } + + public boolean registerMBean() { + boolean registered = false; + try { + // Object to identify MBean + final ObjectName mbeanName = this.getMBeanObjectName(); + + Preconditions.checkArgument(mbeanName != null, + "Object name of the MBean cannot be null"); + + LOG.debug("Register MBean {}", mbeanName); + + // unregistered if already registered + if (server.isRegistered(mbeanName)) { + + LOG.debug("MBean {} found to be already registered", mbeanName); + + try { + unregisterMBean(mbeanName); + } catch (Exception e) { + + LOG.warn("unregister mbean {} resulted in exception {} ", mbeanName, + e); + } + } + server.registerMBean(this, mbeanName); + + LOG.debug("MBean {} registered successfully", + mbeanName.getCanonicalName()); + registered = true; + } catch (Exception e) { + + LOG.error("registration failed {}", e); + + } + return registered; + } + + + public boolean unregisterMBean() { + boolean unregister = false; + try { + ObjectName mbeanName = this.getMBeanObjectName(); + unregister = true; + unregisterMBean(mbeanName); + } catch (Exception e) { + + LOG.error("Failed when unregistering MBean {}", e); + } + return unregister; + } + + private void unregisterMBean(ObjectName mbeanName) + throws MBeanRegistrationException, InstanceNotFoundException { + + server.unregisterMBean(mbeanName); + + } + + + /** + * @return name of bean + */ + protected abstract String getMBeanName(); + + /** + * @return type of the MBean + */ + protected abstract String getMBeanType(); + + + /** + * @return Category name of teh bean + */ + protected abstract String getMBeanCategory(); + + //require for test cases + public MBeanServer getMBeanServer() { + return server; + } +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardMBeanFactory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardMBeanFactory.java new file mode 100644 index 0000000000..a3359086b6 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardMBeanFactory.java @@ -0,0 +1,26 @@ +package org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author: syedbahm + * Date: 7/16/14 + */ +public class ShardMBeanFactory { + private static Map shardMBeans= new HashMap(); + + public static ShardStats getShardStatsMBean(String shardName){ + if(shardMBeans.containsKey(shardName)){ + return shardMBeans.get(shardName); + }else { + ShardStats shardStatsMBeanImpl = new ShardStats(shardName); + + if(shardStatsMBeanImpl.registerMBean()) { + shardMBeans.put(shardName, shardStatsMBeanImpl); + } + return shardStatsMBeanImpl; + } + } + +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStats.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStats.java new file mode 100644 index 0000000000..2da6aae85f --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStats.java @@ -0,0 +1,70 @@ +package org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard; + +import org.opendaylight.controller.cluster.datastore.jmx.mbeans.AbstractBaseMBean; + +/** + * @author: syedbahm + */ +public class ShardStats extends AbstractBaseMBean implements ShardStatsMBean { + private Long committedTransactionsCount; + private Long journalMessagesCount; + final private String shardName; + + ShardStats(String shardName){ + this.shardName = shardName; + committedTransactionsCount =0L; + journalMessagesCount = 0L; + }; + + + @Override + public String getShardName() { + return shardName; + } + + @Override + public Long getCommittedTransactionsCount() { + return committedTransactionsCount; + } + + @Override + public Long getJournalMessagesCount() { + //FIXME: this will be populated once after integration with Raft stuff + return journalMessagesCount; + } + + + public Long incrementCommittedTransactionCount() { + return committedTransactionsCount++; + } + + + public void updateCommittedTransactionsCount(long currentCount){ + committedTransactionsCount = currentCount; + + } + + public void updateJournalMessagesCount(long currentCount){ + journalMessagesCount = currentCount; + + } + + + + @Override + protected String getMBeanName() { + return shardName; + } + + @Override + protected String getMBeanType() { + return JMX_TYPE_DISTRIBUTED_DATASTORE; + } + + @Override + protected String getMBeanCategory() { + return JMX_CATEGORY_SHARD; + } + + +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStatsMBean.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStatsMBean.java new file mode 100644 index 0000000000..c107e49e85 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStatsMBean.java @@ -0,0 +1,11 @@ +package org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard; + +/** + * @author: syedbahm + */ +public interface ShardStatsMBean { + String getShardName(); + Long getCommittedTransactionsCount(); + Long getJournalMessagesCount(); + +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/AbortTransaction.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/AbortTransaction.java index 4cf713a0b3..4515bd7042 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/AbortTransaction.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/AbortTransaction.java @@ -8,5 +8,13 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class AbortTransaction { +import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages; + +public class AbortTransaction implements SerializableMessage { + public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.AbortTransaction.class; + + @Override + public Object toSerializable() { + return ThreePhaseCommitCohortMessages.AbortTransaction.newBuilder().build(); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/AbortTransactionReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/AbortTransactionReply.java index 84234e5807..31a06fe4c5 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/AbortTransactionReply.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/AbortTransactionReply.java @@ -8,5 +8,14 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class AbortTransactionReply { +import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages; + +public class AbortTransactionReply implements SerializableMessage { + public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.AbortTransactionReply.class; + + + @Override + public Object toSerializable() { + return ThreePhaseCommitCohortMessages.AbortTransactionReply.newBuilder().build(); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CanCommitTransaction.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CanCommitTransaction.java index 526d60fc75..2c032aff65 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CanCommitTransaction.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CanCommitTransaction.java @@ -8,5 +8,13 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class CanCommitTransaction { +import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages; + +public class CanCommitTransaction implements SerializableMessage { + public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CanCommitTransaction.class; + + @Override + public Object toSerializable() { + return ThreePhaseCommitCohortMessages.CanCommitTransaction.newBuilder().build(); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CanCommitTransactionReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CanCommitTransactionReply.java index d143c14b3b..bbcd4de03f 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CanCommitTransactionReply.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CanCommitTransactionReply.java @@ -8,7 +8,10 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class CanCommitTransactionReply { +import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages; + +public class CanCommitTransactionReply implements SerializableMessage { + public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CanCommitTransactionReply.class; private final Boolean canCommit; public CanCommitTransactionReply(Boolean canCommit) { @@ -18,4 +21,14 @@ public class CanCommitTransactionReply { public Boolean getCanCommit() { return canCommit; } + + @Override + public Object toSerializable() { + return ThreePhaseCommitCohortMessages.CanCommitTransactionReply.newBuilder().setCanCommit(canCommit).build(); + } + + + public static CanCommitTransactionReply fromSerializable(Object message) { + return new CanCommitTransactionReply(((ThreePhaseCommitCohortMessages.CanCommitTransactionReply)message).getCanCommit()); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseDataChangeListenerRegistration.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseDataChangeListenerRegistration.java index c3cb00c25f..57237bcbe2 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseDataChangeListenerRegistration.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseDataChangeListenerRegistration.java @@ -8,5 +8,12 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class CloseDataChangeListenerRegistration { +import org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages; + +public class CloseDataChangeListenerRegistration implements SerializableMessage { + public static Class SERIALIZABLE_CLASS = ListenerRegistrationMessages.CloseDataChangeListenerRegistration.class; + @Override + public Object toSerializable() { + return ListenerRegistrationMessages.CloseDataChangeListenerRegistration.newBuilder().build(); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseDataChangeListenerRegistrationReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseDataChangeListenerRegistrationReply.java index d5c75eb68a..faf73c87eb 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseDataChangeListenerRegistrationReply.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseDataChangeListenerRegistrationReply.java @@ -8,5 +8,14 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class CloseDataChangeListenerRegistrationReply { +import org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages; + +public class CloseDataChangeListenerRegistrationReply implements SerializableMessage{ + public static Class SERIALIZABLE_CLASS = ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.class; + + @Override + public Object toSerializable() { + return ListenerRegistrationMessages.CloseDataChangeListenerRegistrationReply.newBuilder().build(); + } + } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransaction.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransaction.java index 6809f4b135..451e39cf6a 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransaction.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransaction.java @@ -8,5 +8,12 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class CloseTransaction { +import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; + +public class CloseTransaction implements SerializableMessage{ + public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.CloseTransaction.class; + @Override + public Object toSerializable() { + return ShardTransactionMessages.CloseTransaction.newBuilder().build(); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionChain.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionChain.java index 04c422b68e..efa51fde20 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionChain.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionChain.java @@ -8,5 +8,12 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class CloseTransactionChain { +import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages; + +public class CloseTransactionChain implements SerializableMessage{ + public static final Class SERIALIZABLE_CLASS = ShardTransactionChainMessages.CloseTransactionChain.class; + @Override + public Object toSerializable() { + return ShardTransactionChainMessages.CloseTransactionChain.newBuilder().build(); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionChainReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionChainReply.java index 89fa93bf9a..23699b7be6 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionChainReply.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionChainReply.java @@ -8,5 +8,13 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class CloseTransactionChainReply { +import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages; + +public class CloseTransactionChainReply implements SerializableMessage { + public static final Class SERIALIZABLE_CLASS = ShardTransactionChainMessages.CloseTransactionChainReply.class; + @Override + public Object toSerializable() { + return ShardTransactionChainMessages.CloseTransactionChainReply.newBuilder().build(); + } + } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionReply.java index 4910a3ea0e..666d182aaf 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionReply.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionReply.java @@ -8,5 +8,12 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class CloseTransactionReply { +import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; + +public class CloseTransactionReply implements SerializableMessage { + public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.CloseTransactionReply.class; + @Override + public Object toSerializable() { + return ShardTransactionMessages.CloseTransactionReply.newBuilder().build(); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CommitTransaction.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CommitTransaction.java index d7b210fd03..14187139aa 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CommitTransaction.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CommitTransaction.java @@ -8,5 +8,13 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class CommitTransaction { +import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages; + +public class CommitTransaction implements SerializableMessage { + public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CommitTransaction.class; + + @Override + public Object toSerializable() { + return ThreePhaseCommitCohortMessages.CommitTransaction.newBuilder().build(); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CommitTransactionReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CommitTransactionReply.java index a0e5e895d2..afeba29879 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CommitTransactionReply.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CommitTransactionReply.java @@ -8,5 +8,14 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class CommitTransactionReply { +import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages; + +public class CommitTransactionReply implements SerializableMessage { + + public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CommitTransactionReply.class; + + @Override + public Object toSerializable() { + return ThreePhaseCommitCohortMessages.CommitTransactionReply.newBuilder().build(); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransaction.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransaction.java index 6110641696..795131fdbf 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransaction.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransaction.java @@ -8,15 +8,30 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class CreateTransaction { - private final String transactionId; - public CreateTransaction(String transactionId){ +import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; - this.transactionId = transactionId; - } - public String getTransactionId() { - return transactionId; - } +public class CreateTransaction implements SerializableMessage { + public static Class SERIALIZABLE_CLASS = ShardTransactionMessages.CreateTransaction.class; + private final String transactionId; + + public CreateTransaction(String transactionId){ + + this.transactionId = transactionId; + } + + public String getTransactionId() { + return transactionId; + } + + @Override + public Object toSerializable() { + return ShardTransactionMessages.CreateTransaction.newBuilder().setTransactionId(transactionId).build(); + } + + public static CreateTransaction fromSerializable(Object message){ + return new CreateTransaction(((ShardTransactionMessages.CreateTransaction)message).getTransactionId()); + } + } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionChain.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionChain.java index 9473885211..6339749f7b 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionChain.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionChain.java @@ -8,7 +8,13 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class CreateTransactionChain { +import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages; +public class CreateTransactionChain implements SerializableMessage{ + public static Class SERIALIZABLE_CLASS = ShardTransactionChainMessages.CreateTransactionChain.class; + @Override + public Object toSerializable() { + return ShardTransactionChainMessages.CreateTransactionChain.newBuilder().build(); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionChainReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionChainReply.java index 49dd9b63d2..4a497622fc 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionChainReply.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionChainReply.java @@ -9,8 +9,11 @@ package org.opendaylight.controller.cluster.datastore.messages; import akka.actor.ActorPath; +import akka.actor.ActorSystem; +import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionChainMessages; -public class CreateTransactionChainReply { +public class CreateTransactionChainReply implements SerializableMessage { + public static final Class SERIALIZABLE_CLASS = ShardTransactionChainMessages.CreateTransactionChainReply.class; private final ActorPath transactionChainPath; public CreateTransactionChainReply(ActorPath transactionChainPath) { @@ -20,4 +23,17 @@ public class CreateTransactionChainReply { public ActorPath getTransactionChainPath() { return transactionChainPath; } + + @Override + public ShardTransactionChainMessages.CreateTransactionChainReply toSerializable() { + return ShardTransactionChainMessages.CreateTransactionChainReply.newBuilder() + .setTransactionChainPath(transactionChainPath.toString()).build(); + } + + public static CreateTransactionChainReply fromSerializable(ActorSystem actorSystem,Object serializable){ + ShardTransactionChainMessages.CreateTransactionChainReply o = (ShardTransactionChainMessages.CreateTransactionChainReply) serializable; + return new CreateTransactionChainReply( + actorSystem.actorFor(o.getTransactionChainPath()).path()); + } + } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionReply.java index 18b29c67d0..096d131d5a 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionReply.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionReply.java @@ -32,7 +32,7 @@ public class CreateTransactionReply implements SerializableMessage { public Object toSerializable(){ return ShardTransactionMessages.CreateTransactionReply.newBuilder() - .setTransactionActorPath(transactionPath.toString()) + .setTransactionActorPath(transactionPath) .setTransactionId(transactionId) .build(); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChanged.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChanged.java index c55dae56dd..a8827bebf4 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChanged.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChanged.java @@ -8,20 +8,256 @@ package org.opendaylight.controller.cluster.datastore.messages; +import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec; +import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; +import org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; -public class DataChanged { - private final AsyncDataChangeEvent> +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class DataChanged implements SerializableMessage { + public static final Class SERIALIZABLE_CLASS = + DataChangeListenerMessages.DataChanged.class; + final private SchemaContext schemaContext; + private final AsyncDataChangeEvent> change; - public DataChanged( - AsyncDataChangeEvent> change) { + + + public DataChanged(SchemaContext schemaContext, + AsyncDataChangeEvent> change) { this.change = change; + this.schemaContext = schemaContext; } - public AsyncDataChangeEvent> getChange() { + + public AsyncDataChangeEvent> getChange() { return change; } + + + private NormalizedNodeMessages.Node convertToNodeTree( + NormalizedNode normalizedNode) { + + return new NormalizedNodeToNodeCodec(schemaContext) + .encode(YangInstanceIdentifier.builder().build(), normalizedNode) + .getNormalizedNode(); + + } + + private Iterable convertToRemovePaths( + Set removedPaths) { + final Set removedPathInstanceIds = new HashSet<>(); + for (YangInstanceIdentifier id : removedPaths) { + removedPathInstanceIds.add(InstanceIdentifierUtils.toSerializable(id)); + } + return new Iterable() { + public Iterator iterator() { + return removedPathInstanceIds.iterator(); + } + }; + + } + + private NormalizedNodeMessages.NodeMap convertToNodeMap( + Map> data) { + NormalizedNodeToNodeCodec normalizedNodeToNodeCodec = + new NormalizedNodeToNodeCodec(schemaContext); + NormalizedNodeMessages.NodeMap.Builder nodeMapBuilder = + NormalizedNodeMessages.NodeMap.newBuilder(); + NormalizedNodeMessages.NodeMapEntry.Builder builder = + NormalizedNodeMessages.NodeMapEntry.newBuilder(); + for (Map.Entry> entry : data + .entrySet()) { + + + NormalizedNodeMessages.InstanceIdentifier instanceIdentifier = + InstanceIdentifierUtils.toSerializable(entry.getKey()); + + builder.setInstanceIdentifierPath(instanceIdentifier) + .setNormalizedNode(normalizedNodeToNodeCodec + .encode(entry.getKey(), entry.getValue()) + .getNormalizedNode()); + nodeMapBuilder.addMapEntries(builder.build()); + } + return nodeMapBuilder.build(); + } + + + @Override + public Object toSerializable() { + return DataChangeListenerMessages.DataChanged.newBuilder() + .addAllRemovedPaths(convertToRemovePaths(change.getRemovedPaths())) + .setCreatedData(convertToNodeMap(change.getCreatedData())) + .setOriginalData(convertToNodeMap(change.getOriginalData())) + .setUpdatedData(convertToNodeMap(change.getUpdatedData())) + .setOriginalSubTree(convertToNodeTree(change.getOriginalSubtree())) + .setUpdatedSubTree(convertToNodeTree(change.getUpdatedSubtree())) + .build(); + } + + public static DataChanged fromSerialize(SchemaContext sc, Object message, + YangInstanceIdentifier pathId) { + DataChangeListenerMessages.DataChanged dataChanged = + (DataChangeListenerMessages.DataChanged) message; + DataChangedEvent event = new DataChangedEvent(sc); + if (dataChanged.getCreatedData() != null && dataChanged.getCreatedData() + .isInitialized()) { + event.setCreatedData(dataChanged.getCreatedData()); + } + if (dataChanged.getOriginalData() != null && dataChanged + .getOriginalData().isInitialized()) { + event.setOriginalData(dataChanged.getOriginalData()); + } + + if (dataChanged.getUpdatedData() != null && dataChanged.getUpdatedData() + .isInitialized()) { + event.setUpdateData(dataChanged.getUpdatedData()); + } + + if (dataChanged.getOriginalSubTree() != null && dataChanged + .getOriginalSubTree().isInitialized()) { + event.setOriginalSubtree(dataChanged.getOriginalSubTree(), pathId); + } + + if (dataChanged.getUpdatedSubTree() != null && dataChanged + .getUpdatedSubTree().isInitialized()) { + event.setUpdatedSubtree(dataChanged.getOriginalSubTree(), pathId); + } + + if (dataChanged.getRemovedPathsList() != null && !dataChanged + .getRemovedPathsList().isEmpty()) { + event.setRemovedPaths(dataChanged.getRemovedPathsList()); + } + + return new DataChanged(sc, event); + + } + + static class DataChangedEvent implements + AsyncDataChangeEvent> { + private final SchemaContext schemaContext; + private Map> createdData; + private final NormalizedNodeToNodeCodec nodeCodec; + private Map> updatedData; + private Map> originalData; + private NormalizedNode originalSubTree; + private NormalizedNode updatedSubTree; + private Set removedPathIds; + + DataChangedEvent(SchemaContext schemaContext) { + this.schemaContext = schemaContext; + nodeCodec = new NormalizedNodeToNodeCodec(schemaContext); + } + + @Override + public Map> getCreatedData() { + if(createdData == null){ + return Collections.emptyMap(); + } + return createdData; + } + + DataChangedEvent setCreatedData( + NormalizedNodeMessages.NodeMap nodeMap) { + this.createdData = convertNodeMapToMap(nodeMap); + return this; + } + + private Map> convertNodeMapToMap( + NormalizedNodeMessages.NodeMap nodeMap) { + Map> mapEntries = + new HashMap>(); + for (NormalizedNodeMessages.NodeMapEntry nodeMapEntry : nodeMap + .getMapEntriesList()) { + YangInstanceIdentifier id = InstanceIdentifierUtils + .fromSerializable(nodeMapEntry.getInstanceIdentifierPath()); + mapEntries.put(id, + nodeCodec.decode(id, nodeMapEntry.getNormalizedNode())); + } + return mapEntries; + } + + + @Override + public Map> getUpdatedData() { + if(updatedData == null){ + return Collections.emptyMap(); + } + return updatedData; + } + + DataChangedEvent setUpdateData(NormalizedNodeMessages.NodeMap nodeMap) { + this.updatedData = convertNodeMapToMap(nodeMap); + return this; + } + + @Override + public Set getRemovedPaths() { + if (removedPathIds == null) { + return Collections.emptySet(); + } + return removedPathIds; + } + + public DataChangedEvent setRemovedPaths(List removedPaths) { + Set removedIds = new HashSet<>(); + for (NormalizedNodeMessages.InstanceIdentifier path : removedPaths) { + removedIds.add(InstanceIdentifierUtils.fromSerializable(path)); + } + this.removedPathIds = removedIds; + return this; + } + + @Override + public Map> getOriginalData() { + if (originalData == null) { + Collections.emptyMap(); + } + return originalData; + } + + DataChangedEvent setOriginalData( + NormalizedNodeMessages.NodeMap nodeMap) { + this.originalData = convertNodeMapToMap(nodeMap); + return this; + } + + @Override + public NormalizedNode getOriginalSubtree() { + return originalSubTree; + } + + DataChangedEvent setOriginalSubtree(NormalizedNodeMessages.Node node, + YangInstanceIdentifier instanceIdentifierPath) { + originalSubTree = nodeCodec.decode(instanceIdentifierPath, node); + return this; + } + + @Override + public NormalizedNode getUpdatedSubtree() { + return updatedSubTree; + } + + DataChangedEvent setUpdatedSubtree(NormalizedNodeMessages.Node node, + YangInstanceIdentifier instanceIdentifierPath) { + updatedSubTree = nodeCodec.decode(instanceIdentifierPath, node); + return this; + } + + + } + + + } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChangedReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChangedReply.java index 3531021b94..cffe985d18 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChangedReply.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DataChangedReply.java @@ -8,5 +8,12 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class DataChangedReply { +import org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages; + +public class DataChangedReply implements SerializableMessage { + public static final Class SERIALIZABLE_CLASS = DataChangeListenerMessages.DataChangedReply.class; + @Override + public Object toSerializable() { + return DataChangeListenerMessages.DataChangedReply.newBuilder().build(); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DeleteData.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DeleteData.java index babe1c6686..17861a5a68 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DeleteData.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DeleteData.java @@ -10,29 +10,29 @@ package org.opendaylight.controller.cluster.datastore.messages; import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; public class DeleteData implements SerializableMessage { public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.DeleteData.class; - private final InstanceIdentifier path; + private final YangInstanceIdentifier path; - public DeleteData(InstanceIdentifier path) { + public DeleteData(YangInstanceIdentifier path) { this.path = path; } - public InstanceIdentifier getPath() { + public YangInstanceIdentifier getPath() { return path; } @Override public Object toSerializable() { return ShardTransactionMessages.DeleteData.newBuilder() - .setInstanceIdentifierPathArguments(path.toString()).build(); + .setInstanceIdentifierPathArguments(InstanceIdentifierUtils.toSerializable(path)).build(); } public static DeleteData fromSerizalizable(Object serializable){ ShardTransactionMessages.DeleteData o = (ShardTransactionMessages.DeleteData) serializable; - return new DeleteData(InstanceIdentifierUtils.from(o.getInstanceIdentifierPathArguments())); + return new DeleteData(InstanceIdentifierUtils.fromSerializable(o.getInstanceIdentifierPathArguments())); } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DeleteDataReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DeleteDataReply.java index a3c7305685..8e2a7b7295 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DeleteDataReply.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DeleteDataReply.java @@ -8,5 +8,12 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class DeleteDataReply { +import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; + +public class DeleteDataReply implements SerializableMessage{ + public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.DeleteDataReply.class; + @Override + public Object toSerializable() { + return ShardTransactionMessages.DeleteDataReply.newBuilder().build(); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/FindPrimary.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/FindPrimary.java index f2497e6517..f584467ee9 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/FindPrimary.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/FindPrimary.java @@ -9,13 +9,14 @@ package org.opendaylight.controller.cluster.datastore.messages; import com.google.common.base.Preconditions; +import org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages; /** * The FindPrimary message is used to locate the primary of any given shard * - * TODO : Make this serializable */ -public class FindPrimary{ +public class FindPrimary implements SerializableMessage{ + public static final Class SERIALIZABLE_CLASS = ShardManagerMessages.FindPrimary.class; private final String shardName; public FindPrimary(String shardName){ @@ -28,4 +29,13 @@ public class FindPrimary{ public String getShardName() { return shardName; } + + @Override + public Object toSerializable() { + return ShardManagerMessages.FindPrimary.newBuilder().setShardName(shardName).build(); + } + + public static FindPrimary fromSerializable(Object message){ + return new FindPrimary(((ShardManagerMessages.FindPrimary)message).getShardName()); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/MergeData.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/MergeData.java index 59f1387510..ba790816c4 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/MergeData.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/MergeData.java @@ -12,7 +12,7 @@ import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCo import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; @@ -20,7 +20,7 @@ public class MergeData extends ModifyData{ public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.MergeData.class; - public MergeData(InstanceIdentifier path, NormalizedNode data, + public MergeData(YangInstanceIdentifier path, NormalizedNode data, SchemaContext context) { super(path, data, context); } @@ -28,16 +28,16 @@ public class MergeData extends ModifyData{ @Override public Object toSerializable() { NormalizedNodeMessages.Node normalizedNode = - new NormalizedNodeToNodeCodec(schemaContext).encode(InstanceIdentifierUtils.from(path.toString()), data) + new NormalizedNodeToNodeCodec(schemaContext).encode(path, data) .getNormalizedNode(); return ShardTransactionMessages.MergeData.newBuilder() - .setInstanceIdentifierPathArguments(path.toString()) + .setInstanceIdentifierPathArguments(InstanceIdentifierUtils.toSerializable(path)) .setNormalizedNode(normalizedNode).build(); } public static MergeData fromSerializable(Object serializable, SchemaContext schemaContext){ ShardTransactionMessages.MergeData o = (ShardTransactionMessages.MergeData) serializable; - InstanceIdentifier identifier = InstanceIdentifierUtils.from(o.getInstanceIdentifierPathArguments()); + YangInstanceIdentifier identifier = InstanceIdentifierUtils.fromSerializable(o.getInstanceIdentifierPathArguments()); NormalizedNode normalizedNode = new NormalizedNodeToNodeCodec(schemaContext) diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/MergeDataReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/MergeDataReply.java index 8e90972f87..81b1c3bbb1 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/MergeDataReply.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/MergeDataReply.java @@ -8,5 +8,13 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class MergeDataReply { +import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; + +public class MergeDataReply implements SerializableMessage{ + public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.MergeDataReply.class; + + @Override + public Object toSerializable() { + return ShardTransactionMessages.MergeDataReply.newBuilder().build(); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ModifyData.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ModifyData.java index cdab30cbdc..b5c39d1c3f 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ModifyData.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ModifyData.java @@ -9,16 +9,16 @@ package org.opendaylight.controller.cluster.datastore.messages; import com.google.common.base.Preconditions; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; public abstract class ModifyData implements SerializableMessage { - protected final InstanceIdentifier path; + protected final YangInstanceIdentifier path; protected final NormalizedNode data; protected final SchemaContext schemaContext; - public ModifyData(InstanceIdentifier path, NormalizedNode data, + public ModifyData(YangInstanceIdentifier path, NormalizedNode data, SchemaContext context) { Preconditions.checkNotNull(context, "Cannot serialize an object which does not have a schema schemaContext"); @@ -29,7 +29,7 @@ public abstract class ModifyData implements SerializableMessage { this.schemaContext = context; } - public InstanceIdentifier getPath() { + public YangInstanceIdentifier getPath() { return path; } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PreCommitTransaction.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PreCommitTransaction.java index 87a9c77a4f..1e5a05329b 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PreCommitTransaction.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PreCommitTransaction.java @@ -8,5 +8,14 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class PreCommitTransaction { +import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages; + +public class PreCommitTransaction implements SerializableMessage{ + + public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.PreCommitTransaction.class; + + @Override + public Object toSerializable() { + return ThreePhaseCommitCohortMessages.PreCommitTransaction.newBuilder().build(); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PreCommitTransactionReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PreCommitTransactionReply.java index f499c720d2..1aedae3ae7 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PreCommitTransactionReply.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PreCommitTransactionReply.java @@ -8,5 +8,14 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class PreCommitTransactionReply { +import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages; + +public class PreCommitTransactionReply implements SerializableMessage{ + + public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.PreCommitTransactionReply.class; + + @Override + public Object toSerializable() { + return ThreePhaseCommitCohortMessages.PreCommitTransactionReply.newBuilder().build(); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryFound.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryFound.java index d6aae3786f..69502837bc 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryFound.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryFound.java @@ -8,7 +8,10 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class PrimaryFound { +import org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages; + +public class PrimaryFound implements SerializableMessage { + public static final Class SERIALIZABLE_CLASS = ShardManagerMessages.PrimaryFound.class; private final String primaryPath; public PrimaryFound(String primaryPath) { @@ -44,4 +47,12 @@ public class PrimaryFound { } + @Override + public Object toSerializable() { + return ShardManagerMessages.PrimaryFound.newBuilder().setPrimaryPath(primaryPath).build(); + } + + public static PrimaryFound fromSerializable(Object message){ + return new PrimaryFound(((ShardManagerMessages.PrimaryFound)message).getPrimaryPath()); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryNotFound.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryNotFound.java index c66e12cb39..057028c469 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryNotFound.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryNotFound.java @@ -9,8 +9,10 @@ package org.opendaylight.controller.cluster.datastore.messages; import com.google.common.base.Preconditions; +import org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages; -public class PrimaryNotFound { +public class PrimaryNotFound implements SerializableMessage { + public static final Class SERIALIZABLE_CLASS = ShardManagerMessages.PrimaryNotFound.class; private final String shardName; @@ -37,4 +39,13 @@ public class PrimaryNotFound { public int hashCode() { return shardName != null ? shardName.hashCode() : 0; } + + @Override + public Object toSerializable() { + return ShardManagerMessages.PrimaryNotFound.newBuilder().setShardName(shardName).build(); + } + + public static PrimaryNotFound fromSerializable(Object message){ + return new PrimaryNotFound(((ShardManagerMessages.PrimaryNotFound)message).getShardName()); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadData.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadData.java index cb6347f3e5..a698f46347 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadData.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadData.java @@ -10,28 +10,28 @@ package org.opendaylight.controller.cluster.datastore.messages; import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; public class ReadData { public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.ReadData.class; - private final InstanceIdentifier path; + private final YangInstanceIdentifier path; - public ReadData(InstanceIdentifier path) { + public ReadData(YangInstanceIdentifier path) { this.path = path; } - public InstanceIdentifier getPath() { + public YangInstanceIdentifier getPath() { return path; } public Object toSerializable(){ return ShardTransactionMessages.ReadData.newBuilder() - .setInstanceIdentifierPathArguments(path.toString()) + .setInstanceIdentifierPathArguments(InstanceIdentifierUtils.toSerializable(path)) .build(); } public static ReadData fromSerializable(Object serializable){ ShardTransactionMessages.ReadData o = (ShardTransactionMessages.ReadData) serializable; - return new ReadData(InstanceIdentifierUtils.from(o.getInstanceIdentifierPathArguments())); + return new ReadData(InstanceIdentifierUtils.fromSerializable(o.getInstanceIdentifierPathArguments())); } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadDataReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadDataReply.java index a8926be779..c5498ca228 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadDataReply.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadDataReply.java @@ -10,11 +10,12 @@ package org.opendaylight.controller.cluster.datastore.messages; import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec; import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; public class ReadDataReply implements SerializableMessage{ + private final NormalizedNode normalizedNode; private final SchemaContext schemaContext; public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.ReadDataReply.class; @@ -32,7 +33,7 @@ public class ReadDataReply implements SerializableMessage{ if(normalizedNode != null) { return ShardTransactionMessages.ReadDataReply.newBuilder() .setNormalizedNode(new NormalizedNodeToNodeCodec(schemaContext) - .encode(InstanceIdentifier.builder().build(), normalizedNode).getNormalizedNode() + .encode(YangInstanceIdentifier.builder().build(), normalizedNode).getNormalizedNode() ).build(); }else{ return ShardTransactionMessages.ReadDataReply.newBuilder().build(); @@ -41,7 +42,7 @@ public class ReadDataReply implements SerializableMessage{ } - public static ReadDataReply fromSerializable(SchemaContext schemaContext,InstanceIdentifier id,Object serializable){ + public static ReadDataReply fromSerializable(SchemaContext schemaContext,YangInstanceIdentifier id,Object serializable){ ShardTransactionMessages.ReadDataReply o = (ShardTransactionMessages.ReadDataReply) serializable; return new ReadDataReply(schemaContext,new NormalizedNodeToNodeCodec(schemaContext).decode(id, o.getNormalizedNode())); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadyTransaction.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadyTransaction.java index 58eef66fc7..3a51d9850b 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadyTransaction.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadyTransaction.java @@ -8,5 +8,14 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class ReadyTransaction { +import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; + +public class ReadyTransaction implements SerializableMessage{ + public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.ReadyTransaction.class; + + @Override + public Object toSerializable() { + return ShardTransactionMessages.ReadyTransaction.newBuilder().build(); + } + } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadyTransactionReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadyTransactionReply.java index 32d31bf84d..5273dc2479 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadyTransactionReply.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadyTransactionReply.java @@ -9,8 +9,11 @@ package org.opendaylight.controller.cluster.datastore.messages; import akka.actor.ActorPath; +import akka.actor.ActorSystem; +import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; -public class ReadyTransactionReply { +public class ReadyTransactionReply implements SerializableMessage { + public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.ReadyTransactionReply.class; private final ActorPath cohortPath; public ReadyTransactionReply(ActorPath cohortPath) { @@ -21,4 +24,16 @@ public class ReadyTransactionReply { public ActorPath getCohortPath() { return cohortPath; } + + @Override + public ShardTransactionMessages.ReadyTransactionReply toSerializable() { + return ShardTransactionMessages.ReadyTransactionReply.newBuilder() + .setActorPath(cohortPath.toString()).build(); + } + + public static ReadyTransactionReply fromSerializable(ActorSystem actorSystem,Object serializable){ + ShardTransactionMessages.ReadyTransactionReply o = (ShardTransactionMessages.ReadyTransactionReply) serializable; + return new ReadyTransactionReply( + actorSystem.actorFor(o.getActorPath()).path()); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterChangeListener.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterChangeListener.java index db8a08f11a..c1ec0a87cb 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterChangeListener.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterChangeListener.java @@ -13,16 +13,16 @@ import akka.actor.ActorSystem; import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker; import org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; public class RegisterChangeListener implements SerializableMessage { public static final Class SERIALIZABLE_CLASS = ListenerRegistrationMessages.RegisterChangeListener.class; - private final InstanceIdentifier path; + private final YangInstanceIdentifier path; private final ActorPath dataChangeListenerPath; private final AsyncDataBroker.DataChangeScope scope; - public RegisterChangeListener(InstanceIdentifier path, + public RegisterChangeListener(YangInstanceIdentifier path, ActorPath dataChangeListenerPath, AsyncDataBroker.DataChangeScope scope) { this.path = path; @@ -30,7 +30,7 @@ public class RegisterChangeListener implements SerializableMessage { this.scope = scope; } - public InstanceIdentifier getPath() { + public YangInstanceIdentifier getPath() { return path; } @@ -47,14 +47,14 @@ public class RegisterChangeListener implements SerializableMessage { @Override public ListenerRegistrationMessages.RegisterChangeListener toSerializable() { return ListenerRegistrationMessages.RegisterChangeListener.newBuilder() - .setInstanceIdentifierPath(path.toString()) + .setInstanceIdentifierPath(InstanceIdentifierUtils.toSerializable(path)) .setDataChangeListenerActorPath(dataChangeListenerPath.toString()) .setDataChangeScope(scope.ordinal()).build(); } public static RegisterChangeListener fromSerializable(ActorSystem actorSystem,Object serializable){ ListenerRegistrationMessages.RegisterChangeListener o = (ListenerRegistrationMessages.RegisterChangeListener) serializable; - return new RegisterChangeListener(InstanceIdentifierUtils.from(o.getInstanceIdentifierPath()), + return new RegisterChangeListener(InstanceIdentifierUtils.fromSerializable(o.getInstanceIdentifierPath()), actorSystem.actorFor(o.getDataChangeListenerActorPath()).path(), AsyncDataBroker.DataChangeScope.values()[o.getDataChangeScope()]); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/WriteData.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/WriteData.java index 3cde958ab8..87fa010b37 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/WriteData.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/WriteData.java @@ -12,7 +12,7 @@ import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCo import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; @@ -20,25 +20,24 @@ public class WriteData extends ModifyData{ public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.WriteData.class; - public WriteData(InstanceIdentifier path, NormalizedNode data, SchemaContext schemaContext) { + public WriteData(YangInstanceIdentifier path, NormalizedNode data, SchemaContext schemaContext) { super(path, data, schemaContext); } @Override public Object toSerializable() { NormalizedNodeMessages.Node normalizedNode = - new NormalizedNodeToNodeCodec(schemaContext).encode( - InstanceIdentifierUtils.from(path.toString()), data) + new NormalizedNodeToNodeCodec(schemaContext).encode(path, data) .getNormalizedNode(); return ShardTransactionMessages.WriteData.newBuilder() - .setInstanceIdentifierPathArguments(path.toString()) + .setInstanceIdentifierPathArguments(InstanceIdentifierUtils.toSerializable(path)) .setNormalizedNode(normalizedNode).build(); } public static WriteData fromSerializable(Object serializable, SchemaContext schemaContext){ ShardTransactionMessages.WriteData o = (ShardTransactionMessages.WriteData) serializable; - InstanceIdentifier identifier = InstanceIdentifierUtils.from(o.getInstanceIdentifierPathArguments()); + YangInstanceIdentifier identifier = InstanceIdentifierUtils.fromSerializable(o.getInstanceIdentifierPathArguments()); NormalizedNode normalizedNode = new NormalizedNodeToNodeCodec(schemaContext) diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/WriteDataReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/WriteDataReply.java index 2a2b4ed25d..5404fb6510 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/WriteDataReply.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/WriteDataReply.java @@ -8,5 +8,12 @@ package org.opendaylight.controller.cluster.datastore.messages; -public class WriteDataReply { +import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages; + +public class WriteDataReply implements SerializableMessage{ + public static final Class SERIALIZABLE_CLASS = ShardTransactionMessages.WriteDataReply.class; + @Override + public Object toSerializable() { + return ShardTransactionMessages.WriteDataReply.newBuilder().build(); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModification.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModification.java index 5d9f96277d..169397bf87 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModification.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModification.java @@ -9,7 +9,7 @@ package org.opendaylight.controller.cluster.datastore.modification; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import java.io.Serializable; @@ -21,9 +21,9 @@ public abstract class AbstractModification implements Modification, private static final long serialVersionUID = 1638042650152084457L; - protected final InstanceIdentifier path; + protected final YangInstanceIdentifier path; - protected AbstractModification(InstanceIdentifier path) { + protected AbstractModification(YangInstanceIdentifier path) { this.path = path; } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModification.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModification.java index f7d8b87ff6..593f458afa 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModification.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModification.java @@ -11,13 +11,13 @@ package org.opendaylight.controller.cluster.datastore.modification; import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages; import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; /** * DeleteModification store all the parameters required to delete a path from the data tree */ public class DeleteModification extends AbstractModification { - public DeleteModification(InstanceIdentifier path) { + public DeleteModification(YangInstanceIdentifier path) { super(path); } @@ -29,12 +29,12 @@ public class DeleteModification extends AbstractModification { @Override public Object toSerializable() { return PersistentMessages.Modification.newBuilder() .setType(this.getClass().toString()) - .setPath(this.path.toString()) + .setPath(InstanceIdentifierUtils.toSerializable(this.path)) .build(); } public static DeleteModification fromSerializable(Object serializable){ PersistentMessages.Modification o = (PersistentMessages.Modification) serializable; - return new DeleteModification(InstanceIdentifierUtils.from(o.getPath())); + return new DeleteModification(InstanceIdentifierUtils.fromSerializable(o.getPath())); } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MergeModification.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MergeModification.java index b484f85491..f06adcf96f 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MergeModification.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MergeModification.java @@ -13,7 +13,7 @@ import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUti import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages; import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; @@ -25,7 +25,7 @@ public class MergeModification extends AbstractModification { private final SchemaContext schemaContext; - public MergeModification(InstanceIdentifier path, NormalizedNode data, + public MergeModification(YangInstanceIdentifier path, NormalizedNode data, SchemaContext schemaContext) { super(path); this.data = data; @@ -40,11 +40,11 @@ public class MergeModification extends AbstractModification { @Override public Object toSerializable() { NormalizedNodeMessages.Container encode = new NormalizedNodeToNodeCodec(schemaContext).encode( - InstanceIdentifierUtils.from(path.toString()), data); + path, data); return PersistentMessages.Modification.newBuilder() .setType(this.getClass().toString()) - .setPath(this.path.toString()) + .setPath(InstanceIdentifierUtils.toSerializable(this.path)) .setData(encode.getNormalizedNode()) .build(); @@ -55,7 +55,7 @@ public class MergeModification extends AbstractModification { SchemaContext schemaContext) { PersistentMessages.Modification o = (PersistentMessages.Modification) serializable; - InstanceIdentifier path = InstanceIdentifierUtils.from(o.getPath()); + YangInstanceIdentifier path = InstanceIdentifierUtils.fromSerializable(o.getPath()); NormalizedNode data = new NormalizedNodeToNodeCodec(schemaContext).decode( path, o.getData()); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/WriteModification.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/WriteModification.java index 0f81c7cefe..b4a7dd62d0 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/WriteModification.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/WriteModification.java @@ -13,7 +13,7 @@ import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUti import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages; import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; @@ -25,7 +25,7 @@ public class WriteModification extends AbstractModification { private final NormalizedNode data; private final SchemaContext schemaContext; - public WriteModification(InstanceIdentifier path, NormalizedNode data, SchemaContext schemaContext) { + public WriteModification(YangInstanceIdentifier path, NormalizedNode data, SchemaContext schemaContext) { super(path); this.data = data; this.schemaContext = schemaContext; @@ -39,12 +39,12 @@ public class WriteModification extends AbstractModification { @Override public Object toSerializable() { NormalizedNodeMessages.Container encode = new NormalizedNodeToNodeCodec(schemaContext).encode( - InstanceIdentifierUtils.from(path.toString()), data); + path, data); return PersistentMessages.Modification.newBuilder() .setType(this.getClass().toString()) - .setPath(this.path.toString()) + .setPath(InstanceIdentifierUtils.toSerializable(this.path)) .setData(encode.getNormalizedNode()) .build(); @@ -55,7 +55,7 @@ public class WriteModification extends AbstractModification { SchemaContext schemaContext) { PersistentMessages.Modification o = (PersistentMessages.Modification) serializable; - InstanceIdentifier path = InstanceIdentifierUtils.from(o.getPath()); + YangInstanceIdentifier path = InstanceIdentifierUtils.fromSerializable(o.getPath()); NormalizedNode data = new NormalizedNodeToNodeCodec(schemaContext).decode( path, o.getData()); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/DefaultShardStrategy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/DefaultShardStrategy.java index a8ab5c4bd3..55c682b860 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/DefaultShardStrategy.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/DefaultShardStrategy.java @@ -8,7 +8,7 @@ package org.opendaylight.controller.cluster.datastore.shardstrategy; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; /** * The DefaultShardStrategy basically puts all data into the default Shard @@ -22,7 +22,7 @@ public class DefaultShardStrategy implements ShardStrategy{ public static final String DEFAULT_SHARD = "default"; @Override - public String findShard(InstanceIdentifier path) { + public String findShard(YangInstanceIdentifier path) { return DEFAULT_SHARD; } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ModuleShardStrategy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ModuleShardStrategy.java index fe6f740d27..6f4b65a6f3 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ModuleShardStrategy.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ModuleShardStrategy.java @@ -9,7 +9,7 @@ package org.opendaylight.controller.cluster.datastore.shardstrategy; import org.opendaylight.controller.cluster.datastore.Configuration; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; public class ModuleShardStrategy implements ShardStrategy { @@ -24,7 +24,7 @@ public class ModuleShardStrategy implements ShardStrategy { this.configuration = configuration; } - @Override public String findShard(InstanceIdentifier path) { + @Override public String findShard(YangInstanceIdentifier path) { return configuration.getShardNamesFromModuleName(moduleName).get(0); } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategy.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategy.java index f75eb2d863..2df945edd5 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategy.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategy.java @@ -8,7 +8,7 @@ package org.opendaylight.controller.cluster.datastore.shardstrategy; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; /** * The role of ShardStrategy is to figure out which Shards a given piece of data belongs to @@ -20,5 +20,5 @@ public interface ShardStrategy { * @param path The location of the data in the logical tree * @return */ - String findShard(InstanceIdentifier path); + String findShard(YangInstanceIdentifier path); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactory.java index 8b077d6ee6..f4ab8fab6f 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactory.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactory.java @@ -11,7 +11,7 @@ package org.opendaylight.controller.cluster.datastore.shardstrategy; import com.google.common.base.Optional; import com.google.common.base.Preconditions; import org.opendaylight.controller.cluster.datastore.Configuration; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -29,7 +29,7 @@ public class ShardStrategyFactory { moduleNameToStrategyMap = configuration.getModuleNameToShardStrategyMap(); } - public static ShardStrategy getStrategy(InstanceIdentifier path) { + public static ShardStrategy getStrategy(YangInstanceIdentifier path) { Preconditions.checkState(configuration != null, "configuration should not be missing"); Preconditions.checkNotNull(path, "path should not be null"); @@ -44,9 +44,8 @@ public class ShardStrategyFactory { } - private static String getModuleName(InstanceIdentifier path) { - String namespace = path.getLastPathArgument().getNodeType().getNamespace() - .toASCIIString(); + private static String getModuleName(YangInstanceIdentifier path) { + String namespace = path.getPathArguments().iterator().next().getNodeType().getNamespace().toASCIIString(); Optional optional = configuration.getModuleNameFromNameSpace(namespace); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ActorContext.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ActorContext.java index 2f1949ec6a..c7ee7d8c2c 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ActorContext.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ActorContext.java @@ -14,6 +14,10 @@ import akka.actor.ActorSelection; import akka.actor.ActorSystem; import akka.actor.PoisonPill; import akka.util.Timeout; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import org.opendaylight.controller.cluster.datastore.ClusterWrapper; import org.opendaylight.controller.cluster.datastore.Configuration; import org.opendaylight.controller.cluster.datastore.exceptions.PrimaryNotFoundException; import org.opendaylight.controller.cluster.datastore.exceptions.TimeoutException; @@ -41,18 +45,24 @@ public class ActorContext { private static final Logger LOG = LoggerFactory.getLogger(ActorContext.class); - public static final FiniteDuration ASK_DURATION = Duration.create(5, TimeUnit.SECONDS); - public static final Duration AWAIT_DURATION = Duration.create(5, TimeUnit.SECONDS); + public static final FiniteDuration ASK_DURATION = + Duration.create(5, TimeUnit.SECONDS); + public static final Duration AWAIT_DURATION = + Duration.create(5, TimeUnit.SECONDS); private final ActorSystem actorSystem; private final ActorRef shardManager; + private final ClusterWrapper clusterWrapper; private final Configuration configuration; private SchemaContext schemaContext = null; - public ActorContext(ActorSystem actorSystem, ActorRef shardManager, Configuration configuration){ + public ActorContext(ActorSystem actorSystem, ActorRef shardManager, + ClusterWrapper clusterWrapper, + Configuration configuration) { this.actorSystem = actorSystem; this.shardManager = shardManager; + this.clusterWrapper = clusterWrapper; this.configuration = configuration; } @@ -64,11 +74,11 @@ public class ActorContext { return shardManager; } - public ActorSelection actorSelection(String actorPath){ + public ActorSelection actorSelection(String actorPath) { return actorSystem.actorSelection(actorPath); } - public ActorSelection actorSelection(ActorPath actorPath){ + public ActorSelection actorSelection(ActorPath actorPath) { return actorSystem.actorSelection(actorPath); } @@ -80,28 +90,35 @@ public class ActorContext { * @return */ public ActorSelection findPrimary(String shardName) { + String path = findPrimaryPath(shardName); + return actorSystem.actorSelection(path); + } + + public String findPrimaryPath(String shardName) { Object result = executeLocalOperation(shardManager, - new FindPrimary(shardName), ASK_DURATION); + new FindPrimary(shardName).toSerializable(), ASK_DURATION); - if(result instanceof PrimaryFound){ - PrimaryFound found = (PrimaryFound) result; + if (result.getClass().equals(PrimaryFound.SERIALIZABLE_CLASS)) { + PrimaryFound found = PrimaryFound.fromSerializable(result); - LOG.error("Primary found {}", found.getPrimaryPath()); + LOG.debug("Primary found {}", found.getPrimaryPath()); - return actorSystem.actorSelection(found.getPrimaryPath()); + return found.getPrimaryPath(); } throw new PrimaryNotFoundException(); } + /** * Executes an operation on a local actor and wait for it's response + * * @param actor * @param message * @param duration * @return The response of the operation */ public Object executeLocalOperation(ActorRef actor, Object message, - FiniteDuration duration){ + FiniteDuration duration) { Future future = ask(actor, message, new Timeout(duration)); @@ -114,13 +131,17 @@ public class ActorContext { /** * Execute an operation on a remote actor and wait for it's response + * * @param actor * @param message * @param duration * @return */ public Object executeRemoteOperation(ActorSelection actor, Object message, - FiniteDuration duration){ + FiniteDuration duration) { + + LOG.debug("Sending remote message {} to {}", message.getClass().toString(), actor.toString()); + Future future = ask(actor, message, new Timeout(duration)); @@ -134,18 +155,19 @@ public class ActorContext { /** * Execute an operation on the primary for a given shard *

- * This method first finds the primary for a given shard ,then sends - * the message to the remote shard and waits for a response + * This method first finds the primary for a given shard ,then sends + * the message to the remote shard and waits for a response *

+ * * @param shardName * @param message * @param duration - * @throws org.opendaylight.controller.cluster.datastore.exceptions.TimeoutException if the message to the remote shard times out - * @throws org.opendaylight.controller.cluster.datastore.exceptions.PrimaryNotFoundException if the primary shard is not found - * * @return + * @throws org.opendaylight.controller.cluster.datastore.exceptions.TimeoutException if the message to the remote shard times out + * @throws org.opendaylight.controller.cluster.datastore.exceptions.PrimaryNotFoundException if the primary shard is not found */ - public Object executeShardOperation(String shardName, Object message, FiniteDuration duration){ + public Object executeShardOperation(String shardName, Object message, + FiniteDuration duration) { ActorSelection primary = findPrimary(shardName); return executeRemoteOperation(primary, message, duration); @@ -155,4 +177,44 @@ public class ActorContext { shardManager.tell(PoisonPill.getInstance(), null); actorSystem.shutdown(); } + + public String getRemoteActorPath(final String shardName, + final String localPathOfRemoteActor) { + final String path = findPrimaryPath(shardName); + + LoadingCache graphs = CacheBuilder.newBuilder() + .expireAfterAccess(2, TimeUnit.SECONDS) + .build( + new CacheLoader() { + public String load(String key) { + return resolvePath(path, localPathOfRemoteActor); + } + } + ); + return graphs.getUnchecked(localPathOfRemoteActor); + } + + public String resolvePath(final String primaryPath, + final String localPathOfRemoteActor) { + StringBuilder builder = new StringBuilder(); + String[] primaryPathElements = primaryPath.split("/"); + builder.append(primaryPathElements[0]).append("//") + .append(primaryPathElements[1]).append(primaryPathElements[2]); + String[] remotePathElements = localPathOfRemoteActor.split("/"); + for (int i = 3; i < remotePathElements.length; i++) { + builder.append("/").append(remotePathElements[i]); + } + + return builder.toString(); + + } + + public ActorPath actorFor(String path){ + return actorSystem.actorFor(path).path(); + } + + public String getCurrentMemberName(){ + return clusterWrapper.getCurrentMemberName(); + } + } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/InstanceIdentifierUtils.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/InstanceIdentifierUtils.java index fafeba50b5..20268a6744 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/InstanceIdentifierUtils.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/InstanceIdentifierUtils.java @@ -1,7 +1,10 @@ package org.opendaylight.controller.cluster.datastore.utils; import org.opendaylight.controller.cluster.datastore.node.utils.NodeIdentifierFactory; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; @@ -10,33 +13,60 @@ import java.util.List; * @author: syedbahm */ public class InstanceIdentifierUtils { - public static String getParentPath(String currentElementPath) { - String parentPath = ""; - - if (currentElementPath != null) { - String[] parentPaths = currentElementPath.split("/"); - if (parentPaths.length > 2) { - for (int i = 0; i < parentPaths.length - 1; i++) { - if (parentPaths[i].length() > 0) { - parentPath += "/" + parentPaths[i]; - } + + protected static final Logger logger = LoggerFactory + .getLogger(InstanceIdentifierUtils.class); + + public static String getParentPath(String currentElementPath) { + String parentPath = ""; + + if (currentElementPath != null) { + String[] parentPaths = currentElementPath.split("/"); + if (parentPaths.length > 2) { + for (int i = 0; i < parentPaths.length - 1; i++) { + if (parentPaths[i].length() > 0) { + parentPath += "/" + parentPaths[i]; + } + } + } + } + return parentPath; + } + + @Deprecated + public static YangInstanceIdentifier from(String path) { + String[] ids = path.split("/"); + + List pathArguments = + new ArrayList<>(); + for (String nodeId : ids) { + if (!"".equals(nodeId)) { + pathArguments + .add(NodeIdentifierFactory.getArgument(nodeId)); + } } - } + final YangInstanceIdentifier instanceIdentifier = + YangInstanceIdentifier.create(pathArguments); + return instanceIdentifier; } - return parentPath; - } - public static InstanceIdentifier from(String path) { - String[] ids = path.split("/"); + /** + * @deprecated Use {@link org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils} instead + * @param path + * @return + */ + @Deprecated + public static NormalizedNodeMessages.InstanceIdentifier toSerializable(YangInstanceIdentifier path){ + return org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils.toSerializable(path); + } - List pathArguments = new ArrayList<>(); - for (String nodeId : ids) { - if (!"".equals(nodeId)) { - pathArguments.add(NodeIdentifierFactory.getArgument(nodeId)); - } + /** + * @deprecated Use {@link org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils} instead + * @param path + * @return + */ + @Deprecated + public static YangInstanceIdentifier fromSerializable(NormalizedNodeMessages.InstanceIdentifier path){ + return org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils.fromSerializable(path); } - final InstanceIdentifier instanceIdentifier = - new InstanceIdentifier(pathArguments); - return instanceIdentifier; - } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/resources/module-shards.conf b/opendaylight/md-sal/sal-distributed-datastore/src/main/resources/module-shards.conf new file mode 100644 index 0000000000..60dd7754d0 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/resources/module-shards.conf @@ -0,0 +1,25 @@ +module-shards = [ + { + name = "default" + shards = [ + { + name="default", + replicas = [ + "member-1", + ] + } + ] + }, + { + name = "inventory" + shards = [ + { + name="inventory" + replicas = [ + "member-1", + ] + } + ] + } + +] diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/resources/modules.conf b/opendaylight/md-sal/sal-distributed-datastore/src/main/resources/modules.conf new file mode 100644 index 0000000000..05ef33f759 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/resources/modules.conf @@ -0,0 +1,7 @@ +modules = [ + { + name = "inventory" + namespace = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:people" + shard-strategy = "module" + } +] diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/BasicIntegrationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/BasicIntegrationTest.java index 6b9f00e00e..b62a4b36d5 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/BasicIntegrationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/BasicIntegrationTest.java @@ -12,12 +12,10 @@ import akka.actor.ActorPath; import akka.actor.ActorRef; import akka.actor.ActorSelection; import akka.actor.Props; -import akka.actor.Terminated; import akka.testkit.JavaTestKit; import junit.framework.Assert; import org.junit.Test; import org.opendaylight.controller.cluster.datastore.messages.CommitTransaction; -import org.opendaylight.controller.cluster.datastore.messages.CommitTransactionReply; import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction; import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChain; import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChainReply; @@ -59,14 +57,14 @@ public class BasicIntegrationTest extends AbstractActorTest { new UpdateSchemaContext(TestModel.createTestContext()), getRef()); - shard.tell(new CreateTransactionChain(), getRef()); + shard.tell(new CreateTransactionChain().toSerializable(), getRef()); final ActorSelection transactionChain = new ExpectMsg("CreateTransactionChainReply") { protected ActorSelection match(Object in) { - if (in instanceof CreateTransactionChainReply) { + if (in.getClass().equals(CreateTransactionChainReply.SERIALIZABLE_CLASS)) { ActorPath transactionChainPath = - ((CreateTransactionChainReply) in) + CreateTransactionChainReply.fromSerializable(getSystem(),in) .getTransactionChainPath(); return getSystem() .actorSelection(transactionChainPath); @@ -78,7 +76,7 @@ public class BasicIntegrationTest extends AbstractActorTest { Assert.assertNotNull(transactionChain); - transactionChain.tell(new CreateTransaction("txn-1"), getRef()); + transactionChain.tell(new CreateTransaction("txn-1").toSerializable(), getRef()); final ActorSelection transaction = new ExpectMsg("CreateTransactionReply") { @@ -105,7 +103,7 @@ public class BasicIntegrationTest extends AbstractActorTest { Boolean writeDone = new ExpectMsg("WriteDataReply") { protected Boolean match(Object in) { - if (in instanceof WriteDataReply) { + if (in.getClass().equals(WriteDataReply.SERIALIZABLE_CLASS)) { return true; } else { throw noMatch(); @@ -115,14 +113,14 @@ public class BasicIntegrationTest extends AbstractActorTest { Assert.assertTrue(writeDone); - transaction.tell(new ReadyTransaction(), getRef()); + transaction.tell(new ReadyTransaction().toSerializable(), getRef()); final ActorSelection cohort = new ExpectMsg("ReadyTransactionReply") { protected ActorSelection match(Object in) { - if (in instanceof ReadyTransactionReply) { + if (in.getClass().equals(ReadyTransactionReply.SERIALIZABLE_CLASS)) { ActorPath cohortPath = - ((ReadyTransactionReply) in) + ReadyTransactionReply.fromSerializable(getSystem(),in) .getCohortPath(); return getSystem() .actorSelection(cohortPath); @@ -137,12 +135,12 @@ public class BasicIntegrationTest extends AbstractActorTest { // Add a watch on the transaction actor so that we are notified when it dies final ActorRef cohorActorRef = watchActor(cohort); - cohort.tell(new PreCommitTransaction(), getRef()); + cohort.tell(new PreCommitTransaction().toSerializable(), getRef()); Boolean preCommitDone = new ExpectMsg("PreCommitTransactionReply") { protected Boolean match(Object in) { - if (in instanceof PreCommitTransactionReply) { + if (in.getClass().equals(PreCommitTransactionReply.SERIALIZABLE_CLASS)) { return true; } else { throw noMatch(); @@ -152,51 +150,9 @@ public class BasicIntegrationTest extends AbstractActorTest { Assert.assertTrue(preCommitDone); - // FIXME : When we commit on the cohort it "kills" the Transaction. - // This in turn kills the child of Transaction as well. - // The order in which we receive the terminated event for both - // these actors is not fixed which may cause this test to fail - cohort.tell(new CommitTransaction(), getRef()); + cohort.tell(new CommitTransaction().toSerializable(), getRef()); - final Boolean terminatedCohort = - new ExpectMsg("Terminated Cohort") { - protected Boolean match(Object in) { - if (in instanceof Terminated) { - return cohorActorRef.equals(((Terminated) in).actor()); - } else { - throw noMatch(); - } - } - }.get(); // this extracts the received message - - Assert.assertTrue(terminatedCohort); - - - final Boolean terminatedTransaction = - new ExpectMsg("Terminated Transaction") { - protected Boolean match(Object in) { - if (in instanceof Terminated) { - return transactionActorRef.equals(((Terminated) in).actor()); - } else { - throw noMatch(); - } - } - }.get(); // this extracts the received message - - Assert.assertTrue(terminatedTransaction); - - final Boolean commitDone = - new ExpectMsg("CommitTransactionReply") { - protected Boolean match(Object in) { - if (in instanceof CommitTransactionReply) { - return true; - } else { - throw noMatch(); - } - } - }.get(); // this extracts the received message - - Assert.assertTrue(commitDone); + // FIXME : Add assertions that the commit worked and that the cohort and transaction actors were terminated } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ConfigurationImplTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ConfigurationImplTest.java index 85877ce11e..56fd3c568a 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ConfigurationImplTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ConfigurationImplTest.java @@ -1,9 +1,11 @@ package org.opendaylight.controller.cluster.datastore; +import com.typesafe.config.ConfigFactory; import junit.framework.Assert; import org.junit.BeforeClass; import org.junit.Test; +import java.io.File; import java.util.List; import static org.junit.Assert.assertTrue; @@ -30,4 +32,10 @@ public class ConfigurationImplTest { assertTrue(memberShardNames.contains("people-1")); assertTrue(memberShardNames.contains("cars-1")); } + + @Test + public void testReadConfigurationFromFile(){ + File f = new File("./module-shards.conf"); + ConfigFactory.parseFile(f); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxyTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxyTest.java index d5625d277b..8c1cbbbba0 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxyTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxyTest.java @@ -9,62 +9,79 @@ import org.opendaylight.controller.cluster.datastore.messages.DataChanged; import org.opendaylight.controller.cluster.datastore.utils.ActorContext; import org.opendaylight.controller.cluster.datastore.utils.DoNothingActor; import org.opendaylight.controller.cluster.datastore.utils.MessageCollectorActor; +import org.opendaylight.controller.cluster.datastore.utils.MockClusterWrapper; import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; +import org.opendaylight.controller.md.cluster.datastore.model.CompositeModel; +import org.opendaylight.controller.md.cluster.datastore.model.TestModel; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; public class DataChangeListenerProxyTest extends AbstractActorTest { - private static class MockDataChangeEvent implements - AsyncDataChangeEvent> { + private static class MockDataChangedEvent implements AsyncDataChangeEvent> { + Map> createdData = new HashMap(); + Map> updatedData = new HashMap(); + Map> originalData = new HashMap(); - @Override - public Map> getCreatedData() { - throw new UnsupportedOperationException("getCreatedData"); - } - @Override - public Map> getUpdatedData() { - throw new UnsupportedOperationException("getUpdatedData"); - } - @Override public Set getRemovedPaths() { - throw new UnsupportedOperationException("getRemovedPaths"); - } + @Override + public Map> getCreatedData() { + createdData.put(YangInstanceIdentifier.builder().build(), CompositeModel.createDocumentOne(CompositeModel.createTestContext())); + return createdData; + } - @Override - public Map> getOriginalData() { - throw new UnsupportedOperationException("getOriginalData"); - } + @Override + public Map> getUpdatedData() { + updatedData.put(YangInstanceIdentifier.builder().build(), CompositeModel.createTestContainer()); + return updatedData; - @Override public NormalizedNode getOriginalSubtree() { - throw new UnsupportedOperationException("getOriginalSubtree"); - } + } - @Override public NormalizedNode getUpdatedSubtree() { - throw new UnsupportedOperationException("getUpdatedSubtree"); - } + @Override + public Set getRemovedPaths() { + Setids = new HashSet(); + ids.add( CompositeModel.TEST_PATH); + return ids; } - @Test + @Override + public Map> getOriginalData() { + originalData.put(YangInstanceIdentifier.builder().build(), CompositeModel.createFamily()); + return originalData; + } + + @Override public NormalizedNode getOriginalSubtree() { + return CompositeModel.createFamily() ; + } + + @Override public NormalizedNode getUpdatedSubtree() { + return CompositeModel.createTestContainer(); + } + } + + + @Test public void testOnDataChanged() throws Exception { final Props props = Props.create(MessageCollectorActor.class); final ActorRef actorRef = getSystem().actorOf(props); DataChangeListenerProxy dataChangeListenerProxy = - new DataChangeListenerProxy( + new DataChangeListenerProxy(TestModel.createTestContext(), getSystem().actorSelection(actorRef.path())); - dataChangeListenerProxy.onDataChanged(new MockDataChangeEvent()); + dataChangeListenerProxy.onDataChanged(new MockDataChangedEvent()); //Check if it was received by the remote actor ActorContext - testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)), new MockConfiguration()); + testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)), new MockClusterWrapper(), new MockConfiguration()); Object messages = testContext .executeLocalOperation(actorRef, "messages", ActorContext.ASK_DURATION); @@ -77,7 +94,7 @@ public class DataChangeListenerProxyTest extends AbstractActorTest { Assert.assertEquals(1, listMessages.size()); - Assert.assertTrue(listMessages.get(0) instanceof DataChanged); + Assert.assertTrue(listMessages.get(0).getClass().equals(DataChanged.SERIALIZABLE_CLASS)); } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxyTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxyTest.java index 57609a98e7..c99a7e8c8c 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxyTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxyTest.java @@ -8,10 +8,11 @@ import org.opendaylight.controller.cluster.datastore.messages.CloseDataChangeLis import org.opendaylight.controller.cluster.datastore.utils.ActorContext; import org.opendaylight.controller.cluster.datastore.utils.DoNothingActor; import org.opendaylight.controller.cluster.datastore.utils.MessageCollectorActor; +import org.opendaylight.controller.cluster.datastore.utils.MockClusterWrapper; import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import java.util.List; @@ -21,10 +22,10 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest{ private ActorRef dataChangeListenerActor = getSystem().actorOf(Props.create(DoNothingActor.class)); private static class MockDataChangeListener implements - AsyncDataChangeListener> { + AsyncDataChangeListener> { @Override public void onDataChanged( - AsyncDataChangeEvent> change) { + AsyncDataChangeEvent> change) { throw new UnsupportedOperationException("onDataChanged"); } } @@ -59,7 +60,7 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest{ //Check if it was received by the remote actor ActorContext - testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)), new MockConfiguration()); + testContext = new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)),new MockClusterWrapper(), new MockConfiguration()); Object messages = testContext .executeLocalOperation(actorRef, "messages", ActorContext.ASK_DURATION); @@ -72,6 +73,6 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest{ Assert.assertEquals(1, listMessages.size()); - Assert.assertTrue(listMessages.get(0) instanceof CloseDataChangeListenerRegistration); + Assert.assertTrue(listMessages.get(0).getClass().equals(CloseDataChangeListenerRegistration.SERIALIZABLE_CLASS)); } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationTest.java index 23302b504e..8413bac3a7 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationTest.java @@ -13,7 +13,7 @@ import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener; import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import static org.junit.Assert.assertEquals; @@ -39,12 +39,12 @@ public class DataChangeListenerRegistrationTest extends AbstractActorTest { new Within(duration("1 seconds")) { protected void run() { - subject.tell(new CloseDataChangeListenerRegistration(), getRef()); + subject.tell(new CloseDataChangeListenerRegistration().toSerializable(), getRef()); final String out = new ExpectMsg("match hint") { // do not put code outside this method, will run afterwards protected String match(Object in) { - if (in instanceof CloseDataChangeListenerRegistrationReply) { + if (in.getClass().equals(CloseDataChangeListenerRegistrationReply.SERIALIZABLE_CLASS)) { return "match"; } else { throw noMatch(); @@ -62,10 +62,10 @@ public class DataChangeListenerRegistrationTest extends AbstractActorTest { }}; } - private AsyncDataChangeListener> noOpDataChangeListener(){ - return new AsyncDataChangeListener>() { + private AsyncDataChangeListener> noOpDataChangeListener(){ + return new AsyncDataChangeListener>() { @Override - public void onDataChanged(AsyncDataChangeEvent> change) { + public void onDataChanged(AsyncDataChangeEvent> change) { } }; diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerTest.java index d64859a91c..fd61032220 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerTest.java @@ -6,66 +6,90 @@ import akka.testkit.JavaTestKit; import org.junit.Test; import org.opendaylight.controller.cluster.datastore.messages.DataChanged; import org.opendaylight.controller.cluster.datastore.messages.DataChangedReply; +import org.opendaylight.controller.md.cluster.datastore.model.CompositeModel; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; +import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Set; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; public class DataChangeListenerTest extends AbstractActorTest { - private static class MockDataChangedEvent implements AsyncDataChangeEvent> { + private static class MockDataChangedEvent implements AsyncDataChangeEvent> { + Map> createdData = new HashMap(); + Map> updatedData = new HashMap(); + Map> originalData = new HashMap(); + + @Override - public Map> getCreatedData() { - throw new UnsupportedOperationException("getCreatedData"); + public Map> getCreatedData() { + createdData.put(CompositeModel.FAMILY_PATH, CompositeModel.createFamily()); + return createdData; } @Override - public Map> getUpdatedData() { - throw new UnsupportedOperationException("getUpdatedData"); + public Map> getUpdatedData() { + updatedData.put(CompositeModel.FAMILY_PATH, CompositeModel.createFamily()); + return updatedData; + } - @Override public Set getRemovedPaths() { - throw new UnsupportedOperationException("getRemovedPaths"); + @Override + public Set getRemovedPaths() { + Setids = new HashSet(); + ids.add( CompositeModel.TEST_PATH); + return ids; } @Override - public Map> getOriginalData() { - throw new UnsupportedOperationException("getOriginalData"); + public Map> getOriginalData() { + originalData.put(CompositeModel.FAMILY_PATH, CompositeModel.createFamily()); + return originalData; } @Override public NormalizedNode getOriginalSubtree() { - throw new UnsupportedOperationException("getOriginalSubtree"); + + + return originalData.put(CompositeModel.FAMILY_PATH, CompositeModel.createFamily()); } @Override public NormalizedNode getUpdatedSubtree() { - throw new UnsupportedOperationException("getUpdatedSubtree"); + + //fixme: need to have some valid data here + return originalData.put(CompositeModel.FAMILY_PATH, CompositeModel.createFamily()); } } - private class MockDataChangeListener implements AsyncDataChangeListener> { + private class MockDataChangeListener implements AsyncDataChangeListener> { private boolean gotIt = false; + private AsyncDataChangeEvent> change; @Override public void onDataChanged( - AsyncDataChangeEvent> change) { - gotIt = true; + AsyncDataChangeEvent> change) { + gotIt = true;this.change=change; } public boolean gotIt() { return gotIt; } + public AsyncDataChangeEvent> getChange(){ + return change; + } } @Test public void testDataChanged(){ new JavaTestKit(getSystem()) {{ final MockDataChangeListener listener = new MockDataChangeListener(); - final Props props = DataChangeListener.props(listener); + final Props props = DataChangeListener.props(CompositeModel.createTestContext(),listener,CompositeModel.FAMILY_PATH ); final ActorRef subject = getSystem().actorOf(props, "testDataChanged"); @@ -73,15 +97,14 @@ public class DataChangeListenerTest extends AbstractActorTest { protected void run() { subject.tell( - new DataChanged(new MockDataChangedEvent()), + new DataChanged(CompositeModel.createTestContext(),new MockDataChangedEvent()).toSerializable(), getRef()); final Boolean out = new ExpectMsg("dataChanged") { // do not put code outside this method, will run afterwards protected Boolean match(Object in) { - if (in instanceof DataChangedReply) { - DataChangedReply reply = - (DataChangedReply) in; + if (in.getClass().equals(DataChangedReply.SERIALIZABLE_CLASS)) { + return true; } else { throw noMatch(); @@ -91,6 +114,7 @@ public class DataChangeListenerTest extends AbstractActorTest { assertTrue(out); assertTrue(listener.gotIt()); + assertNotNull(listener.getChange().getCreatedData()); // Will wait for the rest of the 3 seconds expectNoMsg(); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java index 914f0dbb29..23a1ed4931 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreTest.java @@ -3,7 +3,6 @@ package org.opendaylight.controller.cluster.datastore; import akka.actor.ActorRef; import akka.actor.Props; import junit.framework.Assert; - import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListenerReply; import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory; import org.opendaylight.controller.cluster.datastore.utils.DoNothingActor; @@ -19,7 +18,7 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransactio import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain; import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; public class DistributedDataStoreTest extends AbstractActorTest{ @@ -58,9 +57,9 @@ public class DistributedDataStoreTest extends AbstractActorTest{ public void testRegisterChangeListener() throws Exception { mockActorContext.setExecuteShardOperationResponse(new RegisterChangeListenerReply(doNothingActorRef.path()).toSerializable()); ListenerRegistration registration = - distributedDataStore.registerChangeListener(TestModel.TEST_PATH, new AsyncDataChangeListener>() { + distributedDataStore.registerChangeListener(TestModel.TEST_PATH, new AsyncDataChangeListener>() { @Override - public void onDataChanged(AsyncDataChangeEvent> change) { + public void onDataChanged(AsyncDataChangeEvent> change) { throw new UnsupportedOperationException("onDataChanged"); } }, AsyncDataBroker.DataChangeScope.BASE); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java index a2f19d8b2b..87d257a3f2 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java @@ -4,6 +4,7 @@ import akka.actor.ActorSystem; import akka.actor.Props; import akka.testkit.JavaTestKit; import akka.testkit.TestActorRef; +import junit.framework.Assert; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -18,12 +19,12 @@ public class ShardManagerTest { private static ActorSystem system; @BeforeClass - public static void setUp(){ + public static void setUp() { system = ActorSystem.create("test"); } @AfterClass - public static void tearDown(){ + public static void tearDown() { JavaTestKit.shutdownActorSystem(system); system = null; } @@ -32,15 +33,19 @@ public class ShardManagerTest { public void testOnReceiveFindPrimaryForNonExistentShard() throws Exception { new JavaTestKit(system) {{ - final Props props = ShardManager.props("config", new MockClusterWrapper(), new MockConfiguration()); - final TestActorRef subject = TestActorRef.create(system, props); + final Props props = ShardManager + .props("config", new MockClusterWrapper(), + new MockConfiguration()); + final TestActorRef subject = + TestActorRef.create(system, props); new Within(duration("1 seconds")) { protected void run() { - subject.tell(new FindPrimary("inventory"), getRef()); + subject.tell(new FindPrimary("inventory").toSerializable(), getRef()); - expectMsgEquals(Duration.Zero(), new PrimaryNotFound("inventory")); + expectMsgEquals(Duration.Zero(), + new PrimaryNotFound("inventory").toSerializable()); // Will wait for the rest of the 3 seconds expectNoMsg(); @@ -49,24 +54,99 @@ public class ShardManagerTest { }}; } - @Test - public void testOnReceiveFindPrimaryForExistentShard() throws Exception { + @Test + public void testOnReceiveFindPrimaryForExistentShard() throws Exception { + + new JavaTestKit(system) {{ + final Props props = ShardManager + .props("config", new MockClusterWrapper(), + new MockConfiguration()); + final TestActorRef subject = + TestActorRef.create(system, props); + + // the run() method needs to finish within 3 seconds + new Within(duration("1 seconds")) { + protected void run() { + + subject.tell(new FindPrimary(Shard.DEFAULT_NAME).toSerializable(), getRef()); + + expectMsgClass(PrimaryFound.SERIALIZABLE_CLASS); + + expectNoMsg(); + } + }; + }}; + } + + @Test + public void testOnReceiveMemberUp() throws Exception { + + new JavaTestKit(system) {{ + final Props props = ShardManager + .props("config", new MockClusterWrapper(), + new MockConfiguration()); + final TestActorRef subject = + TestActorRef.create(system, props); - new JavaTestKit(system) {{ - final Props props = ShardManager.props("config", new MockClusterWrapper(), new MockConfiguration()); - final TestActorRef subject = TestActorRef.create(system, props); + // the run() method needs to finish within 3 seconds + new Within(duration("1 seconds")) { + protected void run() { + + MockClusterWrapper.sendMemberUp(subject, "member-2", getRef().path().toString()); - // the run() method needs to finish within 3 seconds - new Within(duration("1 seconds")) { - protected void run() { + subject.tell(new FindPrimary("astronauts").toSerializable(), getRef()); - subject.tell(new FindPrimary(Shard.DEFAULT_NAME), getRef()); + final String out = new ExpectMsg("primary found") { + // do not put code outside this method, will run afterwards + protected String match(Object in) { + if (in.getClass().equals(PrimaryFound.SERIALIZABLE_CLASS)) { + PrimaryFound f = PrimaryFound.fromSerializable(in); + return f.getPrimaryPath(); + } else { + throw noMatch(); + } + } + }.get(); // this extracts the received message + + Assert.assertTrue(out, out.contains("member-2-shard-astronauts-config")); + + expectNoMsg(); + } + }; + }}; + } + + @Test + public void testOnReceiveMemberDown() throws Exception { + + new JavaTestKit(system) {{ + final Props props = ShardManager + .props("config", new MockClusterWrapper(), + new MockConfiguration()); + final TestActorRef subject = + TestActorRef.create(system, props); + + // the run() method needs to finish within 3 seconds + new Within(duration("1 seconds")) { + protected void run() { + + MockClusterWrapper.sendMemberUp(subject, "member-2", getRef().path().toString()); + + subject.tell(new FindPrimary("astronauts").toSerializable(), getRef()); + + expectMsgClass(PrimaryFound.SERIALIZABLE_CLASS); + + MockClusterWrapper.sendMemberRemoved(subject, "member-2", getRef().path().toString()); + + subject.tell(new FindPrimary("astronauts").toSerializable(), getRef()); + + expectMsgClass(PrimaryNotFound.SERIALIZABLE_CLASS); + + expectNoMsg(); + } + }; + }}; + } - expectMsgClass(PrimaryFound.class); - expectNoMsg(); - } - }; - }}; - } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java index 2568b0f555..f20cd8c3d7 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java @@ -7,16 +7,16 @@ import org.junit.Test; import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction; import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChain; import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChainReply; -import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper; -import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply; import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListener; import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListenerReply; import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext; +import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper; import org.opendaylight.controller.md.cluster.datastore.model.TestModel; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import static org.junit.Assert.assertEquals; @@ -33,14 +33,14 @@ public class ShardTest extends AbstractActorTest { new Within(duration("1 seconds")) { protected void run() { - subject.tell(new CreateTransactionChain(), getRef()); + subject.tell(new CreateTransactionChain().toSerializable(), getRef()); final String out = new ExpectMsg("match hint") { // do not put code outside this method, will run afterwards protected String match(Object in) { - if (in instanceof CreateTransactionChainReply) { + if (in.getClass().equals(CreateTransactionChainReply.SERIALIZABLE_CLASS)){ CreateTransactionChainReply reply = - (CreateTransactionChainReply) in; + CreateTransactionChainReply.fromSerializable(getSystem(),in); return reply.getTransactionChainPath() .toString(); } else { @@ -118,7 +118,7 @@ public class ShardTest extends AbstractActorTest { new UpdateSchemaContext(TestModel.createTestContext()), getRef()); - subject.tell(new CreateTransaction("txn-1"), + subject.tell(new CreateTransaction("txn-1").toSerializable(), getRef()); final String out = new ExpectMsg("match hint") { @@ -148,11 +148,11 @@ public class ShardTest extends AbstractActorTest { - private AsyncDataChangeListener> noOpDataChangeListener() { - return new AsyncDataChangeListener>() { + private AsyncDataChangeListener> noOpDataChangeListener() { + return new AsyncDataChangeListener>() { @Override public void onDataChanged( - AsyncDataChangeEvent> change) { + AsyncDataChangeEvent> change) { } }; diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionChainTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionChainTest.java index 1e681795ca..6330ad8acc 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionChainTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionChainTest.java @@ -9,7 +9,7 @@ import org.junit.Test; import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChain; import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChainReply; import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction; -import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply; +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; @@ -30,27 +30,27 @@ public class ShardTransactionChainTest extends AbstractActorTest { final Props props = ShardTransactionChain.props(store.createTransactionChain(), TestModel.createTestContext()); final ActorRef subject = getSystem().actorOf(props, "testCreateTransaction"); - new Within(duration("1 seconds")) { + new Within(duration("1 seconds")) { protected void run() { - subject.tell(new CreateTransaction("txn-1"), getRef()); + subject.tell(new CreateTransaction("txn-1").toSerializable(), getRef()); final String out = new ExpectMsg("match hint") { // do not put code outside this method, will run afterwards protected String match(Object in) { - if (in instanceof CreateTransactionReply) { - return ((CreateTransactionReply) in).getTransactionActorPath().toString(); - } else { + if (in.getClass().equals(CreateTransactionReply.SERIALIZABLE_CLASS)) { + return CreateTransactionReply.fromSerializable(in).getTransactionPath(); + }else{ throw noMatch(); } } }.get(); // this extracts the received message - assertEquals("Unexpected transaction path " + out, - "akka://test/user/testCreateTransaction/shard-txn-1", - out); + assertEquals("Unexpected transaction path " + out, + "akka://test/user/testCreateTransaction/shard-txn-1", + out); - // Will wait for the rest of the 3 seconds + // Will wait for the rest of the 3 seconds expectNoMsg(); } @@ -68,12 +68,12 @@ public class ShardTransactionChainTest extends AbstractActorTest { new Within(duration("1 seconds")) { protected void run() { - subject.tell(new CloseTransactionChain(), getRef()); + subject.tell(new CloseTransactionChain().toSerializable(), getRef()); final String out = new ExpectMsg("match hint") { // do not put code outside this method, will run afterwards protected String match(Object in) { - if (in instanceof CloseTransactionChainReply) { + if (in.getClass().equals(CloseTransactionChainReply.SERIALIZABLE_CLASS)) { return "match"; } else { throw noMatch(); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java index 68cee1fcac..4d7c61a197 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java @@ -26,7 +26,7 @@ import org.opendaylight.controller.cluster.datastore.modification.Modification; import org.opendaylight.controller.cluster.datastore.modification.WriteModification; import org.opendaylight.controller.md.cluster.datastore.model.TestModel; import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; import org.opendaylight.yangtools.yang.model.api.SchemaContext; @@ -58,14 +58,14 @@ public class ShardTransactionTest extends AbstractActorTest { protected void run() { subject.tell( - new ReadData(InstanceIdentifier.builder().build()).toSerializable(), + new ReadData(YangInstanceIdentifier.builder().build()).toSerializable(), getRef()); final String out = new ExpectMsg("match hint") { // do not put code outside this method, will run afterwards protected String match(Object in) { if (in.getClass().equals(ReadDataReply.SERIALIZABLE_CLASS)) { - if (ReadDataReply.fromSerializable(testSchemaContext,InstanceIdentifier.builder().build(), in) + if (ReadDataReply.fromSerializable(testSchemaContext,YangInstanceIdentifier.builder().build(), in) .getNormalizedNode()!= null) { return "match"; } @@ -179,7 +179,7 @@ public class ShardTransactionTest extends AbstractActorTest { final String out = new ExpectMsg("match hint") { // do not put code outside this method, will run afterwards protected String match(Object in) { - if (in instanceof WriteDataReply) { + if (in.getClass().equals(WriteDataReply.SERIALIZABLE_CLASS)) { return "match"; } else { throw noMatch(); @@ -217,7 +217,7 @@ public class ShardTransactionTest extends AbstractActorTest { final String out = new ExpectMsg(duration("500 milliseconds"), "match hint") { // do not put code outside this method, will run afterwards protected String match(Object in) { - if (in instanceof MergeDataReply) { + if (in.getClass().equals(MergeDataReply.SERIALIZABLE_CLASS)) { return "match"; } else { throw noMatch(); @@ -254,7 +254,7 @@ public class ShardTransactionTest extends AbstractActorTest { final String out = new ExpectMsg("match hint") { // do not put code outside this method, will run afterwards protected String match(Object in) { - if (in instanceof DeleteDataReply) { + if (in.getClass().equals(DeleteDataReply.SERIALIZABLE_CLASS)) { return "match"; } else { throw noMatch(); @@ -286,12 +286,12 @@ public class ShardTransactionTest extends AbstractActorTest { new Within(duration("1 seconds")) { protected void run() { - subject.tell(new ReadyTransaction(), getRef()); + subject.tell(new ReadyTransaction().toSerializable(), getRef()); final String out = new ExpectMsg("match hint") { // do not put code outside this method, will run afterwards protected String match(Object in) { - if (in instanceof ReadyTransactionReply) { + if (in.getClass().equals(ReadyTransactionReply.SERIALIZABLE_CLASS)) { return "match"; } else { throw noMatch(); @@ -324,12 +324,12 @@ public class ShardTransactionTest extends AbstractActorTest { new Within(duration("2 seconds")) { protected void run() { - subject.tell(new CloseTransaction(), getRef()); + subject.tell(new CloseTransaction().toSerializable(), getRef()); final String out = new ExpectMsg("match hint") { // do not put code outside this method, will run afterwards protected String match(Object in) { - if (in instanceof CloseTransactionReply) { + if (in.getClass().equals(CloseTransactionReply.SERIALIZABLE_CLASS)) { return "match"; } else { throw noMatch(); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java index 8ff785c879..992518e100 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxyTest.java @@ -41,7 +41,7 @@ public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest { @Test public void testCanCommit() throws Exception { - actorContext.setExecuteRemoteOperationResponse(new CanCommitTransactionReply(true)); + actorContext.setExecuteRemoteOperationResponse(new CanCommitTransactionReply(true).toSerializable()); ListenableFuture future = proxy.canCommit(); @@ -51,7 +51,7 @@ public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest { @Test public void testPreCommit() throws Exception { - actorContext.setExecuteRemoteOperationResponse(new PreCommitTransactionReply()); + actorContext.setExecuteRemoteOperationResponse(new PreCommitTransactionReply().toSerializable()); ListenableFuture future = proxy.preCommit(); @@ -61,7 +61,7 @@ public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest { @Test public void testAbort() throws Exception { - actorContext.setExecuteRemoteOperationResponse(new AbortTransactionReply()); + actorContext.setExecuteRemoteOperationResponse(new AbortTransactionReply().toSerializable()); ListenableFuture future = proxy.abort(); @@ -71,7 +71,7 @@ public class ThreePhaseCommitCohortProxyTest extends AbstractActorTest { @Test public void testCommit() throws Exception { - actorContext.setExecuteRemoteOperationResponse(new CommitTransactionReply()); + actorContext.setExecuteRemoteOperationResponse(new CommitTransactionReply().toSerializable()); ListenableFuture future = proxy.commit(); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionProxyTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionProxyTest.java index 62398ad502..f654e3aced 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionProxyTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionProxyTest.java @@ -5,17 +5,21 @@ import akka.actor.Props; import com.google.common.base.Optional; import com.google.common.util.concurrent.ListenableFuture; import junit.framework.Assert; +import org.junit.Before; import org.junit.Test; import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction; import org.opendaylight.controller.cluster.datastore.messages.DeleteData; import org.opendaylight.controller.cluster.datastore.messages.MergeData; +import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound; import org.opendaylight.controller.cluster.datastore.messages.ReadDataReply; import org.opendaylight.controller.cluster.datastore.messages.ReadyTransactionReply; import org.opendaylight.controller.cluster.datastore.messages.WriteData; +import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory; import org.opendaylight.controller.cluster.datastore.utils.ActorContext; import org.opendaylight.controller.cluster.datastore.utils.DoNothingActor; import org.opendaylight.controller.cluster.datastore.utils.MessageCollectorActor; import org.opendaylight.controller.cluster.datastore.utils.MockActorContext; +import org.opendaylight.controller.cluster.datastore.utils.MockClusterWrapper; import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration; import org.opendaylight.controller.md.cluster.datastore.model.TestModel; import org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransactionReply; @@ -29,18 +33,26 @@ import java.util.concurrent.Executors; public class TransactionProxyTest extends AbstractActorTest { + private final Configuration configuration = new MockConfiguration(); + private final ActorContext testContext = - new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)), new MockConfiguration()); + new ActorContext(getSystem(), getSystem().actorOf(Props.create(DoNothingActor.class)), new MockClusterWrapper(), configuration ); private ExecutorService transactionExecutor = Executors.newSingleThreadExecutor(); + @Before + public void setUp(){ + ShardStrategyFactory.setConfiguration(configuration); + } + @Test public void testRead() throws Exception { final Props props = Props.create(DoNothingActor.class); final ActorRef actorRef = getSystem().actorOf(props); final MockActorContext actorContext = new MockActorContext(this.getSystem()); + actorContext.setExecuteLocalOperationResponse(createPrimaryFound(actorRef)); actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef)); actorContext.setExecuteRemoteOperationResponse("message"); @@ -73,6 +85,7 @@ public class TransactionProxyTest extends AbstractActorTest { final ActorRef actorRef = getSystem().actorOf(props); final MockActorContext actorContext = new MockActorContext(this.getSystem()); + actorContext.setExecuteLocalOperationResponse(createPrimaryFound(actorRef)); actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef)); actorContext.setExecuteRemoteOperationResponse("message"); @@ -104,6 +117,7 @@ public class TransactionProxyTest extends AbstractActorTest { final ActorRef actorRef = getSystem().actorOf(props); final MockActorContext actorContext = new MockActorContext(this.getSystem()); + actorContext.setExecuteLocalOperationResponse(createPrimaryFound(actorRef)); actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef)); actorContext.setExecuteRemoteOperationResponse("message"); @@ -129,12 +143,17 @@ public class TransactionProxyTest extends AbstractActorTest { Assert.assertEquals(WriteData.SERIALIZABLE_CLASS, listMessages.get(0).getClass()); } + private Object createPrimaryFound(ActorRef actorRef) { + return new PrimaryFound(actorRef.path().toString()).toSerializable(); + } + @Test public void testMerge() throws Exception { final Props props = Props.create(MessageCollectorActor.class); final ActorRef actorRef = getSystem().actorOf(props); final MockActorContext actorContext = new MockActorContext(this.getSystem()); + actorContext.setExecuteLocalOperationResponse(createPrimaryFound(actorRef)); actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef)); actorContext.setExecuteRemoteOperationResponse("message"); @@ -166,6 +185,7 @@ public class TransactionProxyTest extends AbstractActorTest { final ActorRef actorRef = getSystem().actorOf(props); final MockActorContext actorContext = new MockActorContext(this.getSystem()); + actorContext.setExecuteLocalOperationResponse(createPrimaryFound(actorRef)); actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef)); actorContext.setExecuteRemoteOperationResponse("message"); @@ -196,8 +216,9 @@ public class TransactionProxyTest extends AbstractActorTest { final ActorRef doNothingActorRef = getSystem().actorOf(props); final MockActorContext actorContext = new MockActorContext(this.getSystem()); + actorContext.setExecuteLocalOperationResponse(createPrimaryFound(doNothingActorRef)); actorContext.setExecuteShardOperationResponse(createTransactionReply(doNothingActorRef)); - actorContext.setExecuteRemoteOperationResponse(new ReadyTransactionReply(doNothingActorRef.path())); + actorContext.setExecuteRemoteOperationResponse(new ReadyTransactionReply(doNothingActorRef.path()).toSerializable()); TransactionProxy transactionProxy = new TransactionProxy(actorContext, @@ -237,6 +258,7 @@ public class TransactionProxyTest extends AbstractActorTest { final ActorRef actorRef = getSystem().actorOf(props); final MockActorContext actorContext = new MockActorContext(this.getSystem()); + actorContext.setExecuteLocalOperationResponse(createPrimaryFound(actorRef)); actorContext.setExecuteShardOperationResponse(createTransactionReply(actorRef)); actorContext.setExecuteRemoteOperationResponse("message"); @@ -260,7 +282,7 @@ public class TransactionProxyTest extends AbstractActorTest { Assert.assertEquals(1, listMessages.size()); - Assert.assertTrue(listMessages.get(0) instanceof CloseTransaction); + Assert.assertTrue(listMessages.get(0).getClass().equals(CloseTransaction.SERIALIZABLE_CLASS)); } private CreateTransactionReply createTransactionReply(ActorRef actorRef){ diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStatsTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStatsTest.java new file mode 100644 index 0000000000..f7c467652d --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStatsTest.java @@ -0,0 +1,55 @@ +package org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.opendaylight.controller.cluster.datastore.jmx.mbeans.AbstractBaseMBean; + +import javax.management.MBeanServer; +import javax.management.ObjectName; + +public class ShardStatsTest { + private MBeanServer mbeanServer; + private ShardStats shardStats; + private ObjectName testMBeanName; + + @Before + public void setUp() throws Exception { + + shardStats = new ShardStats("shard-1"); + shardStats.registerMBean(); + mbeanServer= shardStats.getMBeanServer(); + String objectName = AbstractBaseMBean.BASE_JMX_PREFIX + "type="+shardStats.getMBeanType()+",Category="+ + shardStats.getMBeanCategory() + ",name="+ + shardStats.getMBeanName(); + testMBeanName = new ObjectName(objectName); + } + + @After + public void tearDown() throws Exception { + shardStats.unregisterMBean(); + } + + @Test + public void testGetShardName() throws Exception { + + Object attribute = mbeanServer.getAttribute(testMBeanName,"ShardName"); + Assert.assertEquals((String) attribute, "shard-1"); + + } + + @Test + public void testGetCommittedTransactionsCount() throws Exception { + //let us increment some transactions count and then check + shardStats.incrementCommittedTransactionCount(); + shardStats.incrementCommittedTransactionCount(); + shardStats.incrementCommittedTransactionCount(); + + //now let us get from MBeanServer what is the transaction count. + Object attribute = mbeanServer.getAttribute(testMBeanName,"CommittedTransactionsCount"); + Assert.assertEquals((Long) attribute, (Long)3L); + + + } +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModificationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModificationTest.java index efaca5d4f6..d9c550a6db 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModificationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModificationTest.java @@ -17,7 +17,7 @@ import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore; import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction; import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort; import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; public abstract class AbstractModificationTest { @@ -36,7 +36,7 @@ public abstract class AbstractModificationTest { cohort.commit(); } - protected Optional> readData(InstanceIdentifier path) throws Exception{ + protected Optional> readData(YangInstanceIdentifier path) throws Exception{ DOMStoreReadTransaction transaction = store.newReadOnlyTransaction(); ListenableFuture>> future = transaction.read(path); return future.get(); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactoryTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactoryTest.java index 0b348403b9..ab74ba811a 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactoryTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactoryTest.java @@ -7,7 +7,7 @@ import org.junit.rules.ExpectedException; import org.opendaylight.controller.cluster.datastore.ConfigurationImpl; import org.opendaylight.controller.md.cluster.datastore.model.CarsModel; import org.opendaylight.controller.md.cluster.datastore.model.TestModel; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertTrue; @@ -32,7 +32,8 @@ public class ShardStrategyFactoryTest { @Test public void testGetStrategyForKnownModuleName() { ShardStrategy strategy = - ShardStrategyFactory.getStrategy(InstanceIdentifier.of(CarsModel.BASE_QNAME)); + ShardStrategyFactory.getStrategy( + YangInstanceIdentifier.of(CarsModel.BASE_QNAME)); assertTrue(strategy instanceof ModuleShardStrategy); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java new file mode 100644 index 0000000000..3dd0214e9b --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/ActorContextTest.java @@ -0,0 +1,47 @@ +package org.opendaylight.controller.cluster.datastore.utils; + +import akka.actor.ActorRef; +import akka.actor.ActorSystem; +import org.junit.Test; +import org.opendaylight.controller.cluster.datastore.AbstractActorTest; +import org.opendaylight.controller.cluster.datastore.ClusterWrapper; +import org.opendaylight.controller.cluster.datastore.Configuration; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; + +public class ActorContextTest extends AbstractActorTest{ + @Test + public void testResolvePathForRemoteActor(){ + ActorContext actorContext = + new ActorContext(mock(ActorSystem.class), mock(ActorRef.class),mock( + ClusterWrapper.class), + mock(Configuration.class)); + + String actual = actorContext.resolvePath( + "akka.tcp://system@127.0.0.1:2550/user/shardmanager/shard", + "akka://system/user/shardmanager/shard/transaction"); + + String expected = "akka.tcp://system@127.0.0.1:2550/user/shardmanager/shard/transaction"; + + assertEquals(expected, actual); + } + + @Test + public void testResolvePathForLocalActor(){ + ActorContext actorContext = + new ActorContext(getSystem(), mock(ActorRef.class), mock(ClusterWrapper.class), + mock(Configuration.class)); + + String actual = actorContext.resolvePath( + "akka://system/user/shardmanager/shard", + "akka://system/user/shardmanager/shard/transaction"); + + String expected = "akka://system/user/shardmanager/shard/transaction"; + + assertEquals(expected, actual); + + System.out.println(actorContext + .actorFor("akka://system/user/shardmanager/shard/transaction")); + } +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockActorContext.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockActorContext.java index 12f80fb906..1d1e661488 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockActorContext.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockActorContext.java @@ -21,11 +21,11 @@ public class MockActorContext extends ActorContext { private Object executeLocalOperationResponse; public MockActorContext(ActorSystem actorSystem) { - super(actorSystem, null, new MockConfiguration()); + super(actorSystem, null, new MockClusterWrapper(), new MockConfiguration()); } public MockActorContext(ActorSystem actorSystem, ActorRef shardManager) { - super(actorSystem, shardManager, new MockConfiguration()); + super(actorSystem, shardManager, new MockClusterWrapper(), new MockConfiguration()); } @@ -55,4 +55,9 @@ public class MockActorContext extends ActorContext { Object executeLocalOperationResponse) { this.executeLocalOperationResponse = executeLocalOperationResponse; } + + @Override public Object executeLocalOperation(ActorRef actor, + Object message, FiniteDuration duration) { + return this.executeLocalOperationResponse; + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockClusterWrapper.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockClusterWrapper.java index 7749eaa837..803aa03b7c 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockClusterWrapper.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockClusterWrapper.java @@ -9,15 +9,61 @@ package org.opendaylight.controller.cluster.datastore.utils; import akka.actor.ActorRef; +import akka.actor.AddressFromURIString; +import akka.cluster.ClusterEvent; +import akka.cluster.MemberStatus; +import akka.cluster.UniqueAddress; import org.opendaylight.controller.cluster.datastore.ClusterWrapper; +import scala.collection.JavaConversions; + +import java.util.HashSet; +import java.util.Set; public class MockClusterWrapper implements ClusterWrapper{ @Override public void subscribeToMemberEvents(ActorRef actorRef) { - throw new UnsupportedOperationException("subscribeToMemberEvents"); } @Override public String getCurrentMemberName() { return "member-1"; } + + public static void sendMemberUp(ActorRef to, String memberName, String address){ + to.tell(createMemberUp(memberName, address), null); + } + + public static void sendMemberRemoved(ActorRef to, String memberName, String address){ + to.tell(createMemberRemoved(memberName, address), null); + } + + private static ClusterEvent.MemberRemoved createMemberRemoved(String memberName, String address) { + akka.cluster.UniqueAddress uniqueAddress = new UniqueAddress( + AddressFromURIString.parse(address), 55); + + Set roles = new HashSet<>(); + + roles.add(memberName); + + akka.cluster.Member member = new akka.cluster.Member(uniqueAddress, 1, MemberStatus + .removed(), + JavaConversions.asScalaSet(roles).toSet()); + + return new ClusterEvent.MemberRemoved(member, MemberStatus.up()); + + } + + + private static ClusterEvent.MemberUp createMemberUp(String memberName, String address) { + akka.cluster.UniqueAddress uniqueAddress = new UniqueAddress( + AddressFromURIString.parse(address), 55); + + Set roles = new HashSet<>(); + + roles.add(memberName); + + akka.cluster.Member member = new akka.cluster.Member(uniqueAddress, 1, MemberStatus.up(), + JavaConversions.asScalaSet(roles).toSet()); + + return new ClusterEvent.MemberUp(member); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockConfiguration.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockConfiguration.java index 2597dda04c..8d49c6fac3 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockConfiguration.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockConfiguration.java @@ -12,16 +12,14 @@ import com.google.common.base.Optional; import org.opendaylight.controller.cluster.datastore.Configuration; import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy; -import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; public class MockConfiguration implements Configuration{ @Override public List getMemberShardNames(String memberName) { - List shardNames = new ArrayList<>(); - shardNames.add("default"); - return shardNames; + return Arrays.asList("default"); } @Override public Optional getModuleNameFromNameSpace( @@ -40,8 +38,12 @@ public class MockConfiguration implements Configuration{ } @Override public List getMembersFromShardName(String shardName) { - List shardNames = new ArrayList<>(); - shardNames.add("member-1"); - return shardNames; + if("default".equals(shardName)) { + return Arrays.asList("member-1", "member-2"); + } else if("astronauts".equals(shardName)){ + return Arrays.asList("member-2", "member-3"); + } + + return Collections.EMPTY_LIST; } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/TestUtils.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/TestUtils.java index 5f361b2005..939096e7f3 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/TestUtils.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/TestUtils.java @@ -19,7 +19,7 @@ public class TestUtils { public static void assertFirstSentMessage(ActorSystem actorSystem, ActorRef actorRef, Class clazz){ ActorContext testContext = new ActorContext(actorSystem, actorSystem.actorOf( - Props.create(DoNothingActor.class)), new MockConfiguration()); + Props.create(DoNothingActor.class)), new MockClusterWrapper(), new MockConfiguration()); Object messages = testContext .executeLocalOperation(actorRef, "messages", ActorContext.ASK_DURATION); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CarsModel.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CarsModel.java index 675be8e202..57df20172d 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CarsModel.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CarsModel.java @@ -9,7 +9,7 @@ package org.opendaylight.controller.md.cluster.datastore.model; import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; import org.opendaylight.yangtools.yang.data.api.schema.MapNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; @@ -22,7 +22,7 @@ public class CarsModel { public static final QName BASE_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:cars", "2014-03-13", "cars"); - public static final InstanceIdentifier BASE_PATH = InstanceIdentifier.of(BASE_QNAME); + public static final YangInstanceIdentifier BASE_PATH = YangInstanceIdentifier.of(BASE_QNAME); public static final QName CARS_QNAME = QName.create(BASE_QNAME, "cars"); public static final QName CAR_QNAME = QName.create(CARS_QNAME, "car"); @@ -35,19 +35,19 @@ public class CarsModel { // Create a list builder CollectionNodeBuilder cars = ImmutableMapNodeBuilder.create().withNodeIdentifier( - new InstanceIdentifier.NodeIdentifier( - QName.create(CARS_QNAME, "car"))); + new YangInstanceIdentifier.NodeIdentifier( + CAR_QNAME)); // Create an entry for the car altima MapEntryNode altima = - ImmutableNodes.mapEntryBuilder(CARS_QNAME, CAR_NAME_QNAME, "altima") + ImmutableNodes.mapEntryBuilder(CAR_QNAME, CAR_NAME_QNAME, "altima") .withChild(ImmutableNodes.leafNode(CAR_NAME_QNAME, "altima")) .withChild(ImmutableNodes.leafNode(CAR_PRICE_QNAME, 1000)) .build(); // Create an entry for the car accord MapEntryNode honda = - ImmutableNodes.mapEntryBuilder(CARS_QNAME, CAR_NAME_QNAME, "accord") + ImmutableNodes.mapEntryBuilder(CAR_QNAME, CAR_NAME_QNAME, "accord") .withChild(ImmutableNodes.leafNode(CAR_NAME_QNAME, "accord")) .withChild(ImmutableNodes.leafNode(CAR_PRICE_QNAME, 2000)) .build(); @@ -56,7 +56,7 @@ public class CarsModel { cars.withChild(honda); return ImmutableContainerNodeBuilder.create() - .withNodeIdentifier(new InstanceIdentifier.NodeIdentifier(BASE_QNAME)) + .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(BASE_QNAME)) .withChild(cars.build()) .build(); @@ -64,7 +64,7 @@ public class CarsModel { public static NormalizedNode emptyContainer(){ return ImmutableContainerNodeBuilder.create() - .withNodeIdentifier(new InstanceIdentifier.NodeIdentifier(BASE_QNAME)) + .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(BASE_QNAME)) .build(); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CompositeModel.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CompositeModel.java new file mode 100644 index 0000000000..ece312752d --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CompositeModel.java @@ -0,0 +1,372 @@ +package org.opendaylight.controller.md.cluster.datastore.model; + +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode; +import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; +import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; +import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; +import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; +import org.opendaylight.yangtools.yang.data.api.schema.MapNode; +import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; +import org.opendaylight.yangtools.yang.data.impl.schema.Builders; +import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; +import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; +import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder; +import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder; +import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder; +import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetEntryNodeBuilder; +import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetNodeBuilder; +import org.opendaylight.yangtools.yang.model.api.Module; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; +import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntry; +import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntryBuilder; +import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapNodeBuilder; + +public class CompositeModel { + + public static final QName TEST_QNAME = QName.create( + "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test", + "2014-03-13", "test"); + + public static final QName AUG_QNAME = QName.create( + "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug", + "2014-03-13", "name"); + + public static final QName DESC_QNAME = QName.create(TEST_QNAME, "desc"); + public static final QName OUTER_LIST_QNAME = QName.create(TEST_QNAME, + "outer-list"); + public static final QName INNER_LIST_QNAME = QName.create(TEST_QNAME, + "inner-list"); + public static final QName OUTER_CHOICE_QNAME = QName.create(TEST_QNAME, + "outer-choice"); + public static final QName ID_QNAME = QName.create(TEST_QNAME, "id"); + public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name"); + public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value"); + private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang"; + private static final String DATASTORE_AUG_YANG = + "/odl-datastore-augmentation.yang"; + private static final String DATASTORE_TEST_NOTIFICATION_YANG = + "/odl-datastore-test-notification.yang"; + + + public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier + .of(TEST_QNAME); + public static final YangInstanceIdentifier DESC_PATH = YangInstanceIdentifier + .builder(TEST_PATH).node(DESC_QNAME).build(); + public static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier + .builder(TEST_PATH).node(OUTER_LIST_QNAME).build(); + public static final QName TWO_QNAME = QName.create(TEST_QNAME, "two"); + public static final QName THREE_QNAME = QName.create(TEST_QNAME, "three"); + + private static final Integer ONE_ID = 1; + private static final Integer TWO_ID = 2; + private static final String TWO_ONE_NAME = "one"; + private static final String TWO_TWO_NAME = "two"; + private static final String DESC = "Hello there"; + + // Family specific constants + public static final QName FAMILY_QNAME = + QName + .create( + "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test", + "2014-04-17", "family"); + public static final QName CHILDREN_QNAME = QName.create(FAMILY_QNAME, + "children"); + public static final QName GRAND_CHILDREN_QNAME = QName.create(FAMILY_QNAME, + "grand-children"); + public static final QName CHILD_NUMBER_QNAME = QName.create(FAMILY_QNAME, + "child-number"); + public static final QName CHILD_NAME_QNAME = QName.create(FAMILY_QNAME, + "child-name"); + public static final QName GRAND_CHILD_NUMBER_QNAME = QName.create( + FAMILY_QNAME, "grand-child-number"); + public static final QName GRAND_CHILD_NAME_QNAME = QName.create(FAMILY_QNAME, + "grand-child-name"); + + public static final YangInstanceIdentifier FAMILY_PATH = YangInstanceIdentifier + .of(FAMILY_QNAME); + public static final YangInstanceIdentifier FAMILY_DESC_PATH = YangInstanceIdentifier + .builder(FAMILY_PATH).node(DESC_QNAME).build(); + public static final YangInstanceIdentifier CHILDREN_PATH = YangInstanceIdentifier + .builder(FAMILY_PATH).node(CHILDREN_QNAME).build(); + + private static final Integer FIRST_CHILD_ID = 1; + private static final Integer SECOND_CHILD_ID = 2; + + private static final String FIRST_CHILD_NAME = "first child"; + private static final String SECOND_CHILD_NAME = "second child"; + + private static final Integer FIRST_GRAND_CHILD_ID = 1; + private static final Integer SECOND_GRAND_CHILD_ID = 2; + + private static final String FIRST_GRAND_CHILD_NAME = "first grand child"; + private static final String SECOND_GRAND_CHILD_NAME = "second grand child"; + + // first child + private static final YangInstanceIdentifier CHILDREN_1_PATH = YangInstanceIdentifier + .builder(CHILDREN_PATH) + .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID) // + .build(); + private static final YangInstanceIdentifier CHILDREN_1_NAME_PATH = + YangInstanceIdentifier.builder(CHILDREN_PATH) + .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, FIRST_CHILD_NAME) // + .build(); + + private static final YangInstanceIdentifier CHILDREN_2_PATH = YangInstanceIdentifier + .builder(CHILDREN_PATH) + .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID) // + .build(); + private static final YangInstanceIdentifier CHILDREN_2_NAME_PATH = + YangInstanceIdentifier.builder(CHILDREN_PATH) + .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, SECOND_CHILD_NAME) // + .build(); + + + private static final YangInstanceIdentifier GRAND_CHILD_1_PATH = + YangInstanceIdentifier.builder(CHILDREN_1_PATH) + .node(GRAND_CHILDREN_QNAME) + // + .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME, + FIRST_GRAND_CHILD_ID) // + .build(); + + private static final YangInstanceIdentifier GRAND_CHILD_1_NAME_PATH = + YangInstanceIdentifier.builder(CHILDREN_1_PATH) + .node(GRAND_CHILDREN_QNAME) + // + .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME, + FIRST_GRAND_CHILD_NAME) // + .build(); + + private static final YangInstanceIdentifier GRAND_CHILD_2_PATH = + YangInstanceIdentifier.builder(CHILDREN_2_PATH) + .node(GRAND_CHILDREN_QNAME) + // + .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME, + SECOND_GRAND_CHILD_ID) // + .build(); + + private static final YangInstanceIdentifier GRAND_CHILD_2_NAME_PATH = + YangInstanceIdentifier.builder(CHILDREN_2_PATH) + .node(GRAND_CHILDREN_QNAME) + // + .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME, + SECOND_GRAND_CHILD_NAME) // + .build(); + + private static final YangInstanceIdentifier DESC_PATH_ID = YangInstanceIdentifier + .builder(DESC_PATH).build(); + private static final YangInstanceIdentifier OUTER_LIST_1_PATH = + YangInstanceIdentifier.builder(OUTER_LIST_PATH) + .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, ONE_ID) // + .build(); + + private static final YangInstanceIdentifier OUTER_LIST_2_PATH = + YangInstanceIdentifier.builder(OUTER_LIST_PATH) + .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, TWO_ID) // + .build(); + + private static final YangInstanceIdentifier TWO_TWO_PATH = YangInstanceIdentifier + .builder(OUTER_LIST_2_PATH).node(INNER_LIST_QNAME) // + .nodeWithKey(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME) // + .build(); + + private static final YangInstanceIdentifier TWO_TWO_VALUE_PATH = + YangInstanceIdentifier.builder(TWO_TWO_PATH).node(VALUE_QNAME) // + .build(); + + private static final MapEntryNode BAR_NODE = mapEntryBuilder( + OUTER_LIST_QNAME, ID_QNAME, TWO_ID) // + .withChild(mapNodeBuilder(INNER_LIST_QNAME) // + .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_ONE_NAME)) // + .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME)) // + .build()) // + .build(); + + public static final InputStream getDatastoreTestInputStream() { + return getInputStream(DATASTORE_TEST_YANG); + } + + public static final InputStream getDatastoreAugInputStream() { + return getInputStream(DATASTORE_AUG_YANG); + } + + public static final InputStream getDatastoreTestNotificationInputStream() { + return getInputStream(DATASTORE_TEST_NOTIFICATION_YANG); + } + + private static InputStream getInputStream(final String resourceName) { + return TestModel.class.getResourceAsStream(resourceName); + } + + public static SchemaContext createTestContext() { + List inputStreams = new ArrayList<>(); + inputStreams.add(getDatastoreTestInputStream()); + inputStreams.add(getDatastoreAugInputStream()); + inputStreams.add(getDatastoreTestNotificationInputStream()); + + YangParserImpl parser = new YangParserImpl(); + Set modules = parser.parseYangModelsFromStreams(inputStreams); + return parser.resolveSchemaContext(modules); + } + + /** + * Returns a test document + * + *
+   * test
+   *     outer-list
+   *          id 1
+   *     outer-list
+   *          id 2
+   *          inner-list
+   *                  name "one"
+   *          inner-list
+   *                  name "two"
+   *
+   * 
+ * + * @return + */ + public static NormalizedNode createDocumentOne( + SchemaContext schemaContext) { + return ImmutableContainerNodeBuilder + .create() + .withNodeIdentifier( + new YangInstanceIdentifier.NodeIdentifier(schemaContext.getQName())) + .withChild(createTestContainer()).build(); + + } + + public static ContainerNode createTestContainer() { + + + final LeafSetEntryNode nike = + ImmutableLeafSetEntryNodeBuilder + .create() + .withNodeIdentifier( + new YangInstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME, + "shoe"), "nike")).withValue("nike").build(); + final LeafSetEntryNode puma = + ImmutableLeafSetEntryNodeBuilder + .create() + .withNodeIdentifier( + new YangInstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME, + "shoe"), "puma")).withValue("puma").build(); + final LeafSetNode shoes = + ImmutableLeafSetNodeBuilder + .create() + .withNodeIdentifier( + new YangInstanceIdentifier.NodeIdentifier(QName.create(TEST_QNAME, + "shoe"))).withChild(nike).withChild(puma).build(); + + + final LeafSetEntryNode five = + ImmutableLeafSetEntryNodeBuilder + .create() + .withNodeIdentifier( + (new YangInstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME, + "number"), 5))).withValue(5).build(); + final LeafSetEntryNode fifteen = + ImmutableLeafSetEntryNodeBuilder + .create() + .withNodeIdentifier( + (new YangInstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME, + "number"), 15))).withValue(15).build(); + final LeafSetNode numbers = + ImmutableLeafSetNodeBuilder + .create() + .withNodeIdentifier( + new YangInstanceIdentifier.NodeIdentifier(QName.create(TEST_QNAME, + "number"))).withChild(five).withChild(fifteen).build(); + + + Set childAugmentations = new HashSet<>(); + childAugmentations.add(AUG_QNAME); + final YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier = + new YangInstanceIdentifier.AugmentationIdentifier(null, childAugmentations); + final AugmentationNode augmentationNode = + Builders.augmentationBuilder() + .withNodeIdentifier(augmentationIdentifier) + .withChild(ImmutableNodes.leafNode(AUG_QNAME, "First Test")) + .build(); + return ImmutableContainerNodeBuilder + .create() + .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME)) + .withChild(ImmutableNodes.leafNode(DESC_QNAME, DESC)) + .withChild(augmentationNode) + .withChild(shoes) + .withChild(numbers) + .withChild( + mapNodeBuilder(OUTER_LIST_QNAME) + .withChild(mapEntry(OUTER_LIST_QNAME, ID_QNAME, ONE_ID)) + .withChild(BAR_NODE).build()).build(); + + } + + + public static ContainerNode createFamily() { + final DataContainerNodeAttrBuilder familyContainerBuilder = + ImmutableContainerNodeBuilder.create().withNodeIdentifier( + new YangInstanceIdentifier.NodeIdentifier(FAMILY_QNAME)); + + final CollectionNodeBuilder childrenBuilder = + mapNodeBuilder(CHILDREN_QNAME); + + final DataContainerNodeBuilder firstChildBuilder = + mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID); + final DataContainerNodeBuilder secondChildBuilder = + mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID); + + final DataContainerNodeBuilder firstGrandChildBuilder = + mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME, + FIRST_GRAND_CHILD_ID); + final DataContainerNodeBuilder secondGrandChildBuilder = + mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME, + SECOND_GRAND_CHILD_ID); + + firstGrandChildBuilder + .withChild( + ImmutableNodes.leafNode(GRAND_CHILD_NUMBER_QNAME, + FIRST_GRAND_CHILD_ID)).withChild( + ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME, + FIRST_GRAND_CHILD_NAME)); + + secondGrandChildBuilder.withChild( + ImmutableNodes + .leafNode(GRAND_CHILD_NUMBER_QNAME, SECOND_GRAND_CHILD_ID)) + .withChild( + ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME, + SECOND_GRAND_CHILD_NAME)); + + firstChildBuilder + .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, FIRST_CHILD_ID)) + .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, FIRST_CHILD_NAME)) + .withChild( + mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild( + firstGrandChildBuilder.build()).build()); + + + secondChildBuilder + .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, SECOND_CHILD_ID)) + .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, SECOND_CHILD_NAME)) + .withChild( + mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild( + firstGrandChildBuilder.build()).build()); + + childrenBuilder.withChild(firstChildBuilder.build()); + childrenBuilder.withChild(secondChildBuilder.build()); + + return familyContainerBuilder.withChild(childrenBuilder.build()).build(); + } + +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/PeopleModel.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/PeopleModel.java index 14b02a222a..1b4020af43 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/PeopleModel.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/PeopleModel.java @@ -9,7 +9,7 @@ package org.opendaylight.controller.md.cluster.datastore.model; import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; import org.opendaylight.yangtools.yang.data.api.schema.MapNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; @@ -22,7 +22,7 @@ public class PeopleModel { public static final QName BASE_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:people", "2014-03-13", "people"); - public static final InstanceIdentifier BASE_PATH = InstanceIdentifier.of(BASE_QNAME); + public static final YangInstanceIdentifier BASE_PATH = YangInstanceIdentifier.of(BASE_QNAME); public static final QName PEOPLE_QNAME = QName.create(BASE_QNAME, "people"); public static final QName PERSON_QNAME = QName.create(PEOPLE_QNAME, "person"); public static final QName PERSON_NAME_QNAME = QName.create(PERSON_QNAME, "name"); @@ -35,19 +35,19 @@ public class PeopleModel { // Create a list builder CollectionNodeBuilder cars = ImmutableMapNodeBuilder.create().withNodeIdentifier( - new InstanceIdentifier.NodeIdentifier( - QName.create(PEOPLE_QNAME, "person"))); + new YangInstanceIdentifier.NodeIdentifier( + PERSON_QNAME)); // Create an entry for the person jack MapEntryNode jack = - ImmutableNodes.mapEntryBuilder(PEOPLE_QNAME, PERSON_NAME_QNAME, "jack") + ImmutableNodes.mapEntryBuilder(PERSON_QNAME, PERSON_NAME_QNAME, "jack") .withChild(ImmutableNodes.leafNode(PERSON_NAME_QNAME, "jack")) .withChild(ImmutableNodes.leafNode(PERSON_AGE_QNAME, 100)) .build(); // Create an entry for the person jill MapEntryNode jill = - ImmutableNodes.mapEntryBuilder(PEOPLE_QNAME, PERSON_NAME_QNAME, "jill") + ImmutableNodes.mapEntryBuilder(PERSON_QNAME, PERSON_NAME_QNAME, "jill") .withChild(ImmutableNodes.leafNode(PERSON_NAME_QNAME, "jill")) .withChild(ImmutableNodes.leafNode(PERSON_AGE_QNAME, 200)) .build(); @@ -56,7 +56,7 @@ public class PeopleModel { cars.withChild(jill); return ImmutableContainerNodeBuilder.create() - .withNodeIdentifier(new InstanceIdentifier.NodeIdentifier(BASE_QNAME)) + .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(BASE_QNAME)) .withChild(cars.build()) .build(); @@ -65,7 +65,7 @@ public class PeopleModel { public static NormalizedNode emptyContainer(){ return ImmutableContainerNodeBuilder.create() .withNodeIdentifier( - new InstanceIdentifier.NodeIdentifier(BASE_QNAME)) + new YangInstanceIdentifier.NodeIdentifier(BASE_QNAME)) .build(); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/SampleModelsTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/SampleModelsTest.java index 68245917c6..d8fefcd986 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/SampleModelsTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/SampleModelsTest.java @@ -12,50 +12,51 @@ import junit.framework.Assert; import org.junit.Test; import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec; import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; public class SampleModelsTest { @Test public void testPeopleModel(){ - NormalizedNode expected = PeopleModel.emptyContainer(); + NormalizedNode expected = PeopleModel.create(); NormalizedNodeMessages.Container node = new NormalizedNodeToNodeCodec(SchemaContextHelper.full()) - .encode(InstanceIdentifier.of(PeopleModel.BASE_QNAME), + .encode(YangInstanceIdentifier.of(PeopleModel.BASE_QNAME), expected); NormalizedNodeMessages.Node normalizedNode = node.getNormalizedNode(); - NormalizedNode actual = new NormalizedNodeToNodeCodec(SchemaContextHelper.full()).decode(InstanceIdentifier.of(PeopleModel.BASE_QNAME), + NormalizedNode actual = new NormalizedNodeToNodeCodec(SchemaContextHelper.full()).decode(YangInstanceIdentifier.of(PeopleModel.BASE_QNAME), normalizedNode); - Assert.assertEquals(expected, actual); + Assert.assertEquals(expected.toString(), actual.toString()); } @Test public void testCarsModel(){ - NormalizedNode expected = CarsModel.emptyContainer(); + NormalizedNode expected = CarsModel.create(); NormalizedNodeMessages.Container node = new NormalizedNodeToNodeCodec(SchemaContextHelper.full()) - .encode(InstanceIdentifier.of(CarsModel.BASE_QNAME), + .encode(YangInstanceIdentifier.of(CarsModel.BASE_QNAME), expected); NormalizedNodeMessages.Node normalizedNode = node.getNormalizedNode(); - NormalizedNode actual = new NormalizedNodeToNodeCodec(SchemaContextHelper.full()).decode(InstanceIdentifier.of(CarsModel.BASE_QNAME), + NormalizedNode actual = new NormalizedNodeToNodeCodec(SchemaContextHelper.full()).decode( + YangInstanceIdentifier.of(CarsModel.BASE_QNAME), normalizedNode); - Assert.assertEquals(expected, actual); + Assert.assertEquals(expected.toString(), actual.toString()); } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/TestModel.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/TestModel.java index 7a1def9f89..85441eca0d 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/TestModel.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/TestModel.java @@ -8,7 +8,7 @@ package org.opendaylight.controller.md.cluster.datastore.model; import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.model.api.Module; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl; @@ -29,8 +29,8 @@ public class TestModel { public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value"); private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang"; - public static final InstanceIdentifier TEST_PATH = InstanceIdentifier.of(TEST_QNAME); - public static final InstanceIdentifier OUTER_LIST_PATH = InstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build(); + public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME); + public static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build(); public static final QName TWO_QNAME = QName.create(TEST_QNAME,"two"); public static final QName THREE_QNAME = QName.create(TEST_QNAME,"three"); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/application.conf b/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/application.conf index a07c252e4c..aebff27c7d 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/application.conf +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/application.conf @@ -11,4 +11,4 @@ akka { } } -} \ No newline at end of file +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-augmentation.yang b/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-augmentation.yang new file mode 100644 index 0000000000..77d74c47d3 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-augmentation.yang @@ -0,0 +1,19 @@ +module odl-datastore-augmentation { + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug"; + prefix "store-aug"; + + import odl-datastore-test {prefix test;revision-date "2014-03-13";} + + revision "2014-03-13" { + description "Initial revision."; + } + + + augment "/test:test" { + leaf name { + type string; + } + } + +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-test-notification.yang b/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-test-notification.yang new file mode 100644 index 0000000000..25cc53ab93 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-test-notification.yang @@ -0,0 +1,33 @@ +module odl-datastore-test-notification { + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test"; + prefix "notification-test-using-family-model"; + + revision "2014-04-17" { + description "Family structure created on "; + } + + container family { + leaf desc { + type string; + } + list children { + key child-number; + leaf child-number { + type uint16; + } + leaf child-name { + type string; + } + list grand-children { + key grand-child-number; + leaf grand-child-number { + type uint16; + } + leaf grand-child-name { + type string; + } + } + } + } +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/run.sh b/opendaylight/md-sal/sal-protocolbuffer-encoding/run.sh index c9e586ba1a..f0907db664 100755 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/run.sh +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/run.sh @@ -36,3 +36,6 @@ echo "Done generating Java source files." #to remove trailing spaces in the code files find src/main/java -type f -name '*.java' -exec sed --in-place 's/[[:space:]]\+$//' {} \+ + +#to remove trailing spaces in the generated code on OSX +find src/main/java -type f -print0 |xargs -0 perl -pi -e 's/ +$//' diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NodeToNormalizedNodeBuilder.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NodeToNormalizedNodeBuilder.java index e340d08d4b..ce120809d7 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NodeToNormalizedNodeBuilder.java +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NodeToNormalizedNodeBuilder.java @@ -15,7 +15,10 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithV import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument; import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode; import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; +import org.opendaylight.yangtools.yang.data.api.schema.LeafNode; +import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; +import org.opendaylight.yangtools.yang.data.api.schema.MapNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer; import org.opendaylight.yangtools.yang.data.impl.schema.Builders; @@ -48,7 +51,7 @@ import static com.google.common.base.Preconditions.checkArgument; /** * NormalizedNodeBuilder is a builder that walks through a tree like structure and constructs a * NormalizedNode from it. - * + *

* A large part of this code has been copied over from a similar class in sal-common-impl which was * originally supposed to convert a CompositeNode to NormalizedNode * @@ -57,694 +60,787 @@ import static com.google.common.base.Preconditions.checkArgument; public abstract class NodeToNormalizedNodeBuilder implements Identifiable { - private final T identifier; + private final T identifier; - protected static final Logger logger = LoggerFactory - .getLogger(NodeToNormalizedNodeBuilder.class); + protected static final Logger logger = LoggerFactory + .getLogger(NodeToNormalizedNodeBuilder.class); - @Override - public T getIdentifier() { - return identifier; - }; + @Override + public T getIdentifier() { + return identifier; + } - protected NodeToNormalizedNodeBuilder(final T identifier) { - super(); - this.identifier = identifier; + ; - } + protected NodeToNormalizedNodeBuilder(final T identifier) { + super(); + this.identifier = identifier; - /** - * - * @return Should return true if the node that this operation corresponds to is a mixin - */ - public boolean isMixin() { - return false; - } + } + /** + * @return Should return true if the node that this operation corresponds to is a mixin + */ + public boolean isMixin() { + return false; + } - /** - * - * @return Should return true if the node that this operation corresponds to has a 'key' - * associated with it. This is typically true for a list-item or leaf-list entry in yang - */ - public boolean isKeyedEntry() { - return false; - } - protected Set getQNameIdentifiers() { - return Collections.singleton(identifier.getNodeType()); - } + /** + * @return Should return true if the node that this operation corresponds to has a 'key' + * associated with it. This is typically true for a list-item or leaf-list entry in yang + */ + public boolean isKeyedEntry() { + return false; + } - public abstract NodeToNormalizedNodeBuilder getChild( - final PathArgument child); + protected Set getQNameIdentifiers() { + return Collections.singleton(identifier.getNodeType()); + } - public abstract NodeToNormalizedNodeBuilder getChild(QName child); + public abstract NodeToNormalizedNodeBuilder getChild( + final PathArgument child); - public abstract NormalizedNode normalize(QName nodeType, Node node); + public abstract NodeToNormalizedNodeBuilder getChild(QName child); + public abstract NormalizedNode normalize(QName nodeType, Node node); - private static abstract class SimpleTypeNormalization - extends NodeToNormalizedNodeBuilder { - protected SimpleTypeNormalization(final T identifier) { - super(identifier); - } + private static abstract class SimpleTypeNormalization + extends NodeToNormalizedNodeBuilder { - @Override - public NormalizedNode normalize(final QName nodeType, final Node node) { - checkArgument(node != null); - return normalizeImpl(nodeType, node); - } + protected SimpleTypeNormalization(final T identifier) { + super(identifier); + } - protected abstract NormalizedNode normalizeImpl(QName nodeType, - Node node); + @Override + public NormalizedNode normalize(final QName nodeType, + final Node node) { + checkArgument(node != null); + return normalizeImpl(nodeType, node); + } - @Override - public NodeToNormalizedNodeBuilder getChild(final PathArgument child) { - return null; - } + protected abstract NormalizedNode normalizeImpl(QName nodeType, + Node node); - @Override - public NodeToNormalizedNodeBuilder getChild(final QName child) { - return null; - } + @Override + public NodeToNormalizedNodeBuilder getChild( + final PathArgument child) { + return null; + } + + @Override + public NodeToNormalizedNodeBuilder getChild(final QName child) { + return null; + } + + @Override + public NormalizedNode createDefault( + final PathArgument currentArg) { + // TODO Auto-generated method stub + return null; + } - @Override - public NormalizedNode createDefault(final PathArgument currentArg) { - // TODO Auto-generated method stub - return null; } - } - private static final class LeafNormalization extends - SimpleTypeNormalization { + private static final class LeafNormalization extends + SimpleTypeNormalization { - protected LeafNormalization(final NodeIdentifier identifier) { - super(identifier); - } + private final LeafSchemaNode schema; - @Override - protected NormalizedNode normalizeImpl(final QName nodeType, - final Node node) { - return ImmutableNodes.leafNode(nodeType, node.getValue()); + protected LeafNormalization(final LeafSchemaNode schema, final NodeIdentifier identifier) { + super(identifier); + this.schema = schema; + } + + @Override + protected NormalizedNode normalizeImpl(final QName nodeType, + final Node node) { + Object value = NodeValueCodec.toTypeSafeValue(this.schema, this.schema.getType(), node); + return ImmutableNodes.leafNode(nodeType, value); + + } } - } - private static final class LeafListEntryNormalization extends - SimpleTypeNormalization { + private static final class LeafListEntryNormalization extends + SimpleTypeNormalization { - public LeafListEntryNormalization(final LeafListSchemaNode potential) { - super(new NodeWithValue(potential.getQName(), null)); - } + private final LeafListSchemaNode schema; - @Override - protected NormalizedNode normalizeImpl(final QName nodeType, - final Node node) { - final Object data = node.getValue(); - if (data == null) { - Preconditions.checkArgument(false, - "No data available in leaf list entry for " + nodeType); - } - NodeWithValue nodeId = new NodeWithValue(nodeType, data); - return Builders.leafSetEntryBuilder().withNodeIdentifier(nodeId) - .withValue(data).build(); - } + public LeafListEntryNormalization(final LeafListSchemaNode potential) { + super(new NodeWithValue(potential.getQName(), null)); + this.schema = potential; + } + @Override + protected NormalizedNode normalizeImpl(final QName nodeType, + final Node node) { + final Object data = node.getValue(); + if (data == null) { + Preconditions.checkArgument(false, + "No data available in leaf list entry for " + nodeType); + } - @Override - public boolean isKeyedEntry() { - return true; - } - } + Object value = NodeValueCodec.toTypeSafeValue(this.schema, this.schema.getType(), node); - private static abstract class NodeToNormalizationNodeOperation - extends NodeToNormalizedNodeBuilder { + NodeWithValue nodeId = new NodeWithValue(nodeType, value); + return Builders.leafSetEntryBuilder().withNodeIdentifier(nodeId) + .withValue(value).build(); + } - protected NodeToNormalizationNodeOperation(final T identifier) { - super(identifier); - } - @SuppressWarnings({"rawtypes", "unchecked"}) - @Override - public final NormalizedNodeContainer normalize( - final QName nodeType, final Node node) { - checkArgument(node != null); - - if (!node.getType().equals(AugmentationNode.class.getSimpleName())&& !node.getType().equals(ContainerNode.class.getSimpleName())) { - checkArgument(nodeType != null); - } - - NormalizedNodeContainerBuilder builder = createBuilder(node); - - Set> usedMixins = new HashSet<>(); - - logNode(node); - - if (node.getChildCount() == 0 && !node.getType().equals(ContainerNode.class.getSimpleName())) { - PathArgument childPathArgument = - NodeIdentifierFactory.getArgument(node.getPath()); - NormalizedNode child = null; - if (childPathArgument instanceof NodeWithValue) { - final NodeWithValue nodeWithValue = - new NodeWithValue(childPathArgument.getNodeType(), - node.getValue()); - child = - Builders.leafSetEntryBuilder().withNodeIdentifier(nodeWithValue) - .withValue(node.getValue()).build(); - } else { - child = - ImmutableNodes.leafNode(childPathArgument.getNodeType(), - node.getValue()); + @Override + public boolean isKeyedEntry() { + return true; } - builder.addChild(child); - } + } - final List children = node.getChildList(); - for (Node nodeChild : children) { - PathArgument childPathArgument = - NodeIdentifierFactory.getArgument(nodeChild.getPath()); + private static abstract class NodeToNormalizationNodeOperation + extends NodeToNormalizedNodeBuilder { - QName childNodeType = null; - NodeToNormalizedNodeBuilder childOp = null; + protected NodeToNormalizationNodeOperation(final T identifier) { + super(identifier); + } + @SuppressWarnings({"rawtypes", "unchecked"}) + @Override + public final NormalizedNodeContainer normalize( + final QName nodeType, final Node node) { + checkArgument(node != null); + + if (!node.getType().equals(AugmentationNode.class.getSimpleName()) + && !node.getType().equals(ContainerNode.class.getSimpleName()) + && !node.getType().equals(MapNode.class.getSimpleName())) { + checkArgument(nodeType != null); + } + + NormalizedNodeContainerBuilder builder = createBuilder(node); + + Set> usedMixins = new HashSet<>(); + + logNode(node); + + if (node.getChildCount() == 0 && ( + node.getType().equals(LeafSetEntryNode.class.getSimpleName()) + || node.getType().equals(LeafNode.class.getSimpleName()))) { + PathArgument childPathArgument = + NodeIdentifierFactory.getArgument(node.getPath()); + + final NormalizedNode child; + if (childPathArgument instanceof NodeWithValue) { + final NodeWithValue nodeWithValue = + new NodeWithValue(childPathArgument.getNodeType(), + node.getValue()); + child = + Builders.leafSetEntryBuilder() + .withNodeIdentifier(nodeWithValue) + .withValue(node.getValue()).build(); + } else { + child = + ImmutableNodes.leafNode(childPathArgument.getNodeType(), + node.getValue()); + } + builder.addChild(child); + } + + final List children = node.getChildList(); + for (Node nodeChild : children) { + + PathArgument childPathArgument = + NodeIdentifierFactory.getArgument(nodeChild.getPath()); + + QName childNodeType = null; + NodeToNormalizedNodeBuilder childOp = null; + + if (childPathArgument instanceof AugmentationIdentifier) { + childOp = getChild(childPathArgument); + checkArgument(childOp instanceof AugmentationNormalization, childPathArgument); + } else { + childNodeType = childPathArgument.getNodeType(); + childOp = getChild(childNodeType); + } + // We skip unknown nodes if this node is mixin since + // it's nodes and parent nodes are interleaved + if (childOp == null && isMixin()) { + continue; + } else if (childOp == null) { + logger.error( + "childOp is null and this operation is not a mixin : this = {}", + this.toString()); + } + + checkArgument(childOp != null, + "Node %s is not allowed inside %s", + childNodeType, getIdentifier()); + + if (childOp.isMixin()) { + if (usedMixins.contains(childOp)) { + // We already run / processed that mixin, so to avoid + // duplicate we are + // skipping next nodes. + continue; + } + // builder.addChild(childOp.normalize(nodeType, treeCacheNode)); + final NormalizedNode childNode = + childOp.normalize(childNodeType, nodeChild); + if (childNode != null) + builder.addChild(childNode); + usedMixins.add(childOp); + } else { + final NormalizedNode childNode = + childOp.normalize(childNodeType, nodeChild); + if (childNode != null) + builder.addChild(childNode); + } + } + + + try { + return (NormalizedNodeContainer) builder.build(); + } catch (Exception e) { + return null; + } - if (childPathArgument instanceof AugmentationIdentifier) { - childOp = getChild(childPathArgument); - } else { - childNodeType = childPathArgument.getNodeType(); - childOp = getChild(childNodeType); - } - // We skip unknown nodes if this node is mixin since - // it's nodes and parent nodes are interleaved - if (childOp == null && isMixin()) { - continue; - } else if (childOp == null) { - logger.error( - "childOp is null and this operation is not a mixin : this = {}", - this.toString()); - } - - checkArgument(childOp != null, "Node %s is not allowed inside %s", - childNodeType, getIdentifier()); - if (childOp.isMixin()) { - if (usedMixins.contains(childOp)) { - // We already run / processed that mixin, so to avoid - // duplicate we are - // skiping next nodes. - continue; - } - // builder.addChild(childOp.normalize(nodeType, treeCacheNode)); - final NormalizedNode childNode = - childOp.normalize(childNodeType, nodeChild); - if (childNode != null) - builder.addChild(childNode); - usedMixins.add(childOp); - } else { - final NormalizedNode childNode = - childOp.normalize(childNodeType, nodeChild); - if (childNode != null) - builder.addChild(childNode); } - } + private void logNode(Node node) { + //let us find out the type of the node + logger.debug("We got a {} , with identifier {} with {} children", + node.getType(), node.getPath(), + node.getChildList()); + } - try { - return (NormalizedNodeContainer) builder.build(); - } catch (Exception e) { - return null; - } + @SuppressWarnings("rawtypes") + protected abstract NormalizedNodeContainerBuilder createBuilder( + final Node node); } - private void logNode(Node node) { - //let us find out the type of the node - logger.debug("We got a {} , with identifier {} with {} children", node.getType(),node.getPath(), - node.getChildList()); - } - @SuppressWarnings("rawtypes") - protected abstract NormalizedNodeContainerBuilder createBuilder( - final Node node); + private static abstract class DataContainerNormalizationOperation + extends NodeToNormalizationNodeOperation { - } + private final DataNodeContainer schema; + private final Map> byQName; + private final Map> byArg; - private static abstract class DataContainerNormalizationOperation - extends NodeToNormalizationNodeOperation { + protected DataContainerNormalizationOperation(final T identifier, + final DataNodeContainer schema) { + super(identifier); + this.schema = schema; + this.byArg = new ConcurrentHashMap<>(); + this.byQName = new ConcurrentHashMap<>(); + } - private final DataNodeContainer schema; - private final Map> byQName; - private final Map> byArg; + @Override + public NodeToNormalizedNodeBuilder getChild( + final PathArgument child) { + NodeToNormalizedNodeBuilder potential = byArg.get(child); + if (potential != null) { + return potential; + } + potential = fromSchema(schema, child); + return register(potential); + } - protected DataContainerNormalizationOperation(final T identifier, - final DataNodeContainer schema) { - super(identifier); - this.schema = schema; - this.byArg = new ConcurrentHashMap<>(); - this.byQName = new ConcurrentHashMap<>(); - } + @Override + public NodeToNormalizedNodeBuilder getChild(final QName child) { + if (child == null) { + return null; + } + + NodeToNormalizedNodeBuilder potential = byQName.get(child); + if (potential != null) { + return potential; + } + potential = fromSchemaAndPathArgument(schema, child); + return register(potential); + } - @Override - public NodeToNormalizedNodeBuilder getChild(final PathArgument child) { - NodeToNormalizedNodeBuilder potential = byArg.get(child); - if (potential != null) { - return potential; - } - potential = fromSchema(schema, child); - return register(potential); - } + private NodeToNormalizedNodeBuilder register( + final NodeToNormalizedNodeBuilder potential) { + if (potential != null) { + byArg.put(potential.getIdentifier(), potential); + for (QName qName : potential.getQNameIdentifiers()) { + byQName.put(qName, potential); + } + } + return potential; + } - @Override - public NodeToNormalizedNodeBuilder getChild(final QName child) { - if (child == null) { - return null; - } - - NodeToNormalizedNodeBuilder potential = byQName.get(child); - if (potential != null) { - return potential; - } - potential = fromSchemaAndPathArgument(schema, child); - return register(potential); } - private NodeToNormalizedNodeBuilder register( - final NodeToNormalizedNodeBuilder potential) { - if (potential != null) { - byArg.put(potential.getIdentifier(), potential); - for (QName qName : potential.getQNameIdentifiers()) { - byQName.put(qName, potential); + + private static final class ListItemNormalization extends + DataContainerNormalizationOperation { + + private final List keyDefinition; + private final ListSchemaNode schemaNode; + + protected ListItemNormalization( + final NodeIdentifierWithPredicates identifier, + final ListSchemaNode schema) { + super(identifier, schema); + this.schemaNode = schema; + keyDefinition = schema.getKeyDefinition(); } - } - return potential; - } - } + @Override + protected NormalizedNodeContainerBuilder createBuilder( + final Node node) { + NodeIdentifierWithPredicates nodeIdentifierWithPredicates = + (NodeIdentifierWithPredicates) NodeIdentifierFactory + .createPathArgument(node + .getPath(), schemaNode); + return Builders.mapEntryBuilder() + .withNodeIdentifier( + nodeIdentifierWithPredicates + ); + } - private static final class ListItemNormalization extends - DataContainerNormalizationOperation { + @Override + public NormalizedNode createDefault( + final PathArgument currentArg) { + DataContainerNodeAttrBuilder + builder = + Builders.mapEntryBuilder().withNodeIdentifier( + (NodeIdentifierWithPredicates) currentArg); + for (Entry keyValue : ((NodeIdentifierWithPredicates) currentArg) + .getKeyValues().entrySet()) { + if (keyValue.getValue() == null) { + throw new NullPointerException( + "Null value found for path : " + + currentArg); + } + builder.addChild(Builders.leafBuilder() + // + .withNodeIdentifier(new NodeIdentifier(keyValue.getKey())) + .withValue(keyValue.getValue()).build()); + } + return builder.build(); + } - private final List keyDefinition; - private final ListSchemaNode schemaNode; - protected ListItemNormalization( - final NodeIdentifierWithPredicates identifier, - final ListSchemaNode schema) { - super(identifier, schema); - this.schemaNode = schema; - keyDefinition = schema.getKeyDefinition(); + @Override + public boolean isKeyedEntry() { + return true; + } } - @Override - protected NormalizedNodeContainerBuilder createBuilder(final Node node) { - return Builders.mapEntryBuilder().withNodeIdentifier( - (NodeIdentifierWithPredicates) NodeIdentifierFactory.getArgument(node - .getPath())); - } - @Override - public NormalizedNode createDefault(final PathArgument currentArg) { - DataContainerNodeAttrBuilder builder = - Builders.mapEntryBuilder().withNodeIdentifier( - (NodeIdentifierWithPredicates) currentArg); - for (Entry keyValue : ((NodeIdentifierWithPredicates) currentArg) - .getKeyValues().entrySet()) { - if (keyValue.getValue() == null) { - throw new NullPointerException("Null value found for path : " - + currentArg); - } - builder.addChild(Builders.leafBuilder() - // - .withNodeIdentifier(new NodeIdentifier(keyValue.getKey())) - .withValue(keyValue.getValue()).build()); - } - return builder.build(); - } + private static final class ContainerNormalization extends + DataContainerNormalizationOperation { + protected ContainerNormalization(final ContainerSchemaNode schema) { + super(new NodeIdentifier(schema.getQName()), schema); + } - @Override - public boolean isKeyedEntry() { - return true; - } - } + @Override + protected NormalizedNodeContainerBuilder createBuilder( + final Node node) { + return Builders.containerBuilder() + .withNodeIdentifier(getIdentifier()); + } - private static final class ContainerNormalization extends - DataContainerNormalizationOperation { + @Override + public NormalizedNode createDefault( + final PathArgument currentArg) { + return Builders.containerBuilder() + .withNodeIdentifier((NodeIdentifier) currentArg).build(); + } - protected ContainerNormalization(final ContainerSchemaNode schema) { - super(new NodeIdentifier(schema.getQName()), schema); } - @Override - protected NormalizedNodeContainerBuilder createBuilder(final Node node) { - return Builders.containerBuilder().withNodeIdentifier(getIdentifier()); - } - @Override - public NormalizedNode createDefault(final PathArgument currentArg) { - return Builders.containerBuilder() - .withNodeIdentifier((NodeIdentifier) currentArg).build(); - } + private static abstract class MixinNormalizationOp + extends NodeToNormalizationNodeOperation { - } + protected MixinNormalizationOp(final T identifier) { + super(identifier); + } - private static abstract class MixinNormalizationOp - extends NodeToNormalizationNodeOperation { + @Override + public final boolean isMixin() { + return true; + } - protected MixinNormalizationOp(final T identifier) { - super(identifier); } - @Override - public final boolean isMixin() { - return true; - } - } + private static final class LeafListMixinNormalization extends + MixinNormalizationOp { - private static final class LeafListMixinNormalization extends - MixinNormalizationOp { + private final NodeToNormalizedNodeBuilder innerOp; - private final NodeToNormalizedNodeBuilder innerOp; + public LeafListMixinNormalization(final LeafListSchemaNode potential) { + super(new NodeIdentifier(potential.getQName())); + innerOp = new LeafListEntryNormalization(potential); + } - public LeafListMixinNormalization(final LeafListSchemaNode potential) { - super(new NodeIdentifier(potential.getQName())); - innerOp = new LeafListEntryNormalization(potential); - } + @Override + protected NormalizedNodeContainerBuilder createBuilder( + final Node node) { + return Builders.leafSetBuilder() + .withNodeIdentifier(getIdentifier()); + } - @Override - protected NormalizedNodeContainerBuilder createBuilder( - final Node node) { - return Builders.leafSetBuilder().withNodeIdentifier(getIdentifier()); - } + @Override + public NormalizedNode createDefault( + final PathArgument currentArg) { + return Builders.leafSetBuilder().withNodeIdentifier(getIdentifier()) + .build(); + } - @Override - public NormalizedNode createDefault(final PathArgument currentArg) { - return Builders.leafSetBuilder().withNodeIdentifier(getIdentifier()) - .build(); - } + @Override + public NodeToNormalizedNodeBuilder getChild( + final PathArgument child) { + if (child instanceof NodeWithValue) { + return innerOp; + } + return null; + } - @Override - public NodeToNormalizedNodeBuilder getChild(final PathArgument child) { - if (child instanceof NodeWithValue) { - return innerOp; - } - return null; - } + @Override + public NodeToNormalizedNodeBuilder getChild(final QName child) { + if (getIdentifier().getNodeType().equals(child)) { + return innerOp; + } + return null; + } - @Override - public NodeToNormalizedNodeBuilder getChild(final QName child) { - if (getIdentifier().getNodeType().equals(child)) { - return innerOp; - } - return null; } - } - private static final class AugmentationNormalization extends - MixinNormalizationOp { + private static final class AugmentationNormalization extends + MixinNormalizationOp { + + private final Map> byQName; + private final Map> byArg; - private final Map> byQName; - private final Map> byArg; + public AugmentationNormalization(final AugmentationSchema augmentation, + final DataNodeContainer schema) { + super(augmentationIdentifierFrom(augmentation)); - public AugmentationNormalization(final AugmentationSchema augmentation, - final DataNodeContainer schema) { - super(augmentationIdentifierFrom(augmentation)); + ImmutableMap.Builder> + byQNameBuilder = + ImmutableMap.builder(); + ImmutableMap.Builder> + byArgBuilder = + ImmutableMap.builder(); - ImmutableMap.Builder> byQNameBuilder = - ImmutableMap.builder(); - ImmutableMap.Builder> byArgBuilder = - ImmutableMap.builder(); + for (DataSchemaNode augNode : augmentation.getChildNodes()) { + DataSchemaNode resolvedNode = + schema.getDataChildByName(augNode.getQName()); + NodeToNormalizedNodeBuilder resolvedOp = + fromDataSchemaNode(resolvedNode); + byArgBuilder.put(resolvedOp.getIdentifier(), resolvedOp); + for (QName resQName : resolvedOp.getQNameIdentifiers()) { + byQNameBuilder.put(resQName, resolvedOp); + } + } + byQName = byQNameBuilder.build(); + byArg = byArgBuilder.build(); - for (DataSchemaNode augNode : augmentation.getChildNodes()) { - DataSchemaNode resolvedNode = - schema.getDataChildByName(augNode.getQName()); - NodeToNormalizedNodeBuilder resolvedOp = - fromDataSchemaNode(resolvedNode); - byArgBuilder.put(resolvedOp.getIdentifier(), resolvedOp); - for (QName resQName : resolvedOp.getQNameIdentifiers()) { - byQNameBuilder.put(resQName, resolvedOp); } - } - byQName = byQNameBuilder.build(); - byArg = byArgBuilder.build(); - } + @Override + public NodeToNormalizedNodeBuilder getChild( + final PathArgument child) { + return byArg.get(child); + } - @Override - public NodeToNormalizedNodeBuilder getChild(final PathArgument child) { - return byArg.get(child); - } + @Override + public NodeToNormalizedNodeBuilder getChild(final QName child) { + return byQName.get(child); + } - @Override - public NodeToNormalizedNodeBuilder getChild(final QName child) { - return byQName.get(child); - } + @Override + protected Set getQNameIdentifiers() { + return getIdentifier().getPossibleChildNames(); + } - @Override - protected Set getQNameIdentifiers() { - return getIdentifier().getPossibleChildNames(); - } + @SuppressWarnings("rawtypes") + @Override + protected NormalizedNodeContainerBuilder createBuilder( + final Node node) { + return Builders.augmentationBuilder() + .withNodeIdentifier(getIdentifier()); + } - @SuppressWarnings("rawtypes") - @Override - protected NormalizedNodeContainerBuilder createBuilder(final Node node) { - return Builders.augmentationBuilder().withNodeIdentifier(getIdentifier()); - } + @Override + public NormalizedNode createDefault( + final PathArgument currentArg) { + return Builders.augmentationBuilder() + .withNodeIdentifier(getIdentifier()) + .build(); + } - @Override - public NormalizedNode createDefault(final PathArgument currentArg) { - return Builders.augmentationBuilder().withNodeIdentifier(getIdentifier()) - .build(); } - } - private static final class ListMixinNormalization extends - MixinNormalizationOp { + private static final class ListMixinNormalization extends + MixinNormalizationOp { - private final ListItemNormalization innerNode; + private final ListItemNormalization innerNode; - public ListMixinNormalization(final ListSchemaNode list) { - super(new NodeIdentifier(list.getQName())); - this.innerNode = - new ListItemNormalization(new NodeIdentifierWithPredicates( - list.getQName(), Collections.emptyMap()), list); - } + public ListMixinNormalization(final ListSchemaNode list) { + super(new NodeIdentifier(list.getQName())); + this.innerNode = + new ListItemNormalization(new NodeIdentifierWithPredicates( + list.getQName(), Collections.emptyMap()), + list); + } - @SuppressWarnings("rawtypes") - @Override - protected NormalizedNodeContainerBuilder createBuilder( - final Node node) { - return Builders.mapBuilder().withNodeIdentifier(getIdentifier()); - } + @SuppressWarnings("rawtypes") + @Override + protected NormalizedNodeContainerBuilder createBuilder( + final Node node) { + return Builders.mapBuilder().withNodeIdentifier(getIdentifier()); + } - @Override - public NormalizedNode createDefault(final PathArgument currentArg) { - return Builders.mapBuilder().withNodeIdentifier(getIdentifier()).build(); - } + @Override + public NormalizedNode createDefault( + final PathArgument currentArg) { + return Builders.mapBuilder().withNodeIdentifier(getIdentifier()) + .build(); + } - @Override - public NodeToNormalizedNodeBuilder getChild(final PathArgument child) { - if (child.getNodeType().equals(getIdentifier().getNodeType())) { - return innerNode; - } - return null; - } + @Override + public NodeToNormalizedNodeBuilder getChild( + final PathArgument child) { + if (child.getNodeType().equals(getIdentifier().getNodeType())) { + return innerNode; + } + return null; + } - @Override - public NodeToNormalizedNodeBuilder getChild(final QName child) { - if (getIdentifier().getNodeType().equals(child)) { - return innerNode; - } - return null; - } + @Override + public NodeToNormalizedNodeBuilder getChild(final QName child) { + if (getIdentifier().getNodeType().equals(child)) { + return innerNode; + } + return null; + } - } - - private static class ChoiceNodeNormalization extends - MixinNormalizationOp { - - private final ImmutableMap> byQName; - private final ImmutableMap> byArg; - - protected ChoiceNodeNormalization( - final org.opendaylight.yangtools.yang.model.api.ChoiceNode schema) { - super(new NodeIdentifier(schema.getQName())); - ImmutableMap.Builder> byQNameBuilder = - ImmutableMap.builder(); - ImmutableMap.Builder> byArgBuilder = - ImmutableMap.builder(); - - for (ChoiceCaseNode caze : schema.getCases()) { - for (DataSchemaNode cazeChild : caze.getChildNodes()) { - NodeToNormalizedNodeBuilder childOp = - fromDataSchemaNode(cazeChild); - byArgBuilder.put(childOp.getIdentifier(), childOp); - for (QName qname : childOp.getQNameIdentifiers()) { - byQNameBuilder.put(qname, childOp); - } - } - } - byQName = byQNameBuilder.build(); - byArg = byArgBuilder.build(); } - @Override - public NodeToNormalizedNodeBuilder getChild(final PathArgument child) { - return byArg.get(child); - } - @Override - public NodeToNormalizedNodeBuilder getChild(final QName child) { - return byQName.get(child); - } + private static class ChoiceNodeNormalization extends + MixinNormalizationOp { + + private final ImmutableMap> + byQName; + private final ImmutableMap> + byArg; + + protected ChoiceNodeNormalization( + final org.opendaylight.yangtools.yang.model.api.ChoiceNode schema) { + super(new NodeIdentifier(schema.getQName())); + ImmutableMap.Builder> + byQNameBuilder = + ImmutableMap.builder(); + ImmutableMap.Builder> + byArgBuilder = + ImmutableMap.builder(); + + for (ChoiceCaseNode caze : schema.getCases()) { + for (DataSchemaNode cazeChild : caze.getChildNodes()) { + NodeToNormalizedNodeBuilder childOp = + fromDataSchemaNode(cazeChild); + byArgBuilder.put(childOp.getIdentifier(), childOp); + for (QName qname : childOp.getQNameIdentifiers()) { + byQNameBuilder.put(qname, childOp); + } + } + } + byQName = byQNameBuilder.build(); + byArg = byArgBuilder.build(); + } - @Override - protected NormalizedNodeContainerBuilder createBuilder(final Node node) { - return Builders.choiceBuilder().withNodeIdentifier(getIdentifier()); - } + @Override + public NodeToNormalizedNodeBuilder getChild( + final PathArgument child) { + return byArg.get(child); + } - @Override - public NormalizedNode createDefault(final PathArgument currentArg) { - return Builders.choiceBuilder().withNodeIdentifier(getIdentifier()) - .build(); - } - } - - public static NodeToNormalizedNodeBuilder fromSchemaAndPathArgument( - final DataNodeContainer schema, final QName child) { - DataSchemaNode potential = schema.getDataChildByName(child); - if (potential == null) { - Iterable choices = - FluentIterable.from(schema.getChildNodes()).filter( - org.opendaylight.yangtools.yang.model.api.ChoiceNode.class); - potential = findChoice(choices, child); - } - if (potential == null) { - if (logger.isTraceEnabled()) { - logger.trace("BAD CHILD = {}", child.toString()); - } - } + @Override + public NodeToNormalizedNodeBuilder getChild(final QName child) { + return byQName.get(child); + } - checkArgument(potential != null, - "Supplied QName %s is not valid according to schema %s", child, schema); - if ((schema instanceof DataSchemaNode) - && !((DataSchemaNode) schema).isAugmenting() - && potential.isAugmenting()) { - return fromAugmentation(schema, (AugmentationTarget) schema, potential); - } - return fromDataSchemaNode(potential); - } - - /** - * Given a bunch of choice nodes and a the name of child find a choice node for that child which - * has a non-null value - * - * @param choices - * @param child - * @return - */ - private static org.opendaylight.yangtools.yang.model.api.ChoiceNode findChoice( - final Iterable choices, - final QName child) { - org.opendaylight.yangtools.yang.model.api.ChoiceNode foundChoice = null; - choiceLoop: for (org.opendaylight.yangtools.yang.model.api.ChoiceNode choice : choices) { - for (ChoiceCaseNode caze : choice.getCases()) { - if (caze.getDataChildByName(child) != null) { - foundChoice = choice; - break choiceLoop; - } - } - } - return foundChoice; - } - - - /** - * Create an AugmentationIdentifier based on the AugmentationSchema - * - * @param augmentation - * @return - */ - public static AugmentationIdentifier augmentationIdentifierFrom( - final AugmentationSchema augmentation) { - ImmutableSet.Builder potentialChildren = ImmutableSet.builder(); - for (DataSchemaNode child : augmentation.getChildNodes()) { - potentialChildren.add(child.getQName()); - } - return new AugmentationIdentifier(null, potentialChildren.build()); - } - - /** - * Create an AugmentationNormalization based on the schema of the DataContainer, the - * AugmentationTarget and the potential schema node - * - * @param schema - * @param augments - * @param potential - * @return - */ - private static AugmentationNormalization fromAugmentation( - final DataNodeContainer schema, final AugmentationTarget augments, - final DataSchemaNode potential) { - AugmentationSchema augmentation = null; - for (AugmentationSchema aug : augments.getAvailableAugmentations()) { - DataSchemaNode child = aug.getDataChildByName(potential.getQName()); - if (child != null) { - augmentation = aug; - break; - } + @Override + protected NormalizedNodeContainerBuilder createBuilder( + final Node node) { + return Builders.choiceBuilder().withNodeIdentifier(getIdentifier()); + } + @Override + public NormalizedNode createDefault( + final PathArgument currentArg) { + return Builders.choiceBuilder().withNodeIdentifier(getIdentifier()) + .build(); + } } - if (augmentation != null) { - return new AugmentationNormalization(augmentation, schema); - } else { - return null; + + /** + * Find an appropriate NormalizedNodeBuilder using both the schema and the + * Path Argument + * + * @param schema + * @param child + * @return + */ + public static NodeToNormalizedNodeBuilder fromSchemaAndPathArgument( + final DataNodeContainer schema, final QName child) { + DataSchemaNode potential = schema.getDataChildByName(child); + if (potential == null) { + Iterable + choices = + FluentIterable.from(schema.getChildNodes()).filter( + org.opendaylight.yangtools.yang.model.api.ChoiceNode.class); + potential = findChoice(choices, child); + } + if (potential == null) { + if (logger.isTraceEnabled()) { + logger.trace("BAD CHILD = {}", child.toString()); + } + } + + checkArgument(potential != null, + "Supplied QName %s is not valid according to schema %s", child, + schema); + + // If the schema in an instance of DataSchemaNode and the potential + // is augmenting something then there is a chance that this may be + // and augmentation node + if ((schema instanceof DataSchemaNode) + && potential.isAugmenting()) { + + AugmentationNormalization augmentation = + fromAugmentation(schema, (AugmentationTarget) schema, + potential); + + // If an augmentation normalization (builder) is not found then + // we fall through to the regular processing + if(augmentation != null){ + return augmentation; + } + } + return fromDataSchemaNode(potential); + } + + /** + * Given a bunch of choice nodes and a the name of child find a choice node for that child which + * has a non-null value + * + * @param choices + * @param child + * @return + */ + private static org.opendaylight.yangtools.yang.model.api.ChoiceNode findChoice( + final Iterable choices, + final QName child) { + org.opendaylight.yangtools.yang.model.api.ChoiceNode foundChoice = null; + choiceLoop: + for (org.opendaylight.yangtools.yang.model.api.ChoiceNode choice : choices) { + for (ChoiceCaseNode caze : choice.getCases()) { + if (caze.getDataChildByName(child) != null) { + foundChoice = choice; + break choiceLoop; + } + } + } + return foundChoice; } - } - - /** - * - * @param schema - * @param child - * @return - */ - private static NodeToNormalizedNodeBuilder fromSchema( - final DataNodeContainer schema, final PathArgument child) { - if (child instanceof AugmentationIdentifier) { - return fromSchemaAndPathArgument(schema, ((AugmentationIdentifier) child) - .getPossibleChildNames().iterator().next()); + + + /** + * Create an AugmentationIdentifier based on the AugmentationSchema + * + * @param augmentation + * @return + */ + public static AugmentationIdentifier augmentationIdentifierFrom( + final AugmentationSchema augmentation) { + ImmutableSet.Builder potentialChildren = ImmutableSet.builder(); + for (DataSchemaNode child : augmentation.getChildNodes()) { + potentialChildren.add(child.getQName()); + } + return new AugmentationIdentifier(potentialChildren.build()); + } + + /** + * Create an AugmentationNormalization based on the schema of the DataContainer, the + * AugmentationTarget and the potential schema node + * + * @param schema + * @param augments + * @param potential + * @return + */ + private static AugmentationNormalization fromAugmentation( + final DataNodeContainer schema, final AugmentationTarget augments, + final DataSchemaNode potential) { + AugmentationSchema augmentation = null; + for (AugmentationSchema aug : augments.getAvailableAugmentations()) { + DataSchemaNode child = aug.getDataChildByName(potential.getQName()); + if (child != null) { + augmentation = aug; + break; + } + + } + if (augmentation != null) { + return new AugmentationNormalization(augmentation, schema); + } else { + return null; + } } - return fromSchemaAndPathArgument(schema, child.getNodeType()); - } - - public static NodeToNormalizedNodeBuilder fromDataSchemaNode( - final DataSchemaNode potential) { - if (potential instanceof ContainerSchemaNode) { - return new ContainerNormalization((ContainerSchemaNode) potential); - } else if (potential instanceof ListSchemaNode) { - return new ListMixinNormalization((ListSchemaNode) potential); - } else if (potential instanceof LeafSchemaNode) { - return new LeafNormalization(new NodeIdentifier(potential.getQName())); - } else if (potential instanceof org.opendaylight.yangtools.yang.model.api.ChoiceNode) { - return new ChoiceNodeNormalization( - (org.opendaylight.yangtools.yang.model.api.ChoiceNode) potential); - } else if (potential instanceof LeafListSchemaNode) { - return new LeafListMixinNormalization((LeafListSchemaNode) potential); + + /** + * @param schema + * @param child + * @return + */ + private static NodeToNormalizedNodeBuilder fromSchema( + final DataNodeContainer schema, final PathArgument child) { + if (child instanceof AugmentationIdentifier) { + QName childQName = ((AugmentationIdentifier) child) + .getPossibleChildNames().iterator().next(); + + return fromSchemaAndPathArgument(schema, childQName); + } + return fromSchemaAndPathArgument(schema, child.getNodeType()); + } + + public static NodeToNormalizedNodeBuilder fromDataSchemaNode( + final DataSchemaNode potential) { + if (potential instanceof ContainerSchemaNode) { + return new ContainerNormalization((ContainerSchemaNode) potential); + } else if (potential instanceof ListSchemaNode) { + return new ListMixinNormalization((ListSchemaNode) potential); + } else if (potential instanceof LeafSchemaNode) { + return new LeafNormalization((LeafSchemaNode) potential, + new NodeIdentifier(potential.getQName())); + } else if (potential instanceof org.opendaylight.yangtools.yang.model.api.ChoiceNode) { + return new ChoiceNodeNormalization( + (org.opendaylight.yangtools.yang.model.api.ChoiceNode) potential); + } else if (potential instanceof LeafListSchemaNode) { + return new LeafListMixinNormalization( + (LeafListSchemaNode) potential); + } + return null; } - return null; - } - public static NodeToNormalizedNodeBuilder from(final SchemaContext ctx) { - return new ContainerNormalization(ctx); - } + public static NodeToNormalizedNodeBuilder from(final SchemaContext ctx) { + return new ContainerNormalization(ctx); + } - public abstract NormalizedNode createDefault(PathArgument currentArg); + public abstract NormalizedNode createDefault(PathArgument currentArg); } diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NodeValueCodec.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NodeValueCodec.java new file mode 100644 index 0000000000..7b6f5c46d2 --- /dev/null +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NodeValueCodec.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.node; + +import org.opendaylight.controller.cluster.datastore.node.utils.QNameFactory; +import org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils; +import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; +import org.opendaylight.yangtools.yang.data.api.codec.BitsCodec; +import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec; +import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; +import org.opendaylight.yangtools.yang.model.api.TypeDefinition; +import org.opendaylight.yangtools.yang.model.util.IdentityrefType; +import org.opendaylight.yangtools.yang.model.util.InstanceIdentifier; +import org.opendaylight.yangtools.yang.model.util.Leafref; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class NodeValueCodec { + protected static final Logger logger = LoggerFactory + .getLogger(NodeValueCodec.class); + + public static Object toTypeSafeValue(DataSchemaNode schema, TypeDefinition type, NormalizedNodeMessages.Node node){ + + String value = node.getValue(); + + if(schema != null && value != null){ + TypeDefinition baseType = type; + + while (baseType.getBaseType() != null) { + baseType = baseType.getBaseType(); + } + + TypeDefinitionAwareCodec> codec = + TypeDefinitionAwareCodec.from(type); + + if(codec instanceof BitsCodec){ + if(value.contains("[]")){ + value = ""; + } else { + value = value.replace("[", ""); + value = value.replace("]", ""); + value = value.replace(",", " "); + } + } + + if (codec != null) { + return codec.deserialize(value); + } else if(baseType instanceof Leafref) { + return value; + } else if(baseType instanceof IdentityrefType) { + return QNameFactory.create(value); + } else if(baseType instanceof InstanceIdentifier) { + return InstanceIdentifierUtils.fromSerializable(node.getInstanceIdentifierValue()); + } else { + logger.error("Could not figure out how to transform value " + value + " for schemaType " + type); + } + } + + return value; + } +} diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodec.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodec.java index aca94359b7..fc4b3954c5 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodec.java +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodec.java @@ -37,7 +37,7 @@ public class NormalizedNodeToNodeCodec { public NormalizedNode decode(YangInstanceIdentifier id, NormalizedNodeMessages.Node node){ NodeToNormalizedNodeBuilder currentOp = NodeToNormalizedNodeBuilder.from(ctx); - for(YangInstanceIdentifier.PathArgument pathArgument : id.getPath()){ + for(YangInstanceIdentifier.PathArgument pathArgument : id.getPathArguments()){ currentOp = currentOp.getChild(pathArgument); } @@ -53,15 +53,11 @@ public class NormalizedNodeToNodeCodec { nodeType = pathArgument.getNodeType(); } } - try { - if((node != null)&& (!node.getType().isEmpty())){ - return currentOp.normalize(nodeType, node); - }else{ - return null; - } - } catch(RuntimeException e){ - throw e; - } + if((node != null)&& (!node.getType().isEmpty())){ + return currentOp.normalize(nodeType, node); + } else{ + return null; + } } diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToProtocolBufferNode.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToProtocolBufferNode.java index f8ec57be8f..fb15312665 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToProtocolBufferNode.java +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToProtocolBufferNode.java @@ -1,5 +1,7 @@ package org.opendaylight.controller.cluster.datastore.node; +import com.google.common.base.Preconditions; +import org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils; import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node; import org.opendaylight.yangtools.yang.common.QName; @@ -24,177 +26,229 @@ import java.util.Map; /** * NormalizedNodeToProtocolBufferNode walks the NormalizedNode tree converting it to the * NormalizedMessage.Node - * + *

* {@link org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode } is a tree like structure that provides a generic structure for a yang data * model - * - * */ public class NormalizedNodeToProtocolBufferNode { - private final Node.Builder builderRoot; - private NormalizedNodeMessages.Container container; + private final Node.Builder builderRoot; + private NormalizedNodeMessages.Container container; - public NormalizedNodeToProtocolBufferNode() { + public NormalizedNodeToProtocolBufferNode() { - builderRoot = Node.newBuilder(); - } - - public void encode(String parentPath, NormalizedNode normalizedNode) { - if (parentPath == null) { - parentPath = ""; + builderRoot = Node.newBuilder(); } - NormalizedNodeMessages.Container.Builder containerBuilder = - NormalizedNodeMessages.Container.newBuilder(); + public void encode(String parentPath, NormalizedNode normalizedNode) { + if (parentPath == null) { + parentPath = ""; + } + + NormalizedNodeMessages.Container.Builder containerBuilder = + NormalizedNodeMessages.Container.newBuilder(); - if(normalizedNode != null) { + if (normalizedNode != null) { - navigateNormalizedNode(0, parentPath, normalizedNode, builderRoot); - // here we need to put back the Node Tree in Container + navigateNormalizedNode(0, parentPath, normalizedNode, builderRoot); + // here we need to put back the Node Tree in Container - container= containerBuilder.setParentPath(parentPath).setNormalizedNode( - builderRoot.build()).build(); - }else { - //this can happen when an attempt was made to read from datastore and normalized node was null. - container = containerBuilder.setParentPath(parentPath).build(); + container = + containerBuilder.setParentPath(parentPath).setNormalizedNode( + builderRoot.build()).build(); + } else { + //this can happen when an attempt was made to read from datastore and normalized node was null. + container = containerBuilder.setParentPath(parentPath).build(); + + } } - } + private void navigateDataContainerNode(int level, final String parentPath, + final DataContainerNode dataContainerNode, + Node.Builder builderParent) { + + String newParentPath = + parentPath + "/" + dataContainerNode.getIdentifier().toString(); + String type = getDataContainerType(dataContainerNode).getSimpleName(); + builderParent.setPath(dataContainerNode.getIdentifier().toString()) + .setType(type); + + final Iterable> + value = + dataContainerNode.getValue(); + for (NormalizedNode node : value) { + Node.Builder builderChild = Node.newBuilder(); + if (node instanceof MixinNode + && node instanceof NormalizedNodeContainer) { + + navigateNormalizedNodeContainerMixin(level, newParentPath, + (NormalizedNodeContainer) node, builderChild); + } else { + navigateNormalizedNode(level, newParentPath, node, + builderChild); + } + builderParent.addChild(builderChild); + } + } - private void navigateDataContainerNode(int level,final String parentPath, - final DataContainerNode dataContainerNode, Node.Builder builderParent) { + private Class getDataContainerType( + NormalizedNodeContainer dataContainerNode) { + if (dataContainerNode instanceof ChoiceNode) { + return ChoiceNode.class; + } else if (dataContainerNode instanceof AugmentationNode) { + return AugmentationNode.class; + } else if (dataContainerNode instanceof ContainerNode) { + return ContainerNode.class; + } else if (dataContainerNode instanceof MapEntryNode) { + return MapEntryNode.class; + } else if (dataContainerNode instanceof UnkeyedListEntryNode) { + return UnkeyedListEntryNode.class; + } else if (dataContainerNode instanceof MapNode) { + return MapNode.class; + } else if (dataContainerNode instanceof LeafSetNode) { + return LeafSetNode.class; + } + throw new IllegalArgumentException( + "could not find the data container node type " + + dataContainerNode.toString() + ); + } - String newParentPath = parentPath + "/" + dataContainerNode.getIdentifier().toString(); - String type = getDataContainerType(dataContainerNode).getSimpleName(); - builderParent.setPath(dataContainerNode.getIdentifier().toString()) - .setType(type); + private void navigateNormalizedNodeContainerMixin(int level, + final String parentPath, + NormalizedNodeContainer node, Node.Builder builderParent) { + String newParentPath = + parentPath + "/" + node.getIdentifier().toString(); - final Iterable> value = - dataContainerNode.getValue(); - for (NormalizedNode node : value) { - Node.Builder builderChild = Node.newBuilder(); - if (node instanceof MixinNode && node instanceof NormalizedNodeContainer) { + builderParent.setPath(node.getIdentifier().toString()).setType( + this.getDataContainerType(node).getSimpleName()); + final Iterable> value = node.getValue(); + for (NormalizedNode normalizedNode : value) { + // child node builder + Node.Builder builderChild = Node.newBuilder(); + if (normalizedNode instanceof MixinNode + && normalizedNode instanceof NormalizedNodeContainer) { + navigateNormalizedNodeContainerMixin(level + 1, newParentPath, + (NormalizedNodeContainer) normalizedNode, builderChild); + } else { + navigateNormalizedNode(level, newParentPath, normalizedNode, + builderChild); + } + builderParent.addChild(builderChild); - navigateNormalizedNodeContainerMixin(level, newParentPath, - (NormalizedNodeContainer) node, builderChild); - } else { - navigateNormalizedNode(level, newParentPath,node, builderChild); - } - builderParent.addChild(builderChild); - } + } - } - - private Class getDataContainerType( - NormalizedNodeContainer dataContainerNode) { - if (dataContainerNode instanceof ChoiceNode) { - return ChoiceNode.class; - } else if (dataContainerNode instanceof AugmentationNode) { - return AugmentationNode.class; - } else if (dataContainerNode instanceof ContainerNode) { - return ContainerNode.class; - } else if (dataContainerNode instanceof MapEntryNode) { - return MapEntryNode.class; - } else if (dataContainerNode instanceof UnkeyedListEntryNode) { - return UnkeyedListEntryNode.class; - } else if (dataContainerNode instanceof MapNode) { - return MapNode.class; - } else if (dataContainerNode instanceof LeafSetNode){ - return LeafSetNode.class; - } - throw new IllegalArgumentException( - "could not find the data container node type " - + dataContainerNode.toString()); - } - - private void navigateNormalizedNodeContainerMixin(int level, final String parentPath, - NormalizedNodeContainer node, Node.Builder builderParent) { - String newParentPath = parentPath + "/" + node.getIdentifier().toString(); - - builderParent.setPath(node.getIdentifier().toString()).setType( - this.getDataContainerType(node).getSimpleName()); - final Iterable> value = node.getValue(); - for (NormalizedNode normalizedNode : value) { - // child node builder - Node.Builder builderChild = Node.newBuilder(); - if (normalizedNode instanceof MixinNode - && normalizedNode instanceof NormalizedNodeContainer) { - navigateNormalizedNodeContainerMixin(level + 1,newParentPath, - (NormalizedNodeContainer) normalizedNode, builderChild); - } else { - navigateNormalizedNode(level,newParentPath, normalizedNode, builderChild); - } - builderParent.addChild(builderChild); - } + } - } + private void navigateNormalizedNode(int level, + String parentPath, NormalizedNode normalizedNode, + Node.Builder builderParent) { + if (normalizedNode instanceof DataContainerNode) { - private void navigateNormalizedNode(int level, - String parentPath,NormalizedNode normalizedNode, Node.Builder builderParent) { + final DataContainerNode dataContainerNode = + (DataContainerNode) normalizedNode; - if (normalizedNode instanceof DataContainerNode) { + navigateDataContainerNode(level + 1, parentPath, dataContainerNode, + builderParent); + } else if (normalizedNode instanceof MixinNode + && normalizedNode instanceof NormalizedNodeContainer) { - final DataContainerNode dataContainerNode = - (DataContainerNode) normalizedNode; + navigateNormalizedNodeContainerMixin(level, parentPath, + (NormalizedNodeContainer) normalizedNode, + builderParent); + } else { + if (normalizedNode instanceof LeafNode) { + buildLeafNode(parentPath, normalizedNode, builderParent); + } else if (normalizedNode instanceof LeafSetEntryNode) { + buildLeafSetEntryNode(parentPath, normalizedNode, + builderParent); + } - navigateDataContainerNode(level + 1, parentPath,dataContainerNode, builderParent); - } else { + } - if (normalizedNode instanceof LeafNode) { - buildLeafNode(parentPath,normalizedNode, builderParent); - } else if (normalizedNode instanceof LeafSetEntryNode) { - buildLeafSetEntryNode(parentPath,normalizedNode,builderParent); - } + } + private void buildLeafSetEntryNode(String parentPath, + NormalizedNode normalizedNode, + Node.Builder builderParent) { + String path = + parentPath + "/" + normalizedNode.getIdentifier().toString(); + LeafSetEntryNode leafSetEntryNode = (LeafSetEntryNode) normalizedNode; + Map attributes = leafSetEntryNode.getAttributes(); + if (!attributes.isEmpty()) { + NormalizedNodeMessages.Attribute.Builder builder = null; + for (Map.Entry attribute : attributes.entrySet()) { + builder = NormalizedNodeMessages.Attribute.newBuilder(); + + builder + .setName(attribute.getKey().toString()) + .setValue(normalizedNode.getValue().toString()); + + builderParent.addAttributes(builder.build()); + } + } + buildNodeValue(normalizedNode, builderParent); } - } - - private void buildLeafSetEntryNode(String parentPath,NormalizedNode normalizedNode, - Node.Builder builderParent) { - String path = parentPath + "/" + normalizedNode.getIdentifier().toString(); - LeafSetEntryNode leafSetEntryNode = (LeafSetEntryNode) normalizedNode; - Map attributes = leafSetEntryNode.getAttributes(); - if (!attributes.isEmpty()) { - NormalizedNodeMessages.Attribute.Builder builder = null; - for (Map.Entry attribute : attributes.entrySet()) { - builder = NormalizedNodeMessages.Attribute.newBuilder(); - builder.setName(attribute.getKey().toString()).setValue( - normalizedNode.getValue().toString()); - builderParent.addAttributes(builder.build()); - } + private void buildLeafNode(String parentPath, + NormalizedNode normalizedNode, + Node.Builder builderParent) { + Preconditions.checkNotNull(parentPath); + Preconditions.checkNotNull(normalizedNode); + String path = + parentPath + "/" + normalizedNode.getIdentifier().toString(); + LeafNode leafNode = (LeafNode) normalizedNode; + Map attributes = leafNode.getAttributes(); + if (!attributes.isEmpty()) { + NormalizedNodeMessages.Attribute.Builder builder = null; + for (Map.Entry attribute : attributes.entrySet()) { + builder = NormalizedNodeMessages.Attribute.newBuilder(); + builder + .setName(attribute.getKey().toString()) + .setValue(attribute.getValue().toString()); + + builderParent.addAttributes(builder.build()); + } + } + + Object value = normalizedNode.getValue(); + if (value == null) { + builderParent + .setPath(normalizedNode.getIdentifier().toString()) + .setType(LeafNode.class.getSimpleName()) + .setValueType(String.class.getSimpleName()) + .setValue(""); + } else { + buildNodeValue(normalizedNode, builderParent); + } } - builderParent.setPath(normalizedNode.getIdentifier().toString()).setType( - LeafSetEntryNode.class.getSimpleName()).setValue(normalizedNode.getValue().toString()); - } - - private void buildLeafNode(String parentPath,NormalizedNode normalizedNode, - Node.Builder builderParent) { - String path = parentPath + "/" + normalizedNode.getIdentifier().toString(); - LeafNode leafNode = (LeafNode) normalizedNode; - Map attributes = leafNode.getAttributes(); - if (!attributes.isEmpty()) { - NormalizedNodeMessages.Attribute.Builder builder = null; - for (Map.Entry attribute : attributes.entrySet()) { - builder = NormalizedNodeMessages.Attribute.newBuilder(); - builder.setName(attribute.getKey().toString()).setValue( - normalizedNode.getValue().toString()); - builderParent.addAttributes(builder.build()); - } + + private void buildNodeValue(NormalizedNode normalizedNode, + Node.Builder builderParent) { + + Object value = normalizedNode.getValue(); + + builderParent + .setPath(normalizedNode.getIdentifier().toString()) + .setType(LeafNode.class.getSimpleName()) + .setValueType((value.getClass().getSimpleName())) + .setValue(value.toString()); + + if(value.getClass().equals(YangInstanceIdentifier.class)){ + builderParent.setInstanceIdentifierValue( + InstanceIdentifierUtils + .toSerializable((YangInstanceIdentifier) value)); + } } - builderParent.setPath(normalizedNode.getIdentifier().toString()).setType( - LeafNode.class.getSimpleName()).setValue(normalizedNode.getValue().toString()); - } - public NormalizedNodeMessages.Container getContainer() { - return container; - } + public NormalizedNodeMessages.Container getContainer() { + return container; + } } diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactory.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactory.java index 9669c99602..175e242a11 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactory.java +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactory.java @@ -1,6 +1,7 @@ package org.opendaylight.controller.cluster.datastore.node.utils; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; import java.util.HashMap; import java.util.Map; @@ -13,7 +14,7 @@ public class NodeIdentifierFactory { synchronized (cache){ value = cache.get(id); if(value == null) { - value = createPathArgument(id); + value = createPathArgument(id, null); cache.put(id, value); } } @@ -21,15 +22,29 @@ public class NodeIdentifierFactory { return value; } - private static YangInstanceIdentifier.PathArgument createPathArgument(String id){ + public static YangInstanceIdentifier.PathArgument getArgument(String id, DataSchemaNode schemaNode){ + YangInstanceIdentifier.PathArgument value = cache.get(id); + if(value == null){ + synchronized (cache){ + value = cache.get(id); + if(value == null) { + value = createPathArgument(id, schemaNode); + cache.put(id, value); + } + } + } + return value; + } + + public static YangInstanceIdentifier.PathArgument createPathArgument(String id, DataSchemaNode schemaNode){ final NodeIdentifierWithPredicatesGenerator - nodeIdentifierWithPredicatesGenerator = new NodeIdentifierWithPredicatesGenerator(id); + nodeIdentifierWithPredicatesGenerator = new NodeIdentifierWithPredicatesGenerator(id, schemaNode); if(nodeIdentifierWithPredicatesGenerator.matches()){ return nodeIdentifierWithPredicatesGenerator.getPathArgument(); } final NodeIdentifierWithValueGenerator - nodeWithValueGenerator = new NodeIdentifierWithValueGenerator(id); + nodeWithValueGenerator = new NodeIdentifierWithValueGenerator(id, schemaNode); if(nodeWithValueGenerator.matches()){ return nodeWithValueGenerator.getPathArgument(); } diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithPredicatesGenerator.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithPredicatesGenerator.java index 40b5c2e813..4bfcf391dd 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithPredicatesGenerator.java +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithPredicatesGenerator.java @@ -19,15 +19,16 @@ public class NodeIdentifierWithPredicatesGenerator{ private final boolean doesMatch; private final ListSchemaNode listSchemaNode; - public NodeIdentifierWithPredicatesGenerator(String id){ - this(id, null); - } - - public NodeIdentifierWithPredicatesGenerator(String id, ListSchemaNode schemaNode){ + public NodeIdentifierWithPredicatesGenerator(String id, DataSchemaNode schemaNode){ this.id = id; matcher = pattern.matcher(this.id); doesMatch = matcher.matches(); - this.listSchemaNode = schemaNode; + + if(schemaNode instanceof ListSchemaNode){ + this.listSchemaNode = (ListSchemaNode) schemaNode; + } else { + this.listSchemaNode = null; + } } diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithValueGenerator.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithValueGenerator.java index fcde679bed..b2ec5644d4 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithValueGenerator.java +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierWithValueGenerator.java @@ -1,18 +1,23 @@ package org.opendaylight.controller.cluster.datastore.node.utils; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec; +import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; +import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode; import java.util.regex.Matcher; import java.util.regex.Pattern; public class NodeIdentifierWithValueGenerator{ private final String id; - private static final Pattern pattern = Pattern.compile("(.*)\\Q[\\E(.*)\\Q]\\E"); + private final DataSchemaNode schemaNode; + private static final Pattern pattern = Pattern.compile("(.*)\\Q[\\E(.*)\\Q]\\E"); private final Matcher matcher; private final boolean doesMatch; - public NodeIdentifierWithValueGenerator(String id){ + public NodeIdentifierWithValueGenerator(String id, DataSchemaNode schemaNode){ this.id = id; + this.schemaNode = schemaNode; matcher = pattern.matcher(this.id); doesMatch = matcher.matches(); } @@ -26,6 +31,18 @@ public class NodeIdentifierWithValueGenerator{ final String value = matcher.group(2); return new YangInstanceIdentifier.NodeWithValue( - QNameFactory.create(name), value); + QNameFactory.create(name), getValue(value)); } + + private Object getValue(String value){ + if(schemaNode != null){ + if(schemaNode instanceof LeafListSchemaNode){ + return TypeDefinitionAwareCodec + .from(LeafListSchemaNode.class.cast(schemaNode).getType()).deserialize(value); + + } + } + return value; + } + } diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtils.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtils.java new file mode 100644 index 0000000000..5b459e7e7c --- /dev/null +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtils.java @@ -0,0 +1,277 @@ +package org.opendaylight.controller.cluster.datastore.util; + +import org.opendaylight.controller.cluster.datastore.node.utils.NodeIdentifierFactory; +import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * This class contains utility methods for converting an MD-SAL + * YangInstanceIdentifier to and from other representations. + *

+ * The representations convered for now are, + * + *

    + *
  • String
  • + *
  • Protocol Buffer
  • + *
+ */ +public class InstanceIdentifierUtils { + + protected static final Logger logger = LoggerFactory + .getLogger(InstanceIdentifierUtils.class); + + @Deprecated + public static YangInstanceIdentifier from(String path) { + String[] ids = path.split("/"); + + List pathArguments = + new ArrayList<>(); + for (String nodeId : ids) { + if (!"".equals(nodeId)) { + pathArguments + .add(NodeIdentifierFactory.getArgument(nodeId)); + } + } + final YangInstanceIdentifier instanceIdentifier = + YangInstanceIdentifier.create(pathArguments); + return instanceIdentifier; + } + + + /** + * Convert an MD-SAL YangInstanceIdentifier into a protocol buffer version of it + * + * @param path an MD-SAL YangInstanceIdentifier + * @return a protocol buffer version of the MD-SAL YangInstanceIdentifier + */ + public static NormalizedNodeMessages.InstanceIdentifier toSerializable(YangInstanceIdentifier path){ + NormalizedNodeMessages.InstanceIdentifier.Builder builder = + NormalizedNodeMessages.InstanceIdentifier.newBuilder(); + + try { + + for (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument pathArgument : path + .getPathArguments()) { + + String nodeType = ""; + if(!(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier)){ + nodeType = pathArgument.getNodeType().toString(); + } + + NormalizedNodeMessages.PathArgument serializablePathArgument = + NormalizedNodeMessages.PathArgument.newBuilder() + .setValue(pathArgument.toString()) + .setType(pathArgument.getClass().getSimpleName()) + .setNodeType(NormalizedNodeMessages.QName.newBuilder() + .setValue(nodeType)) + .addAllAttributes(getPathArgumentAttributes( + pathArgument)) + .build(); + + builder.addArguments(serializablePathArgument); + } + + } catch(Exception e){ + logger.error("An exception occurred", e); + } + return builder.build(); + } + + + /** + * Convert a protocol buffer version of the MD-SAL YangInstanceIdentifier into + * the MD-SAL version of the YangInstanceIdentifier + * + * @param path a protocol buffer version of the MD-SAL YangInstanceIdentifier + * @return an MD-SAL YangInstanceIdentifier + */ + public static YangInstanceIdentifier fromSerializable(NormalizedNodeMessages.InstanceIdentifier path){ + + List pathArguments = + new ArrayList<>(); + + for(NormalizedNodeMessages.PathArgument pathArgument : path.getArgumentsList()){ + + pathArguments + .add(parsePathArgument(pathArgument)); + + } + + final YangInstanceIdentifier instanceIdentifier = YangInstanceIdentifier.create(pathArguments); + + return instanceIdentifier; + } + + /** + * Take the various attributes of a PathArgument and package them up as + * protocol buffer attributes. + *

+ * + * PathArguments have 4 subtypes and each of the various subtypes have + * different attributes + *

    + *
  • + * NodeIdentifier is the most basic PathArgument. It is used for + * ContainerNode, LeafNode etc and has no attributes + *
  • + *
  • + * NodeWithValue has only a single attribute. It is used for + * LeafListEntryNodes and the attribute it contains is the value + * of the entry + *
  • + *
  • + * NodeIdentifierWithPredicates has a map of attributes. + * It is used to represent a ListItemNode. Each entry + * in the map of attributes represents the key and value of the + * keys in that entry. + *
  • + *
  • + * AugmentationIdentifier has a list of unnamed attributes. Each + * attribute represents the possible children that can go within + * an augmentation entry. + *
  • + *
+ * @param pathArgument + * @return + */ + private static Iterable getPathArgumentAttributes( + YangInstanceIdentifier.PathArgument pathArgument) { + List attributes = new ArrayList<>(); + + + + if (pathArgument instanceof YangInstanceIdentifier.NodeWithValue) { + YangInstanceIdentifier.NodeWithValue identifier + = (YangInstanceIdentifier.NodeWithValue) pathArgument; + + NormalizedNodeMessages.Attribute attribute = + NormalizedNodeMessages.Attribute.newBuilder() + .setName("name") + .setValue(identifier.getValue().toString()) + .setType(identifier.getValue().getClass().getSimpleName()) + .build(); + + attributes.add(attribute); + } else if (pathArgument instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates) { + YangInstanceIdentifier.NodeIdentifierWithPredicates identifier + = (YangInstanceIdentifier.NodeIdentifierWithPredicates) pathArgument; + + for (QName key : identifier.getKeyValues().keySet()) { + Object value = identifier.getKeyValues().get(key); + NormalizedNodeMessages.Attribute attribute = + NormalizedNodeMessages.Attribute.newBuilder() + .setName(key.toString()) + .setValue(value.toString()) + .setType(value.getClass().getSimpleName()) + .build(); + + attributes.add(attribute); + + } + + } else if(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier) { + YangInstanceIdentifier.AugmentationIdentifier identifier + = (YangInstanceIdentifier.AugmentationIdentifier) pathArgument; + + for (QName key : identifier.getPossibleChildNames()) { + Object value = key; + NormalizedNodeMessages.Attribute attribute = + NormalizedNodeMessages.Attribute.newBuilder() + .setName(key.toString()) + .setValue(value.toString()) + .setType(value.getClass().getSimpleName()) + .build(); + + attributes.add(attribute); + + } + } + + return attributes; + } + + + /** + * Parse a protocol buffer PathArgument and return an MD-SAL PathArgument + * + * @param pathArgument protocol buffer PathArgument + * @return MD-SAL PathArgument + */ + private static YangInstanceIdentifier.PathArgument parsePathArgument(NormalizedNodeMessages.PathArgument pathArgument) { + if (YangInstanceIdentifier.NodeWithValue.class.getSimpleName().equals(pathArgument.getType())) { + + YangInstanceIdentifier.NodeWithValue nodeWithValue = + new YangInstanceIdentifier.NodeWithValue( + QName.create(pathArgument.getNodeType().getValue()), + parseAttribute(pathArgument.getAttributes(0))); + + return nodeWithValue; + + } else if(YangInstanceIdentifier.NodeIdentifierWithPredicates.class.getSimpleName().equals(pathArgument.getType())){ + + YangInstanceIdentifier.NodeIdentifierWithPredicates + nodeIdentifierWithPredicates = + new YangInstanceIdentifier.NodeIdentifierWithPredicates( + QName.create(pathArgument.getNodeType().getValue()), toAttributesMap(pathArgument.getAttributesList())); + + return nodeIdentifierWithPredicates; + + } else if(YangInstanceIdentifier.AugmentationIdentifier.class.getSimpleName().equals(pathArgument.getType())){ + + Set qNameSet = new HashSet<>(); + + for(NormalizedNodeMessages.Attribute attribute : pathArgument.getAttributesList()){ + qNameSet.add(QName.create(attribute.getValue())); + } + + return new YangInstanceIdentifier.AugmentationIdentifier(qNameSet); + } + + return NodeIdentifierFactory.getArgument(pathArgument.getValue()); + } + + private static Map toAttributesMap( + List attributesList) { + + Map map = new HashMap<>(); + + for(NormalizedNodeMessages.Attribute attribute : attributesList){ + String name = attribute.getName(); + Object value = parseAttribute(attribute); + + map.put(QName.create(name), value); + } + + return map; + } + + /** + * FIXME: This method only covers a subset of values that may go in an InstanceIdentifier + * + * @param attribute + * @return + */ + private static Object parseAttribute(NormalizedNodeMessages.Attribute attribute){ + if(Short.class.getSimpleName().equals(attribute.getType())) { + return Short.parseShort(attribute.getValue()); + } else if(Long.class.getSimpleName().equals(attribute.getType())){ + return Long.parseLong(attribute.getValue()); + } else if(Boolean.class.getSimpleName().equals(attribute.getType())){ + return Boolean.parseBoolean(attribute.getValue()); + } else if(Integer.class.getSimpleName().equals(attribute.getType())){ + return Integer.parseInt(attribute.getValue()); + } + + return attribute.getValue(); + } +} diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/common/NormalizedNodeMessages.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/common/NormalizedNodeMessages.java index 61193abe71..35c2940be3 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/common/NormalizedNodeMessages.java +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/common/NormalizedNodeMessages.java @@ -40,6 +40,21 @@ public final class NormalizedNodeMessages { */ com.google.protobuf.ByteString getValueBytes(); + + // optional string type = 3; + /** + * optional string type = 3; + */ + boolean hasType(); + /** + * optional string type = 3; + */ + java.lang.String getType(); + /** + * optional string type = 3; + */ + com.google.protobuf.ByteString + getTypeBytes(); } /** * Protobuf type {@code org.opendaylight.controller.mdsal.Attribute} @@ -102,6 +117,11 @@ public final class NormalizedNodeMessages { value_ = input.readBytes(); break; } + case 26: { + bitField0_ |= 0x00000004; + type_ = input.readBytes(); + break; + } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { @@ -228,9 +248,53 @@ public final class NormalizedNodeMessages { } } + // optional string type = 3; + public static final int TYPE_FIELD_NUMBER = 3; + private java.lang.Object type_; + /** + * optional string type = 3; + */ + public boolean hasType() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional string type = 3; + */ + public java.lang.String getType() { + java.lang.Object ref = type_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + type_ = s; + } + return s; + } + } + /** + * optional string type = 3; + */ + public com.google.protobuf.ByteString + getTypeBytes() { + java.lang.Object ref = type_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + type_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private void initFields() { name_ = ""; value_ = ""; + type_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -254,6 +318,9 @@ public final class NormalizedNodeMessages { if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getValueBytes()); } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getTypeBytes()); + } getUnknownFields().writeTo(output); } @@ -271,6 +338,10 @@ public final class NormalizedNodeMessages { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getValueBytes()); } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getTypeBytes()); + } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; @@ -391,6 +462,8 @@ public final class NormalizedNodeMessages { bitField0_ = (bitField0_ & ~0x00000001); value_ = ""; bitField0_ = (bitField0_ & ~0x00000002); + type_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); return this; } @@ -427,6 +500,10 @@ public final class NormalizedNodeMessages { to_bitField0_ |= 0x00000002; } result.value_ = value_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.type_ = type_; result.bitField0_ = to_bitField0_; onBuilt(); return result; @@ -453,6 +530,11 @@ public final class NormalizedNodeMessages { value_ = other.value_; onChanged(); } + if (other.hasType()) { + bitField0_ |= 0x00000004; + type_ = other.type_; + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); return this; } @@ -632,6 +714,80 @@ public final class NormalizedNodeMessages { return this; } + // optional string type = 3; + private java.lang.Object type_ = ""; + /** + * optional string type = 3; + */ + public boolean hasType() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional string type = 3; + */ + public java.lang.String getType() { + java.lang.Object ref = type_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + type_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string type = 3; + */ + public com.google.protobuf.ByteString + getTypeBytes() { + java.lang.Object ref = type_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + type_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string type = 3; + */ + public Builder setType( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + type_ = value; + onChanged(); + return this; + } + /** + * optional string type = 3; + */ + public Builder clearType() { + bitField0_ = (bitField0_ & ~0x00000004); + type_ = getDefaultInstance().getType(); + onChanged(); + return this; + } + /** + * optional string type = 3; + */ + public Builder setTypeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + type_ = value; + onChanged(); + return this; + } + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.Attribute) } @@ -643,123 +799,43 @@ public final class NormalizedNodeMessages { // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.Attribute) } - public interface NodeOrBuilder + public interface QNameOrBuilder extends com.google.protobuf.MessageOrBuilder { - // required string path = 1; - /** - * required string path = 1; - */ - boolean hasPath(); - /** - * required string path = 1; - */ - java.lang.String getPath(); - /** - * required string path = 1; - */ - com.google.protobuf.ByteString - getPathBytes(); - - // optional string type = 2; - /** - * optional string type = 2; - */ - boolean hasType(); - /** - * optional string type = 2; - */ - java.lang.String getType(); - /** - * optional string type = 2; - */ - com.google.protobuf.ByteString - getTypeBytes(); - - // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - java.util.List - getAttributesList(); - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index); - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - int getAttributesCount(); - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - java.util.List - getAttributesOrBuilderList(); - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - 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 = 4; - */ - java.util.List - getChildList(); - /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; - */ - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getChild(int index); - /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; - */ - int getChildCount(); - /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; - */ - java.util.List - getChildOrBuilderList(); - /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; - */ - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getChildOrBuilder( - int index); - - // optional string value = 5; + // required string value = 1; /** - * optional string value = 5; + * required string value = 1; */ boolean hasValue(); /** - * optional string value = 5; + * required string value = 1; */ java.lang.String getValue(); /** - * optional string value = 5; + * required string value = 1; */ com.google.protobuf.ByteString getValueBytes(); } /** - * Protobuf type {@code org.opendaylight.controller.mdsal.Node} + * Protobuf type {@code org.opendaylight.controller.mdsal.QName} */ - public static final class Node extends + public static final class QName extends com.google.protobuf.GeneratedMessage - implements NodeOrBuilder { - // Use Node.newBuilder() to construct. - private Node(com.google.protobuf.GeneratedMessage.Builder builder) { + implements QNameOrBuilder { + // Use QName.newBuilder() to construct. + private QName(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } - private Node(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + private QName(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - private static final Node defaultInstance; - public static Node getDefaultInstance() { + private static final QName defaultInstance; + public static QName getDefaultInstance() { return defaultInstance; } - public Node getDefaultInstanceForType() { + public QName getDefaultInstanceForType() { return defaultInstance; } @@ -769,7 +845,7 @@ public final class NormalizedNodeMessages { getUnknownFields() { return this.unknownFields; } - private Node( + private QName( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { @@ -794,32 +870,6 @@ public final class NormalizedNodeMessages { } case 10: { bitField0_ |= 0x00000001; - path_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - type_ = input.readBytes(); - break; - } - case 26: { - if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - attributes_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000004; - } - attributes_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.PARSER, extensionRegistry)); - break; - } - case 34: { - if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - child_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000008; - } - child_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry)); - break; - } - case 42: { - bitField0_ |= 0x00000004; value_ = input.readBytes(); break; } @@ -831,213 +881,49 @@ public final class NormalizedNodeMessages { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { - if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - attributes_ = java.util.Collections.unmodifiableList(attributes_); - } - if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - child_ = java.util.Collections.unmodifiableList(child_); - } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_descriptor; + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_QName_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_fieldAccessorTable + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_QName_fieldAccessorTable .ensureFieldAccessorsInitialized( - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder.class); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder.class); } - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Node parsePartialFrom( + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public QName parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new Node(input, extensionRegistry); + return new QName(input, extensionRegistry); } }; @java.lang.Override - public com.google.protobuf.Parser getParserForType() { + public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; - // required string path = 1; - public static final int PATH_FIELD_NUMBER = 1; - private java.lang.Object path_; - /** - * required string path = 1; - */ - public boolean hasPath() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required string path = 1; - */ - public java.lang.String getPath() { - java.lang.Object ref = path_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - path_ = s; - } - return s; - } - } - /** - * required string path = 1; - */ - public com.google.protobuf.ByteString - getPathBytes() { - java.lang.Object ref = path_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - path_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional string type = 2; - public static final int TYPE_FIELD_NUMBER = 2; - private java.lang.Object type_; - /** - * optional string type = 2; - */ - public boolean hasType() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional string type = 2; - */ - public java.lang.String getType() { - java.lang.Object ref = type_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - type_ = s; - } - return s; - } - } - /** - * optional string type = 2; - */ - public com.google.protobuf.ByteString - getTypeBytes() { - java.lang.Object ref = type_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - type_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - public static final int ATTRIBUTES_FIELD_NUMBER = 3; - private java.util.List attributes_; - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - public java.util.List getAttributesList() { - return attributes_; - } - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - public java.util.List - getAttributesOrBuilderList() { - return attributes_; - } - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - public int getAttributesCount() { - return attributes_.size(); - } - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index) { - return attributes_.get(index); - } - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder( - int index) { - return attributes_.get(index); - } - - // repeated .org.opendaylight.controller.mdsal.Node child = 4; - public static final int CHILD_FIELD_NUMBER = 4; - private java.util.List child_; - /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; - */ - public java.util.List getChildList() { - return child_; - } - /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; - */ - public java.util.List - getChildOrBuilderList() { - return child_; - } - /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; - */ - public int getChildCount() { - return child_.size(); - } - /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; - */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getChild(int index) { - return child_.get(index); - } - /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; - */ - 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; + // required string value = 1; + public static final int VALUE_FIELD_NUMBER = 1; private java.lang.Object value_; /** - * optional string value = 5; + * required string value = 1; */ public boolean hasValue() { - return ((bitField0_ & 0x00000004) == 0x00000004); + return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * optional string value = 5; + * required string value = 1; */ public java.lang.String getValue() { java.lang.Object ref = value_; @@ -1054,7 +940,7 @@ public final class NormalizedNodeMessages { } } /** - * optional string value = 5; + * required string value = 1; */ public com.google.protobuf.ByteString getValueBytes() { @@ -1071,10 +957,6 @@ public final class NormalizedNodeMessages { } private void initFields() { - path_ = ""; - type_ = ""; - attributes_ = java.util.Collections.emptyList(); - child_ = java.util.Collections.emptyList(); value_ = ""; } private byte memoizedIsInitialized = -1; @@ -1082,22 +964,10 @@ public final class NormalizedNodeMessages { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; - if (!hasPath()) { + if (!hasValue()) { memoizedIsInitialized = 0; return false; } - for (int i = 0; i < getAttributesCount(); i++) { - if (!getAttributes(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - for (int i = 0; i < getChildCount(); i++) { - if (!getChild(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } memoizedIsInitialized = 1; return true; } @@ -1106,19 +976,7 @@ public final class NormalizedNodeMessages { throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getPathBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getTypeBytes()); - } - for (int i = 0; i < attributes_.size(); i++) { - output.writeMessage(3, attributes_.get(i)); - } - for (int i = 0; i < child_.size(); i++) { - output.writeMessage(4, child_.get(i)); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(5, getValueBytes()); + output.writeBytes(1, getValueBytes()); } getUnknownFields().writeTo(output); } @@ -1131,23 +989,7 @@ public final class NormalizedNodeMessages { size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getPathBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getTypeBytes()); - } - for (int i = 0; i < attributes_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, attributes_.get(i)); - } - for (int i = 0; i < child_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(4, child_.get(i)); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(5, getValueBytes()); + .computeBytesSize(1, getValueBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; @@ -1161,53 +1003,53 @@ public final class NormalizedNodeMessages { return super.writeReplace(); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom( + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom( + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(byte[] data) + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom( + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(java.io.InputStream input) + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom( + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseDelimitedFrom(java.io.InputStream input) + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseDelimitedFrom( + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom( + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom( + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -1216,7 +1058,7 @@ public final class NormalizedNodeMessages { public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node prototype) { + public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @@ -1228,24 +1070,24 @@ public final class NormalizedNodeMessages { return builder; } /** - * Protobuf type {@code org.opendaylight.controller.mdsal.Node} + * Protobuf type {@code org.opendaylight.controller.mdsal.QName} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder - implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder { + implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_descriptor; + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_QName_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_fieldAccessorTable + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_QName_fieldAccessorTable .ensureFieldAccessorsInitialized( - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder.class); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder.class); } - // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder() + // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.newBuilder() private Builder() { maybeForceBuilderInitialization(); } @@ -1257,8 +1099,6 @@ public final class NormalizedNodeMessages { } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getAttributesFieldBuilder(); - getChildFieldBuilder(); } } private static Builder create() { @@ -1267,24 +1107,8 @@ public final class NormalizedNodeMessages { public Builder clear() { super.clear(); - path_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - type_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - if (attributesBuilder_ == null) { - attributes_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - } else { - attributesBuilder_.clear(); - } - if (childBuilder_ == null) { - child_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - } else { - childBuilder_.clear(); - } value_ = ""; - bitField0_ = (bitField0_ & ~0x00000010); + bitField0_ = (bitField0_ & ~0x00000001); return this; } @@ -1294,54 +1118,28 @@ public final class NormalizedNodeMessages { public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_descriptor; + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_QName_descriptor; } - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getDefaultInstanceForType() { - return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName getDefaultInstanceForType() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance(); } - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node build() { - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node result = buildPartial(); + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName build() { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node buildPartial() { - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node(this); + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName buildPartial() { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } - result.path_ = path_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.type_ = type_; - if (attributesBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004)) { - attributes_ = java.util.Collections.unmodifiableList(attributes_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.attributes_ = attributes_; - } else { - result.attributes_ = attributesBuilder_.build(); - } - if (childBuilder_ == null) { - if (((bitField0_ & 0x00000008) == 0x00000008)) { - child_ = java.util.Collections.unmodifiableList(child_); - bitField0_ = (bitField0_ & ~0x00000008); - } - result.child_ = child_; - } else { - result.child_ = childBuilder_.build(); - } - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000004; - } result.value_ = value_; result.bitField0_ = to_bitField0_; onBuilt(); @@ -1349,80 +1147,18 @@ public final class NormalizedNodeMessages { } public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node) { - return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node)other); + if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName) { + return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName)other); } else { super.mergeFrom(other); return this; } } - public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node other) { - if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) return this; - if (other.hasPath()) { - bitField0_ |= 0x00000001; - path_ = other.path_; - onChanged(); - } - if (other.hasType()) { - bitField0_ |= 0x00000002; - type_ = other.type_; - onChanged(); - } - if (attributesBuilder_ == null) { - if (!other.attributes_.isEmpty()) { - if (attributes_.isEmpty()) { - attributes_ = other.attributes_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureAttributesIsMutable(); - attributes_.addAll(other.attributes_); - } - onChanged(); - } - } else { - if (!other.attributes_.isEmpty()) { - if (attributesBuilder_.isEmpty()) { - attributesBuilder_.dispose(); - attributesBuilder_ = null; - attributes_ = other.attributes_; - bitField0_ = (bitField0_ & ~0x00000004); - attributesBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getAttributesFieldBuilder() : null; - } else { - attributesBuilder_.addAllMessages(other.attributes_); - } - } - } - if (childBuilder_ == null) { - if (!other.child_.isEmpty()) { - if (child_.isEmpty()) { - child_ = other.child_; - bitField0_ = (bitField0_ & ~0x00000008); - } else { - ensureChildIsMutable(); - child_.addAll(other.child_); - } - onChanged(); - } - } else { - if (!other.child_.isEmpty()) { - if (childBuilder_.isEmpty()) { - childBuilder_.dispose(); - childBuilder_ = null; - child_ = other.child_; - bitField0_ = (bitField0_ & ~0x00000008); - childBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getChildFieldBuilder() : null; - } else { - childBuilder_.addAllMessages(other.child_); - } - } - } + public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName other) { + if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance()) return this; if (other.hasValue()) { - bitField0_ |= 0x00000010; + bitField0_ |= 0x00000001; value_ = other.value_; onChanged(); } @@ -1431,22 +1167,10 @@ public final class NormalizedNodeMessages { } public final boolean isInitialized() { - if (!hasPath()) { + if (!hasValue()) { return false; } - for (int i = 0; i < getAttributesCount(); i++) { - if (!getAttributes(i).isInitialized()) { - - return false; - } - } - for (int i = 0; i < getChildCount(); i++) { - if (!getChild(i).isInitialized()) { - - return false; - } - } return true; } @@ -1454,11 +1178,11 @@ public final class NormalizedNodeMessages { com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parsedMessage = null; + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node) e.getUnfinishedMessage(); + parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { @@ -1469,770 +1193,5571 @@ public final class NormalizedNodeMessages { } private int bitField0_; - // required string path = 1; - private java.lang.Object path_ = ""; + // required string value = 1; + private java.lang.Object value_ = ""; /** - * required string path = 1; + * required string value = 1; */ - public boolean hasPath() { + public boolean hasValue() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * required string path = 1; + * required string value = 1; */ - public java.lang.String getPath() { - java.lang.Object ref = path_; + 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(); - path_ = s; + value_ = s; return s; } else { return (java.lang.String) ref; } } /** - * required string path = 1; + * required string value = 1; */ public com.google.protobuf.ByteString - getPathBytes() { - java.lang.Object ref = path_; + getValueBytes() { + java.lang.Object ref = value_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); - path_ = b; + value_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** - * required string path = 1; + * required string value = 1; */ - public Builder setPath( + public Builder setValue( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; - path_ = value; + value_ = value; onChanged(); return this; } /** - * required string path = 1; + * required string value = 1; */ - public Builder clearPath() { + public Builder clearValue() { bitField0_ = (bitField0_ & ~0x00000001); - path_ = getDefaultInstance().getPath(); + value_ = getDefaultInstance().getValue(); onChanged(); return this; } /** - * required string path = 1; + * required string value = 1; */ - public Builder setPathBytes( + public Builder setValueBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; - path_ = value; + value_ = value; onChanged(); return this; } - // optional string type = 2; - private java.lang.Object type_ = ""; - /** - * optional string type = 2; - */ - public boolean hasType() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional string type = 2; - */ - public java.lang.String getType() { - java.lang.Object ref = type_; - if (!(ref instanceof java.lang.String)) { - java.lang.String s = ((com.google.protobuf.ByteString) ref) - .toStringUtf8(); - type_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * optional string type = 2; - */ - public com.google.protobuf.ByteString - getTypeBytes() { - java.lang.Object ref = type_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - type_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * optional string type = 2; - */ - public Builder setType( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - type_ = value; - onChanged(); - return this; - } - /** - * optional string type = 2; - */ - public Builder clearType() { - bitField0_ = (bitField0_ & ~0x00000002); - type_ = getDefaultInstance().getType(); - onChanged(); - return this; - } - /** - * optional string type = 2; - */ - public Builder setTypeBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.QName) + } + + static { + defaultInstance = new QName(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.QName) } - bitField0_ |= 0x00000002; - type_ = value; - onChanged(); - return this; - } - // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - private java.util.List attributes_ = - java.util.Collections.emptyList(); - private void ensureAttributesIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - attributes_ = new java.util.ArrayList(attributes_); - bitField0_ |= 0x00000004; - } - } + public interface PathArgumentOrBuilder + extends com.google.protobuf.MessageOrBuilder { - private com.google.protobuf.RepeatedFieldBuilder< - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> attributesBuilder_; + // required string value = 1; + /** + * required string value = 1; + */ + boolean hasValue(); + /** + * required string value = 1; + */ + java.lang.String getValue(); + /** + * required string value = 1; + */ + com.google.protobuf.ByteString + getValueBytes(); - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - public java.util.List getAttributesList() { - if (attributesBuilder_ == null) { - return java.util.Collections.unmodifiableList(attributes_); - } else { - return attributesBuilder_.getMessageList(); - } - } - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - public int getAttributesCount() { - if (attributesBuilder_ == null) { - return attributes_.size(); - } else { - return attributesBuilder_.getCount(); + // optional string type = 2; + /** + * optional string type = 2; + * + *
+     *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+     * 
+ */ + boolean hasType(); + /** + * optional string type = 2; + * + *
+     *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+     * 
+ */ + java.lang.String getType(); + /** + * optional string type = 2; + * + *
+     *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+     * 
+ */ + com.google.protobuf.ByteString + getTypeBytes(); + + // optional .org.opendaylight.controller.mdsal.QName nodeType = 3; + /** + * optional .org.opendaylight.controller.mdsal.QName nodeType = 3; + */ + boolean hasNodeType(); + /** + * optional .org.opendaylight.controller.mdsal.QName nodeType = 3; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName getNodeType(); + /** + * optional .org.opendaylight.controller.mdsal.QName nodeType = 3; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNodeTypeOrBuilder(); + + // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + java.util.List + getAttributesList(); + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index); + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + int getAttributesCount(); + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + java.util.List + getAttributesOrBuilderList(); + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder( + int index); + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.PathArgument} + */ + public static final class PathArgument extends + com.google.protobuf.GeneratedMessage + implements PathArgumentOrBuilder { + // Use PathArgument.newBuilder() to construct. + private PathArgument(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private PathArgument(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final PathArgument defaultInstance; + public static PathArgument getDefaultInstance() { + return defaultInstance; + } + + public PathArgument getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private PathArgument( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + value_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + type_ = input.readBytes(); + break; + } + case 26: { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder subBuilder = null; + if (((bitField0_ & 0x00000004) == 0x00000004)) { + subBuilder = nodeType_.toBuilder(); + } + nodeType_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(nodeType_); + nodeType_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000004; + break; + } + case 34: { + if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { + attributes_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000008; + } + attributes_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.PARSER, extensionRegistry)); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { + attributes_ = java.util.Collections.unmodifiableList(attributes_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgument_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public PathArgument parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PathArgument(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // required string value = 1; + public static final int VALUE_FIELD_NUMBER = 1; + private java.lang.Object value_; + /** + * required string value = 1; + */ + public boolean hasValue() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string value = 1; + */ + 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; + } + } + /** + * required string value = 1; + */ + public com.google.protobuf.ByteString + getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string type = 2; + public static final int TYPE_FIELD_NUMBER = 2; + private java.lang.Object type_; + /** + * optional string type = 2; + * + *
+     *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+     * 
+ */ + public boolean hasType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional string type = 2; + * + *
+     *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+     * 
+ */ + public java.lang.String getType() { + java.lang.Object ref = type_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + type_ = s; + } + return s; + } + } + /** + * optional string type = 2; + * + *
+     *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+     * 
+ */ + public com.google.protobuf.ByteString + getTypeBytes() { + java.lang.Object ref = type_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + type_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional .org.opendaylight.controller.mdsal.QName nodeType = 3; + public static final int NODETYPE_FIELD_NUMBER = 3; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName nodeType_; + /** + * optional .org.opendaylight.controller.mdsal.QName nodeType = 3; + */ + public boolean hasNodeType() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional .org.opendaylight.controller.mdsal.QName nodeType = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName getNodeType() { + return nodeType_; + } + /** + * optional .org.opendaylight.controller.mdsal.QName nodeType = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNodeTypeOrBuilder() { + return nodeType_; + } + + // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + public static final int ATTRIBUTES_FIELD_NUMBER = 4; + private java.util.List attributes_; + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public java.util.List getAttributesList() { + return attributes_; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public java.util.List + getAttributesOrBuilderList() { + return attributes_; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public int getAttributesCount() { + return attributes_.size(); + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index) { + return attributes_.get(index); + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder( + int index) { + return attributes_.get(index); + } + + private void initFields() { + value_ = ""; + type_ = ""; + nodeType_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance(); + attributes_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasValue()) { + memoizedIsInitialized = 0; + return false; + } + if (hasNodeType()) { + if (!getNodeType().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + for (int i = 0; i < getAttributesCount(); i++) { + if (!getAttributes(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getValueBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getTypeBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, nodeType_); + } + for (int i = 0; i < attributes_.size(); i++) { + output.writeMessage(4, attributes_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getValueBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getTypeBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, nodeType_); + } + for (int i = 0; i < attributes_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, attributes_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.PathArgument} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgument_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder.class); + } + + // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getNodeTypeFieldBuilder(); + getAttributesFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + value_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + type_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + if (nodeTypeBuilder_ == null) { + nodeType_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance(); + } else { + nodeTypeBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + if (attributesBuilder_ == null) { + attributes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + } else { + attributesBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor; + } + + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument getDefaultInstanceForType() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.getDefaultInstance(); + } + + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument build() { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument buildPartial() { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.value_ = value_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.type_ = type_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + if (nodeTypeBuilder_ == null) { + result.nodeType_ = nodeType_; + } else { + result.nodeType_ = nodeTypeBuilder_.build(); + } + if (attributesBuilder_ == null) { + if (((bitField0_ & 0x00000008) == 0x00000008)) { + attributes_ = java.util.Collections.unmodifiableList(attributes_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.attributes_ = attributes_; + } else { + result.attributes_ = attributesBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument) { + return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument other) { + if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.getDefaultInstance()) return this; + if (other.hasValue()) { + bitField0_ |= 0x00000001; + value_ = other.value_; + onChanged(); + } + if (other.hasType()) { + bitField0_ |= 0x00000002; + type_ = other.type_; + onChanged(); + } + if (other.hasNodeType()) { + mergeNodeType(other.getNodeType()); + } + if (attributesBuilder_ == null) { + if (!other.attributes_.isEmpty()) { + if (attributes_.isEmpty()) { + attributes_ = other.attributes_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureAttributesIsMutable(); + attributes_.addAll(other.attributes_); + } + onChanged(); + } + } else { + if (!other.attributes_.isEmpty()) { + if (attributesBuilder_.isEmpty()) { + attributesBuilder_.dispose(); + attributesBuilder_ = null; + attributes_ = other.attributes_; + bitField0_ = (bitField0_ & ~0x00000008); + attributesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getAttributesFieldBuilder() : null; + } else { + attributesBuilder_.addAllMessages(other.attributes_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasValue()) { + + return false; + } + if (hasNodeType()) { + if (!getNodeType().isInitialized()) { + + return false; + } + } + for (int i = 0; i < getAttributesCount(); i++) { + if (!getAttributes(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // required string value = 1; + private java.lang.Object value_ = ""; + /** + * required string value = 1; + */ + public boolean hasValue() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string value = 1; + */ + 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; + } + } + /** + * required string value = 1; + */ + 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; + } + } + /** + * required string value = 1; + */ + public Builder setValue( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + value_ = value; + onChanged(); + return this; + } + /** + * required string value = 1; + */ + public Builder clearValue() { + bitField0_ = (bitField0_ & ~0x00000001); + value_ = getDefaultInstance().getValue(); + onChanged(); + return this; + } + /** + * required string value = 1; + */ + public Builder setValueBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + value_ = value; + onChanged(); + return this; + } + + // optional string type = 2; + private java.lang.Object type_ = ""; + /** + * optional string type = 2; + * + *
+       *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+       * 
+ */ + public boolean hasType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional string type = 2; + * + *
+       *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+       * 
+ */ + public java.lang.String getType() { + java.lang.Object ref = type_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + type_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string type = 2; + * + *
+       *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+       * 
+ */ + public com.google.protobuf.ByteString + getTypeBytes() { + java.lang.Object ref = type_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + type_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string type = 2; + * + *
+       *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+       * 
+ */ + public Builder setType( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + type_ = value; + onChanged(); + return this; + } + /** + * optional string type = 2; + * + *
+       *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+       * 
+ */ + public Builder clearType() { + bitField0_ = (bitField0_ & ~0x00000002); + type_ = getDefaultInstance().getType(); + onChanged(); + return this; + } + /** + * optional string type = 2; + * + *
+       *NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates
+       * 
+ */ + public Builder setTypeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + type_ = value; + onChanged(); + return this; + } + + // optional .org.opendaylight.controller.mdsal.QName nodeType = 3; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName nodeType_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder> nodeTypeBuilder_; + /** + * optional .org.opendaylight.controller.mdsal.QName nodeType = 3; + */ + public boolean hasNodeType() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional .org.opendaylight.controller.mdsal.QName nodeType = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName getNodeType() { + if (nodeTypeBuilder_ == null) { + return nodeType_; + } else { + return nodeTypeBuilder_.getMessage(); + } + } + /** + * optional .org.opendaylight.controller.mdsal.QName nodeType = 3; + */ + public Builder setNodeType(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName value) { + if (nodeTypeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + nodeType_ = value; + onChanged(); + } else { + nodeTypeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + /** + * optional .org.opendaylight.controller.mdsal.QName nodeType = 3; + */ + public Builder setNodeType( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder builderForValue) { + if (nodeTypeBuilder_ == null) { + nodeType_ = builderForValue.build(); + onChanged(); + } else { + nodeTypeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + /** + * optional .org.opendaylight.controller.mdsal.QName nodeType = 3; + */ + 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; + } + /** + * optional .org.opendaylight.controller.mdsal.QName nodeType = 3; + */ + 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; + } + /** + * optional .org.opendaylight.controller.mdsal.QName nodeType = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder getNodeTypeBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getNodeTypeFieldBuilder().getBuilder(); + } + /** + * optional .org.opendaylight.controller.mdsal.QName nodeType = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNodeTypeOrBuilder() { + if (nodeTypeBuilder_ != null) { + return nodeTypeBuilder_.getMessageOrBuilder(); + } else { + return nodeType_; + } + } + /** + * optional .org.opendaylight.controller.mdsal.QName nodeType = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder> + getNodeTypeFieldBuilder() { + if (nodeTypeBuilder_ == null) { + nodeTypeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>( + nodeType_, + getParentForChildren(), + isClean()); + nodeType_ = null; + } + return nodeTypeBuilder_; + } + + // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + private java.util.List attributes_ = + java.util.Collections.emptyList(); + private void ensureAttributesIsMutable() { + if (!((bitField0_ & 0x00000008) == 0x00000008)) { + attributes_ = new java.util.ArrayList(attributes_); + bitField0_ |= 0x00000008; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> attributesBuilder_; + + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public java.util.List getAttributesList() { + if (attributesBuilder_ == null) { + return java.util.Collections.unmodifiableList(attributes_); + } else { + return attributesBuilder_.getMessageList(); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public int getAttributesCount() { + if (attributesBuilder_ == null) { + return attributes_.size(); + } else { + return attributesBuilder_.getCount(); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index) { + if (attributesBuilder_ == null) { + return attributes_.get(index); + } else { + return attributesBuilder_.getMessage(index); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public Builder setAttributes( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) { + if (attributesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAttributesIsMutable(); + attributes_.set(index, value); + onChanged(); + } else { + attributesBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public Builder setAttributes( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) { + if (attributesBuilder_ == null) { + ensureAttributesIsMutable(); + attributes_.set(index, builderForValue.build()); + onChanged(); + } else { + attributesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public Builder addAttributes(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) { + if (attributesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAttributesIsMutable(); + attributes_.add(value); + onChanged(); + } else { + attributesBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public Builder addAttributes( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) { + if (attributesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAttributesIsMutable(); + attributes_.add(index, value); + onChanged(); + } else { + attributesBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public Builder addAttributes( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) { + if (attributesBuilder_ == null) { + ensureAttributesIsMutable(); + attributes_.add(builderForValue.build()); + onChanged(); + } else { + attributesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public Builder addAttributes( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) { + if (attributesBuilder_ == null) { + ensureAttributesIsMutable(); + attributes_.add(index, builderForValue.build()); + onChanged(); + } else { + attributesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public Builder addAllAttributes( + java.lang.Iterable values) { + if (attributesBuilder_ == null) { + ensureAttributesIsMutable(); + super.addAll(values, attributes_); + onChanged(); + } else { + attributesBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public Builder clearAttributes() { + if (attributesBuilder_ == null) { + attributes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + } else { + attributesBuilder_.clear(); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public Builder removeAttributes(int index) { + if (attributesBuilder_ == null) { + ensureAttributesIsMutable(); + attributes_.remove(index); + onChanged(); + } else { + attributesBuilder_.remove(index); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder getAttributesBuilder( + int index) { + return getAttributesFieldBuilder().getBuilder(index); + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder( + int index) { + if (attributesBuilder_ == null) { + return attributes_.get(index); } else { + return attributesBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public java.util.List + getAttributesOrBuilderList() { + if (attributesBuilder_ != null) { + return attributesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(attributes_); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder addAttributesBuilder() { + return getAttributesFieldBuilder().addBuilder( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance()); + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder addAttributesBuilder( + int index) { + return getAttributesFieldBuilder().addBuilder( + index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance()); + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4; + */ + public java.util.List + getAttributesBuilderList() { + return getAttributesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> + getAttributesFieldBuilder() { + if (attributesBuilder_ == null) { + attributesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>( + attributes_, + ((bitField0_ & 0x00000008) == 0x00000008), + getParentForChildren(), + isClean()); + attributes_ = null; + } + return attributesBuilder_; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.PathArgument) + } + + static { + defaultInstance = new PathArgument(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.PathArgument) + } + + public interface InstanceIdentifierOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + java.util.List + getArgumentsList(); + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument getArguments(int index); + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + int getArgumentsCount(); + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + java.util.List + getArgumentsOrBuilderList(); + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder getArgumentsOrBuilder( + int index); + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.InstanceIdentifier} + */ + public static final class InstanceIdentifier extends + com.google.protobuf.GeneratedMessage + implements InstanceIdentifierOrBuilder { + // Use InstanceIdentifier.newBuilder() to construct. + private InstanceIdentifier(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private InstanceIdentifier(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final InstanceIdentifier defaultInstance; + public static InstanceIdentifier getDefaultInstance() { + return defaultInstance; + } + + public InstanceIdentifier getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private InstanceIdentifier( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + arguments_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + arguments_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.PARSER, extensionRegistry)); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + arguments_ = java.util.Collections.unmodifiableList(arguments_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public InstanceIdentifier parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new InstanceIdentifier(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + // repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + public static final int ARGUMENTS_FIELD_NUMBER = 1; + private java.util.List arguments_; + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public java.util.List getArgumentsList() { + return arguments_; + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public java.util.List + getArgumentsOrBuilderList() { + return arguments_; + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public int getArgumentsCount() { + return arguments_.size(); + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument getArguments(int index) { + return arguments_.get(index); + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder getArgumentsOrBuilder( + int index) { + return arguments_.get(index); + } + + private void initFields() { + arguments_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + for (int i = 0; i < getArgumentsCount(); i++) { + if (!getArguments(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < arguments_.size(); i++) { + output.writeMessage(1, arguments_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < arguments_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, arguments_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.InstanceIdentifier} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder.class); + } + + // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getArgumentsFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (argumentsBuilder_ == null) { + arguments_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + argumentsBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor; + } + + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getDefaultInstanceForType() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + } + + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier build() { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier buildPartial() { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier(this); + int from_bitField0_ = bitField0_; + if (argumentsBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + arguments_ = java.util.Collections.unmodifiableList(arguments_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.arguments_ = arguments_; + } else { + result.arguments_ = argumentsBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier) { + return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier other) { + if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) return this; + if (argumentsBuilder_ == null) { + if (!other.arguments_.isEmpty()) { + if (arguments_.isEmpty()) { + arguments_ = other.arguments_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureArgumentsIsMutable(); + arguments_.addAll(other.arguments_); + } + onChanged(); + } + } else { + if (!other.arguments_.isEmpty()) { + if (argumentsBuilder_.isEmpty()) { + argumentsBuilder_.dispose(); + argumentsBuilder_ = null; + arguments_ = other.arguments_; + bitField0_ = (bitField0_ & ~0x00000001); + argumentsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getArgumentsFieldBuilder() : null; + } else { + argumentsBuilder_.addAllMessages(other.arguments_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + for (int i = 0; i < getArgumentsCount(); i++) { + if (!getArguments(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + private java.util.List arguments_ = + java.util.Collections.emptyList(); + private void ensureArgumentsIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + arguments_ = new java.util.ArrayList(arguments_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder> argumentsBuilder_; + + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public java.util.List getArgumentsList() { + if (argumentsBuilder_ == null) { + return java.util.Collections.unmodifiableList(arguments_); + } else { + return argumentsBuilder_.getMessageList(); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public int getArgumentsCount() { + if (argumentsBuilder_ == null) { + return arguments_.size(); + } else { + return argumentsBuilder_.getCount(); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument getArguments(int index) { + if (argumentsBuilder_ == null) { + return arguments_.get(index); + } else { + return argumentsBuilder_.getMessage(index); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public Builder setArguments( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument value) { + if (argumentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureArgumentsIsMutable(); + arguments_.set(index, value); + onChanged(); + } else { + argumentsBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public Builder setArguments( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder builderForValue) { + if (argumentsBuilder_ == null) { + ensureArgumentsIsMutable(); + arguments_.set(index, builderForValue.build()); + onChanged(); + } else { + argumentsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public Builder addArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument value) { + if (argumentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureArgumentsIsMutable(); + arguments_.add(value); + onChanged(); + } else { + argumentsBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public Builder addArguments( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument value) { + if (argumentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureArgumentsIsMutable(); + arguments_.add(index, value); + onChanged(); + } else { + argumentsBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public Builder addArguments( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder builderForValue) { + if (argumentsBuilder_ == null) { + ensureArgumentsIsMutable(); + arguments_.add(builderForValue.build()); + onChanged(); + } else { + argumentsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public Builder addArguments( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder builderForValue) { + if (argumentsBuilder_ == null) { + ensureArgumentsIsMutable(); + arguments_.add(index, builderForValue.build()); + onChanged(); + } else { + argumentsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public Builder addAllArguments( + java.lang.Iterable values) { + if (argumentsBuilder_ == null) { + ensureArgumentsIsMutable(); + super.addAll(values, arguments_); + onChanged(); + } else { + argumentsBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public Builder clearArguments() { + if (argumentsBuilder_ == null) { + arguments_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + argumentsBuilder_.clear(); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public Builder removeArguments(int index) { + if (argumentsBuilder_ == null) { + ensureArgumentsIsMutable(); + arguments_.remove(index); + onChanged(); + } else { + argumentsBuilder_.remove(index); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder getArgumentsBuilder( + int index) { + return getArgumentsFieldBuilder().getBuilder(index); + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder getArgumentsOrBuilder( + int index) { + if (argumentsBuilder_ == null) { + return arguments_.get(index); } else { + return argumentsBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public java.util.List + getArgumentsOrBuilderList() { + if (argumentsBuilder_ != null) { + return argumentsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(arguments_); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder addArgumentsBuilder() { + return getArgumentsFieldBuilder().addBuilder( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.getDefaultInstance()); + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder addArgumentsBuilder( + int index) { + return getArgumentsFieldBuilder().addBuilder( + index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.getDefaultInstance()); + } + /** + * repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1; + */ + public java.util.List + getArgumentsBuilderList() { + return getArgumentsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder> + getArgumentsFieldBuilder() { + if (argumentsBuilder_ == null) { + argumentsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder>( + arguments_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + arguments_ = null; + } + return argumentsBuilder_; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.InstanceIdentifier) + } + + static { + defaultInstance = new InstanceIdentifier(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.InstanceIdentifier) + } + + public interface NodeOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string path = 1; + /** + * optional string path = 1; + */ + boolean hasPath(); + /** + * optional string path = 1; + */ + java.lang.String getPath(); + /** + * optional string path = 1; + */ + com.google.protobuf.ByteString + getPathBytes(); + + // optional string type = 2; + /** + * optional string type = 2; + */ + boolean hasType(); + /** + * optional string type = 2; + */ + java.lang.String getType(); + /** + * optional string type = 2; + */ + com.google.protobuf.ByteString + getTypeBytes(); + + // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + java.util.List + getAttributesList(); + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index); + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + int getAttributesCount(); + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + java.util.List + getAttributesOrBuilderList(); + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + 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 = 4; + */ + java.util.List + getChildList(); + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getChild(int index); + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + int getChildCount(); + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + java.util.List + getChildOrBuilderList(); + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getChildOrBuilder( + int index); + + // optional string value = 5; + /** + * optional string value = 5; + */ + boolean hasValue(); + /** + * optional string value = 5; + */ + java.lang.String getValue(); + /** + * optional string value = 5; + */ + com.google.protobuf.ByteString + getValueBytes(); + + // optional string valueType = 6; + /** + * optional string valueType = 6; + */ + boolean hasValueType(); + /** + * optional string valueType = 6; + */ + java.lang.String getValueType(); + /** + * optional string valueType = 6; + */ + com.google.protobuf.ByteString + getValueTypeBytes(); + + // repeated string bitsValue = 7; + /** + * repeated string bitsValue = 7; + */ + java.util.List + getBitsValueList(); + /** + * repeated string bitsValue = 7; + */ + int getBitsValueCount(); + /** + * repeated string bitsValue = 7; + */ + java.lang.String getBitsValue(int index); + /** + * repeated string bitsValue = 7; + */ + com.google.protobuf.ByteString + getBitsValueBytes(int index); + + // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8; + /** + * optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8; + */ + boolean hasInstanceIdentifierValue(); + /** + * optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue(); + /** + * optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder(); + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.Node} + */ + public static final class Node extends + com.google.protobuf.GeneratedMessage + implements NodeOrBuilder { + // Use Node.newBuilder() to construct. + private Node(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private Node(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final Node defaultInstance; + public static Node getDefaultInstance() { + return defaultInstance; + } + + public Node getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Node( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + path_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + type_ = input.readBytes(); + break; + } + case 26: { + if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { + attributes_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000004; + } + attributes_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.PARSER, extensionRegistry)); + break; + } + case 34: { + if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { + child_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000008; + } + child_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry)); + break; + } + case 42: { + bitField0_ |= 0x00000004; + value_ = input.readBytes(); + break; + } + case 50: { + bitField0_ |= 0x00000008; + valueType_ = input.readBytes(); + break; + } + case 58: { + if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) { + bitsValue_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000040; + } + bitsValue_.add(input.readBytes()); + break; + } + case 66: { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null; + if (((bitField0_ & 0x00000010) == 0x00000010)) { + subBuilder = instanceIdentifierValue_.toBuilder(); + } + instanceIdentifierValue_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(instanceIdentifierValue_); + instanceIdentifierValue_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000010; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { + attributes_ = java.util.Collections.unmodifiableList(attributes_); + } + if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { + child_ = java.util.Collections.unmodifiableList(child_); + } + if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) { + bitsValue_ = new com.google.protobuf.UnmodifiableLazyStringList(bitsValue_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public Node parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Node(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // optional string path = 1; + public static final int PATH_FIELD_NUMBER = 1; + private java.lang.Object path_; + /** + * optional string path = 1; + */ + public boolean hasPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional string path = 1; + */ + public java.lang.String getPath() { + java.lang.Object ref = path_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + path_ = s; + } + return s; + } + } + /** + * optional string path = 1; + */ + public com.google.protobuf.ByteString + getPathBytes() { + java.lang.Object ref = path_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + path_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string type = 2; + public static final int TYPE_FIELD_NUMBER = 2; + private java.lang.Object type_; + /** + * optional string type = 2; + */ + public boolean hasType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional string type = 2; + */ + public java.lang.String getType() { + java.lang.Object ref = type_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + type_ = s; + } + return s; + } + } + /** + * optional string type = 2; + */ + public com.google.protobuf.ByteString + getTypeBytes() { + java.lang.Object ref = type_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + type_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + public static final int ATTRIBUTES_FIELD_NUMBER = 3; + private java.util.List attributes_; + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public java.util.List getAttributesList() { + return attributes_; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public java.util.List + getAttributesOrBuilderList() { + return attributes_; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public int getAttributesCount() { + return attributes_.size(); + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index) { + return attributes_.get(index); + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder( + int index) { + return attributes_.get(index); + } + + // repeated .org.opendaylight.controller.mdsal.Node child = 4; + public static final int CHILD_FIELD_NUMBER = 4; + private java.util.List child_; + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public java.util.List getChildList() { + return child_; + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public java.util.List + getChildOrBuilderList() { + return child_; + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public int getChildCount() { + return child_.size(); + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getChild(int index) { + return child_.get(index); + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getChildOrBuilder( + int index) { + return child_.get(index); + } + + // optional string value = 5; + public static final int VALUE_FIELD_NUMBER = 5; + private java.lang.Object value_; + /** + * optional string value = 5; + */ + public boolean hasValue() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional string value = 5; + */ + 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; + } + } + /** + * optional string value = 5; + */ + public com.google.protobuf.ByteString + getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string valueType = 6; + public static final int VALUETYPE_FIELD_NUMBER = 6; + private java.lang.Object valueType_; + /** + * optional string valueType = 6; + */ + public boolean hasValueType() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional string valueType = 6; + */ + public java.lang.String getValueType() { + java.lang.Object ref = valueType_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + valueType_ = s; + } + return s; + } + } + /** + * optional string valueType = 6; + */ + public com.google.protobuf.ByteString + getValueTypeBytes() { + java.lang.Object ref = valueType_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + valueType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // repeated string bitsValue = 7; + public static final int BITSVALUE_FIELD_NUMBER = 7; + private com.google.protobuf.LazyStringList bitsValue_; + /** + * repeated string bitsValue = 7; + */ + public java.util.List + getBitsValueList() { + return bitsValue_; + } + /** + * repeated string bitsValue = 7; + */ + public int getBitsValueCount() { + return bitsValue_.size(); + } + /** + * repeated string bitsValue = 7; + */ + public java.lang.String getBitsValue(int index) { + return bitsValue_.get(index); + } + /** + * repeated string bitsValue = 7; + */ + 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_; + /** + * optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8; + */ + public boolean hasInstanceIdentifierValue() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue() { + return instanceIdentifierValue_; + } + /** + * optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder() { + return instanceIdentifierValue_; + } + + private void initFields() { + path_ = ""; + type_ = ""; + attributes_ = java.util.Collections.emptyList(); + child_ = java.util.Collections.emptyList(); + value_ = ""; + valueType_ = ""; + bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY; + instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + for (int i = 0; i < getAttributesCount(); i++) { + if (!getAttributes(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + for (int i = 0; i < getChildCount(); i++) { + if (!getChild(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + if (hasInstanceIdentifierValue()) { + if (!getInstanceIdentifierValue().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getPathBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getTypeBytes()); + } + for (int i = 0; i < attributes_.size(); i++) { + output.writeMessage(3, attributes_.get(i)); + } + for (int i = 0; i < child_.size(); i++) { + output.writeMessage(4, child_.get(i)); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(5, getValueBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(6, getValueTypeBytes()); + } + for (int i = 0; i < bitsValue_.size(); i++) { + output.writeBytes(7, bitsValue_.getByteString(i)); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeMessage(8, instanceIdentifierValue_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getPathBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getTypeBytes()); + } + for (int i = 0; i < attributes_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, attributes_.get(i)); + } + for (int i = 0; i < child_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, child_.get(i)); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(5, getValueBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(6, getValueTypeBytes()); + } + { + int dataSize = 0; + for (int i = 0; i < bitsValue_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(bitsValue_.getByteString(i)); + } + size += dataSize; + size += 1 * getBitsValueList().size(); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(8, instanceIdentifierValue_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.Node} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder.class); + } + + // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getAttributesFieldBuilder(); + getChildFieldBuilder(); + getInstanceIdentifierValueFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + path_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + type_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + if (attributesBuilder_ == null) { + attributes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + } else { + attributesBuilder_.clear(); + } + if (childBuilder_ == null) { + child_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + } else { + childBuilder_.clear(); + } + value_ = ""; + bitField0_ = (bitField0_ & ~0x00000010); + valueType_ = ""; + bitField0_ = (bitField0_ & ~0x00000020); + bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000040); + if (instanceIdentifierValueBuilder_ == null) { + instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + } else { + instanceIdentifierValueBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000080); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Node_descriptor; + } + + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getDefaultInstanceForType() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + } + + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node build() { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node buildPartial() { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.path_ = path_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.type_ = type_; + if (attributesBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004)) { + attributes_ = java.util.Collections.unmodifiableList(attributes_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.attributes_ = attributes_; + } else { + result.attributes_ = attributesBuilder_.build(); + } + if (childBuilder_ == null) { + if (((bitField0_ & 0x00000008) == 0x00000008)) { + child_ = java.util.Collections.unmodifiableList(child_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.child_ = child_; + } else { + result.child_ = childBuilder_.build(); + } + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000004; + } + result.value_ = value_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000008; + } + result.valueType_ = valueType_; + if (((bitField0_ & 0x00000040) == 0x00000040)) { + bitsValue_ = new com.google.protobuf.UnmodifiableLazyStringList( + bitsValue_); + bitField0_ = (bitField0_ & ~0x00000040); + } + result.bitsValue_ = bitsValue_; + if (((from_bitField0_ & 0x00000080) == 0x00000080)) { + to_bitField0_ |= 0x00000010; + } + if (instanceIdentifierValueBuilder_ == null) { + result.instanceIdentifierValue_ = instanceIdentifierValue_; + } else { + result.instanceIdentifierValue_ = instanceIdentifierValueBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node) { + return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node other) { + if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) return this; + if (other.hasPath()) { + bitField0_ |= 0x00000001; + path_ = other.path_; + onChanged(); + } + if (other.hasType()) { + bitField0_ |= 0x00000002; + type_ = other.type_; + onChanged(); + } + if (attributesBuilder_ == null) { + if (!other.attributes_.isEmpty()) { + if (attributes_.isEmpty()) { + attributes_ = other.attributes_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureAttributesIsMutable(); + attributes_.addAll(other.attributes_); + } + onChanged(); + } + } else { + if (!other.attributes_.isEmpty()) { + if (attributesBuilder_.isEmpty()) { + attributesBuilder_.dispose(); + attributesBuilder_ = null; + attributes_ = other.attributes_; + bitField0_ = (bitField0_ & ~0x00000004); + attributesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getAttributesFieldBuilder() : null; + } else { + attributesBuilder_.addAllMessages(other.attributes_); + } + } + } + if (childBuilder_ == null) { + if (!other.child_.isEmpty()) { + if (child_.isEmpty()) { + child_ = other.child_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureChildIsMutable(); + child_.addAll(other.child_); + } + onChanged(); + } + } else { + if (!other.child_.isEmpty()) { + if (childBuilder_.isEmpty()) { + childBuilder_.dispose(); + childBuilder_ = null; + child_ = other.child_; + bitField0_ = (bitField0_ & ~0x00000008); + childBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getChildFieldBuilder() : null; + } else { + childBuilder_.addAllMessages(other.child_); + } + } + } + if (other.hasValue()) { + bitField0_ |= 0x00000010; + value_ = other.value_; + onChanged(); + } + if (other.hasValueType()) { + bitField0_ |= 0x00000020; + valueType_ = other.valueType_; + onChanged(); + } + if (!other.bitsValue_.isEmpty()) { + if (bitsValue_.isEmpty()) { + bitsValue_ = other.bitsValue_; + bitField0_ = (bitField0_ & ~0x00000040); + } else { + ensureBitsValueIsMutable(); + bitsValue_.addAll(other.bitsValue_); + } + onChanged(); + } + if (other.hasInstanceIdentifierValue()) { + mergeInstanceIdentifierValue(other.getInstanceIdentifierValue()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + for (int i = 0; i < getAttributesCount(); i++) { + if (!getAttributes(i).isInitialized()) { + + return false; + } + } + for (int i = 0; i < getChildCount(); i++) { + if (!getChild(i).isInitialized()) { + + return false; + } + } + if (hasInstanceIdentifierValue()) { + if (!getInstanceIdentifierValue().isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // optional string path = 1; + private java.lang.Object path_ = ""; + /** + * optional string path = 1; + */ + public boolean hasPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional string path = 1; + */ + public java.lang.String getPath() { + java.lang.Object ref = path_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + path_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string path = 1; + */ + public com.google.protobuf.ByteString + getPathBytes() { + java.lang.Object ref = path_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + path_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string path = 1; + */ + public Builder setPath( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + path_ = value; + onChanged(); + return this; + } + /** + * optional string path = 1; + */ + public Builder clearPath() { + bitField0_ = (bitField0_ & ~0x00000001); + path_ = getDefaultInstance().getPath(); + onChanged(); + return this; + } + /** + * optional string path = 1; + */ + public Builder setPathBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + path_ = value; + onChanged(); + return this; + } + + // optional string type = 2; + private java.lang.Object type_ = ""; + /** + * optional string type = 2; + */ + public boolean hasType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional string type = 2; + */ + public java.lang.String getType() { + java.lang.Object ref = type_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + type_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string type = 2; + */ + public com.google.protobuf.ByteString + getTypeBytes() { + java.lang.Object ref = type_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + type_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string type = 2; + */ + public Builder setType( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + type_ = value; + onChanged(); + return this; + } + /** + * optional string type = 2; + */ + public Builder clearType() { + bitField0_ = (bitField0_ & ~0x00000002); + type_ = getDefaultInstance().getType(); + onChanged(); + return this; + } + /** + * optional string type = 2; + */ + public Builder setTypeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + type_ = value; + onChanged(); + return this; + } + + // repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + private java.util.List attributes_ = + java.util.Collections.emptyList(); + private void ensureAttributesIsMutable() { + if (!((bitField0_ & 0x00000004) == 0x00000004)) { + attributes_ = new java.util.ArrayList(attributes_); + bitField0_ |= 0x00000004; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> attributesBuilder_; + + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public java.util.List getAttributesList() { + if (attributesBuilder_ == null) { + return java.util.Collections.unmodifiableList(attributes_); + } else { + return attributesBuilder_.getMessageList(); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public int getAttributesCount() { + if (attributesBuilder_ == null) { + return attributes_.size(); + } else { + return attributesBuilder_.getCount(); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index) { + if (attributesBuilder_ == null) { + return attributes_.get(index); + } else { + return attributesBuilder_.getMessage(index); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public Builder setAttributes( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) { + if (attributesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAttributesIsMutable(); + attributes_.set(index, value); + onChanged(); + } else { + attributesBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public Builder setAttributes( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) { + if (attributesBuilder_ == null) { + ensureAttributesIsMutable(); + attributes_.set(index, builderForValue.build()); + onChanged(); + } else { + attributesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public Builder addAttributes(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) { + if (attributesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAttributesIsMutable(); + attributes_.add(value); + onChanged(); + } else { + attributesBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public Builder addAttributes( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) { + if (attributesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAttributesIsMutable(); + attributes_.add(index, value); + onChanged(); + } else { + attributesBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public Builder addAttributes( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) { + if (attributesBuilder_ == null) { + ensureAttributesIsMutable(); + attributes_.add(builderForValue.build()); + onChanged(); + } else { + attributesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public Builder addAttributes( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) { + if (attributesBuilder_ == null) { + ensureAttributesIsMutable(); + attributes_.add(index, builderForValue.build()); + onChanged(); + } else { + attributesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public Builder addAllAttributes( + java.lang.Iterable values) { + if (attributesBuilder_ == null) { + ensureAttributesIsMutable(); + super.addAll(values, attributes_); + onChanged(); + } else { + attributesBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public Builder clearAttributes() { + if (attributesBuilder_ == null) { + attributes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + } else { + attributesBuilder_.clear(); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public Builder removeAttributes(int index) { + if (attributesBuilder_ == null) { + ensureAttributesIsMutable(); + attributes_.remove(index); + onChanged(); + } else { + attributesBuilder_.remove(index); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder getAttributesBuilder( + int index) { + return getAttributesFieldBuilder().getBuilder(index); + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder( + int index) { + if (attributesBuilder_ == null) { + return attributes_.get(index); } else { + return attributesBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public java.util.List + getAttributesOrBuilderList() { + if (attributesBuilder_ != null) { + return attributesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(attributes_); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder addAttributesBuilder() { + return getAttributesFieldBuilder().addBuilder( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance()); + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder addAttributesBuilder( + int index) { + return getAttributesFieldBuilder().addBuilder( + index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance()); + } + /** + * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + */ + public java.util.List + getAttributesBuilderList() { + return getAttributesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> + getAttributesFieldBuilder() { + if (attributesBuilder_ == null) { + attributesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>( + attributes_, + ((bitField0_ & 0x00000004) == 0x00000004), + getParentForChildren(), + isClean()); + attributes_ = null; + } + return attributesBuilder_; + } + + // repeated .org.opendaylight.controller.mdsal.Node child = 4; + private java.util.List child_ = + java.util.Collections.emptyList(); + private void ensureChildIsMutable() { + if (!((bitField0_ & 0x00000008) == 0x00000008)) { + child_ = new java.util.ArrayList(child_); + bitField0_ |= 0x00000008; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> childBuilder_; + + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public java.util.List getChildList() { + if (childBuilder_ == null) { + return java.util.Collections.unmodifiableList(child_); + } else { + return childBuilder_.getMessageList(); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public int getChildCount() { + if (childBuilder_ == null) { + return child_.size(); + } else { + return childBuilder_.getCount(); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getChild(int index) { + if (childBuilder_ == null) { + return child_.get(index); + } else { + return childBuilder_.getMessage(index); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public Builder setChild( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { + if (childBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureChildIsMutable(); + child_.set(index, value); + onChanged(); + } else { + childBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public Builder setChild( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) { + if (childBuilder_ == null) { + ensureChildIsMutable(); + child_.set(index, builderForValue.build()); + onChanged(); + } else { + childBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public Builder addChild(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { + if (childBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureChildIsMutable(); + child_.add(value); + onChanged(); + } else { + childBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public Builder addChild( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { + if (childBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureChildIsMutable(); + child_.add(index, value); + onChanged(); + } else { + childBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public Builder addChild( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) { + if (childBuilder_ == null) { + ensureChildIsMutable(); + child_.add(builderForValue.build()); + onChanged(); + } else { + childBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public Builder addChild( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) { + if (childBuilder_ == null) { + ensureChildIsMutable(); + child_.add(index, builderForValue.build()); + onChanged(); + } else { + childBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public Builder addAllChild( + java.lang.Iterable values) { + if (childBuilder_ == null) { + ensureChildIsMutable(); + super.addAll(values, child_); + onChanged(); + } else { + childBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public Builder clearChild() { + if (childBuilder_ == null) { + child_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + } else { + childBuilder_.clear(); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public Builder removeChild(int index) { + if (childBuilder_ == null) { + ensureChildIsMutable(); + child_.remove(index); + onChanged(); + } else { + childBuilder_.remove(index); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getChildBuilder( + int index) { + return getChildFieldBuilder().getBuilder(index); + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getChildOrBuilder( + int index) { + if (childBuilder_ == null) { + return child_.get(index); } else { + return childBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public java.util.List + getChildOrBuilderList() { + if (childBuilder_ != null) { + return childBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(child_); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder addChildBuilder() { + return getChildFieldBuilder().addBuilder( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()); + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder addChildBuilder( + int index) { + return getChildFieldBuilder().addBuilder( + index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()); + } + /** + * repeated .org.opendaylight.controller.mdsal.Node child = 4; + */ + public java.util.List + getChildBuilderList() { + return getChildFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> + getChildFieldBuilder() { + if (childBuilder_ == null) { + childBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>( + child_, + ((bitField0_ & 0x00000008) == 0x00000008), + getParentForChildren(), + isClean()); + child_ = null; + } + return childBuilder_; + } + + // optional string value = 5; + private java.lang.Object value_ = ""; + /** + * optional string value = 5; + */ + public boolean hasValue() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional string value = 5; + */ + 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; + } + } + /** + * optional string value = 5; + */ + 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; + } + } + /** + * optional string value = 5; + */ + public Builder setValue( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + value_ = value; + onChanged(); + return this; + } + /** + * optional string value = 5; + */ + public Builder clearValue() { + bitField0_ = (bitField0_ & ~0x00000010); + value_ = getDefaultInstance().getValue(); + onChanged(); + return this; + } + /** + * optional string value = 5; + */ + public Builder setValueBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + value_ = value; + onChanged(); + return this; + } + + // optional string valueType = 6; + private java.lang.Object valueType_ = ""; + /** + * optional string valueType = 6; + */ + public boolean hasValueType() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + /** + * optional string valueType = 6; + */ + public java.lang.String getValueType() { + java.lang.Object ref = valueType_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + valueType_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string valueType = 6; + */ + 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; + } + } + /** + * optional string valueType = 6; + */ + public Builder setValueType( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000020; + valueType_ = value; + onChanged(); + return this; + } + /** + * optional string valueType = 6; + */ + public Builder clearValueType() { + bitField0_ = (bitField0_ & ~0x00000020); + valueType_ = getDefaultInstance().getValueType(); + onChanged(); + return this; + } + /** + * optional string valueType = 6; + */ + public Builder setValueTypeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000020; + valueType_ = value; + onChanged(); + return this; + } + + // repeated string bitsValue = 7; + private com.google.protobuf.LazyStringList bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureBitsValueIsMutable() { + if (!((bitField0_ & 0x00000040) == 0x00000040)) { + bitsValue_ = new com.google.protobuf.LazyStringArrayList(bitsValue_); + bitField0_ |= 0x00000040; + } + } + /** + * repeated string bitsValue = 7; + */ + public java.util.List + getBitsValueList() { + return java.util.Collections.unmodifiableList(bitsValue_); + } + /** + * repeated string bitsValue = 7; + */ + public int getBitsValueCount() { + return bitsValue_.size(); + } + /** + * repeated string bitsValue = 7; + */ + public java.lang.String getBitsValue(int index) { + return bitsValue_.get(index); + } + /** + * repeated string bitsValue = 7; + */ + public com.google.protobuf.ByteString + getBitsValueBytes(int index) { + return bitsValue_.getByteString(index); + } + /** + * repeated string bitsValue = 7; + */ + public Builder setBitsValue( + int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureBitsValueIsMutable(); + bitsValue_.set(index, value); + onChanged(); + return this; + } + /** + * repeated string bitsValue = 7; + */ + public Builder addBitsValue( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureBitsValueIsMutable(); + bitsValue_.add(value); + onChanged(); + return this; + } + /** + * repeated string bitsValue = 7; + */ + public Builder addAllBitsValue( + java.lang.Iterable values) { + ensureBitsValueIsMutable(); + super.addAll(values, bitsValue_); + onChanged(); + return this; + } + /** + * repeated string bitsValue = 7; + */ + public Builder clearBitsValue() { + bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000040); + onChanged(); + return this; + } + /** + * repeated string bitsValue = 7; + */ + public Builder addBitsValueBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureBitsValueIsMutable(); + bitsValue_.add(value); + onChanged(); + return this; + } + + // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierValueBuilder_; + /** + * optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8; + */ + public boolean hasInstanceIdentifierValue() { + return ((bitField0_ & 0x00000080) == 0x00000080); + } + /** + * optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue() { + if (instanceIdentifierValueBuilder_ == null) { + return instanceIdentifierValue_; + } else { + return instanceIdentifierValueBuilder_.getMessage(); + } + } + /** + * optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8; + */ + 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; + } + /** + * optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8; + */ + 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; + } + /** + * optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8; + */ + public Builder mergeInstanceIdentifierValue(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) { + if (instanceIdentifierValueBuilder_ == null) { + if (((bitField0_ & 0x00000080) == 0x00000080) && + instanceIdentifierValue_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) { + instanceIdentifierValue_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierValue_).mergeFrom(value).buildPartial(); + } else { + instanceIdentifierValue_ = value; + } + onChanged(); + } else { + instanceIdentifierValueBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000080; + return this; + } + /** + * optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8; + */ + public Builder clearInstanceIdentifierValue() { + if (instanceIdentifierValueBuilder_ == null) { + instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + onChanged(); + } else { + instanceIdentifierValueBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000080); + return this; + } + /** + * optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierValueBuilder() { + bitField0_ |= 0x00000080; + onChanged(); + return getInstanceIdentifierValueFieldBuilder().getBuilder(); + } + /** + * optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder() { + if (instanceIdentifierValueBuilder_ != null) { + return instanceIdentifierValueBuilder_.getMessageOrBuilder(); + } else { + return instanceIdentifierValue_; + } + } + /** + * optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8; + */ + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> + getInstanceIdentifierValueFieldBuilder() { + if (instanceIdentifierValueBuilder_ == null) { + instanceIdentifierValueBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>( + instanceIdentifierValue_, + getParentForChildren(), + isClean()); + instanceIdentifierValue_ = null; + } + return instanceIdentifierValueBuilder_; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.Node) + } + + static { + defaultInstance = new Node(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.Node) + } + + public interface ContainerOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string parentPath = 1; + /** + * required string parentPath = 1; + */ + boolean hasParentPath(); + /** + * required string parentPath = 1; + */ + java.lang.String getParentPath(); + /** + * required string parentPath = 1; + */ + com.google.protobuf.ByteString + getParentPathBytes(); + + // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + boolean hasNormalizedNode(); + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode(); + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder(); + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.Container} + */ + public static final class Container extends + com.google.protobuf.GeneratedMessage + implements ContainerOrBuilder { + // Use Container.newBuilder() to construct. + private Container(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private Container(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final Container defaultInstance; + public static Container getDefaultInstance() { + return defaultInstance; + } + + public Container getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Container( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + parentPath_ = input.readBytes(); + break; + } + case 18: { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + subBuilder = normalizedNode_.toBuilder(); + } + normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(normalizedNode_); + normalizedNode_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000002; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public Container parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Container(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // required string parentPath = 1; + public static final int PARENTPATH_FIELD_NUMBER = 1; + private java.lang.Object parentPath_; + /** + * required string parentPath = 1; + */ + public boolean hasParentPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string parentPath = 1; + */ + public java.lang.String getParentPath() { + java.lang.Object ref = parentPath_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + parentPath_ = s; + } + return s; + } + } + /** + * required string parentPath = 1; + */ + public com.google.protobuf.ByteString + getParentPathBytes() { + java.lang.Object ref = parentPath_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parentPath_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + public static final int NORMALIZEDNODE_FIELD_NUMBER = 2; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_; + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + public boolean hasNormalizedNode() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() { + return normalizedNode_; + } + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() { + return normalizedNode_; + } + + private void initFields() { + parentPath_ = ""; + normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasParentPath()) { + memoizedIsInitialized = 0; + return false; + } + if (hasNormalizedNode()) { + if (!getNormalizedNode().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getParentPathBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, normalizedNode_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getParentPathBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, normalizedNode_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.Container} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.ContainerOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.Builder.class); + } + + // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getNormalizedNodeFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + parentPath_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + if (normalizedNodeBuilder_ == null) { + normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + } else { + normalizedNodeBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_descriptor; + } + + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container getDefaultInstanceForType() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.getDefaultInstance(); + } + + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container build() { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container buildPartial() { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.parentPath_ = parentPath_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + if (normalizedNodeBuilder_ == null) { + result.normalizedNode_ = normalizedNode_; + } else { + result.normalizedNode_ = normalizedNodeBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container) { + return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container other) { + if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.getDefaultInstance()) return this; + if (other.hasParentPath()) { + bitField0_ |= 0x00000001; + parentPath_ = other.parentPath_; + onChanged(); + } + if (other.hasNormalizedNode()) { + mergeNormalizedNode(other.getNormalizedNode()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasParentPath()) { + + return false; + } + if (hasNormalizedNode()) { + if (!getNormalizedNode().isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } } + return this; } + private int bitField0_; + + // required string parentPath = 1; + private java.lang.Object parentPath_ = ""; /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + * required string parentPath = 1; */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute getAttributes(int index) { - if (attributesBuilder_ == null) { - return attributes_.get(index); + public boolean hasParentPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string parentPath = 1; + */ + public java.lang.String getParentPath() { + java.lang.Object ref = parentPath_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + parentPath_ = s; + return s; } else { - return attributesBuilder_.getMessage(index); + return (java.lang.String) ref; } } /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + * required string parentPath = 1; */ - public Builder setAttributes( - int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) { - if (attributesBuilder_ == null) { + public com.google.protobuf.ByteString + getParentPathBytes() { + java.lang.Object ref = parentPath_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parentPath_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string parentPath = 1; + */ + public Builder setParentPath( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + parentPath_ = value; + onChanged(); + return this; + } + /** + * required string parentPath = 1; + */ + public Builder clearParentPath() { + bitField0_ = (bitField0_ & ~0x00000001); + parentPath_ = getDefaultInstance().getParentPath(); + onChanged(); + return this; + } + /** + * required string parentPath = 1; + */ + public Builder setParentPathBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + parentPath_ = value; + onChanged(); + return this; + } + + // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> normalizedNodeBuilder_; + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + public boolean hasNormalizedNode() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() { + if (normalizedNodeBuilder_ == null) { + return normalizedNode_; + } else { + return normalizedNodeBuilder_.getMessage(); + } + } + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { + if (normalizedNodeBuilder_ == null) { if (value == null) { throw new NullPointerException(); } - ensureAttributesIsMutable(); - attributes_.set(index, value); + normalizedNode_ = value; onChanged(); } else { - attributesBuilder_.setMessage(index, value); + normalizedNodeBuilder_.setMessage(value); } + bitField0_ |= 0x00000002; return this; } /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; */ - public Builder setAttributes( - int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) { - if (attributesBuilder_ == null) { - ensureAttributesIsMutable(); - attributes_.set(index, builderForValue.build()); + public Builder setNormalizedNode( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) { + if (normalizedNodeBuilder_ == null) { + normalizedNode_ = builderForValue.build(); onChanged(); } else { - attributesBuilder_.setMessage(index, builderForValue.build()); + normalizedNodeBuilder_.setMessage(builderForValue.build()); } + bitField0_ |= 0x00000002; return this; } /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; */ - public Builder addAttributes(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) { - if (attributesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); + public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { + if (normalizedNodeBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + normalizedNode_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) { + normalizedNode_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(normalizedNode_).mergeFrom(value).buildPartial(); + } else { + normalizedNode_ = value; } - ensureAttributesIsMutable(); - attributes_.add(value); onChanged(); } else { - attributesBuilder_.addMessage(value); + normalizedNodeBuilder_.mergeFrom(value); } + bitField0_ |= 0x00000002; return this; } /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; */ - public Builder addAttributes( - int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute value) { - if (attributesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAttributesIsMutable(); - attributes_.add(index, value); + public Builder clearNormalizedNode() { + if (normalizedNodeBuilder_ == null) { + normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); onChanged(); } else { - attributesBuilder_.addMessage(index, value); + normalizedNodeBuilder_.clear(); } + bitField0_ = (bitField0_ & ~0x00000002); return this; } - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - public Builder addAttributes( - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) { - if (attributesBuilder_ == null) { - ensureAttributesIsMutable(); - attributes_.add(builderForValue.build()); - onChanged(); - } else { - attributesBuilder_.addMessage(builderForValue.build()); - } - return this; + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getNormalizedNodeBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getNormalizedNodeFieldBuilder().getBuilder(); + } + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() { + if (normalizedNodeBuilder_ != null) { + return normalizedNodeBuilder_.getMessageOrBuilder(); + } else { + return normalizedNode_; + } + } + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> + getNormalizedNodeFieldBuilder() { + if (normalizedNodeBuilder_ == null) { + normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>( + normalizedNode_, + getParentForChildren(), + isClean()); + normalizedNode_ = null; + } + return normalizedNodeBuilder_; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.Container) + } + + static { + defaultInstance = new Container(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.Container) + } + + public interface NodeMapEntryOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; + */ + boolean hasInstanceIdentifierPath(); + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPath(); + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathOrBuilder(); + + // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + boolean hasNormalizedNode(); + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode(); + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder(); + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.NodeMapEntry} + */ + public static final class NodeMapEntry extends + com.google.protobuf.GeneratedMessage + implements NodeMapEntryOrBuilder { + // Use NodeMapEntry.newBuilder() to construct. + private NodeMapEntry(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private NodeMapEntry(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final NodeMapEntry defaultInstance; + public static NodeMapEntry getDefaultInstance() { + return defaultInstance; + } + + public NodeMapEntry getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private NodeMapEntry( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + subBuilder = instanceIdentifierPath_.toBuilder(); + } + instanceIdentifierPath_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(instanceIdentifierPath_); + instanceIdentifierPath_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000001; + break; + } + case 18: { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + subBuilder = normalizedNode_.toBuilder(); + } + normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(normalizedNode_); + normalizedNode_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000002; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public NodeMapEntry parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new NodeMapEntry(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; + public static final int INSTANCEIDENTIFIERPATH_FIELD_NUMBER = 1; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPath_; + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; + */ + public boolean hasInstanceIdentifierPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPath() { + return instanceIdentifierPath_; + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathOrBuilder() { + return instanceIdentifierPath_; + } + + // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + public static final int NORMALIZEDNODE_FIELD_NUMBER = 2; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_; + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + public boolean hasNormalizedNode() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() { + return normalizedNode_; + } + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() { + return normalizedNode_; + } + + private void initFields() { + instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasInstanceIdentifierPath()) { + memoizedIsInitialized = 0; + return false; + } + if (!getInstanceIdentifierPath().isInitialized()) { + memoizedIsInitialized = 0; + return false; } - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - public Builder addAttributes( - int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder builderForValue) { - if (attributesBuilder_ == null) { - ensureAttributesIsMutable(); - attributes_.add(index, builderForValue.build()); - onChanged(); - } else { - attributesBuilder_.addMessage(index, builderForValue.build()); + if (hasNormalizedNode()) { + if (!getNormalizedNode().isInitialized()) { + memoizedIsInitialized = 0; + return false; } - return this; } - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - public Builder addAllAttributes( - java.lang.Iterable values) { - if (attributesBuilder_ == null) { - ensureAttributesIsMutable(); - super.addAll(values, attributes_); - onChanged(); - } else { - attributesBuilder_.addAllMessages(values); - } - return this; + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, instanceIdentifierPath_); } - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - public Builder clearAttributes() { - if (attributesBuilder_ == null) { - attributes_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - } else { - attributesBuilder_.clear(); - } - return this; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, normalizedNode_); } - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - public Builder removeAttributes(int index) { - if (attributesBuilder_ == null) { - ensureAttributesIsMutable(); - attributes_.remove(index); - onChanged(); - } else { - attributesBuilder_.remove(index); - } - return this; + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, instanceIdentifierPath_); } - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder getAttributesBuilder( - int index) { - return getAttributesFieldBuilder().getBuilder(index); + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, normalizedNode_); } - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder getAttributesOrBuilder( - int index) { - if (attributesBuilder_ == null) { - return attributes_.get(index); } else { - return attributesBuilder_.getMessageOrBuilder(index); - } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.NodeMapEntry} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor; } - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - public java.util.List - getAttributesOrBuilderList() { - if (attributesBuilder_ != null) { - return attributesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(attributes_); - } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder.class); } - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder addAttributesBuilder() { - return getAttributesFieldBuilder().addBuilder( - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance()); + + // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); } - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder addAttributesBuilder( - int index) { - return getAttributesFieldBuilder().addBuilder( - index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.getDefaultInstance()); + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); } - /** - * repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3; - */ - public java.util.List - getAttributesBuilderList() { - return getAttributesFieldBuilder().getBuilderList(); + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getInstanceIdentifierPathFieldBuilder(); + getNormalizedNodeFieldBuilder(); + } } - private com.google.protobuf.RepeatedFieldBuilder< - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder> - getAttributesFieldBuilder() { - if (attributesBuilder_ == null) { - attributesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>( - attributes_, - ((bitField0_ & 0x00000004) == 0x00000004), - getParentForChildren(), - isClean()); - attributes_ = null; + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (instanceIdentifierPathBuilder_ == null) { + instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + } else { + instanceIdentifierPathBuilder_.clear(); } - return attributesBuilder_; + bitField0_ = (bitField0_ & ~0x00000001); + if (normalizedNodeBuilder_ == null) { + normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + } else { + normalizedNodeBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; } - // repeated .org.opendaylight.controller.mdsal.Node child = 4; - private java.util.List child_ = - java.util.Collections.emptyList(); - private void ensureChildIsMutable() { - if (!((bitField0_ & 0x00000008) == 0x00000008)) { - child_ = new java.util.ArrayList(child_); - bitField0_ |= 0x00000008; - } + public Builder clone() { + return create().mergeFrom(buildPartial()); } - private com.google.protobuf.RepeatedFieldBuilder< - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> childBuilder_; + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor; + } - /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; - */ - public java.util.List getChildList() { - if (childBuilder_ == null) { - return java.util.Collections.unmodifiableList(child_); - } else { - return childBuilder_.getMessageList(); + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry getDefaultInstanceForType() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.getDefaultInstance(); + } + + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry build() { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); } + return result; } - /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; - */ - public int getChildCount() { - if (childBuilder_ == null) { - return child_.size(); + + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry buildPartial() { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (instanceIdentifierPathBuilder_ == null) { + result.instanceIdentifierPath_ = instanceIdentifierPath_; } else { - return childBuilder_.getCount(); + result.instanceIdentifierPath_ = instanceIdentifierPathBuilder_.build(); } - } - /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; - */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getChild(int index) { - if (childBuilder_ == null) { - return child_.get(index); + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + if (normalizedNodeBuilder_ == null) { + result.normalizedNode_ = normalizedNode_; } else { - return childBuilder_.getMessage(index); + result.normalizedNode_ = normalizedNodeBuilder_.build(); } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; } - /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; - */ - public Builder setChild( - int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { - if (childBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureChildIsMutable(); - child_.set(index, value); - onChanged(); + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry) { + return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry)other); } else { - childBuilder_.setMessage(index, value); + super.mergeFrom(other); + return this; } - return this; } - /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; - */ - public Builder setChild( - int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) { - if (childBuilder_ == null) { - ensureChildIsMutable(); - child_.set(index, builderForValue.build()); - onChanged(); - } else { - childBuilder_.setMessage(index, builderForValue.build()); + + public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry other) { + if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.getDefaultInstance()) return this; + if (other.hasInstanceIdentifierPath()) { + mergeInstanceIdentifierPath(other.getInstanceIdentifierPath()); + } + if (other.hasNormalizedNode()) { + mergeNormalizedNode(other.getNormalizedNode()); } + this.mergeUnknownFields(other.getUnknownFields()); return this; } - /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; - */ - public Builder addChild(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { - if (childBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); + + public final boolean isInitialized() { + if (!hasInstanceIdentifierPath()) { + + return false; + } + if (!getInstanceIdentifierPath().isInitialized()) { + + return false; + } + if (hasNormalizedNode()) { + if (!getNormalizedNode().isInitialized()) { + + return false; } - ensureChildIsMutable(); - child_.add(value); - onChanged(); - } else { - childBuilder_.addMessage(value); } - return this; + return true; } - /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; - */ - public Builder addChild( - int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { - if (childBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); } - ensureChildIsMutable(); - child_.add(index, value); - onChanged(); - } else { - childBuilder_.addMessage(index, value); } return this; } + private int bitField0_; + + // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierPathBuilder_; /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ - public Builder addChild( - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) { - if (childBuilder_ == null) { - ensureChildIsMutable(); - child_.add(builderForValue.build()); - onChanged(); + public boolean hasInstanceIdentifierPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPath() { + if (instanceIdentifierPathBuilder_ == null) { + return instanceIdentifierPath_; } else { - childBuilder_.addMessage(builderForValue.build()); + return instanceIdentifierPathBuilder_.getMessage(); } - return this; } /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ - public Builder addChild( - int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) { - if (childBuilder_ == null) { - ensureChildIsMutable(); - child_.add(index, builderForValue.build()); + public Builder setInstanceIdentifierPath(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) { + if (instanceIdentifierPathBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + instanceIdentifierPath_ = value; onChanged(); } else { - childBuilder_.addMessage(index, builderForValue.build()); + instanceIdentifierPathBuilder_.setMessage(value); } + bitField0_ |= 0x00000001; return this; } /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ - public Builder addAllChild( - java.lang.Iterable values) { - if (childBuilder_ == null) { - ensureChildIsMutable(); - super.addAll(values, child_); + public Builder setInstanceIdentifierPath( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) { + if (instanceIdentifierPathBuilder_ == null) { + instanceIdentifierPath_ = builderForValue.build(); onChanged(); } else { - childBuilder_.addAllMessages(values); + instanceIdentifierPathBuilder_.setMessage(builderForValue.build()); } + bitField0_ |= 0x00000001; return this; } /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ - public Builder clearChild() { - if (childBuilder_ == null) { - child_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); + public Builder mergeInstanceIdentifierPath(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) { + if (instanceIdentifierPathBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + instanceIdentifierPath_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) { + instanceIdentifierPath_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierPath_).mergeFrom(value).buildPartial(); + } else { + instanceIdentifierPath_ = value; + } onChanged(); } else { - childBuilder_.clear(); + instanceIdentifierPathBuilder_.mergeFrom(value); } + bitField0_ |= 0x00000001; return this; } /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ - public Builder removeChild(int index) { - if (childBuilder_ == null) { - ensureChildIsMutable(); - child_.remove(index); + public Builder clearInstanceIdentifierPath() { + if (instanceIdentifierPathBuilder_ == null) { + instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); onChanged(); } else { - childBuilder_.remove(index); + instanceIdentifierPathBuilder_.clear(); } + bitField0_ = (bitField0_ & ~0x00000001); return this; } /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; - */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getChildBuilder( - int index) { - return getChildFieldBuilder().getBuilder(index); - } - /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getChildOrBuilder( - int index) { - if (childBuilder_ == null) { - return child_.get(index); } else { - return childBuilder_.getMessageOrBuilder(index); - } + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierPathBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getInstanceIdentifierPathFieldBuilder().getBuilder(); } /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ - public java.util.List - getChildOrBuilderList() { - if (childBuilder_ != null) { - return childBuilder_.getMessageOrBuilderList(); + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathOrBuilder() { + if (instanceIdentifierPathBuilder_ != null) { + return instanceIdentifierPathBuilder_.getMessageOrBuilder(); } else { - return java.util.Collections.unmodifiableList(child_); + return instanceIdentifierPath_; } } /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder addChildBuilder() { - return getChildFieldBuilder().addBuilder( - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.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> + getInstanceIdentifierPathFieldBuilder() { + if (instanceIdentifierPathBuilder_ == null) { + instanceIdentifierPathBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>( + instanceIdentifierPath_, + getParentForChildren(), + isClean()); + instanceIdentifierPath_ = null; + } + return instanceIdentifierPathBuilder_; } + + // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> normalizedNodeBuilder_; /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder addChildBuilder( - int index) { - return getChildFieldBuilder().addBuilder( - index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()); + public boolean hasNormalizedNode() { + return ((bitField0_ & 0x00000002) == 0x00000002); } /** - * repeated .org.opendaylight.controller.mdsal.Node child = 4; + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; */ - public java.util.List - getChildBuilderList() { - return getChildFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> - getChildFieldBuilder() { - if (childBuilder_ == null) { - childBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>( - child_, - ((bitField0_ & 0x00000008) == 0x00000008), - getParentForChildren(), - isClean()); - child_ = null; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() { + if (normalizedNodeBuilder_ == null) { + return normalizedNode_; + } else { + return normalizedNodeBuilder_.getMessage(); } - return childBuilder_; } - - // optional string value = 5; - private java.lang.Object value_ = ""; /** - * optional string value = 5; + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; */ - public boolean hasValue() { - return ((bitField0_ & 0x00000010) == 0x00000010); + public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { + if (normalizedNodeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + normalizedNode_ = value; + onChanged(); + } else { + normalizedNodeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; } /** - * optional string value = 5; + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; */ - 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; + public Builder setNormalizedNode( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) { + if (normalizedNodeBuilder_ == null) { + normalizedNode_ = builderForValue.build(); + onChanged(); } else { - return (java.lang.String) ref; + normalizedNodeBuilder_.setMessage(builderForValue.build()); } + bitField0_ |= 0x00000002; + return this; } /** - * optional string value = 5; + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; */ - 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; + public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { + if (normalizedNodeBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + normalizedNode_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) { + normalizedNode_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(normalizedNode_).mergeFrom(value).buildPartial(); + } else { + normalizedNode_ = value; + } + onChanged(); } else { - return (com.google.protobuf.ByteString) ref; + normalizedNodeBuilder_.mergeFrom(value); } + bitField0_ |= 0x00000002; + return this; } /** - * optional string value = 5; + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; */ - public Builder setValue( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000010; - value_ = value; - onChanged(); + public Builder clearNormalizedNode() { + if (normalizedNodeBuilder_ == null) { + normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + onChanged(); + } else { + normalizedNodeBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); return this; } /** - * optional string value = 5; + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; */ - public Builder clearValue() { - bitField0_ = (bitField0_ & ~0x00000010); - value_ = getDefaultInstance().getValue(); + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getNormalizedNodeBuilder() { + bitField0_ |= 0x00000002; onChanged(); - return this; + return getNormalizedNodeFieldBuilder().getBuilder(); } /** - * optional string value = 5; + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; */ - public Builder setValueBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000010; - value_ = value; - onChanged(); - return this; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() { + if (normalizedNodeBuilder_ != null) { + return normalizedNodeBuilder_.getMessageOrBuilder(); + } else { + return normalizedNode_; + } + } + /** + * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> + getNormalizedNodeFieldBuilder() { + if (normalizedNodeBuilder_ == null) { + normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>( + normalizedNode_, + getParentForChildren(), + isClean()); + normalizedNode_ = null; + } + return normalizedNodeBuilder_; } - // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.Node) + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.NodeMapEntry) } static { - defaultInstance = new Node(true); + defaultInstance = new NodeMapEntry(true); defaultInstance.initFields(); } - // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.Node) + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.NodeMapEntry) } - public interface ContainerOrBuilder + public interface NodeMapOrBuilder extends com.google.protobuf.MessageOrBuilder { - // required string parentPath = 1; - /** - * required string parentPath = 1; - */ - boolean hasParentPath(); + // repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; /** - * required string parentPath = 1; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - java.lang.String getParentPath(); + java.util.List + getMapEntriesList(); /** - * required string parentPath = 1; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - com.google.protobuf.ByteString - getParentPathBytes(); - - // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry getMapEntries(int index); /** - * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - boolean hasNormalizedNode(); + int getMapEntriesCount(); /** - * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode(); + java.util.List + getMapEntriesOrBuilderList(); /** - * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder getMapEntriesOrBuilder( + int index); } /** - * Protobuf type {@code org.opendaylight.controller.mdsal.Container} + * Protobuf type {@code org.opendaylight.controller.mdsal.NodeMap} */ - public static final class Container extends + public static final class NodeMap extends com.google.protobuf.GeneratedMessage - implements ContainerOrBuilder { - // Use Container.newBuilder() to construct. - private Container(com.google.protobuf.GeneratedMessage.Builder builder) { + implements NodeMapOrBuilder { + // Use NodeMap.newBuilder() to construct. + private NodeMap(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } - private Container(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + private NodeMap(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - private static final Container defaultInstance; - public static Container getDefaultInstance() { + private static final NodeMap defaultInstance; + public static NodeMap getDefaultInstance() { return defaultInstance; } - public Container getDefaultInstanceForType() { + public NodeMap getDefaultInstanceForType() { return defaultInstance; } @@ -2242,7 +6767,7 @@ public final class NormalizedNodeMessages { getUnknownFields() { return this.unknownFields; } - private Container( + private NodeMap( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { @@ -2266,21 +6791,11 @@ public final class NormalizedNodeMessages { break; } case 10: { - bitField0_ |= 0x00000001; - parentPath_ = input.readBytes(); - break; - } - case 18: { - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null; - if (((bitField0_ & 0x00000002) == 0x00000002)) { - subBuilder = normalizedNode_.toBuilder(); - } - normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(normalizedNode_); - normalizedNode_ = subBuilder.buildPartial(); + if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + mapEntries_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; } - bitField0_ |= 0x00000002; + mapEntries_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.PARSER, extensionRegistry)); break; } } @@ -2291,118 +6806,86 @@ public final class NormalizedNodeMessages { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { + if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + mapEntries_ = java.util.Collections.unmodifiableList(mapEntries_); + } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_descriptor; + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_fieldAccessorTable + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMap_fieldAccessorTable .ensureFieldAccessorsInitialized( - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.Builder.class); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder.class); } - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public Container parsePartialFrom( + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public NodeMap parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new Container(input, extensionRegistry); + return new NodeMap(input, extensionRegistry); } }; @java.lang.Override - public com.google.protobuf.Parser getParserForType() { + public com.google.protobuf.Parser getParserForType() { return PARSER; } - private int bitField0_; - // required string parentPath = 1; - public static final int PARENTPATH_FIELD_NUMBER = 1; - private java.lang.Object parentPath_; + // repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; + public static final int MAPENTRIES_FIELD_NUMBER = 1; + private java.util.List mapEntries_; /** - * required string parentPath = 1; - */ - public boolean hasParentPath() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * required string parentPath = 1; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public java.lang.String getParentPath() { - java.lang.Object ref = parentPath_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - parentPath_ = s; - } - return s; - } + public java.util.List getMapEntriesList() { + return mapEntries_; } /** - * required string parentPath = 1; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public com.google.protobuf.ByteString - getParentPathBytes() { - java.lang.Object ref = parentPath_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - parentPath_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } + public java.util.List + getMapEntriesOrBuilderList() { + return mapEntries_; } - - // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; - public static final int NORMALIZEDNODE_FIELD_NUMBER = 2; - private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_; /** - * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public boolean hasNormalizedNode() { - return ((bitField0_ & 0x00000002) == 0x00000002); + public int getMapEntriesCount() { + return mapEntries_.size(); } /** - * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() { - return normalizedNode_; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry getMapEntries(int index) { + return mapEntries_.get(index); } /** - * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() { - return normalizedNode_; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder getMapEntriesOrBuilder( + int index) { + return mapEntries_.get(index); } private void initFields() { - parentPath_ = ""; - normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + mapEntries_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; - if (!hasParentPath()) { - memoizedIsInitialized = 0; - return false; - } - if (hasNormalizedNode()) { - if (!getNormalizedNode().isInitialized()) { + for (int i = 0; i < getMapEntriesCount(); i++) { + if (!getMapEntries(i).isInitialized()) { memoizedIsInitialized = 0; return false; } @@ -2414,11 +6897,8 @@ public final class NormalizedNodeMessages { public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getParentPathBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(2, normalizedNode_); + for (int i = 0; i < mapEntries_.size(); i++) { + output.writeMessage(1, mapEntries_.get(i)); } getUnknownFields().writeTo(output); } @@ -2429,13 +6909,9 @@ public final class NormalizedNodeMessages { if (size != -1) return size; size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getParentPathBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { + for (int i = 0; i < mapEntries_.size(); i++) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, normalizedNode_); + .computeMessageSize(1, mapEntries_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; @@ -2449,53 +6925,53 @@ public final class NormalizedNodeMessages { return super.writeReplace(); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom( + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom( + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(byte[] data) + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom( + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom(java.io.InputStream input) + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom( + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseDelimitedFrom(java.io.InputStream input) + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseDelimitedFrom( + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom( + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } - public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parseFrom( + public static org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -2504,7 +6980,7 @@ public final class NormalizedNodeMessages { public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container prototype) { + public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @@ -2516,24 +6992,24 @@ public final class NormalizedNodeMessages { return builder; } /** - * Protobuf type {@code org.opendaylight.controller.mdsal.Container} + * Protobuf type {@code org.opendaylight.controller.mdsal.NodeMap} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder - implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.ContainerOrBuilder { + implements org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_descriptor; + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_fieldAccessorTable + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMap_fieldAccessorTable .ensureFieldAccessorsInitialized( - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.Builder.class); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.class, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder.class); } - // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.newBuilder() + // Construct using org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.newBuilder() private Builder() { maybeForceBuilderInitialization(); } @@ -2545,7 +7021,7 @@ public final class NormalizedNodeMessages { } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getNormalizedNodeFieldBuilder(); + getMapEntriesFieldBuilder(); } } private static Builder create() { @@ -2554,14 +7030,12 @@ public final class NormalizedNodeMessages { public Builder clear() { super.clear(); - parentPath_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - if (normalizedNodeBuilder_ == null) { - normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + if (mapEntriesBuilder_ == null) { + mapEntries_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); } else { - normalizedNodeBuilder_.clear(); + mapEntriesBuilder_.clear(); } - bitField0_ = (bitField0_ & ~0x00000002); return this; } @@ -2571,72 +7045,81 @@ public final class NormalizedNodeMessages { public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_Container_descriptor; + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor; } - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container getDefaultInstanceForType() { - return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.getDefaultInstance(); + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getDefaultInstanceForType() { + return org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance(); } - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container build() { - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container result = buildPartial(); + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap build() { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container buildPartial() { - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container(this); + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap buildPartial() { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap result = new org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap(this); int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.parentPath_ = parentPath_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - if (normalizedNodeBuilder_ == null) { - result.normalizedNode_ = normalizedNode_; + if (mapEntriesBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + mapEntries_ = java.util.Collections.unmodifiableList(mapEntries_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.mapEntries_ = mapEntries_; } else { - result.normalizedNode_ = normalizedNodeBuilder_.build(); + result.mapEntries_ = mapEntriesBuilder_.build(); } - result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container) { - return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container)other); + if (other instanceof org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap) { + return mergeFrom((org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap)other); } else { super.mergeFrom(other); return this; } } - public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container other) { - if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container.getDefaultInstance()) return this; - if (other.hasParentPath()) { - bitField0_ |= 0x00000001; - parentPath_ = other.parentPath_; - onChanged(); - } - if (other.hasNormalizedNode()) { - mergeNormalizedNode(other.getNormalizedNode()); + public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap other) { + if (other == org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance()) return this; + if (mapEntriesBuilder_ == null) { + if (!other.mapEntries_.isEmpty()) { + if (mapEntries_.isEmpty()) { + mapEntries_ = other.mapEntries_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureMapEntriesIsMutable(); + mapEntries_.addAll(other.mapEntries_); + } + onChanged(); + } + } else { + if (!other.mapEntries_.isEmpty()) { + if (mapEntriesBuilder_.isEmpty()) { + mapEntriesBuilder_.dispose(); + mapEntriesBuilder_ = null; + mapEntries_ = other.mapEntries_; + bitField0_ = (bitField0_ & ~0x00000001); + mapEntriesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getMapEntriesFieldBuilder() : null; + } else { + mapEntriesBuilder_.addAllMessages(other.mapEntries_); + } + } } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { - if (!hasParentPath()) { - - return false; - } - if (hasNormalizedNode()) { - if (!getNormalizedNode().isInitialized()) { + for (int i = 0; i < getMapEntriesCount(); i++) { + if (!getMapEntries(i).isInitialized()) { return false; } @@ -2648,11 +7131,11 @@ public final class NormalizedNodeMessages { com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container parsedMessage = null; + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container) e.getUnfinishedMessage(); + parsedMessage = (org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { @@ -2663,206 +7146,255 @@ public final class NormalizedNodeMessages { } private int bitField0_; - // required string parentPath = 1; - private java.lang.Object parentPath_ = ""; + // repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; + private java.util.List mapEntries_ = + java.util.Collections.emptyList(); + private void ensureMapEntriesIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + mapEntries_ = new java.util.ArrayList(mapEntries_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder> mapEntriesBuilder_; + /** - * required string parentPath = 1; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public boolean hasParentPath() { - return ((bitField0_ & 0x00000001) == 0x00000001); + public java.util.List getMapEntriesList() { + if (mapEntriesBuilder_ == null) { + return java.util.Collections.unmodifiableList(mapEntries_); + } else { + return mapEntriesBuilder_.getMessageList(); + } } /** - * required string parentPath = 1; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public java.lang.String getParentPath() { - java.lang.Object ref = parentPath_; - if (!(ref instanceof java.lang.String)) { - java.lang.String s = ((com.google.protobuf.ByteString) ref) - .toStringUtf8(); - parentPath_ = s; - return s; + public int getMapEntriesCount() { + if (mapEntriesBuilder_ == null) { + return mapEntries_.size(); } else { - return (java.lang.String) ref; + return mapEntriesBuilder_.getCount(); } } /** - * required string parentPath = 1; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public com.google.protobuf.ByteString - getParentPathBytes() { - java.lang.Object ref = parentPath_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - parentPath_ = b; - return b; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry getMapEntries(int index) { + if (mapEntriesBuilder_ == null) { + return mapEntries_.get(index); } else { - return (com.google.protobuf.ByteString) ref; + return mapEntriesBuilder_.getMessage(index); } } /** - * required string parentPath = 1; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public Builder setParentPath( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - parentPath_ = value; - onChanged(); + public Builder setMapEntries( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry value) { + if (mapEntriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMapEntriesIsMutable(); + mapEntries_.set(index, value); + onChanged(); + } else { + mapEntriesBuilder_.setMessage(index, value); + } return this; } /** - * required string parentPath = 1; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public Builder clearParentPath() { - bitField0_ = (bitField0_ & ~0x00000001); - parentPath_ = getDefaultInstance().getParentPath(); - onChanged(); + public Builder setMapEntries( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder builderForValue) { + if (mapEntriesBuilder_ == null) { + ensureMapEntriesIsMutable(); + mapEntries_.set(index, builderForValue.build()); + onChanged(); + } else { + mapEntriesBuilder_.setMessage(index, builderForValue.build()); + } return this; } /** - * required string parentPath = 1; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public Builder setParentPathBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - parentPath_ = value; - onChanged(); + public Builder addMapEntries(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry value) { + if (mapEntriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMapEntriesIsMutable(); + mapEntries_.add(value); + onChanged(); + } else { + mapEntriesBuilder_.addMessage(value); + } return this; } - - // optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; - private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> normalizedNodeBuilder_; /** - * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public boolean hasNormalizedNode() { - return ((bitField0_ & 0x00000002) == 0x00000002); + public Builder addMapEntries( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry value) { + if (mapEntriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMapEntriesIsMutable(); + mapEntries_.add(index, value); + onChanged(); + } else { + mapEntriesBuilder_.addMessage(index, value); + } + return this; } /** - * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() { - if (normalizedNodeBuilder_ == null) { - return normalizedNode_; + public Builder addMapEntries( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder builderForValue) { + if (mapEntriesBuilder_ == null) { + ensureMapEntriesIsMutable(); + mapEntries_.add(builderForValue.build()); + onChanged(); } else { - return normalizedNodeBuilder_.getMessage(); + mapEntriesBuilder_.addMessage(builderForValue.build()); } + return this; } /** - * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { - if (normalizedNodeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - normalizedNode_ = value; + public Builder addMapEntries( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder builderForValue) { + if (mapEntriesBuilder_ == null) { + ensureMapEntriesIsMutable(); + mapEntries_.add(index, builderForValue.build()); onChanged(); } else { - normalizedNodeBuilder_.setMessage(value); + mapEntriesBuilder_.addMessage(index, builderForValue.build()); } - bitField0_ |= 0x00000002; return this; } /** - * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public Builder setNormalizedNode( - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) { - if (normalizedNodeBuilder_ == null) { - normalizedNode_ = builderForValue.build(); + public Builder addAllMapEntries( + java.lang.Iterable values) { + if (mapEntriesBuilder_ == null) { + ensureMapEntriesIsMutable(); + super.addAll(values, mapEntries_); onChanged(); } else { - normalizedNodeBuilder_.setMessage(builderForValue.build()); + mapEntriesBuilder_.addAllMessages(values); } - bitField0_ |= 0x00000002; return this; } /** - * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { - if (normalizedNodeBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002) && - normalizedNode_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) { - normalizedNode_ = - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(normalizedNode_).mergeFrom(value).buildPartial(); - } else { - normalizedNode_ = value; - } + public Builder clearMapEntries() { + if (mapEntriesBuilder_ == null) { + mapEntries_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { - normalizedNodeBuilder_.mergeFrom(value); + mapEntriesBuilder_.clear(); } - bitField0_ |= 0x00000002; return this; } /** - * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public Builder clearNormalizedNode() { - if (normalizedNodeBuilder_ == null) { - normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + public Builder removeMapEntries(int index) { + if (mapEntriesBuilder_ == null) { + ensureMapEntriesIsMutable(); + mapEntries_.remove(index); onChanged(); } else { - normalizedNodeBuilder_.clear(); + mapEntriesBuilder_.remove(index); } - bitField0_ = (bitField0_ & ~0x00000002); return this; } /** - * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getNormalizedNodeBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getNormalizedNodeFieldBuilder().getBuilder(); + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder getMapEntriesBuilder( + int index) { + return getMapEntriesFieldBuilder().getBuilder(index); } /** - * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() { - if (normalizedNodeBuilder_ != null) { - return normalizedNodeBuilder_.getMessageOrBuilder(); + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder getMapEntriesOrBuilder( + int index) { + if (mapEntriesBuilder_ == null) { + return mapEntries_.get(index); } else { + return mapEntriesBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; + */ + public java.util.List + getMapEntriesOrBuilderList() { + if (mapEntriesBuilder_ != null) { + return mapEntriesBuilder_.getMessageOrBuilderList(); } else { - return normalizedNode_; + return java.util.Collections.unmodifiableList(mapEntries_); } } /** - * optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; */ - private com.google.protobuf.SingleFieldBuilder< - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> - getNormalizedNodeFieldBuilder() { - if (normalizedNodeBuilder_ == null) { - normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder< - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>( - normalizedNode_, + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder addMapEntriesBuilder() { + return getMapEntriesFieldBuilder().addBuilder( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.getDefaultInstance()); + } + /** + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder addMapEntriesBuilder( + int index) { + return getMapEntriesFieldBuilder().addBuilder( + index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.getDefaultInstance()); + } + /** + * repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1; + */ + public java.util.List + getMapEntriesBuilderList() { + return getMapEntriesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder> + getMapEntriesFieldBuilder() { + if (mapEntriesBuilder_ == null) { + mapEntriesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder>( + mapEntries_, + ((bitField0_ & 0x00000001) == 0x00000001), getParentForChildren(), isClean()); - normalizedNode_ = null; + mapEntries_ = null; } - return normalizedNodeBuilder_; + return mapEntriesBuilder_; } - // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.Container) + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.NodeMap) } static { - defaultInstance = new Container(true); + defaultInstance = new NodeMap(true); defaultInstance.initFields(); } - // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.Container) + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.NodeMap) } private static com.google.protobuf.Descriptors.Descriptor @@ -2870,6 +7402,21 @@ 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_QName_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_QName_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_PathArgument_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_org_opendaylight_controller_mdsal_Node_descriptor; private static @@ -2880,6 +7427,16 @@ public final class NormalizedNodeMessages { private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_org_opendaylight_controller_mdsal_Container_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_NodeMap_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -2890,17 +7447,33 @@ public final class NormalizedNodeMessages { static { java.lang.String[] descriptorData = { "\n\014Common.proto\022!org.opendaylight.control" + - "ler.mdsal\"(\n\tAttribute\022\014\n\004name\030\001 \002(\t\022\r\n\005" + - "value\030\002 \001(\t\"\253\001\n\004Node\022\014\n\004path\030\001 \002(\t\022\014\n\004ty" + - "pe\030\002 \001(\t\022@\n\nattributes\030\003 \003(\0132,.org.opend" + - "aylight.controller.mdsal.Attribute\0226\n\005ch" + - "ild\030\004 \003(\0132\'.org.opendaylight.controller." + - "mdsal.Node\022\r\n\005value\030\005 \001(\t\"`\n\tContainer\022\022" + - "\n\nparentPath\030\001 \002(\t\022?\n\016normalizedNode\030\002 \001" + - "(\0132\'.org.opendaylight.controller.mdsal.N" + - "odeBO\n5org.opendaylight.controller.proto", - "buff.messages.commonB\026NormalizedNodeMess" + - "ages" + "ler.mdsal\"6\n\tAttribute\022\014\n\004name\030\001 \002(\t\022\r\n\005" + + "value\030\002 \001(\t\022\014\n\004type\030\003 \001(\t\"\026\n\005QName\022\r\n\005va" + + "lue\030\001 \002(\t\"\251\001\n\014PathArgument\022\r\n\005value\030\001 \002(" + + "\t\022\014\n\004type\030\002 \001(\t\022:\n\010nodeType\030\003 \001(\0132(.org." + + "opendaylight.controller.mdsal.QName\022@\n\na" + + "ttributes\030\004 \003(\0132,.org.opendaylight.contr" + + "oller.mdsal.Attribute\"X\n\022InstanceIdentif" + + "ier\022B\n\targuments\030\001 \003(\0132/.org.opendayligh" + + "t.controller.mdsal.PathArgument\"\251\002\n\004Node", + "\022\014\n\004path\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022@\n\nattribut" + + "es\030\003 \003(\0132,.org.opendaylight.controller.m" + + "dsal.Attribute\0226\n\005child\030\004 \003(\0132\'.org.open" + + "daylight.controller.mdsal.Node\022\r\n\005value\030" + + "\005 \001(\t\022\021\n\tvalueType\030\006 \001(\t\022\021\n\tbitsValue\030\007 " + + "\003(\t\022V\n\027instanceIdentifierValue\030\010 \001(\01325.o" + + "rg.opendaylight.controller.mdsal.Instanc" + + "eIdentifier\"`\n\tContainer\022\022\n\nparentPath\030\001" + + " \002(\t\022?\n\016normalizedNode\030\002 \001(\0132\'.org.opend" + + "aylight.controller.mdsal.Node\"\246\001\n\014NodeMa", + "pEntry\022U\n\026instanceIdentifierPath\030\001 \002(\01325" + + ".org.opendaylight.controller.mdsal.Insta" + + "nceIdentifier\022?\n\016normalizedNode\030\002 \001(\0132\'." + + "org.opendaylight.controller.mdsal.Node\"N" + + "\n\007NodeMap\022C\n\nmapEntries\030\001 \003(\0132/.org.open" + + "daylight.controller.mdsal.NodeMapEntryBO" + + "\n5org.opendaylight.controller.protobuff." + + "messages.commonB\026NormalizedNodeMessages" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -2912,19 +7485,49 @@ public final class NormalizedNodeMessages { internal_static_org_opendaylight_controller_mdsal_Attribute_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_org_opendaylight_controller_mdsal_Attribute_descriptor, - new java.lang.String[] { "Name", "Value", }); - internal_static_org_opendaylight_controller_mdsal_Node_descriptor = + new java.lang.String[] { "Name", "Value", "Type", }); + internal_static_org_opendaylight_controller_mdsal_QName_descriptor = getDescriptor().getMessageTypes().get(1); + internal_static_org_opendaylight_controller_mdsal_QName_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_QName_descriptor, + new java.lang.String[] { "Value", }); + internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_org_opendaylight_controller_mdsal_PathArgument_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_PathArgument_descriptor, + new java.lang.String[] { "Value", "Type", "NodeType", "Attributes", }); + internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_InstanceIdentifier_descriptor, + new java.lang.String[] { "Arguments", }); + internal_static_org_opendaylight_controller_mdsal_Node_descriptor = + getDescriptor().getMessageTypes().get(4); internal_static_org_opendaylight_controller_mdsal_Node_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_org_opendaylight_controller_mdsal_Node_descriptor, - new java.lang.String[] { "Path", "Type", "Attributes", "Child", "Value", }); + new java.lang.String[] { "Path", "Type", "Attributes", "Child", "Value", "ValueType", "BitsValue", "InstanceIdentifierValue", }); internal_static_org_opendaylight_controller_mdsal_Container_descriptor = - getDescriptor().getMessageTypes().get(2); + getDescriptor().getMessageTypes().get(5); internal_static_org_opendaylight_controller_mdsal_Container_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_org_opendaylight_controller_mdsal_Container_descriptor, new java.lang.String[] { "ParentPath", "NormalizedNode", }); + internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_NodeMapEntry_descriptor, + new java.lang.String[] { "InstanceIdentifierPath", "NormalizedNode", }); + internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_org_opendaylight_controller_mdsal_NodeMap_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_NodeMap_descriptor, + new java.lang.String[] { "MapEntries", }); return null; } }; diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/datachange/notification/DataChangeListenerMessages.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/datachange/notification/DataChangeListenerMessages.java index 5a9c14e8e9..384b389f92 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/datachange/notification/DataChangeListenerMessages.java +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/datachange/notification/DataChangeListenerMessages.java @@ -11,39 +11,100 @@ public final class DataChangeListenerMessages { public interface DataChangedOrBuilder extends com.google.protobuf.MessageOrBuilder { - // repeated string instanceIdentifierPathArguments = 1; + // optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1; /** - * repeated string instanceIdentifierPathArguments = 1; + * optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1; */ - java.util.List - getInstanceIdentifierPathArgumentsList(); + boolean hasOriginalSubTree(); /** - * repeated string instanceIdentifierPathArguments = 1; + * optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1; */ - int getInstanceIdentifierPathArgumentsCount(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getOriginalSubTree(); /** - * repeated string instanceIdentifierPathArguments = 1; + * optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1; */ - java.lang.String getInstanceIdentifierPathArguments(int index); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getOriginalSubTreeOrBuilder(); + + // optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2; + /** + * optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2; + */ + boolean hasUpdatedSubTree(); + /** + * optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getUpdatedSubTree(); + /** + * optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getUpdatedSubTreeOrBuilder(); + + // optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3; + /** + * optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3; + */ + boolean hasOriginalData(); + /** + * optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getOriginalData(); + /** + * optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getOriginalDataOrBuilder(); + + // optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4; + /** + * optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4; + */ + boolean hasUpdatedData(); + /** + * optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getUpdatedData(); + /** + * optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getUpdatedDataOrBuilder(); + + // optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5; + /** + * optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5; + */ + boolean hasCreatedData(); /** - * repeated string instanceIdentifierPathArguments = 1; + * optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5; */ - com.google.protobuf.ByteString - getInstanceIdentifierPathArgumentsBytes(int index); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getCreatedData(); + /** + * optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getCreatedDataOrBuilder(); - // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + // repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + java.util.List + getRemovedPathsList(); /** - * required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; */ - boolean hasNormalizedNode(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getRemovedPaths(int index); /** - * required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; */ - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode(); + int getRemovedPathsCount(); /** - * required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; */ - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder(); + java.util.List + getRemovedPathsOrBuilderList(); + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getRemovedPathsOrBuilder( + int index); } /** * Protobuf type {@code org.opendaylight.controller.mdsal.DataChanged} @@ -97,24 +158,76 @@ public final class DataChangeListenerMessages { break; } case 10: { - if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - instanceIdentifierPathArguments_ = new com.google.protobuf.LazyStringArrayList(); - mutable_bitField0_ |= 0x00000001; + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + subBuilder = originalSubTree_.toBuilder(); } - instanceIdentifierPathArguments_.add(input.readBytes()); + originalSubTree_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(originalSubTree_); + originalSubTree_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000001; break; } case 18: { org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder subBuilder = null; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - subBuilder = normalizedNode_.toBuilder(); + if (((bitField0_ & 0x00000002) == 0x00000002)) { + subBuilder = updatedSubTree_.toBuilder(); } - normalizedNode_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry); + updatedSubTree_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, extensionRegistry); if (subBuilder != null) { - subBuilder.mergeFrom(normalizedNode_); - normalizedNode_ = subBuilder.buildPartial(); + subBuilder.mergeFrom(updatedSubTree_); + updatedSubTree_ = subBuilder.buildPartial(); } - bitField0_ |= 0x00000001; + bitField0_ |= 0x00000002; + break; + } + case 26: { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder subBuilder = null; + if (((bitField0_ & 0x00000004) == 0x00000004)) { + subBuilder = originalData_.toBuilder(); + } + originalData_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(originalData_); + originalData_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000004; + break; + } + case 34: { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder subBuilder = null; + if (((bitField0_ & 0x00000008) == 0x00000008)) { + subBuilder = updatedData_.toBuilder(); + } + updatedData_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updatedData_); + updatedData_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000008; + break; + } + case 42: { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder subBuilder = null; + if (((bitField0_ & 0x00000010) == 0x00000010)) { + subBuilder = createdData_.toBuilder(); + } + createdData_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(createdData_); + createdData_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000010; + break; + } + case 50: { + if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + removedPaths_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000020; + } + removedPaths_.add(input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry)); break; } } @@ -125,8 +238,8 @@ public final class DataChangeListenerMessages { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { - if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - instanceIdentifierPathArguments_ = new com.google.protobuf.UnmodifiableLazyStringList(instanceIdentifierPathArguments_); + if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + removedPaths_ = java.util.Collections.unmodifiableList(removedPaths_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); @@ -160,74 +273,200 @@ public final class DataChangeListenerMessages { } private int bitField0_; - // repeated string instanceIdentifierPathArguments = 1; - public static final int INSTANCEIDENTIFIERPATHARGUMENTS_FIELD_NUMBER = 1; - private com.google.protobuf.LazyStringList instanceIdentifierPathArguments_; + // optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1; + public static final int ORIGINALSUBTREE_FIELD_NUMBER = 1; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node originalSubTree_; + /** + * optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1; + */ + public boolean hasOriginalSubTree() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getOriginalSubTree() { + return originalSubTree_; + } /** - * repeated string instanceIdentifierPathArguments = 1; + * optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1; */ - public java.util.List - getInstanceIdentifierPathArgumentsList() { - return instanceIdentifierPathArguments_; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getOriginalSubTreeOrBuilder() { + return originalSubTree_; } + + // optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2; + public static final int UPDATEDSUBTREE_FIELD_NUMBER = 2; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node updatedSubTree_; /** - * repeated string instanceIdentifierPathArguments = 1; + * optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2; */ - public int getInstanceIdentifierPathArgumentsCount() { - return instanceIdentifierPathArguments_.size(); + public boolean hasUpdatedSubTree() { + return ((bitField0_ & 0x00000002) == 0x00000002); } /** - * repeated string instanceIdentifierPathArguments = 1; + * optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2; */ - public java.lang.String getInstanceIdentifierPathArguments(int index) { - return instanceIdentifierPathArguments_.get(index); + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getUpdatedSubTree() { + return updatedSubTree_; } /** - * repeated string instanceIdentifierPathArguments = 1; + * optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2; */ - public com.google.protobuf.ByteString - getInstanceIdentifierPathArgumentsBytes(int index) { - return instanceIdentifierPathArguments_.getByteString(index); + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getUpdatedSubTreeOrBuilder() { + return updatedSubTree_; } - // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; - public static final int NORMALIZEDNODE_FIELD_NUMBER = 2; - private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_; + // optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3; + public static final int ORIGINALDATA_FIELD_NUMBER = 3; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap originalData_; /** - * required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3; */ - public boolean hasNormalizedNode() { - return ((bitField0_ & 0x00000001) == 0x00000001); + public boolean hasOriginalData() { + return ((bitField0_ & 0x00000004) == 0x00000004); } /** - * required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3; */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() { - return normalizedNode_; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getOriginalData() { + return originalData_; } /** - * required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3; */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() { - return normalizedNode_; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getOriginalDataOrBuilder() { + return originalData_; + } + + // optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4; + public static final int UPDATEDDATA_FIELD_NUMBER = 4; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap updatedData_; + /** + * optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4; + */ + public boolean hasUpdatedData() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getUpdatedData() { + return updatedData_; + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getUpdatedDataOrBuilder() { + return updatedData_; + } + + // optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5; + public static final int CREATEDDATA_FIELD_NUMBER = 5; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap createdData_; + /** + * optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5; + */ + public boolean hasCreatedData() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getCreatedData() { + return createdData_; + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getCreatedDataOrBuilder() { + return createdData_; + } + + // repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + public static final int REMOVEDPATHS_FIELD_NUMBER = 6; + private java.util.List removedPaths_; + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public java.util.List getRemovedPathsList() { + return removedPaths_; + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public java.util.List + getRemovedPathsOrBuilderList() { + return removedPaths_; + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public int getRemovedPathsCount() { + return removedPaths_.size(); + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getRemovedPaths(int index) { + return removedPaths_.get(index); + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getRemovedPathsOrBuilder( + int index) { + return removedPaths_.get(index); } private void initFields() { - instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY; - normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + originalSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + updatedSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + originalData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance(); + updatedData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance(); + createdData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance(); + removedPaths_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; - if (!hasNormalizedNode()) { - memoizedIsInitialized = 0; - return false; + if (hasOriginalSubTree()) { + if (!getOriginalSubTree().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + if (hasUpdatedSubTree()) { + if (!getUpdatedSubTree().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + if (hasOriginalData()) { + if (!getOriginalData().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + if (hasUpdatedData()) { + if (!getUpdatedData().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + if (hasCreatedData()) { + if (!getCreatedData().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } } - if (!getNormalizedNode().isInitialized()) { - memoizedIsInitialized = 0; - return false; + for (int i = 0; i < getRemovedPathsCount(); i++) { + if (!getRemovedPaths(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } } memoizedIsInitialized = 1; return true; @@ -236,11 +475,23 @@ public final class DataChangeListenerMessages { public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - for (int i = 0; i < instanceIdentifierPathArguments_.size(); i++) { - output.writeBytes(1, instanceIdentifierPathArguments_.getByteString(i)); - } if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(2, normalizedNode_); + output.writeMessage(1, originalSubTree_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, updatedSubTree_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, originalData_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeMessage(4, updatedData_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeMessage(5, createdData_); + } + for (int i = 0; i < removedPaths_.size(); i++) { + output.writeMessage(6, removedPaths_.get(i)); } getUnknownFields().writeTo(output); } @@ -251,18 +502,29 @@ public final class DataChangeListenerMessages { if (size != -1) return size; size = 0; - { - int dataSize = 0; - for (int i = 0; i < instanceIdentifierPathArguments_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeBytesSizeNoTag(instanceIdentifierPathArguments_.getByteString(i)); - } - size += dataSize; - size += 1 * getInstanceIdentifierPathArgumentsList().size(); - } if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, normalizedNode_); + .computeMessageSize(1, originalSubTree_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, updatedSubTree_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, originalData_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, updatedData_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, createdData_); + } + for (int i = 0; i < removedPaths_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, removedPaths_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; @@ -372,7 +634,12 @@ public final class DataChangeListenerMessages { } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getNormalizedNodeFieldBuilder(); + getOriginalSubTreeFieldBuilder(); + getUpdatedSubTreeFieldBuilder(); + getOriginalDataFieldBuilder(); + getUpdatedDataFieldBuilder(); + getCreatedDataFieldBuilder(); + getRemovedPathsFieldBuilder(); } } private static Builder create() { @@ -381,14 +648,42 @@ public final class DataChangeListenerMessages { public Builder clear() { super.clear(); - instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY; + if (originalSubTreeBuilder_ == null) { + originalSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + } else { + originalSubTreeBuilder_.clear(); + } bitField0_ = (bitField0_ & ~0x00000001); - if (normalizedNodeBuilder_ == null) { - normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + if (updatedSubTreeBuilder_ == null) { + updatedSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); } else { - normalizedNodeBuilder_.clear(); + updatedSubTreeBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000002); + if (originalDataBuilder_ == null) { + originalData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance(); + } else { + originalDataBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + if (updatedDataBuilder_ == null) { + updatedData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance(); + } else { + updatedDataBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + if (createdDataBuilder_ == null) { + createdData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance(); + } else { + createdDataBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000010); + if (removedPathsBuilder_ == null) { + removedPaths_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + } else { + removedPathsBuilder_.clear(); + } return this; } @@ -417,19 +712,54 @@ public final class DataChangeListenerMessages { org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged result = new org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - instanceIdentifierPathArguments_ = new com.google.protobuf.UnmodifiableLazyStringList( - instanceIdentifierPathArguments_); - bitField0_ = (bitField0_ & ~0x00000001); + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (originalSubTreeBuilder_ == null) { + result.originalSubTree_ = originalSubTree_; + } else { + result.originalSubTree_ = originalSubTreeBuilder_.build(); } - result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000001; + to_bitField0_ |= 0x00000002; + } + if (updatedSubTreeBuilder_ == null) { + result.updatedSubTree_ = updatedSubTree_; + } else { + result.updatedSubTree_ = updatedSubTreeBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + if (originalDataBuilder_ == null) { + result.originalData_ = originalData_; + } else { + result.originalData_ = originalDataBuilder_.build(); + } + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + if (updatedDataBuilder_ == null) { + result.updatedData_ = updatedData_; + } else { + result.updatedData_ = updatedDataBuilder_.build(); } - if (normalizedNodeBuilder_ == null) { - result.normalizedNode_ = normalizedNode_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + if (createdDataBuilder_ == null) { + result.createdData_ = createdData_; + } else { + result.createdData_ = createdDataBuilder_.build(); + } + if (removedPathsBuilder_ == null) { + if (((bitField0_ & 0x00000020) == 0x00000020)) { + removedPaths_ = java.util.Collections.unmodifiableList(removedPaths_); + bitField0_ = (bitField0_ & ~0x00000020); + } + result.removedPaths_ = removedPaths_; } else { - result.normalizedNode_ = normalizedNodeBuilder_.build(); + result.removedPaths_ = removedPathsBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); @@ -447,31 +777,87 @@ public final class DataChangeListenerMessages { public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged other) { if (other == org.opendaylight.controller.protobuff.messages.datachange.notification.DataChangeListenerMessages.DataChanged.getDefaultInstance()) return this; - if (!other.instanceIdentifierPathArguments_.isEmpty()) { - if (instanceIdentifierPathArguments_.isEmpty()) { - instanceIdentifierPathArguments_ = other.instanceIdentifierPathArguments_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureInstanceIdentifierPathArgumentsIsMutable(); - instanceIdentifierPathArguments_.addAll(other.instanceIdentifierPathArguments_); - } - onChanged(); + if (other.hasOriginalSubTree()) { + mergeOriginalSubTree(other.getOriginalSubTree()); + } + if (other.hasUpdatedSubTree()) { + mergeUpdatedSubTree(other.getUpdatedSubTree()); } - if (other.hasNormalizedNode()) { - mergeNormalizedNode(other.getNormalizedNode()); + if (other.hasOriginalData()) { + mergeOriginalData(other.getOriginalData()); + } + if (other.hasUpdatedData()) { + mergeUpdatedData(other.getUpdatedData()); + } + if (other.hasCreatedData()) { + mergeCreatedData(other.getCreatedData()); + } + if (removedPathsBuilder_ == null) { + if (!other.removedPaths_.isEmpty()) { + if (removedPaths_.isEmpty()) { + removedPaths_ = other.removedPaths_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureRemovedPathsIsMutable(); + removedPaths_.addAll(other.removedPaths_); + } + onChanged(); + } + } else { + if (!other.removedPaths_.isEmpty()) { + if (removedPathsBuilder_.isEmpty()) { + removedPathsBuilder_.dispose(); + removedPathsBuilder_ = null; + removedPaths_ = other.removedPaths_; + bitField0_ = (bitField0_ & ~0x00000020); + removedPathsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getRemovedPathsFieldBuilder() : null; + } else { + removedPathsBuilder_.addAllMessages(other.removedPaths_); + } + } } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { - if (!hasNormalizedNode()) { + if (hasOriginalSubTree()) { + if (!getOriginalSubTree().isInitialized()) { - return false; + return false; + } } - if (!getNormalizedNode().isInitialized()) { + if (hasUpdatedSubTree()) { + if (!getUpdatedSubTree().isInitialized()) { - return false; + return false; + } + } + if (hasOriginalData()) { + if (!getOriginalData().isInitialized()) { + + return false; + } + } + if (hasUpdatedData()) { + if (!getUpdatedData().isInitialized()) { + + return false; + } + } + if (hasCreatedData()) { + if (!getCreatedData().isInitialized()) { + + return false; + } + } + for (int i = 0; i < getRemovedPathsCount(); i++) { + if (!getRemovedPaths(i).isInitialized()) { + + return false; + } } return true; } @@ -495,214 +881,829 @@ public final class DataChangeListenerMessages { } private int bitField0_; - // repeated string instanceIdentifierPathArguments = 1; - private com.google.protobuf.LazyStringList instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY; - private void ensureInstanceIdentifierPathArgumentsIsMutable() { - if (!((bitField0_ & 0x00000001) == 0x00000001)) { - instanceIdentifierPathArguments_ = new com.google.protobuf.LazyStringArrayList(instanceIdentifierPathArguments_); - bitField0_ |= 0x00000001; - } - } + // optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node originalSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> originalSubTreeBuilder_; /** - * repeated string instanceIdentifierPathArguments = 1; + * optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1; */ - public java.util.List - getInstanceIdentifierPathArgumentsList() { - return java.util.Collections.unmodifiableList(instanceIdentifierPathArguments_); + public boolean hasOriginalSubTree() { + return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * repeated string instanceIdentifierPathArguments = 1; + * optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1; */ - public int getInstanceIdentifierPathArgumentsCount() { - return instanceIdentifierPathArguments_.size(); + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getOriginalSubTree() { + if (originalSubTreeBuilder_ == null) { + return originalSubTree_; + } else { + return originalSubTreeBuilder_.getMessage(); + } } /** - * repeated string instanceIdentifierPathArguments = 1; + * optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1; */ - public java.lang.String getInstanceIdentifierPathArguments(int index) { - return instanceIdentifierPathArguments_.get(index); + public Builder setOriginalSubTree(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { + if (originalSubTreeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + originalSubTree_ = value; + onChanged(); + } else { + originalSubTreeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; } /** - * repeated string instanceIdentifierPathArguments = 1; + * optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1; */ - public com.google.protobuf.ByteString - getInstanceIdentifierPathArgumentsBytes(int index) { - return instanceIdentifierPathArguments_.getByteString(index); + public Builder setOriginalSubTree( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) { + if (originalSubTreeBuilder_ == null) { + originalSubTree_ = builderForValue.build(); + onChanged(); + } else { + originalSubTreeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; } /** - * repeated string instanceIdentifierPathArguments = 1; + * optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1; */ - public Builder setInstanceIdentifierPathArguments( - int index, java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureInstanceIdentifierPathArgumentsIsMutable(); - instanceIdentifierPathArguments_.set(index, value); - onChanged(); + public Builder mergeOriginalSubTree(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { + if (originalSubTreeBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + originalSubTree_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) { + originalSubTree_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(originalSubTree_).mergeFrom(value).buildPartial(); + } else { + originalSubTree_ = value; + } + onChanged(); + } else { + originalSubTreeBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; return this; } /** - * repeated string instanceIdentifierPathArguments = 1; + * optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1; */ - public Builder addInstanceIdentifierPathArguments( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureInstanceIdentifierPathArgumentsIsMutable(); - instanceIdentifierPathArguments_.add(value); - onChanged(); + public Builder clearOriginalSubTree() { + if (originalSubTreeBuilder_ == null) { + originalSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + onChanged(); + } else { + originalSubTreeBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); return this; } /** - * repeated string instanceIdentifierPathArguments = 1; + * optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1; */ - public Builder addAllInstanceIdentifierPathArguments( - java.lang.Iterable values) { - ensureInstanceIdentifierPathArgumentsIsMutable(); - super.addAll(values, instanceIdentifierPathArguments_); + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getOriginalSubTreeBuilder() { + bitField0_ |= 0x00000001; onChanged(); - return this; + return getOriginalSubTreeFieldBuilder().getBuilder(); } /** - * repeated string instanceIdentifierPathArguments = 1; + * optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1; */ - public Builder clearInstanceIdentifierPathArguments() { - instanceIdentifierPathArguments_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - return this; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getOriginalSubTreeOrBuilder() { + if (originalSubTreeBuilder_ != null) { + return originalSubTreeBuilder_.getMessageOrBuilder(); + } else { + return originalSubTree_; + } } /** - * repeated string instanceIdentifierPathArguments = 1; + * optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1; */ - public Builder addInstanceIdentifierPathArgumentsBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureInstanceIdentifierPathArgumentsIsMutable(); - instanceIdentifierPathArguments_.add(value); - onChanged(); - return this; + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> + getOriginalSubTreeFieldBuilder() { + if (originalSubTreeBuilder_ == null) { + originalSubTreeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>( + originalSubTree_, + getParentForChildren(), + isClean()); + originalSubTree_ = null; + } + return originalSubTreeBuilder_; } - // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; - private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + // optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node updatedSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> normalizedNodeBuilder_; + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> updatedSubTreeBuilder_; /** - * required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2; */ - public boolean hasNormalizedNode() { + public boolean hasUpdatedSubTree() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** - * required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2; */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getNormalizedNode() { - if (normalizedNodeBuilder_ == null) { - return normalizedNode_; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getUpdatedSubTree() { + if (updatedSubTreeBuilder_ == null) { + return updatedSubTree_; } else { - return normalizedNodeBuilder_.getMessage(); + return updatedSubTreeBuilder_.getMessage(); } } /** - * required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2; */ - public Builder setNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { - if (normalizedNodeBuilder_ == null) { + public Builder setUpdatedSubTree(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { + if (updatedSubTreeBuilder_ == null) { if (value == null) { throw new NullPointerException(); } - normalizedNode_ = value; + updatedSubTree_ = value; onChanged(); } else { - normalizedNodeBuilder_.setMessage(value); + updatedSubTreeBuilder_.setMessage(value); } bitField0_ |= 0x00000002; return this; } /** - * required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2; */ - public Builder setNormalizedNode( + public Builder setUpdatedSubTree( org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) { - if (normalizedNodeBuilder_ == null) { - normalizedNode_ = builderForValue.build(); + if (updatedSubTreeBuilder_ == null) { + updatedSubTree_ = builderForValue.build(); onChanged(); } else { - normalizedNodeBuilder_.setMessage(builderForValue.build()); + updatedSubTreeBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000002; return this; } /** - * required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2; */ - public Builder mergeNormalizedNode(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { - if (normalizedNodeBuilder_ == null) { + public Builder mergeUpdatedSubTree(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { + if (updatedSubTreeBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002) && - normalizedNode_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) { - normalizedNode_ = - org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(normalizedNode_).mergeFrom(value).buildPartial(); + updatedSubTree_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance()) { + updatedSubTree_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.newBuilder(updatedSubTree_).mergeFrom(value).buildPartial(); } else { - normalizedNode_ = value; + updatedSubTree_ = value; } onChanged(); } else { - normalizedNodeBuilder_.mergeFrom(value); + updatedSubTreeBuilder_.mergeFrom(value); } bitField0_ |= 0x00000002; return this; } /** - * required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2; */ - public Builder clearNormalizedNode() { - if (normalizedNodeBuilder_ == null) { - normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); + public Builder clearUpdatedSubTree() { + if (updatedSubTreeBuilder_ == null) { + updatedSubTree_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); onChanged(); } else { - normalizedNodeBuilder_.clear(); + updatedSubTreeBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000002); return this; } /** - * required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2; */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getNormalizedNodeBuilder() { + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getUpdatedSubTreeBuilder() { bitField0_ |= 0x00000002; onChanged(); - return getNormalizedNodeFieldBuilder().getBuilder(); + return getUpdatedSubTreeFieldBuilder().getBuilder(); } /** - * required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2; */ - public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getNormalizedNodeOrBuilder() { - if (normalizedNodeBuilder_ != null) { - return normalizedNodeBuilder_.getMessageOrBuilder(); + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getUpdatedSubTreeOrBuilder() { + if (updatedSubTreeBuilder_ != null) { + return updatedSubTreeBuilder_.getMessageOrBuilder(); } else { - return normalizedNode_; + return updatedSubTree_; } } /** - * required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; + * optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2; */ private com.google.protobuf.SingleFieldBuilder< org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> - getNormalizedNodeFieldBuilder() { - if (normalizedNodeBuilder_ == null) { - normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + getUpdatedSubTreeFieldBuilder() { + if (updatedSubTreeBuilder_ == null) { + updatedSubTreeBuilder_ = new com.google.protobuf.SingleFieldBuilder< org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>( - normalizedNode_, + updatedSubTree_, + getParentForChildren(), + isClean()); + updatedSubTree_ = null; + } + return updatedSubTreeBuilder_; + } + + // optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap originalData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder> originalDataBuilder_; + /** + * optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3; + */ + public boolean hasOriginalData() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getOriginalData() { + if (originalDataBuilder_ == null) { + return originalData_; + } else { + return originalDataBuilder_.getMessage(); + } + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3; + */ + public Builder setOriginalData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap value) { + if (originalDataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + originalData_ = value; + onChanged(); + } else { + originalDataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3; + */ + public Builder setOriginalData( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder builderForValue) { + if (originalDataBuilder_ == null) { + originalData_ = builderForValue.build(); + onChanged(); + } else { + originalDataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3; + */ + public Builder mergeOriginalData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap value) { + if (originalDataBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + originalData_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance()) { + originalData_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.newBuilder(originalData_).mergeFrom(value).buildPartial(); + } else { + originalData_ = value; + } + onChanged(); + } else { + originalDataBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + return this; + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3; + */ + public Builder clearOriginalData() { + if (originalDataBuilder_ == null) { + originalData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance(); + onChanged(); + } else { + originalDataBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder getOriginalDataBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getOriginalDataFieldBuilder().getBuilder(); + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getOriginalDataOrBuilder() { + if (originalDataBuilder_ != null) { + return originalDataBuilder_.getMessageOrBuilder(); + } else { + return originalData_; + } + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder> + getOriginalDataFieldBuilder() { + if (originalDataBuilder_ == null) { + originalDataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder>( + originalData_, + getParentForChildren(), + isClean()); + originalData_ = null; + } + return originalDataBuilder_; + } + + // optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap updatedData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder> updatedDataBuilder_; + /** + * optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4; + */ + public boolean hasUpdatedData() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getUpdatedData() { + if (updatedDataBuilder_ == null) { + return updatedData_; + } else { + return updatedDataBuilder_.getMessage(); + } + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4; + */ + public Builder setUpdatedData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap value) { + if (updatedDataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updatedData_ = value; + onChanged(); + } else { + updatedDataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + return this; + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4; + */ + public Builder setUpdatedData( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder builderForValue) { + if (updatedDataBuilder_ == null) { + updatedData_ = builderForValue.build(); + onChanged(); + } else { + updatedDataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + return this; + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4; + */ + public Builder mergeUpdatedData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap value) { + if (updatedDataBuilder_ == null) { + if (((bitField0_ & 0x00000008) == 0x00000008) && + updatedData_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance()) { + updatedData_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.newBuilder(updatedData_).mergeFrom(value).buildPartial(); + } else { + updatedData_ = value; + } + onChanged(); + } else { + updatedDataBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000008; + return this; + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4; + */ + public Builder clearUpdatedData() { + if (updatedDataBuilder_ == null) { + updatedData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance(); + onChanged(); + } else { + updatedDataBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder getUpdatedDataBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getUpdatedDataFieldBuilder().getBuilder(); + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getUpdatedDataOrBuilder() { + if (updatedDataBuilder_ != null) { + return updatedDataBuilder_.getMessageOrBuilder(); + } else { + return updatedData_; + } + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4; + */ + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder> + getUpdatedDataFieldBuilder() { + if (updatedDataBuilder_ == null) { + updatedDataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder>( + updatedData_, + getParentForChildren(), + isClean()); + updatedData_ = null; + } + return updatedDataBuilder_; + } + + // optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap createdData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder> createdDataBuilder_; + /** + * optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5; + */ + public boolean hasCreatedData() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap getCreatedData() { + if (createdDataBuilder_ == null) { + return createdData_; + } else { + return createdDataBuilder_.getMessage(); + } + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5; + */ + public Builder setCreatedData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap value) { + if (createdDataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createdData_ = value; + onChanged(); + } else { + createdDataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000010; + return this; + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5; + */ + public Builder setCreatedData( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder builderForValue) { + if (createdDataBuilder_ == null) { + createdData_ = builderForValue.build(); + onChanged(); + } else { + createdDataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000010; + return this; + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5; + */ + public Builder mergeCreatedData(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap value) { + if (createdDataBuilder_ == null) { + if (((bitField0_ & 0x00000010) == 0x00000010) && + createdData_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance()) { + createdData_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.newBuilder(createdData_).mergeFrom(value).buildPartial(); + } else { + createdData_ = value; + } + onChanged(); + } else { + createdDataBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000010; + return this; + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5; + */ + public Builder clearCreatedData() { + if (createdDataBuilder_ == null) { + createdData_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.getDefaultInstance(); + onChanged(); + } else { + createdDataBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder getCreatedDataBuilder() { + bitField0_ |= 0x00000010; + onChanged(); + return getCreatedDataFieldBuilder().getBuilder(); + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder getCreatedDataOrBuilder() { + if (createdDataBuilder_ != null) { + return createdDataBuilder_.getMessageOrBuilder(); + } else { + return createdData_; + } + } + /** + * optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5; + */ + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder> + getCreatedDataFieldBuilder() { + if (createdDataBuilder_ == null) { + createdDataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder>( + createdData_, + getParentForChildren(), + isClean()); + createdData_ = null; + } + return createdDataBuilder_; + } + + // repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + private java.util.List removedPaths_ = + java.util.Collections.emptyList(); + private void ensureRemovedPathsIsMutable() { + if (!((bitField0_ & 0x00000020) == 0x00000020)) { + removedPaths_ = new java.util.ArrayList(removedPaths_); + bitField0_ |= 0x00000020; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> removedPathsBuilder_; + + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public java.util.List getRemovedPathsList() { + if (removedPathsBuilder_ == null) { + return java.util.Collections.unmodifiableList(removedPaths_); + } else { + return removedPathsBuilder_.getMessageList(); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public int getRemovedPathsCount() { + if (removedPathsBuilder_ == null) { + return removedPaths_.size(); + } else { + return removedPathsBuilder_.getCount(); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getRemovedPaths(int index) { + if (removedPathsBuilder_ == null) { + return removedPaths_.get(index); + } else { + return removedPathsBuilder_.getMessage(index); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public Builder setRemovedPaths( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) { + if (removedPathsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRemovedPathsIsMutable(); + removedPaths_.set(index, value); + onChanged(); + } else { + removedPathsBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public Builder setRemovedPaths( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) { + if (removedPathsBuilder_ == null) { + ensureRemovedPathsIsMutable(); + removedPaths_.set(index, builderForValue.build()); + onChanged(); + } else { + removedPathsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public Builder addRemovedPaths(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) { + if (removedPathsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRemovedPathsIsMutable(); + removedPaths_.add(value); + onChanged(); + } else { + removedPathsBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public Builder addRemovedPaths( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) { + if (removedPathsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRemovedPathsIsMutable(); + removedPaths_.add(index, value); + onChanged(); + } else { + removedPathsBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public Builder addRemovedPaths( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) { + if (removedPathsBuilder_ == null) { + ensureRemovedPathsIsMutable(); + removedPaths_.add(builderForValue.build()); + onChanged(); + } else { + removedPathsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public Builder addRemovedPaths( + int index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) { + if (removedPathsBuilder_ == null) { + ensureRemovedPathsIsMutable(); + removedPaths_.add(index, builderForValue.build()); + onChanged(); + } else { + removedPathsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public Builder addAllRemovedPaths( + java.lang.Iterable values) { + if (removedPathsBuilder_ == null) { + ensureRemovedPathsIsMutable(); + super.addAll(values, removedPaths_); + onChanged(); + } else { + removedPathsBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public Builder clearRemovedPaths() { + if (removedPathsBuilder_ == null) { + removedPaths_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + } else { + removedPathsBuilder_.clear(); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public Builder removeRemovedPaths(int index) { + if (removedPathsBuilder_ == null) { + ensureRemovedPathsIsMutable(); + removedPaths_.remove(index); + onChanged(); + } else { + removedPathsBuilder_.remove(index); + } + return this; + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getRemovedPathsBuilder( + int index) { + return getRemovedPathsFieldBuilder().getBuilder(index); + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getRemovedPathsOrBuilder( + int index) { + if (removedPathsBuilder_ == null) { + return removedPaths_.get(index); } else { + return removedPathsBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public java.util.List + getRemovedPathsOrBuilderList() { + if (removedPathsBuilder_ != null) { + return removedPathsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(removedPaths_); + } + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder addRemovedPathsBuilder() { + return getRemovedPathsFieldBuilder().addBuilder( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()); + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder addRemovedPathsBuilder( + int index) { + return getRemovedPathsFieldBuilder().addBuilder( + index, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()); + } + /** + * repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6; + */ + public java.util.List + getRemovedPathsBuilderList() { + return getRemovedPathsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> + getRemovedPathsFieldBuilder() { + if (removedPathsBuilder_ == null) { + removedPathsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>( + removedPaths_, + ((bitField0_ & 0x00000020) == 0x00000020), getParentForChildren(), isClean()); - normalizedNode_ = null; + removedPaths_ = null; } - return normalizedNodeBuilder_; + return removedPathsBuilder_; } // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.DataChanged) @@ -1045,13 +2046,21 @@ public final class DataChangeListenerMessages { static { java.lang.String[] descriptorData = { "\n\030DataChangeListener.proto\022!org.opendayl" + - "ight.controller.mdsal\032\014Common.proto\"w\n\013D" + - "ataChanged\022\'\n\037instanceIdentifierPathArgu" + - "ments\030\001 \003(\t\022?\n\016normalizedNode\030\002 \002(\0132\'.or" + - "g.opendaylight.controller.mdsal.Node\"\022\n\020" + - "DataChangedReplyBd\nForg.opendaylight.con" + - "troller.protobuff.messages.datachange.no" + - "tificationB\032DataChangeListenerMessages" + "ight.controller.mdsal\032\014Common.proto\"\241\003\n\013" + + "DataChanged\022@\n\017originalSubTree\030\001 \001(\0132\'.o" + + "rg.opendaylight.controller.mdsal.Node\022?\n" + + "\016updatedSubTree\030\002 \001(\0132\'.org.opendaylight" + + ".controller.mdsal.Node\022@\n\014originalData\030\003" + + " \001(\0132*.org.opendaylight.controller.mdsal" + + ".NodeMap\022?\n\013updatedData\030\004 \001(\0132*.org.open" + + "daylight.controller.mdsal.NodeMap\022?\n\013cre" + + "atedData\030\005 \001(\0132*.org.opendaylight.contro", + "ller.mdsal.NodeMap\022K\n\014removedPaths\030\006 \003(\013" + + "25.org.opendaylight.controller.mdsal.Ins" + + "tanceIdentifier\"\022\n\020DataChangedReplyBd\nFo" + + "rg.opendaylight.controller.protobuff.mes" + + "sages.datachange.notificationB\032DataChang" + + "eListenerMessages" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -1063,7 +2072,7 @@ public final class DataChangeListenerMessages { internal_static_org_opendaylight_controller_mdsal_DataChanged_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_org_opendaylight_controller_mdsal_DataChanged_descriptor, - new java.lang.String[] { "InstanceIdentifierPathArguments", "NormalizedNode", }); + new java.lang.String[] { "OriginalSubTree", "UpdatedSubTree", "OriginalData", "UpdatedData", "CreatedData", "RemovedPaths", }); internal_static_org_opendaylight_controller_mdsal_DataChangedReply_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_org_opendaylight_controller_mdsal_DataChangedReply_fieldAccessorTable = new diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/persistent/PersistentMessages.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/persistent/PersistentMessages.java index efe159626f..6c1e2722f6 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/persistent/PersistentMessages.java +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/persistent/PersistentMessages.java @@ -26,20 +26,19 @@ public final class PersistentMessages { com.google.protobuf.ByteString getTypeBytes(); - // required string path = 2; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2; /** - * required string path = 2; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2; */ boolean hasPath(); /** - * required string path = 2; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2; */ - java.lang.String getPath(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getPath(); /** - * required string path = 2; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2; */ - com.google.protobuf.ByteString - getPathBytes(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getPathOrBuilder(); // optional .org.opendaylight.controller.mdsal.Node data = 3; /** @@ -112,8 +111,16 @@ public final class PersistentMessages { break; } case 18: { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + subBuilder = path_.toBuilder(); + } + path_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(path_); + path_ = subBuilder.buildPartial(); + } bitField0_ |= 0x00000002; - path_ = input.readBytes(); break; } case 26: { @@ -212,47 +219,26 @@ public final class PersistentMessages { } } - // required string path = 2; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2; public static final int PATH_FIELD_NUMBER = 2; - private java.lang.Object path_; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier path_; /** - * required string path = 2; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2; */ public boolean hasPath() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** - * required string path = 2; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2; */ - public java.lang.String getPath() { - java.lang.Object ref = path_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - path_ = s; - } - return s; - } + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getPath() { + return path_; } /** - * required string path = 2; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2; */ - public com.google.protobuf.ByteString - getPathBytes() { - java.lang.Object ref = path_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - path_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getPathOrBuilder() { + return path_; } // optional .org.opendaylight.controller.mdsal.Node data = 3; @@ -279,7 +265,7 @@ public final class PersistentMessages { private void initFields() { type_ = ""; - path_ = ""; + path_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); data_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); } private byte memoizedIsInitialized = -1; @@ -295,6 +281,10 @@ public final class PersistentMessages { memoizedIsInitialized = 0; return false; } + if (!getPath().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } if (hasData()) { if (!getData().isInitialized()) { memoizedIsInitialized = 0; @@ -312,7 +302,7 @@ public final class PersistentMessages { output.writeBytes(1, getTypeBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getPathBytes()); + output.writeMessage(2, path_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeMessage(3, data_); @@ -332,7 +322,7 @@ public final class PersistentMessages { } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getPathBytes()); + .computeMessageSize(2, path_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream @@ -446,6 +436,7 @@ public final class PersistentMessages { } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getPathFieldBuilder(); getDataFieldBuilder(); } } @@ -457,7 +448,11 @@ public final class PersistentMessages { super.clear(); type_ = ""; bitField0_ = (bitField0_ & ~0x00000001); - path_ = ""; + if (pathBuilder_ == null) { + path_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + } else { + pathBuilder_.clear(); + } bitField0_ = (bitField0_ & ~0x00000002); if (dataBuilder_ == null) { data_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); @@ -500,7 +495,11 @@ public final class PersistentMessages { if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } - result.path_ = path_; + if (pathBuilder_ == null) { + result.path_ = path_; + } else { + result.path_ = pathBuilder_.build(); + } if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } @@ -531,9 +530,7 @@ public final class PersistentMessages { onChanged(); } if (other.hasPath()) { - bitField0_ |= 0x00000002; - path_ = other.path_; - onChanged(); + mergePath(other.getPath()); } if (other.hasData()) { mergeData(other.getData()); @@ -551,6 +548,10 @@ public final class PersistentMessages { return false; } + if (!getPath().isInitialized()) { + + return false; + } if (hasData()) { if (!getData().isInitialized()) { @@ -653,78 +654,121 @@ public final class PersistentMessages { return this; } - // required string path = 2; - private java.lang.Object path_ = ""; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier path_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> pathBuilder_; /** - * required string path = 2; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2; */ public boolean hasPath() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** - * required string path = 2; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2; */ - public java.lang.String getPath() { - java.lang.Object ref = path_; - if (!(ref instanceof java.lang.String)) { - java.lang.String s = ((com.google.protobuf.ByteString) ref) - .toStringUtf8(); - path_ = s; - return s; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getPath() { + if (pathBuilder_ == null) { + return path_; } else { - return (java.lang.String) ref; + return pathBuilder_.getMessage(); } } /** - * required string path = 2; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2; */ - public com.google.protobuf.ByteString - getPathBytes() { - java.lang.Object ref = path_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - path_ = b; - return b; + public Builder setPath(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) { + if (pathBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + path_ = value; + onChanged(); } else { - return (com.google.protobuf.ByteString) ref; + pathBuilder_.setMessage(value); } + bitField0_ |= 0x00000002; + return this; } /** - * required string path = 2; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2; */ public Builder setPath( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - path_ = value; - onChanged(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) { + if (pathBuilder_ == null) { + path_ = builderForValue.build(); + onChanged(); + } else { + pathBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; return this; } /** - * required string path = 2; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2; + */ + public Builder mergePath(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) { + if (pathBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + path_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) { + path_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(path_).mergeFrom(value).buildPartial(); + } else { + path_ = value; + } + onChanged(); + } else { + pathBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2; */ public Builder clearPath() { + if (pathBuilder_ == null) { + path_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + onChanged(); + } else { + pathBuilder_.clear(); + } bitField0_ = (bitField0_ & ~0x00000002); - path_ = getDefaultInstance().getPath(); - onChanged(); return this; } /** - * required string path = 2; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2; */ - public Builder setPathBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - path_ = value; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getPathBuilder() { + bitField0_ |= 0x00000002; onChanged(); - return this; + return getPathFieldBuilder().getBuilder(); + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getPathOrBuilder() { + if (pathBuilder_ != null) { + return pathBuilder_.getMessageOrBuilder(); + } else { + return path_; + } + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> + getPathFieldBuilder() { + if (pathBuilder_ == null) { + pathBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>( + path_, + getParentForChildren(), + isClean()); + path_ = null; + } + return pathBuilder_; } // optional .org.opendaylight.controller.mdsal.Node data = 3; @@ -1561,14 +1605,15 @@ public final class PersistentMessages { static { java.lang.String[] descriptorData = { "\n\020Persistent.proto\022!org.opendaylight.con" + - "troller.mdsal\032\014Common.proto\"a\n\014Modificat" + - "ion\022\014\n\004type\030\001 \002(\t\022\014\n\004path\030\002 \002(\t\0225\n\004data\030" + - "\003 \001(\0132\'.org.opendaylight.controller.mdsa" + - "l.Node\"^\n\025CompositeModification\022E\n\014modif" + - "ication\030\001 \003(\0132/.org.opendaylight.control" + - "ler.mdsal.ModificationBO\n9org.opendaylig" + - "ht.controller.protobuff.messages.persist" + - "entB\022PersistentMessages" + "troller.mdsal\032\014Common.proto\"\230\001\n\014Modifica" + + "tion\022\014\n\004type\030\001 \002(\t\022C\n\004path\030\002 \002(\01325.org.o" + + "pendaylight.controller.mdsal.InstanceIde" + + "ntifier\0225\n\004data\030\003 \001(\0132\'.org.opendaylight" + + ".controller.mdsal.Node\"^\n\025CompositeModif" + + "ication\022E\n\014modification\030\001 \003(\0132/.org.open" + + "daylight.controller.mdsal.ModificationBO" + + "\n9org.opendaylight.controller.protobuff." + + "messages.persistentB\022PersistentMessages" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/registration/ListenerRegistrationMessages.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/registration/ListenerRegistrationMessages.java index d07c6781b6..77cbd4da46 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/registration/ListenerRegistrationMessages.java +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/registration/ListenerRegistrationMessages.java @@ -645,20 +645,19 @@ public final class ListenerRegistrationMessages { public interface RegisterChangeListenerOrBuilder extends com.google.protobuf.MessageOrBuilder { - // required string instanceIdentifierPath = 1; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; /** - * required string instanceIdentifierPath = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ boolean hasInstanceIdentifierPath(); /** - * required string instanceIdentifierPath = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ - java.lang.String getInstanceIdentifierPath(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPath(); /** - * required string instanceIdentifierPath = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ - com.google.protobuf.ByteString - getInstanceIdentifierPathBytes(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathOrBuilder(); // required string dataChangeListenerActorPath = 2; /** @@ -737,8 +736,16 @@ public final class ListenerRegistrationMessages { break; } case 10: { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + subBuilder = instanceIdentifierPath_.toBuilder(); + } + instanceIdentifierPath_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(instanceIdentifierPath_); + instanceIdentifierPath_ = subBuilder.buildPartial(); + } bitField0_ |= 0x00000001; - instanceIdentifierPath_ = input.readBytes(); break; } case 18: { @@ -791,47 +798,26 @@ public final class ListenerRegistrationMessages { } private int bitField0_; - // required string instanceIdentifierPath = 1; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; public static final int INSTANCEIDENTIFIERPATH_FIELD_NUMBER = 1; - private java.lang.Object instanceIdentifierPath_; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPath_; /** - * required string instanceIdentifierPath = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ public boolean hasInstanceIdentifierPath() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * required string instanceIdentifierPath = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ - public java.lang.String getInstanceIdentifierPath() { - java.lang.Object ref = instanceIdentifierPath_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - instanceIdentifierPath_ = s; - } - return s; - } + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPath() { + return instanceIdentifierPath_; } /** - * required string instanceIdentifierPath = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ - public com.google.protobuf.ByteString - getInstanceIdentifierPathBytes() { - java.lang.Object ref = instanceIdentifierPath_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - instanceIdentifierPath_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathOrBuilder() { + return instanceIdentifierPath_; } // required string dataChangeListenerActorPath = 2; @@ -894,7 +880,7 @@ public final class ListenerRegistrationMessages { } private void initFields() { - instanceIdentifierPath_ = ""; + instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); dataChangeListenerActorPath_ = ""; dataChangeScope_ = 0; } @@ -915,6 +901,10 @@ public final class ListenerRegistrationMessages { memoizedIsInitialized = 0; return false; } + if (!getInstanceIdentifierPath().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } memoizedIsInitialized = 1; return true; } @@ -923,7 +913,7 @@ public final class ListenerRegistrationMessages { throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getInstanceIdentifierPathBytes()); + output.writeMessage(1, instanceIdentifierPath_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getDataChangeListenerActorPathBytes()); @@ -942,7 +932,7 @@ public final class ListenerRegistrationMessages { size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getInstanceIdentifierPathBytes()); + .computeMessageSize(1, instanceIdentifierPath_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream @@ -1060,6 +1050,7 @@ public final class ListenerRegistrationMessages { } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getInstanceIdentifierPathFieldBuilder(); } } private static Builder create() { @@ -1068,7 +1059,11 @@ public final class ListenerRegistrationMessages { public Builder clear() { super.clear(); - instanceIdentifierPath_ = ""; + if (instanceIdentifierPathBuilder_ == null) { + instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + } else { + instanceIdentifierPathBuilder_.clear(); + } bitField0_ = (bitField0_ & ~0x00000001); dataChangeListenerActorPath_ = ""; bitField0_ = (bitField0_ & ~0x00000002); @@ -1105,7 +1100,11 @@ public final class ListenerRegistrationMessages { if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } - result.instanceIdentifierPath_ = instanceIdentifierPath_; + if (instanceIdentifierPathBuilder_ == null) { + result.instanceIdentifierPath_ = instanceIdentifierPath_; + } else { + result.instanceIdentifierPath_ = instanceIdentifierPathBuilder_.build(); + } if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } @@ -1131,9 +1130,7 @@ public final class ListenerRegistrationMessages { public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener other) { if (other == org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages.RegisterChangeListener.getDefaultInstance()) return this; if (other.hasInstanceIdentifierPath()) { - bitField0_ |= 0x00000001; - instanceIdentifierPath_ = other.instanceIdentifierPath_; - onChanged(); + mergeInstanceIdentifierPath(other.getInstanceIdentifierPath()); } if (other.hasDataChangeListenerActorPath()) { bitField0_ |= 0x00000002; @@ -1160,6 +1157,10 @@ public final class ListenerRegistrationMessages { return false; } + if (!getInstanceIdentifierPath().isInitialized()) { + + return false; + } return true; } @@ -1182,78 +1183,121 @@ public final class ListenerRegistrationMessages { } private int bitField0_; - // required string instanceIdentifierPath = 1; - private java.lang.Object instanceIdentifierPath_ = ""; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierPathBuilder_; /** - * required string instanceIdentifierPath = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ public boolean hasInstanceIdentifierPath() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * required string instanceIdentifierPath = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ - public java.lang.String getInstanceIdentifierPath() { - java.lang.Object ref = instanceIdentifierPath_; - if (!(ref instanceof java.lang.String)) { - java.lang.String s = ((com.google.protobuf.ByteString) ref) - .toStringUtf8(); - instanceIdentifierPath_ = s; - return s; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPath() { + if (instanceIdentifierPathBuilder_ == null) { + return instanceIdentifierPath_; } else { - return (java.lang.String) ref; + return instanceIdentifierPathBuilder_.getMessage(); } } /** - * required string instanceIdentifierPath = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ - public com.google.protobuf.ByteString - getInstanceIdentifierPathBytes() { - java.lang.Object ref = instanceIdentifierPath_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - instanceIdentifierPath_ = b; - return b; + public Builder setInstanceIdentifierPath(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) { + if (instanceIdentifierPathBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + instanceIdentifierPath_ = value; + onChanged(); } else { - return (com.google.protobuf.ByteString) ref; + instanceIdentifierPathBuilder_.setMessage(value); } + bitField0_ |= 0x00000001; + return this; } /** - * required string instanceIdentifierPath = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ public Builder setInstanceIdentifierPath( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - instanceIdentifierPath_ = value; - onChanged(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) { + if (instanceIdentifierPathBuilder_ == null) { + instanceIdentifierPath_ = builderForValue.build(); + onChanged(); + } else { + instanceIdentifierPathBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; + */ + public Builder mergeInstanceIdentifierPath(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) { + if (instanceIdentifierPathBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + instanceIdentifierPath_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) { + instanceIdentifierPath_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierPath_).mergeFrom(value).buildPartial(); + } else { + instanceIdentifierPath_ = value; + } + onChanged(); + } else { + instanceIdentifierPathBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; return this; } /** - * required string instanceIdentifierPath = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ public Builder clearInstanceIdentifierPath() { + if (instanceIdentifierPathBuilder_ == null) { + instanceIdentifierPath_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + onChanged(); + } else { + instanceIdentifierPathBuilder_.clear(); + } bitField0_ = (bitField0_ & ~0x00000001); - instanceIdentifierPath_ = getDefaultInstance().getInstanceIdentifierPath(); - onChanged(); return this; } /** - * required string instanceIdentifierPath = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; */ - public Builder setInstanceIdentifierPathBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - instanceIdentifierPath_ = value; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierPathBuilder() { + bitField0_ |= 0x00000001; onChanged(); - return this; + return getInstanceIdentifierPathFieldBuilder().getBuilder(); + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathOrBuilder() { + if (instanceIdentifierPathBuilder_ != null) { + return instanceIdentifierPathBuilder_.getMessageOrBuilder(); + } else { + return instanceIdentifierPath_; + } + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1; + */ + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> + getInstanceIdentifierPathFieldBuilder() { + if (instanceIdentifierPathBuilder_ == null) { + instanceIdentifierPathBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>( + instanceIdentifierPath_, + getParentForChildren(), + isClean()); + instanceIdentifierPath_ = null; + } + return instanceIdentifierPathBuilder_; } // required string dataChangeListenerActorPath = 2; @@ -1897,16 +1941,18 @@ public final class ListenerRegistrationMessages { static { java.lang.String[] descriptorData = { "\n\032ListenerRegistration.proto\022!org.openda" + - "ylight.controller.mdsal\"%\n#CloseDataChan" + - "geListenerRegistration\"*\n(CloseDataChang" + - "eListenerRegistrationReply\"v\n\026RegisterCh" + - "angeListener\022\036\n\026instanceIdentifierPath\030\001" + - " \002(\t\022#\n\033dataChangeListenerActorPath\030\002 \002(" + - "\t\022\027\n\017dataChangeScope\030\003 \002(\005\"?\n\033RegisterCh" + - "angeListenerReply\022 \n\030listenerRegistratio" + - "nPath\030\001 \002(\tB[\n;org.opendaylight.controll" + - "er.protobuff.messages.registrationB\034List", - "enerRegistrationMessages" + "ylight.controller.mdsal\032\014Common.proto\"%\n" + + "#CloseDataChangeListenerRegistration\"*\n(" + + "CloseDataChangeListenerRegistrationReply" + + "\"\255\001\n\026RegisterChangeListener\022U\n\026instanceI" + + "dentifierPath\030\001 \002(\01325.org.opendaylight.c" + + "ontroller.mdsal.InstanceIdentifier\022#\n\033da" + + "taChangeListenerActorPath\030\002 \002(\t\022\027\n\017dataC" + + "hangeScope\030\003 \002(\005\"?\n\033RegisterChangeListen" + + "erReply\022 \n\030listenerRegistrationPath\030\001 \002(", + "\tB[\n;org.opendaylight.controller.protobu" + + "ff.messages.registrationB\034ListenerRegist" + + "rationMessages" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -1943,6 +1989,7 @@ public final class ListenerRegistrationMessages { com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.getDescriptor(), }, assigner); } diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/shard/ShardManagerMessages.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/shard/ShardManagerMessages.java index 055f18e4d3..2324dfc2a2 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/shard/ShardManagerMessages.java +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/shard/ShardManagerMessages.java @@ -489,6 +489,21 @@ public final class ShardManagerMessages { public interface PrimaryFoundOrBuilder extends com.google.protobuf.MessageOrBuilder { + + // required string primaryPath = 1; + /** + * required string primaryPath = 1; + */ + boolean hasPrimaryPath(); + /** + * required string primaryPath = 1; + */ + java.lang.String getPrimaryPath(); + /** + * required string primaryPath = 1; + */ + com.google.protobuf.ByteString + getPrimaryPathBytes(); } /** * Protobuf type {@code org.opendaylight.controller.mdsal.PrimaryFound} @@ -523,6 +538,7 @@ public final class ShardManagerMessages { com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); + int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { @@ -540,6 +556,11 @@ public final class ShardManagerMessages { } break; } + case 10: { + bitField0_ |= 0x00000001; + primaryPath_ = input.readBytes(); + break; + } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { @@ -579,13 +600,62 @@ public final class ShardManagerMessages { return PARSER; } + private int bitField0_; + // required string primaryPath = 1; + public static final int PRIMARYPATH_FIELD_NUMBER = 1; + private java.lang.Object primaryPath_; + /** + * required string primaryPath = 1; + */ + public boolean hasPrimaryPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string primaryPath = 1; + */ + public java.lang.String getPrimaryPath() { + java.lang.Object ref = primaryPath_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + primaryPath_ = s; + } + return s; + } + } + /** + * required string primaryPath = 1; + */ + public com.google.protobuf.ByteString + getPrimaryPathBytes() { + java.lang.Object ref = primaryPath_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + primaryPath_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private void initFields() { + primaryPath_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; + if (!hasPrimaryPath()) { + memoizedIsInitialized = 0; + return false; + } memoizedIsInitialized = 1; return true; } @@ -593,6 +663,9 @@ public final class ShardManagerMessages { public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getPrimaryPathBytes()); + } getUnknownFields().writeTo(output); } @@ -602,6 +675,10 @@ public final class ShardManagerMessages { if (size != -1) return size; size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getPrimaryPathBytes()); + } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; @@ -718,6 +795,8 @@ public final class ShardManagerMessages { public Builder clear() { super.clear(); + primaryPath_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); return this; } @@ -744,6 +823,13 @@ public final class ShardManagerMessages { public org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound buildPartial() { org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound result = new org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.primaryPath_ = primaryPath_; + result.bitField0_ = to_bitField0_; onBuilt(); return result; } @@ -759,11 +845,20 @@ public final class ShardManagerMessages { public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound other) { if (other == org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryFound.getDefaultInstance()) return this; + if (other.hasPrimaryPath()) { + bitField0_ |= 0x00000001; + primaryPath_ = other.primaryPath_; + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { + if (!hasPrimaryPath()) { + + return false; + } return true; } @@ -784,6 +879,81 @@ public final class ShardManagerMessages { } return this; } + private int bitField0_; + + // required string primaryPath = 1; + private java.lang.Object primaryPath_ = ""; + /** + * required string primaryPath = 1; + */ + public boolean hasPrimaryPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string primaryPath = 1; + */ + public java.lang.String getPrimaryPath() { + java.lang.Object ref = primaryPath_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + primaryPath_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string primaryPath = 1; + */ + public com.google.protobuf.ByteString + getPrimaryPathBytes() { + java.lang.Object ref = primaryPath_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + primaryPath_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string primaryPath = 1; + */ + public Builder setPrimaryPath( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + primaryPath_ = value; + onChanged(); + return this; + } + /** + * required string primaryPath = 1; + */ + public Builder clearPrimaryPath() { + bitField0_ = (bitField0_ & ~0x00000001); + primaryPath_ = getDefaultInstance().getPrimaryPath(); + onChanged(); + return this; + } + /** + * required string primaryPath = 1; + */ + public Builder setPrimaryPathBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + primaryPath_ = value; + onChanged(); + return this; + } // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.PrimaryFound) } @@ -798,6 +968,21 @@ public final class ShardManagerMessages { public interface PrimaryNotFoundOrBuilder extends com.google.protobuf.MessageOrBuilder { + + // required string shardName = 1; + /** + * required string shardName = 1; + */ + boolean hasShardName(); + /** + * required string shardName = 1; + */ + java.lang.String getShardName(); + /** + * required string shardName = 1; + */ + com.google.protobuf.ByteString + getShardNameBytes(); } /** * Protobuf type {@code org.opendaylight.controller.mdsal.PrimaryNotFound} @@ -832,6 +1017,7 @@ public final class ShardManagerMessages { com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); + int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { @@ -849,6 +1035,11 @@ public final class ShardManagerMessages { } break; } + case 10: { + bitField0_ |= 0x00000001; + shardName_ = input.readBytes(); + break; + } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { @@ -888,13 +1079,62 @@ public final class ShardManagerMessages { return PARSER; } + private int bitField0_; + // required string shardName = 1; + public static final int SHARDNAME_FIELD_NUMBER = 1; + private java.lang.Object shardName_; + /** + * required string shardName = 1; + */ + public boolean hasShardName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string shardName = 1; + */ + public java.lang.String getShardName() { + java.lang.Object ref = shardName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + shardName_ = s; + } + return s; + } + } + /** + * required string shardName = 1; + */ + public com.google.protobuf.ByteString + getShardNameBytes() { + java.lang.Object ref = shardName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + shardName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private void initFields() { + shardName_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; + if (!hasShardName()) { + memoizedIsInitialized = 0; + return false; + } memoizedIsInitialized = 1; return true; } @@ -902,6 +1142,9 @@ public final class ShardManagerMessages { public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getShardNameBytes()); + } getUnknownFields().writeTo(output); } @@ -911,6 +1154,10 @@ public final class ShardManagerMessages { if (size != -1) return size; size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getShardNameBytes()); + } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; @@ -1027,6 +1274,8 @@ public final class ShardManagerMessages { public Builder clear() { super.clear(); + shardName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); return this; } @@ -1053,6 +1302,13 @@ public final class ShardManagerMessages { public org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound buildPartial() { org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound result = new org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.shardName_ = shardName_; + result.bitField0_ = to_bitField0_; onBuilt(); return result; } @@ -1068,11 +1324,20 @@ public final class ShardManagerMessages { public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound other) { if (other == org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages.PrimaryNotFound.getDefaultInstance()) return this; + if (other.hasShardName()) { + bitField0_ |= 0x00000001; + shardName_ = other.shardName_; + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { + if (!hasShardName()) { + + return false; + } return true; } @@ -1093,6 +1358,81 @@ public final class ShardManagerMessages { } return this; } + private int bitField0_; + + // required string shardName = 1; + private java.lang.Object shardName_ = ""; + /** + * required string shardName = 1; + */ + public boolean hasShardName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string shardName = 1; + */ + public java.lang.String getShardName() { + java.lang.Object ref = shardName_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + shardName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string shardName = 1; + */ + public com.google.protobuf.ByteString + getShardNameBytes() { + java.lang.Object ref = shardName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + shardName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string shardName = 1; + */ + public Builder setShardName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + shardName_ = value; + onChanged(); + return this; + } + /** + * required string shardName = 1; + */ + public Builder clearShardName() { + bitField0_ = (bitField0_ & ~0x00000001); + shardName_ = getDefaultInstance().getShardName(); + onChanged(); + return this; + } + /** + * required string shardName = 1; + */ + public Builder setShardNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + shardName_ = value; + onChanged(); + return this; + } // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.PrimaryNotFound) } @@ -1131,8 +1471,9 @@ public final class ShardManagerMessages { java.lang.String[] descriptorData = { "\n\022ShardManager.proto\022!org.opendaylight.c" + "ontroller.mdsal\" \n\013FindPrimary\022\021\n\tshardN" + - "ame\030\001 \002(\t\"\016\n\014PrimaryFound\"\021\n\017PrimaryNotF" + - "oundBL\n4org.opendaylight.controller.prot" + + "ame\030\001 \002(\t\"#\n\014PrimaryFound\022\023\n\013primaryPath" + + "\030\001 \002(\t\"$\n\017PrimaryNotFound\022\021\n\tshardName\030\001" + + " \002(\tBL\n4org.opendaylight.controller.prot" + "obuff.messages.shardB\024ShardManagerMessag" + "es" }; @@ -1152,13 +1493,13 @@ public final class ShardManagerMessages { internal_static_org_opendaylight_controller_mdsal_PrimaryFound_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_org_opendaylight_controller_mdsal_PrimaryFound_descriptor, - new java.lang.String[] { }); + new java.lang.String[] { "PrimaryPath", }); internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_descriptor = getDescriptor().getMessageTypes().get(2); internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_descriptor, - new java.lang.String[] { }); + new java.lang.String[] { "ShardName", }); return null; } }; diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessages.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessages.java index 8dbb28acb0..7ce3b586b4 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessages.java +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/transaction/ShardTransactionMessages.java @@ -628,6 +628,21 @@ public final class ShardTransactionMessages { public interface CreateTransactionOrBuilder extends com.google.protobuf.MessageOrBuilder { + + // required string transactionId = 1; + /** + * required string transactionId = 1; + */ + boolean hasTransactionId(); + /** + * required string transactionId = 1; + */ + java.lang.String getTransactionId(); + /** + * required string transactionId = 1; + */ + com.google.protobuf.ByteString + getTransactionIdBytes(); } /** * Protobuf type {@code org.opendaylight.controller.mdsal.CreateTransaction} @@ -662,6 +677,7 @@ public final class ShardTransactionMessages { com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); + int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { @@ -679,6 +695,11 @@ public final class ShardTransactionMessages { } break; } + case 10: { + bitField0_ |= 0x00000001; + transactionId_ = input.readBytes(); + break; + } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { @@ -718,13 +739,62 @@ public final class ShardTransactionMessages { return PARSER; } + private int bitField0_; + // required string transactionId = 1; + public static final int TRANSACTIONID_FIELD_NUMBER = 1; + private java.lang.Object transactionId_; + /** + * required string transactionId = 1; + */ + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string transactionId = 1; + */ + public java.lang.String getTransactionId() { + java.lang.Object ref = transactionId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + transactionId_ = s; + } + return s; + } + } + /** + * required string transactionId = 1; + */ + public com.google.protobuf.ByteString + getTransactionIdBytes() { + java.lang.Object ref = transactionId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + transactionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private void initFields() { + transactionId_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; + if (!hasTransactionId()) { + memoizedIsInitialized = 0; + return false; + } memoizedIsInitialized = 1; return true; } @@ -732,6 +802,9 @@ public final class ShardTransactionMessages { public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTransactionIdBytes()); + } getUnknownFields().writeTo(output); } @@ -741,6 +814,10 @@ public final class ShardTransactionMessages { if (size != -1) return size; size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTransactionIdBytes()); + } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; @@ -857,6 +934,8 @@ public final class ShardTransactionMessages { public Builder clear() { super.clear(); + transactionId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); return this; } @@ -883,6 +962,13 @@ public final class ShardTransactionMessages { public org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction buildPartial() { org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction result = new org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.transactionId_ = transactionId_; + result.bitField0_ = to_bitField0_; onBuilt(); return result; } @@ -898,11 +984,20 @@ public final class ShardTransactionMessages { public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction other) { if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.CreateTransaction.getDefaultInstance()) return this; + if (other.hasTransactionId()) { + bitField0_ |= 0x00000001; + transactionId_ = other.transactionId_; + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { + if (!hasTransactionId()) { + + return false; + } return true; } @@ -923,6 +1018,81 @@ public final class ShardTransactionMessages { } return this; } + private int bitField0_; + + // required string transactionId = 1; + private java.lang.Object transactionId_ = ""; + /** + * required string transactionId = 1; + */ + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string transactionId = 1; + */ + public java.lang.String getTransactionId() { + java.lang.Object ref = transactionId_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + transactionId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string transactionId = 1; + */ + public com.google.protobuf.ByteString + getTransactionIdBytes() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + transactionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string transactionId = 1; + */ + public Builder setTransactionId( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + transactionId_ = value; + onChanged(); + return this; + } + /** + * required string transactionId = 1; + */ + public Builder clearTransactionId() { + bitField0_ = (bitField0_ & ~0x00000001); + transactionId_ = getDefaultInstance().getTransactionId(); + onChanged(); + return this; + } + /** + * required string transactionId = 1; + */ + public Builder setTransactionIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + transactionId_ = value; + onChanged(); + return this; + } // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CreateTransaction) } @@ -2369,20 +2539,19 @@ public final class ShardTransactionMessages { public interface DeleteDataOrBuilder extends com.google.protobuf.MessageOrBuilder { - // required string instanceIdentifierPathArguments = 1; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ boolean hasInstanceIdentifierPathArguments(); /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - java.lang.String getInstanceIdentifierPathArguments(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments(); /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - com.google.protobuf.ByteString - getInstanceIdentifierPathArgumentsBytes(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder(); } /** * Protobuf type {@code org.opendaylight.controller.mdsal.DeleteData} @@ -2436,8 +2605,16 @@ public final class ShardTransactionMessages { break; } case 10: { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + subBuilder = instanceIdentifierPathArguments_.toBuilder(); + } + instanceIdentifierPathArguments_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(instanceIdentifierPathArguments_); + instanceIdentifierPathArguments_ = subBuilder.buildPartial(); + } bitField0_ |= 0x00000001; - instanceIdentifierPathArguments_ = input.readBytes(); break; } } @@ -2480,51 +2657,30 @@ public final class ShardTransactionMessages { } private int bitField0_; - // required string instanceIdentifierPathArguments = 1; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; public static final int INSTANCEIDENTIFIERPATHARGUMENTS_FIELD_NUMBER = 1; - private java.lang.Object instanceIdentifierPathArguments_; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_; /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ public boolean hasInstanceIdentifierPathArguments() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public java.lang.String getInstanceIdentifierPathArguments() { - java.lang.Object ref = instanceIdentifierPathArguments_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - instanceIdentifierPathArguments_ = s; - } - return s; - } + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() { + return instanceIdentifierPathArguments_; } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public com.google.protobuf.ByteString - getInstanceIdentifierPathArgumentsBytes() { - java.lang.Object ref = instanceIdentifierPathArguments_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - instanceIdentifierPathArguments_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() { + return instanceIdentifierPathArguments_; } private void initFields() { - instanceIdentifierPathArguments_ = ""; + instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -2535,6 +2691,10 @@ public final class ShardTransactionMessages { memoizedIsInitialized = 0; return false; } + if (!getInstanceIdentifierPathArguments().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } memoizedIsInitialized = 1; return true; } @@ -2543,7 +2703,7 @@ public final class ShardTransactionMessages { throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getInstanceIdentifierPathArgumentsBytes()); + output.writeMessage(1, instanceIdentifierPathArguments_); } getUnknownFields().writeTo(output); } @@ -2556,7 +2716,7 @@ public final class ShardTransactionMessages { size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getInstanceIdentifierPathArgumentsBytes()); + .computeMessageSize(1, instanceIdentifierPathArguments_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; @@ -2666,6 +2826,7 @@ public final class ShardTransactionMessages { } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getInstanceIdentifierPathArgumentsFieldBuilder(); } } private static Builder create() { @@ -2674,7 +2835,11 @@ public final class ShardTransactionMessages { public Builder clear() { super.clear(); - instanceIdentifierPathArguments_ = ""; + if (instanceIdentifierPathArgumentsBuilder_ == null) { + instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + } else { + instanceIdentifierPathArgumentsBuilder_.clear(); + } bitField0_ = (bitField0_ & ~0x00000001); return this; } @@ -2707,7 +2872,11 @@ public final class ShardTransactionMessages { if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } - result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_; + if (instanceIdentifierPathArgumentsBuilder_ == null) { + result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_; + } else { + result.instanceIdentifierPathArguments_ = instanceIdentifierPathArgumentsBuilder_.build(); + } result.bitField0_ = to_bitField0_; onBuilt(); return result; @@ -2725,9 +2894,7 @@ public final class ShardTransactionMessages { public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData other) { if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.DeleteData.getDefaultInstance()) return this; if (other.hasInstanceIdentifierPathArguments()) { - bitField0_ |= 0x00000001; - instanceIdentifierPathArguments_ = other.instanceIdentifierPathArguments_; - onChanged(); + mergeInstanceIdentifierPathArguments(other.getInstanceIdentifierPathArguments()); } this.mergeUnknownFields(other.getUnknownFields()); return this; @@ -2738,6 +2905,10 @@ public final class ShardTransactionMessages { return false; } + if (!getInstanceIdentifierPathArguments().isInitialized()) { + + return false; + } return true; } @@ -2760,78 +2931,121 @@ public final class ShardTransactionMessages { } private int bitField0_; - // required string instanceIdentifierPathArguments = 1; - private java.lang.Object instanceIdentifierPathArguments_ = ""; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierPathArgumentsBuilder_; /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ public boolean hasInstanceIdentifierPathArguments() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public java.lang.String getInstanceIdentifierPathArguments() { - java.lang.Object ref = instanceIdentifierPathArguments_; - if (!(ref instanceof java.lang.String)) { - java.lang.String s = ((com.google.protobuf.ByteString) ref) - .toStringUtf8(); - instanceIdentifierPathArguments_ = s; - return s; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + return instanceIdentifierPathArguments_; } else { - return (java.lang.String) ref; + return instanceIdentifierPathArgumentsBuilder_.getMessage(); } } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public com.google.protobuf.ByteString - getInstanceIdentifierPathArgumentsBytes() { - java.lang.Object ref = instanceIdentifierPathArguments_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - instanceIdentifierPathArguments_ = b; - return b; + public Builder setInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + instanceIdentifierPathArguments_ = value; + onChanged(); } else { - return (com.google.protobuf.ByteString) ref; + instanceIdentifierPathArgumentsBuilder_.setMessage(value); } + bitField0_ |= 0x00000001; + return this; } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ public Builder setInstanceIdentifierPathArguments( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - instanceIdentifierPathArguments_ = value; - onChanged(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + instanceIdentifierPathArguments_ = builderForValue.build(); + onChanged(); + } else { + instanceIdentifierPathArgumentsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; + */ + public Builder mergeInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + instanceIdentifierPathArguments_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) { + instanceIdentifierPathArguments_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierPathArguments_).mergeFrom(value).buildPartial(); + } else { + instanceIdentifierPathArguments_ = value; + } + onChanged(); + } else { + instanceIdentifierPathArgumentsBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; return this; } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ public Builder clearInstanceIdentifierPathArguments() { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + onChanged(); + } else { + instanceIdentifierPathArgumentsBuilder_.clear(); + } bitField0_ = (bitField0_ & ~0x00000001); - instanceIdentifierPathArguments_ = getDefaultInstance().getInstanceIdentifierPathArguments(); - onChanged(); return this; } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public Builder setInstanceIdentifierPathArgumentsBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - instanceIdentifierPathArguments_ = value; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierPathArgumentsBuilder() { + bitField0_ |= 0x00000001; onChanged(); - return this; + return getInstanceIdentifierPathArgumentsFieldBuilder().getBuilder(); + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() { + if (instanceIdentifierPathArgumentsBuilder_ != null) { + return instanceIdentifierPathArgumentsBuilder_.getMessageOrBuilder(); + } else { + return instanceIdentifierPathArguments_; + } + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; + */ + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> + getInstanceIdentifierPathArgumentsFieldBuilder() { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + instanceIdentifierPathArgumentsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>( + instanceIdentifierPathArguments_, + getParentForChildren(), + isClean()); + instanceIdentifierPathArguments_ = null; + } + return instanceIdentifierPathArgumentsBuilder_; } // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.DeleteData) @@ -3157,20 +3371,19 @@ public final class ShardTransactionMessages { public interface ReadDataOrBuilder extends com.google.protobuf.MessageOrBuilder { - // required string instanceIdentifierPathArguments = 1; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ boolean hasInstanceIdentifierPathArguments(); /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - java.lang.String getInstanceIdentifierPathArguments(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments(); /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - com.google.protobuf.ByteString - getInstanceIdentifierPathArgumentsBytes(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder(); } /** * Protobuf type {@code org.opendaylight.controller.mdsal.ReadData} @@ -3224,8 +3437,16 @@ public final class ShardTransactionMessages { break; } case 10: { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + subBuilder = instanceIdentifierPathArguments_.toBuilder(); + } + instanceIdentifierPathArguments_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(instanceIdentifierPathArguments_); + instanceIdentifierPathArguments_ = subBuilder.buildPartial(); + } bitField0_ |= 0x00000001; - instanceIdentifierPathArguments_ = input.readBytes(); break; } } @@ -3268,51 +3489,30 @@ public final class ShardTransactionMessages { } private int bitField0_; - // required string instanceIdentifierPathArguments = 1; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; public static final int INSTANCEIDENTIFIERPATHARGUMENTS_FIELD_NUMBER = 1; - private java.lang.Object instanceIdentifierPathArguments_; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_; /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ public boolean hasInstanceIdentifierPathArguments() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public java.lang.String getInstanceIdentifierPathArguments() { - java.lang.Object ref = instanceIdentifierPathArguments_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - instanceIdentifierPathArguments_ = s; - } - return s; - } + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() { + return instanceIdentifierPathArguments_; } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public com.google.protobuf.ByteString - getInstanceIdentifierPathArgumentsBytes() { - java.lang.Object ref = instanceIdentifierPathArguments_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - instanceIdentifierPathArguments_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() { + return instanceIdentifierPathArguments_; } private void initFields() { - instanceIdentifierPathArguments_ = ""; + instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -3323,6 +3523,10 @@ public final class ShardTransactionMessages { memoizedIsInitialized = 0; return false; } + if (!getInstanceIdentifierPathArguments().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } memoizedIsInitialized = 1; return true; } @@ -3331,7 +3535,7 @@ public final class ShardTransactionMessages { throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getInstanceIdentifierPathArgumentsBytes()); + output.writeMessage(1, instanceIdentifierPathArguments_); } getUnknownFields().writeTo(output); } @@ -3344,7 +3548,7 @@ public final class ShardTransactionMessages { size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getInstanceIdentifierPathArgumentsBytes()); + .computeMessageSize(1, instanceIdentifierPathArguments_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; @@ -3454,6 +3658,7 @@ public final class ShardTransactionMessages { } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getInstanceIdentifierPathArgumentsFieldBuilder(); } } private static Builder create() { @@ -3462,7 +3667,11 @@ public final class ShardTransactionMessages { public Builder clear() { super.clear(); - instanceIdentifierPathArguments_ = ""; + if (instanceIdentifierPathArgumentsBuilder_ == null) { + instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + } else { + instanceIdentifierPathArgumentsBuilder_.clear(); + } bitField0_ = (bitField0_ & ~0x00000001); return this; } @@ -3495,7 +3704,11 @@ public final class ShardTransactionMessages { if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } - result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_; + if (instanceIdentifierPathArgumentsBuilder_ == null) { + result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_; + } else { + result.instanceIdentifierPathArguments_ = instanceIdentifierPathArgumentsBuilder_.build(); + } result.bitField0_ = to_bitField0_; onBuilt(); return result; @@ -3513,9 +3726,7 @@ public final class ShardTransactionMessages { public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData other) { if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.ReadData.getDefaultInstance()) return this; if (other.hasInstanceIdentifierPathArguments()) { - bitField0_ |= 0x00000001; - instanceIdentifierPathArguments_ = other.instanceIdentifierPathArguments_; - onChanged(); + mergeInstanceIdentifierPathArguments(other.getInstanceIdentifierPathArguments()); } this.mergeUnknownFields(other.getUnknownFields()); return this; @@ -3526,6 +3737,10 @@ public final class ShardTransactionMessages { return false; } + if (!getInstanceIdentifierPathArguments().isInitialized()) { + + return false; + } return true; } @@ -3548,78 +3763,121 @@ public final class ShardTransactionMessages { } private int bitField0_; - // required string instanceIdentifierPathArguments = 1; - private java.lang.Object instanceIdentifierPathArguments_ = ""; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierPathArgumentsBuilder_; /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ public boolean hasInstanceIdentifierPathArguments() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public java.lang.String getInstanceIdentifierPathArguments() { - java.lang.Object ref = instanceIdentifierPathArguments_; - if (!(ref instanceof java.lang.String)) { - java.lang.String s = ((com.google.protobuf.ByteString) ref) - .toStringUtf8(); - instanceIdentifierPathArguments_ = s; - return s; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + return instanceIdentifierPathArguments_; } else { - return (java.lang.String) ref; + return instanceIdentifierPathArgumentsBuilder_.getMessage(); } } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public com.google.protobuf.ByteString - getInstanceIdentifierPathArgumentsBytes() { - java.lang.Object ref = instanceIdentifierPathArguments_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - instanceIdentifierPathArguments_ = b; - return b; + public Builder setInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + instanceIdentifierPathArguments_ = value; + onChanged(); } else { - return (com.google.protobuf.ByteString) ref; + instanceIdentifierPathArgumentsBuilder_.setMessage(value); } + bitField0_ |= 0x00000001; + return this; } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ public Builder setInstanceIdentifierPathArguments( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - instanceIdentifierPathArguments_ = value; - onChanged(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + instanceIdentifierPathArguments_ = builderForValue.build(); + onChanged(); + } else { + instanceIdentifierPathArgumentsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; + */ + public Builder mergeInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + instanceIdentifierPathArguments_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) { + instanceIdentifierPathArguments_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierPathArguments_).mergeFrom(value).buildPartial(); + } else { + instanceIdentifierPathArguments_ = value; + } + onChanged(); + } else { + instanceIdentifierPathArgumentsBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; return this; } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ public Builder clearInstanceIdentifierPathArguments() { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + onChanged(); + } else { + instanceIdentifierPathArgumentsBuilder_.clear(); + } bitField0_ = (bitField0_ & ~0x00000001); - instanceIdentifierPathArguments_ = getDefaultInstance().getInstanceIdentifierPathArguments(); - onChanged(); return this; } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public Builder setInstanceIdentifierPathArgumentsBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - instanceIdentifierPathArguments_ = value; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierPathArgumentsBuilder() { + bitField0_ |= 0x00000001; onChanged(); - return this; + return getInstanceIdentifierPathArgumentsFieldBuilder().getBuilder(); + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() { + if (instanceIdentifierPathArgumentsBuilder_ != null) { + return instanceIdentifierPathArgumentsBuilder_.getMessageOrBuilder(); + } else { + return instanceIdentifierPathArguments_; + } + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; + */ + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> + getInstanceIdentifierPathArgumentsFieldBuilder() { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + instanceIdentifierPathArgumentsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>( + instanceIdentifierPathArguments_, + getParentForChildren(), + isClean()); + instanceIdentifierPathArguments_ = null; + } + return instanceIdentifierPathArgumentsBuilder_; } // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.ReadData) @@ -4155,20 +4413,19 @@ public final class ShardTransactionMessages { public interface WriteDataOrBuilder extends com.google.protobuf.MessageOrBuilder { - // required string instanceIdentifierPathArguments = 1; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ boolean hasInstanceIdentifierPathArguments(); /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - java.lang.String getInstanceIdentifierPathArguments(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments(); /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - com.google.protobuf.ByteString - getInstanceIdentifierPathArgumentsBytes(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder(); // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; /** @@ -4236,8 +4493,16 @@ public final class ShardTransactionMessages { break; } case 10: { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + subBuilder = instanceIdentifierPathArguments_.toBuilder(); + } + instanceIdentifierPathArguments_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(instanceIdentifierPathArguments_); + instanceIdentifierPathArguments_ = subBuilder.buildPartial(); + } bitField0_ |= 0x00000001; - instanceIdentifierPathArguments_ = input.readBytes(); break; } case 18: { @@ -4293,47 +4558,26 @@ public final class ShardTransactionMessages { } private int bitField0_; - // required string instanceIdentifierPathArguments = 1; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; public static final int INSTANCEIDENTIFIERPATHARGUMENTS_FIELD_NUMBER = 1; - private java.lang.Object instanceIdentifierPathArguments_; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_; /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ public boolean hasInstanceIdentifierPathArguments() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public java.lang.String getInstanceIdentifierPathArguments() { - java.lang.Object ref = instanceIdentifierPathArguments_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - instanceIdentifierPathArguments_ = s; - } - return s; - } + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() { + return instanceIdentifierPathArguments_; } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public com.google.protobuf.ByteString - getInstanceIdentifierPathArgumentsBytes() { - java.lang.Object ref = instanceIdentifierPathArguments_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - instanceIdentifierPathArguments_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() { + return instanceIdentifierPathArguments_; } // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; @@ -4359,7 +4603,7 @@ public final class ShardTransactionMessages { } private void initFields() { - instanceIdentifierPathArguments_ = ""; + instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); } private byte memoizedIsInitialized = -1; @@ -4375,6 +4619,10 @@ public final class ShardTransactionMessages { memoizedIsInitialized = 0; return false; } + if (!getInstanceIdentifierPathArguments().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } if (!getNormalizedNode().isInitialized()) { memoizedIsInitialized = 0; return false; @@ -4387,7 +4635,7 @@ public final class ShardTransactionMessages { throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getInstanceIdentifierPathArgumentsBytes()); + output.writeMessage(1, instanceIdentifierPathArguments_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeMessage(2, normalizedNode_); @@ -4403,7 +4651,7 @@ public final class ShardTransactionMessages { size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getInstanceIdentifierPathArgumentsBytes()); + .computeMessageSize(1, instanceIdentifierPathArguments_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream @@ -4517,6 +4765,7 @@ public final class ShardTransactionMessages { } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getInstanceIdentifierPathArgumentsFieldBuilder(); getNormalizedNodeFieldBuilder(); } } @@ -4526,7 +4775,11 @@ public final class ShardTransactionMessages { public Builder clear() { super.clear(); - instanceIdentifierPathArguments_ = ""; + if (instanceIdentifierPathArgumentsBuilder_ == null) { + instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + } else { + instanceIdentifierPathArgumentsBuilder_.clear(); + } bitField0_ = (bitField0_ & ~0x00000001); if (normalizedNodeBuilder_ == null) { normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); @@ -4565,7 +4818,11 @@ public final class ShardTransactionMessages { if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } - result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_; + if (instanceIdentifierPathArgumentsBuilder_ == null) { + result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_; + } else { + result.instanceIdentifierPathArguments_ = instanceIdentifierPathArgumentsBuilder_.build(); + } if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } @@ -4591,9 +4848,7 @@ public final class ShardTransactionMessages { public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData other) { if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.WriteData.getDefaultInstance()) return this; if (other.hasInstanceIdentifierPathArguments()) { - bitField0_ |= 0x00000001; - instanceIdentifierPathArguments_ = other.instanceIdentifierPathArguments_; - onChanged(); + mergeInstanceIdentifierPathArguments(other.getInstanceIdentifierPathArguments()); } if (other.hasNormalizedNode()) { mergeNormalizedNode(other.getNormalizedNode()); @@ -4611,6 +4866,10 @@ public final class ShardTransactionMessages { return false; } + if (!getInstanceIdentifierPathArguments().isInitialized()) { + + return false; + } if (!getNormalizedNode().isInitialized()) { return false; @@ -4637,78 +4896,121 @@ public final class ShardTransactionMessages { } private int bitField0_; - // required string instanceIdentifierPathArguments = 1; - private java.lang.Object instanceIdentifierPathArguments_ = ""; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierPathArgumentsBuilder_; /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ public boolean hasInstanceIdentifierPathArguments() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public java.lang.String getInstanceIdentifierPathArguments() { - java.lang.Object ref = instanceIdentifierPathArguments_; - if (!(ref instanceof java.lang.String)) { - java.lang.String s = ((com.google.protobuf.ByteString) ref) - .toStringUtf8(); - instanceIdentifierPathArguments_ = s; - return s; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + return instanceIdentifierPathArguments_; } else { - return (java.lang.String) ref; + return instanceIdentifierPathArgumentsBuilder_.getMessage(); } } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public com.google.protobuf.ByteString - getInstanceIdentifierPathArgumentsBytes() { - java.lang.Object ref = instanceIdentifierPathArguments_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - instanceIdentifierPathArguments_ = b; - return b; + public Builder setInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + instanceIdentifierPathArguments_ = value; + onChanged(); } else { - return (com.google.protobuf.ByteString) ref; + instanceIdentifierPathArgumentsBuilder_.setMessage(value); } + bitField0_ |= 0x00000001; + return this; } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ public Builder setInstanceIdentifierPathArguments( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - instanceIdentifierPathArguments_ = value; - onChanged(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + instanceIdentifierPathArguments_ = builderForValue.build(); + onChanged(); + } else { + instanceIdentifierPathArgumentsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; return this; } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; + */ + public Builder mergeInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + instanceIdentifierPathArguments_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) { + instanceIdentifierPathArguments_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierPathArguments_).mergeFrom(value).buildPartial(); + } else { + instanceIdentifierPathArguments_ = value; + } + onChanged(); + } else { + instanceIdentifierPathArgumentsBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ public Builder clearInstanceIdentifierPathArguments() { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + onChanged(); + } else { + instanceIdentifierPathArgumentsBuilder_.clear(); + } bitField0_ = (bitField0_ & ~0x00000001); - instanceIdentifierPathArguments_ = getDefaultInstance().getInstanceIdentifierPathArguments(); - onChanged(); return this; } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public Builder setInstanceIdentifierPathArgumentsBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - instanceIdentifierPathArguments_ = value; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierPathArgumentsBuilder() { + bitField0_ |= 0x00000001; onChanged(); - return this; + return getInstanceIdentifierPathArgumentsFieldBuilder().getBuilder(); + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() { + if (instanceIdentifierPathArgumentsBuilder_ != null) { + return instanceIdentifierPathArgumentsBuilder_.getMessageOrBuilder(); + } else { + return instanceIdentifierPathArguments_; + } + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; + */ + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> + getInstanceIdentifierPathArgumentsFieldBuilder() { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + instanceIdentifierPathArgumentsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>( + instanceIdentifierPathArguments_, + getParentForChildren(), + isClean()); + instanceIdentifierPathArguments_ = null; + } + return instanceIdentifierPathArgumentsBuilder_; } // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; @@ -5151,20 +5453,19 @@ public final class ShardTransactionMessages { public interface MergeDataOrBuilder extends com.google.protobuf.MessageOrBuilder { - // required string instanceIdentifierPathArguments = 1; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ boolean hasInstanceIdentifierPathArguments(); /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - java.lang.String getInstanceIdentifierPathArguments(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments(); /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - com.google.protobuf.ByteString - getInstanceIdentifierPathArgumentsBytes(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder(); // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; /** @@ -5232,8 +5533,16 @@ public final class ShardTransactionMessages { break; } case 10: { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + subBuilder = instanceIdentifierPathArguments_.toBuilder(); + } + instanceIdentifierPathArguments_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(instanceIdentifierPathArguments_); + instanceIdentifierPathArguments_ = subBuilder.buildPartial(); + } bitField0_ |= 0x00000001; - instanceIdentifierPathArguments_ = input.readBytes(); break; } case 18: { @@ -5289,47 +5598,26 @@ public final class ShardTransactionMessages { } private int bitField0_; - // required string instanceIdentifierPathArguments = 1; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; public static final int INSTANCEIDENTIFIERPATHARGUMENTS_FIELD_NUMBER = 1; - private java.lang.Object instanceIdentifierPathArguments_; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_; /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ public boolean hasInstanceIdentifierPathArguments() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public java.lang.String getInstanceIdentifierPathArguments() { - java.lang.Object ref = instanceIdentifierPathArguments_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - instanceIdentifierPathArguments_ = s; - } - return s; - } + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() { + return instanceIdentifierPathArguments_; } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public com.google.protobuf.ByteString - getInstanceIdentifierPathArgumentsBytes() { - java.lang.Object ref = instanceIdentifierPathArguments_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - instanceIdentifierPathArguments_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() { + return instanceIdentifierPathArguments_; } // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; @@ -5355,7 +5643,7 @@ public final class ShardTransactionMessages { } private void initFields() { - instanceIdentifierPathArguments_ = ""; + instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); } private byte memoizedIsInitialized = -1; @@ -5371,6 +5659,10 @@ public final class ShardTransactionMessages { memoizedIsInitialized = 0; return false; } + if (!getInstanceIdentifierPathArguments().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } if (!getNormalizedNode().isInitialized()) { memoizedIsInitialized = 0; return false; @@ -5383,7 +5675,7 @@ public final class ShardTransactionMessages { throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getInstanceIdentifierPathArgumentsBytes()); + output.writeMessage(1, instanceIdentifierPathArguments_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeMessage(2, normalizedNode_); @@ -5399,7 +5691,7 @@ public final class ShardTransactionMessages { size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getInstanceIdentifierPathArgumentsBytes()); + .computeMessageSize(1, instanceIdentifierPathArguments_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream @@ -5513,6 +5805,7 @@ public final class ShardTransactionMessages { } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getInstanceIdentifierPathArgumentsFieldBuilder(); getNormalizedNodeFieldBuilder(); } } @@ -5522,7 +5815,11 @@ public final class ShardTransactionMessages { public Builder clear() { super.clear(); - instanceIdentifierPathArguments_ = ""; + if (instanceIdentifierPathArgumentsBuilder_ == null) { + instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + } else { + instanceIdentifierPathArgumentsBuilder_.clear(); + } bitField0_ = (bitField0_ & ~0x00000001); if (normalizedNodeBuilder_ == null) { normalizedNode_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.getDefaultInstance(); @@ -5561,7 +5858,11 @@ public final class ShardTransactionMessages { if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } - result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_; + if (instanceIdentifierPathArgumentsBuilder_ == null) { + result.instanceIdentifierPathArguments_ = instanceIdentifierPathArguments_; + } else { + result.instanceIdentifierPathArguments_ = instanceIdentifierPathArgumentsBuilder_.build(); + } if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } @@ -5587,9 +5888,7 @@ public final class ShardTransactionMessages { public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData other) { if (other == org.opendaylight.controller.protobuff.messages.transaction.ShardTransactionMessages.MergeData.getDefaultInstance()) return this; if (other.hasInstanceIdentifierPathArguments()) { - bitField0_ |= 0x00000001; - instanceIdentifierPathArguments_ = other.instanceIdentifierPathArguments_; - onChanged(); + mergeInstanceIdentifierPathArguments(other.getInstanceIdentifierPathArguments()); } if (other.hasNormalizedNode()) { mergeNormalizedNode(other.getNormalizedNode()); @@ -5607,6 +5906,10 @@ public final class ShardTransactionMessages { return false; } + if (!getInstanceIdentifierPathArguments().isInitialized()) { + + return false; + } if (!getNormalizedNode().isInitialized()) { return false; @@ -5633,78 +5936,121 @@ public final class ShardTransactionMessages { } private int bitField0_; - // required string instanceIdentifierPathArguments = 1; - private java.lang.Object instanceIdentifierPathArguments_ = ""; + // required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierPathArgumentsBuilder_; /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ public boolean hasInstanceIdentifierPathArguments() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public java.lang.String getInstanceIdentifierPathArguments() { - java.lang.Object ref = instanceIdentifierPathArguments_; - if (!(ref instanceof java.lang.String)) { - java.lang.String s = ((com.google.protobuf.ByteString) ref) - .toStringUtf8(); - instanceIdentifierPathArguments_ = s; - return s; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierPathArguments() { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + return instanceIdentifierPathArguments_; } else { - return (java.lang.String) ref; + return instanceIdentifierPathArgumentsBuilder_.getMessage(); } } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public com.google.protobuf.ByteString - getInstanceIdentifierPathArgumentsBytes() { - java.lang.Object ref = instanceIdentifierPathArguments_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - instanceIdentifierPathArguments_ = b; - return b; + public Builder setInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + instanceIdentifierPathArguments_ = value; + onChanged(); } else { - return (com.google.protobuf.ByteString) ref; + instanceIdentifierPathArgumentsBuilder_.setMessage(value); } + bitField0_ |= 0x00000001; + return this; } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ public Builder setInstanceIdentifierPathArguments( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - instanceIdentifierPathArguments_ = value; - onChanged(); + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + instanceIdentifierPathArguments_ = builderForValue.build(); + onChanged(); + } else { + instanceIdentifierPathArgumentsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; + */ + public Builder mergeInstanceIdentifierPathArguments(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + instanceIdentifierPathArguments_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) { + instanceIdentifierPathArguments_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierPathArguments_).mergeFrom(value).buildPartial(); + } else { + instanceIdentifierPathArguments_ = value; + } + onChanged(); + } else { + instanceIdentifierPathArgumentsBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; return this; } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ public Builder clearInstanceIdentifierPathArguments() { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + instanceIdentifierPathArguments_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance(); + onChanged(); + } else { + instanceIdentifierPathArgumentsBuilder_.clear(); + } bitField0_ = (bitField0_ & ~0x00000001); - instanceIdentifierPathArguments_ = getDefaultInstance().getInstanceIdentifierPathArguments(); - onChanged(); return this; } /** - * required string instanceIdentifierPathArguments = 1; + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; */ - public Builder setInstanceIdentifierPathArgumentsBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - instanceIdentifierPathArguments_ = value; + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierPathArgumentsBuilder() { + bitField0_ |= 0x00000001; onChanged(); - return this; + return getInstanceIdentifierPathArgumentsFieldBuilder().getBuilder(); + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierPathArgumentsOrBuilder() { + if (instanceIdentifierPathArgumentsBuilder_ != null) { + return instanceIdentifierPathArgumentsBuilder_.getMessageOrBuilder(); + } else { + return instanceIdentifierPathArguments_; + } + } + /** + * required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1; + */ + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> + getInstanceIdentifierPathArgumentsFieldBuilder() { + if (instanceIdentifierPathArgumentsBuilder_ == null) { + instanceIdentifierPathArgumentsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>( + instanceIdentifierPathArguments_, + getParentForChildren(), + isClean()); + instanceIdentifierPathArguments_ = null; + } + return instanceIdentifierPathArgumentsBuilder_; } // required .org.opendaylight.controller.mdsal.Node normalizedNode = 2; @@ -6225,26 +6571,32 @@ public final class ShardTransactionMessages { java.lang.String[] descriptorData = { "\n\026ShardTransaction.proto\022!org.opendaylig" + "ht.controller.mdsal\032\014Common.proto\"\022\n\020Clo" + - "seTransaction\"\027\n\025CloseTransactionReply\"\023" + - "\n\021CreateTransaction\"M\n\026CreateTransaction" + - "Reply\022\034\n\024transactionActorPath\030\001 \002(\t\022\025\n\rt" + - "ransactionId\030\002 \002(\t\"\022\n\020ReadyTransaction\"*" + - "\n\025ReadyTransactionReply\022\021\n\tactorPath\030\001 \002" + - "(\t\"5\n\nDeleteData\022\'\n\037instanceIdentifierPa" + - "thArguments\030\001 \002(\t\"\021\n\017DeleteDataReply\"3\n\010" + - "ReadData\022\'\n\037instanceIdentifierPathArgume", - "nts\030\001 \002(\t\"P\n\rReadDataReply\022?\n\016normalized" + - "Node\030\001 \001(\0132\'.org.opendaylight.controller" + - ".mdsal.Node\"u\n\tWriteData\022\'\n\037instanceIden" + - "tifierPathArguments\030\001 \002(\t\022?\n\016normalizedN" + - "ode\030\002 \002(\0132\'.org.opendaylight.controller." + - "mdsal.Node\"\020\n\016WriteDataReply\"u\n\tMergeDat" + - "a\022\'\n\037instanceIdentifierPathArguments\030\001 \002" + - "(\t\022?\n\016normalizedNode\030\002 \002(\0132\'.org.openday" + - "light.controller.mdsal.Node\"\020\n\016MergeData" + - "ReplyBV\n:org.opendaylight.controller.pro", - "tobuff.messages.transactionB\030ShardTransa" + - "ctionMessages" + "seTransaction\"\027\n\025CloseTransactionReply\"*" + + "\n\021CreateTransaction\022\025\n\rtransactionId\030\001 \002" + + "(\t\"M\n\026CreateTransactionReply\022\034\n\024transact" + + "ionActorPath\030\001 \002(\t\022\025\n\rtransactionId\030\002 \002(" + + "\t\"\022\n\020ReadyTransaction\"*\n\025ReadyTransactio" + + "nReply\022\021\n\tactorPath\030\001 \002(\t\"l\n\nDeleteData\022" + + "^\n\037instanceIdentifierPathArguments\030\001 \002(\013" + + "25.org.opendaylight.controller.mdsal.Ins", + "tanceIdentifier\"\021\n\017DeleteDataReply\"j\n\010Re" + + "adData\022^\n\037instanceIdentifierPathArgument" + + "s\030\001 \002(\01325.org.opendaylight.controller.md" + + "sal.InstanceIdentifier\"P\n\rReadDataReply\022" + + "?\n\016normalizedNode\030\001 \001(\0132\'.org.opendaylig" + + "ht.controller.mdsal.Node\"\254\001\n\tWriteData\022^" + + "\n\037instanceIdentifierPathArguments\030\001 \002(\0132" + + "5.org.opendaylight.controller.mdsal.Inst" + + "anceIdentifier\022?\n\016normalizedNode\030\002 \002(\0132\'" + + ".org.opendaylight.controller.mdsal.Node\"", + "\020\n\016WriteDataReply\"\254\001\n\tMergeData\022^\n\037insta" + + "nceIdentifierPathArguments\030\001 \002(\01325.org.o" + + "pendaylight.controller.mdsal.InstanceIde" + + "ntifier\022?\n\016normalizedNode\030\002 \002(\0132\'.org.op" + + "endaylight.controller.mdsal.Node\"\020\n\016Merg" + + "eDataReplyBV\n:org.opendaylight.controlle" + + "r.protobuff.messages.transactionB\030ShardT" + + "ransactionMessages" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -6268,7 +6620,7 @@ public final class ShardTransactionMessages { internal_static_org_opendaylight_controller_mdsal_CreateTransaction_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_org_opendaylight_controller_mdsal_CreateTransaction_descriptor, - new java.lang.String[] { }); + new java.lang.String[] { "TransactionId", }); internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor = getDescriptor().getMessageTypes().get(3); internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_fieldAccessorTable = new diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Common.proto b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Common.proto index 44d9468391..59d78dd04d 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Common.proto +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Common.proto @@ -7,17 +7,46 @@ option java_outer_classname = "NormalizedNodeMessages"; message Attribute{ required string name =1; optional string value=2; + optional string type=3; +} + +message QName { + required string value=1; +} + +message PathArgument { + required string value=1; + optional string type=2; //NodeIdentifier, NodeWithValue, NodeIdentifierWithPredicates + optional QName nodeType=3; + repeated Attribute attributes=4; + +} + +message InstanceIdentifier { + repeated PathArgument arguments=1; } message Node{ - required string path = 1; + optional string path = 1; optional string type = 2; repeated Attribute attributes = 3; repeated Node child=4; optional string value = 5; + optional string valueType = 6; + repeated string bitsValue = 7; + optional InstanceIdentifier instanceIdentifierValue = 8; } message Container{ required string parentPath =1 ; optional Node normalizedNode=2; -} \ No newline at end of file +} + +message NodeMapEntry{ + required InstanceIdentifier instanceIdentifierPath =1; + optional Node normalizedNode=2; +} + +message NodeMap{ +repeated NodeMapEntry mapEntries=1; +} diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/DataChangeListener.proto b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/DataChangeListener.proto index 3c1c881796..e4ba800730 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/DataChangeListener.proto +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/DataChangeListener.proto @@ -5,10 +5,15 @@ import "Common.proto"; option java_package = "org.opendaylight.controller.protobuff.messages.datachange.notification"; option java_outer_classname = "DataChangeListenerMessages"; -message DataChanged{ - repeated string instanceIdentifierPathArguments =1 ; - required Node normalizedNode = 2; +message DataChanged { + optional Node originalSubTree = 1; + optional Node updatedSubTree = 2; + optional NodeMap originalData =3; + optional NodeMap updatedData =4; + optional NodeMap createdData =5; + repeated InstanceIdentifier removedPaths =6; } + message DataChangedReply{ -} \ No newline at end of file +} diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ListenerRegistration.proto b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ListenerRegistration.proto index b3eb2ed4bd..3342a1364a 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ListenerRegistration.proto +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ListenerRegistration.proto @@ -1,5 +1,7 @@ package org.opendaylight.controller.mdsal; +import "Common.proto"; + option java_package = "org.opendaylight.controller.protobuff.messages.registration"; option java_outer_classname = "ListenerRegistrationMessages"; @@ -22,7 +24,7 @@ message CloseDataChangeListenerRegistrationReply{ */ message RegisterChangeListener{ -required string instanceIdentifierPath=1; +required InstanceIdentifier instanceIdentifierPath=1; required string dataChangeListenerActorPath=2; required int32 dataChangeScope=3; } diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Persistent.proto b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Persistent.proto index 5b49503d42..b3f28197ed 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Persistent.proto +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Persistent.proto @@ -8,7 +8,7 @@ option java_outer_classname = "PersistentMessages"; message Modification { required string type=1; - required string path=2; + required InstanceIdentifier path=2; optional Node data=3; } diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardManager.proto b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardManager.proto index c86fde0c72..abd6fcc109 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardManager.proto +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardManager.proto @@ -8,7 +8,9 @@ message FindPrimary { } message PrimaryFound { + required string primaryPath =1; } message PrimaryNotFound { + required string shardName =1; } diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardTransaction.proto b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardTransaction.proto index a2a2cac29d..9684b7d72f 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardTransaction.proto +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardTransaction.proto @@ -13,7 +13,7 @@ message CloseTransactionReply{ } message CreateTransaction{ - + required string transactionId = 1; } message CreateTransactionReply{ @@ -31,14 +31,14 @@ required string actorPath = 1; } message DeleteData { -required string instanceIdentifierPathArguments = 1; +required InstanceIdentifier instanceIdentifierPathArguments = 1; } message DeleteDataReply{ } message ReadData { -required string instanceIdentifierPathArguments=1; +required InstanceIdentifier instanceIdentifierPathArguments=1; } message ReadDataReply{ @@ -46,7 +46,7 @@ message ReadDataReply{ } message WriteData { - required string instanceIdentifierPathArguments = 1; + required InstanceIdentifier instanceIdentifierPathArguments = 1; required Node normalizedNode =2; } @@ -56,11 +56,11 @@ message WriteDataReply{ } message MergeData { - required string instanceIdentifierPathArguments = 1; + required InstanceIdentifier instanceIdentifierPathArguments = 1; required Node normalizedNode =2; } message MergeDataReply{ -} \ No newline at end of file +} diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java index 0c532304ed..4ccbc97f35 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java @@ -11,13 +11,14 @@ package org.opendaylight.controller.cluster.datastore.node; import junit.framework.Assert; import org.junit.Before; import org.junit.Test; -import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container; -import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node; import org.opendaylight.controller.cluster.datastore.node.utils.NodeIdentifierFactory; import org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeGetter; import org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeNavigator; import org.opendaylight.controller.cluster.datastore.util.TestModel; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container; +import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node; +import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; @@ -57,7 +58,10 @@ public class NormalizedNodeToNodeCodecTest { @Test public void testNormalizeNodeAttributesToProtoBuffNode(){ final NormalizedNode documentOne = TestModel.createTestContainer(); - String id = "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)outer-list/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)outer-list[{(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id=2}]/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id"; + String id = "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test" + + "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)outer-list" + + "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)outer-list[{(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id=2}]" + + "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id"; NormalizedNodeGetter normalizedNodeGetter = new NormalizedNodeGetter(id); new NormalizedNodeNavigator(normalizedNodeGetter).navigate( @@ -87,7 +91,6 @@ public class NormalizedNodeToNodeCodecTest { public void testThatANormalizedNodeToProtoBuffNodeEncodeDecode() throws Exception { final NormalizedNode documentOne = TestModel.createTestContainer(); - final NormalizedNodeToNodeCodec normalizedNodeToNodeCodec = new NormalizedNodeToNodeCodec(schemaContext); Container container = normalizedNodeToNodeCodec.encode(YangInstanceIdentifier.builder().build(), documentOne); @@ -107,6 +110,15 @@ public class NormalizedNodeToNodeCodecTest { //check first level children are proper ListchildrenResult = containerResult.getNormalizedNode().getChildList(); ListchildrenOriginal = container.getNormalizedNode().getChildList(); + + System.out.println("-------------------------------------------------"); + + System.out.println(childrenOriginal.toString()); + + System.out.println("-------------------------------------------------"); + + System.out.println(childrenResult.toString()); + boolean bFound; for(Node resultChild: childrenResult){ bFound = false; @@ -120,7 +132,27 @@ public class NormalizedNodeToNodeCodecTest { Assert.assertTrue(bFound); } + } + + @Test + public void addAugmentations(){ + String stringId = "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test" + + "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)augmented-list" + + "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)augmented-list[{(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id=1}]"; + + YangInstanceIdentifier identifier = instanceIdentifierFromString(stringId); + + MapEntryNode uno = TestModel.createAugmentedListEntry(1, "Uno"); + + NormalizedNodeToNodeCodec codec = + new NormalizedNodeToNodeCodec(schemaContext); + + Container encode = codec + .encode(identifier, uno); + + System.out.println(encode.getNormalizedNode()); + codec.decode(identifier, encode.getNormalizedNode()); } } diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToProtocolBufferNodeTest.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToProtocolBufferNodeTest.java deleted file mode 100644 index df3e55f356..0000000000 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToProtocolBufferNodeTest.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.opendaylight.controller.cluster.datastore.node; - - -import com.google.common.collect.Lists; -import org.junit.Assert; -import org.junit.Test; -import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; -import org.opendaylight.controller.cluster.datastore.util.NormalizedNodeXmlConverterTest; -import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; -import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; - -import java.util.Iterator; - -/** - * @author: syedbahm - * Date: 7/2/14 - */ -public class NormalizedNodeToProtocolBufferNodeTest { - - private String instanceIdentifierToString(YangInstanceIdentifier id){ - Iterable iterable = id.getPathArguments(); - Iterator iterator = iterable.iterator(); - String path=""; - while (iterator.hasNext()) { - path += "/"+iterator.next().toString(); - - } - return path; - } - @Test - public void testNormalizedNodeToNodeSerialization (){ - NormalizedNode nn = NormalizedNodeXmlConverterTest.augmentChoiceExpectedNode(); - YangInstanceIdentifier id = YangInstanceIdentifier.create( - Lists.newArrayList(NormalizedNodeXmlConverterTest.getNodeIdentifier("container"))); - - NormalizedNodeToProtocolBufferNode nnn = new NormalizedNodeToProtocolBufferNode(); - nnn.encode(instanceIdentifierToString(id), nn); - NormalizedNodeMessages.Node node = nnn.getContainer().getNormalizedNode(); - Assert.assertTrue(node.getChildCount()>0); - } - - @Test - public void testNormalizedNodeToNodeSerializationChoiceNode() { - QName CH2_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:controller:test", "2014-03-13", "ch2"); - NormalizedNode - choice = NormalizedNodeXmlConverterTest.augmentChoiceExpectedNode() - .getChild(new YangInstanceIdentifier.NodeIdentifier(CH2_QNAME)) - .get(); - - YangInstanceIdentifier id = YangInstanceIdentifier.create( - Lists.newArrayList(NormalizedNodeXmlConverterTest.getNodeIdentifier("ch2"))); - - NormalizedNodeToProtocolBufferNode nnn = new NormalizedNodeToProtocolBufferNode(); - nnn.encode(instanceIdentifierToString(id), choice); - - NormalizedNodeMessages.Node node = nnn.getContainer().getNormalizedNode(); - - Assert.assertTrue(node.getChildCount()==2); - - - - } - -} diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactoryTest.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactoryTest.java new file mode 100644 index 0000000000..4b0bde83e0 --- /dev/null +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/node/utils/NodeIdentifierFactoryTest.java @@ -0,0 +1,20 @@ +package org.opendaylight.controller.cluster.datastore.node.utils; + +import junit.framework.Assert; +import org.junit.Test; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; + +public class NodeIdentifierFactoryTest { + + @Test + public void validateAugmentationIdentifier(){ + YangInstanceIdentifier.PathArgument argument = NodeIdentifierFactory + .getArgument( + "AugmentationIdentifier{childNames=[(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics]}"); + + Assert.assertTrue(argument instanceof YangInstanceIdentifier.AugmentationIdentifier); + + + } + +} diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java new file mode 100644 index 0000000000..bb246fb1e4 --- /dev/null +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/InstanceIdentifierUtilsTest.java @@ -0,0 +1,141 @@ +package org.opendaylight.controller.cluster.datastore.util; + +import org.junit.Assert; +import org.junit.Test; +import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; + +public class InstanceIdentifierUtilsTest { + + private static QName TEST_QNAME = QName.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test"); + private static QName NODE_WITH_VALUE_QNAME = QName.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)value"); + private static QName NODE_WITH_PREDICATES_QNAME = QName.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)pred"); + private static QName NAME_QNAME = QName.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)name"); + + @Test + public void testSerializationOfNodeIdentifier(){ + YangInstanceIdentifier.PathArgument p1 = + new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME); + + List arguments = new ArrayList<>(); + + arguments.add(p1); + + YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments); + + NormalizedNodeMessages.InstanceIdentifier instanceIdentifier = + InstanceIdentifierUtils.toSerializable(expected); + + YangInstanceIdentifier actual = + InstanceIdentifierUtils.fromSerializable(instanceIdentifier); + + + Assert.assertEquals(expected.getLastPathArgument(), + actual.getLastPathArgument()); + + + } + + @Test + public void testSerializationOfNodeWithValue(){ + + withValue((short) 1); + withValue((long) 2); + withValue(3); + withValue(true); + + } + + private void withValue(Object value){ + YangInstanceIdentifier.PathArgument p1 = + new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME); + + YangInstanceIdentifier.PathArgument p2 = + new YangInstanceIdentifier.NodeWithValue(NODE_WITH_VALUE_QNAME, value); + + + List arguments = new ArrayList<>(); + + arguments.add(p1); + arguments.add(p2); + + YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments); + + NormalizedNodeMessages.InstanceIdentifier instanceIdentifier = + InstanceIdentifierUtils.toSerializable(expected); + + YangInstanceIdentifier actual = + InstanceIdentifierUtils.fromSerializable(instanceIdentifier); + + + Assert.assertEquals(expected.getLastPathArgument(), + actual.getLastPathArgument()); + } + + + @Test + public void testSerializationOfNodeIdentifierWithPredicates(){ + + withPredicates((short) 1); + withPredicates((long) 2); + withPredicates(3); + withPredicates(true); + + } + + private void withPredicates(Object value){ + YangInstanceIdentifier.PathArgument p1 = + new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME); + + YangInstanceIdentifier.PathArgument p2 = + new YangInstanceIdentifier.NodeIdentifierWithPredicates(NODE_WITH_PREDICATES_QNAME, NAME_QNAME, value); + + + List arguments = new ArrayList<>(); + + arguments.add(p1); + arguments.add(p2); + + YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments); + + NormalizedNodeMessages.InstanceIdentifier instanceIdentifier = + InstanceIdentifierUtils.toSerializable(expected); + + YangInstanceIdentifier actual = + InstanceIdentifierUtils.fromSerializable(instanceIdentifier); + + + Assert.assertEquals(expected.getLastPathArgument(), + actual.getLastPathArgument()); + } + + @Test + public void testAugmentationIdentifier(){ + YangInstanceIdentifier.PathArgument p1 = + new YangInstanceIdentifier.AugmentationIdentifier(new HashSet(Arrays.asList(TEST_QNAME))); + + List arguments = new ArrayList<>(); + + arguments.add(p1); + + YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments); + + NormalizedNodeMessages.InstanceIdentifier instanceIdentifier = + InstanceIdentifierUtils.toSerializable(expected); + + YangInstanceIdentifier actual = + InstanceIdentifierUtils.fromSerializable(instanceIdentifier); + + + Assert.assertEquals(expected.getLastPathArgument(), + actual.getLastPathArgument()); + + } + +} diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/TestModel.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/TestModel.java index 9f6e2d1f45..bef4057aa2 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/TestModel.java +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/util/TestModel.java @@ -17,6 +17,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContaine import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder; import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetEntryNodeBuilder; import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetNodeBuilder; +import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapEntryNodeBuilder; import org.opendaylight.yangtools.yang.model.api.Module; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl; @@ -33,340 +34,453 @@ import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.ma public class TestModel { - public static final QName TEST_QNAME = QName.create( - "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test", - "2014-03-13", "test"); - - public static final QName AUG_QNAME = QName.create( - "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug", - "2014-03-13", "name"); - - public static final QName DESC_QNAME = QName.create(TEST_QNAME, "desc"); - public static final QName OUTER_LIST_QNAME = QName.create(TEST_QNAME, - "outer-list"); - public static final QName INNER_LIST_QNAME = QName.create(TEST_QNAME, - "inner-list"); - public static final QName OUTER_CHOICE_QNAME = QName.create(TEST_QNAME, - "outer-choice"); - public static final QName ID_QNAME = QName.create(TEST_QNAME, "id"); - public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name"); - public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value"); - private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang"; - private static final String DATASTORE_AUG_YANG = - "/odl-datastore-augmentation.yang"; - private static final String DATASTORE_TEST_NOTIFICATION_YANG = - "/odl-datastore-test-notification.yang"; - - - public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier - .of(TEST_QNAME); - public static final YangInstanceIdentifier DESC_PATH = YangInstanceIdentifier - .builder(TEST_PATH).node(DESC_QNAME).build(); - public static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier - .builder(TEST_PATH).node(OUTER_LIST_QNAME).build(); - public static final QName TWO_QNAME = QName.create(TEST_QNAME, "two"); - public static final QName THREE_QNAME = QName.create(TEST_QNAME, "three"); - - private static final Integer ONE_ID = 1; - private static final Integer TWO_ID = 2; - private static final String TWO_ONE_NAME = "one"; - private static final String TWO_TWO_NAME = "two"; - private static final String DESC = "Hello there"; - - // Family specific constants - public static final QName FAMILY_QNAME = - QName - .create( - "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test", - "2014-04-17", "family"); - public static final QName CHILDREN_QNAME = QName.create(FAMILY_QNAME, - "children"); - public static final QName GRAND_CHILDREN_QNAME = QName.create(FAMILY_QNAME, - "grand-children"); - public static final QName CHILD_NUMBER_QNAME = QName.create(FAMILY_QNAME, - "child-number"); - public static final QName CHILD_NAME_QNAME = QName.create(FAMILY_QNAME, - "child-name"); - public static final QName GRAND_CHILD_NUMBER_QNAME = QName.create( - FAMILY_QNAME, "grand-child-number"); - public static final QName GRAND_CHILD_NAME_QNAME = QName.create(FAMILY_QNAME, - "grand-child-name"); - - public static final YangInstanceIdentifier FAMILY_PATH = YangInstanceIdentifier - .of(FAMILY_QNAME); - public static final YangInstanceIdentifier FAMILY_DESC_PATH = YangInstanceIdentifier - .builder(FAMILY_PATH).node(DESC_QNAME).build(); - public static final YangInstanceIdentifier CHILDREN_PATH = YangInstanceIdentifier - .builder(FAMILY_PATH).node(CHILDREN_QNAME).build(); - - private static final Integer FIRST_CHILD_ID = 1; - private static final Integer SECOND_CHILD_ID = 2; - - private static final String FIRST_CHILD_NAME = "first child"; - private static final String SECOND_CHILD_NAME = "second child"; - - private static final Integer FIRST_GRAND_CHILD_ID = 1; - private static final Integer SECOND_GRAND_CHILD_ID = 2; - - private static final String FIRST_GRAND_CHILD_NAME = "first grand child"; - private static final String SECOND_GRAND_CHILD_NAME = "second grand child"; - - // first child - private static final YangInstanceIdentifier CHILDREN_1_PATH = YangInstanceIdentifier - .builder(CHILDREN_PATH) - .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID) // - .build(); - private static final YangInstanceIdentifier CHILDREN_1_NAME_PATH = - YangInstanceIdentifier.builder(CHILDREN_PATH) - .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, FIRST_CHILD_NAME) // - .build(); - - private static final YangInstanceIdentifier CHILDREN_2_PATH = YangInstanceIdentifier - .builder(CHILDREN_PATH) - .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID) // - .build(); - private static final YangInstanceIdentifier CHILDREN_2_NAME_PATH = - YangInstanceIdentifier.builder(CHILDREN_PATH) - .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, SECOND_CHILD_NAME) // - .build(); - - - private static final YangInstanceIdentifier GRAND_CHILD_1_PATH = - YangInstanceIdentifier.builder(CHILDREN_1_PATH) - .node(GRAND_CHILDREN_QNAME) - // - .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME, - FIRST_GRAND_CHILD_ID) // - .build(); - - private static final YangInstanceIdentifier GRAND_CHILD_1_NAME_PATH = - YangInstanceIdentifier.builder(CHILDREN_1_PATH) - .node(GRAND_CHILDREN_QNAME) - // - .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME, - FIRST_GRAND_CHILD_NAME) // - .build(); - - private static final YangInstanceIdentifier GRAND_CHILD_2_PATH = - YangInstanceIdentifier.builder(CHILDREN_2_PATH) - .node(GRAND_CHILDREN_QNAME) - // - .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME, - SECOND_GRAND_CHILD_ID) // - .build(); - - private static final YangInstanceIdentifier GRAND_CHILD_2_NAME_PATH = - YangInstanceIdentifier.builder(CHILDREN_2_PATH) - .node(GRAND_CHILDREN_QNAME) - // - .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME, - SECOND_GRAND_CHILD_NAME) // - .build(); - - private static final YangInstanceIdentifier DESC_PATH_ID = YangInstanceIdentifier - .builder(DESC_PATH).build(); - private static final YangInstanceIdentifier OUTER_LIST_1_PATH = - YangInstanceIdentifier.builder(OUTER_LIST_PATH) - .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, ONE_ID) // - .build(); - - private static final YangInstanceIdentifier OUTER_LIST_2_PATH = - YangInstanceIdentifier.builder(OUTER_LIST_PATH) - .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, TWO_ID) // - .build(); - - private static final YangInstanceIdentifier TWO_TWO_PATH = YangInstanceIdentifier - .builder(OUTER_LIST_2_PATH).node(INNER_LIST_QNAME) // - .nodeWithKey(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME) // - .build(); - - private static final YangInstanceIdentifier TWO_TWO_VALUE_PATH = - YangInstanceIdentifier.builder(TWO_TWO_PATH).node(VALUE_QNAME) // - .build(); - - private static final MapEntryNode BAR_NODE = mapEntryBuilder( - OUTER_LIST_QNAME, ID_QNAME, TWO_ID) // - .withChild(mapNodeBuilder(INNER_LIST_QNAME) // - .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_ONE_NAME)) // - .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME)) // - .build()) // - .build(); - - public static final InputStream getDatastoreTestInputStream() { - return getInputStream(DATASTORE_TEST_YANG); - } - - public static final InputStream getDatastoreAugInputStream() { - return getInputStream(DATASTORE_AUG_YANG); - } - - public static final InputStream getDatastoreTestNotificationInputStream() { - return getInputStream(DATASTORE_TEST_NOTIFICATION_YANG); - } - - private static InputStream getInputStream(final String resourceName) { - return TestModel.class.getResourceAsStream(resourceName); - } - - public static SchemaContext createTestContext() { - List inputStreams = new ArrayList<>(); - inputStreams.add(getDatastoreTestInputStream()); - inputStreams.add(getDatastoreAugInputStream()); - inputStreams.add(getDatastoreTestNotificationInputStream()); - - YangParserImpl parser = new YangParserImpl(); - Set modules = parser.parseYangModelsFromStreams(inputStreams); - return parser.resolveSchemaContext(modules); - } - - /** - * Returns a test document - * - *
-   * test
-   *     outer-list
-   *          id 1
-   *     outer-list
-   *          id 2
-   *          inner-list
-   *                  name "one"
-   *          inner-list
-   *                  name "two"
-   *
-   * 
- * - * @return - */ - public static NormalizedNode createDocumentOne( - SchemaContext schemaContext) { - return ImmutableContainerNodeBuilder - .create() - .withNodeIdentifier( - new YangInstanceIdentifier.NodeIdentifier(schemaContext.getQName())) - .withChild(createTestContainer()).build(); - - } - - public static ContainerNode createTestContainer() { - - - final LeafSetEntryNode nike = - ImmutableLeafSetEntryNodeBuilder - .create() - .withNodeIdentifier( - new YangInstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME, - "shoe"), "nike")).withValue("nike").build(); - final LeafSetEntryNode puma = - ImmutableLeafSetEntryNodeBuilder - .create() - .withNodeIdentifier( - new YangInstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME, - "shoe"), "puma")).withValue("puma").build(); - final LeafSetNode shoes = - ImmutableLeafSetNodeBuilder - .create() - .withNodeIdentifier( - new YangInstanceIdentifier.NodeIdentifier(QName.create(TEST_QNAME, - "shoe"))).withChild(nike).withChild(puma).build(); + public static final QName TEST_QNAME = QName.create( + "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test", + "2014-03-13", "test"); + + public static final QName AUG_NAME_QNAME = QName.create( + "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug", + "2014-03-13", "name"); + + public static final QName AUG_CONT_QNAME = QName.create( + "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug", + "2014-03-13", "cont"); + + + public static final QName DESC_QNAME = QName.create(TEST_QNAME, "desc"); + public static final QName POINTER_QNAME = + QName.create(TEST_QNAME, "pointer"); + public static final QName SOME_REF_QNAME = + QName.create(TEST_QNAME, "some-ref"); + public static final QName MYIDENTITY_QNAME = + QName.create(TEST_QNAME, "myidentity"); + public static final QName SWITCH_FEATURES_QNAME = + QName.create(TEST_QNAME, "switch-features"); + + public static final QName AUGMENTED_LIST_QNAME = + QName.create(TEST_QNAME, "augmented-list"); + + public static final QName OUTER_LIST_QNAME = QName.create(TEST_QNAME, + "outer-list"); + public static final QName INNER_LIST_QNAME = QName.create(TEST_QNAME, + "inner-list"); + public static final QName OUTER_CHOICE_QNAME = QName.create(TEST_QNAME, + "outer-choice"); + public static final QName ID_QNAME = QName.create(TEST_QNAME, "id"); + public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name"); + public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value"); + private static final String DATASTORE_TEST_YANG = + "/odl-datastore-test.yang"; + private static final String DATASTORE_AUG_YANG = + "/odl-datastore-augmentation.yang"; + private static final String DATASTORE_TEST_NOTIFICATION_YANG = + "/odl-datastore-test-notification.yang"; + + + public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier + .of(TEST_QNAME); + public static final YangInstanceIdentifier DESC_PATH = YangInstanceIdentifier + .builder(TEST_PATH).node(DESC_QNAME).build(); + public static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier + .builder(TEST_PATH).node(OUTER_LIST_QNAME).build(); + public static final QName TWO_QNAME = QName.create(TEST_QNAME, "two"); + public static final QName THREE_QNAME = QName.create(TEST_QNAME, "three"); + + private static final Integer ONE_ID = 1; + private static final Integer TWO_ID = 2; + private static final String TWO_ONE_NAME = "one"; + private static final String TWO_TWO_NAME = "two"; + private static final String DESC = "Hello there"; + + // Family specific constants + public static final QName FAMILY_QNAME = + QName + .create( + "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test", + "2014-04-17", "family"); + public static final QName CHILDREN_QNAME = QName.create(FAMILY_QNAME, + "children"); + public static final QName GRAND_CHILDREN_QNAME = QName.create(FAMILY_QNAME, + "grand-children"); + public static final QName CHILD_NUMBER_QNAME = QName.create(FAMILY_QNAME, + "child-number"); + public static final QName CHILD_NAME_QNAME = QName.create(FAMILY_QNAME, + "child-name"); + public static final QName GRAND_CHILD_NUMBER_QNAME = QName.create( + FAMILY_QNAME, "grand-child-number"); + public static final QName GRAND_CHILD_NAME_QNAME = + QName.create(FAMILY_QNAME, + "grand-child-name"); + + public static final YangInstanceIdentifier FAMILY_PATH = YangInstanceIdentifier + .of(FAMILY_QNAME); + public static final YangInstanceIdentifier FAMILY_DESC_PATH = YangInstanceIdentifier + .builder(FAMILY_PATH).node(DESC_QNAME).build(); + public static final YangInstanceIdentifier CHILDREN_PATH = YangInstanceIdentifier + .builder(FAMILY_PATH).node(CHILDREN_QNAME).build(); + + private static final Integer FIRST_CHILD_ID = 1; + private static final Integer SECOND_CHILD_ID = 2; + + private static final String FIRST_CHILD_NAME = "first child"; + private static final String SECOND_CHILD_NAME = "second child"; + + private static final Integer FIRST_GRAND_CHILD_ID = 1; + private static final Integer SECOND_GRAND_CHILD_ID = 2; + + private static final String FIRST_GRAND_CHILD_NAME = "first grand child"; + private static final String SECOND_GRAND_CHILD_NAME = "second grand child"; + + // first child + private static final YangInstanceIdentifier CHILDREN_1_PATH = YangInstanceIdentifier + .builder(CHILDREN_PATH) + .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID) // + .build(); + private static final YangInstanceIdentifier CHILDREN_1_NAME_PATH = + YangInstanceIdentifier.builder(CHILDREN_PATH) + .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, FIRST_CHILD_NAME) // + .build(); + + private static final YangInstanceIdentifier CHILDREN_2_PATH = YangInstanceIdentifier + .builder(CHILDREN_PATH) + .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID) // + .build(); + private static final YangInstanceIdentifier CHILDREN_2_NAME_PATH = + YangInstanceIdentifier.builder(CHILDREN_PATH) + .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, SECOND_CHILD_NAME) // + .build(); - final LeafSetEntryNode five = - ImmutableLeafSetEntryNodeBuilder + private static final YangInstanceIdentifier GRAND_CHILD_1_PATH = + YangInstanceIdentifier.builder(CHILDREN_1_PATH) + .node(GRAND_CHILDREN_QNAME) + // + .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME, + FIRST_GRAND_CHILD_ID) // + .build(); + + private static final YangInstanceIdentifier GRAND_CHILD_1_NAME_PATH = + YangInstanceIdentifier.builder(CHILDREN_1_PATH) + .node(GRAND_CHILDREN_QNAME) + // + .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME, + FIRST_GRAND_CHILD_NAME) // + .build(); + + private static final YangInstanceIdentifier GRAND_CHILD_2_PATH = + YangInstanceIdentifier.builder(CHILDREN_2_PATH) + .node(GRAND_CHILDREN_QNAME) + // + .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME, + SECOND_GRAND_CHILD_ID) // + .build(); + + private static final YangInstanceIdentifier GRAND_CHILD_2_NAME_PATH = + YangInstanceIdentifier.builder(CHILDREN_2_PATH) + .node(GRAND_CHILDREN_QNAME) + // + .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME, + SECOND_GRAND_CHILD_NAME) // + .build(); + + private static final YangInstanceIdentifier DESC_PATH_ID = YangInstanceIdentifier + .builder(DESC_PATH).build(); + private static final YangInstanceIdentifier OUTER_LIST_1_PATH = + YangInstanceIdentifier.builder(OUTER_LIST_PATH) + .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, ONE_ID) // + .build(); + + private static final YangInstanceIdentifier OUTER_LIST_2_PATH = + YangInstanceIdentifier.builder(OUTER_LIST_PATH) + .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, TWO_ID) // + .build(); + + private static final YangInstanceIdentifier TWO_TWO_PATH = YangInstanceIdentifier + .builder(OUTER_LIST_2_PATH).node(INNER_LIST_QNAME) // + .nodeWithKey(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME) // + .build(); + + private static final YangInstanceIdentifier TWO_TWO_VALUE_PATH = + YangInstanceIdentifier.builder(TWO_TWO_PATH).node(VALUE_QNAME) // + .build(); + + private static final MapEntryNode BAR_NODE = mapEntryBuilder( + OUTER_LIST_QNAME, ID_QNAME, TWO_ID) // + .withChild(mapNodeBuilder(INNER_LIST_QNAME) // + .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_ONE_NAME)) // + .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME)) // + .build()) // + .build(); + + public static final InputStream getDatastoreTestInputStream() { + return getInputStream(DATASTORE_TEST_YANG); + } + + public static final InputStream getDatastoreAugInputStream() { + return getInputStream(DATASTORE_AUG_YANG); + } + + public static final InputStream getDatastoreTestNotificationInputStream() { + return getInputStream(DATASTORE_TEST_NOTIFICATION_YANG); + } + + private static InputStream getInputStream(final String resourceName) { + return TestModel.class.getResourceAsStream(resourceName); + } + + public static SchemaContext createTestContext() { + List inputStreams = new ArrayList<>(); + inputStreams.add(getDatastoreTestInputStream()); + inputStreams.add(getDatastoreAugInputStream()); + inputStreams.add(getDatastoreTestNotificationInputStream()); + + YangParserImpl parser = new YangParserImpl(); + Set modules = parser.parseYangModelsFromStreams(inputStreams); + return parser.resolveSchemaContext(modules); + } + + /** + * Returns a test document + *

+ *

+     * test
+     *     outer-list
+     *          id 1
+     *     outer-list
+     *          id 2
+     *          inner-list
+     *                  name "one"
+     *          inner-list
+     *                  name "two"
+     *
+     * 
+ * + * @return + */ + public static NormalizedNode createDocumentOne( + SchemaContext schemaContext) { + return ImmutableContainerNodeBuilder .create() .withNodeIdentifier( - (new YangInstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME, - "number"), 5))).withValue(5).build(); - final LeafSetEntryNode fifteen = - ImmutableLeafSetEntryNodeBuilder + new YangInstanceIdentifier.NodeIdentifier(schemaContext.getQName())) + .withChild(createTestContainer()).build(); + + } + + public static ContainerNode createTestContainer() { + + + // Create a list of shoes + // This is to test leaf list entry + final LeafSetEntryNode nike = + ImmutableLeafSetEntryNodeBuilder + .create() + .withNodeIdentifier( + new YangInstanceIdentifier.NodeWithValue( + QName.create(TEST_QNAME, + "shoe"), "nike") + ).withValue("nike").build(); + + final LeafSetEntryNode puma = + ImmutableLeafSetEntryNodeBuilder + .create() + .withNodeIdentifier( + new YangInstanceIdentifier.NodeWithValue( + QName.create(TEST_QNAME, + "shoe"), "puma") + ).withValue("puma").build(); + + final LeafSetNode shoes = + ImmutableLeafSetNodeBuilder + .create() + .withNodeIdentifier( + new YangInstanceIdentifier.NodeIdentifier( + QName.create(TEST_QNAME, + "shoe")) + ).withChild(nike).withChild(puma).build(); + + + // Test a leaf-list where each entry contains an identity + final LeafSetEntryNode cap1 = + ImmutableLeafSetEntryNodeBuilder + .create() + .withNodeIdentifier( + new YangInstanceIdentifier.NodeWithValue( + QName.create(TEST_QNAME, + "capability"), DESC_QNAME) + ).withValue(DESC_QNAME).build(); + + final LeafSetNode capabilities = + ImmutableLeafSetNodeBuilder + .create() + .withNodeIdentifier( + new YangInstanceIdentifier.NodeIdentifier( + QName.create(TEST_QNAME, + "capability")) + ).withChild(cap1).build(); + + ContainerNode switchFeatures = ImmutableContainerNodeBuilder .create() - .withNodeIdentifier( - (new YangInstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME, - "number"), 15))).withValue(15).build(); - final LeafSetNode numbers = - ImmutableLeafSetNodeBuilder + .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier( + SWITCH_FEATURES_QNAME)) + .withChild(capabilities) + .build(); + + // Create a leaf list with numbers + final LeafSetEntryNode five = + ImmutableLeafSetEntryNodeBuilder + .create() + .withNodeIdentifier( + (new YangInstanceIdentifier.NodeWithValue( + QName.create(TEST_QNAME, + "number"), 5)) + ).withValue(5).build(); + final LeafSetEntryNode fifteen = + ImmutableLeafSetEntryNodeBuilder + .create() + .withNodeIdentifier( + (new YangInstanceIdentifier.NodeWithValue( + QName.create(TEST_QNAME, + "number"), 15)) + ).withValue(15).build(); + final LeafSetNode numbers = + ImmutableLeafSetNodeBuilder + .create() + .withNodeIdentifier( + new YangInstanceIdentifier.NodeIdentifier( + QName.create(TEST_QNAME, + "number")) + ).withChild(five).withChild(fifteen).build(); + + + // Create augmentations + MapEntryNode mapEntry = createAugmentedListEntry(1, "First Test"); + + + // Create the document + return ImmutableContainerNodeBuilder .create() .withNodeIdentifier( - new YangInstanceIdentifier.NodeIdentifier(QName.create(TEST_QNAME, - "number"))).withChild(five).withChild(fifteen).build(); - - - Set childAugmentations = new HashSet<>(); - childAugmentations.add(AUG_QNAME); - final YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier = - new YangInstanceIdentifier.AugmentationIdentifier(null, childAugmentations); - final AugmentationNode augmentationNode = - Builders.augmentationBuilder() - .withNodeIdentifier(augmentationIdentifier) - .withChild(ImmutableNodes.leafNode(AUG_QNAME, "First Test")) + new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME)) + .withChild(ImmutableNodes.leafNode(DESC_QNAME, DESC)) + .withChild(ImmutableNodes.leafNode(POINTER_QNAME, "pointer")) + .withChild(ImmutableNodes.leafNode(SOME_REF_QNAME, + YangInstanceIdentifier.builder().build())) + .withChild(ImmutableNodes.leafNode(MYIDENTITY_QNAME, DESC_QNAME)) + + //.withChild(augmentationNode) + .withChild(shoes) + .withChild(numbers) + .withChild(switchFeatures) + .withChild(mapNodeBuilder(AUGMENTED_LIST_QNAME).withChild(mapEntry).build()) + .withChild( + mapNodeBuilder(OUTER_LIST_QNAME) + .withChild(mapEntry(OUTER_LIST_QNAME, ID_QNAME, ONE_ID)) + .withChild(BAR_NODE).build() + ).build(); + + } + + public static MapEntryNode createAugmentedListEntry(int id, String name) { + + Set childAugmentations = new HashSet<>(); + childAugmentations.add(AUG_CONT_QNAME); + + ContainerNode augCont = ImmutableContainerNodeBuilder + .create() + .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(AUG_CONT_QNAME)) + .withChild(ImmutableNodes.leafNode(AUG_NAME_QNAME, name)) .build(); - return ImmutableContainerNodeBuilder - .create() - .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME)) - .withChild(ImmutableNodes.leafNode(DESC_QNAME, DESC)) - .withChild(augmentationNode) - .withChild(shoes) - .withChild(numbers) - .withChild( - mapNodeBuilder(OUTER_LIST_QNAME) - .withChild(mapEntry(OUTER_LIST_QNAME, ID_QNAME, ONE_ID)) - .withChild(BAR_NODE).build()).build(); - - } - - - public static ContainerNode createFamily() { - final DataContainerNodeAttrBuilder familyContainerBuilder = - ImmutableContainerNodeBuilder.create().withNodeIdentifier( - new YangInstanceIdentifier.NodeIdentifier(FAMILY_QNAME)); - - final CollectionNodeBuilder childrenBuilder = - mapNodeBuilder(CHILDREN_QNAME); - - final DataContainerNodeBuilder firstChildBuilder = - mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID); - final DataContainerNodeBuilder secondChildBuilder = - mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID); - - final DataContainerNodeBuilder firstGrandChildBuilder = - mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME, - FIRST_GRAND_CHILD_ID); - final DataContainerNodeBuilder secondGrandChildBuilder = - mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME, - SECOND_GRAND_CHILD_ID); - - firstGrandChildBuilder - .withChild( - ImmutableNodes.leafNode(GRAND_CHILD_NUMBER_QNAME, - FIRST_GRAND_CHILD_ID)).withChild( - ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME, - FIRST_GRAND_CHILD_NAME)); - - secondGrandChildBuilder.withChild( - ImmutableNodes - .leafNode(GRAND_CHILD_NUMBER_QNAME, SECOND_GRAND_CHILD_ID)) - .withChild( - ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME, - SECOND_GRAND_CHILD_NAME)); - firstChildBuilder - .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, FIRST_CHILD_ID)) - .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, FIRST_CHILD_NAME)) - .withChild( - mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild( - firstGrandChildBuilder.build()).build()); + final YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier = + new YangInstanceIdentifier.AugmentationIdentifier(childAugmentations); - secondChildBuilder - .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, SECOND_CHILD_ID)) - .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, SECOND_CHILD_NAME)) - .withChild( - mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild( - firstGrandChildBuilder.build()).build()); + final AugmentationNode augmentationNode = + Builders.augmentationBuilder() + .withNodeIdentifier(augmentationIdentifier) + .withChild(augCont) + .build(); - childrenBuilder.withChild(firstChildBuilder.build()); - childrenBuilder.withChild(secondChildBuilder.build()); - - return familyContainerBuilder.withChild(childrenBuilder.build()).build(); - } + return ImmutableMapEntryNodeBuilder.create() + .withNodeIdentifier( + new YangInstanceIdentifier.NodeIdentifierWithPredicates( + AUGMENTED_LIST_QNAME, ID_QNAME, id)) + .withChild(ImmutableNodes.leafNode(ID_QNAME, id)) + .withChild(augmentationNode).build(); + } + + + public static ContainerNode createFamily() { + final DataContainerNodeAttrBuilder + familyContainerBuilder = + ImmutableContainerNodeBuilder.create().withNodeIdentifier( + new YangInstanceIdentifier.NodeIdentifier(FAMILY_QNAME)); + + final CollectionNodeBuilder childrenBuilder = + mapNodeBuilder(CHILDREN_QNAME); + + final DataContainerNodeBuilder + firstChildBuilder = + mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID); + final DataContainerNodeBuilder + secondChildBuilder = + mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, + SECOND_CHILD_ID); + + final DataContainerNodeBuilder + firstGrandChildBuilder = + mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME, + FIRST_GRAND_CHILD_ID); + final DataContainerNodeBuilder + secondGrandChildBuilder = + mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME, + SECOND_GRAND_CHILD_ID); + + firstGrandChildBuilder + .withChild( + ImmutableNodes.leafNode(GRAND_CHILD_NUMBER_QNAME, + FIRST_GRAND_CHILD_ID) + ).withChild( + ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME, + FIRST_GRAND_CHILD_NAME) + ); + + secondGrandChildBuilder.withChild( + ImmutableNodes + .leafNode(GRAND_CHILD_NUMBER_QNAME, SECOND_GRAND_CHILD_ID) + ) + .withChild( + ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME, + SECOND_GRAND_CHILD_NAME) + ); + + firstChildBuilder + .withChild( + ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, FIRST_CHILD_ID)) + .withChild( + ImmutableNodes.leafNode(CHILD_NAME_QNAME, FIRST_CHILD_NAME)) + .withChild( + mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild( + firstGrandChildBuilder.build()).build() + ); + + + secondChildBuilder + .withChild( + ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, SECOND_CHILD_ID)) + .withChild( + ImmutableNodes.leafNode(CHILD_NAME_QNAME, SECOND_CHILD_NAME)) + .withChild( + mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild( + firstGrandChildBuilder.build()).build() + ); + + childrenBuilder.withChild(firstChildBuilder.build()); + childrenBuilder.withChild(secondChildBuilder.build()); + + return familyContainerBuilder.withChild(childrenBuilder.build()) + .build(); + } } diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-augmentation.yang b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-augmentation.yang index 77d74c47d3..c305572951 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-augmentation.yang +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-augmentation.yang @@ -10,10 +10,12 @@ module odl-datastore-augmentation { } - augment "/test:test" { - leaf name { - type string; + augment "/test:test/test:augmented-list" { + container cont { + leaf name { + type string; + } } } -} \ No newline at end of file +} diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-test.yang b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-test.yang index 38ec700973..e4eca7b717 100644 --- a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-test.yang +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/resources/odl-datastore-test.yang @@ -7,6 +7,9 @@ module odl-datastore-test { description "Initial revision."; } + identity feature-capability { + } + container test { leaf desc { type string; @@ -50,5 +53,39 @@ module odl-datastore-test { type uint8; } + leaf pointer { + type leafref { + path "/network-topology/topology/node/termination-point/tp-id"; + } + } + + leaf some-ref { + type instance-identifier; + } + + leaf myidentity { + type identityref { + base feature-capability; + } + } + + container switch-features { + leaf-list capability { + type identityref { + base feature-capability; + } + + } + } + + list augmented-list { + key id; + + leaf id { + type uint8; + } + } + + } -} \ No newline at end of file +} diff --git a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/LeafListEntryReader.java b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/LeafListEntryReader.java index 4ba3478365..a05a169c99 100644 --- a/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/LeafListEntryReader.java +++ b/opendaylight/netconf/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/reader/impl/LeafListEntryReader.java @@ -1,3 +1,4 @@ + /* * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * @@ -9,7 +10,6 @@ package org.opendaylight.controller.netconf.cli.reader.impl; import com.google.common.base.Optional; import com.google.common.collect.Lists; -import java.util.List; import jline.console.completer.Completer; import org.opendaylight.controller.netconf.cli.io.BaseConsoleContext; import org.opendaylight.controller.netconf.cli.io.ConsoleContext; @@ -19,6 +19,8 @@ import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; +import java.util.List; + class LeafListEntryReader extends BasicDataHolderReader implements GenericListEntryReader {