summaryrefslogtreecommitdiffstats
path: root/v3po/data-impl
diff options
context:
space:
mode:
authorMaros Marsalek <mmarsale@cisco.com>2016-04-12 10:13:25 +0200
committerMaros Marsalek <mmarsale@cisco.com>2016-04-12 10:13:25 +0200
commitabd7814ef36ed9135c6e80b79ece76238d50a39c (patch)
tree5bc2762890fde439c7896fcf39a70841897968f5 /v3po/data-impl
parent5970b9ec4f014869118026001e933c9847da2509 (diff)
HONEYCOMB-8: Remove references to VPP from data layer
Change-Id: Ia8ceb1f6e16c5148514ee2add55ff78533d8fe1e Signed-off-by: Marek Gradzki <mgradzki@cisco.com> Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'v3po/data-impl')
-rw-r--r--v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTree.java (renamed from v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/VppConfigDataTree.java)43
-rw-r--r--v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/DataBroker.java (renamed from v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/VppDataBroker.java)35
-rw-r--r--v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/DataTreeUtils.java2
-rw-r--r--v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTree.java (renamed from v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/VppOperationalDataTree.java)24
-rw-r--r--v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/ReadOnlyTransaction.java (renamed from v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/VppReadOnlyTransaction.java)20
-rw-r--r--v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/WriteTransaction.java (renamed from v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/VppWriteTransaction.java)30
-rw-r--r--v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTreeTest.java (renamed from v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VPPConfigDataTreeTest.java)41
-rw-r--r--v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/DataBrokerTest.java (renamed from v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppDataBrokerTest.java)18
-rw-r--r--v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTreeTest.java (renamed from v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppOperationalDataTreeTest.java)6
-rw-r--r--v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/ReadOnlyTransactionTest.java (renamed from v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppReadOnlyTransactionTest.java)14
-rw-r--r--v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/WriteTransactionTest.java (renamed from v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppWriteTransactionTest.java)18
11 files changed, 126 insertions, 125 deletions
diff --git a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/VppConfigDataTree.java b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTree.java
index 6e01306b0..84a1d27e3 100644
--- a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/VppConfigDataTree.java
+++ b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTree.java
@@ -22,9 +22,9 @@ import static io.fd.honeycomb.v3po.data.impl.DataTreeUtils.childrenFromNormalize
import com.google.common.base.Optional;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
-import io.fd.honeycomb.v3po.data.ReadableVppDataTree;
-import io.fd.honeycomb.v3po.data.VppDataTree;
-import io.fd.honeycomb.v3po.data.VppDataTreeSnapshot;
+import io.fd.honeycomb.v3po.data.DataTreeSnapshot;
+import io.fd.honeycomb.v3po.data.ModifiableDataTree;
+import io.fd.honeycomb.v3po.data.ReadableDataTree;
import io.fd.honeycomb.v3po.translate.TranslationException;
import io.fd.honeycomb.v3po.translate.util.write.TransactionWriteContext;
import io.fd.honeycomb.v3po.translate.write.WriteContext;
@@ -44,22 +44,21 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * VppDataTree implementation for configuration data.
+ * DataTree implementation for configuration data.
*/
-public final class VppConfigDataTree implements VppDataTree {
+public final class ConfigDataTree implements ModifiableDataTree {
- private static final Logger LOG = LoggerFactory.getLogger(VppConfigDataTree.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ConfigDataTree.class);
private final BindingNormalizedNodeSerializer serializer;
private final DataTree dataTree;
private final WriterRegistry writer;
- public static final ReadableVppDataTree EMPTY_OPERATIONAL = new ReadableVppDataTree() {
+ public static final ReadableDataTree EMPTY_OPERATIONAL = new ReadableDataTree() {
@Override
public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(
@Nonnull final YangInstanceIdentifier path) {
@@ -73,22 +72,22 @@ public final class VppConfigDataTree implements VppDataTree {
* @param serializer service for serialization between Java Binding Data representation and NormalizedNode
* representation.
* @param dataTree data tree for configuration data representation
- * @param vppWriter service for translation between Java Binding Data and Vpp.
+ * @param writer service for translation between Java Binding Data and data provider.
*/
- public VppConfigDataTree(@Nonnull final BindingNormalizedNodeSerializer serializer,
- @Nonnull final DataTree dataTree, @Nonnull final WriterRegistry vppWriter) {
+ public ConfigDataTree(@Nonnull final BindingNormalizedNodeSerializer serializer,
+ @Nonnull final DataTree dataTree, @Nonnull final WriterRegistry writer) {
this.serializer = checkNotNull(serializer, "serializer should not be null");
this.dataTree = checkNotNull(dataTree, "dataTree should not be null");
- this.writer = checkNotNull(vppWriter, "vppWriter should not be null");
+ this.writer = checkNotNull(writer, "writer should not be null");
}
@Override
- public VppDataTreeSnapshot takeSnapshot() {
+ public DataTreeSnapshot takeSnapshot() {
return new ConfigSnapshot(dataTree.takeSnapshot());
}
@Override
- public void commit(final DataTreeModification modification)
+ public void modify(final DataTreeModification modification)
throws DataValidationFailedException, TranslationException {
dataTree.validate(modification);
@@ -98,19 +97,19 @@ public final class VppConfigDataTree implements VppDataTree {
final YangInstanceIdentifier rootPath = candidate.getRootPath();
final Optional<NormalizedNode<?, ?>> normalizedDataBefore = rootNode.getDataBefore();
final Optional<NormalizedNode<?, ?>> normalizedDataAfter = rootNode.getDataAfter();
- LOG.debug("VppConfigDataTree.commit() rootPath={}, rootNode={}, dataBefore={}, dataAfter={}",
+ LOG.debug("ConfigDataTree.modify() rootPath={}, rootNode={}, dataBefore={}, dataAfter={}",
rootPath, rootNode, normalizedDataBefore, normalizedDataAfter);
final Map<InstanceIdentifier<?>, DataObject> nodesBefore = extractNetconfData(normalizedDataBefore);
- LOG.debug("VppConfigDataTree.commit() extracted nodesBefore={}", nodesBefore.keySet());
+ LOG.debug("ConfigDataTree.modify() extracted nodesBefore={}", nodesBefore.keySet());
final Map<InstanceIdentifier<?>, DataObject> nodesAfter = extractNetconfData(normalizedDataAfter);
- LOG.debug("VppConfigDataTree.commit() extracted nodesAfter={}", nodesAfter.keySet());
+ LOG.debug("ConfigDataTree.modify() extracted nodesAfter={}", nodesAfter.keySet());
- final DOMDataReadOnlyTransaction beforeTx = new VppReadOnlyTransaction(EMPTY_OPERATIONAL, takeSnapshot());
+ final DOMDataReadOnlyTransaction beforeTx = new ReadOnlyTransaction(EMPTY_OPERATIONAL, takeSnapshot());
final ConfigSnapshot modificationSnapshot = new ConfigSnapshot(modification);
- final DOMDataReadOnlyTransaction afterTx = new VppReadOnlyTransaction(EMPTY_OPERATIONAL, modificationSnapshot);
+ final DOMDataReadOnlyTransaction afterTx = new ReadOnlyTransaction(EMPTY_OPERATIONAL, modificationSnapshot);
try(final WriteContext ctx = new TransactionWriteContext(serializer, beforeTx, afterTx)) {
writer.update(nodesBefore, nodesAfter, ctx);
} catch (io.fd.honeycomb.v3po.translate.write.WriterRegistry.BulkUpdateException e) {
@@ -144,10 +143,10 @@ public final class VppConfigDataTree implements VppDataTree {
return Collections.emptyMap();
}
- private final static class ConfigSnapshot implements VppDataTreeSnapshot {
- private final DataTreeSnapshot snapshot;
+ private final static class ConfigSnapshot implements DataTreeSnapshot {
+ private final org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot snapshot;
- ConfigSnapshot(@Nonnull final DataTreeSnapshot snapshot) {
+ ConfigSnapshot(@Nonnull final org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot snapshot) {
this.snapshot = snapshot;
}
diff --git a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/VppDataBroker.java b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/DataBroker.java
index 5c5248cea..7b4d93baa 100644
--- a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/VppDataBroker.java
+++ b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/DataBroker.java
@@ -17,9 +17,9 @@
package io.fd.honeycomb.v3po.data.impl;
import com.google.common.base.Preconditions;
-import io.fd.honeycomb.v3po.data.ReadableVppDataTree;
-import io.fd.honeycomb.v3po.data.VppDataTree;
-import io.fd.honeycomb.v3po.data.VppDataTreeSnapshot;
+import io.fd.honeycomb.v3po.data.ReadableDataTree;
+import io.fd.honeycomb.v3po.data.ModifiableDataTree;
+import io.fd.honeycomb.v3po.data.DataTreeSnapshot;
import java.util.Collections;
import java.util.Map;
import javax.annotation.Nonnull;
@@ -37,42 +37,43 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
/**
- * Data Broker which provides data transaction functionality for VPP using {@link NormalizedNode} data format.
+ * Data Broker which provides data transaction functionality for YANG capable data provider
+ * using {@link NormalizedNode} data format.
*/
-public class VppDataBroker implements DOMDataBroker {
+public class DataBroker implements DOMDataBroker {
- private final ReadableVppDataTree operationalData;
- private final VppDataTree configDataTree;
+ private final ReadableDataTree operationalData;
+ private final ModifiableDataTree configDataTree;
/**
- * Creates VppDataBroker instance.
+ * Creates DataBroker instance.
*
- * @param operationalData VPP operational data
- * @param configDataTree VPP configuration data
+ * @param operationalData operational data
+ * @param configDataTree configuration data
*/
- public VppDataBroker(@Nonnull final ReadableVppDataTree operationalData,
- @Nonnull final VppDataTree configDataTree) {
+ public DataBroker(@Nonnull final ReadableDataTree operationalData,
+ @Nonnull final ModifiableDataTree configDataTree) {
this.operationalData = Preconditions.checkNotNull(operationalData, "operationalData should not be null");
this.configDataTree = Preconditions.checkNotNull(configDataTree, "configDataProxy should not be null");
}
@Override
public DOMDataReadOnlyTransaction newReadOnlyTransaction() {
- return new VppReadOnlyTransaction(operationalData, configDataTree.takeSnapshot());
+ return new ReadOnlyTransaction(operationalData, configDataTree.takeSnapshot());
}
@Override
public DOMDataReadWriteTransaction newReadWriteTransaction() {
// todo use the same snapshot
- final VppDataTreeSnapshot configSnapshot = configDataTree.takeSnapshot();
- final DOMDataReadOnlyTransaction readOnlyTx = new VppReadOnlyTransaction(operationalData, configSnapshot);
- final DOMDataWriteTransaction writeOnlyTx = new VppWriteTransaction(configDataTree, configSnapshot);
+ final DataTreeSnapshot configSnapshot = configDataTree.takeSnapshot();
+ final DOMDataReadOnlyTransaction readOnlyTx = new ReadOnlyTransaction(operationalData, configSnapshot);
+ final DOMDataWriteTransaction writeOnlyTx = new WriteTransaction(configDataTree, configSnapshot);
return new ReadWriteTransaction(readOnlyTx, writeOnlyTx);
}
@Override
public DOMDataWriteTransaction newWriteOnlyTransaction() {
- return new VppWriteTransaction(configDataTree);
+ return new WriteTransaction(configDataTree);
}
@Override
diff --git a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/DataTreeUtils.java b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/DataTreeUtils.java
index 83ed0f263..39e841f9a 100644
--- a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/DataTreeUtils.java
+++ b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/DataTreeUtils.java
@@ -62,7 +62,7 @@ final class DataTreeUtils {
for (final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> child : children) {
final YangInstanceIdentifier.PathArgument pathArgument = child.getIdentifier();
final YangInstanceIdentifier identifier = YangInstanceIdentifier.create(pathArgument);
- LOG.debug("VppConfigDataProxy.extractDataObject() child={}, pathArgument={}, identifier={}", child,
+ LOG.debug("DataTreeUtils.childrenFromNormalized() child={}, pathArgument={}, identifier={}", child,
pathArgument, identifier);
final Map.Entry<InstanceIdentifier<?>, DataObject> entry = serializer.fromNormalizedNode(identifier, child);
diff --git a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/VppOperationalDataTree.java b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTree.java
index fc13606e6..21672b48b 100644
--- a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/VppOperationalDataTree.java
+++ b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTree.java
@@ -26,7 +26,7 @@ import com.google.common.collect.Collections2;
import com.google.common.collect.Multimap;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
-import io.fd.honeycomb.v3po.data.ReadableVppDataTree;
+import io.fd.honeycomb.v3po.data.ReadableDataTree;
import io.fd.honeycomb.v3po.translate.Context;
import io.fd.honeycomb.v3po.translate.read.ReadContext;
import io.fd.honeycomb.v3po.translate.read.ReadFailedException;
@@ -56,10 +56,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * ReadableVppDataTree implementation for operational data.
+ * ReadableDataTree implementation for operational data.
*/
-public final class VppOperationalDataTree implements ReadableVppDataTree {
- private static final Logger LOG = LoggerFactory.getLogger(VppOperationalDataTree.class);
+public final class OperationalDataTree implements ReadableDataTree {
+ private static final Logger LOG = LoggerFactory.getLogger(OperationalDataTree.class);
private final BindingNormalizedNodeSerializer serializer;
private final ReaderRegistry readerRegistry;
@@ -71,10 +71,10 @@ public final class VppOperationalDataTree implements ReadableVppDataTree {
* @param serializer service for serialization between Java Binding Data representation and NormalizedNode
* representation.
* @param globalContext service for obtaining top level context data from all yang modules.
- * @param readerRegistry service responsible for translation between DataObjects and VPP APIs.
+ * @param readerRegistry service responsible for translation between DataObjects and data provider.
*/
- public VppOperationalDataTree(@Nonnull BindingNormalizedNodeSerializer serializer,
- @Nonnull final SchemaContext globalContext, @Nonnull ReaderRegistry readerRegistry) {
+ public OperationalDataTree(@Nonnull BindingNormalizedNodeSerializer serializer,
+ @Nonnull final SchemaContext globalContext, @Nonnull ReaderRegistry readerRegistry) {
this.globalContext = checkNotNull(globalContext, "serializer should not be null");
this.serializer = checkNotNull(serializer, "serializer should not be null");
this.readerRegistry = checkNotNull(readerRegistry, "reader should not be null");
@@ -101,10 +101,10 @@ public final class VppOperationalDataTree implements ReadableVppDataTree {
private Optional<NormalizedNode<?, ?>> readNode(final YangInstanceIdentifier yangInstanceIdentifier,
final ReadContext ctx)
throws ReadFailedException {
- LOG.debug("VppOperationalDataTree.readNode(), yangInstanceIdentifier={}", yangInstanceIdentifier);
+ LOG.debug("OperationalDataTree.readNode(), yangInstanceIdentifier={}", yangInstanceIdentifier);
final InstanceIdentifier<?> path = serializer.fromYangInstanceIdentifier(yangInstanceIdentifier);
checkNotNull(path, "Invalid instance identifier %s. Cannot create BA equivalent.", yangInstanceIdentifier);
- LOG.debug("VppOperationalDataTree.readNode(), path={}", path);
+ LOG.debug("OperationalDataTree.readNode(), path={}", path);
final Optional<? extends DataObject> dataObject;
@@ -118,7 +118,7 @@ public final class VppOperationalDataTree implements ReadableVppDataTree {
}
private Optional<NormalizedNode<?, ?>> readRoot(final ReadContext ctx) throws ReadFailedException {
- LOG.debug("VppOperationalDataTree.readRoot()");
+ LOG.debug("OperationalDataTree.readRoot()");
final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> dataNodeBuilder =
Builders.containerBuilder()
@@ -182,11 +182,11 @@ public final class VppOperationalDataTree implements ReadableVppDataTree {
return new Function<DataObject, NormalizedNode<?, ?>>() {
@Override
public NormalizedNode<?, ?> apply(@Nullable final DataObject dataObject) {
- LOG.trace("VppOperationalDataTree.toNormalizedNode(), path={}, dataObject={}", path, dataObject);
+ LOG.trace("OperationalDataTree.toNormalizedNode(), path={}, dataObject={}", path, dataObject);
final Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> entry =
serializer.toNormalizedNode(path, dataObject);
- LOG.trace("VppOperationalDataTree.toNormalizedNode(), normalizedNodeEntry={}", entry);
+ LOG.trace("OperationalDataTree.toNormalizedNode(), normalizedNodeEntry={}", entry);
return entry.getValue();
}
};
diff --git a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/VppReadOnlyTransaction.java b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/ReadOnlyTransaction.java
index db01591b9..83c9e30bd 100644
--- a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/VppReadOnlyTransaction.java
+++ b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/ReadOnlyTransaction.java
@@ -22,8 +22,8 @@ import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
-import io.fd.honeycomb.v3po.data.ReadableVppDataTree;
-import io.fd.honeycomb.v3po.data.VppDataTreeSnapshot;
+import io.fd.honeycomb.v3po.data.ReadableDataTree;
+import io.fd.honeycomb.v3po.data.DataTreeSnapshot;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -34,14 +34,14 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-final class VppReadOnlyTransaction implements DOMDataReadOnlyTransaction {
+final class ReadOnlyTransaction implements DOMDataReadOnlyTransaction {
- private static final Logger LOG = LoggerFactory.getLogger(VppReadOnlyTransaction.class);
- private volatile ReadableVppDataTree operationalData;
- private volatile VppDataTreeSnapshot configSnapshot;
+ private static final Logger LOG = LoggerFactory.getLogger(ReadOnlyTransaction.class);
+ private volatile ReadableDataTree operationalData;
+ private volatile DataTreeSnapshot configSnapshot;
- VppReadOnlyTransaction(@Nonnull final ReadableVppDataTree operationalData,
- @Nonnull final VppDataTreeSnapshot configSnapshot) {
+ ReadOnlyTransaction(@Nonnull final ReadableDataTree operationalData,
+ @Nonnull final DataTreeSnapshot configSnapshot) {
this.operationalData = Preconditions.checkNotNull(operationalData, "operationalData should not be null");
this.configSnapshot = Preconditions.checkNotNull(configSnapshot, "config should not be null");
}
@@ -56,7 +56,7 @@ final class VppReadOnlyTransaction implements DOMDataReadOnlyTransaction {
public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(
final LogicalDatastoreType store,
final YangInstanceIdentifier path) {
- LOG.debug("VppReadOnlyTransaction.read(), store={}, path={}", store, path);
+ LOG.debug("ReadOnlyTransaction.read(), store={}, path={}", store, path);
Preconditions.checkState(configSnapshot != null, "Transaction was closed");
@@ -70,7 +70,7 @@ final class VppReadOnlyTransaction implements DOMDataReadOnlyTransaction {
@Override
public CheckedFuture<Boolean, ReadFailedException> exists(final LogicalDatastoreType store,
final YangInstanceIdentifier path) {
- LOG.debug("VppReadOnlyTransaction.exists() store={}, path={}", store, path);
+ LOG.debug("ReadOnlyTransaction.exists() store={}, path={}", store, path);
ListenableFuture<Boolean> listenableFuture = Futures.transform(read(store, path), IS_NODE_PRESENT);
diff --git a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/VppWriteTransaction.java b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/WriteTransaction.java
index c9766eb21..fbeba7e07 100644
--- a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/VppWriteTransaction.java
+++ b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/WriteTransaction.java
@@ -26,8 +26,8 @@ import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
-import io.fd.honeycomb.v3po.data.VppDataTree;
-import io.fd.honeycomb.v3po.data.VppDataTreeSnapshot;
+import io.fd.honeycomb.v3po.data.ModifiableDataTree;
+import io.fd.honeycomb.v3po.data.DataTreeSnapshot;
import io.fd.honeycomb.v3po.translate.TranslationException;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.NotThreadSafe;
@@ -44,15 +44,15 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@NotThreadSafe
-final class VppWriteTransaction implements DOMDataWriteTransaction {
+final class WriteTransaction implements DOMDataWriteTransaction {
- private static final Logger LOG = LoggerFactory.getLogger(VppWriteTransaction.class);
- private final VppDataTree configDataTree;
+ private static final Logger LOG = LoggerFactory.getLogger(WriteTransaction.class);
+ private final ModifiableDataTree configDataTree;
private DataTreeModification modification;
private TransactionStatus status;
- VppWriteTransaction(@Nonnull final VppDataTree configDataTree,
- @Nonnull final VppDataTreeSnapshot configSnapshot) {
+ WriteTransaction(@Nonnull final ModifiableDataTree configDataTree,
+ @Nonnull final DataTreeSnapshot configSnapshot) {
this.configDataTree = Preconditions.checkNotNull(configDataTree, "configDataTree should not be null");
Preconditions.checkNotNull(configSnapshot, "configSnapshot should not be null");
// initialize transaction state:
@@ -60,7 +60,7 @@ final class VppWriteTransaction implements DOMDataWriteTransaction {
status = NEW;
}
- VppWriteTransaction(@Nonnull final VppDataTree configDataTree) {
+ WriteTransaction(@Nonnull final ModifiableDataTree configDataTree) {
this(configDataTree, configDataTree.takeSnapshot());
}
@@ -70,13 +70,13 @@ final class VppWriteTransaction implements DOMDataWriteTransaction {
private void checkIsNew() {
Preconditions.checkState(status == NEW, "Transaction was submitted or canceled");
- Preconditions.checkState(modification != null, "VPPDataTree modification should not be null");
+ Preconditions.checkState(modification != null, "DataTree modification should not be null");
}
@Override
public void put(final LogicalDatastoreType store, final YangInstanceIdentifier path,
final NormalizedNode<?, ?> data) {
- LOG.debug("VppWriteTransaction.put() store={}, path={}, data={}", store, path, data);
+ LOG.debug("WriteTransaction.put() store={}, path={}, data={}", store, path, data);
checkIsNew();
checkConfigurationWrite(store);
modification.write(path, data);
@@ -85,7 +85,7 @@ final class VppWriteTransaction implements DOMDataWriteTransaction {
@Override
public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path,
final NormalizedNode<?, ?> data) {
- LOG.debug("VppWriteTransaction.merge() store={}, path={}, data={}", store, path, data);
+ LOG.debug("WriteTransaction.merge() store={}, path={}, data={}", store, path, data);
checkIsNew();
checkConfigurationWrite(store);
modification.merge(path, data);
@@ -105,7 +105,7 @@ final class VppWriteTransaction implements DOMDataWriteTransaction {
@Override
public void delete(LogicalDatastoreType store, final YangInstanceIdentifier path) {
- LOG.debug("VppWriteTransaction.delete() store={}, path={}", store, path);
+ LOG.debug("WriteTransaction.delete() store={}, path={}", store, path);
checkIsNew();
checkConfigurationWrite(store);
modification.delete(path);
@@ -113,7 +113,7 @@ final class VppWriteTransaction implements DOMDataWriteTransaction {
@Override
public CheckedFuture<Void, TransactionCommitFailedException> submit() {
- LOG.debug("VppWriteTransaction.submit()");
+ LOG.debug("WriteTransaction.submit()");
checkIsNew();
// seal transaction:
@@ -121,11 +121,11 @@ final class VppWriteTransaction implements DOMDataWriteTransaction {
status = SUBMITED;
try {
- configDataTree.commit(modification);
+ configDataTree.modify(modification);
status = COMMITED;
} catch (DataValidationFailedException | TranslationException e) {
status = FAILED;
- LOG.error("Failed to commit VPP state modification", e);
+ LOG.error("Failed modify data tree", e);
return Futures.immediateFailedCheckedFuture(
new TransactionCommitFailedException("Failed to validate DataTreeModification", e));
} finally {
diff --git a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VPPConfigDataTreeTest.java b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTreeTest.java
index ecb9ac4ab..b7f8b9d2c 100644
--- a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VPPConfigDataTreeTest.java
+++ b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTreeTest.java
@@ -31,7 +31,7 @@ import static org.mockito.MockitoAnnotations.initMocks;
import com.google.common.base.Optional;
import com.google.common.util.concurrent.CheckedFuture;
-import io.fd.honeycomb.v3po.data.VppDataTreeSnapshot;
+import io.fd.honeycomb.v3po.data.DataTreeSnapshot;
import io.fd.honeycomb.v3po.translate.TranslationException;
import io.fd.honeycomb.v3po.translate.write.WriteContext;
import io.fd.honeycomb.v3po.translate.write.WriterRegistry;
@@ -56,12 +56,11 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
-public class VPPConfigDataTreeTest {
+public class ConfigDataTreeTest {
@Mock
- private WriterRegistry vppWriter;
+ private WriterRegistry writer;
@Mock
private BindingNormalizedNodeSerializer serializer;
@Mock
@@ -69,26 +68,27 @@ public class VPPConfigDataTreeTest {
@Mock
private DataTreeModification modification;
- private VppConfigDataTree proxy;
+ private ConfigDataTree configDataTree;
@Before
public void setUp() {
initMocks(this);
- proxy = new VppConfigDataTree(serializer, dataTree, vppWriter);
+ configDataTree = new ConfigDataTree(serializer, dataTree, writer);
}
@Test
public void testRead() throws Exception {
- final DataTreeSnapshot snapshot = mock(DataTreeSnapshot.class);
+ final org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot
+ snapshot = mock(org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot.class);
when(dataTree.takeSnapshot()).thenReturn(snapshot);
final YangInstanceIdentifier path = mock(YangInstanceIdentifier.class);
final Optional node = mock(Optional.class);
doReturn(node).when(snapshot).readNode(path);
- final VppDataTreeSnapshot vppDataTreeSnapshot = proxy.takeSnapshot();
+ final DataTreeSnapshot dataTreeSnapshot = configDataTree.takeSnapshot();
final CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> future =
- vppDataTreeSnapshot.read(path);
+ dataTreeSnapshot.read(path);
verify(dataTree).takeSnapshot();
verify(snapshot).readNode(path);
@@ -99,13 +99,14 @@ public class VPPConfigDataTreeTest {
@Test
public void testNewModification() throws Exception {
- final DataTreeSnapshot snapshot = mock(DataTreeSnapshot.class);
+ final org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot
+ snapshot = mock(org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot.class);
when(dataTree.takeSnapshot()).thenReturn(snapshot);
when(snapshot.newModification()).thenReturn(modification);
- final VppDataTreeSnapshot vppDataTreeSnapshot = proxy.takeSnapshot();
- final DataTreeModification newModification = vppDataTreeSnapshot.newModification();
+ final DataTreeSnapshot dataTreeSnapshot = configDataTree.takeSnapshot();
+ final DataTreeModification newModification = dataTreeSnapshot.newModification();
verify(dataTree).takeSnapshot();
verify(snapshot).newModification();
@@ -127,10 +128,10 @@ public class VPPConfigDataTreeTest {
when(rootNode.getDataAfter()).thenReturn(Optional.<NormalizedNode<?, ?>>fromNullable(nodeAfter));
// Run the test
- proxy.commit(modification);
+ configDataTree.modify(modification);
// Verify all changes were processed:
- verify(vppWriter).update(
+ verify(writer).update(
mapOf(dataBefore, Ethernet.class),
mapOf(dataAfter, Ethernet.class),
any(WriteContext.class));
@@ -163,7 +164,7 @@ public class VPPConfigDataTreeTest {
// Fail on update:
final TranslationException failedOnUpdateException = new TranslationException("update failed");
doThrow(new io.fd.honeycomb.v3po.translate.write.WriterRegistry.BulkUpdateException(InstanceIdentifier.create(Ethernet.class), reverter,
- failedOnUpdateException)).when(vppWriter).update(anyMap(), anyMap(), any(WriteContext.class));
+ failedOnUpdateException)).when(writer).update(anyMap(), anyMap(), any(WriteContext.class));
// Prepare modification:
final DataTreeCandidateNode rootNode = mockRootNode();
@@ -176,9 +177,9 @@ public class VPPConfigDataTreeTest {
// Run the test
try {
- proxy.commit(modification);
+ configDataTree.modify(modification);
} catch (io.fd.honeycomb.v3po.translate.write.WriterRegistry.BulkUpdateException e) {
- verify(vppWriter).update(anyMap(), anyMap(), any(WriteContext.class));
+ verify(writer).update(anyMap(), anyMap(), any(WriteContext.class));
verify(reverter).revert();
assertEquals(failedOnUpdateException, e.getCause());
return;
@@ -198,7 +199,7 @@ public class VPPConfigDataTreeTest {
// Fail on update:
doThrow(new io.fd.honeycomb.v3po.translate.write.WriterRegistry.BulkUpdateException(InstanceIdentifier.create(Ethernet.class), reverter,
- new TranslationException("update failed"))).when(vppWriter).update(anyMap(), anyMap(), any(WriteContext.class));
+ new TranslationException("update failed"))).when(writer).update(anyMap(), anyMap(), any(WriteContext.class));
// Fail on revert:
final TranslationException failedOnRevertException = new TranslationException("update failed");
@@ -218,9 +219,9 @@ public class VPPConfigDataTreeTest {
// Run the test
try {
- proxy.commit(modification);
+ configDataTree.modify(modification);
} catch (io.fd.honeycomb.v3po.translate.write.WriterRegistry.Reverter.RevertFailedException e) {
- verify(vppWriter).update(anyMap(), anyMap(), any(WriteContext.class));
+ verify(writer).update(anyMap(), anyMap(), any(WriteContext.class));
verify(reverter).revert();
assertEquals(failedOnRevertException, e.getCause());
return;
diff --git a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppDataBrokerTest.java b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/DataBrokerTest.java
index 0a7cd80ae..a2908d591 100644
--- a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppDataBrokerTest.java
+++ b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/DataBrokerTest.java
@@ -22,9 +22,9 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
-import io.fd.honeycomb.v3po.data.ReadableVppDataTree;
-import io.fd.honeycomb.v3po.data.VppDataTree;
-import io.fd.honeycomb.v3po.data.VppDataTreeSnapshot;
+import io.fd.honeycomb.v3po.data.ReadableDataTree;
+import io.fd.honeycomb.v3po.data.ModifiableDataTree;
+import io.fd.honeycomb.v3po.data.DataTreeSnapshot;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
@@ -39,21 +39,21 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-public class VppDataBrokerTest {
+public class DataBrokerTest {
@Mock
- private ReadableVppDataTree operationalData;
+ private ReadableDataTree operationalData;
@Mock
- private VppDataTree confiDataTree;
+ private ModifiableDataTree confiDataTree;
@Mock
- private VppDataTreeSnapshot configSnapshot;
- private VppDataBroker broker;
+ private DataTreeSnapshot configSnapshot;
+ private DataBroker broker;
@Before
public void setUp() {
initMocks(this);
when(confiDataTree.takeSnapshot()).thenReturn(configSnapshot);
- broker = new VppDataBroker(operationalData, confiDataTree);
+ broker = new DataBroker(operationalData, confiDataTree);
}
@Test
diff --git a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppOperationalDataTreeTest.java b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTreeTest.java
index d0b45fa65..f4c2f1e5b 100644
--- a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppOperationalDataTreeTest.java
+++ b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/OperationalDataTreeTest.java
@@ -53,14 +53,14 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-public class VppOperationalDataTreeTest {
+public class OperationalDataTreeTest {
@Mock
private BindingNormalizedNodeSerializer serializer;
@Mock
private ReaderRegistry reader;
- private VppOperationalDataTree operationalData;
+ private OperationalDataTree operationalData;
@Mock
private InstanceIdentifier<DataObject> id;
@@ -76,7 +76,7 @@ public class VppOperationalDataTreeTest {
@Before
public void setUp() {
initMocks(this);
- operationalData = new VppOperationalDataTree(serializer, globalContext, reader);
+ operationalData = new OperationalDataTree(serializer, globalContext, reader);
doReturn(schemaNode).when(globalContext).getDataChildByName(any(QName.class));
}
diff --git a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppReadOnlyTransactionTest.java b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/ReadOnlyTransactionTest.java
index b0c64bbdf..30fdd1392 100644
--- a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppReadOnlyTransactionTest.java
+++ b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/ReadOnlyTransactionTest.java
@@ -24,8 +24,8 @@ import static org.mockito.MockitoAnnotations.initMocks;
import com.google.common.base.Optional;
import com.google.common.util.concurrent.CheckedFuture;
-import io.fd.honeycomb.v3po.data.ReadableVppDataTree;
-import io.fd.honeycomb.v3po.data.VppDataTreeSnapshot;
+import io.fd.honeycomb.v3po.data.ReadableDataTree;
+import io.fd.honeycomb.v3po.data.DataTreeSnapshot;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
@@ -34,19 +34,19 @@ import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-public class VppReadOnlyTransactionTest {
+public class ReadOnlyTransactionTest {
@Mock
- private ReadableVppDataTree operationalData;
+ private ReadableDataTree operationalData;
@Mock
- private VppDataTreeSnapshot configSnapshot;
+ private DataTreeSnapshot configSnapshot;
- private VppReadOnlyTransaction readOnlyTx;
+ private ReadOnlyTransaction readOnlyTx;
@Before
public void setUp() {
initMocks(this);
- readOnlyTx = new VppReadOnlyTransaction(operationalData, configSnapshot);
+ readOnlyTx = new ReadOnlyTransaction(operationalData, configSnapshot);
}
@Test
diff --git a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppWriteTransactionTest.java b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/WriteTransactionTest.java
index ad93b148a..d0360dbd8 100644
--- a/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/VppWriteTransactionTest.java
+++ b/v3po/data-impl/src/test/java/io/fd/honeycomb/v3po/data/impl/WriteTransactionTest.java
@@ -27,8 +27,8 @@ import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.common.util.concurrent.CheckedFuture;
-import io.fd.honeycomb.v3po.data.VppDataTree;
-import io.fd.honeycomb.v3po.data.VppDataTreeSnapshot;
+import io.fd.honeycomb.v3po.data.ModifiableDataTree;
+import io.fd.honeycomb.v3po.data.DataTreeSnapshot;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
@@ -39,12 +39,12 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
-public class VppWriteTransactionTest {
+public class WriteTransactionTest {
@Mock
- private VppDataTree configDataTree;
+ private ModifiableDataTree configDataTree;
@Mock
- private VppDataTreeSnapshot configSnapshot;
+ private DataTreeSnapshot configSnapshot;
@Mock
private YangInstanceIdentifier path;
@Mock
@@ -52,13 +52,13 @@ public class VppWriteTransactionTest {
@Mock
private DataTreeModification dataTreeModification;
- private VppWriteTransaction writeTx;
+ private WriteTransaction writeTx;
@Before
public void setUp() {
initMocks(this);
when(configSnapshot.newModification()).thenReturn(dataTreeModification);
- writeTx = new VppWriteTransaction(configDataTree, configSnapshot);
+ writeTx = new WriteTransaction(configDataTree, configSnapshot);
}
@Test
@@ -107,12 +107,12 @@ public class VppWriteTransactionTest {
public void testSubmit() throws Exception {
writeTx.submit();
verify(dataTreeModification).ready();
- verify(configDataTree).commit(dataTreeModification);
+ verify(configDataTree).modify(dataTreeModification);
}
@Test
public void testSubmitFailed() throws Exception {
- doThrow(mock(DataValidationFailedException.class)).when(configDataTree).commit(dataTreeModification);
+ doThrow(mock(DataValidationFailedException.class)).when(configDataTree).modify(dataTreeModification);
final CheckedFuture<Void, TransactionCommitFailedException> future = writeTx.submit();
try {
future.get();