diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2016-04-11 21:23:57 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2016-04-12 11:05:25 +0200 |
commit | 6bad7a88fa8b0be4f371897447f78abe7c52f805 (patch) | |
tree | 2eedfc7c1fcc3d255e3f03011845e46a2ce0832f /v3po/impl/src/main/java | |
parent | f93415dd8b3719b380b4295ab364420b9bf3d927 (diff) |
HONEYCOMB-34: Config tree initialization using binding data broker
Change-Id: I070aca2cc35dd10ea5bde19c8cbf4cad1c50f468
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/impl/src/main/java')
4 files changed, 13 insertions, 47 deletions
diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java index 36eeb8598..8ed83d53a 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java +++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java @@ -20,10 +20,6 @@ import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Futures; -import io.fd.honeycomb.v3po.data.ModifiableDataTree; -import io.fd.honeycomb.v3po.data.ReadableDataTree; -import io.fd.honeycomb.v3po.translate.read.ReaderRegistry; -import io.fd.honeycomb.v3po.translate.write.WriterRegistry; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -71,31 +67,22 @@ public class V3poProvider implements BindingAwareProvider, AutoCloseable, Broker private static final Logger LOG = LoggerFactory.getLogger(V3poProvider.class); private final Broker domBroker; private final BindingNormalizedNodeSerializer serializer; + private final DOMDataBroker domDataBroker; private RpcRegistration<V3poService> v3poService; private VppIetfInterfaceListener vppInterfaceListener; private VppBridgeDomainListener vppBridgeDomainListener; private vppApi api; - private ReaderRegistry readerRegistry; - private WriterRegistry writerRegistry; private DataBroker db; VppPollOperDataImpl vppPollOperData; private VppDataBrokerInitializationProvider vppDataBrokerInitializationProvider; - private final ModifiableDataTree configDataTree; - private final ReadableDataTree operationalDataTree; public V3poProvider(@Nonnull final Broker domBroker, final vppApi vppJapi, - @Nonnull final ReaderRegistry readerRegistry, - @Nonnull final WriterRegistry writerRegistry, @Nonnull final BindingNormalizedNodeSerializer serializer, - @Nonnull final ModifiableDataTree configDataTree, - @Nonnull final ReadableDataTree operationalDataTree) { + @Nonnull final DOMDataBroker domDataBroker) { api = vppJapi; - this.readerRegistry = Preconditions.checkNotNull(readerRegistry, "readerRegistry should not be null"); - this.writerRegistry = Preconditions.checkNotNull(writerRegistry, "writerRegistry should not be null"); this.domBroker = Preconditions.checkNotNull(domBroker, "domBroker should not be null"); this.serializer = Preconditions.checkNotNull(serializer, "serializer should not be null"); - this.configDataTree = Preconditions.checkNotNull(configDataTree, "configDataTree should not be null"); - this.operationalDataTree = Preconditions.checkNotNull(operationalDataTree, "operationalDataTree should not be null"); + this.domDataBroker = Preconditions.checkNotNull(domDataBroker, "domDataBroker should not be null"); } private void initializeVppConfig() { @@ -206,7 +193,7 @@ public class V3poProvider implements BindingAwareProvider, AutoCloseable, Broker startOperationalUpdateTimer(); // TODO make configurable: - vppDataBrokerInitializationProvider = new VppDataBrokerInitializationProvider(db, readerRegistry, writerRegistry, serializer, configDataTree, operationalDataTree); + vppDataBrokerInitializationProvider = new VppDataBrokerInitializationProvider(db, serializer, domDataBroker); // TODO pull the registration into Module domBroker.registerProvider(vppDataBrokerInitializationProvider); } diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java index bbb004b73..c1d22f9da 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java +++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java @@ -20,11 +20,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.base.Optional; import com.google.common.base.Preconditions; -import io.fd.honeycomb.v3po.data.ModifiableDataTree; -import io.fd.honeycomb.v3po.data.ReadableDataTree; -import io.fd.honeycomb.v3po.data.impl.DataBroker; -import io.fd.honeycomb.v3po.translate.read.ReaderRegistry; -import io.fd.honeycomb.v3po.translate.write.WriterRegistry; import java.util.Collection; import java.util.Collections; import javax.annotation.Nonnull; @@ -67,28 +62,18 @@ public final class VppDataBrokerInitializationProvider implements Provider, Auto private final TopologyId VPP_TOPOLOGY_ID = TopologyId.getDefaultInstance("vpp-topology"); private final NodeId VPP_TOPOLOGY_NODE_ID = NodeId.getDefaultInstance("vpp"); private final org.opendaylight.controller.md.sal.binding.api.DataBroker bindingBroker; - private final ReaderRegistry readerRegistry; private final InstanceIdentifier<Node> mountPointPath; - private final WriterRegistry writerRegistry; private final BindingNormalizedNodeSerializer serializer; private ObjectRegistration<DOMMountPoint> mountPointRegistration; - private DOMDataBroker broker; - private final ModifiableDataTree configDataTree; - private final ReadableDataTree operationalDataTree; + private final DOMDataBroker domDataBroker; public VppDataBrokerInitializationProvider( @Nonnull final org.opendaylight.controller.md.sal.binding.api.DataBroker bindingBroker, - @Nonnull final ReaderRegistry readerRegistry, - @Nonnull final WriterRegistry writerRegistry, @Nonnull final BindingNormalizedNodeSerializer serializer, - @Nonnull final ModifiableDataTree configDataTree, - @Nonnull final ReadableDataTree operationalDataTree) { + @Nonnull final DOMDataBroker domDataBroker) { this.bindingBroker = checkNotNull(bindingBroker, "bindingBroker should not be null"); - this.readerRegistry = checkNotNull(readerRegistry, "readerRegistry should not be null"); - this.writerRegistry = checkNotNull(writerRegistry, "writerRegistry should not be null"); this.serializer = checkNotNull(serializer, "serializer should not be null"); - this.configDataTree = checkNotNull(configDataTree, "configDataTree should not be null"); - this.operationalDataTree = checkNotNull(operationalDataTree, "configDataTree should not be null"); + this.domDataBroker = checkNotNull(domDataBroker, "domDataBroker should not be null"); this.mountPointPath = getMountPointPath(); } @@ -115,8 +100,7 @@ public final class VppDataBrokerInitializationProvider implements Provider, Auto final DOMMountPointService.DOMMountPointBuilder mountPointBuilder = mountPointService.createMountPoint(path); mountPointBuilder.addInitialSchemaContext(globalContext); - broker = new DataBroker(operationalDataTree, configDataTree); - mountPointBuilder.addService(DOMDataBroker.class, broker); + mountPointBuilder.addService(DOMDataBroker.class, domDataBroker); mountPointRegistration = mountPointBuilder.register(); final DOMMountPoint mountPoint = mountPointRegistration.getInstance(); @@ -164,7 +148,7 @@ public final class VppDataBrokerInitializationProvider implements Provider, Auto } public Optional<DOMDataBroker> getBroker() { - return Optional.fromNullable(broker); + return Optional.fromNullable(domDataBroker); } @Override @@ -173,10 +157,6 @@ public final class VppDataBrokerInitializationProvider implements Provider, Auto mountPointRegistration.close(); } - if (broker != null) { - broker = null; - } - // remove MD-SAL placeholder data for VPP mount point: final WriteTransaction rwTx = bindingBroker.newWriteOnlyTransaction(); // does not fail if data is not present: diff --git a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModule.java b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModule.java index 76f014456..24e34c0a9 100644 --- a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModule.java +++ b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModule.java @@ -41,7 +41,7 @@ public class DataBrokerModule extends @Override public java.lang.AutoCloseable createInstance() { - LOG.info("DataBrokerModule.createInstance()"); + LOG.debug("DataBrokerModule.createInstance()"); return new CloseableDataBroker( new DataBroker(getOperationalDataTreeDependency(), getConfigDataTreeDependency())); } @@ -56,7 +56,7 @@ public class DataBrokerModule extends @Override public void close() throws Exception { - LOG.info("CloseableDataBroker.close()"); + LOG.debug("CloseableDataBroker.close()"); // NOP } diff --git a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java index 959780496..697213b3c 100644 --- a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java +++ b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java @@ -57,9 +57,8 @@ public class V3poModule extends final Broker domBroker = getDomBrokerDependency(); domBroker.registerProvider(new InitializationProvider()); - final V3poProvider provider = new V3poProvider(domBroker, getVppJapiDependency(), getReaderRegistryDependency(), - getWriterRegistryDependency(), getSerializerDependency(), - getConfigDataTreeDependency(), getOperationalDataTreeDependency()); + final V3poProvider provider = new V3poProvider(domBroker, getVppJapiDependency(), getSerializerDependency(), + getDomDataBrokerDependency()); getBrokerDependency().registerProvider(provider); return provider; } |