import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
+import javax.inject.Inject;
+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.interfacemanager.IfmUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public final class AlivenessMonitorUtils {
private static final Logger LOG = LoggerFactory.getLogger(AlivenessMonitorUtils.class);
private static final long FAILURE_THRESHOLD = 4;
- private static final long MONITORING_INTERVAL = 10000;
private static final long MONITORING_WINDOW = 4;
private final AlivenessMonitorService alivenessMonitorService;
private final DataBroker dataBroker;
+ @Inject
public AlivenessMonitorUtils(AlivenessMonitorService alivenessMonitor, DataBroker dataBroker) {
this.alivenessMonitorService = alivenessMonitor;
this.dataBroker = dataBroker;
@Inject
public AlivenessMonitorListener(final DataBroker dataBroker, final NotificationService notificationService,
final AlivenessMonitorService alivenessMonitorService,
- final InterfaceManagerCommonUtils interfaceManagerCommonUtils) {
- this.alivenessMonitorUtils = new AlivenessMonitorUtils(alivenessMonitorService, dataBroker);
+ final InterfaceManagerCommonUtils interfaceManagerCommonUtils,
+ final AlivenessMonitorUtils alivenessMonitorUtils) {
+ this.alivenessMonitorUtils = alivenessMonitorUtils;
this.interfaceManagerCommonUtils = interfaceManagerCommonUtils;
notificationService.registerNotificationListener(this);
}
public InterfaceConfigListener(final DataBroker dataBroker, final IdManagerService idManager,
final IMdsalApiManager mdsalApiManager, final InterfacemgrProvider interfaceMgrProvider,
final AlivenessMonitorService alivenessMonitorService, final EntityOwnershipUtils entityOwnershipUtils,
- final JobCoordinator coordinator, final InterfaceManagerCommonUtils interfaceManagerCommonUtils) {
+ final JobCoordinator coordinator, final InterfaceManagerCommonUtils interfaceManagerCommonUtils,
+ final OvsInterfaceConfigRemoveHelper ovsInterfaceConfigRemoveHelper,
+ final OvsInterfaceConfigAddHelper ovsInterfaceConfigAddHelper,
+ final OvsInterfaceConfigUpdateHelper ovsInterfaceConfigUpdateHelper) {
super(Interface.class, InterfaceConfigListener.class);
this.interfaceMgrProvider = interfaceMgrProvider;
this.entityOwnershipUtils = entityOwnershipUtils;
this.coordinator = coordinator;
this.interfaceManagerCommonUtils = interfaceManagerCommonUtils;
- this.ovsInterfaceConfigRemoveHelper = new OvsInterfaceConfigRemoveHelper(dataBroker, alivenessMonitorService,
- mdsalApiManager, idManager, coordinator, interfaceManagerCommonUtils);
- this.ovsInterfaceConfigAddHelper = new OvsInterfaceConfigAddHelper(dataBroker, alivenessMonitorService,
- mdsalApiManager, coordinator, interfaceManagerCommonUtils);
- this.ovsInterfaceConfigUpdateHelper = new OvsInterfaceConfigUpdateHelper(ovsInterfaceConfigAddHelper,
- ovsInterfaceConfigRemoveHelper);
+ this.ovsInterfaceConfigRemoveHelper = ovsInterfaceConfigRemoveHelper;
+ this.ovsInterfaceConfigAddHelper = ovsInterfaceConfigAddHelper;
+ this.ovsInterfaceConfigUpdateHelper = ovsInterfaceConfigUpdateHelper;
this.registerListener(LogicalDatastoreType.CONFIGURATION, dataBroker);
}
public InterfaceInventoryStateListener(final DataBroker dataBroker, final IdManagerService idManagerService,
final IMdsalApiManager mdsalApiManager, final AlivenessMonitorService alivenessMonitorService,
final EntityOwnershipUtils entityOwnershipUtils, final JobCoordinator coordinator,
- final InterfaceManagerCommonUtils interfaceManagerCommonUtils) {
+ final InterfaceManagerCommonUtils interfaceManagerCommonUtils,
+ final OvsInterfaceStateAddHelper ovsInterfaceStateAddHelper,
+ final OvsInterfaceStateUpdateHelper ovsInterfaceStateUpdateHelper,
+ final AlivenessMonitorUtils alivenessMonitorUtils) {
super(FlowCapableNodeConnector.class, InterfaceInventoryStateListener.class);
this.dataBroker = dataBroker;
this.idManager = idManagerService;
this.entityOwnershipUtils = entityOwnershipUtils;
this.coordinator = coordinator;
this.interfaceManagerCommonUtils = interfaceManagerCommonUtils;
- this.alivenessMonitorUtils = new AlivenessMonitorUtils(alivenessMonitorService, dataBroker);
- this.ovsInterfaceStateUpdateHelper = new OvsInterfaceStateUpdateHelper(dataBroker, alivenessMonitorService,
- interfaceManagerCommonUtils);
- this.ovsInterfaceStateAddHelper = new OvsInterfaceStateAddHelper(dataBroker,
- alivenessMonitorService, interfaceManagerCommonUtils);
+ this.alivenessMonitorUtils = alivenessMonitorUtils;
+ this.ovsInterfaceStateUpdateHelper = ovsInterfaceStateUpdateHelper;
+ this.ovsInterfaceStateAddHelper = ovsInterfaceStateAddHelper;
this.registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
}
import com.google.common.util.concurrent.ListenableFuture;
import java.math.BigInteger;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
import javax.inject.Inject;
import org.opendaylight.genius.interfacemanager.InterfacemgrProvider;
import org.opendaylight.genius.interfacemanager.commons.InterfaceManagerCommonUtils;
import org.opendaylight.genius.interfacemanager.commons.InterfaceMetaUtils;
-import org.opendaylight.genius.interfacemanager.renderer.ovs.statehelpers.OvsInterfaceTopologyStateRemoveHelper;
import org.opendaylight.genius.interfacemanager.renderer.ovs.statehelpers.OvsInterfaceTopologyStateUpdateHelper;
import org.opendaylight.genius.interfacemanager.renderer.ovs.utilities.SouthboundUtils;
import org.opendaylight.genius.utils.clustering.EntityOwnershipUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.BridgeEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeRef;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
@Inject
public InterfaceTopologyStateListener(final DataBroker dataBroker, final InterfacemgrProvider interfaceMgrProvider,
final EntityOwnershipUtils entityOwnershipUtils, final JobCoordinator coordinator,
- final InterfaceManagerCommonUtils interfaceManagerCommonUtils) {
+ final InterfaceManagerCommonUtils interfaceManagerCommonUtils,
+ final OvsInterfaceTopologyStateUpdateHelper ovsInterfaceTopologyStateUpdateHelper) {
super(OvsdbBridgeAugmentation.class, InterfaceTopologyStateListener.class);
this.dataBroker = dataBroker;
this.interfaceMgrProvider = interfaceMgrProvider;
this.entityOwnershipUtils = entityOwnershipUtils;
this.coordinator = coordinator;
this.interfaceManagerCommonUtils = interfaceManagerCommonUtils;
- this.ovsInterfaceTopologyStateUpdateHelper = new OvsInterfaceTopologyStateUpdateHelper(dataBroker,
- entityOwnershipUtils, coordinator, interfaceManagerCommonUtils);
+ this.ovsInterfaceTopologyStateUpdateHelper = ovsInterfaceTopologyStateUpdateHelper;
this.registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
}
@Override
public List<ListenableFuture<Void>> call() {
- return OvsInterfaceTopologyStateRemoveHelper.removePortFromBridge(instanceIdentifier, bridgeNew,
- dataBroker);
+ BigInteger dpnId = IfmUtil.getDpnId(bridgeNew.getDatapathId());
+
+ if (dpnId == null) {
+ LOG.warn("Got Null DPID for Bridge: {}", bridgeNew);
+ return Collections.emptyList();
+ }
+
+ WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
+ LOG.debug("removing bridge references for bridge: {}, dpn: {}", bridgeNew, dpnId);
+ // delete bridge reference entry in interface meta operational DS
+ InterfaceMetaUtils.deleteBridgeRefEntry(dpnId, transaction);
+
+ // the bridge reference is copied to dpn-tunnel interfaces map, so that
+ // whenever a northbound delete
+ // happens when bridge is not connected, we need the bridge reference to
+ // clean up the topology config DS
+ InterfaceMetaUtils.addBridgeRefToBridgeInterfaceEntry(dpnId, new OvsdbBridgeRef(instanceIdentifier),
+ transaction);
+
+ return Collections.singletonList(transaction.submit());
}
}
@Inject
public TerminationPointStateListener(DataBroker dataBroker, final InterfacemgrProvider interfaceMgrProvider,
final EntityOwnershipUtils entityOwnershipUtils, final JobCoordinator coordinator,
- final InterfaceManagerCommonUtils interfaceManagerCommonUtils) {
+ final InterfaceManagerCommonUtils interfaceManagerCommonUtils,
+ final OvsInterfaceTopologyStateUpdateHelper ovsInterfaceTopologyStateUpdateHelper) {
this.interfaceMgrProvider = interfaceMgrProvider;
this.entityOwnershipUtils = entityOwnershipUtils;
this.coordinator = coordinator;
this.interfaceManagerCommonUtils = interfaceManagerCommonUtils;
- this.ovsInterfaceTopologyStateUpdateHelper = new OvsInterfaceTopologyStateUpdateHelper(dataBroker,
- entityOwnershipUtils, coordinator, interfaceManagerCommonUtils);
+ this.ovsInterfaceTopologyStateUpdateHelper = ovsInterfaceTopologyStateUpdateHelper;
this.registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
}
@Inject
public VlanMemberConfigListener(final DataBroker dataBroker, final IdManagerService idManagerService,
final IMdsalApiManager mdsalApiManager, final AlivenessMonitorService alivenessMonitorService,
- final JobCoordinator coordinator, final InterfaceManagerCommonUtils interfaceManagerCommonUtils) {
+ final JobCoordinator coordinator, final InterfaceManagerCommonUtils interfaceManagerCommonUtils,
+ final OvsVlanMemberConfigAddHelper ovsVlanMemberConfigAddHelper,
+ final OvsVlanMemberConfigRemoveHelper ovsVlanMemberConfigRemoveHelper,
+ final OvsVlanMemberConfigUpdateHelper ovsVlanMemberConfigUpdateHelper) {
super(Interface.class, VlanMemberConfigListener.class);
this.coordinator = coordinator;
- this.ovsVlanMemberConfigAddHelper = new OvsVlanMemberConfigAddHelper(dataBroker, idManagerService,
- interfaceManagerCommonUtils);
- this.ovsVlanMemberConfigRemoveHelper = new OvsVlanMemberConfigRemoveHelper(dataBroker,
- interfaceManagerCommonUtils);
- this.ovsVlanMemberConfigUpdateHelper = new OvsVlanMemberConfigUpdateHelper(ovsVlanMemberConfigAddHelper,
- ovsVlanMemberConfigRemoveHelper);
+ this.ovsVlanMemberConfigAddHelper = ovsVlanMemberConfigAddHelper;
+ this.ovsVlanMemberConfigRemoveHelper = ovsVlanMemberConfigRemoveHelper;
+ this.ovsVlanMemberConfigUpdateHelper = ovsVlanMemberConfigUpdateHelper;
this.registerListener(LogicalDatastoreType.CONFIGURATION, dataBroker);
}
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.genius.interfacemanager.IfmConstants;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
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.alivenessmonitor.rev160411.AlivenessMonitorService;
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.InterfaceParentEntryKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public final class OvsInterfaceConfigAddHelper {
private static final Logger LOG = LoggerFactory.getLogger(OvsInterfaceConfigAddHelper.class);
private final InterfaceManagerCommonUtils interfaceManagerCommonUtils;
private final OvsInterfaceStateAddHelper ovsInterfaceStateAddHelper;
- public OvsInterfaceConfigAddHelper(DataBroker dataBroker, AlivenessMonitorService alivenessMonitorService,
+ @Inject
+ public OvsInterfaceConfigAddHelper(DataBroker dataBroker, AlivenessMonitorUtils alivenessMonitorUtils,
IMdsalApiManager mdsalApiManager, JobCoordinator coordinator,
- InterfaceManagerCommonUtils interfaceManagerCommonUtils) {
+ InterfaceManagerCommonUtils interfaceManagerCommonUtils,
+ OvsInterfaceStateAddHelper ovsInterfaceStateAddHelper) {
this.dataBroker = dataBroker;
+ this.alivenessMonitorUtils = alivenessMonitorUtils;
this.mdsalApiManager = mdsalApiManager;
this.coordinator = coordinator;
this.interfaceManagerCommonUtils = interfaceManagerCommonUtils;
- this.alivenessMonitorUtils = new AlivenessMonitorUtils(alivenessMonitorService, dataBroker);
- this.ovsInterfaceStateAddHelper = new OvsInterfaceStateAddHelper(dataBroker, alivenessMonitorService,
- interfaceManagerCommonUtils);
+ this.ovsInterfaceStateAddHelper = ovsInterfaceStateAddHelper;
}
public List<ListenableFuture<Void>> addConfiguration(ParentRefs parentRefs, Interface interfaceNew) {
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.genius.interfacemanager.IfmConstants;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
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.alivenessmonitor.rev160411.AlivenessMonitorService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
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;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public final class OvsInterfaceConfigRemoveHelper {
private static final Logger LOG = LoggerFactory.getLogger(OvsInterfaceConfigRemoveHelper.class);
private final DataBroker dataBroker;
- private final AlivenessMonitorService alivenessMonitorService;
private final IMdsalApiManager mdsalApiManager;
private final IdManagerService idManager;
private final JobCoordinator coordinator;
private final InterfaceManagerCommonUtils interfaceManagerCommonUtils;
private final AlivenessMonitorUtils alivenessMonitorUtils;
- public OvsInterfaceConfigRemoveHelper(DataBroker dataBroker, AlivenessMonitorService alivenessMonitorService,
+ @Inject
+ public OvsInterfaceConfigRemoveHelper(DataBroker dataBroker, AlivenessMonitorUtils alivenessMonitorUtils,
IMdsalApiManager mdsalApiManager, IdManagerService idManager, JobCoordinator coordinator,
InterfaceManagerCommonUtils interfaceManagerCommonUtils) {
this.dataBroker = dataBroker;
- this.alivenessMonitorService = alivenessMonitorService;
this.mdsalApiManager = mdsalApiManager;
this.idManager = idManager;
this.coordinator = coordinator;
this.interfaceManagerCommonUtils = interfaceManagerCommonUtils;
- this.alivenessMonitorUtils = new AlivenessMonitorUtils(alivenessMonitorService, dataBroker);
- }
-
- public DataBroker getDataBroker() {
- return dataBroker;
- }
-
- public AlivenessMonitorService getAlivenessMonitorService() {
- return alivenessMonitorService;
- }
-
- public IMdsalApiManager getMdsalApiManager() {
- return mdsalApiManager;
- }
-
- public IdManagerService getIdManager() {
- return idManager;
- }
-
- public JobCoordinator getCoordinator() {
- return coordinator;
- }
-
- public AlivenessMonitorUtils getAlivenessMonitorUtils() {
- return alivenessMonitorUtils;
- }
-
- public InterfaceManagerCommonUtils getInterfaceManagerCommonUtils() {
- return interfaceManagerCommonUtils;
+ this.alivenessMonitorUtils = alivenessMonitorUtils;
}
public List<ListenableFuture<Void>> removeConfiguration(Interface interfaceOld, ParentRefs parentRefs) {
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.genius.interfacemanager.IfmConstants;
+import org.opendaylight.genius.interfacemanager.commons.AlivenessMonitorUtils;
import org.opendaylight.genius.interfacemanager.commons.InterfaceManagerCommonUtils;
import org.opendaylight.genius.interfacemanager.commons.InterfaceMetaUtils;
import org.opendaylight.genius.interfacemanager.renderer.ovs.utilities.SouthboundUtils;
+import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class OvsInterfaceConfigUpdateHelper {
private static final Logger LOG = LoggerFactory.getLogger(OvsInterfaceConfigUpdateHelper.class);
+ private final DataBroker dataBroker;
+ private final JobCoordinator coordinator;
+ private final InterfaceManagerCommonUtils interfaceManagerCommonUtils;
+ private final AlivenessMonitorUtils alivenessMonitorUtils;
private final OvsInterfaceConfigRemoveHelper ovsInterfaceConfigRemoveHelper;
private final OvsInterfaceConfigAddHelper ovsInterfaceConfigAddHelper;
- public OvsInterfaceConfigUpdateHelper(OvsInterfaceConfigAddHelper ovsInterfaceConfigAddHelper,
- OvsInterfaceConfigRemoveHelper ovsInterfaceConfigRemoveHelper) {
- this.ovsInterfaceConfigAddHelper = ovsInterfaceConfigAddHelper;
+ @Inject
+ public OvsInterfaceConfigUpdateHelper(DataBroker dataBroker, JobCoordinator coordinator,
+ InterfaceManagerCommonUtils interfaceManagerCommonUtils, AlivenessMonitorUtils alivenessMonitorUtils,
+ OvsInterfaceConfigRemoveHelper ovsInterfaceConfigRemoveHelper,
+ OvsInterfaceConfigAddHelper ovsInterfaceConfigAddHelper) {
+ this.dataBroker = dataBroker;
+ this.coordinator = coordinator;
+ this.interfaceManagerCommonUtils = interfaceManagerCommonUtils;
+ this.alivenessMonitorUtils = alivenessMonitorUtils;
this.ovsInterfaceConfigRemoveHelper = ovsInterfaceConfigRemoveHelper;
+ this.ovsInterfaceConfigAddHelper = ovsInterfaceConfigAddHelper;
}
public List<ListenableFuture<Void>> updateConfiguration(Interface interfaceNew, Interface interfaceOld) {
// If there is no operational state entry for the interface, treat it as
// create
- final DataBroker dataBroker = ovsInterfaceConfigRemoveHelper.getDataBroker();
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
- .ietf.interfaces.rev140508.interfaces.state.Interface ifState = ovsInterfaceConfigRemoveHelper
- .getInterfaceManagerCommonUtils().getInterfaceState(interfaceNew.getName());
+ .ietf.interfaces.rev140508.interfaces.state.Interface ifState = interfaceManagerCommonUtils
+ .getInterfaceState(interfaceNew.getName());
if (ifState == null) {
futures.addAll(ovsInterfaceConfigAddHelper.addConfiguration(interfaceNew.getAugmentation(ParentRefs.class),
interfaceNew));
private void handleTunnelMonitorUpdates(List<ListenableFuture<Void>> futures, WriteTransaction transaction,
Interface interfaceNew, Interface interfaceOld) {
LOG.debug("tunnel monitoring attributes modified for interface {}", interfaceNew.getName());
- DataBroker dataBroker = ovsInterfaceConfigRemoveHelper.getDataBroker();
// update termination point on switch, if switch is connected
BridgeRefEntry bridgeRefEntry = InterfaceMetaUtils.getBridgeReferenceForInterface(interfaceNew, dataBroker);
IfTunnel ifTunnel = interfaceNew.getAugmentation(IfTunnel.class);
} else {
// update lldp tunnel monitoring attributes for an internal vxlan
// tunnel interface
- ovsInterfaceConfigRemoveHelper.getAlivenessMonitorUtils().handleTunnelMonitorUpdates(
- interfaceOld, interfaceNew);
+ alivenessMonitorUtils.handleTunnelMonitorUpdates(interfaceOld, interfaceNew);
}
futures.add(transaction.submit());
}
return;
}
LOG.info("admin-state modified for interface {}", interfaceNew.getName());
- DataBroker dataBroker = ovsInterfaceConfigRemoveHelper.getDataBroker();
- OperStatus operStatus = ovsInterfaceConfigRemoveHelper.getInterfaceManagerCommonUtils()
- .updateStateEntry(interfaceNew, transaction , ifState);
+ OperStatus operStatus = interfaceManagerCommonUtils.updateStateEntry(interfaceNew, transaction , ifState);
InterfaceParentEntryKey interfaceParentEntryKey = new InterfaceParentEntryKey(interfaceNew.getName());
InterfaceParentEntry interfaceParentEntry = InterfaceMetaUtils
.getInterfaceParentEntryFromConfigDS(interfaceParentEntryKey, dataBroker);
VlanMemberStateUpdateWorker vlanMemberStateUpdateWorker = new VlanMemberStateUpdateWorker(dataBroker,
operStatus, interfaceParentEntry.getInterfaceChildEntry());
- ovsInterfaceConfigRemoveHelper.getCoordinator().enqueueJob(interfaceNew.getName(), vlanMemberStateUpdateWorker,
- IfmConstants.JOB_MAX_RETRIES);
+ coordinator.enqueueJob(interfaceNew.getName(), vlanMemberStateUpdateWorker, IfmConstants.JOB_MAX_RETRIES);
}
private static <T> boolean checkAugmentations(T oldAug, T newAug) {
import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.genius.interfacemanager.commons.InterfaceManagerCommonUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class OvsVlanMemberConfigAddHelper {
private static final Logger LOG = LoggerFactory.getLogger(OvsVlanMemberConfigAddHelper.class);
private final DataBroker dataBroker;
- private final IdManagerService idManager;
private final InterfaceManagerCommonUtils interfaceManagerCommonUtils;
- public OvsVlanMemberConfigAddHelper(DataBroker dataBroker, IdManagerService idManager,
+ @Inject
+ public OvsVlanMemberConfigAddHelper(DataBroker dataBroker,
InterfaceManagerCommonUtils interfaceManagerCommonUtils) {
this.dataBroker = dataBroker;
- this.idManager = idManager;
this.interfaceManagerCommonUtils = interfaceManagerCommonUtils;
}
- public DataBroker getDataBroker() {
- return dataBroker;
- }
-
- public IdManagerService getIdManager() {
- return idManager;
- }
-
- public InterfaceManagerCommonUtils getInterfaceManagerCommonUtils() {
- return interfaceManagerCommonUtils;
- }
-
public List<ListenableFuture<Void>> addConfiguration(ParentRefs parentRefs, Interface interfaceNew) {
LOG.info("adding vlan member configuration for interface {}", interfaceNew.getName());
List<ListenableFuture<Void>> futures = new ArrayList<>();
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class OvsVlanMemberConfigRemoveHelper {
private static final Logger LOG = LoggerFactory.getLogger(OvsVlanMemberConfigRemoveHelper.class);
private final DataBroker dataBroker;
private final InterfaceManagerCommonUtils interfaceManagerCommonUtils;
+ @Inject
public OvsVlanMemberConfigRemoveHelper(DataBroker dataBroker,
InterfaceManagerCommonUtils interfaceManagerCommonUtils) {
this.dataBroker = dataBroker;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.interfacemanager.IfmUtil;
+import org.opendaylight.genius.interfacemanager.commons.InterfaceManagerCommonUtils;
import org.opendaylight.genius.interfacemanager.commons.InterfaceMetaUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class OvsVlanMemberConfigUpdateHelper {
private static final Logger LOG = LoggerFactory.getLogger(OvsVlanMemberConfigUpdateHelper.class);
+ private final DataBroker dataBroker;
+ private final InterfaceManagerCommonUtils interfaceManagerCommonUtils;
private final OvsVlanMemberConfigAddHelper ovsVlanMemberConfigAddHelper;
private final OvsVlanMemberConfigRemoveHelper ovsVlanMemberConfigRemoveHelper;
- public OvsVlanMemberConfigUpdateHelper(OvsVlanMemberConfigAddHelper ovsVlanMemberConfigAddHelper,
+ @Inject
+ public OvsVlanMemberConfigUpdateHelper(DataBroker dataBroker,
+ InterfaceManagerCommonUtils interfaceManagerCommonUtils,
+ OvsVlanMemberConfigAddHelper ovsVlanMemberConfigAddHelper,
OvsVlanMemberConfigRemoveHelper ovsVlanMemberConfigRemoveHelper) {
+ this.dataBroker = dataBroker;
+ this.interfaceManagerCommonUtils = interfaceManagerCommonUtils;
this.ovsVlanMemberConfigAddHelper = ovsVlanMemberConfigAddHelper;
this.ovsVlanMemberConfigRemoveHelper = ovsVlanMemberConfigRemoveHelper;
}
parentRefsOld.getParentInterface());
InterfaceChildEntryKey interfaceChildEntryKey = new InterfaceChildEntryKey(interfaceOld.getName());
InterfaceChildEntry interfaceChildEntry = InterfaceMetaUtils
- .getInterfaceChildEntryFromConfigDS(interfaceParentEntryKey, interfaceChildEntryKey,
- ovsVlanMemberConfigAddHelper.getDataBroker());
+ .getInterfaceChildEntryFromConfigDS(interfaceParentEntryKey, interfaceChildEntryKey, dataBroker);
if (interfaceChildEntry == null) {
futures.addAll(ovsVlanMemberConfigAddHelper.addConfiguration(interfaceNew.getAugmentation(ParentRefs.class),
return futures;
}
- DataBroker dataBroker = ovsVlanMemberConfigAddHelper.getDataBroker();
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf
- .interfaces.rev140508.interfaces.state.Interface pifState = ovsVlanMemberConfigAddHelper
- .getInterfaceManagerCommonUtils().getInterfaceState(parentRefsNew.getParentInterface());
+ .interfaces.rev140508.interfaces.state.Interface pifState = interfaceManagerCommonUtils.getInterfaceState(
+ parentRefsNew.getParentInterface());
if (pifState != null) {
OperStatus operStatus = OperStatus.Down;
if (interfaceNew.isEnabled()) {
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.genius.interfacemanager.IfmConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.AlivenessMonitorService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
* entries in Interface-State OperDS. Create the entries in Inventory OperDS.
*/
+@Singleton
public final class OvsInterfaceStateAddHelper {
private static final Logger LOG = LoggerFactory.getLogger(OvsInterfaceStateAddHelper.class);
private final InterfaceManagerCommonUtils interfaceManagerCommonUtils;
private final AlivenessMonitorUtils alivenessMonitorUtils;
- public OvsInterfaceStateAddHelper(DataBroker dataBroker, AlivenessMonitorService alivenessMonitorService,
+ @Inject
+ public OvsInterfaceStateAddHelper(DataBroker dataBroker, AlivenessMonitorUtils alivenessMonitorUtils,
InterfaceManagerCommonUtils interfaceManagerCommonUtils) {
this.dataBroker = dataBroker;
this.interfaceManagerCommonUtils = interfaceManagerCommonUtils;
- this.alivenessMonitorUtils = new AlivenessMonitorUtils(alivenessMonitorService, dataBroker);
+ this.alivenessMonitorUtils = alivenessMonitorUtils;
}
public List<ListenableFuture<Void>> addState(String interfaceName, Interface parentInterface) {
import com.google.common.util.concurrent.ListenableFuture;
import java.util.Collections;
import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.AlivenessMonitorService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class OvsInterfaceStateUpdateHelper {
private static final Logger LOG = LoggerFactory.getLogger(OvsInterfaceStateUpdateHelper.class);
private final InterfaceManagerCommonUtils interfaceManagerCommonUtils;
private final AlivenessMonitorUtils alivenessMonitorUtils;
- public OvsInterfaceStateUpdateHelper(DataBroker dataBroker, AlivenessMonitorService alivenessMonitorService,
+ @Inject
+ public OvsInterfaceStateUpdateHelper(DataBroker dataBroker, AlivenessMonitorUtils alivenessMonitorUtils,
InterfaceManagerCommonUtils interfaceManagerCommonUtils) {
this.dataBroker = dataBroker;
this.interfaceManagerCommonUtils = interfaceManagerCommonUtils;
- this.alivenessMonitorUtils = new AlivenessMonitorUtils(alivenessMonitorService, dataBroker);
+ this.alivenessMonitorUtils = alivenessMonitorUtils;
}
public List<ListenableFuture<Void>> updateState(String interfaceName,
+++ /dev/null
-/*
- * Copyright (c) 2016, 2017 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.genius.interfacemanager.renderer.ovs.statehelpers;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import java.math.BigInteger;
-import java.util.Collections;
-import java.util.List;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.genius.interfacemanager.IfmUtil;
-import org.opendaylight.genius.interfacemanager.commons.InterfaceMetaUtils;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeRef;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class OvsInterfaceTopologyStateRemoveHelper {
- private static final Logger LOG = LoggerFactory.getLogger(OvsInterfaceTopologyStateRemoveHelper.class);
-
- public static List<ListenableFuture<Void>> removePortFromBridge(
- InstanceIdentifier<OvsdbBridgeAugmentation> bridgeIid, OvsdbBridgeAugmentation bridgeOld,
- DataBroker dataBroker) {
- BigInteger dpnId = IfmUtil.getDpnId(bridgeOld.getDatapathId());
-
- if (dpnId == null) {
- LOG.warn("Got Null DPID for Bridge: {}", bridgeOld);
- return Collections.emptyList();
- }
-
- WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
- LOG.debug("removing bridge references for bridge: {}, dpn: {}", bridgeOld,
- dpnId);
- // delete bridge reference entry in interface meta operational DS
- InterfaceMetaUtils.deleteBridgeRefEntry(dpnId, transaction);
-
- // the bridge reference is copied to dpn-tunnel interfaces map, so that
- // whenever a northbound delete
- // happens when bridge is not connected, we need the bridge reference to
- // clean up the topology config DS
- InterfaceMetaUtils.addBridgeRefToBridgeInterfaceEntry(dpnId, new OvsdbBridgeRef(bridgeIid), transaction);
-
- return Collections.singletonList(transaction.submit());
- }
-}
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.genius.interfacemanager.IfmConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class OvsInterfaceTopologyStateUpdateHelper {
private static final Logger LOG = LoggerFactory.getLogger(OvsInterfaceTopologyStateUpdateHelper.class);
private final JobCoordinator coordinator;
private final InterfaceManagerCommonUtils interfaceManagerCommonUtils;
+ @Inject
public OvsInterfaceTopologyStateUpdateHelper(DataBroker dataBroker, EntityOwnershipUtils entityOwnershipUtils,
JobCoordinator coordinator, InterfaceManagerCommonUtils interfaceManagerCommonUtils) {
this.dataBroker = dataBroker;