From: Tony Tkacik Date: Wed, 25 Jun 2014 09:48:07 +0000 (+0000) Subject: Merge "BUG 1179 - rpcResult = false but response 200" X-Git-Tag: release/helium~606 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=af01f3ff581487d002140ca08a94e4636546d649;hp=9e5a99f92b5aadabe12fc9e0d34f5fa6e6750b58;p=controller.git Merge "BUG 1179 - rpcResult = false but response 200" --- diff --git a/features/base/src/main/resources/features.xml b/features/base/src/main/resources/features.xml index 5677ab66d0..dd6eec8222 100644 --- a/features/base/src/main/resources/features.xml +++ b/features/base/src/main/resources/features.xml @@ -73,7 +73,7 @@ mvn:org.javassist/javassist/${javassist.version} mvn:commons-io/commons-io/${commons.io.version} mvn:commons-codec/commons-codec/${commons.codec.version} - mvn:org.apache.commons/commons-lang3/${commons.lang.version} + mvn:org.apache.commons/commons-lang3/${commons.lang3.version} mvn:commons-net/commons-net/${commons.net.version} diff --git a/opendaylight/commons/opendaylight/pom.xml b/opendaylight/commons/opendaylight/pom.xml index 990276468b..58dbef67d5 100644 --- a/opendaylight/commons/opendaylight/pom.xml +++ b/opendaylight/commons/opendaylight/pom.xml @@ -2,11 +2,13 @@ 4.0.0 - org.opendaylight.controller - commons.parent - 1.0.2-SNAPSHOT - ../parent + org.opendaylight.odlparent + odlparent + 1.4.2-SNAPSHOT + + + org.opendaylight.controller commons.opendaylight 1.4.2-SNAPSHOT pom @@ -15,14 +17,14 @@ + 2.3.2 1.0.0 0.4.2-SNAPSHOT 0.0.1-SNAPSHOT 1.1.0 - - 0.5.2-SNAPSHOT 0.5.2-SNAPSHOT + 4.1 1.50 @@ -30,7 +32,7 @@ 0.4.2-SNAPSHOT 0.4.2-SNAPSHOT 0.4.2-SNAPSHOT - 2.10 + 2.12 0.5.1-SNAPSHOT 0.4.3-SNAPSHOT 0.4.2-SNAPSHOT @@ -49,7 +51,7 @@ 2.4 7.0.32.v201211201952 7.0.32.v201211081135 - 3.1 + 3.1 0.0.2-SNAPSHOT 3.0.1 0.1.2-SNAPSHOT @@ -59,6 +61,7 @@ 7.0.32.v201211081135 7.0.32.v201211201952 2.3.2 + 0.1.2-SNAPSHOT 0.5.2-SNAPSHOT 0.2.5-SNAPSHOT 0.4.3-SNAPSHOT @@ -69,8 +72,6 @@ 0.5.2-SNAPSHOT 0.5.2-SNAPSHOT 0.0.2-SNAPSHOT - 7.0.42 - 0.2.0 0.4.2-SNAPSHOT 1.1.0-SNAPSHOT 2.5.0 @@ -80,23 +81,16 @@ 3.0.0 + 0000.0002.0038.0 - 2.15 - 1.0.1 - 3.0.1 - 3.1.0 - 3.1.6 - 4.2.0 1.4.2-SNAPSHOT + 2.4.0 0.4.2-SNAPSHOT 0.4.2-SNAPSHOT 0.5.2-SNAPSHOT 0.4.2-SNAPSHOT 0.4.2-SNAPSHOT 0.6.0-SNAPSHOT - 2.2.0.RELEASE - 2.2.4 - 14.0.1 0.5.2-SNAPSHOT 0.5.2-SNAPSHOT 0.4.2-SNAPSHOT @@ -107,19 +101,7 @@ 2013.10.19.1-SNAPSHOT 2013.10.21.2-SNAPSHOT 2010.09.24.4-SNAPSHOT - 2.3.2 - 0.6.2.201302030002 - 2.4 - 1.7 - 1.7 - 3.17.1-GA - 1.2 - - 1.17 - 1.17 - 4.0 - 2.8 - 1.3.3 + 2.0-beta-2 src/main/yang-gen-config 0.0.2-SNAPSHOT 1.1.4 @@ -130,16 +112,12 @@ 1.0.0-SNAPSHOT 3.0.0 3.0.1 + 1.0.0 1.0.9 0.4.2-SNAPSHOT - 2.5.1 - - 1.7 - 1.7 + 3.0.5 1.1-SNAPSHOT - 1.9.5 0.2.5-SNAPSHOT - 4.0.19.Final 0.0.3-SNAPSHOT 0.4.2-SNAPSHOT 0.4.2-SNAPSHOT @@ -150,18 +128,11 @@ 1.4.2-SNAPSHOT 1.4.2-SNAPSHOT 2013.08.27.4-SNAPSHOT - 20080701 0.0.2-SNAPSHOT - 5.0.0 - 5.0.0 - UTF-8 - UTF-8 - 2.6 1.0-alpha-2 0.5.0-SNAPSHOT 0.4.2-SNAPSHOT 0.4.2-SNAPSHOT - 2.3.2 0.4.2-SNAPSHOT 0.1.2-SNAPSHOT 0.4.2-SNAPSHOT @@ -175,19 +146,12 @@ 2.11 0.4.2-SNAPSHOT dav:http://nexus.opendaylight.org/content/sites/site - 3.2 - 1.7.2 ${user.name}-private-view https://sonar.opendaylight.org/ jacoco java org.openflow.openflowj,net.sf.jung2 - 1.0.0 - 1.2.1 - 3.1.4.RELEASE - 3.1.3.RELEASE - 3.1.3.RELEASE 0.4.2-SNAPSHOT 0.4.2-SNAPSHOT 0.5.1-SNAPSHOT @@ -201,14 +165,11 @@ 0.4.2-SNAPSHOT 0.4.2-SNAPSHOT 0.4.2-SNAPSHOT - 1.5.0 0.4.2-SNAPSHOT 0.0.2-SNAPSHOT 0.4.2-SNAPSHOT - 3.6.0.RELEASE 0.4.2-SNAPSHOT src/main/xtend-gen - 2.4.3 2013.09.07.4-SNAPSHOT 1.0.0-SNAPSHOT 0.6.2-SNAPSHOT @@ -216,7 +177,7 @@ - + ${project.groupId} ietf-netconf-monitoring @@ -298,6 +259,12 @@ guava ${guava.version} + + + com.jcabi + jcabi-maven-slf4j + 0.8 + com.sun.jersey @@ -360,6 +327,11 @@ commons-io ${commons.io.version} + + commons-lang + commons-lang + ${commons.lang.version} + commons-net commons-net @@ -522,6 +494,11 @@ jsr311-api ${jsr311.api.version} + + net.sourceforge.pmd + pmd + 5.1.0 + orbit javax.activation @@ -615,7 +592,7 @@ org.apache.commons commons-lang3 - ${commons.lang.version} + ${commons.lang3.version} org.apache.felix @@ -655,11 +632,26 @@ enunciate-core-annotations ${enunciate.version} + + org.codehaus.gmaven.runtime + gmaven-runtime-2.0 + 1.5 + org.codehaus.jettison jettison ${jettison.version} + + org.eclipse + jdt + 3.3.0-v20070607-1300 + + + org.eclipse.equinox + app + 1.0.0-v20070606 + @@ -667,6 +659,11 @@ servlet 1.0.0-v20070606 + + org.eclipse.jdt + core + 3.3.0-v_771 + org.eclipse.persistence org.eclipse.persistence.antlr @@ -689,11 +686,21 @@ org.eclipse.xtend.lib ${xtend.version} + + org.glassfish.jersey.test-framework.providers + jersey-test-framework-provider-grizzly2 + 2.4 + org.javassist javassist ${javassist.version} + + org.jboss.resteasy + jaxrs-api + 3.0.4.Final + org.jboss.spec.javax.transaction jboss-transaction-api_1.1_spec @@ -894,6 +901,11 @@ filter-valve ${filtervalve.version} + + org.opendaylight.controller + flow-management-compatibility + ${mdsal.version} + org.opendaylight.controller flowprogrammer.northbound @@ -984,6 +996,12 @@ netconf-client ${netconf.version} + + org.opendaylight.controller + netconf-client + ${netconf.version} + test-jar + @@ -1108,6 +1126,11 @@ protocol_plugins.stub ${protocol_plugins.stub.version} + + org.opendaylight.controller + remoterpc-routingtable.implementation + ${mdsal.version} + org.opendaylight.controller routing.dijkstra_implementation @@ -1435,6 +1458,37 @@ model-inventory ${mdsal.version} + + org.opendaylight.controller.model + model-topology + ${mdsal.version} + + + org.opendaylight.controller.samples + sample-toaster + ${mdsal.version} + + + org.opendaylight.controller.samples + sample-toaster-consumer + ${mdsal.version} + + + + org.opendaylight.controller.samples + sample-toaster-provider + ${mdsal.version} + + + org.opendaylight.controller.tests + sal-remoterpc-connector-test-consumer + ${mdsal.version} + + + org.opendaylight.controller.tests + sal-remoterpc-connector-test-provider + ${mdsal.version} + org.opendaylight.controller.thirdparty com.sun.jersey.jersey-servlet @@ -1604,6 +1658,16 @@ yang-ext ${yang-ext.version} + + org.opendaylight.yangtools.thirdparty + antlr4-runtime-osgi-nohead + 4.0 + + + org.opendaylight.yangtools.thirdparty + xtend-lib-osgi + ${xtend.version} + org.openexi nagasena @@ -1624,17 +1688,10 @@ org.osgi.core ${osgi.core.version} - - - org.ow2.asm - asm-all - 4.1 - - - org.ow2.chameleon.management - chameleon-mbeans - 1.0.0 + org.reflections + reflections + 0.9.9-RC1 org.scala-lang @@ -1658,81 +1715,9 @@ compile - org.springframework - org.springframework.aop - ${spring.version} - - - org.springframework - org.springframework.asm - ${spring.version} - - - org.springframework - org.springframework.beans - ${spring.version} - - - org.springframework - org.springframework.context - ${spring.version} - - - org.springframework - org.springframework.context.support - ${spring.version} - - - org.springframework - org.springframework.core - ${spring.version} - - - org.springframework - org.springframework.expression - ${spring.version} - - - org.springframework - org.springframework.transaction - ${spring-security.version} - - - org.springframework - org.springframework.web - ${spring.version} - - - org.springframework - org.springframework.web.servlet - ${spring.version} - - - - - org.springframework.security - spring-security-config - ${spring-security.version} - - - org.springframework.security - spring-security-core - ${spring-security.version} - - - org.springframework.security - spring-security-taglibs - ${spring-security.version} - - - org.springframework.security - spring-security-web - ${spring-security.version} - - - virgomirror - org.eclipse.jdt.core.compiler.batch - 3.8.0.I20120518-2145 + org.slf4j + slf4j-simple + ${slf4j.version} junit @@ -1740,12 +1725,6 @@ ${junit.version} test - - org.mockito - mockito-all - ${mockito.version} - test - org.opendaylight.controller commons.logback_settings @@ -1771,44 +1750,6 @@ ${yangtools.version} test - - - org.ops4j.pax.exam - pax-exam-container-native - ${exam.version} - test - - - org.ops4j.pax.exam - pax-exam-junit4 - ${exam.version} - test - - - org.ops4j.pax.exam - pax-exam-link-mvn - ${exam.version} - test - - - org.ops4j.pax.url - pax-url-aether - ${url.version} - test - - - - org.springframework.osgi - spring-osgi-mock - ${spring-osgi.version} - test - - - xmlunit - xmlunit - 1.5 - test - @@ -1955,7 +1896,7 @@ org.eclipse.m2e lifecycle-mapping - 1.0.0 + ${lifecycle.mapping.version} @@ -2299,7 +2240,7 @@ opendaylight-mirror opendaylight-mirror - ${nexusproxy}/groups/public/ + http://nexus.opendaylight.org/content/groups/public/ @@ -2311,7 +2252,7 @@ opendaylight-snapshot opendaylight-snapshot - ${nexusproxy}/repositories/${nexus.repository.snapshot}/ + http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/ @@ -2327,7 +2268,7 @@ opendaylight-mirror opendaylight-mirror - ${nexusproxy}/groups/public/ + http://nexus.opendaylight.org/content/groups/public/ @@ -2339,19 +2280,19 @@ opendaylight-snapshot opendaylight-snapshot - ${nexusproxy}/repositories/${nexus.repository.snapshot}/ + http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/ opendaylight-release - ${nexusproxy}/repositories/${nexus.repository.release}/ + http://nexus.opendaylight.org/content/repositories/opendaylight.release/ opendaylight-snapshot - ${nexusproxy}/repositories/${nexus.repository.snapshot}/ + http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/ diff --git a/opendaylight/config/config-manager/pom.xml b/opendaylight/config/config-manager/pom.xml index 79fd5268e6..fc2c0fd85b 100644 --- a/opendaylight/config/config-manager/pom.xml +++ b/opendaylight/config/config-manager/pom.xml @@ -25,13 +25,7 @@ com.google.guava guava - + commons-io commons-io diff --git a/opendaylight/config/netconf-config-dispatcher/pom.xml b/opendaylight/config/netconf-config-dispatcher/pom.xml index 65ebdaf938..b9d218ead1 100644 --- a/opendaylight/config/netconf-config-dispatcher/pom.xml +++ b/opendaylight/config/netconf-config-dispatcher/pom.xml @@ -26,7 +26,6 @@ ${project.groupId} netconf-client - ${netconf.version} diff --git a/opendaylight/config/pom.xml b/opendaylight/config/pom.xml index 5f34a9aa82..76fbd7f6e5 100644 --- a/opendaylight/config/pom.xml +++ b/opendaylight/config/pom.xml @@ -81,12 +81,11 @@ org.apache.maven.plugins maven-antrun-plugin - 1.3 + ${maven.antrun.plugin.version} org.apache.maven.plugins maven-jar-plugin - 2.4 @@ -99,7 +98,6 @@ org.apache.maven.plugins maven-surefire-plugin - 2.14.1 true classes @@ -112,7 +110,7 @@ org.codehaus.groovy.maven gmaven-plugin - 1.0 + ${gmaven.plugin.version} org.opendaylight.yangtools @@ -155,7 +153,6 @@ org.apache.maven.plugins maven-checkstyle-plugin - 2.12 false false diff --git a/opendaylight/config/threadpool-config-impl/pom.xml b/opendaylight/config/threadpool-config-impl/pom.xml index 4bc080bbff..4fd0d681a1 100644 --- a/opendaylight/config/threadpool-config-impl/pom.xml +++ b/opendaylight/config/threadpool-config-impl/pom.xml @@ -23,7 +23,6 @@ ${project.groupId} threadpool-config-api - ${project.version} com.google.guava diff --git a/opendaylight/config/yang-jmx-generator-plugin/pom.xml b/opendaylight/config/yang-jmx-generator-plugin/pom.xml index b8831f6979..5f51980b94 100644 --- a/opendaylight/config/yang-jmx-generator-plugin/pom.xml +++ b/opendaylight/config/yang-jmx-generator-plugin/pom.xml @@ -24,7 +24,6 @@ com.jcabi jcabi-maven-slf4j - 0.8 @@ -40,7 +39,6 @@ org.codehaus.gmaven.runtime gmaven-runtime-2.0 - 1.5 org.sonatype.gossip @@ -77,14 +75,12 @@ net.sourceforge.pmd pmd - 5.1.0 test org.eclipse jdt - 3.3.0-v20070607-1300 test @@ -98,14 +94,12 @@ org.eclipse.equinox app - 1.0.0-v20070606 test org.eclipse.jdt core - 3.3.0-v_771 test diff --git a/opendaylight/config/yang-test-plugin/pom.xml b/opendaylight/config/yang-test-plugin/pom.xml index 173227f0bc..c7fb73f385 100644 --- a/opendaylight/config/yang-test-plugin/pom.xml +++ b/opendaylight/config/yang-test-plugin/pom.xml @@ -24,7 +24,7 @@ org.apache.maven maven-plugin-api - 3.0.5 + ${maven.plugin.api.version} diff --git a/opendaylight/config/yang-test/pom.xml b/opendaylight/config/yang-test/pom.xml index 8c8065dd67..247b3c0745 100644 --- a/opendaylight/config/yang-test/pom.xml +++ b/opendaylight/config/yang-test/pom.xml @@ -64,7 +64,7 @@ org.eclipse.m2e lifecycle-mapping - 1.0.0 + ${lifecycle.mapping.version} diff --git a/opendaylight/distribution/opendaylight-karaf/pom.xml b/opendaylight/distribution/opendaylight-karaf/pom.xml index 6a6a12d1de..7970b3aa00 100644 --- a/opendaylight/distribution/opendaylight-karaf/pom.xml +++ b/opendaylight/distribution/opendaylight-karaf/pom.xml @@ -82,7 +82,7 @@ org.opendaylight.yangtools - features-file + features-yangtools ${yangtools.version} features xml diff --git a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/pom.xml b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/pom.xml index fc58ed96e1..62dc2ffa1a 100644 --- a/opendaylight/md-sal/compatibility/inventory-topology-compatibility/pom.xml +++ b/opendaylight/md-sal/compatibility/inventory-topology-compatibility/pom.xml @@ -49,7 +49,6 @@ org.opendaylight.controller.model model-topology - 1.1-SNAPSHOT org.slf4j diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/pom.xml b/opendaylight/md-sal/compatibility/sal-compatibility/pom.xml index 6c79e053e1..168dd14d10 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/pom.xml +++ b/opendaylight/md-sal/compatibility/sal-compatibility/pom.xml @@ -26,7 +26,6 @@ org.opendaylight.controller.model model-topology - 1.1-SNAPSHOT diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FromSalConversionsUtils.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FromSalConversionsUtils.java index a879a36f8c..36045cabf4 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FromSalConversionsUtils.java +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FromSalConversionsUtils.java @@ -205,6 +205,7 @@ public class FromSalConversionsUtils { VlanIdBuilder vlanIDBuilder = new VlanIdBuilder(); vlanIDBuilder.setVlanId(new VlanId((NetUtils .getUnsignedShort((short) vlan.getValue())))); + vlanIDBuilder.setVlanIdPresent(true); vlanMatchBuild.setVlanId(vlanIDBuilder.build()); } diff --git a/opendaylight/md-sal/forwardingrules-manager/pom.xml b/opendaylight/md-sal/forwardingrules-manager/pom.xml index 9bd63d3c3b..b3096e6478 100644 --- a/opendaylight/md-sal/forwardingrules-manager/pom.xml +++ b/opendaylight/md-sal/forwardingrules-manager/pom.xml @@ -18,7 +18,6 @@ org.opendaylight.controller flow-management-compatibility - 1.1-SNAPSHOT org.opendaylight.controller diff --git a/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/FlowCapableInventoryProvider.java b/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/FlowCapableInventoryProvider.java index 7e4190f1df..6ed61e3024 100644 --- a/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/FlowCapableInventoryProvider.java +++ b/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/FlowCapableInventoryProvider.java @@ -7,61 +7,117 @@ */ package org.opendaylight.controller.md.inventory.manager; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.LinkedBlockingDeque; + +import org.opendaylight.controller.md.sal.common.api.TransactionStatus; import org.opendaylight.controller.sal.binding.api.NotificationProviderService; import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction; import org.opendaylight.controller.sal.binding.api.data.DataProviderService; import org.opendaylight.yangtools.concepts.Registration; -import org.opendaylight.yangtools.yang.binding.NotificationListener; +import org.opendaylight.yangtools.yang.common.RpcResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class FlowCapableInventoryProvider implements AutoCloseable { +import com.google.common.base.Preconditions; + +class FlowCapableInventoryProvider implements AutoCloseable, Runnable { + private static final Logger LOG = LoggerFactory.getLogger(FlowCapableInventoryProvider.class); + private static final int QUEUE_DEPTH = 500; + private static final int MAX_BATCH = 100; + + private final BlockingQueue queue = new LinkedBlockingDeque<>(QUEUE_DEPTH); + private final NotificationProviderService notificationService; + private final DataProviderService dataService; + private Registration listenerRegistration; + private Thread thread; - private final static Logger LOG = LoggerFactory.getLogger(FlowCapableInventoryProvider.class); + FlowCapableInventoryProvider(final DataProviderService dataService, final NotificationProviderService notificationService) { + this.dataService = Preconditions.checkNotNull(dataService); + this.notificationService = Preconditions.checkNotNull(notificationService); + } + + void start() { + final NodeChangeCommiter changeCommiter = new NodeChangeCommiter(FlowCapableInventoryProvider.this); + this.listenerRegistration = this.notificationService.registerNotificationListener(changeCommiter); - private DataProviderService dataService; - private NotificationProviderService notificationService; - private Registration listenerRegistration; - private final NodeChangeCommiter changeCommiter = new NodeChangeCommiter(FlowCapableInventoryProvider.this); + thread = new Thread(this); + thread.setDaemon(true); + thread.setName("FlowCapableInventoryProvider"); + thread.start(); - public void start() { - this.listenerRegistration = this.notificationService.registerNotificationListener(this.changeCommiter); LOG.info("Flow Capable Inventory Provider started."); } - protected DataModificationTransaction startChange() { - DataProviderService _dataService = this.dataService; - return _dataService.beginTransaction(); + void enqueue(final InventoryOperation op) { + try { + queue.put(op); + } catch (InterruptedException e) { + LOG.warn("Failed to enqueue operation {}", op, e); + } } @Override - public void close() { - try { - LOG.info("Flow Capable Inventory Provider stopped."); - if (this.listenerRegistration != null) { + public void close() throws InterruptedException { + LOG.info("Flow Capable Inventory Provider stopped."); + if (this.listenerRegistration != null) { + try { this.listenerRegistration.close(); + } catch (Exception e) { + LOG.error("Failed to stop inventory provider", e); } - } catch (Exception e) { - String errMsg = "Error by stop Flow Capable Inventory Provider."; - LOG.error(errMsg, e); - throw new RuntimeException(errMsg, e); + listenerRegistration = null; } - } - public DataProviderService getDataService() { - return this.dataService; - } + if (thread != null) { + thread.interrupt(); + thread.join(); + thread = null; + } - public void setDataService(final DataProviderService dataService) { - this.dataService = dataService; - } - public NotificationProviderService getNotificationService() { - return this.notificationService; } - public void setNotificationService( - final NotificationProviderService notificationService) { - this.notificationService = notificationService; + @Override + public void run() { + try { + for (;;) { + InventoryOperation op = queue.take(); + + final DataModificationTransaction tx = dataService.beginTransaction(); + LOG.debug("New operations available, starting transaction {}", tx.getIdentifier()); + + int ops = 0; + do { + op.applyOperation(tx); + + ops++; + if (ops < MAX_BATCH) { + op = queue.poll(); + } else { + op = null; + } + } while (op != null); + + LOG.debug("Processed {} operations, submitting transaction {}", ops, tx.getIdentifier()); + + try { + final RpcResult result = tx.commit().get(); + if(!result.isSuccessful()) { + LOG.error("Transaction {} failed", tx.getIdentifier()); + } + } catch (ExecutionException e) { + LOG.warn("Failed to commit inventory change", e.getCause()); + } + } + } catch (InterruptedException e) { + LOG.info("Processing interrupted, terminating", e); + } + + // Drain all events, making sure any blocked threads are unblocked + while (!queue.isEmpty()) { + queue.poll(); + } } } diff --git a/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/InventoryActivator.java b/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/InventoryActivator.java index 6c06088fc4..5bcae367e3 100644 --- a/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/InventoryActivator.java +++ b/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/InventoryActivator.java @@ -12,23 +12,32 @@ import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderCo import org.opendaylight.controller.sal.binding.api.NotificationProviderService; import org.opendaylight.controller.sal.binding.api.data.DataProviderService; import org.osgi.framework.BundleContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class InventoryActivator extends AbstractBindingAwareProvider { - - private static FlowCapableInventoryProvider provider = new FlowCapableInventoryProvider(); + private static final Logger LOG = LoggerFactory.getLogger(InventoryActivator.class); + private FlowCapableInventoryProvider provider; @Override public void onSessionInitiated(final ProviderContext session) { - DataProviderService salDataService = session. getSALService(DataProviderService.class); + DataProviderService salDataService = session.getSALService(DataProviderService.class); NotificationProviderService salNotifiService = - session. getSALService(NotificationProviderService.class); - InventoryActivator.provider.setDataService(salDataService); - InventoryActivator.provider.setNotificationService(salNotifiService); - InventoryActivator.provider.start(); + session.getSALService(NotificationProviderService.class); + + provider = new FlowCapableInventoryProvider(salDataService, salNotifiService); + provider.start(); } @Override protected void stopImpl(final BundleContext context) { - InventoryActivator.provider.close(); + if (provider != null) { + try { + provider.close(); + } catch (InterruptedException e) { + LOG.warn("Interrupted while waiting for shutdown", e); + } + provider = null; + } } } diff --git a/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/InventoryOperation.java b/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/InventoryOperation.java new file mode 100644 index 0000000000..3be5fcf643 --- /dev/null +++ b/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/InventoryOperation.java @@ -0,0 +1,16 @@ +/** + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.md.inventory.manager; + +import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction; + +interface InventoryOperation { + + void applyOperation(DataModificationTransaction tx); + +} diff --git a/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/NodeChangeCommiter.java b/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/NodeChangeCommiter.java index 674ae398d3..3db3c93fcc 100644 --- a/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/NodeChangeCommiter.java +++ b/opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/NodeChangeCommiter.java @@ -7,15 +7,11 @@ */ package org.opendaylight.controller.md.inventory.manager; -import java.util.concurrent.Future; - -import org.opendaylight.controller.md.sal.common.api.TransactionStatus; import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorUpdated; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeUpdated; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRemoved; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdated; @@ -31,123 +27,90 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.N import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder; -import org.opendaylight.yangtools.yang.common.RpcResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Objects; -import com.google.common.util.concurrent.FutureCallback; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.JdkFutureAdapters; - -public class NodeChangeCommiter implements OpendaylightInventoryListener { +import com.google.common.base.Preconditions; - protected final static Logger LOG = LoggerFactory.getLogger(NodeChangeCommiter.class); +class NodeChangeCommiter implements OpendaylightInventoryListener { + private static final Logger LOG = LoggerFactory.getLogger(NodeChangeCommiter.class); private final FlowCapableInventoryProvider manager; public NodeChangeCommiter(final FlowCapableInventoryProvider manager) { - this.manager = manager; - } - - public FlowCapableInventoryProvider getManager() { - return this.manager; + this.manager = Preconditions.checkNotNull(manager); } @Override public synchronized void onNodeConnectorRemoved(final NodeConnectorRemoved connector) { - - final NodeConnectorRef ref = connector.getNodeConnectorRef(); - final DataModificationTransaction it = this.getManager().startChange(); - LOG.debug("removing node connector {} ", ref.getValue()); - it.removeOperationalData(ref.getValue()); - Future> commitResult = it.commit(); - listenOnTransactionState(it.getIdentifier(), commitResult, "nodeConnector removal", ref.getValue()); + manager.enqueue(new InventoryOperation() { + @Override + public void applyOperation(final DataModificationTransaction tx) { + final NodeConnectorRef ref = connector.getNodeConnectorRef(); + LOG.debug("removing node connector {} ", ref.getValue()); + tx.removeOperationalData(ref.getValue()); + } + }); } @Override public synchronized void onNodeConnectorUpdated(final NodeConnectorUpdated connector) { - - final NodeConnectorRef ref = connector.getNodeConnectorRef(); - final FlowCapableNodeConnectorUpdated flowConnector = connector - .getAugmentation(FlowCapableNodeConnectorUpdated.class); - final DataModificationTransaction it = this.manager.startChange(); - final NodeConnectorBuilder data = new NodeConnectorBuilder(connector); - NodeConnectorId id = connector.getId(); - NodeConnectorKey nodeConnectorKey = new NodeConnectorKey(id); - data.setKey(nodeConnectorKey); - boolean notEquals = (!Objects.equal(flowConnector, null)); - if (notEquals) { - final FlowCapableNodeConnector augment = InventoryMapping.toInventoryAugment(flowConnector); - data.addAugmentation(FlowCapableNodeConnector.class, augment); - } - InstanceIdentifier value = ref.getValue(); - LOG.debug("updating node connector : {}.", value); - NodeConnector build = data.build(); - it.putOperationalData((value), build); - Future> commitResult = it.commit(); - listenOnTransactionState(it.getIdentifier(), commitResult, "nodeConnector update", ref.getValue()); + manager.enqueue(new InventoryOperation() { + @Override + public void applyOperation(final DataModificationTransaction tx) { + final NodeConnectorRef ref = connector.getNodeConnectorRef(); + final NodeConnectorBuilder data = new NodeConnectorBuilder(connector); + data.setKey(new NodeConnectorKey(connector.getId())); + + final FlowCapableNodeConnectorUpdated flowConnector = connector + .getAugmentation(FlowCapableNodeConnectorUpdated.class); + if (flowConnector != null) { + final FlowCapableNodeConnector augment = InventoryMapping.toInventoryAugment(flowConnector); + data.addAugmentation(FlowCapableNodeConnector.class, augment); + } + InstanceIdentifier value = ref.getValue(); + LOG.debug("updating node connector : {}.", value); + NodeConnector build = data.build(); + tx.putOperationalData(value, build); + } + }); } @Override public synchronized void onNodeRemoved(final NodeRemoved node) { - - final NodeRef ref = node.getNodeRef(); - final DataModificationTransaction it = this.manager.startChange(); - LOG.debug("removing node : {}", ref.getValue()); - it.removeOperationalData((ref.getValue())); - Future> commitResult = it.commit(); - listenOnTransactionState(it.getIdentifier(), commitResult, "node removal", ref.getValue()); + manager.enqueue(new InventoryOperation() { + @Override + public void applyOperation(final DataModificationTransaction tx) { + final NodeRef ref = node.getNodeRef(); + LOG.debug("removing node : {}", ref.getValue()); + tx.removeOperationalData((ref.getValue())); + } + }); } @Override public synchronized void onNodeUpdated(final NodeUpdated node) { - - final NodeRef ref = node.getNodeRef(); - final FlowCapableNodeUpdated flowNode = node - . getAugmentation(FlowCapableNodeUpdated.class); - final DataModificationTransaction it = this.manager.startChange(); - final NodeBuilder nodeBuilder = new NodeBuilder(node); - nodeBuilder.setKey(new NodeKey(node.getId())); - boolean equals = Objects.equal(flowNode, null); - if (equals) { + final FlowCapableNodeUpdated flowNode = node.getAugmentation(FlowCapableNodeUpdated.class); + if (flowNode == null) { return; } - final FlowCapableNode augment = InventoryMapping.toInventoryAugment(flowNode); - nodeBuilder.addAugmentation(FlowCapableNode.class, augment); - InstanceIdentifier value = ref.getValue(); - InstanceIdentifierBuilder builder = ((InstanceIdentifier) value).builder(); - InstanceIdentifierBuilder augmentation = builder - . augmentation(FlowCapableNode.class); - final InstanceIdentifier path = augmentation.build(); - LOG.debug("updating node :{} ", path); - it.putOperationalData(path, augment); - - Future> commitResult = it.commit(); - listenOnTransactionState(it.getIdentifier(), commitResult, "node update", ref.getValue()); - } - - /** - * @param txId transaction identificator - * @param future transaction result - * @param action performed by transaction - * @param nodeConnectorPath target value - */ - private static void listenOnTransactionState(final Object txId, Future> future, - final String action, final InstanceIdentifier nodeConnectorPath) { - Futures.addCallback(JdkFutureAdapters.listenInPoolThread(future),new FutureCallback>() { - - @Override - public void onFailure(Throwable t) { - LOG.error("Action {} [{}] failed for Tx:{}", action, nodeConnectorPath, txId, t); - - } + manager.enqueue(new InventoryOperation() { @Override - public void onSuccess(RpcResult result) { - if(!result.isSuccessful()) { - LOG.error("Action {} [{}] failed for Tx:{}", action, nodeConnectorPath, txId); - } + public void applyOperation(final DataModificationTransaction tx) { + final NodeRef ref = node.getNodeRef(); + final NodeBuilder nodeBuilder = new NodeBuilder(node); + nodeBuilder.setKey(new NodeKey(node.getId())); + + final FlowCapableNode augment = InventoryMapping.toInventoryAugment(flowNode); + nodeBuilder.addAugmentation(FlowCapableNode.class, augment); + + @SuppressWarnings("unchecked") + InstanceIdentifierBuilder builder = ((InstanceIdentifier) ref.getValue()).builder(); + InstanceIdentifierBuilder augmentation = builder.augmentation(FlowCapableNode.class); + final InstanceIdentifier path = augmentation.build(); + LOG.debug("updating node :{} ", path); + tx.putOperationalData(path, augment); } }); } diff --git a/opendaylight/md-sal/model/model-inventory/src/main/yang/opendaylight-inventory-config.yang b/opendaylight/md-sal/model/model-inventory/src/main/yang/opendaylight-inventory-config.yang deleted file mode 100644 index 1ccdfe8741..0000000000 --- a/opendaylight/md-sal/model/model-inventory/src/main/yang/opendaylight-inventory-config.yang +++ /dev/null @@ -1,21 +0,0 @@ -module opendaylight-inventory-config { - namespace "urn:opendaylight:inventory:config"; - prefix inv-config; - - import yang-ext {prefix ext; revision-date "2013-07-09";} - import opendaylight-inventory {prefix inv; revision-date "2013-08-19";} - - - revision "2013-08-19" { - description "Initial revision of Inventory model"; - } - /** Base structure **/ - container nodes { - list node { - key "id"; - ext:context-instance "node-context"; - - uses inv:node; - } - } -} diff --git a/opendaylight/md-sal/pom.xml b/opendaylight/md-sal/pom.xml index 8d4901d31b..05f4b4d63c 100644 --- a/opendaylight/md-sal/pom.xml +++ b/opendaylight/md-sal/pom.xml @@ -57,11 +57,15 @@ remoterpc-routingtable/implementation sal-remoterpc-connector/implementation + sal-rest-docgen - - feature + + sal-protocolbuffer-encoding + + + feature @@ -88,7 +92,7 @@ org.eclipse.m2e lifecycle-mapping - 1.0.0 + ${lifecycle.mapping.version} @@ -163,7 +167,7 @@ org.codehaus.mojo findbugs-maven-plugin - 2.4.0 + ${findbugs.maven.plugin.version} Max Low @@ -173,7 +177,7 @@ org.codehaus.mojo jdepend-maven-plugin - 2.0-beta-2 + ${jdepend.maven.plugin.version} diff --git a/opendaylight/md-sal/remoterpc-routingtable/integrationtest/pom.xml b/opendaylight/md-sal/remoterpc-routingtable/integrationtest/pom.xml index 6db143ab3e..ce11be1e77 100644 --- a/opendaylight/md-sal/remoterpc-routingtable/integrationtest/pom.xml +++ b/opendaylight/md-sal/remoterpc-routingtable/integrationtest/pom.xml @@ -21,37 +21,30 @@ org.opendaylight.controller remoterpc-routingtable.implementation - 0.4.1-SNAPSHOT org.opendaylight.controller clustering.services - 0.4.1-SNAPSHOT org.opendaylight.controller sal - 0.5.1-SNAPSHOT org.opendaylight.controller sal.implementation - 0.4.0-SNAPSHOT org.opendaylight.controller containermanager - 0.5.0-SNAPSHOT org.opendaylight.controller containermanager.it.implementation - 0.5.0-SNAPSHOT org.opendaylight.controller clustering.stub - 0.4.0-SNAPSHOT junit @@ -62,11 +55,6 @@ pax-exam-container-native test - - org.ops4j.pax.exam - pax-exam-junit4 - test - org.ops4j.pax.exam pax-exam-link-mvn @@ -104,7 +92,6 @@ org.opendaylight.controller sal - 0.5.1-SNAPSHOT org.opendaylight.yangtools @@ -117,12 +104,10 @@ org.opendaylight.controller sal-connector-api - 1.0-SNAPSHOT org.opendaylight.controller sal-common-util - 1.0-SNAPSHOT @@ -132,22 +117,10 @@ org.opendaylight.controller sal-common-api - 1.0-SNAPSHOT - - - org.opendaylight.controller - sal-common-util - 1.0-SNAPSHOT - - - org.opendaylight.controller - sal-binding-broker-impl - 1.0-SNAPSHOT org.opendaylight.controller sal-binding-broker-impl - 1.0-SNAPSHOT org.ops4j.pax.exam @@ -171,44 +144,36 @@ org.opendaylight.controller config-manager - 0.2.3-SNAPSHOT equinoxSDK381 org.eclipse.osgi - 3.8.1.v20120830-144521 test org.slf4j log4j-over-slf4j - 1.7.2 ch.qos.logback logback-core - 1.0.9 ch.qos.logback logback-classic - 1.0.9 org.opendaylight.yangtools.thirdparty antlr4-runtime-osgi-nohead - 4.0 org.opendaylight.yangtools.thirdparty xtend-lib-osgi - 2.4.3 org.opendaylight.controller clustering.services - 0.4.1-SNAPSHOT junit @@ -219,22 +184,16 @@ equinoxSDK381 org.eclipse.osgi - 3.8.1.v20120830-144521 org.ops4j.pax.exam pax-exam-junit4 - 3.0.0 - - - org.ops4j.pax.exam - pax-exam-junit4 - 3.0.0 + ${exam.version} org.ops4j.pax.exam pax-exam - 3.0.0 + ${exam.version} diff --git a/opendaylight/md-sal/remoterpc-routingtable/integrationtest/test-nb/pom.xml b/opendaylight/md-sal/remoterpc-routingtable/integrationtest/test-nb/pom.xml index 1fd4b762c1..d74e7130a4 100644 --- a/opendaylight/md-sal/remoterpc-routingtable/integrationtest/test-nb/pom.xml +++ b/opendaylight/md-sal/remoterpc-routingtable/integrationtest/test-nb/pom.xml @@ -5,7 +5,7 @@ sal-remoterpc-connector-test-parent org.opendaylight.controller.tests - 1.0-SNAPSHOT + 1.1-SNAPSHOT remoterpc-routingtable-nb-it @@ -56,23 +56,19 @@ org.opendaylight.controller containermanager - 0.5.1-SNAPSHOT org.opendaylight.controller commons.northbound - 0.4.1-SNAPSHOT org.opendaylight.controller sal - 0.5.1-SNAPSHOT org.osgi org.osgi.core - 5.0.0 junit @@ -81,7 +77,6 @@ org.opendaylight.controller remoterpc-routingtable.implementation - 0.4.1-SNAPSHOT com.google.guava diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationService.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationService.java index 6e8bda56d8..46e372aea6 100644 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationService.java +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationService.java @@ -7,7 +7,7 @@ */ package org.opendaylight.controller.sal.binding.api; -import org.opendaylight.yangtools.concepts.Registration; +import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.yang.binding.Notification; public interface NotificationService extends BindingAwareService { @@ -16,9 +16,9 @@ public interface NotificationService extends BindingAwareService { * * @param notificationType * @param listener - * @return Registration for listener. To unregister listener invoke {@link Registration#close()} method. + * @return Registration for listener. To unregister listener invoke {@link ListenerRegistration#close()} method. */ - Registration> registerNotificationListener( + ListenerRegistration> registerNotificationListener( Class notificationType, NotificationListener listener); /** @@ -27,8 +27,8 @@ public interface NotificationService extends BindingAwareService { * Listener is registered for all notifications present in implemented interfaces. * * @param listener - * @return Registration for listener. To unregister listener invoke {@link Registration#close()} method. + * @return Registration for listener. To unregister listener invoke {@link ListenerRegistration#close()} method. */ - Registration registerNotificationListener( + ListenerRegistration registerNotificationListener( org.opendaylight.yangtools.yang.binding.NotificationListener listener); } diff --git a/opendaylight/md-sal/sal-binding-broker/pom.xml b/opendaylight/md-sal/sal-binding-broker/pom.xml index 7fc467670d..35b186db6a 100644 --- a/opendaylight/md-sal/sal-binding-broker/pom.xml +++ b/opendaylight/md-sal/sal-binding-broker/pom.xml @@ -82,7 +82,6 @@ org.reflections reflections - 0.9.9-RC1 compile diff --git a/opendaylight/md-sal/sal-binding-dom-it/pom.xml b/opendaylight/md-sal/sal-binding-dom-it/pom.xml index d1354f897f..fd5c5be18d 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/pom.xml +++ b/opendaylight/md-sal/sal-binding-dom-it/pom.xml @@ -48,7 +48,6 @@ org.slf4j slf4j-simple - 1.7.2 test diff --git a/opendaylight/md-sal/sal-binding-it/pom.xml b/opendaylight/md-sal/sal-binding-it/pom.xml index 70847aabea..b8bb891e79 100644 --- a/opendaylight/md-sal/sal-binding-it/pom.xml +++ b/opendaylight/md-sal/sal-binding-it/pom.xml @@ -9,11 +9,9 @@ sal-binding-it - 3.0.0 ../sal-binding-broker/target/jacoco-it.exec ../sal-binding-broker/target/jacoco.exec - 1.5.0 @@ -80,7 +78,6 @@ org.opendaylight.yangtools.thirdparty antlr4-runtime-osgi-nohead - 4.0 @@ -90,7 +87,6 @@ org.opendaylight.yangtools.thirdparty xtend-lib-osgi - 2.4.3 org.openexi @@ -148,7 +144,7 @@ org.eclipse.m2e lifecycle-mapping - 1.0.0 + ${lifecycle.mapping.version} @@ -200,7 +196,6 @@ org.apache.maven.plugins maven-surefire-plugin - 2.14.1 false @@ -232,7 +227,6 @@ org.ops4j.pax.exam maven-paxexam-plugin - 1.2.4 generate-config diff --git a/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalConsumerInstance.java b/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalConsumerInstance.java index 7d7e56dae0..53abd39cde 100644 --- a/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalConsumerInstance.java +++ b/opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalConsumerInstance.java @@ -14,7 +14,6 @@ import org.opendaylight.controller.sal.binding.api.data.DataBrokerService; import org.opendaylight.controller.sal.binding.api.data.DataChangeListener; import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction; import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.concepts.Registration; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.Notification; @@ -72,13 +71,13 @@ public abstract class AbstractBindingSalConsumerInstance Registration> registerNotificationListener( + public ListenerRegistration> registerNotificationListener( Class notificationType, NotificationListener listener) { return getNotificationBrokerChecked().registerNotificationListener(notificationType, listener); } @Override - public Registration registerNotificationListener( + public ListenerRegistration registerNotificationListener( org.opendaylight.yangtools.yang.binding.NotificationListener listener) { return getNotificationBrokerChecked().registerNotificationListener(listener); } diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataBroker.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataBroker.java index 87bbfd3d06..fb429e5fd1 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataBroker.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataBroker.java @@ -10,6 +10,52 @@ package org.opendaylight.controller.md.sal.common.api.data; import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.concepts.Path; +/** + * + * Provides access to a conceptual data tree store. + * + *

