From 88f571c455b926e587eefb154e8e331020ec6ee5 Mon Sep 17 00:00:00 2001 From: Ravindra Thakur Date: Tue, 11 Jun 2019 15:41:37 +0530 Subject: [PATCH] Stale table 21 and table 220 entries RC: getPrimaryRd() with vpnInstance is used is delete path. which does not return the correct RD in delete path. Fix: use getVpnRd() with vpnName for vpn op data lookup. The variant with vpnName as lookup key uses vpn-instance-to-vpn-id DS to read the primary RD which gives correct primary RD value. Change-Id: I27467be7f0ea5eb6a05e5a5153887f6bbb06bac0 Signed-off-by: Ravindra Thakur Signed-off-by: Arun Sharma --- .../netvirt/vpnmanager/VpnInstanceListener.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/vpnmanager/impl/src/main/java/org/opendaylight/netvirt/vpnmanager/VpnInstanceListener.java b/vpnmanager/impl/src/main/java/org/opendaylight/netvirt/vpnmanager/VpnInstanceListener.java index 50ced723b0..72601a369c 100644 --- a/vpnmanager/impl/src/main/java/org/opendaylight/netvirt/vpnmanager/VpnInstanceListener.java +++ b/vpnmanager/impl/src/main/java/org/opendaylight/netvirt/vpnmanager/VpnInstanceListener.java @@ -79,6 +79,7 @@ import org.slf4j.LoggerFactory; public class VpnInstanceListener extends AsyncDataTreeChangeListenerBase { private static final Logger LOG = LoggerFactory.getLogger(VpnInstanceListener.class); private static final String LOGGING_PREFIX_ADD = "VPN-ADD:"; + private static final String LOGGING_PREFIX_UPDATE = "VPN-UPDATE:"; private static final String LOGGING_PREFIX_DELETE = "VPN-REMOVE:"; private final DataBroker dataBroker; private final ManagedNewTransactionRunner txRunner; @@ -125,24 +126,28 @@ public class VpnInstanceListener extends AsyncDataTreeChangeListenerBase identifier, VpnInstance del) { - LOG.trace("{} remove: VPN event key: {}, value: {}", LOGGING_PREFIX_DELETE, identifier, del); + LOG.trace("{} : VPN event key: {}, value: {}", LOGGING_PREFIX_DELETE, identifier, del); final String vpnName = del.getVpnInstanceName(); Optional vpnOpValue; - String primaryRd = VpnUtil.getPrimaryRd(del); + String primaryRd = vpnUtil.getVpnRd(vpnName); + if (primaryRd == null) { + LOG.error("{}, failed to remove VPN: primaryRd is null for vpn {}", LOGGING_PREFIX_DELETE, vpnName); + return; + } //TODO(vpnteam): Entire code would need refactoring to listen only on the parent object - VPNInstance try { vpnOpValue = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, VpnUtil.getVpnInstanceOpDataIdentifier(primaryRd)); } catch (ReadFailedException e) { - LOG.error("{} remove: Exception when attempting to retrieve VpnInstanceOpDataEntry for VPN {}. ", + LOG.error("{}, failed to remove VPN: Exception while retrieving VpnInstanceOpDataEntry for VPN {}. ", LOGGING_PREFIX_DELETE, vpnName, e); return; } if (!vpnOpValue.isPresent()) { - LOG.error("{} remove: Unable to retrieve VpnInstanceOpDataEntry for VPN {}. ", LOGGING_PREFIX_DELETE, - vpnName); + LOG.error("{}, failed to remove VPN: Unable to retrieve VpnInstanceOpDataEntry for VPN {}. ", + LOGGING_PREFIX_DELETE, vpnName); return; } else { jobCoordinator.enqueueJob("VPN-" + vpnName, () -> -- 2.36.6