import javax.inject.Singleton;
import org.apache.aries.blueprint.annotation.service.Reference;
import org.eclipse.jdt.annotation.Nullable;
+import org.opendaylight.genius.cloudscaler.api.TombstonedNodeManager;
import org.opendaylight.genius.interfacemanager.IfmConstants;
import org.opendaylight.genius.interfacemanager.IfmUtil;
import org.opendaylight.genius.interfacemanager.commons.AlivenessMonitorUtils;
import org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl;
import org.opendaylight.mdsal.binding.util.TypedReadWriteTransaction;
import org.opendaylight.mdsal.binding.util.TypedWriteTransaction;
+import org.opendaylight.mdsal.common.api.ReadFailedException;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntry;
private final AlivenessMonitorUtils alivenessMonitorUtils;
private final InterfaceMetaUtils interfaceMetaUtils;
private final SouthboundUtils southboundUtils;
+ private final TombstonedNodeManager tombstonedNodeManager;
@Inject
public OvsInterfaceConfigRemoveHelper(@Reference DataBroker dataBroker,
@Reference JobCoordinator coordinator,
InterfaceManagerCommonUtils interfaceManagerCommonUtils,
InterfaceMetaUtils interfaceMetaUtils,
- SouthboundUtils southboundUtils) {
+ SouthboundUtils southboundUtils,
+ TombstonedNodeManager tombstonedNodeManager) {
this.dataBroker = dataBroker;
this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
this.mdsalApiManager = mdsalApiManager;
this.alivenessMonitorUtils = alivenessMonitorUtils;
this.interfaceMetaUtils = interfaceMetaUtils;
this.southboundUtils = southboundUtils;
+ this.tombstonedNodeManager = tombstonedNodeManager;
}
public List<? extends ListenableFuture<?>> removeConfiguration(Interface interfaceOld, ParentRefs parentRefs) {
private void removeVlanConfiguration(ParentRefs parentRefs, String interfaceName,
IfL2vlan ifL2vlan, TypedWriteTransaction<Operational> tx,
- List<ListenableFuture<?>> futures) {
+ List<ListenableFuture<?>> futures) throws ReadFailedException {
+
if (parentRefs == null || ifL2vlan == null || IfL2vlan.L2vlanMode.Trunk != ifL2vlan.getL2vlanMode()
&& IfL2vlan.L2vlanMode.Transparent != ifL2vlan.getL2vlanMode()) {
return;
private void removeTunnelConfiguration(ParentRefs parentRefs, String interfaceName, IfTunnel ifTunnel,
TypedWriteTransaction<Operational> operTx, TypedReadWriteTransaction<Configuration> confTx)
- throws ExecutionException, InterruptedException {
+ throws ExecutionException, InterruptedException, ReadFailedException {
LOG.info("removing tunnel configuration for interface {}", interfaceName);
Uint64 dpId = null;
if (parentRefs != null) {
public org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
.ietf.interfaces.rev140508.interfaces.state.Interface cleanUpInterfaceWithUnknownState(
String interfaceName, ParentRefs parentRefs, IfTunnel ifTunnel,
- TypedWriteTransaction<Operational> transaction) {
+ TypedWriteTransaction<Operational> transaction) throws ReadFailedException {
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508
.interfaces.state.Interface ifState = interfaceManagerCommonUtils.getInterfaceState(interfaceName);
if (ifState != null && ifState
.getOperStatus() == org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
- .ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus.Unknown) {
+ .ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus.Unknown
+ || tombstonedNodeManager.isDpnTombstoned(parentRefs.getDatapathNodeIdentifier())) {
String staleInterface = ifTunnel != null ? interfaceName : parentRefs.getParentInterface();
- LOG.debug("cleaning up parent-interface for {}, since the oper-status is UNKNOWN", interfaceName);
+ LOG.debug("cleaning up parent-interface for {}, in the case oper-status is UNKNOWN or the DPN:{}"
+ + " is tombstoned", interfaceName, parentRefs.getDatapathNodeIdentifier());
interfaceManagerCommonUtils.deleteInterfaceStateInformation(staleInterface, transaction);
}
return ifState;