+ * Also provides the ability to subscribe for changes to data under a given + * branch of the tree. + * + *

+ * All operations on data tree are performed via one of the transactions: + *

    + *
  • Read-Only - allocated using {@link #newReadOnlyTransaction()} + *
  • Write-Only - allocated using {@link #newWriteOnlyTransaction()} + *
  • Read-Write - allocated using {@link #newReadWriteTransaction()} + *
+ * + *

+ * These transactions provide a stable isolated view of data tree, which is + * guaranteed to be not affected by other concurrent transactions, until + * transaction is committed. + * + *

+ * For a detailed explanation of how transaction are isolated and how transaction-local + * changes are committed to global data tree, see + * {@link AsyncReadTransaction}, {@link AsyncWriteTransaction}, + * {@link AsyncReadWriteTransaction} and {@link AsyncWriteTransaction#commit()}. + * + * + *

+ * It is strongly recommended to use the type of transaction, which + * provides only the minimal capabilities you need. This allows for + * optimizations at the data broker / data store level. For example, + * implementations may optimize the transaction for reading if they know ahead + * of time that you only need to read data - such as not keeping additional meta-data, + * which may be required for write transactions. + * + *

+ * Implementation Note: This interface is not intended to be implemented + * by users of MD-SAL, but only to be consumed by them. + * + * @param

+ * Type of path (subtree identifier), which represents location in + * tree + * @param + * Type of data (payload), which represents data payload + */ public interface AsyncDataBroker

, D, L extends AsyncDataChangeListener> extends // AsyncDataTransactionFactory { @@ -17,52 +63,150 @@ public interface AsyncDataBroker

, D, L extends AsyncDataChange * * Scope of Data Change * + *

* Represents scope of data change (addition, replacement, deletion). * - * The terminology for types is reused from LDAP + * The terminology for scope types is reused from LDAP. + * + *

Examples

+ * + * Following is an example model with comments describing what notifications + * you would receive based on the scope you specify, when you are + * registering for changes on container a. * - * @see http://www.idevelopment.info/data/LDAP/LDAP_Resources/SEARCH_Setting_the_SCOPE_Parameter.shtml + *
+     * container a              // scope BASE, ONE, SUBTREE
+     *    leaf "foo"            // scope ONE, SUBTREE
+     *    container             // scope ONE, SUBTREE
+     *       leaf  "bar"        // scope SUBTREE
+     *    list list             // scope ONE, SUBTREE
+     *      list [a]            // scope SUBTREE
+     *        id "a"            // scope SUBTREE
+     *      list [b]            // scope SUBTREE
+     *        id "b"            // scope SUBTREE
+     * 
+ * + * Following is an example model with comments describing what notifications + * you would receive based on the scope you specify, when you are + * registering for changes on list list (without specifying concrete item in + * the list). + * + *
+     *  list list               // scope BASE, ONE, SUBTREE
+     *      list [a]            // scope ONE, SUBTREE
+     *        id "a"            // scope SUBTREE
+     *      list [b]            // scope ONE, SUBTREE
+     *        id "b"            // scope SUBTREE
+     * 
+ * + * + * @see http://www.idevelopment.info/data/LDAP/LDAP_Resources/ + * SEARCH_Setting_the_SCOPE_Parameter.shtml */ public enum DataChangeScope { - /** - * Represents only a direct change of the node, such as replacement of node, - * addition or deletion. - * - */ - BASE, - /** - * Represent a change (addition,replacement,deletion) - * of the node or one of it's direct childs. - * - */ - ONE, - /** - * Represents a change of the node or any of it's child nodes. - * - */ - SUBTREE + /** + * Represents only a direct change of the node, such as replacement of a + * node, addition or deletion. + * + */ + BASE, + /** + * Represent a change (addition,replacement,deletion) of the node or one + * of its direct children. + * + * This scope is superset of {@link #BASE}. + * + */ + ONE, + /** + * Represents a change of the node or any of or any of its child nodes, + * direct and nested. + * + * This scope is superset of {@link #ONE} and {@link #BASE}. + * + */ + SUBTREE } + /** + * {@inheritDoc} + */ @Override public AsyncReadTransaction newReadOnlyTransaction(); + /** + * {@inheritDoc} + */ @Override - public AsyncReadWriteTransaction newReadWriteTransaction(); + public AsyncReadWriteTransaction newReadWriteTransaction(); + /** + * {@inheritDoc} + */ @Override public AsyncWriteTransaction newWriteOnlyTransaction(); /** - * Registers {@link DataChangeListener} for Data Change callbacks - * which will be triggered on which will be triggered on the store + * Registers a {@link AsyncDataChangeListener} to receive + * notifications when data changes under a given path in the conceptual data + * tree. + *

+ * You are able to register for notifications for any node or subtree + * which can be reached via the supplied path. + *

+ * If path type P allows it, you may specify paths up to the leaf nodes + * then it is possible to listen on leaf nodes. + *

+ * You are able to register for data change notifications for a subtree even + * if it does not exist. You will receive notification once that node is + * created. + *

+ * If there is any preexisting data in data tree on path for which you are + * registering, you will receive initial data change event, which will + * contain all preexisting data, marked as created. + * + *

+ * You are also able to specify the scope of the changes you want to be + * notified. + *

+ * Supported scopes are: + *

    + *
  • {@link DataChangeScope#BASE} - notification events will only be + * triggered when a node referenced by path is created, removed or replaced. + *
  • {@link DataChangeScope#ONE} - notifications events will only be + * triggered when a node referenced by path is created, removed or replaced, + * or any or any of its immediate children are created, updated or removed. + *
  • {@link DataChangeScope#SUBTREE} - notification events will be + * triggered when a node referenced by the path is created, removed + * or replaced or any of the children in its subtree are created, removed + * or replaced. + *
+ * See {@link DataChangeScope} for examples. + *

+ * This method returns a {@link ListenerRegistration} object. To + * "unregister" your listener for changes call the "close" method on this + * returned object. + *

+ * You MUST call close when you no longer need to receive notifications + * (such as during shutdown or for example if your bundle is shutting down). * - * @param store Logical store in which listener is registered. - * @param path Path (subtree identifier) on which client listener will be invoked. - * @param listener Instance of listener which should be invoked on - * @param triggeringScope Scope of change which triggers callback. - * @return Listener registration of the listener, call {@link ListenerRegistration#close()} - * to stop delivery of change events. + * @param store + * Logical Data Store - Logical Datastore you want to listen for + * changes in. For example + * {@link LogicalDatastoreType#OPERATIONAL} or + * {@link LogicalDatastoreType#CONFIGURATION} + * @param path + * Path (subtree identifier) on which client listener will be + * invoked. + * @param listener + * Instance of listener which should be invoked on + * @param triggeringScope + * Scope of change which triggers callback. + * @return Listener registration object, which may be used to unregister + * your listener using {@link ListenerRegistration#close()} to stop + * delivery of change events. */ - ListenerRegistration registerDataChangeListener(LogicalDatastoreType store, P path, L listener, DataChangeScope triggeringScope); + ListenerRegistration registerDataChangeListener(LogicalDatastoreType store, P path, L listener, + DataChangeScope triggeringScope); } diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataChangeEvent.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataChangeEvent.java index f612e51747..29c9bae31f 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataChangeEvent.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataChangeEvent.java @@ -13,63 +13,128 @@ import java.util.Set; import org.opendaylight.yangtools.concepts.Immutable; import org.opendaylight.yangtools.concepts.Path; -public interface AsyncDataChangeEvent

,D> extends Immutable { +/** + * + * An event which contains a capture of changes in a data subtree + * + *

+ * Represents a notification indicating that some data at or under a particular + * path has changed. The notification contains a capture of the changes in the data + * subtree. This event is triggered by successful application of modifications + * from a transaction on the global data tree. Use the + * {@link AsyncDataBroker#registerDataChangeListener(LogicalDatastoreType, Path, AsyncDataChangeListener, AsyncDataBroker.DataChangeScope)} + * method to register a listener for data change events. + * + *

+ * A listener will only receive notifications for changes to data under the path + * they register for. See + * {@link AsyncDataBroker#registerDataChangeListener(LogicalDatastoreType, Path, AsyncDataChangeListener, AsyncDataBroker.DataChangeScope)} + * to learn more about registration scopes. + * + *

+ * The entire subtree under the path will be provided via instance methods of Data + * Change Event even if just a leaf node changes. + * + *

+ * Implementation Note: This interface is not intended to be implemented + * by users of MD-SAL, but only to be consumed by them. + * + * @param

+ * Type of path (subtree identifier), which represents location in + * tree + * @param + * Type of data (payload), which represents data payload + */ +public interface AsyncDataChangeEvent

, D> extends Immutable { /** - * Returns a immutable map of paths and newly created objects + * Returns a map of paths and newly created objects, which were introduced by + * this change into conceptual data tree, if no new objects were introduced + * this map will be empty. + *

+ * This map contains all data tree nodes (and paths to them) which were created + * and are in the scope of listener registration. The data tree nodes + * contain their whole subtree with their current state. * * @return map of paths and newly created objects */ Map getCreatedData(); /** - * Returns a immutable map of paths and respective updated objects after update. - * - * Original state of the object is in - * {@link #getOriginalData()} + * Returns a map of paths and objects which were updated by this change in the + * conceptual data tree if no existing objects were updated + * this map will be empty. + *

+ * This map contains all data tree nodes (and paths to them) which were updated + * and are in the scope of listener registration. The data tree nodes + * contain their whole subtree with their current state. + *

+ * A Node is considered updated if it contents were replaced or one of its + * children was created, removed or updated. + *

+ * Original state of the updated data tree nodes is in + * {@link #getOriginalData()} stored with same path. * * @return map of paths and newly created objects */ Map getUpdatedData(); /** - * Returns a immutable set of removed paths. - * - * Original state of the object is in - * {@link #getOriginalData()} + * Returns an immutable set of removed paths. + *

+ * This set contains the paths to the data tree nodes which are in the scope + * of the listener registration that have been removed. + *

+ * Original state of the removed data tree nodes is in + * {@link #getOriginalData()} stored with same path. * * @return set of removed paths */ Set

getRemovedPaths(); /** - * Return a immutable map of paths and original state of updated and removed objects. + * Returns an immutable map of updated or removed paths and their original + * states prior to this change. * - * This map is populated if at changed path was previous object, and captures - * state of previous object. + *

+ * This map contains the original version of the data tree nodes (and paths + * to them), which are in the scope of the listener registration. * * @return map of paths and original state of updated and removed objects. */ Map getOriginalData(); /** - * Returns a immutable stable view of data state, which - * captures state of data store before the reported change. + * Returns an immutable stable view of data state, which captures the state of + * data store before the reported change. * + *

+ * The view is rooted at the point where the listener, to which the event is + * being delivered, was registered. + *

+ * If listener used a wildcarded path (if supported by path type) during + * registration for change listeners this method returns null, and original + * state can be accessed only via {@link #getOriginalData()} * - * The view is rooted at the point where the listener, to which the event is being delivered, was registered. - * - * @return Stable view of data before the change happened, rooted at the listener registration path. + * @return Stable view of data before the change happened, rooted at the + * listener registration path. * */ D getOriginalSubtree(); /** - * Returns a immutable stable view of data, which captures state of data store - * after the reported change. - * - * The view is rooted at the point where the listener, to which the event is being delivered, was registered. + * Returns an immutable stable view of data, which captures the state of data + * store after the reported change. + *

+ * The view is rooted at the point where the listener, to which the event is + * being delivered, was registered. + *

+ * If listener used a wildcarded path (if supported by path type) during + * registration for change listeners this method returns null, and state + * can be accessed only via {@link #getCreatedData()}, + * {@link #getUpdatedData()}, {@link #getRemovedPaths()} * - * @return Stable view of data after the change happened, rooted at the listener registration path. + * @return Stable view of data after the change happened, rooted at the + * listener registration path. */ D getUpdatedSubtree(); } diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataChangeListener.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataChangeListener.java index 49f07bc52b..dca5200d39 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataChangeListener.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataChangeListener.java @@ -11,13 +11,42 @@ import java.util.EventListener; import org.opendaylight.yangtools.concepts.Path; +/** + * Listener of data change events on particular subtree. + * + *

+ * User-supplied implementations of this listener interface MUST register via + * {@link AsyncDataBroker#registerDataChangeListener(LogicalDatastoreType, Path, AsyncDataChangeListener, AsyncDataBroker.DataChangeScope)} + * in order to start receiving data change events, which capture state changes + * in a subtree. + * + *

+ * Implementation Note: This interface is intended to be implemented + * by users of MD-SAL. + * + * @param

+ * Type of path (subtree identifier), which represents location in + * tree + * @param + * Type of data (payload), which represents data payload + */ public interface AsyncDataChangeListener

, D> extends EventListener { /** - * Note that this method may be invoked from a shared thread pool, so + * + * Invoked when there is data change for the particular path, which was used to + * register this listener. + *

+ * This method may be also invoked during registration of the listener if + * there is any preexisting data in the conceptual data tree for supplied path. + * This initial event will contain all preexisting data as created. + * + *

+ * Note that this method may be invoked from a shared thread pool, so * implementations SHOULD NOT perform CPU-intensive operations and they * definitely MUST NOT invoke any potentially blocking operations. * - * @param change Data Change Event being delivered. + * @param change + * Data Change Event being delivered. */ void onDataChanged(AsyncDataChangeEvent change); } diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataTransactionFactory.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataTransactionFactory.java index 732fed0f3f..cedd883b22 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataTransactionFactory.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataTransactionFactory.java @@ -9,12 +9,110 @@ package org.opendaylight.controller.md.sal.common.api.data; import org.opendaylight.yangtools.concepts.Path; +/** + * A factory which allocates new transactions to operate on the data + * tree. + * + *

+ * Note: This interface is not intended to be used directly, but rather + * via subinterfaces which introduces additional semantics to allocated + * transactions. + *

    + *
  • {@link AsyncDataBroker} + *
  • {@link TransactionChain} + *
+ * + *

+ * All operations on the data tree are performed via one of the transactions: + *

    + *
  • Read-Only - allocated using {@link #newReadOnlyTransaction()} + *
  • Write-Only - allocated using {@link #newWriteOnlyTransaction()} + *
  • Read-Write - allocated using {@link #newReadWriteTransaction()} + *
+ * + *

+ * These transactions provides a stable isolated view of the data tree, which is + * guaranteed to be not affected by other concurrent transactions, until + * transaction is committed. + * + *

+ * For a detailed explanation of how transaction are isolated and how transaction-local + * changes are committed to global data tree, see + * {@link AsyncReadTransaction}, {@link AsyncWriteTransaction}, + * {@link AsyncReadWriteTransaction} and {@link AsyncWriteTransaction#commit()}. + * + *

+ * It is strongly recommended to use the type of transaction, which + * provides only the minimal capabilities you need. This allows for + * optimizations at the data broker / data store level. For example, + * implementations may optimize the transaction for reading if they know ahead + * of time that you only need to read data - such as not keeping additional meta-data, + * which may be required for write transactions. + *

+ * Implementation Note: This interface is not intended to be implemented + * by users of MD-SAL, but only to be consumed by them. + * + * @see AsyncDataBroker + * @see TransactionChain + * + * @param

+ * Type of path (subtree identifier), which represents location in + * tree + * @param + * Type of data (payload), which represents data payload + */ public interface AsyncDataTransactionFactory

, D> { + /** + * Allocates a new read-only transaction which provides an immutable snapshot of + * the data tree. + *

+ * The view of data tree is an immutable snapshot of current data tree state when + * transaction was allocated. + * + * @return new read-only transaction + */ AsyncReadTransaction newReadOnlyTransaction(); + /** + * Allocates new read-write transaction which provides a mutable view of the data + * tree. + * + *

+ * Preconditions for mutation of data tree are captured from the snapshot of + * data tree state, when the transaction is allocated. If data was + * changed during transaction in an incompatible way then the commit of this transaction + * will fail. See {@link AsyncWriteTransaction#commit()} for more + * details about conflicting and not-conflicting changes and + * failure scenarios. + * + * @return new read-write transaction + */ AsyncReadWriteTransaction newReadWriteTransaction(); - AsyncWriteTransaction newWriteOnlyTransaction(); + /** + * Allocates new write-only transaction based on latest state of data + * tree. + * + *

+ * Preconditions for mutation of data tree are captured from the snapshot of + * data tree state, when the transaction is allocated. If data was + * changed during transaction in an incompatible way then the commit of this transaction + * will fail. See {@link AsyncWriteTransaction#commit()} for more + * details about conflicting and not-conflicting changes and + * failure scenarios. + * + *

+ * Since this transaction does not provide a view of the data it SHOULD BE + * used only by callers which are exclusive writers (exporters of data) + * to the subtree they modify. This prevents optimistic + * lock failures as described in {@link AsyncWriteTransaction#commit()}. + *

+ * Exclusivity of writers to particular subtree SHOULD BE enforced by + * external locking mechanism. + * + * @return new write-only transaction + */ + AsyncWriteTransaction newWriteOnlyTransaction(); } diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncReadTransaction.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncReadTransaction.java index 7744f71888..6cf5a5b532 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncReadTransaction.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncReadTransaction.java @@ -12,12 +12,61 @@ import org.opendaylight.yangtools.concepts.Path; import com.google.common.base.Optional; import com.google.common.util.concurrent.ListenableFuture; +/** + * + * Provides a stateful read-only view of the data tree. + * + *

+ * View of the data tree is a stable point-in-time snapshot of the current data tree state when + * the transaction was created. It's state and underlying data tree + * is not affected by other concurrently running transactions. + * + *

+ * Implementation Note: This interface is not intended to be implemented + * by users of MD-SAL, but only to be consumed by them. + * + *

Transaction isolation example

Lest assume initial state of data tree + * for PATH is A. + * + *
+ * txRead = broker.newReadOnlyTransaction();   // read Transaction is snapshot of data
+ * txWrite = broker.newReadWriteTransactoin(); // concurrent write transaction
+ *
+ * txRead.read(OPERATIONAL,PATH).get();        // will return Optional containing A
+ * txWrite = broker.put(OPERATIONAL,PATH,B);   // writes B to PATH
+ *
+ * txRead.read(OPERATIONAL,PATH).get();        // still returns Optional containing A
+ *
+ * txWrite.commit().get();                     // data tree is updated, PATH contains B
+ * txRead.read(OPERATIONAL,PATH).get();        // still returns Optional containing A
+ *
+ * txAfterCommit = broker.newReadOnlyTransaction(); // read Transaction is snapshot of new state
+ * txAfterCommit.read(OPERATIONAL,PATH).get(); // returns Optional containing B;
+ * 
+ * + *

+ * Note: example contains blocking calls on future only to illustrate + * that action happened after other asynchronous action. Use of blocking call + * {@link ListenableFuture#get()} is discouraged for most uses and you should + * use + * {@link com.google.common.util.concurrent.Futures#addCallback(ListenableFuture, com.google.common.util.concurrent.FutureCallback)} + * or other functions from {@link com.google.common.util.concurrent.Futures} to + * register more specific listeners. + * + * @param

+ * Type of path (subtree identifier), which represents location in + * tree + * @param + * Type of data (payload), which represents data payload + */ public interface AsyncReadTransaction

, D> extends AsyncTransaction { /** * - * Reads data from provided logical data store located at provided path - * + * Reads data from provided logical data store located at the provided path. + *

+ * If the target is a subtree, then the whole subtree is read (and will be + * accessible from the returned data object). * * @param store * Logical data store from which read should occur. @@ -26,10 +75,11 @@ public interface AsyncReadTransaction

, D> extends AsyncTransac * read * @return Listenable Future which contains read result *

    - *
  • If data at supplied path exists the {@link Future#get()} - * returns Optional object containing data + *
  • If data at supplied path exists the + * {@link ListeblaFuture#get()} returns Optional object containing + * data once read is done. *
  • If data at supplied path does not exists the - * {@link Future#get()} returns {@link Optional#absent()}. + * {@link ListenbleFuture#get()} returns {@link Optional#absent()}. *
*/ ListenableFuture> read(LogicalDatastoreType store, P path); diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncReadWriteTransaction.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncReadWriteTransaction.java index ce740bf41d..34101366c8 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncReadWriteTransaction.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncReadWriteTransaction.java @@ -10,12 +10,126 @@ package org.opendaylight.controller.md.sal.common.api.data; import org.opendaylight.yangtools.concepts.Path; /** - * Transaction enabling client to have combined transaction, - * which provides read and write capabilities. + * Transaction enabling a client to have a combined read/write capabilities. * + *

+ * The initial state of the write transaction is stable snapshot of current data tree + * state captured when transaction was created and it's state and underlying + * data tree are not affected by other concurrently running transactions. * - * @param

Path Type - * @param Data Type + *

+ * Write transactions are isolated from other concurrent write transactions. All + * writes are local to the transaction and represents only a proposal of state + * change for data tree and it is not visible to any other concurrently running + * transactions. + * + *

+ * Applications publish the changes proposed in the transaction by calling {@link #commit} + * on the transaction. This seals the transaction + * (preventing any further writes using this transaction) and submits it to be + * processed and applied to global conceptual data tree. + * + *

+ * The transaction commit may fail due to a concurrent transaction modifying and committing data in + * an incompatible way. See {@link #commit()} for more concrete commit failure examples. + * + * Implementation Note: This interface is not intended to be implemented + * by users of MD-SAL, but only to be consumed by them. + * + *

Examples

+ * + *

Transaction local state

+ * + * Let assume initial state of data tree for PATH is A + * . + * + *
+ * txWrite = broker.newReadWriteTransaction(); // concurrent write transaction
+ *
+ * txWrite.read(OPERATIONAL,PATH).get()        // will return Optional containing A
+ * txWrite.put(OPERATIONAL,PATH,B);            // writes B to PATH
+ * txWrite.read(OPERATIONAL,PATH).get()        // will return Optional Containing B
+ *
+ * txWrite.commit().get();                     // data tree is updated, PATH contains B
+ *
+ * tx1afterCommit = broker.newReadOnlyTransaction(); // read Transaction is snapshot of new state
+ * tx1afterCommit.read(OPERATIONAL,PATH).get(); // returns Optional containing B
+ * 
+ * + * As you could see read-write transaction provides capabilities as + * {@link AsyncWriteTransaction} but also allows for reading proposed changes as + * if they already happened. + * + *

Transaction isolation (read transaction, read-write transaction)

Let + * assume initial state of data tree for PATH is A. + * + *
+ * txRead = broker.newReadOnlyTransaction();   // read Transaction is snapshot of data
+ * txWrite = broker.newReadWriteTransaction(); // concurrent write transaction
+ *
+ * txRead.read(OPERATIONAL,PATH).get();        // will return Optional containing A
+ * txWrite.read(OPERATIONAL,PATH).get()        // will return Optional containing A
+ *
+ * txWrite.put(OPERATIONAL,PATH,B);            // writes B to PATH
+ * txWrite.read(OPERATIONAL,PATH).get()        // will return Optional Containing B
+ *
+ * txRead.read(OPERATIONAL,PATH).get();        // concurrent read transaction still returns
+ *                                             // Optional containing A
+ *
+ * txWrite.commit().get();                     // data tree is updated, PATH contains B
+ * txRead.read(OPERATIONAL,PATH).get();        // still returns Optional containing A
+ *
+ * tx1afterCommit = broker.newReadOnlyTransaction(); // read Transaction is snapshot of new state
+ * tx1afterCommit.read(OPERATIONAL,PATH).get(); // returns Optional containing B
+ * 
+ * + *

Transaction isolation (2 concurrent read-write transactions)

Let + * assume initial state of data tree for PATH is A. + * + *
+ * tx1 = broker.newReadWriteTransaction(); // read Transaction is snapshot of data
+ * tx2 = broker.newReadWriteTransaction(); // concurrent write transaction
+ *
+ * tx1.read(OPERATIONAL,PATH).get();       // will return Optional containing A
+ * tx2.read(OPERATIONAL,PATH).get()        // will return Optional containing A
+ *
+ * tx2.put(OPERATIONAL,PATH,B);            // writes B to PATH
+ * tx2.read(OPERATIONAL,PATH).get()        // will return Optional Containing B
+ *
+ * tx1.read(OPERATIONAL,PATH).get();       // tx1 read-write transaction still sees Optional
+ *                                         // containing A since is isolated from tx2
+ * tx1.put(OPERATIONAL,PATH,C);            // writes C to PATH
+ * tx1.read(OPERATIONAL,PATH).get()        // will return Optional Containing C
+ *
+ * tx2.read(OPERATIONAL,PATH).get()        // tx2 read-write transaction still sees Optional
+ *                                         // containing B since is isolated from tx1
+ *
+ * tx2.commit().get();                     // data tree is updated, PATH contains B
+ * tx1.read(OPERATIONAL,PATH).get();       // still returns Optional containing C since is isolated from tx2
+ *
+ * tx1afterCommit = broker.newReadOnlyTransaction(); // read Transaction is snapshot of new state
+ * tx1afterCommit.read(OPERATIONAL,PATH).get(); // returns Optional containing B
+ *
+ * tx1.commit()                            // Will fail with OptimisticLockFailedException
+ *                                         // which means concurrent transaction changed the same PATH
+ *
+ * 
+ * + *

+ * Note: examples contains blocking calls on future only to illustrate + * that action happened after other asynchronous action. Use of blocking call + * {@link com.google.common.util.concurrent.ListenableFuture#get()} is discouraged for most uses and you should + * use + * {@link com.google.common.util.concurrent.Futures#addCallback(com.google.common.util.concurrent.ListenableFuture, com.google.common.util.concurrent.FutureCallback)} + * or other functions from {@link com.google.common.util.concurrent.Futures} to + * register more specific listeners. + * + * + * @param

+ * Type of path (subtree identifier), which represents location in + * tree + * @param + * Type of data (payload), which represents data payload */ public interface AsyncReadWriteTransaction

, D> extends AsyncReadTransaction, AsyncWriteTransaction { diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncTransaction.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncTransaction.java index 23ca275ef2..c7cc91528b 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncTransaction.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncTransaction.java @@ -13,7 +13,17 @@ import org.opendaylight.yangtools.concepts.Path; /** * - * @author + * A common parent for all transactions which operate on a conceptual data tree. + * + * See derived transaction types for more concrete behavior: + *

    + *
  • {@link AsyncReadTransaction} - Read capabilities, user is able to read data from data tree
  • + *
  • {@link AsyncWriteTransaction} - Write capabilities, user is able to propose changes to data tree
  • + *
  • {@link AsyncReadWriteTransaction} - Read and Write capabilities, user is able to read state and to propose changes of state.
  • + *
+ * + * Implementation Note: This interface is not intended to be implemented + * by users of MD-SAL. * * @param

Type of path (subtree identifier), which represents location in tree * @param Type of data (payload), which represents data payload diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncWriteTransaction.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncWriteTransaction.java index 82c48d2ddb..e2734eaddc 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncWriteTransaction.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncWriteTransaction.java @@ -13,56 +13,118 @@ import org.opendaylight.yangtools.yang.common.RpcResult; import com.google.common.util.concurrent.ListenableFuture; -public interface AsyncWriteTransaction

, D> extends AsyncTransaction { +/** + * Write transaction provides mutation capabilities for a data tree. + * + *

+ * Initial state of write transaction is a stable snapshot of the current data tree. + * The state is captured when the transaction is created and its state and underlying + * data tree are not affected by other concurrently running transactions. + *

+ * Write transactions are isolated from other concurrent write transactions. All + * writes are local to the transaction and represent only a proposal of state + * change for the data tree and it is not visible to any other concurrently running + * transaction. + *

+ * Applications publish the changes proposed in the transaction by calling {@link #commit} + * on the transaction. This seals the transaction + * (preventing any further writes using this transaction) and submits it to be + * processed and applied to global conceptual data tree. + *

+ * The transaction commit may fail due to a concurrent transaction modifying and committing data in + * an incompatible way. See {@link #commit()} for more concrete commit failure examples. + * + * + *

+ * Implementation Note: This interface is not intended to be implemented + * by users of MD-SAL, but only to be consumed by them. + * + * @param

+ * Type of path (subtree identifier), which represents location in + * tree + * @param + * Type of data (payload), which represents data payload + */ +public interface AsyncWriteTransaction

, D> extends AsyncTransaction { /** - * Cancels transaction. + * Cancels the transaction. * - * Transaction could be only cancelled if it's status - * is {@link TransactionStatus#NEW} or {@link TransactionStatus#SUBMITED} + * Transactions can only be cancelled if it's status is + * {@link TransactionStatus#NEW} or {@link TransactionStatus#SUBMITED} * - * Invoking cancel() on {@link TransactionStatus#FAILED} or {@link TransactionStatus#CANCELED} - * will have no effect. + * Invoking cancel() on {@link TransactionStatus#FAILED} or + * {@link TransactionStatus#CANCELED} will have no effect. * - * @throws IllegalStateException If transaction status is {@link TransactionStatus#COMMITED} + * @throws IllegalStateException + * If transaction status is {@link TransactionStatus#COMMITED} * */ public void cancel(); /** - * Store a piece of data at specified path. This acts as a add / replace operation, - * which is to say that whole subtree will be replaced by specified path. + * Store a piece of data at specified path. This acts as an add / replace + * operation, which is to say that whole subtree will be replaced by + * specified path. Performing the following put operations: + * + *

+     * 1) container { list [ a ] }
+     * 2) container { list [ b ] }
+     * 
+ * + * will result in the following data being present: + * + *
+     * container { list [ b ] }
+     * 
* - * If you need add or merge of current object with specified use {@link #merge(LogicalDatastoreType, Path, Object)} * - * @param store Logical data store which should be modified - * @param path Data object path - * @param data Data object to be written to specified path - * @throws IllegalStateException if the transaction is no longer {@link TransactionStatus#NEW} + * If you need to make sure that a parent object exists, but you do not want modify + * its preexisting state by using put, consider using + * {@link #merge(LogicalDatastoreType, Path, Object)} + * + * @param store + * Logical data store which should be modified + * @param path + * Data object path + * @param data + * Data object to be written to specified path + * @throws IllegalStateException + * if the transaction is no longer {@link TransactionStatus#NEW} */ public void put(LogicalDatastoreType store, P path, D data); /** - * Store a piece of data at specified path. This acts as a merge operation, + * Store a piece of data at the specified path. This acts as a merge operation, * which is to say that any pre-existing data which is not explicitly * overwritten will be preserved. This means that if you store a container, - * its child lists will be merged. Performing the following put operations: + * its child lists will be merged. Performing the following merge + * operations: * + *
      * 1) container { list [ a ] }
      * 2) container { list [ b ] }
+     * 
* * will result in the following data being present: * + *
      * container { list [ a, b ] }
+     * 
* - * This also means that storing the container will preserve any augmentations - * which have been attached to it. - * - * If you require an explicit replace operation, use {@link #put(LogicalDatastoreType, Path, Object)} instead. + * This also means that storing the container will preserve any + * augmentations which have been attached to it. + *

+ * If you require an explicit replace operation, use + * {@link #put(LogicalDatastoreType, Path, Object)} instead. * - * @param store Logical data store which should be modified - * @param path Data object path - * @param data Data object to be written to specified path - * @throws IllegalStateException if the transaction is no longer {@link TransactionStatus#NEW} + * @param store + * Logical data store which should be modified + * @param path + * Data object path + * @param data + * Data object to be written to specified path + * @throws IllegalStateException + * if the transaction is no longer {@link TransactionStatus#NEW} */ public void merge(LogicalDatastoreType store, P path, D data); @@ -70,9 +132,12 @@ public interface AsyncWriteTransaction

, D> extends AsyncTrans * Remove a piece of data from specified path. This operation does not fail * if the specified path does not exist. * - * @param store Logical data store which should be modified - * @param path Data object path - * @throws IllegalStateException if the transaction is no longer {@link TransactionStatus#NEW} + * @param store + * Logical data store which should be modified + * @param path + * Data object path + * @throws IllegalStateException + * if the transaction is no longer {@link TransactionStatus#NEW} */ public void delete(LogicalDatastoreType store, P path); @@ -80,41 +145,169 @@ public interface AsyncWriteTransaction

, D> extends AsyncTrans * * Closes transaction and resources allocated to the transaction. * - * This call does not change Transaction status. Client SHOULD - * explicitly {@link #commit()} or {@link #cancel()} transaction. + * This call does not change Transaction status. Client SHOULD explicitly + * {@link #commit()} or {@link #cancel()} transaction. * - * @throws IllegalStateException if the transaction has not been - * updated by invoking {@link #commit()} or {@link #cancel()}. + * @throws IllegalStateException + * if the transaction has not been updated by invoking + * {@link #commit()} or {@link #cancel()}. */ @Override public void close(); /** - * Initiates a commit of modification. This call logically seals the - * transaction, preventing any the client from interacting with the - * data stores. The transaction is marked as {@link TransactionStatus#SUBMITED} - * and enqueued into the data store backed for processing. + * Submits transaction to be applied to update logical data tree. + *

+ * This call logically seals the transaction, which prevents the client from + * further changing data tree using this transaction. Any subsequent calls to + * {@link #put(LogicalDatastoreType, Path, Object)}, + * {@link #merge(LogicalDatastoreType, Path, Object)} or + * {@link #delete(LogicalDatastoreType, Path)} will fail with + * {@link IllegalStateException}. + * + * The transaction is marked as {@link TransactionStatus#SUBMITED} and + * enqueued into the data store backed for processing. * *

- * The successful commit changes the state of the system and may affect - * several components. + * Whether or not the commit is successful is determined by versioning + * of data tree and validation of registered commit participants + * {@link AsyncConfigurationCommitHandler} + * if transaction changes {@link LogicalDatastoreType#CONFIGURATION} data tree. + *

+ * The effects of successful commit of data depends on + * other data change listeners {@link AsyncDataChangeListener} and + * {@link AsyncConfigurationCommitHandler}, which was registered to the + * same {@link AsyncDataBroker}, to which this transaction belongs. * + *

Failure scenarios

*

- * The effects of successful commit of data are described in the - * specifications and YANG models describing the Provider components of - * controller. It is assumed that Consumer has an understanding of this - * changes. - * - * @see DataCommitHandler for further information how two-phase commit is - * processed. - * @param store Identifier of the store, where commit should occur. + * Transaction may fail because of multiple reasons, such as + *

    + *
  • Another transaction finished earlier and modified the same node in + * non-compatible way (see below). In this case the returned future will fail with + * {@link OptimisticLockFailedException}. It is the responsibility of the + * caller to create a new transaction and submit the same modification again in + * order to update data tree.
  • + *
  • Data change introduced by this transaction did not pass validation by + * commit handlers or data was incorrectly structured. Returned future will + * fail with {@link DataValidationFailedException}. User should not retry to + * create new transaction with same data, since it probably will fail again. + *
  • + *
+ * + *

Change compatibility

+ * + * There are several sets of changes which could be considered incompatible + * between two transactions which are derived from same initial state. + * Rules for conflict detection applies recursively for each subtree + * level. + * + *

Change compatibility of leafs, leaf-list items

+ * + * Following table shows state changes and failures between two concurrent transactions, + * which are based on same initial state, Tx 1 completes successfully + * before Tx 2 is submitted. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Initial stateTx 1Tx 2Result
Emptyput(A,1)put(A,2)Tx 2 will fail, state is A=1
Emptyput(A,1)merge(A,2)A=2
Emptymerge(A,1)put(A,2)Tx 2 will fail, state is A=1
Emptymerge(A,1)merge(A,2)A=2
A=0put(A,1)put(A,2)Tx 2 will fail, A=1
A=0put(A,1)merge(A,2)A=2
A=0merge(A,1)put(A,2)Tx 2 will fail, A=1
A=0merge(A,1)merge(A,2)A=2
A=0delete(A)put(A,2)Tx 2 will fail, A does not exists
A=0delete(A)merge(A,2)A=2
+ * + *

Change compatibility of subtrees

+ * + * Following table shows state changes and failures between two concurrent transactions, + * which are based on same initial state, Tx 1 completes successfully + * before Tx 2 is submitted. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Initial stateTx 1Tx 2Result
Emptyput(TOP,[])put(TOP,[])Tx 2 will fail, state is TOP=[]
Emptyput(TOP,[])merge(TOP,[])TOP=[]
Emptyput(TOP,[FOO=1])put(TOP,[BAR=1])Tx 2 will fail, state is TOP=[FOO=1]
Emptyput(TOP,[FOO=1])merge(TOP,[BAR=1])TOP=[FOO=1,BAR=1]
Emptymerge(TOP,[FOO=1])put(TOP,[BAR=1])Tx 2 will fail, state is TOP=[FOO=1]
Emptymerge(TOP,[FOO=1])merge(TOP,[BAR=1])TOP=[FOO=1,BAR=1]
TOP=[]put(TOP,[FOO=1])put(TOP,[BAR=1])Tx 2 will fail, state is TOP=[FOO=1]
TOP=[]put(TOP,[FOO=1])merge(TOP,[BAR=1])state is TOP=[FOO=1,BAR=1]
TOP=[]merge(TOP,[FOO=1])put(TOP,[BAR=1])Tx 2 will fail, state is TOP=[FOO=1]
TOP=[]merge(TOP,[FOO=1])merge(TOP,[BAR=1])state is TOP=[FOO=1,BAR=1]
TOP=[]delete(TOP)put(TOP,[BAR=1])Tx 2 will fail, state is empty store
TOP=[]delete(TOP)merge(TOP,[BAR=1])state is TOP=[BAR=1]
TOP=[]put(TOP/FOO,1)put(TOP/BAR,1])state is TOP=[FOO=1,BAR=1]
TOP=[]put(TOP/FOO,1)merge(TOP/BAR,1)state is TOP=[FOO=1,BAR=1]
TOP=[]merge(TOP/FOO,1)put(TOP/BAR,1)state is TOP=[FOO=1,BAR=1]
TOP=[]merge(TOP/FOO,1)merge(TOP/BAR,1)state is TOP=[FOO=1,BAR=1]
TOP=[]delete(TOP)put(TOP/BAR,1)Tx 2 will fail, state is empty store
TOP=[]delete(TOP)merge(TOP/BAR,1]Tx 2 will fail, state is empty store
TOP=[FOO=1]put(TOP/FOO,2)put(TOP/BAR,1)state is TOP=[FOO=2,BAR=1]
TOP=[FOO=1]put(TOP/FOO,2)merge(TOP/BAR,1)state is TOP=[FOO=2,BAR=1]
TOP=[FOO=1]merge(TOP/FOO,2)put(TOP/BAR,1)state is TOP=[FOO=2,BAR=1]
TOP=[FOO=1]merge(TOP/FOO,2)merge(TOP/BAR,1)state is TOP=[FOO=2,BAR=1]
TOP=[FOO=1]delete(TOP/FOO)put(TOP/BAR,1)state is TOP=[BAR=1]
TOP=[FOO=1]delete(TOP/FOO)merge(TOP/BAR,1]state is TOP=[BAR=1]
+ * + * + *

Examples of failure scenarios

+ * + *

Conflict of two transactions

+ * + * This example illustrates two concurrent transactions, which derived from + * same initial state of data tree and proposes conflicting modifications. + * + *
+     * txA = broker.newWriteTransaction(); // allocates new transaction, data tree is empty
+     * txB = broker.newWriteTransaction(); // allocates new transaction, data tree is empty
+     *
+     * txA.put(CONFIGURATION, PATH, A);    // writes to PATH value A
+     * txB.put(CONFIGURATION, PATH, B)     // writes to PATH value B
+     *
+     * ListenableFuture futureA = txA.commit(); // transaction A is sealed and committed
+     * ListenebleFuture futureB = txB.commit(); // transaction B is sealed and committed
+     * 
+ * + * Commit of transaction A will be processed asynchronously and data tree + * will be updated to contain value A for PATH. + * Returned {@link ListenableFuture} will successfully complete once + * state is applied to data tree. + * + * Commit of Transaction B will fail, because previous transaction also + * modified path in a concurrent way. The state introduced by transaction B + * will not be applied. Returned {@link ListenableFuture} object will fail + * with {@link OptimisticLockFailedException} exception, which indicates to + * client that concurrent transaction prevented the submitted transaction from being + * applied. + * * @return Result of the Commit, containing success information or list of * encountered errors, if commit was not successful. The Future * blocks until {@link TransactionStatus#COMMITED} is reached. - * Future will fail with {@link TransactionCommitFailedException} - * if Commit of this transaction failed. + * Future will fail with {@link TransactionCommitFailedException} if + * Commit of this transaction failed. TODO: Usability: Consider + * change from ListenableFuture to + * {@link com.google.common.util.concurrent.CheckedFuture} which + * will throw {@link TransactionCommitFailedException}. * - * @throws IllegalStateException if the transaction is not {@link TransactionStatus#NEW} + * @throws IllegalStateException + * if the transaction is not {@link TransactionStatus#NEW} */ public ListenableFuture> commit(); diff --git a/opendaylight/md-sal/sal-common-impl/pom.xml b/opendaylight/md-sal/sal-common-impl/pom.xml index 6b387b5a61..82bd716c59 100644 --- a/opendaylight/md-sal/sal-common-impl/pom.xml +++ b/opendaylight/md-sal/sal-common-impl/pom.xml @@ -40,6 +40,11 @@ mockito-all test
+ + org.opendaylight.yangtools + yang-parser-impl + test +
diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizationOperation.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizationOperation.java index a7c6b0c66f..7ce475dd59 100644 --- a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizationOperation.java +++ b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizationOperation.java @@ -10,6 +10,10 @@ package org.opendaylight.controller.md.sal.common.impl.util.compat; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; +import com.google.common.base.Optional; +import com.google.common.collect.FluentIterable; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; import java.util.Collections; import java.util.HashSet; import java.util.List; @@ -17,7 +21,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; - import org.opendaylight.yangtools.concepts.Identifiable; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.CompositeNode; @@ -28,12 +31,15 @@ import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument; import org.opendaylight.yangtools.yang.data.api.Node; import org.opendaylight.yangtools.yang.data.api.SimpleNode; +import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode; import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; 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.DataContainerNodeAttrBuilder; +import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeAttrBuilder; import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeContainerBuilder; +import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode; import org.opendaylight.yangtools.yang.model.api.AugmentationSchema; import org.opendaylight.yangtools.yang.model.api.AugmentationTarget; import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode; @@ -45,11 +51,6 @@ import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode; import org.opendaylight.yangtools.yang.model.api.ListSchemaNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; -import com.google.common.base.Optional; -import com.google.common.collect.FluentIterable; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; - public abstract class DataNormalizationOperation implements Identifiable { private final T identifier; @@ -612,6 +613,42 @@ public abstract class DataNormalizationOperation impleme } } + private static class AnyXmlNormalization extends DataNormalizationOperation { + + protected AnyXmlNormalization( NodeIdentifier identifier ) { + super( identifier ); + } + + @Override + public DataNormalizationOperation getChild( PathArgument child ) throws DataNormalizationException { + return null; + } + + @Override + public DataNormalizationOperation getChild( QName child ) throws DataNormalizationException { + return null; + } + + @Override + public NormalizedNode normalize( Node legacyData ) { + NormalizedNodeAttrBuilder, AnyXmlNode> builder = + Builders.anyXmlBuilder().withNodeIdentifier( + new NodeIdentifier( legacyData.getNodeType() ) ); + builder.withValue(legacyData); + return builder.build(); + } + + @Override + public boolean isLeaf() { + return false; + } + + @Override + public NormalizedNode createDefault( PathArgument currentArg ) { + return null; + } + } + private static final Optional findChildSchemaNode(final DataNodeContainer parent,final QName child) { DataSchemaNode potential = parent.getDataChildByName(child); if (potential == null) { @@ -712,6 +749,8 @@ public abstract class DataNormalizationOperation impleme return new ChoiceNodeNormalization((org.opendaylight.yangtools.yang.model.api.ChoiceNode) potential); } else if (potential instanceof LeafListSchemaNode) { return fromLeafListSchemaNode((LeafListSchemaNode) potential); + } else if (potential instanceof AnyXmlSchemaNode) { + return new AnyXmlNormalization( new NodeIdentifier(potential.getQName() ) ); } return null; } diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizer.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizer.java index f30c8ddcaa..ec8ce6ecd5 100644 --- a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizer.java +++ b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizer.java @@ -9,11 +9,15 @@ package org.opendaylight.controller.md.sal.common.impl.util.compat; import static com.google.common.base.Preconditions.checkArgument; +import com.google.common.base.Preconditions; +import com.google.common.base.Predicates; +import com.google.common.collect.FluentIterable; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Iterables; import java.util.AbstractMap; import java.util.ArrayList; import java.util.Iterator; import java.util.Map; - import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.CompositeNode; import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; @@ -21,6 +25,7 @@ import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.AugmentationI import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument; import org.opendaylight.yangtools.yang.data.api.Node; import org.opendaylight.yangtools.yang.data.api.SimpleNode; +import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode; import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; import org.opendaylight.yangtools.yang.data.api.schema.MixinNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; @@ -31,12 +36,6 @@ import org.opendaylight.yangtools.yang.data.impl.SimpleNodeTOImpl; import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder; import org.opendaylight.yangtools.yang.model.api.SchemaContext; -import com.google.common.base.Preconditions; -import com.google.common.base.Predicates; -import com.google.common.collect.FluentIterable; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; - public class DataNormalizer { private final DataNormalizationOperation operation; @@ -134,6 +133,9 @@ public class DataNormalizer { // DataContainerNode,"Node object %s, %s should be of type DataContainerNode",normalizedPath,normalizedData); if (normalizedData instanceof DataContainerNode) { return toLegacyFromDataContainer((DataContainerNode) normalizedData); + } else if (normalizedData instanceof AnyXmlNode) { + Node value = ((AnyXmlNode) normalizedData).getValue(); + return value instanceof CompositeNode ? (CompositeNode)value : null; } return null; } @@ -150,6 +152,8 @@ public class DataNormalizer { if (node instanceof DataContainerNode) { return toLegacyFromDataContainer((DataContainerNode) node); + } else if (node instanceof AnyXmlNode) { + return ((AnyXmlNode) node).getValue(); } return toLegacySimple(node); diff --git a/opendaylight/md-sal/sal-common-impl/src/test/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizerTest.java b/opendaylight/md-sal/sal-common-impl/src/test/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizerTest.java new file mode 100644 index 0000000000..ddf089c68f --- /dev/null +++ b/opendaylight/md-sal/sal-common-impl/src/test/java/org/opendaylight/controller/md/sal/common/impl/util/compat/DataNormalizerTest.java @@ -0,0 +1,768 @@ +/* + * Copyright (c) 2014 Brocade Communications Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.md.sal.common.impl.util.compat; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import java.util.AbstractMap; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import org.junit.Test; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.data.api.CompositeNode; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.AugmentationIdentifier; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeWithValue; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument; +import org.opendaylight.yangtools.yang.data.api.Node; +import org.opendaylight.yangtools.yang.data.api.SimpleNode; +import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode; +import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode; +import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; +import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; +import org.opendaylight.yangtools.yang.data.api.schema.LeafNode; +import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode; +import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode; +import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; +import org.opendaylight.yangtools.yang.data.api.schema.MapNode; +import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; +import org.opendaylight.yangtools.yang.data.api.schema.OrderedLeafSetNode; +import org.opendaylight.yangtools.yang.data.api.schema.OrderedMapNode; +import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode; +import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode; +import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode; +import org.opendaylight.yangtools.yang.data.impl.NodeFactory; +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.ListNodeBuilder; +import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder; +import org.opendaylight.yangtools.yang.model.api.Module; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; +import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl; + +public class DataNormalizerTest { + + static class NormalizedNodeData { + PathArgument nodeID; + Class nodeClass; + Object nodeData; // List for a container, value Object for a leaf + + NormalizedNodeData(PathArgument nodeID, Class nodeClass, Object nodeData) { + this.nodeID = nodeID; + this.nodeClass = nodeClass; + this.nodeData = nodeData; + } + } + + static class LegacyNodeData { + QName nodeKey; + Object nodeData; // List for a CompositeNode, value Object for a + // SimpeNode + + LegacyNodeData(QName nodeKey, Object nodeData) { + this.nodeKey = nodeKey; + this.nodeData = nodeData; + } + + @Override + public String toString() { + return nodeKey.toString(); + } + } + + static final QName TEST_QNAME = QName.create( + "urn:opendaylight:params:xml:ns:yang:controller:md:sal:normalization:test", "2014-03-13", "test"); + static final QName OUTER_LIST_QNAME = QName.create(TEST_QNAME, "outer-list"); + static final QName INNER_LIST_QNAME = QName.create(TEST_QNAME, "inner-list"); + static final QName OUTER_CHOICE_QNAME = QName.create(TEST_QNAME, "outer-choice"); + static final QName ID_QNAME = QName.create(TEST_QNAME, "id"); + static final QName NAME_QNAME = QName.create(TEST_QNAME, "name"); + static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value"); + + static final InstanceIdentifier TEST_PATH = InstanceIdentifier.of(TEST_QNAME); + static final InstanceIdentifier OUTER_LIST_PATH = InstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME) + .build(); + static final QName ONE_QNAME = QName.create(TEST_QNAME, "one"); + static final QName TWO_QNAME = QName.create(TEST_QNAME, "two"); + static final QName THREE_QNAME = QName.create(TEST_QNAME, "three"); + + static final QName ANY_XML_DATA_QNAME = QName.create(TEST_QNAME, "any-xml-data"); + static final QName OUTER_CONTAINER_QNAME = QName.create(TEST_QNAME, "outer-container"); + static final QName AUGMENTED_LEAF_QNAME = QName.create(TEST_QNAME, "augmented-leaf"); + static final QName UNKEYED_LIST_QNAME = QName.create(TEST_QNAME, "unkeyed-list"); + static final QName UNORDERED_LEAF_LIST_QNAME = QName.create(TEST_QNAME, "unordered-leaf-list"); + static final QName ORDERED_LEAF_LIST_QNAME = QName.create(TEST_QNAME, "ordered-leaf-list"); + + static final Short OUTER_LIST_ID = (short) 10; + + static final InstanceIdentifier OUTER_LIST_PATH_LEGACY = InstanceIdentifier.builder(TEST_QNAME) + .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, OUTER_LIST_ID).build(); + + static final InstanceIdentifier LEAF_TWO_PATH_LEGACY = InstanceIdentifier.builder(OUTER_LIST_PATH_LEGACY) + .node(TWO_QNAME).build(); + + static final QName ANY_XML_LEAF_QNAME = QName.create(TEST_QNAME, "leaf");; + static final QName ANY_XML_INNER_QNAME = QName.create(TEST_QNAME, "inner"); + static final QName ANY_XML_INNER_LEAF_QNAME = QName.create(TEST_QNAME, "inner-leaf"); + + SchemaContext createTestContext() { + YangParserImpl parser = new YangParserImpl(); + Set modules = parser.parseYangModelsFromStreams(Collections.singletonList(DataNormalizerTest.class + .getResourceAsStream("/normalization-test.yang"))); + return parser.resolveSchemaContext(modules); + } + + @Test + public void testToNormalizedInstanceIdentifier() { + SchemaContext testCtx = createTestContext(); + DataNormalizer normalizer = new DataNormalizer(testCtx); + + InstanceIdentifier normalizedPath = normalizer.toNormalized(LEAF_TWO_PATH_LEGACY); + + verifyNormalizedInstanceIdentifier(normalizedPath, TEST_QNAME, OUTER_LIST_QNAME, new Object[] { + OUTER_LIST_QNAME, ID_QNAME, OUTER_LIST_ID }, OUTER_CHOICE_QNAME, TWO_QNAME); + } + + private void verifyNormalizedInstanceIdentifier(InstanceIdentifier actual, Object... expPath) { + + assertNotNull("Actual InstanceIdentifier is null", actual); + assertEquals("InstanceIdentifier path length", expPath.length, actual.getPath().size()); + + for (int i = 0; i < expPath.length; i++) { + PathArgument actualArg = actual.getPath().get(i); + if (expPath[i] instanceof Object[]) { // NodeIdentifierWithPredicates + Object[] exp = (Object[]) expPath[i]; + assertEquals("Actual path arg " + (i + 1) + " class", NodeIdentifierWithPredicates.class, + actualArg.getClass()); + NodeIdentifierWithPredicates actualNode = (NodeIdentifierWithPredicates) actualArg; + assertEquals("Actual path arg " + (i + 1) + " node type", exp[0], actualNode.getNodeType()); + assertEquals("Actual path arg " + (i + 1) + " key values map size", 1, actualNode.getKeyValues().size()); + Entry keyValuesEntry = actualNode.getKeyValues().entrySet().iterator().next(); + assertEquals("Actual path arg " + (i + 1) + " key values map key", exp[1], keyValuesEntry.getKey()); + assertEquals("Actual path arg " + (i + 1) + " key values map value", exp[2], keyValuesEntry.getValue()); + } else if (expPath[i] instanceof Set) { // AugmentationIdentifier + assertEquals("Actual path arg " + (i + 1) + " class", AugmentationIdentifier.class, + actualArg.getClass()); + AugmentationIdentifier actualNode = (AugmentationIdentifier) actualArg; + assertEquals("Actual path arg " + (i + 1) + " PossibleChildNames", expPath[i], + actualNode.getPossibleChildNames()); + } else { + assertEquals("Actual path arg " + (i + 1) + " node type", expPath[i], actualArg.getNodeType()); + } + } + } + + @Test + public void testToLegacyInstanceIdentifier() throws DataNormalizationException { + + DataNormalizer normalizer = new DataNormalizer(createTestContext()); + + InstanceIdentifier normalized = InstanceIdentifier.builder().node(TEST_QNAME).node(OUTER_LIST_QNAME) + .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, OUTER_LIST_ID).node(OUTER_CHOICE_QNAME).node(TWO_QNAME) + .build(); + + InstanceIdentifier legacy = normalizer.toLegacy(normalized); + + assertEquals("Legacy InstanceIdentifier", LEAF_TWO_PATH_LEGACY, legacy); + } + + @Test + public void testToLegacyNormalizedNode() { + + ChoiceNode choiceNode1 = Builders.choiceBuilder().withNodeIdentifier(new NodeIdentifier(OUTER_CHOICE_QNAME)) + .withChild(ImmutableNodes.leafNode(TWO_QNAME, "two")) + .withChild(ImmutableNodes.leafNode(THREE_QNAME, "three")).build(); + + MapEntryNode innerListEntryNode1 = Builders.mapEntryBuilder() + .withNodeIdentifier(new NodeIdentifierWithPredicates(INNER_LIST_QNAME, NAME_QNAME, "inner-name1")) + .withChild(ImmutableNodes.leafNode(NAME_QNAME, "inner-name1")) + .withChild(ImmutableNodes.leafNode(VALUE_QNAME, "inner-value1")).build(); + + MapEntryNode innerListEntryNode2 = Builders.mapEntryBuilder() + .withNodeIdentifier(new NodeIdentifierWithPredicates(INNER_LIST_QNAME, NAME_QNAME, "inner-name2")) + .withChild(ImmutableNodes.leafNode(NAME_QNAME, "inner-name2")) + .withChild(ImmutableNodes.leafNode(VALUE_QNAME, "inner-value2")).build(); + + OrderedMapNode innerListNode = Builders.orderedMapBuilder() + .withNodeIdentifier(new NodeIdentifier(INNER_LIST_QNAME)).withChild(innerListEntryNode1) + .withChild(innerListEntryNode2).build(); + + Short outerListID1 = Short.valueOf((short) 10); + MapEntryNode outerListEntryNode1 = Builders.mapEntryBuilder() + .withNodeIdentifier(new NodeIdentifierWithPredicates(OUTER_LIST_QNAME, ID_QNAME, outerListID1)) + .withChild(ImmutableNodes.leafNode(ID_QNAME, outerListID1)).withChild(choiceNode1) + .withChild(innerListNode).build(); + + ChoiceNode choiceNode2 = Builders.choiceBuilder().withNodeIdentifier(new NodeIdentifier(OUTER_CHOICE_QNAME)) + .withChild(ImmutableNodes.leafNode(ONE_QNAME, "one")).build(); + + Short outerListID2 = Short.valueOf((short) 20); + MapEntryNode outerListEntryNode2 = Builders.mapEntryBuilder() + .withNodeIdentifier(new NodeIdentifierWithPredicates(OUTER_LIST_QNAME, ID_QNAME, outerListID2)) + .withChild(ImmutableNodes.leafNode(ID_QNAME, outerListID2)).withChild(choiceNode2).build(); + + MapNode outerListNode = Builders.mapBuilder().withNodeIdentifier(new NodeIdentifier(OUTER_LIST_QNAME)) + .withChild(outerListEntryNode1).withChild(outerListEntryNode2).build(); + + UnkeyedListEntryNode unkeyedListEntryNode1 = Builders.unkeyedListEntryBuilder() + .withNodeIdentifier(new NodeIdentifier(UNKEYED_LIST_QNAME)) + .withChild(ImmutableNodes.leafNode(NAME_QNAME, "unkeyed1")).build(); + + UnkeyedListEntryNode unkeyedListEntryNode2 = Builders.unkeyedListEntryBuilder() + .withNodeIdentifier(new NodeIdentifier(UNKEYED_LIST_QNAME)) + .withChild(ImmutableNodes.leafNode(NAME_QNAME, "unkeyed2")).build(); + + UnkeyedListNode unkeyedListNode = Builders.unkeyedListBuilder() + .withNodeIdentifier(new NodeIdentifier(UNKEYED_LIST_QNAME)).withChild(unkeyedListEntryNode1) + .withChild(unkeyedListEntryNode2).build(); + + ContainerNode testContainerNode = Builders.containerBuilder() + .withNodeIdentifier(new NodeIdentifier(TEST_QNAME)).withChild(outerListNode).withChild(unkeyedListNode) + .build(); + + Node legacyNode = DataNormalizer.toLegacy(testContainerNode); + + verifyLegacyNode( + legacyNode, + expectCompositeNode( + TEST_QNAME, + expectCompositeNode( + OUTER_LIST_QNAME, + expectSimpleNode(ID_QNAME, outerListID1), + expectSimpleNode(TWO_QNAME, "two"), + expectSimpleNode(THREE_QNAME, "three"), + + expectCompositeNode(INNER_LIST_QNAME, expectSimpleNode(NAME_QNAME, "inner-name1"), + expectSimpleNode(VALUE_QNAME, "inner-value1")), + + expectCompositeNode(INNER_LIST_QNAME, expectSimpleNode(NAME_QNAME, "inner-name2"), + expectSimpleNode(VALUE_QNAME, "inner-value2"))), + expectCompositeNode(OUTER_LIST_QNAME, expectSimpleNode(ID_QNAME, outerListID2), + expectSimpleNode(ONE_QNAME, "one")), + expectCompositeNode(UNKEYED_LIST_QNAME, expectSimpleNode(NAME_QNAME, "unkeyed1")), + expectCompositeNode(UNKEYED_LIST_QNAME, expectSimpleNode(NAME_QNAME, "unkeyed2")))); + + // Conversion of Mixin type nodes is not supported. + + assertNull("Expected null returned for Mixin type node", DataNormalizer.toLegacy(outerListNode)); + } + + /** + * Following data are constructed: + * inner-leaf-value + * leaf-value + */ + @Test + public void testToLegacyNormalizedNodeWithAnyXml() { + + Node innerLeafChild = NodeFactory.createImmutableSimpleNode(ANY_XML_INNER_LEAF_QNAME, null, + "inner-leaf-value"); + CompositeNode innerContainer = NodeFactory.createImmutableCompositeNode(ANY_XML_INNER_QNAME, null, + Collections.> singletonList(innerLeafChild)); + + Node leafChild = NodeFactory.createImmutableSimpleNode(ANY_XML_LEAF_QNAME, null, "leaf-value"); + CompositeNode anyXmlNodeValue = NodeFactory.createImmutableCompositeNode(ANY_XML_DATA_QNAME, null, + Arrays.asList(leafChild, innerContainer)); + + AnyXmlNode testAnyXmlNode = Builders.anyXmlBuilder().withNodeIdentifier(new NodeIdentifier(TEST_QNAME)) + .withValue(anyXmlNodeValue).build(); + + ContainerNode testContainerNode = Builders.containerBuilder() + .withNodeIdentifier(new NodeIdentifier(TEST_QNAME)).withChild(testAnyXmlNode).build(); + + DataNormalizer normalizer = new DataNormalizer(createTestContext()); + Node legacyNode = normalizer.toLegacy(InstanceIdentifier.builder(TEST_QNAME).build(), testContainerNode); + + verifyLegacyNode( + legacyNode, + expectCompositeNode( + TEST_QNAME, + expectCompositeNode( + ANY_XML_DATA_QNAME, + expectSimpleNode(ANY_XML_LEAF_QNAME, "leaf-value"), + expectCompositeNode(ANY_XML_INNER_QNAME, + expectSimpleNode(ANY_XML_INNER_LEAF_QNAME, "inner-leaf-value"))))); + } + + @Test + public void testToLegacyNormalizedNodeWithLeafLists() { + + CompositeNodeBuilder testBuilder = ImmutableCompositeNode.builder(); + testBuilder.setQName(TEST_QNAME); + + ListNodeBuilder> leafSetBuilder = Builders.leafSetBuilder() + .withNodeIdentifier(new NodeIdentifier(UNORDERED_LEAF_LIST_QNAME)); + for (int i = 1; i <= 3; i++) { + leafSetBuilder.withChildValue("unordered-value" + i); + } + + ListNodeBuilder> orderedLeafSetBuilder = Builders.orderedLeafSetBuilder() + .withNodeIdentifier(new NodeIdentifier(ORDERED_LEAF_LIST_QNAME)); + for (int i = 3; i > 0; i--) { + orderedLeafSetBuilder.withChildValue("ordered-value" + i); + } + + ContainerNode testContainerNode = Builders.containerBuilder() + .withNodeIdentifier(new NodeIdentifier(TEST_QNAME)).withChild(leafSetBuilder.build()) + .withChild(orderedLeafSetBuilder.build()).build(); + + DataNormalizer normalizer = new DataNormalizer(createTestContext()); + + Node legacyNode = normalizer.toLegacy(InstanceIdentifier.builder(TEST_QNAME).build(), testContainerNode); + + verifyLegacyNode( + legacyNode, + expectCompositeNode(TEST_QNAME, expectSimpleNode(UNORDERED_LEAF_LIST_QNAME, "unordered-value1"), + expectSimpleNode(UNORDERED_LEAF_LIST_QNAME, "unordered-value2"), + expectSimpleNode(UNORDERED_LEAF_LIST_QNAME, "unordered-value3"), + expectSimpleNode(ORDERED_LEAF_LIST_QNAME, "ordered-value3"), + expectSimpleNode(ORDERED_LEAF_LIST_QNAME, "ordered-value2"), + expectSimpleNode(ORDERED_LEAF_LIST_QNAME, "ordered-value1"))); + } + + @Test + public void testToLegacyNormalizedNodeWithAugmentation() { + + AugmentationNode augmentationNode = Builders.augmentationBuilder() + .withNodeIdentifier(new AugmentationIdentifier(Sets.newHashSet(AUGMENTED_LEAF_QNAME))) + .withChild(ImmutableNodes.leafNode(AUGMENTED_LEAF_QNAME, "augmented-value")).build(); + + ContainerNode outerContainerNode = Builders.containerBuilder() + .withNodeIdentifier(new NodeIdentifier(OUTER_CONTAINER_QNAME)).withChild(augmentationNode).build(); + + ContainerNode testContainerNode = Builders.containerBuilder() + .withNodeIdentifier(new NodeIdentifier(TEST_QNAME)).withChild(outerContainerNode).build(); + + DataNormalizer normalizer = new DataNormalizer(createTestContext()); + + Node legacyNode = normalizer.toLegacy(InstanceIdentifier.builder(TEST_QNAME).build(), testContainerNode); + + verifyLegacyNode( + legacyNode, + expectCompositeNode( + TEST_QNAME, + expectCompositeNode(OUTER_CONTAINER_QNAME, + expectSimpleNode(AUGMENTED_LEAF_QNAME, "augmented-value")))); + } + + private boolean isOrdered(QName nodeName) { + return ORDERED_LEAF_LIST_QNAME.equals(nodeName) || INNER_LIST_QNAME.equals(nodeName); + } + + @SuppressWarnings("unchecked") + private void verifyLegacyNode(Node actual, LegacyNodeData expNodeData) { + + assertNotNull("Actual Node is null", actual); + assertTrue("Expected CompositeNode instance", actual instanceof CompositeNode); + CompositeNode actualCN = (CompositeNode) actual; + assertEquals("Node key", expNodeData.nodeKey, actualCN.getKey()); + + List expChildData = Lists.newArrayList(); + List unorderdChildData = Lists.newArrayList(); + for (LegacyNodeData data : (List) expNodeData.nodeData) { + if (isOrdered(data.nodeKey)) { + expChildData.add(data); + } else { + unorderdChildData.add(data); + } + } + + Collections.sort(unorderdChildData, new Comparator() { + @Override + public int compare(LegacyNodeData arg1, LegacyNodeData arg2) { + String str1 = arg1.nodeKey.getLocalName(); + if (!(arg1.nodeData instanceof List)) + str1 += arg1.nodeData; // add simple node value + + String str2 = arg2.nodeKey.getLocalName(); + if (!(arg2.nodeData instanceof List)) + str2 += arg2.nodeData; // add simple node value + + return str1.compareTo(str2); + } + }); + + expChildData.addAll(unorderdChildData); + + List> actualChildNodes = Lists.newArrayList(); + List> unorderedChildNodes = Lists.newArrayList(); + for (Node node : actualCN.getValue()) { + if (isOrdered(node.getKey())) { + actualChildNodes.add(node); + } else { + unorderedChildNodes.add(node); + } + } + + Collections.sort(unorderedChildNodes, new Comparator>() { + @Override + public int compare(Node n1, Node n2) { + String str1 = n1.getKey().getLocalName(); + if (n1 instanceof SimpleNode) + str1 += ((SimpleNode) n1).getValue(); + + String str2 = n2.getKey().getLocalName(); + if (n2 instanceof SimpleNode) + str2 += ((SimpleNode) n2).getValue(); + + return str1.compareTo(str2); + } + }); + + actualChildNodes.addAll(unorderedChildNodes); + + for (Node actualChild : actualChildNodes) { + LegacyNodeData expData = expChildData.isEmpty() ? null : expChildData.remove(0); + assertNotNull("Unexpected child node with key " + actualChild.getKey(), expData); + assertEquals("Child node QName", expData.nodeKey, actualChild.getKey()); + + if (expData.nodeData instanceof List) { // List represents a + // composite node + verifyLegacyNode(actualChild, expData); + } else { // else a simple node + assertTrue("Expected SimpleNode instance", actualChild instanceof SimpleNode); + assertEquals("Child node value with key " + actualChild.getKey(), expData.nodeData, + ((SimpleNode) actualChild).getValue()); + } + } + + if (!expChildData.isEmpty()) { + fail("Missing child nodes: " + expChildData); + } + } + + private LegacyNodeData expectCompositeNode(QName key, LegacyNodeData... childData) { + return new LegacyNodeData(key, Lists.newArrayList(childData)); + } + + private LegacyNodeData expectSimpleNode(QName key, Object value) { + return new LegacyNodeData(key, value); + } + + @Test + public void testToNormalizedCompositeNode() { + SchemaContext testCtx = createTestContext(); + DataNormalizer normalizer = new DataNormalizer(testCtx); + + CompositeNodeBuilder testBuilder = ImmutableCompositeNode.builder(); + testBuilder.setQName(TEST_QNAME); + + CompositeNodeBuilder outerListBuilder = ImmutableCompositeNode.builder(); + outerListBuilder.setQName(OUTER_LIST_QNAME); + outerListBuilder.addLeaf(ID_QNAME, 10); + outerListBuilder.addLeaf(ONE_QNAME, "one"); + + for (int i = 3; i > 0; i--) { + CompositeNodeBuilder innerListBuilder = ImmutableCompositeNode.builder(); + innerListBuilder.setQName(INNER_LIST_QNAME); + innerListBuilder.addLeaf(NAME_QNAME, "inner-name" + i); + innerListBuilder.addLeaf(VALUE_QNAME, "inner-value" + i); + outerListBuilder.add(innerListBuilder.toInstance()); + } + + testBuilder.add(outerListBuilder.toInstance()); + + outerListBuilder = ImmutableCompositeNode.builder(); + outerListBuilder.setQName(OUTER_LIST_QNAME); + outerListBuilder.addLeaf(ID_QNAME, 20); + outerListBuilder.addLeaf(TWO_QNAME, "two"); + outerListBuilder.addLeaf(THREE_QNAME, "three"); + testBuilder.add(outerListBuilder.toInstance()); + + for (int i = 1; i <= 2; i++) { + CompositeNodeBuilder unkeyedListBuilder = ImmutableCompositeNode.builder(); + unkeyedListBuilder.setQName(UNKEYED_LIST_QNAME); + unkeyedListBuilder.addLeaf(NAME_QNAME, "unkeyed-name" + i); + testBuilder.add(unkeyedListBuilder.toInstance()); + } + + Entry> normalizedNodeEntry = normalizer + .toNormalized(new AbstractMap.SimpleEntry(new InstanceIdentifier( + ImmutableList. of(new NodeIdentifier(TEST_QNAME))), testBuilder.toInstance())); + + verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME); + + verifyNormalizedNode( + normalizedNodeEntry.getValue(), + expectContainerNode( + TEST_QNAME, + expectMapNode( + OUTER_LIST_QNAME, + expectMapEntryNode( + OUTER_LIST_QNAME, + ID_QNAME, + 10, + expectLeafNode(ID_QNAME, 10), + expectChoiceNode(OUTER_CHOICE_QNAME, expectLeafNode(ONE_QNAME, "one")), + expectOrderedMapNode( + INNER_LIST_QNAME, + expectMapEntryNode(INNER_LIST_QNAME, NAME_QNAME, "inner-name3", + expectLeafNode(NAME_QNAME, "inner-name3"), + expectLeafNode(VALUE_QNAME, "inner-value3")), + expectMapEntryNode(INNER_LIST_QNAME, NAME_QNAME, "inner-name2", + expectLeafNode(NAME_QNAME, "inner-name2"), + expectLeafNode(VALUE_QNAME, "inner-value2")), + expectMapEntryNode(INNER_LIST_QNAME, NAME_QNAME, "inner-name1", + expectLeafNode(NAME_QNAME, "inner-name1"), + expectLeafNode(VALUE_QNAME, "inner-value1")))), + expectMapEntryNode( + OUTER_LIST_QNAME, + ID_QNAME, + 20, + expectLeafNode(ID_QNAME, 20), + expectChoiceNode(OUTER_CHOICE_QNAME, expectLeafNode(TWO_QNAME, "two"), + expectLeafNode(THREE_QNAME, "three")))), + expectUnkeyedListNode( + UNKEYED_LIST_QNAME, + expectUnkeyedListEntryNode(UNKEYED_LIST_QNAME, + expectLeafNode(NAME_QNAME, "unkeyed-name1")), + expectUnkeyedListEntryNode(UNKEYED_LIST_QNAME, + expectLeafNode(NAME_QNAME, "unkeyed-name2"))))); + } + + @Test + public void testToNormalizedCompositeNodeWithAnyXml() { + SchemaContext testCtx = createTestContext(); + DataNormalizer normalizer = new DataNormalizer(testCtx); + + CompositeNodeBuilder testBuilder = ImmutableCompositeNode.builder(); + testBuilder.setQName(TEST_QNAME); + + CompositeNodeBuilder anyXmlBuilder = ImmutableCompositeNode.builder(); + anyXmlBuilder.setQName(ANY_XML_DATA_QNAME); + anyXmlBuilder.addLeaf(ANY_XML_LEAF_QNAME, "leaf-value"); + + CompositeNodeBuilder innerBuilder = ImmutableCompositeNode.builder(); + innerBuilder.setQName(ANY_XML_INNER_QNAME); + innerBuilder.addLeaf(ANY_XML_INNER_LEAF_QNAME, "inner-leaf-value"); + + anyXmlBuilder.add(innerBuilder.toInstance()); + CompositeNode anyXmlLegacy = anyXmlBuilder.toInstance(); + testBuilder.add(anyXmlLegacy); + + Entry> normalizedNodeEntry = normalizer + .toNormalized(new AbstractMap.SimpleEntry(new InstanceIdentifier( + ImmutableList. of(new NodeIdentifier(TEST_QNAME))), testBuilder.toInstance())); + + verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME); + + verifyNormalizedNode(normalizedNodeEntry.getValue(), + expectContainerNode(TEST_QNAME, expectAnyXmlNode(ANY_XML_DATA_QNAME, anyXmlLegacy))); + } + + @Test + public void testToNormalizedCompositeNodeWithAugmentation() { + SchemaContext testCtx = createTestContext(); + DataNormalizer normalizer = new DataNormalizer(testCtx); + + CompositeNodeBuilder testBuilder = ImmutableCompositeNode.builder(); + testBuilder.setQName(TEST_QNAME); + + CompositeNodeBuilder outerContBuilder = ImmutableCompositeNode.builder(); + outerContBuilder.setQName(OUTER_CONTAINER_QNAME); + outerContBuilder.addLeaf(AUGMENTED_LEAF_QNAME, "augmented-value"); + + testBuilder.add(outerContBuilder.toInstance()); + + Entry> normalizedNodeEntry = normalizer + .toNormalized(new AbstractMap.SimpleEntry(new InstanceIdentifier( + ImmutableList. of(new NodeIdentifier(TEST_QNAME))), testBuilder.toInstance())); + + verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME); + + NormalizedNodeData expAugmentation = expectAugmentation(AUGMENTED_LEAF_QNAME, + expectLeafNode(AUGMENTED_LEAF_QNAME, "augmented-value")); + + verifyNormalizedNode(normalizedNodeEntry.getValue(), + expectContainerNode(TEST_QNAME, expectContainerNode(OUTER_CONTAINER_QNAME, expAugmentation))); + + normalizedNodeEntry = normalizer.toNormalized(new AbstractMap.SimpleEntry( + new InstanceIdentifier(Lists.newArrayList(new NodeIdentifier(TEST_QNAME), new NodeIdentifier( + OUTER_CONTAINER_QNAME))), outerContBuilder.toInstance())); + + verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME, OUTER_CONTAINER_QNAME, + Sets.newHashSet(AUGMENTED_LEAF_QNAME)); + + verifyNormalizedNode(normalizedNodeEntry.getValue(), expAugmentation); + } + + @Test + public void testToNormalizedCompositeNodeWithLeafLists() { + SchemaContext testCtx = createTestContext(); + DataNormalizer normalizer = new DataNormalizer(testCtx); + + CompositeNodeBuilder testBuilder = ImmutableCompositeNode.builder(); + testBuilder.setQName(TEST_QNAME); + + for (int i = 1; i <= 3; i++) { + testBuilder.addLeaf(UNORDERED_LEAF_LIST_QNAME, "unordered-value" + i); + } + + for (int i = 3; i > 0; i--) { + testBuilder.addLeaf(ORDERED_LEAF_LIST_QNAME, "ordered-value" + i); + } + + Entry> normalizedNodeEntry = normalizer + .toNormalized(new AbstractMap.SimpleEntry(new InstanceIdentifier( + ImmutableList. of(new NodeIdentifier(TEST_QNAME))), testBuilder.toInstance())); + + verifyNormalizedInstanceIdentifier(normalizedNodeEntry.getKey(), TEST_QNAME); + + verifyNormalizedNode( + normalizedNodeEntry.getValue(), + expectContainerNode( + TEST_QNAME, + expectLeafSetNode(UNORDERED_LEAF_LIST_QNAME, + expectLeafSetEntryNode(UNORDERED_LEAF_LIST_QNAME, "unordered-value1"), + expectLeafSetEntryNode(UNORDERED_LEAF_LIST_QNAME, "unordered-value2"), + expectLeafSetEntryNode(UNORDERED_LEAF_LIST_QNAME, "unordered-value3")), + expectOrderedLeafSetNode(ORDERED_LEAF_LIST_QNAME, + expectLeafSetEntryNode(ORDERED_LEAF_LIST_QNAME, "ordered-value3"), + expectLeafSetEntryNode(ORDERED_LEAF_LIST_QNAME, "ordered-value2"), + expectLeafSetEntryNode(ORDERED_LEAF_LIST_QNAME, "ordered-value1")))); + } + + @SuppressWarnings("unchecked") + private void verifyNormalizedNode(NormalizedNode actual, NormalizedNodeData expNodeData) { + + Class expNodeClass = expNodeData.nodeClass; + PathArgument expNodeID = expNodeData.nodeID; + + assertNotNull("Actual NormalizedNode is null", actual); + assertTrue("NormalizedNode instance " + actual.getClass() + " is not derived from " + expNodeClass, + expNodeClass.isAssignableFrom(actual.getClass())); + assertEquals("NormalizedNode identifier", expNodeID, actual.getIdentifier()); + + if (expNodeData.nodeData instanceof List) { + Map orderingMap = null; + if (expNodeClass.equals(OrderedMapNode.class) || expNodeClass.equals(OrderedLeafSetNode.class)) { + orderingMap = Maps.newHashMap(); + } + + int i = 1; + Map expChildDataMap = Maps.newHashMap(); + List expChildDataList = (List) expNodeData.nodeData; + for (NormalizedNodeData data : expChildDataList) { + expChildDataMap.put(data.nodeID, data); + + if (orderingMap != null) { + orderingMap.put(data.nodeID, i++); + } + } + + assertNotNull("Actual value is null for node " + actual.getIdentifier(), actual.getValue()); + assertTrue("Expected value instance Iterable for node " + actual.getIdentifier(), + Iterable.class.isAssignableFrom(actual.getValue().getClass())); + + i = 1; + for (NormalizedNode actualChild : (Iterable>) actual.getValue()) { + NormalizedNodeData expChildData = expNodeClass.equals(UnkeyedListNode.class) ? expChildDataList + .remove(0) : expChildDataMap.remove(actualChild.getIdentifier()); + + assertNotNull( + "Unexpected child node " + actualChild.getClass() + " with identifier " + + actualChild.getIdentifier() + " for parent node " + actual.getClass() + + " with identifier " + actual.getIdentifier(), expChildData); + + if (orderingMap != null) { + assertEquals("Order index for child node " + actualChild.getIdentifier(), + orderingMap.get(actualChild.getIdentifier()), Integer.valueOf(i)); + } + + verifyNormalizedNode(actualChild, expChildData); + i++; + } + + if (expNodeClass.equals(UnkeyedListNode.class)) { + if (expChildDataList.size() > 0) { + fail("Missing " + expChildDataList.size() + " child nodes for parent " + actual.getIdentifier()); + } + } else { + if (!expChildDataMap.isEmpty()) { + fail("Missing child nodes for parent " + actual.getIdentifier() + ": " + expChildDataMap.keySet()); + } + } + } else { + assertEquals("Leaf value for node " + actual.getIdentifier(), expNodeData.nodeData, actual.getValue()); + } + } + + private NormalizedNodeData expectOrderedLeafSetNode(QName nodeName, NormalizedNodeData... childData) { + return new NormalizedNodeData(new NodeIdentifier(nodeName), OrderedLeafSetNode.class, + Lists.newArrayList(childData)); + } + + private NormalizedNodeData expectLeafSetNode(QName nodeName, NormalizedNodeData... childData) { + return new NormalizedNodeData(new NodeIdentifier(nodeName), LeafSetNode.class, Lists.newArrayList(childData)); + } + + private NormalizedNodeData expectLeafSetEntryNode(QName nodeName, Object value) { + return new NormalizedNodeData(new NodeWithValue(nodeName, value), LeafSetEntryNode.class, value); + } + + private NormalizedNodeData expectUnkeyedListNode(QName nodeName, NormalizedNodeData... childData) { + return new NormalizedNodeData(new NodeIdentifier(nodeName), UnkeyedListNode.class, + Lists.newArrayList(childData)); + } + + private NormalizedNodeData expectUnkeyedListEntryNode(QName nodeName, NormalizedNodeData... childData) { + return new NormalizedNodeData(new NodeIdentifier(nodeName), UnkeyedListEntryNode.class, + Lists.newArrayList(childData)); + } + + private NormalizedNodeData expectAugmentation(QName augmentedNodeName, NormalizedNodeData... childData) { + return new NormalizedNodeData(new AugmentationIdentifier(Sets.newHashSet(augmentedNodeName)), + AugmentationNode.class, Lists.newArrayList(childData)); + } + + private NormalizedNodeData expectAnyXmlNode(QName nodeName, Object value) { + return new NormalizedNodeData(new NodeIdentifier(nodeName), AnyXmlNode.class, value); + } + + private NormalizedNodeData expectContainerNode(QName nodeName, NormalizedNodeData... childData) { + return new NormalizedNodeData(new NodeIdentifier(nodeName), ContainerNode.class, Lists.newArrayList(childData)); + } + + private NormalizedNodeData expectChoiceNode(QName nodeName, NormalizedNodeData... childData) { + return new NormalizedNodeData(new NodeIdentifier(nodeName), ChoiceNode.class, Lists.newArrayList(childData)); + } + + private NormalizedNodeData expectLeafNode(QName nodeName, Object value) { + return new NormalizedNodeData(new NodeIdentifier(nodeName), LeafNode.class, value); + + } + + private NormalizedNodeData expectMapEntryNode(QName nodeName, QName key, Object value, + NormalizedNodeData... childData) { + return new NormalizedNodeData(new NodeIdentifierWithPredicates(nodeName, key, value), MapEntryNode.class, + Lists.newArrayList(childData)); + } + + private NormalizedNodeData expectMapNode(QName key, NormalizedNodeData... childData) { + return new NormalizedNodeData(new NodeIdentifier(key), MapNode.class, Lists.newArrayList(childData)); + } + + private NormalizedNodeData expectOrderedMapNode(QName key, NormalizedNodeData... childData) { + return new NormalizedNodeData(new NodeIdentifier(key), OrderedMapNode.class, Lists.newArrayList(childData)); + } +} diff --git a/opendaylight/md-sal/sal-common-impl/src/test/resources/normalization-test.yang b/opendaylight/md-sal/sal-common-impl/src/test/resources/normalization-test.yang new file mode 100644 index 0000000000..6df5306850 --- /dev/null +++ b/opendaylight/md-sal/sal-common-impl/src/test/resources/normalization-test.yang @@ -0,0 +1,74 @@ +module normalization-test { + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:normalization:test"; + prefix "norm-test"; + + revision "2014-03-13" { + description "Initial revision."; + } + + grouping outer-grouping { + } + + container test { + list outer-list { + key id; + leaf id { + type uint16; + } + choice outer-choice { + case one { + leaf one { + type string; + } + } + case two-three { + leaf two { + type string; + } + leaf three { + type string; + } + } + } + list inner-list { + key name; + ordered-by user; + + leaf name { + type string; + } + leaf value { + type string; + } + } + } + + list unkeyed-list { + leaf name { + type string; + } + } + + leaf-list unordered-leaf-list { + type string; + } + + leaf-list ordered-leaf-list { + ordered-by user; + type string; + } + + container outer-container { + } + + anyxml any-xml-data; + } + + augment /norm-test:test/norm-test:outer-container { + + leaf augmented-leaf { + type string; + } + } +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-distributed-datastore/pom.xml b/opendaylight/md-sal/sal-distributed-datastore/pom.xml index cf28d067ab..ea686d966f 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/pom.xml +++ b/opendaylight/md-sal/sal-distributed-datastore/pom.xml @@ -57,6 +57,17 @@ sal-binding-config
+ + + org.opendaylight.controller + sal-broker-impl + + org.opendaylight.controller sal-common-api diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ListenerRegistration.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ListenerRegistration.java new file mode 100644 index 0000000000..fda429f754 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ListenerRegistration.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore; + +import akka.actor.Props; +import akka.actor.UntypedActor; +import akka.japi.Creator; +import org.opendaylight.controller.cluster.datastore.messages.CloseListenerRegistration; +import org.opendaylight.controller.cluster.datastore.messages.CloseListenerRegistrationReply; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; + +public class ListenerRegistration extends UntypedActor{ + + private final org.opendaylight.yangtools.concepts.ListenerRegistration>> registration; + + public ListenerRegistration(org.opendaylight.yangtools.concepts.ListenerRegistration>> registration) { + this.registration = registration; + } + + @Override + public void onReceive(Object message) throws Exception { + if(message instanceof CloseListenerRegistration){ + closeListenerRegistration((CloseListenerRegistration) message); + } + } + + public static Props props(final org.opendaylight.yangtools.concepts.ListenerRegistration>> registration){ + return Props.create(new Creator(){ + + @Override + public ListenerRegistration create() throws Exception { + return new ListenerRegistration(registration); + } + }); + } + + private void closeListenerRegistration(CloseListenerRegistration message){ + registration.close(); + getSender().tell(new CloseListenerRegistrationReply(), getSelf()); + } +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java new file mode 100644 index 0000000000..8365328669 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore; + +import akka.actor.ActorRef; +import akka.event.Logging; +import akka.event.LoggingAdapter; +import akka.persistence.UntypedProcessor; +import com.google.common.util.concurrent.ListeningExecutorService; +import com.google.common.util.concurrent.MoreExecutors; +import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChain; +import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChainReply; +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.sal.common.api.data.AsyncDataChangeListener; +import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore; +import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; + +import java.util.concurrent.Executors; + +/** + * A Shard represents a portion of the logical data tree + *

+ * Our Shard uses InMemoryDataStore as it's internal representation and delegates all requests it + * + */ +public class Shard extends UntypedProcessor { + + ListeningExecutorService storeExecutor = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(2)); + + private final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", storeExecutor); + + LoggingAdapter log = Logging.getLogger(getContext().system(), this); + + @Override + public void onReceive(Object message) throws Exception { + if (message instanceof CreateTransactionChain) { + createTransactionChain(); + } else if(message instanceof RegisterChangeListener){ + registerChangeListener((RegisterChangeListener) message); + } else if(message instanceof UpdateSchemaContext){ + updateSchemaContext((UpdateSchemaContext) message); + } + } + + private void updateSchemaContext(UpdateSchemaContext message) { + store.onGlobalContextUpdated(message.getSchemaContext()); + } + + private void registerChangeListener(RegisterChangeListener registerChangeListener) { + org.opendaylight.yangtools.concepts.ListenerRegistration>> registration = + store.registerChangeListener(registerChangeListener.getPath(), registerChangeListener.getListener(), registerChangeListener.getScope()); + ActorRef listenerRegistration = getContext().actorOf(ListenerRegistration.props(registration)); + getSender().tell(new RegisterChangeListenerReply(listenerRegistration.path()), getSelf()); + } + + private void createTransactionChain() { + DOMStoreTransactionChain chain = store.createTransactionChain(); + ActorRef transactionChain = getContext().actorOf(ShardTransactionChain.props(chain)); + getSender().tell(new CreateTransactionChainReply(transactionChain.path()), getSelf()); + } +} 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 new file mode 100644 index 0000000000..b316b9df04 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransaction.java @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore; + +import akka.actor.ActorRef; +import akka.actor.Props; +import akka.actor.UntypedActor; +import akka.event.Logging; +import akka.event.LoggingAdapter; +import akka.japi.Creator; +import com.google.common.base.Optional; +import com.google.common.util.concurrent.ListenableFuture; +import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction; +import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionReply; +import org.opendaylight.controller.cluster.datastore.messages.DeleteData; +import org.opendaylight.controller.cluster.datastore.messages.DeleteDataReply; +import org.opendaylight.controller.cluster.datastore.messages.MergeData; +import org.opendaylight.controller.cluster.datastore.messages.MergeDataReply; +import org.opendaylight.controller.cluster.datastore.messages.ReadData; +import org.opendaylight.controller.cluster.datastore.messages.ReadDataReply; +import org.opendaylight.controller.cluster.datastore.messages.ReadyTransaction; +import org.opendaylight.controller.cluster.datastore.messages.ReadyTransactionReply; +import org.opendaylight.controller.cluster.datastore.messages.WriteData; +import org.opendaylight.controller.cluster.datastore.messages.WriteDataReply; +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.schema.NormalizedNode; + +import java.util.concurrent.ExecutionException; + +/** + * The ShardTransaction Actor represents a remote transaction + * + * The ShardTransaction Actor delegates all actions to DOMDataReadWriteTransaction + * + * Even though the DOMStore and the DOMStoreTransactionChain implement multiple types of transactions + * the ShardTransaction Actor only works with read-write transactions. This is just to keep the logic simple. At this + * time there are no known advantages for creating a read-only or write-only transaction which may change over time + * at which point we can optimize things in the distributed store as well. + * + * Handles Messages + * ---------------- + * {@link org.opendaylight.controller.cluster.datastore.messages.ReadData} + * {@link org.opendaylight.controller.cluster.datastore.messages.WriteData} + * {@link org.opendaylight.controller.cluster.datastore.messages.MergeData} + * {@link org.opendaylight.controller.cluster.datastore.messages.DeleteData} + * {@link org.opendaylight.controller.cluster.datastore.messages.ReadyTransaction} + * {@link org.opendaylight.controller.cluster.datastore.messages.CloseTransaction} + */ +public class ShardTransaction extends UntypedActor { + + private final DOMStoreReadWriteTransaction transaction; + + private final LoggingAdapter log = Logging.getLogger(getContext().system(), this); + + public ShardTransaction(DOMStoreReadWriteTransaction transaction) { + this.transaction = transaction; + } + + + public static Props props(final DOMStoreReadWriteTransaction transaction){ + return Props.create(new Creator(){ + + @Override + public ShardTransaction create() throws Exception { + return new ShardTransaction(transaction); + } + }); + } + + @Override + public void onReceive(Object message) throws Exception { + if(message instanceof ReadData){ + readData((ReadData) message); + } else if(message instanceof WriteData){ + writeData((WriteData) message); + } else if(message instanceof MergeData){ + mergeData((MergeData) message); + } else if(message instanceof DeleteData){ + deleteData((DeleteData) message); + } else if(message instanceof ReadyTransaction){ + readyTransaction((ReadyTransaction) message); + } else if(message instanceof CloseTransaction){ + closeTransaction((CloseTransaction) message); + } + } + + private void readData(ReadData message) { + final ActorRef sender = getSender(); + final ActorRef self = getSelf(); + final InstanceIdentifier path = message.getPath(); + final ListenableFuture>> future = transaction.read(path); + + future.addListener(new Runnable() { + @Override + public void run() { + try { + Optional> optional = future.get(); + if(optional.isPresent()){ + sender.tell(new ReadDataReply(optional.get()), self); + } else { + //TODO : Need to decide what to do here + } + } catch (InterruptedException | ExecutionException e) { + log.error(e, "An exception happened when reading data from path : " + path.toString()); + } + + } + }, getContext().dispatcher()); + } + + + private void writeData(WriteData message){ + transaction.write(message.getPath(), message.getData()); + getSender().tell(new WriteDataReply(), getSelf()); + } + + private void mergeData(MergeData message){ + transaction.merge(message.getPath(), message.getData()); + getSender().tell(new MergeDataReply(), getSelf()); + } + + private void deleteData(DeleteData message){ + transaction.delete(message.getPath()); + getSender().tell(new DeleteDataReply(), getSelf()); + } + + private void readyTransaction(ReadyTransaction message){ + DOMStoreThreePhaseCommitCohort cohort = transaction.ready(); + ActorRef cohortActor = getContext().actorOf(ThreePhaseCommitCohort.props(cohort)); + getSender().tell(new ReadyTransactionReply(cohortActor.path()), getSelf()); + + } + + private void closeTransaction(CloseTransaction message){ + transaction.close(); + getSender().tell(new CloseTransactionReply(), 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 new file mode 100644 index 0000000000..83913fe416 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransactionChain.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore; + +import akka.actor.ActorRef; +import akka.actor.Props; +import akka.actor.UntypedActor; +import akka.japi.Creator; +import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChain; +import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChainReply; +import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction; +import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply; +import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction; +import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain; + +/** + * The ShardTransactionChain Actor represents a remote TransactionChain + */ +public class ShardTransactionChain extends UntypedActor{ + + private final DOMStoreTransactionChain chain; + + public ShardTransactionChain(DOMStoreTransactionChain chain) { + this.chain = chain; + } + + @Override + public void onReceive(Object message) throws Exception { + if(message instanceof CreateTransaction){ + DOMStoreReadWriteTransaction transaction = chain.newReadWriteTransaction(); + ActorRef transactionActor = getContext().actorOf(ShardTransaction.props(transaction)); + getSender().tell(new CreateTransactionReply(transactionActor.path()), getSelf()); + } else if (message instanceof CloseTransactionChain){ + chain.close(); + getSender().tell(new CloseTransactionChainReply(), getSelf()); + } + } + + public static Props props(final DOMStoreTransactionChain chain){ + return Props.create(new Creator(){ + + @Override + public ShardTransactionChain create() throws Exception { + return new ShardTransactionChain(chain); + } + }); + } +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohort.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohort.java new file mode 100644 index 0000000000..8e21cb2d86 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohort.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore; + +import akka.actor.Props; +import akka.actor.UntypedActor; +import akka.japi.Creator; +import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort; + +public class ThreePhaseCommitCohort extends UntypedActor{ + private final DOMStoreThreePhaseCommitCohort cohort; + + public ThreePhaseCommitCohort(DOMStoreThreePhaseCommitCohort cohort) { + + this.cohort = cohort; + } + + @Override + public void onReceive(Object message) throws Exception { + throw new UnsupportedOperationException("onReceive"); + } + + public static Props props(final DOMStoreThreePhaseCommitCohort cohort) { + return Props.create(new Creator(){ + @Override + public ThreePhaseCommitCohort create() throws Exception { + return new ThreePhaseCommitCohort(cohort); + } + }); + } +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseListenerRegistration.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseListenerRegistration.java new file mode 100644 index 0000000000..d55ad28d5b --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseListenerRegistration.java @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +public class CloseListenerRegistration { +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseListenerRegistrationReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseListenerRegistrationReply.java new file mode 100644 index 0000000000..e195e4b959 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseListenerRegistrationReply.java @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +public class CloseListenerRegistrationReply { +} 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 new file mode 100644 index 0000000000..6809f4b135 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransaction.java @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +public class CloseTransaction { +} 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 new file mode 100644 index 0000000000..04c422b68e --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionChain.java @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +public class CloseTransactionChain { +} 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 new file mode 100644 index 0000000000..89fa93bf9a --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionChainReply.java @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +public class CloseTransactionChainReply { +} 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 new file mode 100644 index 0000000000..4910a3ea0e --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionReply.java @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +public class CloseTransactionReply { +} 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 new file mode 100644 index 0000000000..e0cdd3cc2b --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransaction.java @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +public class CreateTransaction { + +} 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 new file mode 100644 index 0000000000..cdad3324ab --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionChain.java @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +public class CreateTransactionChain { + +} 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 new file mode 100644 index 0000000000..49dd9b63d2 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionChainReply.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +import akka.actor.ActorPath; + +public class CreateTransactionChainReply { + private final ActorPath transactionChainPath; + + public CreateTransactionChainReply(ActorPath transactionChainPath) { + this.transactionChainPath = transactionChainPath; + } + + public ActorPath getTransactionChainPath() { + return transactionChainPath; + } +} 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 new file mode 100644 index 0000000000..4faf9d370d --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateTransactionReply.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +import akka.actor.ActorPath; + +public class CreateTransactionReply { + private final ActorPath transactionPath; + + public CreateTransactionReply(ActorPath transactionPath) { + this.transactionPath = transactionPath; + } + + public ActorPath getTransactionPath() { + return transactionPath; + } +} 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 new file mode 100644 index 0000000000..384e75ae7e --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DeleteData.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; + +public class DeleteData { + private final InstanceIdentifier path; + + public DeleteData(InstanceIdentifier path) { + this.path = path; + } + + public InstanceIdentifier getPath() { + return path; + } +} 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 new file mode 100644 index 0000000000..a3c7305685 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/DeleteDataReply.java @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +public class DeleteDataReply { +} 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 new file mode 100644 index 0000000000..75d1e95c1e --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/MergeData.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; + +public class MergeData extends ModifyData { + public MergeData(InstanceIdentifier path, NormalizedNode data) { + super(path, data); + } +} 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 new file mode 100644 index 0000000000..8e90972f87 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/MergeDataReply.java @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +public class MergeDataReply { +} 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 new file mode 100644 index 0000000000..da8608876e --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ModifyData.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; + +public abstract class ModifyData { + private final InstanceIdentifier path; + private final NormalizedNode data; + + public ModifyData(InstanceIdentifier path, NormalizedNode data) { + this.path = path; + this.data = data; + } + + public InstanceIdentifier getPath() { + return path; + } + + public NormalizedNode getData() { + return data; + } + +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadData.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadData.java new file mode 100644 index 0000000000..2f56a9740b --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadData.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; + +public class ReadData { + private final InstanceIdentifier path; + + public ReadData(InstanceIdentifier path) { + this.path = path; + } + + public InstanceIdentifier getPath() { + return path; + } +} 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 new file mode 100644 index 0000000000..52e2c29249 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadDataReply.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; + +public class ReadDataReply { + private final NormalizedNode normalizedNode; + + public ReadDataReply(NormalizedNode normalizedNode){ + + this.normalizedNode = normalizedNode; + } + + public NormalizedNode getNormalizedNode() { + return normalizedNode; + } +} 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 new file mode 100644 index 0000000000..58eef66fc7 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadyTransaction.java @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +public class ReadyTransaction { +} 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 new file mode 100644 index 0000000000..48565d4fbb --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ReadyTransactionReply.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +import akka.actor.ActorPath; + +public class ReadyTransactionReply { + private final ActorPath path; + + public ReadyTransactionReply(ActorPath path) { + + this.path = path; + } + + public ActorPath getPath() { + return 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 new file mode 100644 index 0000000000..0123a70147 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterChangeListener.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; + +public class RegisterChangeListener { + private final InstanceIdentifier path; + private final AsyncDataChangeListener> listener; + private final AsyncDataBroker.DataChangeScope scope; + + + public RegisterChangeListener(InstanceIdentifier path, AsyncDataChangeListener> listener, AsyncDataBroker.DataChangeScope scope) { + this.path = path; + this.listener = listener; + this.scope = scope; + } + + public InstanceIdentifier getPath() { + return path; + } + + public AsyncDataChangeListener> getListener() { + return listener; + } + + public AsyncDataBroker.DataChangeScope getScope() { + return scope; + } +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterChangeListenerReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterChangeListenerReply.java new file mode 100644 index 0000000000..ae8bbbd75a --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterChangeListenerReply.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +import akka.actor.ActorPath; + +public class RegisterChangeListenerReply { + private final ActorPath listenerRegistrationPath; + + public RegisterChangeListenerReply(ActorPath listenerRegistrationPath) { + this.listenerRegistrationPath = listenerRegistrationPath; + } + + public ActorPath getListenerRegistrationPath() { + return listenerRegistrationPath; + } +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/UpdateSchemaContext.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/UpdateSchemaContext.java new file mode 100644 index 0000000000..47f9ea8c4f --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/UpdateSchemaContext.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +import org.opendaylight.yangtools.yang.model.api.SchemaContext; + +public class UpdateSchemaContext { + private final SchemaContext schemaContext; + + public UpdateSchemaContext(SchemaContext schemaContext) { + this.schemaContext = schemaContext; + } + + public SchemaContext getSchemaContext() { + return schemaContext; + } +} 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 new file mode 100644 index 0000000000..1348e65aa3 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/WriteData.java @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; + +public class WriteData extends ModifyData{ + + public WriteData(InstanceIdentifier path, NormalizedNode data) { + super(path, data); + } +} 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 new file mode 100644 index 0000000000..2a2b4ed25d --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/WriteDataReply.java @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.messages; + +public class WriteDataReply { +} 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 new file mode 100644 index 0000000000..a8ab5c4bd3 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/DefaultShardStrategy.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.shardstrategy; + +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; + +/** + * The DefaultShardStrategy basically puts all data into the default Shard + *

+ * The default shard stores data for all modules for which a specific set of shards has not been configured + *

+ */ +public class DefaultShardStrategy implements ShardStrategy{ + + public static final String NAME = "default"; + public static final String DEFAULT_SHARD = "default"; + + @Override + public String findShard(InstanceIdentifier path) { + return DEFAULT_SHARD; + } +} 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 new file mode 100644 index 0000000000..f75eb2d863 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategy.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.shardstrategy; + +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; + +/** + * The role of ShardStrategy is to figure out which Shards a given piece of data belongs to + */ +public interface ShardStrategy { + /** + * Find the name of the shard in which the data pointed to by the specified path belongs in + * + * @param path The location of the data in the logical tree + * @return + */ + String findShard(InstanceIdentifier 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 new file mode 100644 index 0000000000..210537925b --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactory.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore.shardstrategy; + +import com.google.common.base.Preconditions; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class ShardStrategyFactory { + private static final Map moduleNameToStrategyMap = new ConcurrentHashMap(); + + private static final String UNKNOWN_MODULE_NAME = "unknown"; + + public static ShardStrategy getStrategy(InstanceIdentifier path){ + Preconditions.checkNotNull(path, "path should not be null"); + + String moduleName = getModuleName(path); + ShardStrategy shardStrategy = moduleNameToStrategyMap.get(moduleName); + if(shardStrategy == null){ + return new DefaultShardStrategy(); + } + + return shardStrategy; + } + + + private static String getModuleName(InstanceIdentifier path){ + return UNKNOWN_MODULE_NAME; + } + + /** + * This is to be used in the future to register a custom shard strategy + * + * @param moduleName + * @param shardStrategy + */ + public static void registerShardStrategy(String moduleName, ShardStrategy shardStrategy){ + throw new UnsupportedOperationException("registering a custom shard strategy not supported yet"); + } +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractActorTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractActorTest.java new file mode 100644 index 0000000000..2fe7b69cc9 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractActorTest.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.cluster.datastore; + +import akka.actor.ActorSystem; +import akka.testkit.JavaTestKit; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +public abstract class AbstractActorTest { + private static ActorSystem system; + + @BeforeClass + public static void setUp(){ + system = ActorSystem.create("test"); + } + + @AfterClass + public static void tearDown(){ + JavaTestKit.shutdownActorSystem(system); + system = null; + } + + protected ActorSystem getSystem(){ + return system; + } + +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ListenerRegistrationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ListenerRegistrationTest.java new file mode 100644 index 0000000000..0f155ef597 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ListenerRegistrationTest.java @@ -0,0 +1,72 @@ +package org.opendaylight.controller.cluster.datastore; + +import akka.actor.ActorRef; +import akka.actor.Props; +import akka.testkit.JavaTestKit; +import com.google.common.util.concurrent.ListeningExecutorService; +import com.google.common.util.concurrent.MoreExecutors; +import org.junit.Test; +import org.opendaylight.controller.cluster.datastore.messages.CloseListenerRegistration; +import org.opendaylight.controller.cluster.datastore.messages.CloseListenerRegistrationReply; +import org.opendaylight.controller.md.cluster.datastore.model.TestModel; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener; +import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; + +import static org.junit.Assert.assertEquals; + +public class ListenerRegistrationTest extends AbstractActorTest { + private static ListeningExecutorService storeExecutor = MoreExecutors.listeningDecorator(MoreExecutors.sameThreadExecutor()); + + private static final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", storeExecutor); + + static { + store.onGlobalContextUpdated(TestModel.createTestContext()); + } + + + @Test + public void testOnReceiveCloseListenerRegistration() throws Exception { + new JavaTestKit(getSystem()) {{ + final Props props = ListenerRegistration.props(store.registerChangeListener(TestModel.TEST_PATH, noOpDataChangeListener(), AsyncDataBroker.DataChangeScope.BASE)); + final ActorRef subject = getSystem().actorOf(props, "testCloseListenerRegistration"); + + new Within(duration("1 seconds")) { + protected void run() { + + subject.tell(new CloseListenerRegistration(), getRef()); + + 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 CloseListenerRegistrationReply) { + return "match"; + } else { + throw noMatch(); + } + } + }.get(); // this extracts the received message + + assertEquals("match", out); + + expectNoMsg(); + } + + + }; + }}; + } + + private AsyncDataChangeListener> noOpDataChangeListener(){ + return new AsyncDataChangeListener>() { + @Override + public void onDataChanged(AsyncDataChangeEvent> change) { + + } + }; + } + +} \ No newline at end of file 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 new file mode 100644 index 0000000000..b5a341d95c --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java @@ -0,0 +1,98 @@ +package org.opendaylight.controller.cluster.datastore; + +import akka.actor.ActorRef; +import akka.actor.Props; +import akka.testkit.JavaTestKit; +import org.junit.Test; +import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChain; +import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionChainReply; +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.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.yangtools.yang.data.api.schema.NormalizedNode; + +import static org.junit.Assert.assertTrue; + +public class ShardTest extends AbstractActorTest{ + @Test + public void testOnReceiveCreateTransactionChain() throws Exception { + new JavaTestKit(getSystem()) {{ + final Props props = Props.create(Shard.class); + final ActorRef subject = getSystem().actorOf(props, "testCreateTransactionChain"); + + new Within(duration("1 seconds")) { + protected void run() { + + subject.tell(new CreateTransactionChain(), getRef()); + + final String out = new ExpectMsg("match hint") { + // do not put code outside this method, will run afterwards + protected String match(Object in) { + if (in instanceof CreateTransactionChainReply) { + CreateTransactionChainReply reply = (CreateTransactionChainReply) in; + return reply.getTransactionChainPath().toString(); + } else { + throw noMatch(); + } + } + }.get(); // this extracts the received message + + assertTrue(out.matches("akka:\\/\\/test\\/user\\/testCreateTransactionChain\\/\\$.*")); + // Will wait for the rest of the 3 seconds + expectNoMsg(); + } + + + }; + }}; + } + + @Test + public void testOnReceiveRegisterListener() throws Exception { + new JavaTestKit(getSystem()) {{ + final Props props = Props.create(Shard.class); + final ActorRef subject = getSystem().actorOf(props, "testRegisterChangeListener"); + + new Within(duration("1 seconds")) { + protected void run() { + + subject.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef()); + + subject.tell(new RegisterChangeListener(InstanceIdentifier.builder().build(), noOpDataChangeListener() , AsyncDataBroker.DataChangeScope.BASE), 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 RegisterChangeListenerReply) { + RegisterChangeListenerReply reply = (RegisterChangeListenerReply) in; + return reply.getListenerRegistrationPath().toString(); + } else { + throw noMatch(); + } + } + }.get(); // this extracts the received message + + assertTrue(out.matches("akka:\\/\\/test\\/user\\/testRegisterChangeListener\\/\\$.*")); + // Will wait for the rest of the 3 seconds + expectNoMsg(); + } + + + }; + }}; + } + + private AsyncDataChangeListener> noOpDataChangeListener(){ + return new AsyncDataChangeListener>() { + @Override + public void onDataChanged(AsyncDataChangeEvent> change) { + + } + }; + } +} \ No newline at end of file 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 new file mode 100644 index 0000000000..bc3a104656 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionChainTest.java @@ -0,0 +1,91 @@ +package org.opendaylight.controller.cluster.datastore; + +import akka.actor.ActorRef; +import akka.actor.Props; +import akka.testkit.JavaTestKit; +import com.google.common.util.concurrent.ListeningExecutorService; +import com.google.common.util.concurrent.MoreExecutors; +import org.junit.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.cluster.datastore.messages.CreateTransactionReply; +import org.opendaylight.controller.md.cluster.datastore.model.TestModel; +import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class ShardTransactionChainTest extends AbstractActorTest { + + private static ListeningExecutorService storeExecutor = MoreExecutors.listeningDecorator(MoreExecutors.sameThreadExecutor()); + + private static final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", storeExecutor); + + static { + store.onGlobalContextUpdated(TestModel.createTestContext()); + } + @Test + public void testOnReceiveCreateTransaction() throws Exception { + new JavaTestKit(getSystem()) {{ + final Props props = ShardTransactionChain.props(store.createTransactionChain()); + final ActorRef subject = getSystem().actorOf(props, "testCreateTransaction"); + + new Within(duration("1 seconds")) { + protected void run() { + + subject.tell(new CreateTransaction(), 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).getTransactionPath().toString(); + } else { + throw noMatch(); + } + } + }.get(); // this extracts the received message + + assertTrue(out.matches("akka:\\/\\/test\\/user\\/testCreateTransaction\\/\\$.*")); + // Will wait for the rest of the 3 seconds + expectNoMsg(); + } + + + }; + }}; + } + + @Test + public void testOnReceiveCloseTransactionChain() throws Exception { + new JavaTestKit(getSystem()) {{ + final Props props = ShardTransactionChain.props(store.createTransactionChain()); + final ActorRef subject = getSystem().actorOf(props, "testCloseTransactionChain"); + + new Within(duration("1 seconds")) { + protected void run() { + + subject.tell(new CloseTransactionChain(), 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) { + return "match"; + } else { + throw noMatch(); + } + } + }.get(); // this extracts the received message + + assertEquals("match", out); + // Will wait for the rest of the 3 seconds + expectNoMsg(); + } + + + }; + }}; + } +} \ No newline at end of file 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 new file mode 100644 index 0000000000..36633c55d5 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java @@ -0,0 +1,236 @@ +package org.opendaylight.controller.cluster.datastore; + +import akka.actor.ActorRef; +import akka.actor.Props; +import akka.testkit.JavaTestKit; +import com.google.common.util.concurrent.ListeningExecutorService; +import com.google.common.util.concurrent.MoreExecutors; +import org.junit.Test; +import org.opendaylight.controller.cluster.datastore.messages.CloseTransaction; +import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionReply; +import org.opendaylight.controller.cluster.datastore.messages.DeleteData; +import org.opendaylight.controller.cluster.datastore.messages.DeleteDataReply; +import org.opendaylight.controller.cluster.datastore.messages.MergeData; +import org.opendaylight.controller.cluster.datastore.messages.MergeDataReply; +import org.opendaylight.controller.cluster.datastore.messages.ReadData; +import org.opendaylight.controller.cluster.datastore.messages.ReadDataReply; +import org.opendaylight.controller.cluster.datastore.messages.ReadyTransaction; +import org.opendaylight.controller.cluster.datastore.messages.ReadyTransactionReply; +import org.opendaylight.controller.cluster.datastore.messages.WriteData; +import org.opendaylight.controller.cluster.datastore.messages.WriteDataReply; +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.impl.schema.ImmutableNodes; + +import static org.junit.Assert.assertEquals; + +public class ShardTransactionTest extends AbstractActorTest { + private static ListeningExecutorService storeExecutor = MoreExecutors.listeningDecorator(MoreExecutors.sameThreadExecutor()); + + private static final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", storeExecutor); + + static { + store.onGlobalContextUpdated(TestModel.createTestContext()); + } + + @Test + public void testOnReceiveReadData() throws Exception { + new JavaTestKit(getSystem()) {{ + final Props props = ShardTransaction.props(store.newReadWriteTransaction()); + final ActorRef subject = getSystem().actorOf(props, "testReadData"); + + new Within(duration("1 seconds")) { + protected void run() { + + subject.tell(new ReadData(InstanceIdentifier.builder().build()), getRef()); + + final String out = new ExpectMsg("match hint") { + // do not put code outside this method, will run afterwards + protected String match(Object in) { + if (in instanceof ReadDataReply) { + if (((ReadDataReply) in).getNormalizedNode() != null) { + return "match"; + } + return null; + } else { + throw noMatch(); + } + } + }.get(); // this extracts the received message + + assertEquals("match", out); + + expectNoMsg(); + } + + + }; + }}; + } + + @Test + public void testOnReceiveWriteData() throws Exception { + new JavaTestKit(getSystem()) {{ + final Props props = ShardTransaction.props(store.newReadWriteTransaction()); + final ActorRef subject = getSystem().actorOf(props, "testWriteData"); + + new Within(duration("1 seconds")) { + protected void run() { + + subject.tell(new WriteData(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME)), getRef()); + + final String out = new ExpectMsg("match hint") { + // do not put code outside this method, will run afterwards + protected String match(Object in) { + if (in instanceof WriteDataReply) { + return "match"; + } else { + throw noMatch(); + } + } + }.get(); // this extracts the received message + + assertEquals("match", out); + + expectNoMsg(); + } + + + }; + }}; + } + + @Test + public void testOnReceiveMergeData() throws Exception { + new JavaTestKit(getSystem()) {{ + final Props props = ShardTransaction.props(store.newReadWriteTransaction()); + final ActorRef subject = getSystem().actorOf(props, "testMergeData"); + + new Within(duration("1 seconds")) { + protected void run() { + + subject.tell(new MergeData(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME)), getRef()); + + final String out = new ExpectMsg("match hint") { + // do not put code outside this method, will run afterwards + protected String match(Object in) { + if (in instanceof MergeDataReply) { + return "match"; + } else { + throw noMatch(); + } + } + }.get(); // this extracts the received message + + assertEquals("match", out); + + expectNoMsg(); + } + + + }; + }}; + } + + @Test + public void testOnReceiveDeleteData() throws Exception { + new JavaTestKit(getSystem()) {{ + final Props props = ShardTransaction.props(store.newReadWriteTransaction()); + final ActorRef subject = getSystem().actorOf(props, "testDeleteData"); + + new Within(duration("1 seconds")) { + protected void run() { + + subject.tell(new DeleteData(TestModel.TEST_PATH), getRef()); + + final String out = new ExpectMsg("match hint") { + // do not put code outside this method, will run afterwards + protected String match(Object in) { + if (in instanceof DeleteDataReply) { + return "match"; + } else { + throw noMatch(); + } + } + }.get(); // this extracts the received message + + assertEquals("match", out); + + expectNoMsg(); + } + + + }; + }}; + } + + + @Test + public void testOnReceiveReadyTransaction() throws Exception { + new JavaTestKit(getSystem()) {{ + final Props props = ShardTransaction.props(store.newReadWriteTransaction()); + final ActorRef subject = getSystem().actorOf(props, "testReadyTransaction"); + + new Within(duration("1 seconds")) { + protected void run() { + + subject.tell(new ReadyTransaction(), getRef()); + + final String out = new ExpectMsg("match hint") { + // do not put code outside this method, will run afterwards + protected String match(Object in) { + if (in instanceof ReadyTransactionReply) { + return "match"; + } else { + throw noMatch(); + } + } + }.get(); // this extracts the received message + + assertEquals("match", out); + + expectNoMsg(); + } + + + }; + }}; + + } + + @Test + public void testOnReceiveCloseTransaction() throws Exception { + new JavaTestKit(getSystem()) {{ + final Props props = ShardTransaction.props(store.newReadWriteTransaction()); + final ActorRef subject = getSystem().actorOf(props, "testCloseTransaction"); + + new Within(duration("1 seconds")) { + protected void run() { + + subject.tell(new CloseTransaction(), 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) { + return "match"; + } else { + throw noMatch(); + } + } + }.get(); // this extracts the received message + + assertEquals("match", out); + + expectNoMsg(); + } + + + }; + }}; + + } + + +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/DefaultShardStrategyTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/DefaultShardStrategyTest.java new file mode 100644 index 0000000000..d3ba9b1c15 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/DefaultShardStrategyTest.java @@ -0,0 +1,14 @@ +package org.opendaylight.controller.cluster.datastore.shardstrategy; + +import junit.framework.Assert; +import org.junit.Test; +import org.opendaylight.controller.md.cluster.datastore.model.TestModel; + +public class DefaultShardStrategyTest { + + @Test + public void testFindShard() throws Exception { + String shard = new DefaultShardStrategy().findShard(TestModel.TEST_PATH); + Assert.assertEquals(DefaultShardStrategy.DEFAULT_SHARD, shard); + } +} \ No newline at end of file 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 new file mode 100644 index 0000000000..2cff981b68 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactoryTest.java @@ -0,0 +1,29 @@ +package org.opendaylight.controller.cluster.datastore.shardstrategy; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.opendaylight.controller.md.cluster.datastore.model.TestModel; + +import static junit.framework.Assert.assertNotNull; + +public class ShardStrategyFactoryTest { + + @Rule + public ExpectedException expectedEx = ExpectedException.none(); + + @Test + public void testGetStrategy(){ + ShardStrategy strategy = ShardStrategyFactory.getStrategy(TestModel.TEST_PATH); + assertNotNull(strategy); + } + + @Test + public void testGetStrategyNullPointerExceptionWhenPathIsNull(){ + expectedEx.expect(NullPointerException.class); + expectedEx.expectMessage("path should not be null"); + + ShardStrategyFactory.getStrategy(null); + } + +} \ No newline at end of file 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 new file mode 100644 index 0000000000..7a1def9f89 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/TestModel.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.md.cluster.datastore.model; + +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +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.Collections; +import java.util.Set; + +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 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"; + + 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 QName TWO_QNAME = QName.create(TEST_QNAME,"two"); + public static final QName THREE_QNAME = QName.create(TEST_QNAME,"three"); + + + public static final InputStream getDatastoreTestInputStream() { + return getInputStream(DATASTORE_TEST_YANG); + } + + private static InputStream getInputStream(final String resourceName) { + return TestModel.class.getResourceAsStream(DATASTORE_TEST_YANG); + } + + public static SchemaContext createTestContext() { + YangParserImpl parser = new YangParserImpl(); + Set modules = parser.parseYangModelsFromStreams(Collections.singletonList(getDatastoreTestInputStream())); + return parser.resolveSchemaContext(modules); + } +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-test.yang b/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-test.yang new file mode 100644 index 0000000000..f6d0202fd5 --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-test.yang @@ -0,0 +1,42 @@ +module odl-datastore-test { + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test"; + prefix "store-test"; + + revision "2014-03-13" { + description "Initial revision."; + } + + container test { + list outer-list { + key id; + leaf id { + type uint16; + } + choice outer-choice { + case one { + leaf one { + type string; + } + } + case two-three { + leaf two { + type string; + } + leaf three { + type string; + } + } + } + list inner-list { + key name; + leaf name { + type string; + } + leaf value { + type string; + } + } + } + } +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/ResolveDataChangeEventsTask.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/ResolveDataChangeEventsTask.java index 2a163d8dbc..5021d070e1 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/ResolveDataChangeEventsTask.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/ResolveDataChangeEventsTask.java @@ -290,9 +290,8 @@ final class ResolveDataChangeEventsTask implements Callable> afterCont = (NormalizedNodeContainer>) afterData; return resolveNodeContainerReplaced(path, listeners, beforeCont, afterCont); } else if (!beforeData.equals(afterData)) { - // Node is either of Leaf type (does not contain child nodes) - // or we do not have listeners, so normal equals method is - // sufficient for determining change. + // Node is Leaf type (does not contain child nodes) + // so normal equals method is sufficient for determining change. LOG.trace("Resolving leaf replace event for {} , before {}, after {}",path,beforeData,afterData); DOMImmutableDataChangeEvent event = builder(DataChangeScope.BASE).setBefore(beforeData).setAfter(afterData) .addUpdated(path, beforeData, afterData).build(); @@ -421,9 +420,6 @@ final class ResolveDataChangeEventsTask implements Callable outerListLegacy = DataNormalizer.toLegacy(OUTER_LIST_WITH_CHOICE); - assertNotNull(outerListLegacy); - } - -} diff --git a/opendaylight/md-sal/sal-netconf-connector/pom.xml b/opendaylight/md-sal/sal-netconf-connector/pom.xml index 0dd25292c2..0bf4b3238d 100644 --- a/opendaylight/md-sal/sal-netconf-connector/pom.xml +++ b/opendaylight/md-sal/sal-netconf-connector/pom.xml @@ -25,7 +25,6 @@ ${project.groupId} sal-common-util - 1.1-SNAPSHOT ${project.groupId} diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/README-FIRST b/opendaylight/md-sal/sal-protocolbuffer-encoding/README-FIRST new file mode 100644 index 0000000000..778d8c6162 --- /dev/null +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/README-FIRST @@ -0,0 +1,23 @@ +Instructions on generating the protocol buffer Java source files + +These instructions are developers who are planning to generate the protocolbuffer java source files. + +1. We are using protocol buffer version 2.5.0 - you need to install the exact same version on your box. +The download link is https://code.google.com/p/protobuf/downloads/list. Download .tar/zip based on +your OS. + +2. Once downloaded the tar/zip and extracted follow the README instructions to compile protoc on your +machine + +3. Create your .proto (IDL) file in resources folder. Give appropriate package name so that the source + get generation in proper packages. For more information check + https://developers.google.com/protocol-buffers/docs/javatutorial + + For detailed information https://developers.google.com/protocol-buffers/docs/reference/java-generated + +4. To generate the java source files execute in sal-protocolbuffer-encoding directory + just run.sh in sal-protocolbuffer-encoding or execute the following command + + protoc --proto_path=src/main/resources --java_out=src/main/java src/main/resources/*.proto + +5. Run mvn clean install and resolve any trailing spaces issues & build the .jar diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/pom.xml b/opendaylight/md-sal/sal-protocolbuffer-encoding/pom.xml new file mode 100644 index 0000000000..671a9441d8 --- /dev/null +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + + + org.opendaylight.controller + sal-parent + 1.1-SNAPSHOT + + + sal-protocolbuffer-encoding + + bundle + + + + com.google.protobuf + protobuf-java + 2.5.0 + + + junit + junit + test + + + + diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/run.sh b/opendaylight/md-sal/sal-protocolbuffer-encoding/run.sh new file mode 100755 index 0000000000..72e2c87ecb --- /dev/null +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/run.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +##################################################################################################### +#Instructions on generating the protocol buffer Java source files +# +#These instructions are developers who are planning to generate the protocolbuffer java source files. +# +#1. We are using protocol buffer version 2.5.0 - you need to install the exact same version on your box. +#The download link is https://code.google.com/p/protobuf/downloads/list. Download .tar/zip based on +#your OS. +# +#2. Once downloaded the tar/zip and extracted follow the README instructions to compile protoc on your +#machine +# +#3. Create your .proto (IDL) file in resources folder. Give appropriate package name so that the source +# get generation in proper packages. For more information check +# https://developers.google.com/protocol-buffers/docs/javatutorial +# +# For detailed information https://developers.google.com/protocol-buffers/docs/reference/java-generated +# +#4. To generate the java source files execute in sal-protocolbuffer-encoding execute ./run.sh i.e. this script +# or run command +# protoc --proto_path=src/main/resources --java_out=src/main/java src/main/resources/*.proto +# +#5. Run mvn clean install and resolve any trailing spaces issues & build the .jar +######################################################################################################## + +protoc --proto_path=src/main/resources --java_out=src/main/java src/main/resources/*.proto + +echo "Done generating Java source files." \ No newline at end of file diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/registration/ListenerRegistrationMessages.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/registration/ListenerRegistrationMessages.java new file mode 100644 index 0000000000..afcb455c97 --- /dev/null +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/registration/ListenerRegistrationMessages.java @@ -0,0 +1,681 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ListenerRegistration.proto + +package org.opendaylight.controller.cluster.datastore.registration; + +public final class ListenerRegistrationMessages { + private ListenerRegistrationMessages() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public interface CloseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.Close} + */ + public static final class Close extends + com.google.protobuf.GeneratedMessage + implements CloseOrBuilder { + // Use Close.newBuilder() to construct. + private Close(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private Close(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final Close defaultInstance; + public static Close getDefaultInstance() { + return defaultInstance; + } + + public Close getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Close( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close.class, org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public Close parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Close(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close 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.Close} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close.class, org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close.Builder.class); + } + + // Construct using org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_Close_descriptor; + } + + public org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close getDefaultInstanceForType() { + return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close.getDefaultInstance(); + } + + public org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close build() { + org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close buildPartial() { + org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close result = new org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close) { + return mergeFrom((org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close other) { + if (other == org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.Close) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.Close) + } + + static { + defaultInstance = new Close(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.Close) + } + + public interface CloseReplyOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.CloseReply} + */ + public static final class CloseReply extends + com.google.protobuf.GeneratedMessage + implements CloseReplyOrBuilder { + // Use CloseReply.newBuilder() to construct. + private CloseReply(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private CloseReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final CloseReply defaultInstance; + public static CloseReply getDefaultInstance() { + return defaultInstance; + } + + public CloseReply getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private CloseReply( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply.class, org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public CloseReply parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CloseReply(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply 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.CloseReply} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReplyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply.class, org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply.Builder.class); + } + + // Construct using org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor; + } + + public org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply getDefaultInstanceForType() { + return org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply.getDefaultInstance(); + } + + public org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply build() { + org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply buildPartial() { + org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply result = new org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply) { + return mergeFrom((org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply other) { + if (other == org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.cluster.datastore.registration.ListenerRegistrationMessages.CloseReply) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CloseReply) + } + + static { + defaultInstance = new CloseReply(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CloseReply) + } + + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_Close_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_Close_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_CloseReply_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\032ListenerRegistration.proto\022!org.openda" + + "ylight.controller.mdsal\"\007\n\005Close\"\014\n\nClos" + + "eReplyBZ\n:org.opendaylight.controller.cl" + + "uster.datastore.registrationB\034ListenerRe" + + "gistrationMessages" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + internal_static_org_opendaylight_controller_mdsal_Close_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_org_opendaylight_controller_mdsal_Close_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_Close_descriptor, + new java.lang.String[] { }); + internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_org_opendaylight_controller_mdsal_CloseReply_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_CloseReply_descriptor, + new java.lang.String[] { }); + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/shard/ShardManagerMessages.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/shard/ShardManagerMessages.java new file mode 100644 index 0000000000..a8f1bf0373 --- /dev/null +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/shard/ShardManagerMessages.java @@ -0,0 +1,1172 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ShardManager.proto + +package org.opendaylight.controller.cluster.datastore.shard; + +public final class ShardManagerMessages { + private ShardManagerMessages() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public interface FindPrimaryOrBuilder + 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.FindPrimary} + */ + public static final class FindPrimary extends + com.google.protobuf.GeneratedMessage + implements FindPrimaryOrBuilder { + // Use FindPrimary.newBuilder() to construct. + private FindPrimary(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private FindPrimary(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final FindPrimary defaultInstance; + public static FindPrimary getDefaultInstance() { + return defaultInstance; + } + + public FindPrimary getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private FindPrimary( + 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; + shardName_ = input.readBytes(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_FindPrimary_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_FindPrimary_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary.class, org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public FindPrimary parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new FindPrimary(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + 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; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getShardNameBytes()); + } + 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, getShardNameBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary 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.FindPrimary} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimaryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_FindPrimary_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_FindPrimary_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary.class, org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary.Builder.class); + } + + // Construct using org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + shardName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_FindPrimary_descriptor; + } + + public org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary getDefaultInstanceForType() { + return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary.getDefaultInstance(); + } + + public org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary build() { + org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary buildPartial() { + org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary result = new org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary(this); + 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; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary) { + return mergeFrom((org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary other) { + if (other == org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary.getDefaultInstance()) return this; + 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; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.FindPrimary) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + 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.FindPrimary) + } + + static { + defaultInstance = new FindPrimary(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.FindPrimary) + } + + public interface PrimaryFoundOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.PrimaryFound} + */ + public static final class PrimaryFound extends + com.google.protobuf.GeneratedMessage + implements PrimaryFoundOrBuilder { + // Use PrimaryFound.newBuilder() to construct. + private PrimaryFound(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private PrimaryFound(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final PrimaryFound defaultInstance; + public static PrimaryFound getDefaultInstance() { + return defaultInstance; + } + + public PrimaryFound getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private PrimaryFound( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryFound_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryFound_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound.class, org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public PrimaryFound parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PrimaryFound(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound 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.PrimaryFound} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFoundOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryFound_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryFound_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound.class, org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound.Builder.class); + } + + // Construct using org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryFound_descriptor; + } + + public org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound getDefaultInstanceForType() { + return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound.getDefaultInstance(); + } + + public org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound build() { + org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound buildPartial() { + org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound result = new org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound) { + return mergeFrom((org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound other) { + if (other == org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryFound) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.PrimaryFound) + } + + static { + defaultInstance = new PrimaryFound(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.PrimaryFound) + } + + public interface PrimaryNotFoundOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.PrimaryNotFound} + */ + public static final class PrimaryNotFound extends + com.google.protobuf.GeneratedMessage + implements PrimaryNotFoundOrBuilder { + // Use PrimaryNotFound.newBuilder() to construct. + private PrimaryNotFound(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private PrimaryNotFound(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final PrimaryNotFound defaultInstance; + public static PrimaryNotFound getDefaultInstance() { + return defaultInstance; + } + + public PrimaryNotFound getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private PrimaryNotFound( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound.class, org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public PrimaryNotFound parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PrimaryNotFound(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound 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.PrimaryNotFound} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFoundOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound.class, org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound.Builder.class); + } + + // Construct using org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_descriptor; + } + + public org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound getDefaultInstanceForType() { + return org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound.getDefaultInstance(); + } + + public org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound build() { + org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound buildPartial() { + org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound result = new org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound) { + return mergeFrom((org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound other) { + if (other == org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages.PrimaryNotFound) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.PrimaryNotFound) + } + + static { + defaultInstance = new PrimaryNotFound(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.PrimaryNotFound) + } + + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_FindPrimary_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_FindPrimary_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_PrimaryFound_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_PrimaryFound_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_PrimaryNotFound_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\022ShardManager.proto\022!org.opendaylight.c" + + "ontroller.mdsal\" \n\013FindPrimary\022\021\n\tshardN" + + "ame\030\001 \002(\t\"\016\n\014PrimaryFound\"\021\n\017PrimaryNotF" + + "oundBK\n3org.opendaylight.controller.clus" + + "ter.datastore.shardB\024ShardManagerMessage" + + "s" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + internal_static_org_opendaylight_controller_mdsal_FindPrimary_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_org_opendaylight_controller_mdsal_FindPrimary_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_FindPrimary_descriptor, + new java.lang.String[] { "ShardName", }); + internal_static_org_opendaylight_controller_mdsal_PrimaryFound_descriptor = + getDescriptor().getMessageTypes().get(1); + 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[] { }); + 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[] { }); + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/transaction/ShardTransactionChainMessages.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/transaction/ShardTransactionChainMessages.java new file mode 100644 index 0000000000..5de32c8a66 --- /dev/null +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/transaction/ShardTransactionChainMessages.java @@ -0,0 +1,1493 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ShardTransactionChainMessages.proto + +package org.opendaylight.controller.cluster.datastore.transaction; + +public final class ShardTransactionChainMessages { + private ShardTransactionChainMessages() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public interface CloseTransactionChainOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.CloseTransactionChain} + */ + public static final class CloseTransactionChain extends + com.google.protobuf.GeneratedMessage + implements CloseTransactionChainOrBuilder { + // Use CloseTransactionChain.newBuilder() to construct. + private CloseTransactionChain(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private CloseTransactionChain(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final CloseTransactionChain defaultInstance; + public static CloseTransactionChain getDefaultInstance() { + return defaultInstance; + } + + public CloseTransactionChain getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private CloseTransactionChain( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public CloseTransactionChain parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CloseTransactionChain(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain 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.CloseTransactionChain} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain.Builder.class); + } + + // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_descriptor; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain getDefaultInstanceForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain.getDefaultInstance(); + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain build() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain buildPartial() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain) { + return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain other) { + if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChain) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CloseTransactionChain) + } + + static { + defaultInstance = new CloseTransactionChain(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CloseTransactionChain) + } + + public interface CloseTransactionChainReplyOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.CloseTransactionChainReply} + */ + public static final class CloseTransactionChainReply extends + com.google.protobuf.GeneratedMessage + implements CloseTransactionChainReplyOrBuilder { + // Use CloseTransactionChainReply.newBuilder() to construct. + private CloseTransactionChainReply(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private CloseTransactionChainReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final CloseTransactionChainReply defaultInstance; + public static CloseTransactionChainReply getDefaultInstance() { + return defaultInstance; + } + + public CloseTransactionChainReply getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private CloseTransactionChainReply( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public CloseTransactionChainReply parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CloseTransactionChainReply(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply 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.CloseTransactionChainReply} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReplyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.Builder.class); + } + + // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_descriptor; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply getDefaultInstanceForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.getDefaultInstance(); + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply build() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply buildPartial() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply) { + return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply other) { + if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CloseTransactionChainReply) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CloseTransactionChainReply) + } + + static { + defaultInstance = new CloseTransactionChainReply(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CloseTransactionChainReply) + } + + public interface CreateTransactionChainOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.CreateTransactionChain} + */ + public static final class CreateTransactionChain extends + com.google.protobuf.GeneratedMessage + implements CreateTransactionChainOrBuilder { + // Use CreateTransactionChain.newBuilder() to construct. + private CreateTransactionChain(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private CreateTransactionChain(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final CreateTransactionChain defaultInstance; + public static CreateTransactionChain getDefaultInstance() { + return defaultInstance; + } + + public CreateTransactionChain getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private CreateTransactionChain( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public CreateTransactionChain parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateTransactionChain(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain 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.CreateTransactionChain} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain.Builder.class); + } + + // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_descriptor; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain getDefaultInstanceForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain.getDefaultInstance(); + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain build() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain buildPartial() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain) { + return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain other) { + if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChain) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CreateTransactionChain) + } + + static { + defaultInstance = new CreateTransactionChain(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CreateTransactionChain) + } + + public interface CreateTransactionChainReplyOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string transactionChainPath = 1; + /** + * required string transactionChainPath = 1; + */ + boolean hasTransactionChainPath(); + /** + * required string transactionChainPath = 1; + */ + java.lang.String getTransactionChainPath(); + /** + * required string transactionChainPath = 1; + */ + com.google.protobuf.ByteString + getTransactionChainPathBytes(); + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.CreateTransactionChainReply} + */ + public static final class CreateTransactionChainReply extends + com.google.protobuf.GeneratedMessage + implements CreateTransactionChainReplyOrBuilder { + // Use CreateTransactionChainReply.newBuilder() to construct. + private CreateTransactionChainReply(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private CreateTransactionChainReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final CreateTransactionChainReply defaultInstance; + public static CreateTransactionChainReply getDefaultInstance() { + return defaultInstance; + } + + public CreateTransactionChainReply getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private CreateTransactionChainReply( + 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; + transactionChainPath_ = input.readBytes(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public CreateTransactionChainReply parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateTransactionChainReply(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // required string transactionChainPath = 1; + public static final int TRANSACTIONCHAINPATH_FIELD_NUMBER = 1; + private java.lang.Object transactionChainPath_; + /** + * required string transactionChainPath = 1; + */ + public boolean hasTransactionChainPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string transactionChainPath = 1; + */ + public java.lang.String getTransactionChainPath() { + java.lang.Object ref = transactionChainPath_; + 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()) { + transactionChainPath_ = s; + } + return s; + } + } + /** + * required string transactionChainPath = 1; + */ + public com.google.protobuf.ByteString + getTransactionChainPathBytes() { + java.lang.Object ref = transactionChainPath_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + transactionChainPath_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + transactionChainPath_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTransactionChainPath()) { + 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, getTransactionChainPathBytes()); + } + 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, getTransactionChainPathBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply 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.CreateTransactionChainReply} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReplyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.Builder.class); + } + + // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + transactionChainPath_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_descriptor; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply getDefaultInstanceForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.getDefaultInstance(); + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply build() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply buildPartial() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.transactionChainPath_ = transactionChainPath_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply) { + return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply other) { + if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply.getDefaultInstance()) return this; + if (other.hasTransactionChainPath()) { + bitField0_ |= 0x00000001; + transactionChainPath_ = other.transactionChainPath_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTransactionChainPath()){ + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionChainMessages.CreateTransactionChainReply) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // required string transactionChainPath = 1; + private java.lang.Object transactionChainPath_ = ""; + /** + * required string transactionChainPath = 1; + */ + public boolean hasTransactionChainPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string transactionChainPath = 1; + */ + public java.lang.String getTransactionChainPath() { + java.lang.Object ref = transactionChainPath_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + transactionChainPath_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string transactionChainPath = 1; + */ + public com.google.protobuf.ByteString + getTransactionChainPathBytes() { + java.lang.Object ref = transactionChainPath_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + transactionChainPath_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string transactionChainPath = 1; + */ + public Builder setTransactionChainPath( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + transactionChainPath_ = value; + onChanged(); + return this; + } + /** + * required string transactionChainPath = 1; + */ + public Builder clearTransactionChainPath() { + bitField0_ = (bitField0_ & ~0x00000001); + transactionChainPath_ = getDefaultInstance().getTransactionChainPath(); + onChanged(); + return this; + } + /** + * required string transactionChainPath = 1; + */ + public Builder setTransactionChainPathBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + transactionChainPath_ = value; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CreateTransactionChainReply) + } + + static { + defaultInstance = new CreateTransactionChainReply(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CreateTransactionChainReply) + } + + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n#ShardTransactionChainMessages.proto\022!o" + + "rg.opendaylight.controller.mdsal\"\027\n\025Clos" + + "eTransactionChain\"\034\n\032CloseTransactionCha" + + "inReply\"\030\n\026CreateTransactionChain\";\n\033Cre" + + "ateTransactionChainReply\022\034\n\024transactionC" + + "hainPath\030\001 \002(\tBZ\n9org.opendaylight.contr" + + "oller.cluster.datastore.transactionB\035Sha" + + "rdTransactionChainMessages" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_CloseTransactionChain_descriptor, + new java.lang.String[] { }); + internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_CloseTransactionChainReply_descriptor, + new java.lang.String[] { }); + internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_CreateTransactionChain_descriptor, + new java.lang.String[] { }); + internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_CreateTransactionChainReply_descriptor, + new java.lang.String[] { "TransactionChainPath", }); + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/transaction/ShardTransactionMessages.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/transaction/ShardTransactionMessages.java new file mode 100644 index 0000000000..3a226db3bc --- /dev/null +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/cluster/datastore/transaction/ShardTransactionMessages.java @@ -0,0 +1,3606 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ShardTransactionMessages.proto + +package org.opendaylight.controller.cluster.datastore.transaction; + +public final class ShardTransactionMessages { + private ShardTransactionMessages() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public interface CloseTransactionOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.CloseTransaction} + */ + public static final class CloseTransaction extends + com.google.protobuf.GeneratedMessage + implements CloseTransactionOrBuilder { + // Use CloseTransaction.newBuilder() to construct. + private CloseTransaction(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private CloseTransaction(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final CloseTransaction defaultInstance; + public static CloseTransaction getDefaultInstance() { + return defaultInstance; + } + + public CloseTransaction getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private CloseTransaction( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransaction_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransaction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public CloseTransaction parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CloseTransaction(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.CloseTransaction} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransaction_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransaction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction.Builder.class); + } + + // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransaction_descriptor; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction getDefaultInstanceForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction.getDefaultInstance(); + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction build() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction buildPartial() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction) { + return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction other) { + if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransaction) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CloseTransaction) + } + + static { + defaultInstance = new CloseTransaction(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CloseTransaction) + } + + public interface CloseTransactionReplyOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.CloseTransactionReply} + */ + public static final class CloseTransactionReply extends + com.google.protobuf.GeneratedMessage + implements CloseTransactionReplyOrBuilder { + // Use CloseTransactionReply.newBuilder() to construct. + private CloseTransactionReply(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private CloseTransactionReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final CloseTransactionReply defaultInstance; + public static CloseTransactionReply getDefaultInstance() { + return defaultInstance; + } + + public CloseTransactionReply getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private CloseTransactionReply( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public CloseTransactionReply parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CloseTransactionReply(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.CloseTransactionReply} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReplyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply.Builder.class); + } + + // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_descriptor; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply getDefaultInstanceForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply.getDefaultInstance(); + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply build() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply buildPartial() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply) { + return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply other) { + if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CloseTransactionReply) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CloseTransactionReply) + } + + static { + defaultInstance = new CloseTransactionReply(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CloseTransactionReply) + } + + public interface CreateTransactionOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.CreateTransaction} + */ + public static final class CreateTransaction extends + com.google.protobuf.GeneratedMessage + implements CreateTransactionOrBuilder { + // Use CreateTransaction.newBuilder() to construct. + private CreateTransaction(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private CreateTransaction(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final CreateTransaction defaultInstance; + public static CreateTransaction getDefaultInstance() { + return defaultInstance; + } + + public CreateTransaction getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private CreateTransaction( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransaction_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransaction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public CreateTransaction parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateTransaction(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.CreateTransaction} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransaction_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransaction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction.Builder.class); + } + + // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransaction_descriptor; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction getDefaultInstanceForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction.getDefaultInstance(); + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction build() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction buildPartial() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction) { + return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction other) { + if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransaction) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CreateTransaction) + } + + static { + defaultInstance = new CreateTransaction(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CreateTransaction) + } + + public interface CreateTransactionReplyOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string transactionPath = 1; + /** + * required string transactionPath = 1; + */ + boolean hasTransactionPath(); + /** + * required string transactionPath = 1; + */ + java.lang.String getTransactionPath(); + /** + * required string transactionPath = 1; + */ + com.google.protobuf.ByteString + getTransactionPathBytes(); + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.CreateTransactionReply} + */ + public static final class CreateTransactionReply extends + com.google.protobuf.GeneratedMessage + implements CreateTransactionReplyOrBuilder { + // Use CreateTransactionReply.newBuilder() to construct. + private CreateTransactionReply(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private CreateTransactionReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final CreateTransactionReply defaultInstance; + public static CreateTransactionReply getDefaultInstance() { + return defaultInstance; + } + + public CreateTransactionReply getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private CreateTransactionReply( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + transactionPath_ = input.readBytes(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public CreateTransactionReply parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateTransactionReply(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // required string transactionPath = 1; + public static final int TRANSACTIONPATH_FIELD_NUMBER = 1; + private java.lang.Object transactionPath_; + /** + * required string transactionPath = 1; + */ + public boolean hasTransactionPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string transactionPath = 1; + */ + public java.lang.String getTransactionPath() { + java.lang.Object ref = transactionPath_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + transactionPath_ = s; + } + return s; + } + } + /** + * required string transactionPath = 1; + */ + public com.google.protobuf.ByteString + getTransactionPathBytes() { + java.lang.Object ref = transactionPath_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + transactionPath_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + transactionPath_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTransactionPath()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTransactionPathBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTransactionPathBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.CreateTransactionReply} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReplyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply.Builder.class); + } + + // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + transactionPath_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply getDefaultInstanceForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply.getDefaultInstance(); + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply build() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply buildPartial() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.transactionPath_ = transactionPath_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply) { + return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply other) { + if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply.getDefaultInstance()) return this; + if (other.hasTransactionPath()) { + bitField0_ |= 0x00000001; + transactionPath_ = other.transactionPath_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTransactionPath()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.CreateTransactionReply) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // required string transactionPath = 1; + private java.lang.Object transactionPath_ = ""; + /** + * required string transactionPath = 1; + */ + public boolean hasTransactionPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string transactionPath = 1; + */ + public java.lang.String getTransactionPath() { + java.lang.Object ref = transactionPath_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + transactionPath_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string transactionPath = 1; + */ + public com.google.protobuf.ByteString + getTransactionPathBytes() { + java.lang.Object ref = transactionPath_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + transactionPath_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string transactionPath = 1; + */ + public Builder setTransactionPath( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + transactionPath_ = value; + onChanged(); + return this; + } + /** + * required string transactionPath = 1; + */ + public Builder clearTransactionPath() { + bitField0_ = (bitField0_ & ~0x00000001); + transactionPath_ = getDefaultInstance().getTransactionPath(); + onChanged(); + return this; + } + /** + * required string transactionPath = 1; + */ + public Builder setTransactionPathBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + transactionPath_ = value; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CreateTransactionReply) + } + + static { + defaultInstance = new CreateTransactionReply(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CreateTransactionReply) + } + + public interface ReadyTransactionOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.ReadyTransaction} + */ + public static final class ReadyTransaction extends + com.google.protobuf.GeneratedMessage + implements ReadyTransactionOrBuilder { + // Use ReadyTransaction.newBuilder() to construct. + private ReadyTransaction(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private ReadyTransaction(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final ReadyTransaction defaultInstance; + public static ReadyTransaction getDefaultInstance() { + return defaultInstance; + } + + public ReadyTransaction getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ReadyTransaction( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public ReadyTransaction parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ReadyTransaction(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.ReadyTransaction} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction.Builder.class); + } + + // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_descriptor; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction getDefaultInstanceForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction.getDefaultInstance(); + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction build() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction buildPartial() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction) { + return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction other) { + if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransaction) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.ReadyTransaction) + } + + static { + defaultInstance = new ReadyTransaction(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.ReadyTransaction) + } + + public interface ReadyTransactionReplyOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string actorPath = 1; + /** + * required string actorPath = 1; + */ + boolean hasActorPath(); + /** + * required string actorPath = 1; + */ + java.lang.String getActorPath(); + /** + * required string actorPath = 1; + */ + com.google.protobuf.ByteString + getActorPathBytes(); + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.ReadyTransactionReply} + */ + public static final class ReadyTransactionReply extends + com.google.protobuf.GeneratedMessage + implements ReadyTransactionReplyOrBuilder { + // Use ReadyTransactionReply.newBuilder() to construct. + private ReadyTransactionReply(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private ReadyTransactionReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final ReadyTransactionReply defaultInstance; + public static ReadyTransactionReply getDefaultInstance() { + return defaultInstance; + } + + public ReadyTransactionReply getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ReadyTransactionReply( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + actorPath_ = input.readBytes(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public ReadyTransactionReply parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ReadyTransactionReply(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // required string actorPath = 1; + public static final int ACTORPATH_FIELD_NUMBER = 1; + private java.lang.Object actorPath_; + /** + * required string actorPath = 1; + */ + public boolean hasActorPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string actorPath = 1; + */ + public java.lang.String getActorPath() { + java.lang.Object ref = actorPath_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + actorPath_ = s; + } + return s; + } + } + /** + * required string actorPath = 1; + */ + public com.google.protobuf.ByteString + getActorPathBytes() { + java.lang.Object ref = actorPath_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + actorPath_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + actorPath_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasActorPath()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getActorPathBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getActorPathBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.ReadyTransactionReply} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReplyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply.Builder.class); + } + + // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + actorPath_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_descriptor; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply getDefaultInstanceForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply.getDefaultInstance(); + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply build() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply buildPartial() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.actorPath_ = actorPath_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply) { + return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply other) { + if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply.getDefaultInstance()) return this; + if (other.hasActorPath()) { + bitField0_ |= 0x00000001; + actorPath_ = other.actorPath_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasActorPath()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadyTransactionReply) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // required string actorPath = 1; + private java.lang.Object actorPath_ = ""; + /** + * required string actorPath = 1; + */ + public boolean hasActorPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string actorPath = 1; + */ + public java.lang.String getActorPath() { + java.lang.Object ref = actorPath_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + actorPath_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string actorPath = 1; + */ + public com.google.protobuf.ByteString + getActorPathBytes() { + java.lang.Object ref = actorPath_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + actorPath_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string actorPath = 1; + */ + public Builder setActorPath( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + actorPath_ = value; + onChanged(); + return this; + } + /** + * required string actorPath = 1; + */ + public Builder clearActorPath() { + bitField0_ = (bitField0_ & ~0x00000001); + actorPath_ = getDefaultInstance().getActorPath(); + onChanged(); + return this; + } + /** + * required string actorPath = 1; + */ + public Builder setActorPathBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + actorPath_ = value; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.ReadyTransactionReply) + } + + static { + defaultInstance = new ReadyTransactionReply(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.ReadyTransactionReply) + } + + public interface DeleteDataOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string instanceIdentifierPath = 1; + /** + * required string instanceIdentifierPath = 1; + */ + boolean hasInstanceIdentifierPath(); + /** + * required string instanceIdentifierPath = 1; + */ + java.lang.String getInstanceIdentifierPath(); + /** + * required string instanceIdentifierPath = 1; + */ + com.google.protobuf.ByteString + getInstanceIdentifierPathBytes(); + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.DeleteData} + */ + public static final class DeleteData extends + com.google.protobuf.GeneratedMessage + implements DeleteDataOrBuilder { + // Use DeleteData.newBuilder() to construct. + private DeleteData(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private DeleteData(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final DeleteData defaultInstance; + public static DeleteData getDefaultInstance() { + return defaultInstance; + } + + public DeleteData getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private DeleteData( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + instanceIdentifierPath_ = input.readBytes(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteData_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteData_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public DeleteData parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeleteData(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // required string instanceIdentifierPath = 1; + public static final int INSTANCEIDENTIFIERPATH_FIELD_NUMBER = 1; + private java.lang.Object instanceIdentifierPath_; + /** + * required string instanceIdentifierPath = 1; + */ + public boolean hasInstanceIdentifierPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string 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; + } + } + /** + * required string 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; + } + } + + private void initFields() { + instanceIdentifierPath_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasInstanceIdentifierPath()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getInstanceIdentifierPathBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getInstanceIdentifierPathBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.DeleteData} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteData_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteData_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData.Builder.class); + } + + // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + instanceIdentifierPath_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteData_descriptor; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData getDefaultInstanceForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData.getDefaultInstance(); + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData build() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData buildPartial() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.instanceIdentifierPath_ = instanceIdentifierPath_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData) { + return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData other) { + if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData.getDefaultInstance()) return this; + if (other.hasInstanceIdentifierPath()) { + bitField0_ |= 0x00000001; + instanceIdentifierPath_ = other.instanceIdentifierPath_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasInstanceIdentifierPath()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteData) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // required string instanceIdentifierPath = 1; + private java.lang.Object instanceIdentifierPath_ = ""; + /** + * required string instanceIdentifierPath = 1; + */ + public boolean hasInstanceIdentifierPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string 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; + } else { + return (java.lang.String) ref; + } + } + /** + * required string 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; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string instanceIdentifierPath = 1; + */ + public Builder setInstanceIdentifierPath( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + instanceIdentifierPath_ = value; + onChanged(); + return this; + } + /** + * required string instanceIdentifierPath = 1; + */ + public Builder clearInstanceIdentifierPath() { + bitField0_ = (bitField0_ & ~0x00000001); + instanceIdentifierPath_ = getDefaultInstance().getInstanceIdentifierPath(); + onChanged(); + return this; + } + /** + * required string instanceIdentifierPath = 1; + */ + public Builder setInstanceIdentifierPathBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + instanceIdentifierPath_ = value; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.DeleteData) + } + + static { + defaultInstance = new DeleteData(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.DeleteData) + } + + public interface DeleteDataReplyOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.DeleteDataReply} + */ + public static final class DeleteDataReply extends + com.google.protobuf.GeneratedMessage + implements DeleteDataReplyOrBuilder { + // Use DeleteDataReply.newBuilder() to construct. + private DeleteDataReply(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private DeleteDataReply(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final DeleteDataReply defaultInstance; + public static DeleteDataReply getDefaultInstance() { + return defaultInstance; + } + + public DeleteDataReply getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private DeleteDataReply( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public DeleteDataReply parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeleteDataReply(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.DeleteDataReply} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReplyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply.Builder.class); + } + + // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_descriptor; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply getDefaultInstanceForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply.getDefaultInstance(); + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply build() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply buildPartial() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply) { + return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply other) { + if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.DeleteDataReply) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.DeleteDataReply) + } + + static { + defaultInstance = new DeleteDataReply(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.DeleteDataReply) + } + + public interface ReadDataOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string intanceIdentifier = 1; + /** + * required string intanceIdentifier = 1; + */ + boolean hasIntanceIdentifier(); + /** + * required string intanceIdentifier = 1; + */ + java.lang.String getIntanceIdentifier(); + /** + * required string intanceIdentifier = 1; + */ + com.google.protobuf.ByteString + getIntanceIdentifierBytes(); + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.ReadData} + */ + public static final class ReadData extends + com.google.protobuf.GeneratedMessage + implements ReadDataOrBuilder { + // Use ReadData.newBuilder() to construct. + private ReadData(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private ReadData(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final ReadData defaultInstance; + public static ReadData getDefaultInstance() { + return defaultInstance; + } + + public ReadData getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ReadData( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + intanceIdentifier_ = input.readBytes(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadData_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadData_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public ReadData parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ReadData(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // required string intanceIdentifier = 1; + public static final int INTANCEIDENTIFIER_FIELD_NUMBER = 1; + private java.lang.Object intanceIdentifier_; + /** + * required string intanceIdentifier = 1; + */ + public boolean hasIntanceIdentifier() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string intanceIdentifier = 1; + */ + public java.lang.String getIntanceIdentifier() { + java.lang.Object ref = intanceIdentifier_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + intanceIdentifier_ = s; + } + return s; + } + } + /** + * required string intanceIdentifier = 1; + */ + public com.google.protobuf.ByteString + getIntanceIdentifierBytes() { + java.lang.Object ref = intanceIdentifier_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + intanceIdentifier_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + intanceIdentifier_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasIntanceIdentifier()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getIntanceIdentifierBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getIntanceIdentifierBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.ReadData} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadDataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadData_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadData_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData.class, org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData.Builder.class); + } + + // Construct using org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + intanceIdentifier_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.internal_static_org_opendaylight_controller_mdsal_ReadData_descriptor; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData getDefaultInstanceForType() { + return org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData.getDefaultInstance(); + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData build() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData buildPartial() { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData result = new org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.intanceIdentifier_ = intanceIdentifier_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData) { + return mergeFrom((org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData other) { + if (other == org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData.getDefaultInstance()) return this; + if (other.hasIntanceIdentifier()) { + bitField0_ |= 0x00000001; + intanceIdentifier_ = other.intanceIdentifier_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasIntanceIdentifier()) { + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.opendaylight.controller.cluster.datastore.transaction.ShardTransactionMessages.ReadData) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // required string intanceIdentifier = 1; + private java.lang.Object intanceIdentifier_ = ""; + /** + * required string intanceIdentifier = 1; + */ + public boolean hasIntanceIdentifier() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string intanceIdentifier = 1; + */ + public java.lang.String getIntanceIdentifier() { + java.lang.Object ref = intanceIdentifier_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + intanceIdentifier_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string intanceIdentifier = 1; + */ + public com.google.protobuf.ByteString + getIntanceIdentifierBytes() { + java.lang.Object ref = intanceIdentifier_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + intanceIdentifier_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string intanceIdentifier = 1; + */ + public Builder setIntanceIdentifier( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + intanceIdentifier_ = value; + onChanged(); + return this; + } + /** + * required string intanceIdentifier = 1; + */ + public Builder clearIntanceIdentifier() { + bitField0_ = (bitField0_ & ~0x00000001); + intanceIdentifier_ = getDefaultInstance().getIntanceIdentifier(); + onChanged(); + return this; + } + /** + * required string intanceIdentifier = 1; + */ + public Builder setIntanceIdentifierBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + intanceIdentifier_ = value; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.ReadData) + } + + static { + defaultInstance = new ReadData(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.ReadData) + } + + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_CloseTransaction_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_CloseTransaction_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_CreateTransaction_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_CreateTransaction_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_DeleteData_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_DeleteData_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_ReadData_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_ReadData_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\036ShardTransactionMessages.proto\022!org.op" + + "endaylight.controller.mdsal\"\022\n\020CloseTran" + + "saction\"\027\n\025CloseTransactionReply\"\023\n\021Crea" + + "teTransaction\"1\n\026CreateTransactionReply\022" + + "\027\n\017transactionPath\030\001 \002(\t\"\022\n\020ReadyTransac" + + "tion\"*\n\025ReadyTransactionReply\022\021\n\tactorPa" + + "th\030\001 \002(\t\",\n\nDeleteData\022\036\n\026instanceIdenti" + + "fierPath\030\001 \002(\t\"\021\n\017DeleteDataReply\"%\n\010Rea" + + "dData\022\031\n\021intanceIdentifier\030\001 \002(\tBU\n9org." + + "opendaylight.controller.cluster.datastor", + "e.transactionB\030ShardTransactionMessages" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + internal_static_org_opendaylight_controller_mdsal_CloseTransaction_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_org_opendaylight_controller_mdsal_CloseTransaction_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_CloseTransaction_descriptor, + new java.lang.String[] { }); + internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_CloseTransactionReply_descriptor, + new java.lang.String[] { }); + internal_static_org_opendaylight_controller_mdsal_CreateTransaction_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_org_opendaylight_controller_mdsal_CreateTransaction_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_CreateTransaction_descriptor, + new java.lang.String[] { }); + internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_CreateTransactionReply_descriptor, + new java.lang.String[] { "TransactionPath", }); + internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_ReadyTransaction_descriptor, + new java.lang.String[] { }); + internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_ReadyTransactionReply_descriptor, + new java.lang.String[] { "ActorPath", }); + internal_static_org_opendaylight_controller_mdsal_DeleteData_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_org_opendaylight_controller_mdsal_DeleteData_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_DeleteData_descriptor, + new java.lang.String[] { "InstanceIdentifierPath", }); + internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_DeleteDataReply_descriptor, + new java.lang.String[] { }); + internal_static_org_opendaylight_controller_mdsal_ReadData_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_org_opendaylight_controller_mdsal_ReadData_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_ReadData_descriptor, + new java.lang.String[] { "IntanceIdentifier", }); + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ListenerRegistration.proto b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ListenerRegistration.proto new file mode 100644 index 0000000000..ec8046f557 --- /dev/null +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ListenerRegistration.proto @@ -0,0 +1,13 @@ +package org.opendaylight.controller.mdsal; + +option java_package = "org.opendaylight.controller.cluster.datastore.registration"; +option java_outer_classname = "ListenerRegistrationMessages"; + +message Close { + +} + +message CloseReply{ + +} + 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 new file mode 100644 index 0000000000..31e8c58b13 --- /dev/null +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardManager.proto @@ -0,0 +1,14 @@ +package org.opendaylight.controller.mdsal; + +option java_package = "org.opendaylight.controller.cluster.datastore.shard"; +option java_outer_classname = "ShardManagerMessages"; + +message FindPrimary { + required string shardName = 1; +} + +message PrimaryFound { +} + +message PrimaryNotFound { +} 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 new file mode 100644 index 0000000000..0b260c8071 --- /dev/null +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardTransaction.proto @@ -0,0 +1,39 @@ +package org.opendaylight.controller.mdsal; + +option java_package = "org.opendaylight.controller.cluster.datastore.transaction"; +option java_outer_classname = "ShardTransactionMessages"; + +message CloseTransaction{ +} + +message CloseTransactionReply{ + +} + +message CreateTransaction{ + +} + +message CreateTransactionReply{ +required string transactionPath = 1; + +} + +message ReadyTransaction{ + +} + +message ReadyTransactionReply{ +required string actorPath = 1; +} + +message DeleteData { +required string instanceIdentifierPath = 1; +} + +message DeleteDataReply{ + +} +message ReadData { +required string intanceIdentifier=1; +} \ No newline at end of file diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardTransactionChain.proto b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardTransactionChain.proto new file mode 100644 index 0000000000..73a9aa11c8 --- /dev/null +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/ShardTransactionChain.proto @@ -0,0 +1,23 @@ +package org.opendaylight.controller.mdsal; + +option java_package = "org.opendaylight.controller.cluster.datastore.transaction"; +option java_outer_classname = "ShardTransactionChainMessages"; + +message CloseTransactionChain { + +} + +message CloseTransactionChainReply{ + + +} + +message CreateTransactionChain { + +} + +message CreateTransactionChainReply{ +required string transactionChainPath = 1; + +} + diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/messages/ShardManagerMessagesTest.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/messages/ShardManagerMessagesTest.java new file mode 100644 index 0000000000..f57cfc9f10 --- /dev/null +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/test/java/org/opendaylight/controller/cluster/datastore/messages/ShardManagerMessagesTest.java @@ -0,0 +1,43 @@ +package org.opendaylight.controller.cluster.datastore.messages; + +/** + * This test case is present to ensure that if others have + * used proper version of protocol buffer. + * + * If a different version of protocol buffer is used then it would + * generate different java sources and would result in + * breaking of this test case. + * + * @author: syedbahm + * Date: 6/20/14 + * + */ + +import org.junit.Assert; +import org.junit.Test; +import org.opendaylight.controller.cluster.datastore.shard.ShardManagerMessages; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; + +public class ShardManagerMessagesTest { + + @Test + public void verifySerialization()throws Exception{ + ShardManagerMessages.FindPrimary.Builder builder = ShardManagerMessages.FindPrimary.newBuilder(); + builder.setShardName("Inventory"); + File testFile = new File("./test"); + FileOutputStream output = new FileOutputStream(testFile); + builder.build().writeTo(output); + output.close(); + + //Here we will read the same and check we got back what we had saved + ShardManagerMessages.FindPrimary findPrimary + = ShardManagerMessages.FindPrimary.parseFrom(new FileInputStream(testFile)); + Assert.assertEquals("Inventory", findPrimary.getShardName()); + + testFile.delete(); + + } +} diff --git a/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/consumer-service/pom.xml b/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/consumer-service/pom.xml index 89695c124a..8435884e7b 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/consumer-service/pom.xml +++ b/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/consumer-service/pom.xml @@ -14,34 +14,28 @@ org.opendaylight.controller containermanager - 0.5.2-SNAPSHOT org.opendaylight.controller sal - 0.8.1-SNAPSHOT org.opendaylight.controller sal-binding-api - 1.1-SNAPSHOT org.opendaylight.controller sal-common-util - 1.1-SNAPSHOT org.opendaylight.controller sal-common-util - 1.1-SNAPSHOT org.opendaylight.controller sal-core-api - 1.1-SNAPSHOT org.opendaylight.yangtools diff --git a/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/provider-service/pom.xml b/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/provider-service/pom.xml index bd0e43bada..2b9dc0cf25 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/provider-service/pom.xml +++ b/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/provider-service/pom.xml @@ -33,30 +33,25 @@ org.opendaylight.controller sal-binding-api - 1.1-SNAPSHOT org.opendaylight.controller sal-common-util - 1.1-SNAPSHOT org.opendaylight.controller sal-core-api - 1.1-SNAPSHOT org.opendaylight.controller containermanager - 0.5.2-SNAPSHOT org.opendaylight.controller sal - 0.8.1-SNAPSHOT org.opendaylight.yangtools @@ -77,12 +72,10 @@ org.opendaylight.controller sal-common-util - 1.1-SNAPSHOT org.opendaylight.controller sal-remoterpc-connector - 1.1-SNAPSHOT diff --git a/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-it/pom.xml b/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-it/pom.xml index 84e9d29c72..0ffc330f90 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-it/pom.xml +++ b/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-it/pom.xml @@ -13,29 +13,12 @@ https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL - - 2.3.0 - 3.0.0 - 1.5.0 - - - - - - commons-codec - commons-codec - 1.7 - - - - org.ops4j.pax.exam maven-paxexam-plugin - 1.2.4 generate-config @@ -53,7 +36,7 @@ org.eclipse.m2e lifecycle-mapping - 1.0.0 + ${lifecycle.mapping.version} @@ -90,22 +73,18 @@ org.opendaylight.yangtools.thirdparty xtend-lib-osgi - 2.4.3 org.opendaylight.controller.tests sal-remoterpc-connector-test-provider - 1.1-SNAPSHOT org.opendaylight.controller.tests sal-remoterpc-connector-test-consumer - 1.1-SNAPSHOT org.opendaylight.controller sal-broker-impl - 1.1-SNAPSHOT org.ops4j.pax.exam @@ -128,55 +107,45 @@ org.ops4j.pax.url pax-url-aether - 1.5.2 test equinoxSDK381 org.eclipse.osgi - 3.8.1.v20120830-144521 test org.slf4j log4j-over-slf4j - 1.7.2 ch.qos.logback logback-core - 1.0.9 ch.qos.logback logback-classic - 1.0.9 org.opendaylight.controller sal-binding-api - 1.0-SNAPSHOT org.opendaylight.controller sal-common-util - 1.0-SNAPSHOT org.opendaylight.controller sal-core-api - 1.0-SNAPSHOT org.opendaylight.controller sal-remoterpc-connector - 1.0-SNAPSHOT org.opendaylight.controller containermanager - 0.5.1-SNAPSHOT org.osgi @@ -211,29 +180,24 @@ org.opendaylight.controller sal-common-util - 1.0-SNAPSHOT org.opendaylight.yangtools.thirdparty antlr4-runtime-osgi-nohead - 4.0 org.opendaylight.controller zeromq-routingtable.implementation - 0.4.1-SNAPSHOT org.opendaylight.controller clustering.services - 0.4.1-SNAPSHOT org.opendaylight.controller sal - 0.5.1-SNAPSHOT org.osgi @@ -244,7 +208,6 @@ org.opendaylight.controller sal.implementation - 0.4.0-SNAPSHOT commons-io @@ -255,7 +218,6 @@ org.opendaylight.controller containermanager - 0.5.0-SNAPSHOT org.osgi @@ -270,7 +232,6 @@ org.opendaylight.controller containermanager.it.implementation - 0.5.0-SNAPSHOT commons-io @@ -281,7 +242,6 @@ org.opendaylight.controller clustering.stub - 0.4.0-SNAPSHOT commons-io @@ -293,7 +253,6 @@ org.apache.felix org.apache.felix.dependencymanager.shell - 3.0.1 org.osgi @@ -304,7 +263,6 @@ eclipselink javax.resource - 1.5.0.v200906010428 com.google.guava @@ -313,12 +271,10 @@ org.opendaylight.controller sal - 0.5.1-SNAPSHOT org.opendaylight.controller ietf-netconf-monitoring - 0.2.5-SNAPSHOT org.opendaylight.yangtools @@ -327,38 +283,31 @@ org.opendaylight.yangtools.model yang-ext - 2013.09.07.3 org.opendaylight.yangtools.model opendaylight-l2-types - 2013.08.27.3 org.opendaylight.controller sal-binding-it - 1.0-SNAPSHOT org.opendaylight.controller sal-binding-config - 1.0-SNAPSHOT org.opendaylight.controller sal-binding-broker-impl - 1.0-SNAPSHOT org.opendaylight.controller sal-broker-impl - 1.0-SNAPSHOT org.opendaylight.controller.model model-inventory - 1.0-SNAPSHOT org.opendaylight.yangtools @@ -367,24 +316,20 @@ org.opendaylight.controller sal-connector-api - 1.0-SNAPSHOT org.opendaylight.controller sal-common-util - 1.0-SNAPSHOT org.opendaylight.controller clustering.services - 0.4.1-SNAPSHOT equinoxSDK381 org.eclipse.osgi - 3.8.1.v20120830-144521 @@ -408,19 +353,16 @@ org.zeromq jeromq - 0.3.1 org.opendaylight.yangtools.thirdparty xtend-lib-osgi - 2.4.3 test org.opendaylight.controller sal-binding-broker-impl - 1.0-SNAPSHOT provided @@ -478,23 +420,19 @@ equinoxSDK381 org.eclipse.osgi - 3.8.1.v20120830-144521 test org.slf4j log4j-over-slf4j - 1.7.2 ch.qos.logback logback-core - 1.0.9 ch.qos.logback logback-classic - 1.0.9 org.mockito @@ -504,13 +442,11 @@ org.opendaylight.controller.model model-flow-service - 1.0-SNAPSHOT provided org.opendaylight.controller config-manager - 0.2.3-SNAPSHOT commons-io @@ -521,13 +457,11 @@ org.opendaylight.controller.model model-flow-management - 1.0-SNAPSHOT provided org.opendaylight.yangtools.thirdparty antlr4-runtime-osgi-nohead - 4.0 diff --git a/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-nb/pom.xml b/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-nb/pom.xml index b041cb430a..b681db27fb 100644 --- a/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-nb/pom.xml +++ b/opendaylight/md-sal/sal-remoterpc-connector/integrationtest/test-nb/pom.xml @@ -59,37 +59,30 @@ org.opendaylight.controller containermanager - 0.5.1-SNAPSHOT org.opendaylight.controller commons.northbound - 0.4.1-SNAPSHOT org.opendaylight.controller sal - 0.5.1-SNAPSHOT org.opendaylight.controller.tests sal-remoterpc-connector-test-provider - 1.0-SNAPSHOT org.opendaylight.controller.tests sal-remoterpc-connector-test-consumer - 1.0-SNAPSHOT org.opendaylight.controller sal-remoterpc-connector - 1.0-SNAPSHOT org.osgi org.osgi.core - 5.0.0 junit @@ -98,7 +91,6 @@ org.opendaylight.controller remoterpc-routingtable.implementation - 0.4.1-SNAPSHOT com.google.guava diff --git a/opendaylight/md-sal/sal-rest-connector/pom.xml b/opendaylight/md-sal/sal-rest-connector/pom.xml index c2d245badb..46f4a2366a 100644 --- a/opendaylight/md-sal/sal-rest-connector/pom.xml +++ b/opendaylight/md-sal/sal-rest-connector/pom.xml @@ -17,7 +17,6 @@ ${project.groupId} sal-core-api - 1.1-SNAPSHOT com.google.code.gson @@ -62,7 +61,6 @@ org.jboss.resteasy jaxrs-api - 3.0.4.Final provided @@ -80,7 +78,6 @@ org.glassfish.jersey.test-framework.providers jersey-test-framework-provider-grizzly2 - 2.4 test diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlReader.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlReader.java index 171805a179..1d6ca15f3c 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlReader.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlReader.java @@ -14,14 +14,13 @@ import java.io.IOException; import java.io.InputStream; import java.net.URI; import java.util.Stack; - import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.Characters; import javax.xml.stream.events.StartElement; import javax.xml.stream.events.XMLEvent; - import org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper; import org.opendaylight.controller.sal.restconf.impl.EmptyNodeWrapper; import org.opendaylight.controller.sal.restconf.impl.IdentityValuesDTO; @@ -131,17 +130,9 @@ public class XmlReader { private boolean isSimpleNodeEvent(final XMLEvent event) throws XMLStreamException { checkArgument(event != null, "XML Event cannot be NULL!"); if (event.isStartElement()) { - if (eventReader.hasNext()) { - final XMLEvent innerEvent; - innerEvent = eventReader.peek(); - if (innerEvent.isCharacters()) { - final Characters chars = innerEvent.asCharacters(); - if (!chars.isWhiteSpace()) { - return true; - } - } else if (innerEvent.isEndElement()) { - return true; - } + XMLEvent innerEvent = skipCommentsAndWhitespace(); + if ( innerEvent != null && (innerEvent.isCharacters() || innerEvent.isEndElement())) { + return true; } } return false; @@ -150,16 +141,8 @@ public class XmlReader { private boolean isCompositeNodeEvent(final XMLEvent event) throws XMLStreamException { checkArgument(event != null, "XML Event cannot be NULL!"); if (event.isStartElement()) { - if (eventReader.hasNext()) { - XMLEvent innerEvent; - innerEvent = eventReader.peek(); - if (innerEvent.isCharacters()) { - Characters chars = innerEvent.asCharacters(); - if (chars.isWhiteSpace()) { - eventReader.nextEvent(); - innerEvent = eventReader.peek(); - } - } + XMLEvent innerEvent = skipCommentsAndWhitespace(); + if( innerEvent != null ) { if (innerEvent.isStartElement()) { return true; } @@ -168,6 +151,26 @@ public class XmlReader { return false; } + private XMLEvent skipCommentsAndWhitespace() throws XMLStreamException { + while( eventReader.hasNext() ) { + XMLEvent event = eventReader.peek(); + if( event.getEventType() == XMLStreamConstants.COMMENT ) { + eventReader.nextEvent(); + continue; + } + + if( event.isCharacters() ) { + Characters chars = event.asCharacters(); + if( chars.isWhiteSpace() ) { + eventReader.nextEvent(); + continue; + } + } + return event; + } + return null; + } + private CompositeNodeWrapper resolveCompositeNodeFromStartElement(final StartElement startElement) { checkArgument(startElement != null, "Start Element cannot be NULL!"); return new CompositeNodeWrapper(getNamespaceFor(startElement), getLocalNameFor(startElement)); diff --git a/opendaylight/md-sal/sal-rest-docgen/pom.xml b/opendaylight/md-sal/sal-rest-docgen/pom.xml index 79a3434c49..0c8b4d5a2a 100644 --- a/opendaylight/md-sal/sal-rest-docgen/pom.xml +++ b/opendaylight/md-sal/sal-rest-docgen/pom.xml @@ -36,8 +36,6 @@ org.apache.commons commons-lang3 - 3.3.2 - diff --git a/opendaylight/md-sal/samples/l2switch/implementation/pom.xml b/opendaylight/md-sal/samples/l2switch/implementation/pom.xml index 10a9d6ddad..8824284785 100644 --- a/opendaylight/md-sal/samples/l2switch/implementation/pom.xml +++ b/opendaylight/md-sal/samples/l2switch/implementation/pom.xml @@ -32,7 +32,6 @@ org.opendaylight.controller.model model-topology - 1.1-SNAPSHOT org.opendaylight.controller.samples.l2switch.md diff --git a/opendaylight/md-sal/samples/toaster-it/pom.xml b/opendaylight/md-sal/samples/toaster-it/pom.xml index 2fcb2f6d63..56ed9a07a6 100644 --- a/opendaylight/md-sal/samples/toaster-it/pom.xml +++ b/opendaylight/md-sal/samples/toaster-it/pom.xml @@ -21,18 +21,15 @@ org.opendaylight.controller.samples sample-toaster - 1.1-SNAPSHOT org.opendaylight.controller.samples sample-toaster-consumer - 1.1-SNAPSHOT org.opendaylight.controller.samples sample-toaster-provider - 1.1-SNAPSHOT org.openexi @@ -50,7 +47,6 @@ equinoxSDK381 org.eclipse.osgi - 3.8.1.v20120830-144521 test @@ -72,7 +68,6 @@ org.ops4j.pax.exam maven-paxexam-plugin - 1.2.4 generate-config diff --git a/opendaylight/md-sal/samples/toaster-it/src/test/resources/controller.xml b/opendaylight/md-sal/samples/toaster-it/src/test/resources/controller.xml index 61c24c6b64..57581d100d 100644 --- a/opendaylight/md-sal/samples/toaster-it/src/test/resources/controller.xml +++ b/opendaylight/md-sal/samples/toaster-it/src/test/resources/controller.xml @@ -1,45 +1,92 @@ + + + - - - - urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&revision=2013-10-28 - - urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom?module=opendaylight-md-sal-dom&revision=2013-10-28 - - urn:opendaylight:params:xml:ns:yang:controller:config?module=config&revision=2013-04-05 - - urn:ietf:params:netconf:capability:candidate:1.0 - urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring?module=ietf-netconf-monitoring&revision=2010-10-04 - urn:ietf:params:xml:ns:yang:rpc-context?module=rpc-context&revision=2013-06-17 - - - urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl?module=opendaylight-sal-binding-broker-impl&revision=2013-10-28 - - urn:ietf:params:xml:ns:yang:ietf-inet-types?module=ietf-inet-types&revision=2010-09-24 - - urn:ietf:params:netconf:capability:rollback-on-error:1.0 - urn:ietf:params:xml:ns:yang:ietf-yang-types?module=ietf-yang-types&revision=2010-09-24 - - - urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:impl?module=opendaylight-sal-dom-broker-impl&revision=2013-10-28 - - urn:opendaylight:params:xml:ns:yang:controller:logback:config?module=config-logging&revision=2013-07-16 - - - urn:opendaylight:params:xml:ns:yang:controller:md:sal:common?module=opendaylight-md-sal-common&revision=2013-10-28 - - http://netconfcentral.org/ns/toaster?module=toaster&revision=2009-11-20 - urn:opendaylight:params:xml:ns:yang:controller:config:kitchen-service:impl?module=kitchen-service-impl&revision=2014-01-31 - urn:opendaylight:params:xml:ns:yang:controller:config:toaster-provider:impl?module=toaster-provider-impl&revision=2014-01-31 - - - + + prefix:schema-service-singleton + yang-schema-service + + + prefix:runtime-generated-mapping + runtime-mapping-singleton + + + prefix:binding-notification-broker + binding-notification-broker + + + prefix:binding-broker-impl + binding-broker-impl + + binding:binding-notification-service + binding-notification-broker + + + binding:binding-data-broker + binding-data-broker + + + + + + prefix:dom-inmemory-data-broker + inmemory-data-broker + + dom:schema-service + yang-schema-service + + + + prefix:dom-broker-impl + inmemory-dom-broker + + dom:dom-async-data-broker + inmemory-data-broker + + + + prefix:binding-data-compatible-broker + inmemory-binding-data-broker + + dom:dom-broker-osgi-registry + dom-broker + + + binding:binding-dom-mapping-service + runtime-mapping-singleton + + + + prefix:binding-forwarded-data-broker + binding-async-data-broker + + + dom:dom-broker-osgi-registry + dom-broker + + + binding:binding-dom-mapping-service + runtime-mapping-singleton + + + + + prefix:toaster-provider-impl @@ -53,17 +100,18 @@ binding:binding-data-broker - ref_binding-data-broker + binding-data-broker binding:binding-notification-service - ref_binding-notification-broker + binding-notification-broker + prefix:kitchen-service-impl @@ -79,126 +127,37 @@ binding:binding-notification-service - ref_binding-notification-broker - - - - - - prefix:schema-service-singleton - - yang-schema-service - - - - prefix:hash-map-data-store - - hash-map-data-store - - - - prefix:dom-broker-impl - - dom-broker - - - dom:dom-data-store - - ref_hash-map-data-store - - - - - prefix:binding-broker-impl - - binding-broker-impl - - - binding:binding-notification-service - - ref_binding-notification-broker + binding-notification-broker - - - binding:binding-data-broker - - ref_binding-data-broker - - - - - prefix:runtime-generated-mapping - - runtime-mapping-singleton - - - - prefix:binding-notification-broker - - binding-notification-broker - - - - prefix:binding-data-broker - - binding-data-broker - - - dom:dom-broker-osgi-registry - - ref_dom-broker - - - - binding:binding-dom-mapping-service - - ref_runtime-mapping-singleton - - - - kitchen:kitchen-service - - - kitchen-service - /modules/module[type='kitchen-service-impl'][name='kitchen-service-impl'] - + dom:schema-service + + yang-schema-service + /modules/module[type='schema-service-singleton'][name='yang-schema-service'] + - - dom:schema-service - + binding-impl:binding-dom-mapping-service - ref_yang-schema-service - - /config/modules/module[name='schema-service-singleton']/instance[name='yang-schema-service'] - + runtime-mapping-singleton + /modules/module[type='runtime-generated-mapping'][name='runtime-mapping-singleton'] - - binding:binding-notification-service - + binding:binding-notification-service - ref_binding-notification-broker - - /config/modules/module[name='binding-notification-broker']/instance[name='binding-notification-broker'] - + binding-notification-broker + /modules/module[type='binding-notification-broker'][name='binding-notification-broker'] - - dom:dom-data-store - + binding:binding-broker-osgi-registry - ref_hash-map-data-store - - /config/modules/module[name='hash-map-data-store']/instance[name='hash-map-data-store'] - + binding-osgi-broker + /modules/module[type='binding-broker-impl'][name='binding-broker-impl'] @@ -208,54 +167,65 @@ /modules/module[type='binding-broker-impl'][name='binding-broker-impl'] + - - binding:binding-broker-osgi-registry - + dom:dom-broker-osgi-registry - ref_binding-broker-impl - - /config/modules/module[name='binding-broker-impl']/instance[name='binding-broker-impl'] - + dom-broker + /modules/module[type='dom-broker-impl'][name='inmemory-dom-broker'] + - - binding-impl:binding-dom-mapping-service - + binding:binding-data-broker - ref_runtime-mapping-singleton - - /config/modules/module[name='runtime-generated-mapping']/instance[name='runtime-mapping-singleton'] - + binding-data-broker + /modules/module[type='binding-data-compatible-broker'][name='inmemory-binding-data-broker'] + - - dom:dom-broker-osgi-registry - + binding:binding-async-data-broker - ref_dom-broker - /config/modules/module[name='dom-broker-impl']/instance[name='dom-broker'] - + binding-data-broker + /modules/module[type='binding-forwarded-data-broker'][name='binding-async-data-broker'] + - - binding:binding-data-broker - + dom:dom-async-data-broker - ref_binding-data-broker - - /config/modules/module[name='binding-data-broker']/instance[name='binding-data-broker'] - + inmemory-data-broker + /modules/module[type='dom-inmemory-data-broker'][name='inmemory-data-broker'] + + + + + kitchen:kitchen-service + + + kitchen-service + /modules/module[type='kitchen-service-impl'][name='kitchen-service-impl'] + + - - + + urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&revision=2013-10-28 + urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom?module=opendaylight-md-sal-dom&revision=2013-10-28 + urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl?module=opendaylight-sal-binding-broker-impl&revision=2013-10-28 + urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:impl?module=opendaylight-sal-dom-broker-impl&revision=2013-10-28 + urn:opendaylight:params:xml:ns:yang:controller:md:sal:common?module=opendaylight-md-sal-common&revision=2013-10-28 + + http://netconfcentral.org/ns/toaster?module=toaster&revision=2009-11-20 + urn:opendaylight:params:xml:ns:yang:controller:config:kitchen-service:impl?module=kitchen-service-impl&revision=2014-01-31 + urn:opendaylight:params:xml:ns:yang:controller:config:toaster-provider:impl?module=toaster-provider-impl&revision=2014-01-31 + + + diff --git a/opendaylight/md-sal/topology-lldp-discovery/pom.xml b/opendaylight/md-sal/topology-lldp-discovery/pom.xml index a51f6c2f9f..2c8571ca64 100644 --- a/opendaylight/md-sal/topology-lldp-discovery/pom.xml +++ b/opendaylight/md-sal/topology-lldp-discovery/pom.xml @@ -28,7 +28,6 @@ commons-lang commons-lang - 2.4 equinoxSDK381 diff --git a/opendaylight/md-sal/topology-manager/pom.xml b/opendaylight/md-sal/topology-manager/pom.xml index 55244d3c90..fe1813a199 100644 --- a/opendaylight/md-sal/topology-manager/pom.xml +++ b/opendaylight/md-sal/topology-manager/pom.xml @@ -34,7 +34,6 @@ org.opendaylight.controller.model model-topology - 1.1-SNAPSHOT org.osgi diff --git a/opendaylight/netconf/netconf-api/pom.xml b/opendaylight/netconf/netconf-api/pom.xml index 815acec5e7..a15047224b 100644 --- a/opendaylight/netconf/netconf-api/pom.xml +++ b/opendaylight/netconf/netconf-api/pom.xml @@ -19,7 +19,6 @@ ${project.groupId} ietf-netconf-monitoring-extension - ${project.version} org.opendaylight.controller diff --git a/opendaylight/netconf/netconf-client/pom.xml b/opendaylight/netconf/netconf-client/pom.xml index f46d149033..bf27ed6f4d 100644 --- a/opendaylight/netconf/netconf-client/pom.xml +++ b/opendaylight/netconf/netconf-client/pom.xml @@ -72,7 +72,6 @@ org.apache.maven.plugins maven-jar-plugin - 2.4 diff --git a/opendaylight/netconf/netconf-impl/pom.xml b/opendaylight/netconf/netconf-impl/pom.xml index c60506ef44..c6544466d4 100644 --- a/opendaylight/netconf/netconf-impl/pom.xml +++ b/opendaylight/netconf/netconf-impl/pom.xml @@ -19,7 +19,6 @@ ${project.groupId} ietf-netconf-monitoring-extension - ${project.version} @@ -81,7 +80,6 @@ ${project.groupId} netconf-client - ${project.version} test-jar test @@ -109,7 +107,6 @@ org.apache.felix maven-bundle-plugin - 2.3.7 org.opendaylight.controller.netconf.impl.osgi.NetconfImplActivator @@ -156,7 +153,6 @@ org.apache.maven.plugins maven-jar-plugin - 2.4 diff --git a/opendaylight/netconf/netconf-it/pom.xml b/opendaylight/netconf/netconf-it/pom.xml index c40dfe7fc3..0e9589d2d2 100644 --- a/opendaylight/netconf/netconf-it/pom.xml +++ b/opendaylight/netconf/netconf-it/pom.xml @@ -10,9 +10,6 @@ netconf-it ${project.artifactId} - - 2.0.0 - @@ -177,7 +174,6 @@ org.ops4j.pax.exam maven-paxexam-plugin - 1.2.4 generate-config diff --git a/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/client/SshClientAdapter.java b/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/client/SshClientAdapter.java index 87056db06c..cf4ec213c2 100644 --- a/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/client/SshClientAdapter.java +++ b/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/client/SshClientAdapter.java @@ -12,7 +12,6 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -20,6 +19,8 @@ import java.util.LinkedList; import java.util.Queue; import java.util.concurrent.atomic.AtomicBoolean; import org.opendaylight.controller.netconf.nettyutil.handler.ssh.virtualsocket.VirtualSocketException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -27,6 +28,8 @@ import org.opendaylight.controller.netconf.nettyutil.handler.ssh.virtualsocket.V * pipeline. */ public class SshClientAdapter implements Runnable { + private static final Logger logger = LoggerFactory.getLogger(SshClientAdapter.class); + private static final int BUFFER_SIZE = 1024; private final SshClient sshClient; @@ -49,8 +52,15 @@ public class SshClientAdapter implements Runnable { } public void run() { + SshSession session; + try { + session = sshClient.openSession(); + } catch (IOException e) { + logger.error("Cannot establish session", e); + sshClient.close(); + return; + } try { - SshSession session = sshClient.openSession(); invoker.invoke(session); InputStream stdOut = session.getStdout(); session.getStderr(); @@ -82,7 +92,7 @@ public class SshClientAdapter implements Runnable { // Netty closed connection prematurely. // Just pass and move on. } catch (Exception e) { - throw new IllegalStateException(e); + logger.error("Unexpected exception", e); } finally { sshClient.close(); diff --git a/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/virtualsocket/ChannelInputStream.java b/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/virtualsocket/ChannelInputStream.java index 2a3eeb21a8..ba65b9ef34 100644 --- a/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/virtualsocket/ChannelInputStream.java +++ b/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/virtualsocket/ChannelInputStream.java @@ -93,6 +93,7 @@ public class ChannelInputStream extends InputStream implements ChannelInboundHan synchronized(lock) { this.bb.discardReadBytes(); this.bb.writeBytes((ByteBuf) o); + ((ByteBuf) o).release(); lock.notifyAll(); } } diff --git a/opendaylight/netconf/netconf-ssh/pom.xml b/opendaylight/netconf/netconf-ssh/pom.xml index cbd3efc57f..8a2387d2c1 100644 --- a/opendaylight/netconf/netconf-ssh/pom.xml +++ b/opendaylight/netconf/netconf-ssh/pom.xml @@ -56,7 +56,6 @@ org.apache.felix maven-bundle-plugin - 2.3.7 org.opendaylight.controller.netconf.ssh.osgi.NetconfSSHActivator @@ -81,7 +80,6 @@ org.apache.maven.plugins maven-jar-plugin - 2.4 diff --git a/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/threads/Handshaker.java b/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/threads/Handshaker.java index d999d378d9..8045d32a50 100644 --- a/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/threads/Handshaker.java +++ b/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/threads/Handshaker.java @@ -100,14 +100,14 @@ public class Handshaker implements Runnable { @Override public void run() { // let ganymed process handshake - logger.trace("{} SocketThread is started", session); + logger.trace("{} is started", session); try { // TODO this should be guarded with a timer to prevent resource exhaustion ganymedConnection.connect(); } catch (IOException e) { - logger.warn("{} SocketThread error ", session, e); + logger.debug("{} connection error", session, e); } - logger.trace("{} SocketThread is exiting", session); + logger.trace("{} is exiting", session); } } diff --git a/opendaylight/netconf/netconf-tcp/pom.xml b/opendaylight/netconf/netconf-tcp/pom.xml index 65da6e987e..3c4ee4728d 100644 --- a/opendaylight/netconf/netconf-tcp/pom.xml +++ b/opendaylight/netconf/netconf-tcp/pom.xml @@ -47,7 +47,6 @@ org.apache.felix maven-bundle-plugin - 2.3.7 org.opendaylight.controller.netconf.tcp.osgi.NetconfTCPActivator diff --git a/opendaylight/netconf/netconf-util/pom.xml b/opendaylight/netconf/netconf-util/pom.xml index f3b35ce3ce..df4d389705 100644 --- a/opendaylight/netconf/netconf-util/pom.xml +++ b/opendaylight/netconf/netconf-util/pom.xml @@ -53,7 +53,6 @@ org.apache.felix maven-bundle-plugin - 2.3.7 com.google.common.base, com.google.common.collect, io.netty.channel, @@ -69,7 +68,6 @@ org.apache.maven.plugins maven-jar-plugin - 2.4 diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Match.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Match.java index cfe20a1fa2..4b8966c546 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Match.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6Match.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013-2014 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -69,6 +69,16 @@ public class V6Match extends OFMatch implements Cloneable { private static int IPV6_EXT_MIN_HDR_LEN = 36; + /** + * CFI bit in VLAN TCI field. + */ + private static final int VLAN_TCI_CFI = 1 << 12; + + /** + * Value of OFP_VLAN_NONE defined by OpenFlow 1.0. + */ + private static final short OFP_VLAN_NONE = (short) 0xffff; + private enum MatchFieldState { MATCH_ABSENT, MATCH_FIELD_ONLY, MATCH_FIELD_WITH_MASK } @@ -334,11 +344,15 @@ public class V6Match extends OFMatch implements Cloneable { private byte[] getVlanTCI(short dataLayerVirtualLanID, byte dataLayerVirtualLanPriorityCodePoint) { ByteBuffer vlan_tci = ByteBuffer.allocate(2); - int cfi = 1 << 12; // the cfi bit is in position 12 - int pcp = dataLayerVirtualLanPriorityCodePoint << 13; // the pcp fields - // have to move by - // 13 - int vlan_tci_int = pcp + cfi + dataLayerVirtualLanID; + int vlan_tci_int; + if (dataLayerVirtualLanID == OFP_VLAN_NONE) { + // Match only packets without VLAN tag. + vlan_tci_int = 0; + } else { + // the pcp fields have to move by 13 + int pcp = dataLayerVirtualLanPriorityCodePoint << 13; + vlan_tci_int = pcp + VLAN_TCI_CFI + dataLayerVirtualLanID; + } vlan_tci.put((byte) (vlan_tci_int >> 8)); // bits 8 to 15 vlan_tci.put((byte) vlan_tci_int); // bits 0 to 7 return vlan_tci.array(); @@ -542,7 +556,12 @@ public class V6Match extends OFMatch implements Cloneable { ethTypeState = MatchFieldState.MATCH_FIELD_ONLY; match_len += 6; } else if (values[0].equals(STR_DL_VLAN)) { - this.dataLayerVirtualLan = U16.t(Integer.valueOf(values[1])); + short vlan = U16.t(Integer.valueOf(values[1])); + if (this.dlVlanPCPState != MatchFieldState.MATCH_ABSENT && + vlan == OFP_VLAN_NONE) { + throw new IllegalArgumentException("DL_VLAN_PCP is set."); + } + this.dataLayerVirtualLan = vlan; this.dlVlanIDState = MatchFieldState.MATCH_FIELD_ONLY; // the variable dlVlanIDState is not really used as a flag // for serializing and deserializing. Rather it is used as a @@ -552,6 +571,9 @@ public class V6Match extends OFMatch implements Cloneable { if (this.dlVlanPCPState != MatchFieldState.MATCH_ABSENT) { this.dlVlanTCIState = MatchFieldState.MATCH_FIELD_ONLY; match_len -= 2; + } else if (this.dataLayerVirtualLan == OFP_VLAN_NONE) { + this.dlVlanTCIState = MatchFieldState.MATCH_FIELD_ONLY; + match_len += 6; } else { this.dlVlanTCIState = MatchFieldState.MATCH_FIELD_WITH_MASK; this.dataLayerVirtualLanTCIMask = 0x1fff; @@ -559,6 +581,11 @@ public class V6Match extends OFMatch implements Cloneable { } this.wildcards &= ~OFPFW_DL_VLAN; } else if (values[0].equals(STR_DL_VLAN_PCP)) { + if (this.dlVlanIDState != MatchFieldState.MATCH_ABSENT && + this.dataLayerVirtualLan == OFP_VLAN_NONE) { + throw new IllegalArgumentException + ("OFP_VLAN_NONE is specified to DL_VLAN."); + } this.dataLayerVirtualLanPriorityCodePoint = U8.t(Short .valueOf(values[1])); this.dlVlanPCPState = MatchFieldState.MATCH_FIELD_ONLY; @@ -858,12 +885,20 @@ public class V6Match extends OFMatch implements Cloneable { // get the vlan pcp byte firstByte = data.get(); byte secondByte = data.get(); - super.setDataLayerVirtualLanPriorityCodePoint(getVlanPCP(firstByte)); - super.setDataLayerVirtualLan(getVlanID(firstByte, secondByte)); + if (firstByte == 0 && secondByte == 0) { + // Match only packets without VLAN tag. + setDataLayerVirtualLan(OFP_VLAN_NONE); + } else if (((firstByte << 8) & VLAN_TCI_CFI) == 0) { + // Ignore invalid TCI field. + return; + } else { + super.setDataLayerVirtualLanPriorityCodePoint(getVlanPCP(firstByte)); + super.setDataLayerVirtualLan(getVlanID(firstByte, secondByte)); + this.wildcards ^= (1 << 20); + } this.dlVlanTCIState = MatchFieldState.MATCH_FIELD_ONLY; this.match_len += 6; this.wildcards ^= (1 << 1); // Sync with 0F 1.0 Match - this.wildcards ^= (1 << 20); } } } @@ -1241,7 +1276,6 @@ public class V6Match extends OFMatch implements Cloneable { * * @return */ - public Inet6Address getNetworkDest() { return this.nwDst; } @@ -1251,7 +1285,6 @@ public class V6Match extends OFMatch implements Cloneable { * * @return */ - public Inet6Address getNetworkSrc() { return this.nwSrc; } @@ -1316,7 +1349,19 @@ public class V6Match extends OFMatch implements Cloneable { } } + /** + * Set a value to VLAN ID match field. + * + * @param vlan A value to match for VLAN ID. + * @param mask A bitmask for VLAN ID. + */ public void setDataLayerVirtualLan(short vlan, short mask) { + if (vlan == OFP_VLAN_NONE + && this.dlVlanIDState != MatchFieldState.MATCH_ABSENT) { + throw new IllegalStateException + ("DL_VLAN_PCP is set."); + } + // mask is ignored as the code sets the appropriate mask super.dataLayerVirtualLan = vlan; this.dlVlanIDState = MatchFieldState.MATCH_FIELD_ONLY; @@ -1327,6 +1372,9 @@ public class V6Match extends OFMatch implements Cloneable { if (this.dlVlanPCPState != MatchFieldState.MATCH_ABSENT) { this.dlVlanTCIState = MatchFieldState.MATCH_FIELD_ONLY; match_len -= 2; + } else if (this.dataLayerVirtualLan == OFP_VLAN_NONE) { + this.dlVlanTCIState = MatchFieldState.MATCH_FIELD_ONLY; + match_len += 6; } else { this.dlVlanTCIState = MatchFieldState.MATCH_FIELD_WITH_MASK; this.dataLayerVirtualLanTCIMask = 0x1fff; @@ -1334,7 +1382,19 @@ public class V6Match extends OFMatch implements Cloneable { } } + /** + * Set a value to VLAN PCP match field. + * + * @param pcp A value to match for VLAN PCP. + * @param mask A bitmask for VLAN PCP. + */ public void setDataLayerVirtualLanPriorityCodePoint(byte pcp, byte mask) { + if (this.dlVlanIDState != MatchFieldState.MATCH_ABSENT + && this.dataLayerVirtualLan == OFP_VLAN_NONE) { + throw new IllegalStateException + ("OFP_VLAN_NONE is specified to DL_VLAN."); + } + // mask is ignored as the code sets the appropriate mask super.dataLayerVirtualLanPriorityCodePoint = pcp; this.dlVlanPCPState = MatchFieldState.MATCH_FIELD_ONLY; diff --git a/opendaylight/protocol_plugins/openflow/src/test/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6MatchTest.java b/opendaylight/protocol_plugins/openflow/src/test/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6MatchTest.java new file mode 100644 index 0000000000..fceaaf46c9 --- /dev/null +++ b/opendaylight/protocol_plugins/openflow/src/test/java/org/opendaylight/controller/protocol_plugin/openflow/vendorextension/v6extension/V6MatchTest.java @@ -0,0 +1,461 @@ +/* + * Copyright (c) 2014 NEC Corporation + * All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.controller.protocol_plugin.openflow.vendorextension.v6extension; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.openflow.protocol.OFMatch.OFPFW_ALL; +import static org.openflow.protocol.OFMatch.OFPFW_DL_VLAN; +import static org.openflow.protocol.OFMatch.OFPFW_DL_VLAN_PCP; +import static org.openflow.protocol.OFMatch.OFPFW_IN_PORT; + +import java.nio.ByteBuffer; +import org.junit.Test; + +/** + * JUnit test for {@link V6Match}. + */ +public class V6MatchTest { + /** + * Header of a match entry for input port field without a mask. + * The vendor-specific value is 0, and the length of value is 2. + */ + private static int HEADER_INPUT_PORT = (0 << 9) | 2; + + /** + * Header of a match entry for VLAN TCI field without a mask. + * The vendor-specific value is 4, and the length of value is 2. + */ + private static int HEADER_VLAN_TCI= (4 << 9) | 2; + + /** + * Header of a match entry for VLAN TCI field with a mask. + * The vendor-specific value is 4, and the length of value is 4. + */ + private static int HEADER_VLAN_TCI_W = (4 << 9) | (1 << 8) | 4; + + /** + * Length of a match entry for input port field. + * Header (4 bytes) + value (2 bytes) = 6 bytes. + */ + private static short MATCH_LEN_INPUT_PORT = 6; + + /** + * Length of a match entry for VLAN TCI field without a mask. + * Header (4 bytes) + value (2 bytes) = 6 bytes. + */ + private static short MATCH_LEN_VLAN_TCI = 6; + + /** + * Length of a match entry for VLAN TCI field with a mask. + * Header (4 bytes) + value (2 bytes) + bitmask (2 bytes) = 8 bytes. + */ + private static short MATCH_LEN_VLAN_TCI_WITH_MASK = 8; + + /** + * Value of OFP_VLAN_NONE defined by OpenFlow 1.0. + */ + private static final short OFP_VLAN_NONE = (short)0xffff; + + /** + * CFI bit in VLAN TCI field. + */ + private static final int VLAN_TCI_CFI = 1 << 12; + + /** + * Test case for {@link V6Match#fromString(String)} about VLAN TCI field. + * This test passes values to "dl_vlan" and "dl_vpcp". + */ + @Test + public void testFromStringVlanTci() { + // Test for "dl_vlan" using non OFP_VLAN_NONE values. + short vlans[] = {1, 10, 1000, 4095}; + short mask = 0; + for (short vlan: vlans) { + V6Match match = new V6Match(); + match.fromString("dl_vlan=" + vlan); + assertEquals(MATCH_LEN_VLAN_TCI_WITH_MASK, match.getIPv6MatchLen()); + assertEquals(vlan, match.getDataLayerVirtualLan()); + int wildcards = OFPFW_ALL & ~OFPFW_DL_VLAN; + assertEquals(wildcards, match.getWildcards()); + } + + // Test for "dl_vpcp". + byte pcps[] = {1, 3, 7}; + for (byte pcp: pcps) { + V6Match match = new V6Match(); + match.fromString("dl_vpcp=" + pcp); + assertEquals(MATCH_LEN_VLAN_TCI_WITH_MASK, match.getIPv6MatchLen()); + assertEquals(pcp, match.getDataLayerVirtualLanPriorityCodePoint()); + int wildcards = OFPFW_ALL & ~OFPFW_DL_VLAN_PCP; + assertEquals(wildcards, match.getWildcards()); + } + + // Set "dl_vlan" field firstly, "dl_vpcp" field secondly. + for (short vlan: vlans) { + for (byte pcp: pcps) { + V6Match match = new V6Match(); + match.fromString("dl_vlan=" + vlan); + match.fromString("dl_vpcp=" + pcp); + assertEquals(MATCH_LEN_VLAN_TCI, match.getIPv6MatchLen()); + assertEquals(vlan, match.getDataLayerVirtualLan()); + assertEquals(pcp, + match.getDataLayerVirtualLanPriorityCodePoint()); + } + } + + // Set "dl_vpcp" field firstly, "dl_vlan" field secondly. + for (short vlan: vlans) { + for (byte pcp: pcps) { + V6Match match = new V6Match(); + match.fromString("dl_vpcp=" + pcp); + match.fromString("dl_vlan=" + vlan); + assertEquals(MATCH_LEN_VLAN_TCI, match.getIPv6MatchLen()); + assertEquals(vlan, match.getDataLayerVirtualLan()); + assertEquals(pcp, + match.getDataLayerVirtualLanPriorityCodePoint()); + } + } + + // Test for OFP_VLAN_NONE when VLAN PCP is not set. + V6Match match = new V6Match(); + match.fromString("dl_vlan=" + OFP_VLAN_NONE); + assertEquals(MATCH_LEN_VLAN_TCI, match.getIPv6MatchLen()); + assertEquals(OFP_VLAN_NONE, match.getDataLayerVirtualLan()); + + // Test for OFP_VLAN_NONE when VLAN PCP is set. + match = new V6Match(); + match.fromString("dl_vpcp=" + 1); + try { + match.fromString("dl_vlan=" + OFP_VLAN_NONE); + fail("Throwing exception was expected."); + } catch (IllegalArgumentException e) { + // Throwing exception was expected. + } + } + + /** + * Test case for {@link V6Match#writeTo(ByteBuffer)} for VLAN TCI field. + */ + @Test + public void testWriteToVlanTci() { + byte mask = 0; + + // Set only VLAN ID. + short vlans[] = {1, 10, 1000, 4095}; + for (short vlan: vlans) { + V6Match match = new V6Match(); + match.setDataLayerVirtualLan(vlan, mask); + ByteBuffer data = ByteBuffer.allocate(10); + match.writeTo(data); + assertEquals(MATCH_LEN_VLAN_TCI_WITH_MASK, data.position()); + data.flip(); + // Header + assertEquals(HEADER_VLAN_TCI_W, data.getInt()); + // Value + short expectedTci = (short) (VLAN_TCI_CFI | vlan); + assertEquals(expectedTci, data.getShort()); + // Mask + short expectedMask = 0x1fff; + assertEquals(expectedMask, data.getShort()); + } + + // Set only VLAN PCP. + byte pcps[] = {1, 3, 7}; + for (byte pcp: pcps) { + V6Match match = new V6Match(); + match.setDataLayerVirtualLanPriorityCodePoint(pcp, mask); + ByteBuffer data = ByteBuffer.allocate(10); + match.writeTo(data); + assertEquals(MATCH_LEN_VLAN_TCI_WITH_MASK, data.position()); + data.flip(); + // Header + assertEquals(HEADER_VLAN_TCI_W, data.getInt()); + // Value + short expectedTci = (short) (pcp << 13 | VLAN_TCI_CFI); + assertEquals(expectedTci, data.getShort()); + // Mask + short expectedMask = (short) 0xf000; + assertEquals(expectedMask, data.getShort()); + } + + // Set both VLAN ID and PCP. + for (short vlan: vlans) { + for (byte pcp: pcps) { + V6Match match = new V6Match(); + match.setDataLayerVirtualLan(vlan, mask); + match.setDataLayerVirtualLanPriorityCodePoint(pcp, mask); + ByteBuffer data = ByteBuffer.allocate(10); + match.writeTo(data); + assertEquals(MATCH_LEN_VLAN_TCI, data.position()); + data.flip(); + // Header + assertEquals(HEADER_VLAN_TCI, data.getInt()); + // Value + short expectedTci = (short) (pcp << 13 | VLAN_TCI_CFI | vlan); + assertEquals(expectedTci, data.getShort()); + } + } + + // Set OFP_VLAN_NONE. + V6Match match = new V6Match(); + match.setDataLayerVirtualLan(OFP_VLAN_NONE, mask); + ByteBuffer data = ByteBuffer.allocate(10); + match.writeTo(data); + assertEquals(MATCH_LEN_VLAN_TCI, data.position()); + data.flip(); + // Header + assertEquals(HEADER_VLAN_TCI, data.getInt()); + // Value + assertEquals(0, data.getShort()); + } + + /** + * Test case for {@link V6Match#writeTo(ByteBuffer)} for input port field. + */ + @Test + public void testWriteToInputPort() { + // Set input port. + short ports[] = {1, 10, 100, 1000}; + for (short port: ports) { + V6Match match = new V6Match(); + match.setInputPort(port, (short) 0); + ByteBuffer data = ByteBuffer.allocate(10); + match.writeTo(data); + assertEquals(MATCH_LEN_INPUT_PORT, data.position()); + data.flip(); + // Header + assertEquals(HEADER_INPUT_PORT, data.getInt()); + // Value + assertEquals(port, data.getShort()); + } + } + + /** + * Test case for {@link V6Match#readFrom(ByteBuffer)} for VLAN TCI field. + */ + @Test + public void testReadFromVlanTci() { + // Test for an exact match a TCI value with CFI=1. + // It matches packets that have an 802.1Q header with a specified + // VID and PCP. + short vlans[] = {1, 10, 1000, 4095}; + byte pcps[] = {1, 3, 7}; + for (short vlan: vlans) { + for (byte pcp: pcps) { + ByteBuffer data = ByteBuffer.allocate(MATCH_LEN_VLAN_TCI); + data.putInt(HEADER_VLAN_TCI); + short tci = (short) (pcp << 13 | VLAN_TCI_CFI | vlan); + data.putShort(tci); + data.flip(); + + V6Match match = new V6Match(); + match.readFrom(data); + assertEquals(MATCH_LEN_VLAN_TCI, match.getIPv6MatchLen()); + assertEquals(pcp, + match.getDataLayerVirtualLanPriorityCodePoint()); + assertEquals(vlan, match.getDataLayerVirtualLan()); + int wildcards = OFPFW_ALL & ~OFPFW_DL_VLAN_PCP & ~OFPFW_DL_VLAN; + assertEquals(wildcards, match.getWildcards()); + } + } + + // Test with a specific VID and CFI=1 with mask=0x1fff. + // It matches packets that have an 802.1Q header with that VID + // and any PCP. + for (short vlan: vlans) { + ByteBuffer data = ByteBuffer.allocate(MATCH_LEN_VLAN_TCI_WITH_MASK); + data.putInt(HEADER_VLAN_TCI_W); + short tci = (short) (VLAN_TCI_CFI | vlan); + data.putShort(tci); + short mask = (short) 0x1fff; + data.putShort(mask); + data.flip(); + + V6Match match = new V6Match(); + match.readFrom(data); + assertEquals(MATCH_LEN_VLAN_TCI_WITH_MASK, match.getIPv6MatchLen()); + assertEquals(vlan, match.getDataLayerVirtualLan()); + int wildcards = OFPFW_ALL & ~OFPFW_DL_VLAN; + assertEquals(wildcards, match.getWildcards()); + } + + // Test with a specific PCP and CFI=1 with mask=0xf000. + // It matches packets that have an 802.1Q header with that PCP + // and any VID. + for (byte pcp: pcps) { + ByteBuffer data = ByteBuffer.allocate(MATCH_LEN_VLAN_TCI_WITH_MASK); + data.putInt(HEADER_VLAN_TCI_W); + short tci = (short) (pcp << 13| VLAN_TCI_CFI); + data.putShort(tci); + short mask = (short) 0xf000; + data.putShort(mask); + data.flip(); + + V6Match match = new V6Match(); + match.readFrom(data); + assertEquals(MATCH_LEN_VLAN_TCI_WITH_MASK, match.getIPv6MatchLen()); + assertEquals(pcp, match.getDataLayerVirtualLanPriorityCodePoint()); + int wildcards = OFPFW_ALL & ~OFPFW_DL_VLAN_PCP; + assertEquals(wildcards, match.getWildcards()); + } + + // Test for an exact match with 0. + // It matches only packets without an 802.1Q header. + ByteBuffer data = ByteBuffer.allocate(MATCH_LEN_VLAN_TCI); + data.putInt(HEADER_VLAN_TCI); + short tci = 0; + data.putShort(tci); + data.flip(); + + V6Match match = new V6Match(); + match.readFrom(data); + assertEquals(MATCH_LEN_VLAN_TCI, match.getIPv6MatchLen()); + assertEquals(OFP_VLAN_NONE, match.getDataLayerVirtualLan()); + int wildcards = OFPFW_ALL & ~OFPFW_DL_VLAN; + assertEquals(wildcards, match.getWildcards()); + } + + /** + * Test case for {@link V6Match#readFrom(ByteBuffer)} for input port field. + */ + @Test + public void testReadFromInputPort() { + // Set input port. + short ports[] = {1, 10, 100, 1000}; + for (short port: ports) { + ByteBuffer data = ByteBuffer.allocate(MATCH_LEN_INPUT_PORT); + data.putInt(HEADER_INPUT_PORT); + data.putShort(port); + data.flip(); + + V6Match match = new V6Match(); + match.readFrom(data); + assertEquals(MATCH_LEN_INPUT_PORT, match.getIPv6MatchLen()); + assertEquals(port, match.getInputPort()); + int wildcards = OFPFW_ALL & ~OFPFW_IN_PORT; + assertEquals(wildcards, match.getWildcards()); + } + } + + /** + * Test case for {@link V6Match#setDataLayerVirtualLan(short, short)}. + */ + @Test + public void testSetDataLayerVirtualLan() { + short vlans[] = {1, 10, 1000, 4095}; + short mask = 0; + for (short vlan: vlans) { + V6Match match = new V6Match(); + match.setDataLayerVirtualLan(vlan, mask); + assertEquals(MATCH_LEN_VLAN_TCI_WITH_MASK, match.getIPv6MatchLen()); + assertEquals(vlan, match.getDataLayerVirtualLan()); + } + + // Test for OFP_VLAN_NONE. + V6Match match = new V6Match(); + match.setDataLayerVirtualLan(OFP_VLAN_NONE, mask); + assertEquals(MATCH_LEN_VLAN_TCI, match.getIPv6MatchLen()); + assertEquals(OFP_VLAN_NONE, match.getDataLayerVirtualLan()); + } + + /** + * Test case for + * {@link V6Match#setDataLayerVirtualLanPriorityCodePoint(byte, byte)}. + */ + @Test + public void testSetDataLayerVirtualLanPriorityCodePoint() { + byte pcps[] = {1, 3, 7}; + byte mask = 0; + for (byte pcp: pcps) { + V6Match match = new V6Match(); + match.setDataLayerVirtualLanPriorityCodePoint(pcp, mask); + assertEquals(MATCH_LEN_VLAN_TCI_WITH_MASK, match.getIPv6MatchLen()); + assertEquals(pcp, match.getDataLayerVirtualLanPriorityCodePoint()); + } + } + + /** + * Test case for setter methods for VLAN TCI field. + * + * This test case calls {@link V6Match#setDataLayerVirtualLan(short, short)} + * and {@link V6Match#setDataLayerVirtualLanPriorityCodePoint(byte, byte)}. + */ + @Test + public void testSetVlanTCI() { + short vlans[] = {1, 10, 1000, 4095}; + byte pcps[] = {1, 3, 7}; + byte mask = 0; + + // Call setDataLayerVirtualLan(short, short) firstly, + // and setDataLayerVirtualLanPriorityCodePoint(byte, byte) secondly, + for (short vlan: vlans) { + for (byte pcp: pcps) { + V6Match match = new V6Match(); + match.setDataLayerVirtualLan(vlan, mask); + match.setDataLayerVirtualLanPriorityCodePoint(pcp, mask); + assertEquals(MATCH_LEN_VLAN_TCI, match.getIPv6MatchLen()); + assertEquals(vlan, match.getDataLayerVirtualLan()); + assertEquals(pcp, + match.getDataLayerVirtualLanPriorityCodePoint()); + } + } + + // Call setDataLayerVirtualLanPriorityCodePoint(byte, byte) firstly, + // and setDataLayerVirtualLan(short, short) secondly. + for (short vlan: vlans) { + for (byte pcp: pcps) { + V6Match match = new V6Match(); + match.setDataLayerVirtualLanPriorityCodePoint(pcp, mask); + match.setDataLayerVirtualLan(vlan, mask); + assertEquals(MATCH_LEN_VLAN_TCI, match.getIPv6MatchLen()); + assertEquals(vlan, match.getDataLayerVirtualLan()); + assertEquals(pcp, + match.getDataLayerVirtualLanPriorityCodePoint()); + } + } + + // Test for setting OFP_VLAN_NONE when VLAN PCP is set. + for (byte pcp: pcps) { + V6Match match = new V6Match(); + match.setDataLayerVirtualLanPriorityCodePoint(pcp, mask); + try { + match.setDataLayerVirtualLan(OFP_VLAN_NONE, mask); + } catch (IllegalStateException e) { + // Throwing exception was expected. + } + } + + // Test for set VLAN PCP when OFP_VLAN_NONE is set to VLAN match. + for (byte pcp: pcps) { + V6Match match = new V6Match(); + match.setDataLayerVirtualLan(OFP_VLAN_NONE, mask); + try { + match.setDataLayerVirtualLanPriorityCodePoint(pcp, mask); + } catch (IllegalStateException e) { + // Throwing exception was expected. + } + } + } + + /** + * Test case for {@link V6Match#setInputPort(short, short)}. + */ + @Test + public void testSetInputPort() { + short ports[] = {1, 10, 100, 1000}; + for (short port: ports) { + V6Match match = new V6Match(); + match.setInputPort(port, (short) 0); + assertEquals(MATCH_LEN_INPUT_PORT, match.getIPv6MatchLen()); + assertEquals(port, match.getInputPort()); + } + } +}