Fix delete case in EffRibIn. 72/22172/8
authorIveta Halanova <iveta.halanova@pantheon.sk>
Wed, 10 Jun 2015 09:00:39 +0000 (11:00 +0200)
committerDana Kutenicsova <dkutenic@cisco.com>
Mon, 15 Jun 2015 09:10:02 +0000 (09:10 +0000)
Delete case was pushed with wrong InstanceIdentifier.

Change-Id: I3e57f5f0b7915bcd290d4b2e851bbb388a092eb4
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
Signed-off-by: Iveta Halanova <iveta.halanova@pantheon.sk>
(cherry picked from commit 34ccd897e1384038c9e8a5cf8e270cd12b4c3199)

bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.java

index c9edf74734b516e80cf8dd52c4deb240fd63e570..0b1a8d92e38ddffe2e1f8e18c817b6a0e4f01a4c 100644 (file)
@@ -81,16 +81,16 @@ final class EffectiveRibInWriter implements AutoCloseable {
 
         private void processRoute(final DOMDataWriteTransaction tx, final RIBSupport ribSupport, final AbstractImportPolicy policy, final YangInstanceIdentifier routesPath, final DataTreeCandidateNode route) {
             LOG.debug("Process route {}", route);
+            final YangInstanceIdentifier routeId = ribSupport.routePath(routesPath, route.getIdentifier());
             switch (route.getModificationType()) {
             case DELETE:
-                tx.delete(LogicalDatastoreType.OPERATIONAL, routesPath.node(route.getIdentifier()));
+                tx.delete(LogicalDatastoreType.OPERATIONAL, routeId);
                 break;
             case UNMODIFIED:
                 // No-op
                 break;
             case SUBTREE_MODIFIED:
             case WRITE:
-                final YangInstanceIdentifier routeId = ribSupport.routePath(routesPath, route.getIdentifier());
                 tx.put(LogicalDatastoreType.OPERATIONAL, routeId, route.getDataAfter().get());
                 // Lookup per-table attributes from RIBSupport
                 final ContainerNode advertisedAttrs = (ContainerNode) NormalizedNodes.findNode(route.getDataAfter(), ribSupport.routeAttributesIdentifier()).orNull();
@@ -218,7 +218,6 @@ final class EffectiveRibInWriter implements AutoCloseable {
 
         private void changeDataTree(final DOMDataWriteTransaction tx, final YangInstanceIdentifier rootPath,
             final DataTreeCandidateNode root, final NodeIdentifierWithPredicates peerKey, final DataTreeCandidateNode table) {
-
             final PathArgument lastArg = table.getIdentifier();
             Verify.verify(lastArg instanceof NodeIdentifierWithPredicates, "Unexpected type %s in path %s", lastArg.getClass(), rootPath);
             final NodeIdentifierWithPredicates tableKey = (NodeIdentifierWithPredicates) lastArg;