<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.genius</groupId>
+ <artifactId>cloudscaler-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.opendaylight.infrautils</groupId>
<artifactId>caches-test</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.genius</groupId>
+ <artifactId>cloudscaler-impl</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<!--Build Dependencies-->
<build>
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
+import org.opendaylight.genius.cloudscaler.api.TombstonedNodeManager;
import org.opendaylight.genius.infra.Datastore.Configuration;
import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
private final DirectTunnelUtils directTunnelUtils;
private final OfEndPointCache ofEndPointCache;
private final ItmConfig itmConfig;
+ private final TombstonedNodeManager tombstonedNodeManager;
public ItmInternalTunnelDeleteWorker(DataBroker dataBroker, JobCoordinator jobCoordinator,
TunnelMonitoringConfig tunnelMonitoringConfig,
TunnelStateCache tunnelStateCache,
DirectTunnelUtils directTunnelUtils,
OfEndPointCache ofEndPointCache,
- ItmConfig itmConfig) {
+ ItmConfig itmConfig,
+ TombstonedNodeManager tombstonedNodeManager) {
this.dataBroker = dataBroker;
this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
this.jobCoordinator = jobCoordinator;
this.directTunnelUtils = directTunnelUtils;
this.ofEndPointCache = ofEndPointCache;
this.itmConfig = itmConfig;
+ this.tombstonedNodeManager = tombstonedNodeManager;
}
@SuppressWarnings("checkstyle:IllegalCatch")
LOG.debug("Entries in meshEndPointCache {} for DPN Id{} ", meshedEndPtCache.size(), srcDpn.getDPNID());
for (TunnelEndPoints srcTep : srcDpn.nonnullTunnelEndPoints()) {
LOG.trace("Processing srcTep {}", srcTep);
+ Boolean isDpnTombstoned = tombstonedNodeManager.isDpnTombstoned(srcDpn.getDPNID());
List<TzMembership> srcTZones = srcTep.nonnullTzMembership();
boolean tepDeleteFlag = false;
// First, take care of tunnel removal, so run through all other DPNS other than srcDpn
+ "Destination TEP {} " ,srcTep , dstTep);
removeTunnelInterfaceFromOvsdb(tx, srcTep, dstTep, srcDpn.getDPNID(),
dstDpn.getDPNID());
-
+ if (isDpnTombstoned) {
+ LOG.trace("Removing tunnelState entry for {} while tombstoned "
+ + "is set {}", srcDpn.getDPNID(), isDpnTombstoned);
+ removeTunnelState(srcTep,dstTep);
+ }
}
-
} else {
if (checkIfTrunkExists(dstDpn.getDPNID(), srcDpn.getDPNID(),
srcTep.getTunnelType(), dataBroker)) {
}
}
+ private void removeTunnelState(TunnelEndPoints srcTep, TunnelEndPoints dstTep) {
+ String trunkfwdIfName = ItmUtils.getTrunkInterfaceName(srcTep.getInterfaceName(),
+ srcTep.getIpAddress().getIpv4Address().getValue(),
+ dstTep.getIpAddress().getIpv4Address().getValue(),
+ srcTep.getTunnelType().getName());
+ LOG.trace("Removing tunnelstate for {}", trunkfwdIfName);
+ directTunnelUtils.deleteTunnelStateEntry(trunkfwdIfName);
+
+ String trunkRevIfName = ItmUtils.getTrunkInterfaceName(dstTep.getInterfaceName(),
+ dstTep.getIpAddress().getIpv4Address().getValue(),
+ srcTep.getIpAddress().getIpv4Address().getValue(),
+ srcTep.getTunnelType().getName());
+ LOG.trace("Removing tunnelstate for {}", trunkRevIfName);
+ directTunnelUtils.deleteTunnelStateEntry(trunkRevIfName);
+ }
+
private boolean checkIfTepInterfaceExists(Uint64 srcDpnId, Uint64 dstDpnId) {
DpnTepInterfaceInfo dpnTepInterfaceInfo = dpnTepStateCache.getDpnTepInterface(srcDpnId, dstDpnId);
if (dpnTepInterfaceInfo != null) {
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.genius.cloudscaler.api.TombstonedNodeManager;
import org.opendaylight.genius.datastoreutils.listeners.DataTreeEventCallbackRegistrar;
import org.opendaylight.genius.infra.Datastore;
import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
private final DPNTEPsInfoCache dpnTEPsInfoCache;
private final ManagedNewTransactionRunner txRunner;
private final DataTreeEventCallbackRegistrar eventCallbacks;
+ private final TombstonedNodeManager tombstonedNodeManager;
@Inject
public TransportZoneListener(final DataBroker dataBroker,
final IInterfaceManager interfaceManager,
final OfEndPointCache ofEndPointCache,
final ServiceRecoveryRegistry serviceRecoveryRegistry,
- final DataTreeEventCallbackRegistrar eventCallbacks) {
+ final DataTreeEventCallbackRegistrar eventCallbacks,
+ final TombstonedNodeManager tombstonedNodeManager) {
super(dataBroker, LogicalDatastoreType.CONFIGURATION,
InstanceIdentifier.create(TransportZones.class).child(TransportZone.class));
this.dataBroker = dataBroker;
this.mdsalManager = mdsalManager;
this.itmConfig = itmConfig;
this.dpnTEPsInfoCache = dpnTEPsInfoCache;
+ this.tombstonedNodeManager = tombstonedNodeManager;
this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
this.eventCallbacks = eventCallbacks;
initializeTZNode();
this.itmInternalTunnelDeleteWorker = new ItmInternalTunnelDeleteWorker(dataBroker, jobCoordinator,
tunnelMonitoringConfig, interfaceManager, dpnTepStateCache, ovsBridgeEntryCache,
- ovsBridgeRefEntryCache, tunnelStateCache, directTunnelUtils, ofEndPointCache, itmConfig);
+ ovsBridgeRefEntryCache, tunnelStateCache, directTunnelUtils, ofEndPointCache, itmConfig,
+ tombstonedNodeManager);
this.itmInternalTunnelAddWorker = new ItmInternalTunnelAddWorker(dataBroker, jobCoordinator,
tunnelMonitoringConfig, itmConfig, directTunnelUtils, interfaceManager,
ovsBridgeRefEntryCache, ofEndPointCache, eventCallbacks);
this.externalTunnelAddWorker = new ItmExternalTunnelAddWorker(itmConfig, dpnTEPsInfoCache);
- serviceRecoveryRegistry.addRecoverableListener(ItmServiceRecoveryHandler.getServiceRegistryKey(), this);
+ serviceRecoveryRegistry.addRecoverableListener(ItmServiceRecoveryHandler.getServiceRegistryKey(),
+ this);
}
@Override
import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.genius.cloudscaler.api.TombstonedNodeManager;
import org.opendaylight.genius.datastoreutils.listeners.DataTreeEventCallbackRegistrar;
import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
private final ManagedNewTransactionRunner txRunner;
private final IInterfaceManager interfaceManager;
private final DpnTepStateCache dpnTepStateCache;
+ private final TombstonedNodeManager tombstonedNodeManager;
@Inject
public ItmTepInstanceRecoveryHandler(DataBroker dataBroker,
ServiceRecoveryRegistry serviceRecoveryRegistry,
EntityOwnershipUtils entityOwnershipUtils,
OfEndPointCache ofEndPointCache,
- DataTreeEventCallbackRegistrar eventCallbacks) {
+ DataTreeEventCallbackRegistrar eventCallbacks,
+ TombstonedNodeManager tombstonedNodeManager) {
this.dataBroker = dataBroker;
this.itmConfig = itmConfig;
this.imdsalApiManager = imdsalApiMgr;
this.dpntePsInfoCache = dpntePsInfoCache;
this.entityOwnershipUtils = entityOwnershipUtils;
this.eventCallbacks = eventCallbacks;
+ this.tombstonedNodeManager = tombstonedNodeManager;
this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
this.itmInternalTunnelAddWorker = new ItmInternalTunnelAddWorker(dataBroker, jobCoordinator,
tunnelMonitoringConfig, itmConfig, directTunnelUtils, interfaceManager,
dpntePsInfoCache);
this.itmInternalTunnelDeleteWorker = new ItmInternalTunnelDeleteWorker(dataBroker, jobCoordinator,
tunnelMonitoringConfig, interfaceManager, dpnTepStateCache, ovsBridgeEntryCache,
- ovsBridgeRefEntryCache, tunnelStateCache, directTunnelUtils, ofEndPointCache, itmConfig);
+ ovsBridgeRefEntryCache, tunnelStateCache, directTunnelUtils, ofEndPointCache, itmConfig,
+ tombstonedNodeManager);
serviceRecoveryRegistry.registerServiceRecoveryRegistry(getServiceRegistryKey(), this);
this.interfaceManager = interfaceManager;
this.dpnTepStateCache = dpnTepStateCache;
<reference id="dataTreeEventCallbackRegistrar"
interface="org.opendaylight.genius.datastoreutils.listeners.DataTreeEventCallbackRegistrar"/>
+ <reference id="tombstonedNodeManager"
+ interface="org.opendaylight.genius.cloudscaler.api.TombstonedNodeManager"/>
+
<odl:clustered-app-config id="itmConfig"
binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfig"
default-config-file-name="genius-itm-config.xml"
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.genius.cloudscaler.api.TombstonedNodeManager;
import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.itm.cache.DPNTEPsInfoCache;
import org.opendaylight.genius.itm.cache.DpnTepStateCache;
@Mock IInterfaceManager interfaceManager;
@Mock ItmConfig itmConfig;
@Mock TunnelMonitoringConfig tunnelMonitoringConfig;
+ @Mock TombstonedNodeManager tombstonedNodeManager;
DirectTunnelUtils directTunnelUtils;
ItmInternalTunnelDeleteWorker itmInternalTunnelDeleteWorker;
UnprocessedNodeConnectorCache unprocessedNodeConnectorCache;
new OvsBridgeEntryCache(dataBroker, new GuavaCacheProvider(new CacheManagersRegistryImpl())),
new OvsBridgeRefEntryCache(dataBroker, new GuavaCacheProvider(new CacheManagersRegistryImpl())),
new TunnelStateCache(dataBroker, new GuavaCacheProvider(new CacheManagersRegistryImpl())),
- directTunnelUtils, ofEndPointCache, itmConfig);
+ directTunnelUtils, ofEndPointCache, itmConfig, tombstonedNodeManager);
}
@After
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.test.DataBrokerTestModule;
import org.opendaylight.daexim.DataImportBootReady;
+import org.opendaylight.genius.cloudscaler.api.TombstonedNodeManager;
+import org.opendaylight.genius.cloudscaler.rpcservice.TombstonedNodeManagerImpl;
import org.opendaylight.genius.datastoreutils.listeners.DataTreeEventCallbackRegistrar;
import org.opendaylight.genius.datastoreutils.listeners.internal.DataTreeEventCallbackRegistrarImpl;
import org.opendaylight.genius.datastoreutils.testutils.JobCoordinatorEventsWaiter;
new SimpleDOMEntityOwnershipService(), dataBrokerTestModule.getBindingToNormalizedNodeCodec());
bind(EntityOwnershipService.class).toInstance(entityOwnershipService);
bind(EntityOwnershipUtils.class);
+ bind(TombstonedNodeManager.class).to(TombstonedNodeManagerImpl.class);
// Bindings to test infra (fakes & mocks)
TestIMdsalApiManager mdsalManager = TestIMdsalApiManager.newInstance();