*/
package org.opendaylight.protocol.bgp.rib.impl;
+import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.base.Verify;
import java.util.Collection;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
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.ModificationType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
private void processRoute(final DOMDataWriteTransaction tx, final RIBSupport ribSupport, final AbstractImportPolicy policy, final YangInstanceIdentifier routesPath, final DataTreeCandidateNode route) {
- LOG.debug("Process route {}", route);
+ LOG.debug("Process route {}", route.getIdentifier());
final YangInstanceIdentifier routeId = ribSupport.routePath(routesPath, route.getIdentifier());
switch (route.getModificationType()) {
case DELETE:
final AbstractImportPolicy policy = EffectiveRibInWriter.this.peerPolicyTracker.policyFor(IdentifierUtils.peerId(peerKey));
for (final DataTreeCandidateNode child : children) {
- LOG.debug("Process table {} type {}", child, child.getModificationType());
- final YangInstanceIdentifier childPath = tablePath.node(child.getIdentifier());
+ final PathArgument childIdentifier = child.getIdentifier();
+ final Optional<NormalizedNode<?, ?>> childDataAfter = child.getDataAfter();
+ LOG.debug("Process table {} type {}, dataAfter {}, dataBefore {}", childIdentifier, child
+ .getModificationType(), childDataAfter, child.getDataBefore());
+ final YangInstanceIdentifier childPath = tablePath.node(childIdentifier);
switch (child.getModificationType()) {
case DELETE:
case DISAPPEARED:
- tx.delete(LogicalDatastoreType.OPERATIONAL, tablePath.node(child.getIdentifier()));
+ tx.delete(LogicalDatastoreType.OPERATIONAL, tablePath.node(childIdentifier));
break;
case UNMODIFIED:
// No-op
break;
case SUBTREE_MODIFIED:
- if (TABLE_ROUTES.equals(child.getIdentifier())) {
+ if (TABLE_ROUTES.equals(childIdentifier)) {
for (final DataTreeCandidateNode route : ribSupport.changedRoutes(child)) {
processRoute(tx, ribSupport, policy, childPath, route);
}
} else {
- tx.put(LogicalDatastoreType.OPERATIONAL, childPath, child.getDataAfter().get());
+ tx.put(LogicalDatastoreType.OPERATIONAL, childPath, childDataAfter.get());
}
break;
case APPEARED:
case WRITE:
- tx.put(LogicalDatastoreType.OPERATIONAL, childPath, child.getDataAfter().get());
+ tx.put(LogicalDatastoreType.OPERATIONAL, childPath, childDataAfter.get());
// Routes are special, as they may end up being filtered. The previous put conveniently
// ensured that we have them in at target, so a subsequent delete will not fail :)
- if (TABLE_ROUTES.equals(child.getIdentifier())) {
+ if (TABLE_ROUTES.equals(childIdentifier)) {
for (final DataTreeCandidateNode route : ribSupport.changedRoutes(child)) {
processRoute(tx, ribSupport, policy, childPath, route);
}
final YangInstanceIdentifier tablePath = effectiveTablePath(peerKey, tableKey);
// Create an empty table
- ribSupport.clearTable(tx,tablePath);
+ LOG.trace("Create Empty table", tablePath);
+ ribSupport.clearTable(tx, tablePath);
processTableChildren(tx, ribSupport.getRibSupport(), peerKey, tablePath, table.getChildNodes());
}
// filter out any change outside AdjRibsIn
final DataTreeCandidateNode ribIn = root.getModifiedChild(ADJRIBIN_NID);
if (ribIn == null) {
- LOG.debug("Skipping change {}", tc.getRootNode());
+ LOG.debug("Skipping change {}", root.getIdentifier());
continue;
}
final DataTreeCandidateNode tables = ribIn.getModifiedChild(TABLES_NID);
if (tables == null) {
- LOG.debug("Skipping change {}", tc.getRootNode());
+ LOG.debug("Skipping change {}", root.getIdentifier());
continue;
}
for (final DataTreeCandidateNode table : tables.getChildNodes()) {
final PathArgument lastArg = table.getIdentifier();
Verify.verify(lastArg instanceof NodeIdentifierWithPredicates, "Unexpected type %s in path %s", lastArg.getClass(), rootPath);
final NodeIdentifierWithPredicates tableKey = (NodeIdentifierWithPredicates) lastArg;
-
- switch (root.getModificationType()) {
+ final ModificationType modificationType = root.getModificationType();
+ switch (modificationType) {
case DELETE:
case DISAPPEARED:
+ final YangInstanceIdentifier effectiveTablePath = effectiveTablePath(peerKey, tableKey);
+ LOG.debug("Delete Effective Table {} modification type {}, ", effectiveTablePath, modificationType);
// delete the corresponding effective table
- tx.delete(LogicalDatastoreType.OPERATIONAL, effectiveTablePath(peerKey, tableKey));
+ tx.delete(LogicalDatastoreType.OPERATIONAL, effectiveTablePath);
break;
case SUBTREE_MODIFIED:
modifyTable(tx, peerKey, tableKey, table);