import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
import org.opendaylight.netvirt.vpnmanager.VpnFootprintService;
+import org.opendaylight.netvirt.vpnmanager.VpnUtil;
import org.opendaylight.netvirt.vpnmanager.api.intervpnlink.InterVpnLinkCache;
import org.opendaylight.netvirt.vpnmanager.api.intervpnlink.InterVpnLinkDataComposite;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.inter.vpn.link.rev160311.inter.vpn.link.states.InterVpnLinkState;
String firstEndpointVpnUuid = vpnLink.getFirstEndpointVpnUuid().get();
String secondEndpointVpnUuid = vpnLink.getSecondEndpointVpnUuid().get();
// Note that in the DPN of the firstEndpoint we install the lportTag of the secondEndpoint and viceversa
-
- InterVpnLinkUtil.installLPortDispatcherTableFlow(broker, mdsalManager, ivpnLinkName, firstDpnList,
- secondEndpointVpnUuid, opt2ndEndpointLportTag.get());
- InterVpnLinkUtil.installLPortDispatcherTableFlow(broker, mdsalManager, ivpnLinkName, secondDpnList,
- firstEndpointVpnUuid, opt1stEndpointLportTag.get());
- // Update the VPN -> DPNs Map.
- // Note: when a set of DPNs is calculated for Vpn1, these DPNs are added to the VpnToDpn map of Vpn2. Why?
- // because we do the handover from Vpn1 to Vpn2 in those DPNs, so in those DPNs we must know how to reach
- // to Vpn2 targets. If new Vpn2 targets are added later, the Fib will be maintained in these DPNs even if
- // Vpn2 is not physically present there.
- InterVpnLinkUtil.updateVpnFootprint(vpnFootprintService, secondEndpointVpnUuid, firstDpnList);
- InterVpnLinkUtil.updateVpnFootprint(vpnFootprintService, firstEndpointVpnUuid, secondDpnList);
+ String vpn1PrimaryRd = VpnUtil.getPrimaryRd(broker, firstEndpointVpnUuid);
+ String vpn2PrimaryRd = VpnUtil.getPrimaryRd(broker, secondEndpointVpnUuid);
+ if (!VpnUtil.isVpnPendingDelete(broker, vpn1PrimaryRd)
+ && !VpnUtil.isVpnPendingDelete(broker, vpn2PrimaryRd)) {
+ InterVpnLinkUtil.installLPortDispatcherTableFlow(broker, mdsalManager, ivpnLinkName, firstDpnList,
+ secondEndpointVpnUuid, opt2ndEndpointLportTag.get());
+ InterVpnLinkUtil.installLPortDispatcherTableFlow(broker, mdsalManager, ivpnLinkName, secondDpnList,
+ firstEndpointVpnUuid, opt1stEndpointLportTag.get());
+ // Update the VPN -> DPNs Map.
+ // Note: when a set of DPNs is calculated for Vpn1, these DPNs are added to the VpnToDpn map of Vpn2. Why?
+ // because we do the handover from Vpn1 to Vpn2 in those DPNs, so in those DPNs we must know how to reach
+ // to Vpn2 targets. If new Vpn2 targets are added later, the Fib will be maintained in these DPNs even if
+ // Vpn2 is not physically present there.
+ InterVpnLinkUtil.updateVpnFootprint(vpnFootprintService, secondEndpointVpnUuid, vpn1PrimaryRd,
+ firstDpnList);
+ InterVpnLinkUtil.updateVpnFootprint(vpnFootprintService, firstEndpointVpnUuid, vpn2PrimaryRd,
+ secondDpnList);
+ }
}
}