import org.opendaylight.genius.cloudscaler.api.TombstonedNodeManager;
import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.itm.cache.DpnTepStateCache;
-import org.opendaylight.genius.itm.cache.OfEndPointCache;
import org.opendaylight.genius.itm.cache.OvsBridgeEntryCache;
import org.opendaylight.genius.itm.cache.OvsBridgeRefEntryCache;
import org.opendaylight.genius.itm.cache.TunnelStateCache;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeBase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeLogicalGroup;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfig;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.meta.rev171210.bridge.tunnel.info.OvsBridgeEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.meta.rev171210.bridge.tunnel.info.OvsBridgeEntryKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.meta.rev171210.bridge.tunnel.info.ovs.bridge.entry.OvsBridgeTunnelEntry;
private final OvsBridgeRefEntryCache ovsBridgeRefEntryCache;
private final TunnelStateCache tunnelStateCache;
private final DirectTunnelUtils directTunnelUtils;
- private final OfEndPointCache ofEndPointCache;
- private final ItmConfig itmConfig;
private final TombstonedNodeManager tombstonedNodeManager;
public ItmInternalTunnelDeleteWorker(DataBroker dataBroker, JobCoordinator jobCoordinator,
OvsBridgeRefEntryCache ovsBridgeRefEntryCache,
TunnelStateCache tunnelStateCache,
DirectTunnelUtils directTunnelUtils,
- OfEndPointCache ofEndPointCache,
- ItmConfig itmConfig,
TombstonedNodeManager tombstonedNodeManager) {
this.dataBroker = dataBroker;
this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
this.ovsBridgeRefEntryCache = ovsBridgeRefEntryCache;
this.tunnelStateCache = tunnelStateCache;
this.directTunnelUtils = directTunnelUtils;
- this.ofEndPointCache = ofEndPointCache;
- this.itmConfig = itmConfig;
this.tombstonedNodeManager = tombstonedNodeManager;
}
}
for (DPNTEPsInfo srcDpn : dpnTepsList) {
LOG.trace("Processing srcDpn {}", srcDpn);
-
List<TunnelEndPoints> meshedEndPtCache = ItmUtils.getTEPsForDpn(srcDpn.getDPNID(), meshedDpnList);
if (meshedEndPtCache == null) {
LOG.debug("No Tunnel End Point configured for this DPN {}", srcDpn.getDPNID());
return;
}
- OvsdbBridgeRef ovsdbBridgeRef = getOvsdbBridgeRef(dpId);
- Optional<OvsBridgeEntry> ovsBridgeEntryOptional = ovsBridgeEntryCache.get(dpId);
+ Optional<OvsBridgeRefEntry> ovsBridgeRefEntryOptional = ovsBridgeRefEntryCache.get(dpId);
+ Optional<OvsBridgeEntry> ovsBridgeEntryOptional;
+ OvsdbBridgeRef ovsdbBridgeRef = null;
+ if (ovsBridgeRefEntryOptional.isPresent()) {
+ ovsdbBridgeRef = ovsBridgeRefEntryOptional.get().getOvsBridgeReference();
+ } else {
+ ovsBridgeEntryOptional = ovsBridgeEntryCache.get(dpId);
+ if (ovsBridgeEntryOptional.isPresent()) {
+ ovsdbBridgeRef = ovsBridgeEntryOptional.get().getOvsBridgeReference();
+ }
+ }
+
+ if (ovsdbBridgeRef != null) {
+ removeTerminationEndPoint(ovsdbBridgeRef.getValue(), interfaceName);
+ }
+ removeTunnelIngressFlow(tx, interfaceName, dpId);
// delete bridge to tunnel interface mappings
OvsBridgeEntryKey bridgeEntryKey = new OvsBridgeEntryKey(dpId);
InstanceIdentifier<OvsBridgeEntry> bridgeEntryIid =
DirectTunnelUtils.getOvsBridgeEntryIdentifier(bridgeEntryKey);
+ ovsBridgeEntryOptional = ovsBridgeEntryCache.get(dpId);
if (ovsBridgeEntryOptional.isPresent()) {
@NonNull Map<OvsBridgeTunnelEntryKey, OvsBridgeTunnelEntry> bridgeTunnelEntries =
ovsBridgeEntryOptional.get().nonnullOvsBridgeTunnelEntry();
- if (ovsdbBridgeRef != null) {
- if (!itmConfig.isUseOfTunnels()) {
- removeTerminationEndPoint(ovsdbBridgeRef.getValue(), interfaceName);
- } else if (bridgeTunnelEntries.size() <= 1) {
- removeTerminationEndPoint(ovsdbBridgeRef.getValue(), ofEndPointCache.get(dpId));
- ofEndPointCache.remove(dpId);
- }
- }
-
deleteBridgeInterfaceEntry(bridgeEntryKey, bridgeTunnelEntries, bridgeEntryIid, interfaceName);
// IfIndex needs to be removed only during State Clean up not Config
+ cleanUpInterfaceWithUnknownState(interfaceName, parentRefs, ifTunnel);
+ directTunnelUtils.removeLportTagInterfaceMap(interfaceName);
}
-
- directTunnelUtils.deleteTunnelStateEntry(interfaceName);
- // delete tunnel ingress flow
- removeTunnelIngressFlow(tx, interfaceName, dpId);
- directTunnelUtils.removeTunnelEgressFlow(tx, dpId, interfaceName);
- cleanUpInterfaceWithUnknownState(interfaceName, parentRefs, ifTunnel);
- directTunnelUtils.removeLportTagInterfaceMap(interfaceName);
- }
-
- private OvsdbBridgeRef getOvsdbBridgeRef(Uint64 dpId) throws ReadFailedException {
- Optional<OvsBridgeRefEntry> ovsBridgeRefEntryOptional = ovsBridgeRefEntryCache.get(dpId);
- Optional<OvsBridgeEntry> ovsBridgeEntryOptional;
- OvsdbBridgeRef ovsdbBridgeRef = null;
- if (ovsBridgeRefEntryOptional.isPresent()) {
- ovsdbBridgeRef = ovsBridgeRefEntryOptional.get().getOvsBridgeReference();
- } else {
- ovsBridgeEntryOptional = ovsBridgeEntryCache.get(dpId);
- if (ovsBridgeEntryOptional.isPresent()) {
- ovsdbBridgeRef = ovsBridgeEntryOptional.get().getOvsBridgeReference();
- }
- }
- return ovsdbBridgeRef;
}
private void removeTerminationEndPoint(InstanceIdentifier<?> bridgeIid, String interfaceName) {