Fix delete case in EffRibIn. 73/22173/2
authorDana Kutenicsova <dkutenic@cisco.com>
Tue, 9 Jun 2015 09:33:46 +0000 (11:33 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 9 Jun 2015 12:45:42 +0000 (12:45 +0000)
Delete case was pushed with wrong InstanceIdentifier.

Change-Id: I3e57f5f0b7915bcd290d4b2e851bbb388a092eb4
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.java

index 3ff077c8ccf419aea68c91ae7f3147d17c4808b4..9ab1b61cbe1e14a9d258debc80f098dd3b90b759 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();