package org.opendaylight.genius.itm.api;
import java.math.BigInteger;
+import java.util.Collection;
import java.util.List;
import org.apache.felix.service.command.CommandSession;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
void showTeps(CommandSession session);
- void showState(List<StateTunnelList> tunnels, CommandSession session);
+ void showState(Collection<StateTunnelList> tunnels, CommandSession session);
void showCache(String cacheName);
String DEFAULT_TRANSPORT_ZONE = "default-transport-zone";
Class<? extends TunnelMonitoringTypeBase> DEFAULT_MONITOR_PROTOCOL
= TunnelMonitoringTypeBfd.class;
- String ITM_MONIRORING_PARAMS_CACHE_NAME = "ItmMonitoringParamsCache";
- String TUNNEL_STATE_CACHE_NAME = "ItmTunnelStateCache";
- // FIXME: the following annotation should be removed once the itm-impl
- // changes the name
- @SuppressWarnings("checkstyle:ConstantName")
- String DPN_TEPs_Info_CACHE_NAME = "ItmDpnTepsInfoCache";
String INTERNAL_TUNNEL_CACHE_NAME = "InternalTunnelCache";
String EXTERNAL_TUNNEL_CACHE_NAME = "ExternalTunnelCache";
String TUNNEL_STATE_UP = "UP";
<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.infrautils</groupId>
+ <artifactId>caches-test</artifactId>
+ <version>${genius.infrautils.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<!--Build Dependencies-->
<build>
--- /dev/null
+/*
+ * Copyright (c) 2017 Inocybe Technologies 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.itm.cache;
+
+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.mdsalutil.cache.DataObjectCache;
+import org.opendaylight.infrautils.caches.CacheProvider;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.DpnEndpoints;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * Caches DPNTEPsInfo objects.
+ *
+ * @author Thomas Pantelis
+ */
+@SuppressWarnings("checkstyle:AbbreviationAsWordInName")
+@Singleton
+public class DPNTEPsInfoCache extends DataObjectCache<DPNTEPsInfo> {
+
+ @Inject
+ public DPNTEPsInfoCache(DataBroker dataBroker, CacheProvider cacheProvider) {
+ super(DPNTEPsInfo.class, dataBroker, LogicalDatastoreType.CONFIGURATION,
+ InstanceIdentifier.builder(DpnEndpoints.class).child(DPNTEPsInfo.class).build(), cacheProvider);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Inocybe Technologies 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.itm.cache;
+
+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.mdsalutil.cache.DataObjectCache;
+import org.opendaylight.infrautils.caches.CacheProvider;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.TunnelsState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * Caches StateTunnelList objects.
+ *
+ * @author Thomas Pantelis
+ */
+@Singleton
+public class TunnelStateCache extends DataObjectCache<StateTunnelList> {
+
+ @Inject
+ public TunnelStateCache(DataBroker dataBroker, CacheProvider cacheProvider) {
+ super(StateTunnelList.class, dataBroker, LogicalDatastoreType.OPERATIONAL,
+ InstanceIdentifier.builder(TunnelsState.class).child(StateTunnelList.class).build(), cacheProvider);
+ }
+}
}
@SuppressWarnings("checkstyle:RegexpSinglelineJava")
- public void showState(List<StateTunnelList> tunnelLists, boolean tunnelMonitorEnabled,
+ public void showState(Collection<StateTunnelList> tunnelLists, boolean tunnelMonitorEnabled,
CommandSession session) throws TepException {
if (tunnelLists == null || tunnelLists.isEmpty()) {
handleError("No Internal Tunnels Exist", session);
*/
package org.opendaylight.genius.itm.cli;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Collection;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.console.OsgiCommandSupport;
import org.opendaylight.genius.itm.api.IITMProvider;
-import org.opendaylight.genius.itm.globals.ITMConstants;
-import org.opendaylight.genius.utils.cache.DataStoreCache;
+import org.opendaylight.genius.itm.cache.TunnelStateCache;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList;
@Command(scope = "tep", name = "show-state", description = "Monitors tunnel state")
public class TepShowState extends OsgiCommandSupport {
- private IITMProvider itmProvider;
+ private final IITMProvider itmProvider;
+ private final TunnelStateCache tunnelStateCache;
- public void setItmProvider(IITMProvider itmProvider) {
+ public TepShowState(IITMProvider itmProvider, TunnelStateCache tunnelStateCache) {
this.itmProvider = itmProvider;
+ this.tunnelStateCache = tunnelStateCache;
}
@Override
protected Object doExecute() {
- List<StateTunnelList> tunnels = null ;
- List<Object> values = null ;
- values = DataStoreCache.getValues(ITMConstants.TUNNEL_STATE_CACHE_NAME);
- if (values != null) {
- tunnels = new ArrayList<>() ;
- for (Object value : values) {
- tunnels.add((StateTunnelList)value);
- }
- }
- if (tunnels != null) {
+ Collection<StateTunnelList> tunnels = tunnelStateCache.getAllPresent();
+ if (!tunnels.isEmpty()) {
itmProvider.showState(tunnels, session);
} else {
session.getConsole().println("No Internal Tunnels configured on the switch");
}
return null;
}
-}
\ No newline at end of file
+}
import com.google.common.util.concurrent.ListenableFuture;
import java.math.BigInteger;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.apache.commons.net.util.SubnetUtils;
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.itm.cache.DPNTEPsInfoCache;
import org.opendaylight.genius.itm.globals.ITMConstants;
import org.opendaylight.genius.itm.impl.ItmUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public final class ItmExternalTunnelAddWorker {
+public class ItmExternalTunnelAddWorker {
private static final Logger LOG = LoggerFactory.getLogger(ItmExternalTunnelAddWorker.class);
- private static Integer monitorInterval;
- private static Class<? extends TunnelMonitoringTypeBase> monitorProtocol;
+ private final DataBroker dataBroker;
+ private final ItmConfig itmConfig;
+ private final DPNTEPsInfoCache dpnTEPsInfoCache;
- private ItmExternalTunnelAddWorker() { }
+ public ItmExternalTunnelAddWorker(DataBroker dataBroker, ItmConfig itmConfig, DPNTEPsInfoCache dpnTEPsInfoCache) {
+ this.dataBroker = dataBroker;
+ this.itmConfig = itmConfig;
+ this.dpnTEPsInfoCache = dpnTEPsInfoCache;
+ }
- public static List<ListenableFuture<Void>> buildTunnelsToExternalEndPoint(DataBroker dataBroker,
- List<DPNTEPsInfo> cfgDpnList,
- IpAddress extIp,
- Class<? extends TunnelTypeBase> tunType,
- ItmConfig itmConfig) {
+ public List<ListenableFuture<Void>> buildTunnelsToExternalEndPoint(Collection<DPNTEPsInfo> cfgDpnList,
+ IpAddress extIp, Class<? extends TunnelTypeBase> tunType) {
if (null != cfgDpnList) {
WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
for (DPNTEPsInfo teps : cfgDpnList) {
return Collections.emptyList();
}
- public static List<ListenableFuture<Void>> buildTunnelsFromDpnToExternalEndPoint(DataBroker dataBroker,
- List<BigInteger> dpnId,
- IpAddress extIp,
- Class<? extends TunnelTypeBase>
- tunType,
- ItmConfig itmConfig) {
- List<DPNTEPsInfo> cfgDpnList = dpnId == null ? ItmUtils.getTunnelMeshInfo(dataBroker)
- : ItmUtils.getDpnTepListFromDpnId(dataBroker, dpnId);
- return buildTunnelsToExternalEndPoint(dataBroker, cfgDpnList, extIp, tunType, itmConfig);
+ public List<ListenableFuture<Void>> buildTunnelsFromDpnToExternalEndPoint(List<BigInteger> dpnId, IpAddress extIp,
+ Class<? extends TunnelTypeBase> tunType) {
+ Collection<DPNTEPsInfo> cfgDpnList = dpnId == null ? dpnTEPsInfoCache.getAllPresent()
+ : ItmUtils.getDpnTepListFromDpnId(dpnTEPsInfoCache, dpnId);
+ return buildTunnelsToExternalEndPoint(cfgDpnList, extIp, tunType);
}
- public static List<ListenableFuture<Void>> buildHwVtepsTunnels(DataBroker dataBroker,
- List<DPNTEPsInfo> cfgdDpnList,
- List<HwVtep> cfgdHwVteps) {
+ public List<ListenableFuture<Void>> buildHwVtepsTunnels(List<DPNTEPsInfo> cfgdDpnList, List<HwVtep> cfgdHwVteps) {
+ Integer monitorInterval = ITMConstants.BFD_DEFAULT_MONITOR_INTERVAL;
+ Class<? extends TunnelMonitoringTypeBase> monitorProtocol = ITMConstants.DEFAULT_MONITOR_PROTOCOL;
+
List<ListenableFuture<Void>> futures = new ArrayList<>();
WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
- monitorInterval = ITMConstants.BFD_DEFAULT_MONITOR_INTERVAL;
- monitorProtocol = ITMConstants.DEFAULT_MONITOR_PROTOCOL;
if (null != cfgdDpnList && !cfgdDpnList.isEmpty()) {
LOG.trace("calling tunnels from css {}",cfgdDpnList);
- tunnelsFromCSS(cfgdDpnList, writeTransaction , dataBroker);
+ tunnelsFromCSS(cfgdDpnList, writeTransaction, monitorInterval, monitorProtocol);
}
if (null != cfgdHwVteps && !cfgdHwVteps.isEmpty()) {
LOG.trace("calling tunnels from hwTep {}",cfgdHwVteps);
- tunnelsFromhWVtep(cfgdHwVteps, writeTransaction, dataBroker);
+ tunnelsFromhWVtep(cfgdHwVteps, writeTransaction, monitorInterval, monitorProtocol);
}
if (cfgdDpnList != null && !cfgdDpnList.isEmpty() || cfgdHwVteps != null && !cfgdHwVteps.isEmpty()) {
return futures;
}
- private static void tunnelsFromCSS(List<DPNTEPsInfo> cfgdDpnList,
- WriteTransaction transaction,
- DataBroker dataBroker) {
+ private void tunnelsFromCSS(List<DPNTEPsInfo> cfgdDpnList, WriteTransaction transaction, Integer monitorInterval,
+ Class<? extends TunnelMonitoringTypeBase> monitorProtocol) {
for (DPNTEPsInfo dpn : cfgdDpnList) {
LOG.trace("processing dpn {}" , dpn);
if (dpn.getTunnelEndPoints() != null && !dpn.getTunnelEndPoints().isEmpty()) {
for (TunnelEndPoints tep : dpn.getTunnelEndPoints()) {
for (TzMembership zone: tep.getTzMembership()) {
createTunnelsFromOVSinTransportZone(zone.getZoneName(), dpn, tep,
- transaction, dataBroker);
+ transaction, monitorInterval, monitorProtocol);
}
}
}
}
}
- private static void createTunnelsFromOVSinTransportZone(String zoneName, DPNTEPsInfo dpn, TunnelEndPoints tep,
- WriteTransaction transaction, DataBroker dataBroker) {
+ private void createTunnelsFromOVSinTransportZone(String zoneName, DPNTEPsInfo dpn, TunnelEndPoints tep,
+ WriteTransaction transaction, Integer monitorInterval,
+ Class<? extends TunnelMonitoringTypeBase> monitorProtocol) {
InstanceIdentifier<TransportZone> tzonePath = InstanceIdentifier.builder(TransportZones.class)
.child(TransportZone.class, new TransportZoneKey(zoneName)).build();
Optional<TransportZone> transportZoneOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION,
if (!wireUp(dpn.getDPNID(), tep.getPortname(), sub.getVlanId(),
tep.getIpAddress(), useOfTunnel, nodeId, hwVtepDS.getIpAddress(),
tep.getSubnetMask(), sub.getGatewayIp(), sub.getPrefix(),
- transportZone.getTunnelType(), false, transaction)) {
+ transportZone.getTunnelType(), false, monitorInterval, monitorProtocol,
+ transaction)) {
LOG.error("Unable to build tunnel {} -- {}",
tep.getIpAddress(), hwVtepDS.getIpAddress());
}
LOG.trace("wire up {} and {}", hwVtepDS,tep);
if (!wireUp(hwVtepDS.getTopologyId(), hwVtepDS.getNodeId(), hwVtepDS.getIpAddress(),
cssID, tep.getIpAddress(), sub.getPrefix(), sub.getGatewayIp(),
- tep.getSubnetMask(), transportZone.getTunnelType(), false,
- transaction)) {
+ tep.getSubnetMask(), transportZone.getTunnelType(), false, monitorInterval,
+ monitorProtocol, transaction)) {
LOG.error("Unable to build tunnel {} -- {}",
hwVtepDS.getIpAddress(), tep.getIpAddress());
}
}
}
- private static void tunnelsFromhWVtep(List<HwVtep> cfgdHwVteps,
- WriteTransaction transaction,
- DataBroker dataBroker) {
+ private void tunnelsFromhWVtep(List<HwVtep> cfgdHwVteps, WriteTransaction transaction,
+ Integer monitorInterval, Class<? extends TunnelMonitoringTypeBase> monitorProtocol) {
for (HwVtep hwTep : cfgdHwVteps) {
InstanceIdentifier<TransportZone> tzonePath = InstanceIdentifier.builder(TransportZones.class)
.child(TransportZone.class, new TransportZoneKey(hwTep.getTransportZone())).build();
LOG.trace("wire up {} and {}",hwTep, hwVtepDS);
if (!wireUp(hwTep.getTopoId(), hwTep.getNodeId(), hwTep.getHwIp(),
hwVtepDS.getNodeId(), hwVtepDS.getIpAddress(), hwTep.getIpPrefix(),
- hwTep.getGatewayIP(), sub.getPrefix(), tunType,false,
- transaction)) {
+ hwTep.getGatewayIP(), sub.getPrefix(), tunType, false,
+ monitorInterval, monitorProtocol, transaction)) {
LOG.error("Unable to build tunnel {} -- {}",
hwTep.getHwIp(), hwVtepDS.getIpAddress());
}
LOG.trace("wire up {} and {}", hwVtepDS,hwTep);
if (!wireUp(hwTep.getTopoId(), hwVtepDS.getNodeId(), hwVtepDS.getIpAddress(),
hwTep.getNodeId(), hwTep.getHwIp(), sub.getPrefix(), sub.getGatewayIp(),
- hwTep.getIpPrefix(), tunType, false,
- transaction)) {
+ hwTep.getIpPrefix(), tunType, false, monitorInterval,
+ monitorProtocol, transaction)) {
LOG.error("Unable to build tunnel {} -- {}",
hwVtepDS.getIpAddress(), hwTep.getHwIp());
}
LOG.trace("wire up {} and {}",hwTep, vtep);
if (!wireUp(hwTep.getTopoId(), hwTep.getNodeId(), hwTep.getHwIp(), cssID,
vtep.getIpAddress(), hwTep.getIpPrefix(), hwTep.getGatewayIP(),
- sub.getPrefix(), tunType,false,
+ sub.getPrefix(), tunType,false, monitorInterval, monitorProtocol,
transaction)) {
LOG.error("Unable to build tunnel {} -- {}",
hwTep.getHwIp(), vtep.getIpAddress());
boolean useOfTunnel = ItmUtils.falseIfNull(vtep.isOptionOfTunnel());
if (!wireUp(vtep.getDpnId(), vtep.getPortname(), sub.getVlanId(), vtep.getIpAddress(),
useOfTunnel, hwTep.getNodeId(),hwTep.getHwIp(),sub.getPrefix(),
- sub.getGatewayIp(), hwTep.getIpPrefix(), tunType, false, transaction)) {
+ sub.getGatewayIp(),hwTep.getIpPrefix(), tunType, false,
+ monitorInterval, monitorProtocol, transaction)) {
//do nothing
}
}
}
//for tunnels from TOR device
- private static boolean wireUp(String topoId, String srcNodeid, IpAddress srcIp, String dstNodeId, IpAddress dstIp,
- IpPrefix srcSubnet, IpAddress gwIp, IpPrefix dstSubnet,
- Class<? extends TunnelTypeBase> tunType, Boolean monitorEnabled,
- WriteTransaction transaction) {
+ private boolean wireUp(String topoId, String srcNodeid, IpAddress srcIp, String dstNodeId, IpAddress dstIp,
+ IpPrefix srcSubnet, IpAddress gwIp, IpPrefix dstSubnet, Class<? extends TunnelTypeBase> tunType,
+ Boolean monitorEnabled, Integer monitorInterval, Class<? extends TunnelMonitoringTypeBase> monitorProtocol,
+ WriteTransaction transaction) {
IpAddress gatewayIpObj = new IpAddress("0.0.0.0".toCharArray());
IpAddress gwyIpAddress = srcSubnet.equals(dstSubnet) ? gatewayIpObj : gwIp;
String parentIf = ItmUtils.getHwParentIf(topoId, srcNodeid);
}
//for tunnels from OVS
- private static boolean wireUp(BigInteger dpnId, String portname, Integer vlanId, IpAddress srcIp,
- Boolean remoteIpFlow, String dstNodeId, IpAddress dstIp, IpPrefix srcSubnet,
- IpAddress gwIp, IpPrefix dstSubnet, Class<? extends TunnelTypeBase> tunType,
- Boolean monitorEnabled, WriteTransaction transaction) {
+ private boolean wireUp(BigInteger dpnId, String portname, Integer vlanId, IpAddress srcIp, Boolean remoteIpFlow,
+ String dstNodeId, IpAddress dstIp, IpPrefix srcSubnet, IpAddress gwIp, IpPrefix dstSubnet,
+ Class<? extends TunnelTypeBase> tunType, Boolean monitorEnabled, Integer monitorInterval,
+ Class<? extends TunnelMonitoringTypeBase> monitorProtocol, WriteTransaction transaction) {
IpAddress gatewayIpObj = new IpAddress("0.0.0.0".toCharArray());
IpAddress gwyIpAddress = srcSubnet.equals(dstSubnet) ? gatewayIpObj : gwIp;
String parentIf = ItmUtils.getInterfaceName(dpnId, portname, vlanId);
import com.google.common.util.concurrent.ListenableFuture;
import java.math.BigInteger;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
private ItmExternalTunnelDeleteWorker() { }
public static List<ListenableFuture<Void>> deleteTunnels(DataBroker dataBroker,
- List<DPNTEPsInfo> dpnTepsList, List<DPNTEPsInfo> meshedDpnList, IpAddress extIp,
+ Collection<DPNTEPsInfo> dpnTepsList, Collection<DPNTEPsInfo> meshedDpnList, IpAddress extIp,
Class<? extends TunnelTypeBase> tunType) {
LOG.trace(" Delete Tunnels towards DC Gateway with Ip {}", extIp);
}
public static List<ListenableFuture<Void>> deleteTunnels(DataBroker dataBroker,
- List<DPNTEPsInfo> dpnTepsList, IpAddress extIp, Class<? extends TunnelTypeBase> tunType) {
+ Collection<DPNTEPsInfo> dpnTepsList, IpAddress extIp, Class<? extends TunnelTypeBase> tunType) {
LOG.trace(" Delete Tunnels towards DC Gateway with Ip {}", extIp);
if (dpnTepsList == null || dpnTepsList.isEmpty()) {
import com.google.common.util.concurrent.ListenableFuture;
import java.math.BigInteger;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
import org.opendaylight.genius.itm.impl.ITMBatchingUtils;
import org.opendaylight.genius.itm.impl.ItmUtils;
+import org.opendaylight.genius.itm.impl.TunnelMonitoringConfig;
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.inet.types.rev130715.IpAddress;
public final class ItmInternalTunnelAddWorker {
private static final Logger LOG = LoggerFactory.getLogger(ItmInternalTunnelAddWorker.class) ;
- private static Boolean monitorEnabled;
- private static Integer monitorInterval;
private static ItmConfig itmCfg;
- private static Class<? extends TunnelMonitoringTypeBase> monitorProtocol;
+
+ private final Integer monitorInterval;
+ private final boolean isTunnelMonitoringEnabled;
+ private final Class<? extends TunnelMonitoringTypeBase> monitorProtocol;
private final DataBroker dataBroker;
private final ManagedNewTransactionRunner txRunner;
private final JobCoordinator jobCoordinator;
- public ItmInternalTunnelAddWorker(DataBroker dataBroker, JobCoordinator jobCoordinator) {
+ public ItmInternalTunnelAddWorker(DataBroker dataBroker, JobCoordinator jobCoordinator,
+ TunnelMonitoringConfig tunnelMonitoringConfig) {
this.dataBroker = dataBroker;
this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
this.jobCoordinator = jobCoordinator;
+
+ isTunnelMonitoringEnabled = tunnelMonitoringConfig.isTunnelMonitoringEnabled();
+ monitorProtocol = tunnelMonitoringConfig.getMonitorProtocol();
+ monitorInterval = Integer.valueOf(tunnelMonitoringConfig.getMonitorInterval());
}
public List<ListenableFuture<Void>> buildAllTunnels(IMdsalApiManager mdsalManager, List<DPNTEPsInfo> cfgdDpnList,
- List<DPNTEPsInfo> meshedDpnList, ItmConfig itmConfig) {
+ Collection<DPNTEPsInfo> meshedDpnList, ItmConfig itmConfig) {
LOG.trace("Building tunnels with DPN List {} " , cfgdDpnList);
- monitorInterval = ItmUtils.determineMonitorInterval(dataBroker);
- monitorProtocol = ItmUtils.determineMonitorProtocol(dataBroker);
- monitorEnabled = ItmUtils.readMonitoringStateFromCache(dataBroker);
itmCfg = itmConfig;
if (null == cfgdDpnList || cfgdDpnList.isEmpty()) {
LOG.error(" Build Tunnels was invoked with empty list");
ITMBatchingUtils.update(dep, tnlBuilder, ITMBatchingUtils.EntityType.DEFAULT_CONFIG);
}
- private void buildTunnelFrom(DPNTEPsInfo srcDpn, List<DPNTEPsInfo> meshedDpnList,
+ private void buildTunnelFrom(DPNTEPsInfo srcDpn, Collection<DPNTEPsInfo> meshedDpnList,
IMdsalApiManager mdsalManager, WriteTransaction transaction) {
LOG.trace("Building tunnels from DPN {} " , srcDpn);
if (null == meshedDpnList || meshedDpnList.isEmpty()) {
return true;
}
- private static void createTunnelInterface(TunnelEndPoints srcte, TunnelEndPoints dstte,
- BigInteger srcDpnId, Class<? extends TunnelTypeBase> tunType,
- String trunkInterfaceName, String parentInterfaceName) {
+ private void createTunnelInterface(TunnelEndPoints srcte, TunnelEndPoints dstte, BigInteger srcDpnId,
+ Class<? extends TunnelTypeBase> tunType, String trunkInterfaceName, String parentInterfaceName) {
String gateway = srcte.getIpAddress().getIpv4Address() != null ? "0.0.0.0" : "::";
IpAddress gatewayIpObj = new IpAddress(gateway.toCharArray());
IpAddress gwyIpAddress =
boolean useOfTunnel = ItmUtils.falseIfNull(srcte.isOptionOfTunnel());
List<TunnelOptions> tunOptions = ItmUtils.buildTunnelOptions(srcte, itmCfg);
- Boolean isMonitorEnabled = tunType.isAssignableFrom(TunnelTypeLogicalGroup.class) ? false : monitorEnabled;
+ Boolean isMonitorEnabled = tunType.isAssignableFrom(TunnelTypeLogicalGroup.class) ? false
+ : isTunnelMonitoringEnabled;
Interface iface = ItmUtils.buildTunnelInterface(srcDpnId, trunkInterfaceName,
String.format("%s %s",ItmUtils.convertTunnelTypetoString(tunType), "Trunk Interface"),
true, tunType, srcte.getIpAddress(), dstte.getIpAddress(), gwyIpAddress, srcte.getVLANID(), true,
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
-
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.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
import org.opendaylight.genius.itm.impl.ItmUtils;
+import org.opendaylight.genius.itm.impl.TunnelMonitoringConfig;
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;
private final DataBroker dataBroker;
private final ManagedNewTransactionRunner txRunner;
private final JobCoordinator jobCoordinator;
+ private final TunnelMonitoringConfig tunnelMonitoringConfig;
- public ItmInternalTunnelDeleteWorker(DataBroker dataBroker, JobCoordinator jobCoordinator) {
+ public ItmInternalTunnelDeleteWorker(DataBroker dataBroker, JobCoordinator jobCoordinator,
+ TunnelMonitoringConfig tunnelMonitoringConfig) {
this.dataBroker = dataBroker;
this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
this.jobCoordinator = jobCoordinator;
+ this.tunnelMonitoringConfig = tunnelMonitoringConfig;
}
@SuppressWarnings("checkstyle:IllegalCatch")
- public List<ListenableFuture<Void>> deleteTunnels(IMdsalApiManager mdsalManager, List<DPNTEPsInfo> dpnTepsList,
- List<DPNTEPsInfo> meshedDpnList) {
+ public List<ListenableFuture<Void>> deleteTunnels(IMdsalApiManager mdsalManager,
+ Collection<DPNTEPsInfo> dpnTepsList, Collection<DPNTEPsInfo> meshedDpnList) {
LOG.trace("TEPs to be deleted {} " , dpnTepsList);
return Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(writeTransaction -> {
if (dpnTepsList == null || dpnTepsList.size() == 0) {
// remove the tep from the cache
meshedEndPtCache.remove(srcTep);
Class<? extends TunnelMonitoringTypeBase> monitorProtocol =
- ItmUtils.determineMonitorProtocol(dataBroker);
+ tunnelMonitoringConfig.getMonitorProtocol();
InstanceIdentifier<DPNTEPsInfo> dpnPath =
InstanceIdentifier.builder(DpnEndpoints.class).child(DPNTEPsInfo.class, srcDpn.getKey())
.build();
import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.concurrent.Callable;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.genius.itm.cache.DPNTEPsInfoCache;
import org.opendaylight.genius.itm.impl.ItmUtils;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfig;
private static final Logger LOG = LoggerFactory.getLogger(ItmTepAddWorker.class);
private final DataBroker dataBroker;
- private List<DPNTEPsInfo> meshedDpnList;
+ private Collection<DPNTEPsInfo> meshedDpnList;
private final List<DPNTEPsInfo> cfgdDpnList ;
private final IMdsalApiManager mdsalManager;
private final List<HwVtep> cfgdHwVteps;
private final ItmConfig itmConfig;
private final ItmInternalTunnelAddWorker itmInternalTunnelAddWorker;
+ private final ItmExternalTunnelAddWorker externalTunnelAddWorker;
+ private final DPNTEPsInfoCache dpnTEPsInfoCache;
public ItmTepAddWorker(List<DPNTEPsInfo> cfgdDpnList, List<HwVtep> hwVtepList, DataBroker broker,
- IMdsalApiManager mdsalManager,
- ItmConfig itmConfig, ItmInternalTunnelAddWorker itmInternalTunnelAddWorker) {
+ IMdsalApiManager mdsalManager, ItmConfig itmConfig, ItmInternalTunnelAddWorker itmInternalTunnelAddWorker,
+ ItmExternalTunnelAddWorker externalTunnelAddWorker, DPNTEPsInfoCache dpnTEPsInfoCache) {
this.cfgdDpnList = cfgdDpnList ;
this.dataBroker = broker ;
this.mdsalManager = mdsalManager;
this.cfgdHwVteps = hwVtepList;
this.itmConfig = itmConfig;
this.itmInternalTunnelAddWorker = itmInternalTunnelAddWorker;
+ this.externalTunnelAddWorker = externalTunnelAddWorker;
+ this.dpnTEPsInfoCache = dpnTEPsInfoCache;
LOG.trace("ItmTepAddWorker initialized with DpnList {}",cfgdDpnList);
LOG.trace("ItmTepAddWorker initialized with hwvteplist {}",hwVtepList);
}
@Override
public List<ListenableFuture<Void>> call() {
List<ListenableFuture<Void>> futures = new ArrayList<>() ;
- this.meshedDpnList = ItmUtils.getTunnelMeshInfo(dataBroker) ;
+ this.meshedDpnList = dpnTEPsInfoCache.getAllPresent();
LOG.debug("Invoking Internal Tunnel build method with Configured DpnList {} ; Meshed DpnList {} ",
cfgdDpnList, meshedDpnList);
futures.addAll(itmInternalTunnelAddWorker.buildAllTunnels(mdsalManager, cfgdDpnList,
List<DcGatewayIp> dcGatewayIpList = ItmUtils.getDcGatewayIpList(dataBroker);
if (dcGatewayIpList != null && !dcGatewayIpList.isEmpty()) {
for (DcGatewayIp dcGatewayIp : dcGatewayIpList) {
- futures.addAll(ItmExternalTunnelAddWorker.buildTunnelsToExternalEndPoint(dataBroker,
- cfgdDpnList, dcGatewayIp.getIpAddress(), dcGatewayIp.getTunnnelType(), itmConfig));
+ futures.addAll(externalTunnelAddWorker.buildTunnelsToExternalEndPoint(cfgdDpnList,
+ dcGatewayIp.getIpAddress(), dcGatewayIp.getTunnnelType()));
}
}
//futures.addAll(ItmExternalTunnelAddWorker.buildTunnelsToExternalEndPoint(dataBroker,meshedDpnList, extIp) ;
LOG.debug("invoking build hwVtepTunnels with hwVteplist {}", cfgdHwVteps);
- futures.addAll(ItmExternalTunnelAddWorker.buildHwVtepsTunnels(dataBroker,
- cfgdDpnList,cfgdHwVteps));
+ futures.addAll(externalTunnelAddWorker.buildHwVtepsTunnels(cfgdDpnList,cfgdHwVteps));
return futures ;
}
import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.concurrent.Callable;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.genius.itm.cache.DPNTEPsInfoCache;
import org.opendaylight.genius.itm.impl.ItmUtils;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo;
private final DataBroker dataBroker;
private final List<DPNTEPsInfo> delDpnList ;
- private List<DPNTEPsInfo> meshedDpnList ;
+ private Collection<DPNTEPsInfo> meshedDpnList ;
private final IMdsalApiManager mdsalManager;
private final List<HwVtep> cfgdHwVteps;
private final TransportZone originalTZone;
private final ItmInternalTunnelDeleteWorker itmInternalTunnelDeleteWorker;
+ private final DPNTEPsInfoCache dpnTEPsInfoCache;
public ItmTepRemoveWorker(List<DPNTEPsInfo> delDpnList, List<HwVtep> delHwList, TransportZone originalTZone,
- DataBroker broker, IMdsalApiManager mdsalManager,
- ItmInternalTunnelDeleteWorker itmInternalTunnelDeleteWorker) {
+ DataBroker broker, IMdsalApiManager mdsalManager,
+ ItmInternalTunnelDeleteWorker itmInternalTunnelDeleteWorker, DPNTEPsInfoCache dpnTEPsInfoCache) {
this.delDpnList = delDpnList;
this.dataBroker = broker;
this.mdsalManager = mdsalManager;
this.cfgdHwVteps = delHwList;
this.originalTZone = originalTZone;
this.itmInternalTunnelDeleteWorker = itmInternalTunnelDeleteWorker;
+ this.dpnTEPsInfoCache = dpnTEPsInfoCache;
LOG.trace("ItmTepRemoveWorker initialized with DpnList {}", delDpnList);
LOG.trace("ItmTepRemoveWorker initialized with cfgdHwTeps {}", delHwList);
}
@Override
public List<ListenableFuture<Void>> call() {
List<ListenableFuture<Void>> futures = new ArrayList<>() ;
- this.meshedDpnList = ItmUtils.getTunnelMeshInfo(dataBroker) ;
+ this.meshedDpnList = dpnTEPsInfoCache.getAllPresent();
futures.addAll(itmInternalTunnelDeleteWorker.deleteTunnels(mdsalManager, delDpnList,
meshedDpnList));
LOG.debug("Invoking Internal Tunnel delete method with DpnList to be deleted {} ; Meshed DpnList {} ",
+++ /dev/null
-/*
- * Copyright (c) 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.itm.confighelpers;
-
-import com.google.common.util.concurrent.ListenableFuture;
-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.itm.impl.ITMBatchingUtils;
-import org.opendaylight.genius.itm.impl.ItmUtils;
-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.opendaylight.genius.itm.op.rev160406.TunnelOperStatus;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelListBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelListKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class ItmTunnelStateUpdateHelper {
- private static final Logger LOG = LoggerFactory.getLogger(ItmTunnelStateUpdateHelper.class);
-
- private ItmTunnelStateUpdateHelper() { }
-
- public static List<ListenableFuture<Void>> updateTunnel(Interface updated, DataBroker broker) throws Exception {
- LOG.debug("Invoking ItmTunnelStateUpdateHelper for Interface {} ", updated);
- final WriteTransaction writeTransaction = broker.newWriteOnlyTransaction();
-
- StateTunnelListKey tlKey = ItmUtils.getTunnelStateKey(updated);
- LOG.trace("TunnelStateKey: {} for interface: {}", tlKey, updated.getName());
- InstanceIdentifier<StateTunnelList> stListId = ItmUtils.buildStateTunnelListId(tlKey);
- StateTunnelList tunnelsState = ItmUtils.getTunnelState(broker, updated.getName(), stListId);
- StateTunnelListBuilder stlBuilder;
- TunnelOperStatus tunnelOperStatus;
- boolean tunnelState = updated.getOperStatus().equals(Interface.OperStatus.Up);
- switch (updated.getOperStatus()) {
- case Up:
- tunnelOperStatus = TunnelOperStatus.Up;
- break;
- case Down:
- tunnelOperStatus = TunnelOperStatus.Down;
- break;
- case Unknown:
- tunnelOperStatus = TunnelOperStatus.Unknown;
- break;
- default:
- tunnelOperStatus = TunnelOperStatus.Ignore;
- }
- if (tunnelsState != null) {
- stlBuilder = new StateTunnelListBuilder(tunnelsState);
- stlBuilder.setTunnelState(tunnelState);
- stlBuilder.setOperState(tunnelOperStatus);
- StateTunnelList stList = stlBuilder.build();
- LOG.trace("Batching the updation of tunnel_state: {} for Id: {}", stList, stListId);
- ITMBatchingUtils.update(stListId, stList, ITMBatchingUtils.EntityType.DEFAULT_OPERATIONAL);
- }
-
- return Collections.singletonList(writeTransaction.submit());
- }
-}
+++ /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.itm.impl;
-
-import com.google.common.base.Optional;
-import java.util.List;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-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.itm.globals.ITMConstants;
-import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelMonitoringTypeBase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelMonitoringTypeBfd;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorInterval;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorIntervalBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorParams;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorParamsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@Singleton
-public class ITMManager implements AutoCloseable {
- private static final Logger LOG = LoggerFactory.getLogger(ITMManager.class);
-
- private final DataBroker broker;
- private final IMdsalApiManager mdsalManager;
-
- List<DPNTEPsInfo> meshedDpnList;
-
- @Inject
- public ITMManager(final DataBroker dataBroker,final IMdsalApiManager mdsalManager) {
- this.broker = dataBroker;
- this.mdsalManager = mdsalManager;
- }
-
- @PostConstruct
- public void start() {
- LOG.info("ITMManager Started");
- }
-
- @Override
- @PreDestroy
- public void close() {
- LOG.info("ITMManager Closed");
- }
-
- @SuppressWarnings("checkstyle:IllegalCatch")
- protected void initTunnelMonitorDataInConfigDS() {
- new Thread() {
- public void run() {
- boolean readSucceeded = false;
- InstanceIdentifier<TunnelMonitorParams> monitorPath =
- InstanceIdentifier.builder(TunnelMonitorParams.class).build();
- while (!readSucceeded) {
- try {
- Optional<TunnelMonitorParams> storedTunnelMonitor =
- ItmUtils.read(LogicalDatastoreType.CONFIGURATION, monitorPath, broker);
- // Store default values only when tunnel monitor data is not initialized
- if (!storedTunnelMonitor.isPresent()) {
- TunnelMonitorParams monitorEnabled = new TunnelMonitorParamsBuilder()
- .setEnabled(ITMConstants.DEFAULT_MONITOR_ENABLED).build();
- ItmUtils.asyncUpdate(LogicalDatastoreType.CONFIGURATION, monitorPath, monitorEnabled,
- broker, ItmUtils.DEFAULT_CALLBACK);
-
- InstanceIdentifier<TunnelMonitorInterval> intervalPath =
- InstanceIdentifier.builder(TunnelMonitorInterval.class).build();
- TunnelMonitorInterval monitorInteval = new TunnelMonitorIntervalBuilder()
- .setInterval(ITMConstants.DEFAULT_MONITOR_INTERVAL).build();
- ItmUtils.asyncUpdate(LogicalDatastoreType.CONFIGURATION, intervalPath, monitorInteval,
- broker, ItmUtils.DEFAULT_CALLBACK);
- }
- readSucceeded = true;
- } catch (Exception e) {
- LOG.warn("Unable to read monitor enabled info; retrying after some delay");
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ie) {
- return;
- }
- }
- }
- }
- }.start();
- }
-
- protected boolean getTunnelMonitorEnabledFromConfigDS() {
- InstanceIdentifier<TunnelMonitorParams> path = InstanceIdentifier.builder(TunnelMonitorParams.class).build();
- return ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, broker)
- .toJavaUtil().map(TunnelMonitorParams::isEnabled).orElse(true);
- }
-
- protected Class<? extends TunnelMonitoringTypeBase> getTunnelMonitorTypeFromConfigDS() {
-
- Class<? extends TunnelMonitoringTypeBase> tunnelMonitorType = TunnelMonitoringTypeBfd.class;
- InstanceIdentifier<TunnelMonitorParams> path = InstanceIdentifier.builder(TunnelMonitorParams.class).build();
- Optional<TunnelMonitorParams> storedTunnelMonitor =
- ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, broker);
- if (storedTunnelMonitor.isPresent() && storedTunnelMonitor.get().getMonitorProtocol() != null) {
- tunnelMonitorType = storedTunnelMonitor.get().getMonitorProtocol();
- }
- return tunnelMonitorType;
- }
-
- protected int getTunnelMonitorIntervalFromConfigDS() {
- InstanceIdentifier<TunnelMonitorInterval> path =
- InstanceIdentifier.builder(TunnelMonitorInterval.class).build();
- return ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, broker).toJavaUtil().map(
- TunnelMonitorInterval::getInterval).orElse(ITMConstants.DEFAULT_MONITOR_INTERVAL);
- }
-}
import com.google.common.base.Preconditions;
import java.math.BigInteger;
+import java.util.Collection;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import org.opendaylight.genius.itm.listeners.TunnelMonitorChangeListener;
import org.opendaylight.genius.itm.listeners.TunnelMonitorIntervalListener;
import org.opendaylight.genius.itm.listeners.VtepConfigSchemaListener;
-import org.opendaylight.genius.itm.listeners.cache.DpnTepsInfoListener;
-import org.opendaylight.genius.itm.listeners.cache.ItmMonitoringIntervalListener;
-import org.opendaylight.genius.itm.listeners.cache.ItmMonitoringListener;
-import org.opendaylight.genius.itm.listeners.cache.StateTunnelListListener;
import org.opendaylight.genius.itm.monitoring.ItmTunnelEventListener;
import org.opendaylight.genius.itm.rpc.ItmManagerRpcService;
import org.opendaylight.genius.mdsalutil.MDSALUtil;
private static final Logger LOG = LoggerFactory.getLogger(ItmProvider.class);
- private final ITMManager itmManager;
private final DataBroker dataBroker;
private final ItmManagerRpcService itmRpcService ;
private final IdManagerService idManager;
private final InterfaceStateListener ifStateListener;
private RpcProviderRegistry rpcProviderRegistry;
private final ItmTunnelEventListener itmStateListener;
- private final ItmMonitoringListener itmMonitoringListener;
- private final ItmMonitoringIntervalListener itmMonitoringIntervalListener;
private final OvsdbNodeListener ovsdbChangeListener;
static short flag = 0;
- private final StateTunnelListListener tunnelStateListener ;
- private final DpnTepsInfoListener dpnTepsInfoListener ;
+ private final TunnelMonitoringConfig tunnelMonitoringConfig;
@Inject
public ItmProvider(DataBroker dataBroker,
- DpnTepsInfoListener dpnTepsInfoListener,
IdManagerService idManagerService,
InterfaceStateListener interfaceStateListener,
- ITMManager itmManager,
ItmManagerRpcService itmManagerRpcService,
- ItmMonitoringListener itmMonitoringListener,
- ItmMonitoringIntervalListener itmMonitoringIntervalListener,
ItmTunnelEventListener itmTunnelEventListener,
- StateTunnelListListener stateTunnelListListener,
TepCommandHelper tepCommandHelper,
TunnelMonitorChangeListener tunnelMonitorChangeListener,
TunnelMonitorIntervalListener tunnelMonitorIntervalListener,
TransportZoneListener transportZoneListener,
VtepConfigSchemaListener vtepConfigSchemaListener,
- OvsdbNodeListener ovsdbNodeListener) {
+ OvsdbNodeListener ovsdbNodeListener,
+ TunnelMonitoringConfig tunnelMonitoringConfig) {
LOG.info("ItmProvider Before register MBean");
this.dataBroker = dataBroker;
- this.dpnTepsInfoListener = dpnTepsInfoListener;
this.idManager = idManagerService;
this.ifStateListener = interfaceStateListener;
- this.itmManager = itmManager;
this.itmRpcService = itmManagerRpcService;
- this.itmMonitoringListener = itmMonitoringListener;
- this.itmMonitoringIntervalListener = itmMonitoringIntervalListener;
this.itmStateListener = itmTunnelEventListener;
- this.tunnelStateListener = stateTunnelListListener;
this.tepCommandHelper = tepCommandHelper;
this.tnlToggleListener = tunnelMonitorChangeListener;
this.tnlIntervalListener = tunnelMonitorIntervalListener;
this.tzChangeListener = transportZoneListener;
this.vtepConfigSchemaListener = vtepConfigSchemaListener;
this.ovsdbChangeListener = ovsdbNodeListener;
+ this.tunnelMonitoringConfig = tunnelMonitoringConfig;
ITMBatchingUtils.registerWithBatchManager(this.dataBroker);
}
@Override
@PreDestroy
public void close() {
- if (itmManager != null) {
- itmManager.close();
- }
if (tzChangeListener != null) {
tzChangeListener.close();
}
if (tnlToggleListener != null) {
tnlToggleListener.close();
}
- if (tunnelStateListener != null) {
- tunnelStateListener.close();
- }
- if (dpnTepsInfoListener != null) {
- dpnTepsInfoListener.close();
- }
if (ovsdbChangeListener != null) {
ovsdbChangeListener.close();
}
@Override
public void showTeps(CommandSession session) {
try {
- tepCommandHelper.showTeps(itmManager.getTunnelMonitorEnabledFromConfigDS(),
- ItmUtils.determineMonitorInterval(this.dataBroker), session);
+ tepCommandHelper.showTeps(tunnelMonitoringConfig.isTunnelMonitoringEnabled(),
+ tunnelMonitoringConfig.getMonitorInterval(), session);
} catch (TepException e) {
LOG.error(e.getMessage());
}
}
@Override
- public void showState(List<StateTunnelList> tunnels,CommandSession session) {
+ public void showState(Collection<StateTunnelList> tunnels,CommandSession session) {
if (tunnels != null) {
try {
- tepCommandHelper.showState(tunnels, itmManager.getTunnelMonitorEnabledFromConfigDS(), session);
+ tepCommandHelper.showState(tunnels, tunnelMonitoringConfig.isTunnelMonitoringEnabled(), session);
} catch (TepException e) {
LOG.error(e.getMessage());
}
import org.opendaylight.genius.interfacemanager.globals.IfmConstants;
import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.itm.api.IITMProvider;
+import org.opendaylight.genius.itm.cache.DPNTEPsInfoCache;
import org.opendaylight.genius.itm.confighelpers.HwVtep;
import org.opendaylight.genius.itm.confighelpers.ItmTunnelAggregationHelper;
import org.opendaylight.genius.itm.globals.ITMConstants;
import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
import org.opendaylight.genius.mdsalutil.matches.MatchTunnelId;
-import org.opendaylight.genius.utils.cache.DataStoreCache;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelMonitoringTypeBase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelMonitoringTypeBfd;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeBase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeGre;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeLogicalGroup;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.tunnel.optional.params.TunnelOptionsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.tunnel.optional.params.TunnelOptionsKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfig;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorInterval;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorIntervalBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorParams;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorParamsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.VtepConfigSchemas;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.VtepIpPools;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.vtep.config.schemas.VtepConfigSchema;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
.setTransportType(tunType).build();
}
- public static List<DPNTEPsInfo> getTunnelMeshInfo(DataBroker dataBroker) {
- // Read the Mesh Information from Cache if not read from the DS
- List<DPNTEPsInfo> dpnTEPs = getTunnelMeshInfo() ;
- if (dpnTEPs != null) {
- return dpnTEPs;
- }
-
- // Read the EndPoint Info from the operational database
- InstanceIdentifierBuilder<DpnEndpoints> depBuilder = InstanceIdentifier.builder(DpnEndpoints.class);
- InstanceIdentifier<DpnEndpoints> deps = depBuilder.build();
- Optional<DpnEndpoints> dpnEps = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, deps, dataBroker);
- if (dpnEps.isPresent()) {
- DpnEndpoints tn = dpnEps.get();
- dpnTEPs = tn.getDPNTEPsInfo();
- LOG.debug("Read from CONFIGURATION datastore - No. of Dpns " , dpnTEPs.size());
- } else {
- LOG.debug("No Dpn information in CONFIGURATION datastore ");
- }
- return dpnTEPs;
- }
-
- // Reading the Mesh Information from Cache
- private static List<DPNTEPsInfo> getTunnelMeshInfo() {
- List<DPNTEPsInfo> dpnTepsInfo = null;
- List<Object> values = DataStoreCache.getValues(ITMConstants.DPN_TEPs_Info_CACHE_NAME);
- if (values != null) {
- dpnTepsInfo = new ArrayList<>() ;
- for (Object value : values) {
- dpnTepsInfo.add((DPNTEPsInfo)value) ;
- }
- }
- return dpnTepsInfo;
- }
-
private static String getUniqueIdString(String idKey) {
return UUID.nameUUIDFromBytes(idKey.getBytes()).toString().substring(0, 12).replace("-", "");
}
- public static List<DPNTEPsInfo> getDpnTepListFromDpnId(DataBroker dataBroker, List<BigInteger> dpnIds) {
- List<DPNTEPsInfo> meshedDpnList = getTunnelMeshInfo(dataBroker) ;
+ public static List<DPNTEPsInfo> getDpnTepListFromDpnId(DPNTEPsInfoCache dpnTEPsInfoCache, List<BigInteger> dpnIds) {
+ Collection<DPNTEPsInfo> meshedDpnList = dpnTEPsInfoCache.getAllPresent();
List<DPNTEPsInfo> cfgDpnList = new ArrayList<>();
- if (null != meshedDpnList) {
- for (BigInteger dpnId : dpnIds) {
- for (DPNTEPsInfo teps : meshedDpnList) {
- if (dpnId.equals(teps.getDPNID())) {
- cfgDpnList.add(teps);
- }
+ for (BigInteger dpnId : dpnIds) {
+ for (DPNTEPsInfo teps : meshedDpnList) {
+ if (dpnId.equals(teps.getDPNID())) {
+ cfgDpnList.add(teps);
}
}
}
+
return cfgDpnList;
}
interfaceName)).build();
}
- public static Boolean readMonitoringStateFromCache(DataBroker dataBroker) {
- InstanceIdentifier<TunnelMonitorParams> iid = InstanceIdentifier.create(TunnelMonitorParams.class);
- TunnelMonitorParams tunnelMonitorParams = (TunnelMonitorParams) DataStoreCache
- .get(ITMConstants.ITM_MONIRORING_PARAMS_CACHE_NAME,iid,"MonitorParams",dataBroker,true);
- if (tunnelMonitorParams != null) {
- return tunnelMonitorParams.isEnabled();
- } else {
- return ITMConstants.DEFAULT_MONITOR_ENABLED;
- }
- }
-
- private static Integer readMonitorIntervalfromCache(DataBroker dataBroker) {
- InstanceIdentifier<TunnelMonitorInterval> iid = InstanceIdentifier.create(TunnelMonitorInterval.class);
- TunnelMonitorInterval tunnelMonitorIOptional = (TunnelMonitorInterval)DataStoreCache
- .get(ITMConstants.ITM_MONIRORING_PARAMS_CACHE_NAME,iid,"Interval",dataBroker,true);
- if (tunnelMonitorIOptional != null) {
- return tunnelMonitorIOptional.getInterval();
- }
- return null;
- }
-
- public static Integer determineMonitorInterval(DataBroker dataBroker) {
- Integer monitorInterval = ItmUtils.readMonitorIntervalfromCache(dataBroker);
- LOG.debug("determineMonitorInterval: monitorInterval from DS = {}", monitorInterval);
- if (monitorInterval == null) {
- Class<? extends TunnelMonitoringTypeBase> monitorProtocol = determineMonitorProtocol(dataBroker);
- if (monitorProtocol.isAssignableFrom(TunnelMonitoringTypeBfd.class)) {
- monitorInterval = ITMConstants.BFD_DEFAULT_MONITOR_INTERVAL;
- } else {
- monitorInterval = ITMConstants.DEFAULT_MONITOR_INTERVAL;
- }
- }
- LOG.debug("determineMonitorInterval: monitorInterval = {}", monitorInterval);
- InstanceIdentifier<TunnelMonitorInterval> iid = InstanceIdentifier.builder(TunnelMonitorInterval.class).build();
- TunnelMonitorInterval intervalBuilder = new TunnelMonitorIntervalBuilder().setInterval(monitorInterval).build();
- ItmUtils.asyncUpdate(LogicalDatastoreType.OPERATIONAL,iid, intervalBuilder, dataBroker,
- ItmUtils.DEFAULT_CALLBACK);
- return monitorInterval;
- }
-
public static List<String> getInternalTunnelInterfaces(DataBroker dataBroker) {
List<String> tunnelList = new ArrayList<>();
Collection<String> internalInterfaces = ITM_CACHE.getAllInternalInterfaces();
return new ExternalTunnelKey(dst, src, tunType);
}
- public static List<TunnelEndPoints> getTEPsForDpn(BigInteger srcDpn, List<DPNTEPsInfo> dpnList) {
+ public static List<TunnelEndPoints> getTEPsForDpn(BigInteger srcDpn, Collection<DPNTEPsInfo> dpnList) {
for (DPNTEPsInfo dpn : dpnList) {
if (dpn.getDPNID().equals(srcDpn)) {
return dpn.getTunnelEndPoints() ;
return result;
}
- public static StateTunnelList getTunnelState(DataBroker dataBroker, String ifaceName,
- InstanceIdentifier<StateTunnelList> stListId) {
- StateTunnelList tunnelState = (StateTunnelList)DataStoreCache
- .get(ITMConstants.TUNNEL_STATE_CACHE_NAME, ifaceName);
- if (tunnelState == null) {
- Optional<StateTunnelList> tunnelsState = ItmUtils
- .read(LogicalDatastoreType.OPERATIONAL, stListId, dataBroker);
- if (tunnelsState.isPresent()) {
- return tunnelState;
- }
- }
- return tunnelState;
- }
-
- private static Class<? extends TunnelMonitoringTypeBase> readMonitoringProtocolFromCache(DataBroker dataBroker) {
- InstanceIdentifier<TunnelMonitorParams> iid = InstanceIdentifier.create(TunnelMonitorParams.class);
- TunnelMonitorParams tunnelMonitorParams = (TunnelMonitorParams) DataStoreCache
- .get(ITMConstants.ITM_MONIRORING_PARAMS_CACHE_NAME,iid,"MonitorParams",dataBroker,true);
- if (tunnelMonitorParams != null) {
- return tunnelMonitorParams.getMonitorProtocol();
- }
- return null;
- }
-
- public static Class<? extends TunnelMonitoringTypeBase> determineMonitorProtocol(DataBroker dataBroker) {
- Class<? extends TunnelMonitoringTypeBase> monitoringProtocol =
- ItmUtils.readMonitoringProtocolFromCache(dataBroker);
- LOG.debug("determineMonitorProtocol: monitorProtocol from DS = {}", monitoringProtocol);
- if (monitoringProtocol == null) {
- monitoringProtocol = ITMConstants.DEFAULT_MONITOR_PROTOCOL;
- }
- LOG.debug("determineMonitorProtocol: monitorProtocol = {}", monitoringProtocol);
- Boolean monitorState = ItmUtils.readMonitoringStateFromCache(dataBroker);
- if (monitorState == null) {
- monitorState = true;
- }
- LOG.debug("determineMonitorProtocol: monitorState = {}", monitorState);
- InstanceIdentifier<TunnelMonitorParams> iid = InstanceIdentifier.builder(TunnelMonitorParams.class).build();
- TunnelMonitorParams protocolBuilder = new TunnelMonitorParamsBuilder().setEnabled(monitorState)
- .setMonitorProtocol(monitoringProtocol).build();
- ItmUtils.asyncUpdate(LogicalDatastoreType.OPERATIONAL,iid, protocolBuilder, dataBroker,
- ItmUtils.DEFAULT_CALLBACK);
- return monitoringProtocol;
- }
-
public static List<DcGatewayIp> getDcGatewayIpList(DataBroker broker) {
InstanceIdentifier<DcGatewayIpList> dcGatewayIpListid =
InstanceIdentifier.builder(DcGatewayIpList.class).build();
}
public static List<TzMembership> getOriginalTzMembership(TunnelEndPoints srcTep, BigInteger dpnId,
- List<DPNTEPsInfo> meshedDpnList) {
+ Collection<DPNTEPsInfo> meshedDpnList) {
LOG.trace("Original Membership for source DPN {}, source TEP {}", dpnId, srcTep);
for (DPNTEPsInfo dstDpn : meshedDpnList) {
if (dpnId.equals(dstDpn.getDPNID())) {
--- /dev/null
+/*
+ * Copyright (c) 2017 Inocybe Technologies 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.itm.impl;
+
+import com.google.common.base.Optional;
+import javax.annotation.PreDestroy;
+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.controller.md.sal.common.api.data.ReadFailedException;
+import org.opendaylight.genius.itm.globals.ITMConstants;
+import org.opendaylight.genius.mdsalutil.cache.DataObjectCache;
+import org.opendaylight.infrautils.caches.CacheProvider;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelMonitoringTypeBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorInterval;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorParams;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Maintains configuration for tunnel monitoring parameters.
+ *
+ * @author Thomas Pantelis
+ */
+@Singleton
+public class TunnelMonitoringConfig implements AutoCloseable {
+ private static final Logger LOG = LoggerFactory.getLogger(ItmProvider.class);
+
+ private static final InstanceIdentifier<TunnelMonitorParams> TUNNEL_MONITOR_PARAMS_PATH =
+ InstanceIdentifier.create(TunnelMonitorParams.class);
+
+ private static final InstanceIdentifier<TunnelMonitorInterval> TUNNEL_MONITOR_INTERVAL_PATH =
+ InstanceIdentifier.create(TunnelMonitorInterval.class);
+
+ private final DataObjectCache<TunnelMonitorInterval> tunnelMonitorIntervalCache;
+ private final DataObjectCache<TunnelMonitorParams> tunnelMonitorParamsCache;
+
+ @Inject
+ public TunnelMonitoringConfig(DataBroker dataBroker, CacheProvider cacheProvider) {
+ tunnelMonitorIntervalCache = new DataObjectCache<>(TunnelMonitorInterval.class, dataBroker,
+ LogicalDatastoreType.CONFIGURATION, TUNNEL_MONITOR_INTERVAL_PATH, cacheProvider);
+ tunnelMonitorParamsCache = new DataObjectCache<>(TunnelMonitorParams.class, dataBroker,
+ LogicalDatastoreType.CONFIGURATION, TUNNEL_MONITOR_PARAMS_PATH, cacheProvider);
+ }
+
+ public boolean isTunnelMonitoringEnabled() {
+ try {
+ Optional<TunnelMonitorParams> maybeTunnelParams = tunnelMonitorParamsCache.get(TUNNEL_MONITOR_PARAMS_PATH);
+ return maybeTunnelParams.isPresent() ? maybeTunnelParams.get().isEnabled()
+ : ITMConstants.DEFAULT_MONITOR_ENABLED;
+ } catch (ReadFailedException e) {
+ LOG.warn("Read of {} failed", TUNNEL_MONITOR_PARAMS_PATH, e);
+ return ITMConstants.DEFAULT_MONITOR_ENABLED;
+ }
+ }
+
+ public Class<? extends TunnelMonitoringTypeBase> getMonitorProtocol() {
+ try {
+ Optional<TunnelMonitorParams> maybeTunnelParams = tunnelMonitorParamsCache.get(TUNNEL_MONITOR_PARAMS_PATH);
+ return maybeTunnelParams.isPresent() ? maybeTunnelParams.get().getMonitorProtocol()
+ : ITMConstants.DEFAULT_MONITOR_PROTOCOL;
+ } catch (ReadFailedException e) {
+ LOG.warn("Read of {} failed", TUNNEL_MONITOR_PARAMS_PATH, e);
+ return ITMConstants.DEFAULT_MONITOR_PROTOCOL;
+ }
+ }
+
+ public int getMonitorInterval() {
+ try {
+ Optional<TunnelMonitorInterval> maybeTunnelInterval =
+ tunnelMonitorIntervalCache.get(TUNNEL_MONITOR_INTERVAL_PATH);
+ return maybeTunnelInterval.isPresent() ? maybeTunnelInterval.get().getInterval()
+ : ITMConstants.DEFAULT_MONITOR_INTERVAL;
+ } catch (ReadFailedException e) {
+ LOG.warn("Read of {} failed", TUNNEL_MONITOR_INTERVAL_PATH, e);
+ return ITMConstants.DEFAULT_MONITOR_INTERVAL;
+ }
+ }
+
+ @Override
+ @PreDestroy
+ public void close() {
+ tunnelMonitorIntervalCache.close();
+ tunnelMonitorParamsCache.close();
+ }
+}
package org.opendaylight.genius.itm.listeners;
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.ListenableFuture;
+import java.util.Collections;
+import java.util.List;
import java.util.Objects;
import javax.annotation.Nonnull;
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.datastoreutils.listeners.AbstractSyncDataTreeChangeListener;
import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
+import org.opendaylight.genius.itm.cache.TunnelStateCache;
import org.opendaylight.genius.itm.confighelpers.ItmTunnelAggregationHelper;
import org.opendaylight.genius.itm.confighelpers.ItmTunnelStateAddHelper;
import org.opendaylight.genius.itm.confighelpers.ItmTunnelStateRemoveHelper;
-import org.opendaylight.genius.itm.confighelpers.ItmTunnelStateUpdateHelper;
import org.opendaylight.genius.itm.globals.ITMConstants;
+import org.opendaylight.genius.itm.impl.ITMBatchingUtils;
import org.opendaylight.genius.itm.impl.ItmUtils;
import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
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.interfaces.rev140508.interfaces.state.Interface.OperStatus;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.TunnelOperStatus;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelListBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelListKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private final JobCoordinator jobCoordinator;
private final IInterfaceManager interfaceManager;
private final ItmTunnelAggregationHelper tunnelAggregationHelper;
+ private final TunnelStateCache tunnelStateCache;
@Inject
public InterfaceStateListener(final DataBroker dataBroker, IInterfaceManager iinterfacemanager,
- final ItmTunnelAggregationHelper tunnelAggregation, JobCoordinator jobCoordinator) {
+ final ItmTunnelAggregationHelper tunnelAggregation, JobCoordinator jobCoordinator,
+ TunnelStateCache tunnelStateCache) {
super(dataBroker, LogicalDatastoreType.OPERATIONAL,
InstanceIdentifier.create(InterfacesState.class).child(Interface.class));
this.dataBroker = dataBroker;
this.jobCoordinator = jobCoordinator;
this.interfaceManager = iinterfacemanager;
this.tunnelAggregationHelper = tunnelAggregation;
+ this.tunnelStateCache = tunnelStateCache;
}
@Override
if (!Objects.equals(originalInterface.getOperStatus(), updatedInterface.getOperStatus())) {
LOG.debug("Tunnel Interface {} changed state to {}", originalInterface.getName(), operStatus);
jobCoordinator.enqueueJob(ITMConstants.ITM_PREFIX + originalInterface.getName(),
- () -> ItmTunnelStateUpdateHelper.updateTunnel(updatedInterface, dataBroker));
+ () -> updateTunnel(updatedInterface));
}
if (tunnelAggregationHelper.isTunnelAggregationEnabled()) {
tunnelAggregationHelper.updateLogicalTunnelState(originalInterface, updatedInterface,
}
}
}
+
+ private List<ListenableFuture<Void>> updateTunnel(Interface updated) throws Exception {
+ LOG.debug("Invoking ItmTunnelStateUpdateHelper for Interface {} ", updated);
+ final WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
+
+ StateTunnelListKey tlKey = ItmUtils.getTunnelStateKey(updated);
+ LOG.trace("TunnelStateKey: {} for interface: {}", tlKey, updated.getName());
+ InstanceIdentifier<StateTunnelList> stListId = ItmUtils.buildStateTunnelListId(tlKey);
+ Optional<StateTunnelList> tunnelsState = tunnelStateCache.get(stListId);
+ StateTunnelListBuilder stlBuilder;
+ TunnelOperStatus tunnelOperStatus;
+ boolean tunnelState = updated.getOperStatus().equals(Interface.OperStatus.Up);
+ switch (updated.getOperStatus()) {
+ case Up:
+ tunnelOperStatus = TunnelOperStatus.Up;
+ break;
+ case Down:
+ tunnelOperStatus = TunnelOperStatus.Down;
+ break;
+ case Unknown:
+ tunnelOperStatus = TunnelOperStatus.Unknown;
+ break;
+ default:
+ tunnelOperStatus = TunnelOperStatus.Ignore;
+ }
+ if (tunnelsState.isPresent()) {
+ stlBuilder = new StateTunnelListBuilder(tunnelsState.get());
+ stlBuilder.setTunnelState(tunnelState);
+ stlBuilder.setOperState(tunnelOperStatus);
+ StateTunnelList stList = stlBuilder.build();
+ LOG.trace("Batching the updation of tunnel_state: {} for Id: {}", stList, stListId);
+ ITMBatchingUtils.update(stListId, stList, ITMBatchingUtils.EntityType.DEFAULT_OPERATIONAL);
+ }
+
+ return Collections.singletonList(writeTransaction.submit());
+ }
}
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.genius.datastoreutils.listeners.AbstractSyncDataTreeChangeListener;
+import org.opendaylight.genius.itm.cache.DPNTEPsInfoCache;
import org.opendaylight.genius.itm.confighelpers.HwVtep;
+import org.opendaylight.genius.itm.confighelpers.ItmExternalTunnelAddWorker;
import org.opendaylight.genius.itm.confighelpers.ItmInternalTunnelAddWorker;
import org.opendaylight.genius.itm.confighelpers.ItmInternalTunnelDeleteWorker;
import org.opendaylight.genius.itm.confighelpers.ItmTepAddWorker;
import org.opendaylight.genius.itm.confighelpers.ItmTepsNotHostedRemoveWorker;
import org.opendaylight.genius.itm.globals.ITMConstants;
import org.opendaylight.genius.itm.impl.ItmUtils;
+import org.opendaylight.genius.itm.impl.TunnelMonitoringConfig;
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.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeBase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfig;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo;
private final ItmConfig itmConfig;
private final ItmInternalTunnelDeleteWorker itmInternalTunnelDeleteWorker;
private final ItmInternalTunnelAddWorker itmInternalTunnelAddWorker;
+ private final ItmExternalTunnelAddWorker externalTunnelAddWorker;
+ private final DPNTEPsInfoCache dpnTEPsInfoCache;
@Inject
- public TransportZoneListener(final DataBroker dataBroker, final IdManagerService idManagerService,
+ public TransportZoneListener(final DataBroker dataBroker,
final IMdsalApiManager mdsalManager,
- final ItmConfig itmConfig, JobCoordinator jobCoordinator) {
+ final ItmConfig itmConfig, final JobCoordinator jobCoordinator,
+ final TunnelMonitoringConfig tunnelMonitoringConfig,
+ final DPNTEPsInfoCache dpnTEPsInfoCache) {
super(dataBroker, LogicalDatastoreType.CONFIGURATION,
InstanceIdentifier.create(TransportZones.class).child(TransportZone.class));
this.dataBroker = dataBroker;
initializeTZNode(dataBroker);
this.mdsalManager = mdsalManager;
this.itmConfig = itmConfig;
- this.itmInternalTunnelDeleteWorker = new ItmInternalTunnelDeleteWorker(dataBroker, jobCoordinator);
- this.itmInternalTunnelAddWorker = new ItmInternalTunnelAddWorker(dataBroker, jobCoordinator);
+ this.dpnTEPsInfoCache = dpnTEPsInfoCache;
+ this.itmInternalTunnelDeleteWorker = new ItmInternalTunnelDeleteWorker(dataBroker, jobCoordinator,
+ tunnelMonitoringConfig);
+ this.itmInternalTunnelAddWorker = new ItmInternalTunnelAddWorker(dataBroker, jobCoordinator,
+ tunnelMonitoringConfig);
+ this.externalTunnelAddWorker = new ItmExternalTunnelAddWorker(dataBroker, itmConfig, dpnTEPsInfoCache);
}
@SuppressWarnings("checkstyle:IllegalCatch")
if (!opDpnList.isEmpty() || !hwVtepList.isEmpty()) {
LOG.trace("Delete: Invoking ItmManager with hwVtep List {} ", hwVtepList);
jobCoordinator.enqueueJob(transportZone.getZoneName(),
- new ItmTepRemoveWorker(opDpnList, hwVtepList, transportZone, dataBroker,
- mdsalManager,
- itmInternalTunnelDeleteWorker));
+ new ItmTepRemoveWorker(opDpnList, hwVtepList, transportZone, dataBroker, mdsalManager,
+ itmInternalTunnelDeleteWorker, dpnTEPsInfoCache));
}
}
}
if (!newDpnTepsList.isEmpty()) {
LOG.trace("Adding TEPs ");
jobCoordinator.enqueueJob(updatedTransportZone.getZoneName(),
- new ItmTepAddWorker(newDpnTepsList, Collections.emptyList(), dataBroker,
- mdsalManager, itmConfig,
- itmInternalTunnelAddWorker));
+ new ItmTepAddWorker(newDpnTepsList, Collections.emptyList(), dataBroker, mdsalManager, itmConfig,
+ itmInternalTunnelAddWorker, externalTunnelAddWorker, dpnTEPsInfoCache));
}
if (!oldDpnTepsList.isEmpty()) {
LOG.trace("Removing TEPs ");
jobCoordinator.enqueueJob(updatedTransportZone.getZoneName(),
- new ItmTepRemoveWorker(oldDpnTepsList,
- Collections.emptyList(),
- originalTransportZone, dataBroker,
- mdsalManager,
- itmInternalTunnelDeleteWorker));
+ new ItmTepRemoveWorker(oldDpnTepsList, Collections.emptyList(), originalTransportZone, dataBroker,
+ mdsalManager, itmInternalTunnelDeleteWorker, dpnTEPsInfoCache));
}
List<HwVtep> oldHwList = createhWVteps(originalTransportZone);
List<HwVtep> newHwList = createhWVteps(updatedTransportZone);
LOG.trace("newHwListcopy {}", newHwListcopy);
if (!newHwList.isEmpty()) {
LOG.trace("Adding HW TEPs ");
- jobCoordinator.enqueueJob(updatedTransportZone.getZoneName(),
- new ItmTepAddWorker(Collections.emptyList(), newHwList, dataBroker,
- mdsalManager, itmConfig,
- itmInternalTunnelAddWorker));
+ jobCoordinator.enqueueJob(updatedTransportZone.getZoneName(), new ItmTepAddWorker(Collections.emptyList(),
+ newHwList, dataBroker, mdsalManager, itmConfig, itmInternalTunnelAddWorker, externalTunnelAddWorker,
+ dpnTEPsInfoCache));
}
if (!oldHwList.isEmpty()) {
LOG.trace("Removing HW TEPs ");
- jobCoordinator.enqueueJob(updatedTransportZone.getZoneName(),
- new ItmTepRemoveWorker(Collections.emptyList(), oldHwList,
- originalTransportZone,
- dataBroker,
- mdsalManager,
- itmInternalTunnelDeleteWorker));
+ jobCoordinator.enqueueJob(updatedTransportZone.getZoneName(), new ItmTepRemoveWorker(
+ Collections.emptyList(), oldHwList, originalTransportZone, dataBroker, mdsalManager,
+ itmInternalTunnelDeleteWorker, dpnTEPsInfoCache));
}
}
LOG.trace("Add: Invoking ItmManager with DPN List {} ", opDpnList);
LOG.trace("Add: Invoking ItmManager with hwVtep List {} ", hwVtepList);
jobCoordinator.enqueueJob(transportZone.getZoneName(),
- new ItmTepAddWorker(opDpnList, hwVtepList, dataBroker,
- mdsalManager, itmConfig, itmInternalTunnelAddWorker));
+ new ItmTepAddWorker(opDpnList, hwVtepList, dataBroker, mdsalManager, itmConfig,
+ itmInternalTunnelAddWorker, externalTunnelAddWorker, dpnTEPsInfoCache));
}
}
+++ /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.itm.listeners.cache;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-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.datastoreutils.AsyncClusteredDataTreeChangeListenerBase;
-import org.opendaylight.genius.itm.globals.ITMConstants;
-import org.opendaylight.genius.utils.cache.DataStoreCache;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.DpnEndpoints;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/*
- * Created by Hema Gopalkrishnan on 18-08-2016.
- */
-@Singleton
-public class DpnTepsInfoListener extends AsyncClusteredDataTreeChangeListenerBase<DPNTEPsInfo,DpnTepsInfoListener>
- implements AutoCloseable {
- private static final Logger LOG = LoggerFactory.getLogger(DpnTepsInfoListener.class);
- private final DataBroker broker;
-
- /**
- * Responsible for listening to DPNTEPsInfo change.
- *
- */
- @Inject
- public DpnTepsInfoListener(final DataBroker dataBroker) {
- super(DPNTEPsInfo.class, DpnTepsInfoListener.class);
- DataStoreCache.create(ITMConstants.DPN_TEPs_Info_CACHE_NAME) ;
- this.broker = dataBroker;
- }
-
- @PostConstruct
- public void start() {
- registerListener(LogicalDatastoreType.CONFIGURATION, this.broker);
- LOG.info("dpnTepsInfo Listener Started");
- }
-
- @Override
- @PreDestroy
- public void close() {
- LOG.info("dpnTepsInfo Listener Closed");
- }
-
- @Override
- protected void remove(InstanceIdentifier<DPNTEPsInfo> identifier, DPNTEPsInfo del) {
- LOG.debug("Remove from cache {} Invoked for data Obj {}",
- ITMConstants.DPN_TEPs_Info_CACHE_NAME, del.getDPNID());
- DataStoreCache.remove(ITMConstants.DPN_TEPs_Info_CACHE_NAME, del.getDPNID()) ;
- }
-
- @Override
- protected void update(InstanceIdentifier<DPNTEPsInfo> identifier, DPNTEPsInfo original,
- DPNTEPsInfo update) {
- LOG.debug("Update to cache {} Invoked for data Obj {}",
- ITMConstants.DPN_TEPs_Info_CACHE_NAME, update.getDPNID());
- DataStoreCache.add(ITMConstants.DPN_TEPs_Info_CACHE_NAME, update.getDPNID(), update);
- }
-
- @Override
- protected void add(InstanceIdentifier<DPNTEPsInfo> identifier, DPNTEPsInfo add) {
- LOG.debug("Add to cache {} Invoked for data Obj {}", ITMConstants.DPN_TEPs_Info_CACHE_NAME, add.getDPNID());
- DataStoreCache.add(ITMConstants.DPN_TEPs_Info_CACHE_NAME, add.getDPNID(), add);
- }
-
- @Override
- protected DpnTepsInfoListener getDataTreeChangeListener() {
- return this;
- }
-
- @Override
- protected InstanceIdentifier<DPNTEPsInfo> getWildCardPath() {
- return InstanceIdentifier.builder(DpnEndpoints.class)
- .child(DPNTEPsInfo.class).build();
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2015, 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.itm.listeners.cache;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-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.datastoreutils.AsyncClusteredDataTreeChangeListenerBase;
-import org.opendaylight.genius.itm.globals.ITMConstants;
-import org.opendaylight.genius.utils.cache.DataStoreCache;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorInterval;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/*
- * Created by Dimple Jain on 8/4/2016.
- */
-@Singleton
-public class ItmMonitoringIntervalListener extends AsyncClusteredDataTreeChangeListenerBase<TunnelMonitorInterval,
- ItmMonitoringIntervalListener> {
-
- private static final Logger LOG = LoggerFactory.getLogger(ItmMonitoringIntervalListener.class);
-
- @SuppressWarnings("checkstyle:IllegalCatch")
- @Inject
- public ItmMonitoringIntervalListener(final DataBroker dataBroker) {
- super(TunnelMonitorInterval.class, ItmMonitoringIntervalListener.class);
- try {
- registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
- } catch (final Exception e) {
- LOG.error("ItmMonitoring Interval listener registration fail!", e);
- }
- }
-
- @PostConstruct
- public void start() {
- LOG.info("ItmMonitoringIntervalListener Started");
- }
-
- @PreDestroy
- public void close() {
- LOG.info("ItmMonitoringIntervalListener Closed");
- }
-
- @Override
- protected void remove(InstanceIdentifier<TunnelMonitorInterval> key, TunnelMonitorInterval dataObjectModification) {
- DataStoreCache.remove(ITMConstants.ITM_MONIRORING_PARAMS_CACHE_NAME, "Interval");
- }
-
- @Override
- protected void update(InstanceIdentifier<TunnelMonitorInterval> identifier, TunnelMonitorInterval original,
- TunnelMonitorInterval update) {
- DataStoreCache.add(ITMConstants.ITM_MONIRORING_PARAMS_CACHE_NAME, "Interval", update);
- }
-
- @Override
- protected void add(InstanceIdentifier<TunnelMonitorInterval> identifier, TunnelMonitorInterval add) {
- DataStoreCache.add(ITMConstants.ITM_MONIRORING_PARAMS_CACHE_NAME, "Interval", add);
- }
-
- @Override protected InstanceIdentifier<TunnelMonitorInterval> getWildCardPath() {
- return InstanceIdentifier.create(TunnelMonitorInterval.class);
- }
-
- @Override
- protected ItmMonitoringIntervalListener getDataTreeChangeListener() {
- return this;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2015, 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.itm.listeners.cache;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-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.datastoreutils.AsyncClusteredDataTreeChangeListenerBase;
-import org.opendaylight.genius.itm.globals.ITMConstants;
-import org.opendaylight.genius.utils.cache.DataStoreCache;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorParams;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/*
- * Created by Dimple Jain on 8/4/2016.
- */
-@Singleton
-public class ItmMonitoringListener extends AsyncClusteredDataTreeChangeListenerBase<TunnelMonitorParams,
- ItmMonitoringListener> {
- private static final Logger LOG = LoggerFactory.getLogger(ItmMonitoringListener.class);
-
- @SuppressWarnings("checkstyle:IllegalCatch")
- @Inject
- public ItmMonitoringListener(final DataBroker dataBroker) {
- super(TunnelMonitorParams.class, ItmMonitoringListener.class);
- DataStoreCache.create(ITMConstants.ITM_MONIRORING_PARAMS_CACHE_NAME);
-
- try {
- registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
- } catch (final Exception e) {
- LOG.error("ItmMonitoring DataChange listener registration fail!", e);
- }
- }
-
- @PostConstruct
- public void start() {
- LOG.info("ItmMonitoring Started");
- }
-
- @PreDestroy
- public void close() {
- LOG.info("ItmMonitoring Closed");
- }
-
- @Override
- protected void remove(InstanceIdentifier<TunnelMonitorParams> key, TunnelMonitorParams dataObjectModification) {
- DataStoreCache.remove(ITMConstants.ITM_MONIRORING_PARAMS_CACHE_NAME, "MonitorParams");
- }
-
- @Override
- protected void update(InstanceIdentifier<TunnelMonitorParams> identifier, TunnelMonitorParams original,
- TunnelMonitorParams update) {
- DataStoreCache.add(ITMConstants.ITM_MONIRORING_PARAMS_CACHE_NAME, "MonitorParams", update);
- }
-
- @Override
- protected void add(InstanceIdentifier<TunnelMonitorParams> identifier, TunnelMonitorParams add) {
- DataStoreCache.add(ITMConstants.ITM_MONIRORING_PARAMS_CACHE_NAME, "MonitorParams", add);
- }
-
- @Override protected InstanceIdentifier<TunnelMonitorParams> getWildCardPath() {
- return InstanceIdentifier.create(TunnelMonitorParams.class);
- }
-
- @Override
- protected ItmMonitoringListener getDataTreeChangeListener() {
- return this;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 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.itm.listeners.cache;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-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.datastoreutils.AsyncClusteredDataTreeChangeListenerBase;
-import org.opendaylight.genius.itm.globals.ITMConstants;
-import org.opendaylight.genius.utils.cache.DataStoreCache;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.TunnelsState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@Singleton
-public class StateTunnelListListener
- extends AsyncClusteredDataTreeChangeListenerBase<StateTunnelList,StateTunnelListListener>
- implements AutoCloseable {
- private static final Logger LOG = LoggerFactory.getLogger(StateTunnelListListener.class);
- private final DataBroker broker;
-
- /**
- * Responsible for listening to tunnel interface state change.
- *
- */
- @SuppressWarnings("checkstyle:IllegalCatch")
- @Inject
- public StateTunnelListListener(final DataBroker dataBroker) {
- super(StateTunnelList.class, StateTunnelListListener.class);
- DataStoreCache.create(ITMConstants.TUNNEL_STATE_CACHE_NAME);
- this.broker = dataBroker;
- try {
- registerListener(LogicalDatastoreType.OPERATIONAL, this.broker);
- } catch (final Exception e) {
- LOG.error("StateTunnelListListener DataChange listener registration fail!", e);
- }
- }
-
- @PostConstruct
- public void start() {
- LOG.info("Tunnel Interface State Listener Started");
- }
-
- @Override
- @PreDestroy
- public void close() {
- LOG.info("Tunnel Interface State Listener Closed");
- }
-
- @Override
- protected void remove(InstanceIdentifier<StateTunnelList> identifier, StateTunnelList del) {
- DataStoreCache.remove(ITMConstants.TUNNEL_STATE_CACHE_NAME, del.getTunnelInterfaceName());
- }
-
- @Override
- protected void update(InstanceIdentifier<StateTunnelList> identifier, StateTunnelList original,
- StateTunnelList update) {
- DataStoreCache.add(ITMConstants.TUNNEL_STATE_CACHE_NAME, update.getTunnelInterfaceName(), update);
- }
-
- @Override
- protected void add(InstanceIdentifier<StateTunnelList> identifier, StateTunnelList add) {
- DataStoreCache.add(ITMConstants.TUNNEL_STATE_CACHE_NAME, add.getTunnelInterfaceName(), add);
- }
-
- @Override
- protected StateTunnelListListener getDataTreeChangeListener() {
- return this;
- }
-
- @Override
- protected InstanceIdentifier<StateTunnelList> getWildCardPath() {
- return InstanceIdentifier.builder(TunnelsState.class)
- .child(StateTunnelList.class).build();
- }
-
-}
import com.google.common.util.concurrent.SettableFuture;
import java.math.BigInteger;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.concurrent.Future;
import javax.annotation.PostConstruct;
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.itm.cache.DPNTEPsInfoCache;
import org.opendaylight.genius.itm.confighelpers.ItmExternalTunnelAddWorker;
import org.opendaylight.genius.itm.confighelpers.ItmExternalTunnelDeleteWorker;
import org.opendaylight.genius.itm.globals.ITMConstants;
private static final Logger LOG = LoggerFactory.getLogger(ItmManagerRpcService.class);
private final DataBroker dataBroker;
private final IMdsalApiManager mdsalManager;
- private final ItmConfig itmConfig;
+ private final DPNTEPsInfoCache dpnTEPsInfoCache;
+ private final ItmExternalTunnelAddWorker externalTunnelAddWorker;
@Inject
- public ItmManagerRpcService(final DataBroker dataBroker,
- final IMdsalApiManager mdsalManager, final ItmConfig itmConfig) {
+ public ItmManagerRpcService(final DataBroker dataBroker, final IMdsalApiManager mdsalManager,
+ final ItmConfig itmConfig, final DPNTEPsInfoCache dpnTEPsInfoCache) {
this.dataBroker = dataBroker;
this.mdsalManager = mdsalManager;
- this.itmConfig = itmConfig;
+ this.dpnTEPsInfoCache = dpnTEPsInfoCache;
+ this.externalTunnelAddWorker = new ItmExternalTunnelAddWorker(dataBroker, itmConfig, dpnTEPsInfoCache);
}
@PostConstruct
RemoveExternalTunnelEndpointInput input) {
//Ignore the Futures for now
final SettableFuture<RpcResult<Void>> result = SettableFuture.create();
- List<DPNTEPsInfo> meshedDpnList = ItmUtils.getTunnelMeshInfo(dataBroker) ;
+ Collection<DPNTEPsInfo> meshedDpnList = dpnTEPsInfoCache.getAllPresent();
ItmExternalTunnelDeleteWorker.deleteTunnels(dataBroker, meshedDpnList,
input.getDestinationIp(), input.getTunnelType());
InstanceIdentifier<DcGatewayIp> extPath = InstanceIdentifier.builder(DcGatewayIpList.class)
RemoveExternalTunnelFromDpnsInput input) {
//Ignore the Futures for now
final SettableFuture<RpcResult<Void>> result = SettableFuture.create();
- List<DPNTEPsInfo> cfgDpnList = ItmUtils.getDpnTepListFromDpnId(dataBroker, input.getDpnId()) ;
+ List<DPNTEPsInfo> cfgDpnList = ItmUtils.getDpnTepListFromDpnId(dpnTEPsInfoCache, input.getDpnId()) ;
ItmExternalTunnelDeleteWorker.deleteTunnels(dataBroker, cfgDpnList,
input.getDestinationIp(), input.getTunnelType());
result.set(RpcResultBuilder.<Void>success().build());
BuildExternalTunnelFromDpnsInput input) {
//Ignore the Futures for now
final SettableFuture<RpcResult<Void>> result = SettableFuture.create();
- List<ListenableFuture<Void>> extTunnelResultList = ItmExternalTunnelAddWorker
- .buildTunnelsFromDpnToExternalEndPoint(dataBroker, input.getDpnId(),
- input.getDestinationIp(),input.getTunnelType(), itmConfig);
+ List<ListenableFuture<Void>> extTunnelResultList = externalTunnelAddWorker
+ .buildTunnelsFromDpnToExternalEndPoint(input.getDpnId(), input.getDestinationIp(),input.getTunnelType());
for (ListenableFuture<Void> extTunnelResult : extTunnelResultList) {
Futures.addCallback(extTunnelResult, new FutureCallback<Void>() {
//Ignore the Futures for now
final SettableFuture<RpcResult<Void>> result = SettableFuture.create();
- List<DPNTEPsInfo> meshedDpnList = ItmUtils.getTunnelMeshInfo(dataBroker) ;
- ItmExternalTunnelAddWorker.buildTunnelsToExternalEndPoint(dataBroker, meshedDpnList,
- input.getDestinationIp(), input.getTunnelType(), itmConfig);
+ Collection<DPNTEPsInfo> meshedDpnList = dpnTEPsInfoCache.getAllPresent();
+ externalTunnelAddWorker.buildTunnelsToExternalEndPoint(meshedDpnList,
+ input.getDestinationIp(), input.getTunnelType());
InstanceIdentifier<DcGatewayIp> extPath = InstanceIdentifier.builder(DcGatewayIpList.class)
.child(DcGatewayIp.class, new DcGatewayIpKey(input.getDestinationIp())).build();
DcGatewayIp dcGatewayIp =
resultBld = RpcResultBuilder.success();
resultBld.withResult(output.build()) ;
} else {
- List<DPNTEPsInfo> meshedDpnList = ItmUtils.getTunnelMeshInfo(dataBroker);
+ Collection<DPNTEPsInfo> meshedDpnList = dpnTEPsInfoCache.getAllPresent();
if (meshedDpnList == null) {
LOG.error("There are no tunnel mesh info in config DS");
return Futures.immediateFuture(resultBld.build());
<reference id="jobCoordinator"
interface="org.opendaylight.infrautils.jobcoordinator.JobCoordinator"/>
+ <reference id="cacheProvider"
+ interface="org.opendaylight.infrautils.caches.CacheProvider"/>
+
<odl:rpc-implementation ref="itmManagerRpcService" />
<odl:clustered-app-config id="itmConfig"
</command>
<command>
<action class="org.opendaylight.genius.itm.cli.TepShowState">
- <property name="itmProvider" ref="itmProvider" />
+ <argument ref="itmProvider" />
+ <argument ref="tunnelStateCache" />
</action>
</command>
<command>
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.genius.itm.cache.DPNTEPsInfoCache;
import org.opendaylight.genius.itm.confighelpers.HwVtep;
import org.opendaylight.genius.itm.confighelpers.ItmExternalTunnelAddWorker;
import org.opendaylight.genius.itm.globals.ITMConstants;
-import org.opendaylight.genius.utils.cache.DataStoreCache;
+import org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl;
+import org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
@Mock IdManagerService idManagerService;
@Mock ItmConfig itmConfig;
+ private ItmExternalTunnelAddWorker externalTunnelAddWorker;
+
@Before
public void setUp() {
setupMocks();
- DataStoreCache.create(ITMConstants.ITM_MONIRORING_PARAMS_CACHE_NAME);
optionalDpnEndPoints = Optional.of(dpnEndpointsVxlan);
tunnelMonitorParamsOptional = Optional.of(tunnelMonitorParams);
doReturn(Futures.immediateCheckedFuture(tunnelMonitorIntervalOptional))
.when(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, tunnelMonitorIntervalIdentifier);
+ externalTunnelAddWorker = new ItmExternalTunnelAddWorker(dataBroker, itmConfig,
+ new DPNTEPsInfoCache(dataBroker, new GuavaCacheProvider(new CacheManagersRegistryImpl())));
+
}
@After
@Test
public void testBuildTunnelsToExternalEndPoint() {
- ItmExternalTunnelAddWorker.buildTunnelsToExternalEndPoint(dataBroker, cfgdDpnListVxlan,
- ipAddress2,tunnelType1, itmConfig);
+ externalTunnelAddWorker.buildTunnelsToExternalEndPoint(cfgdDpnListVxlan, ipAddress2, tunnelType1);
verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION,interfaceIdentifier,iface,true);
verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION,externalTunnelIdentifier,externalTunnel,true);
@Test
public void testBuildTunnelsFromDpnToExternalEndPoint() {
- ItmExternalTunnelAddWorker.buildTunnelsFromDpnToExternalEndPoint(dataBroker, bigIntegerList,
- ipAddress2,tunnelType1, itmConfig);
+ externalTunnelAddWorker.buildTunnelsFromDpnToExternalEndPoint(bigIntegerList, ipAddress2, tunnelType1);
verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION,interfaceIdentifier,iface,true);
verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION,externalTunnelIdentifier,externalTunnel,true);
doReturn(Futures.immediateCheckedFuture(optionalTransportZone)).when(mockReadTx).read(LogicalDatastoreType
.CONFIGURATION,transportZoneIdentifier);
- ItmExternalTunnelAddWorker.buildHwVtepsTunnels(dataBroker, cfgdDpnListVxlan,null);
- ItmExternalTunnelAddWorker.buildHwVtepsTunnels(dataBroker, null,cfgdHwVtepsList);
+ externalTunnelAddWorker.buildHwVtepsTunnels(cfgdDpnListVxlan, null);
+ externalTunnelAddWorker.buildHwVtepsTunnels(null, cfgdHwVtepsList);
verify(mockWriteTx, times(2)).merge(LogicalDatastoreType.CONFIGURATION,ifIID1,extTunnelIf1,true);
verify(mockWriteTx, times(2)).merge(LogicalDatastoreType.CONFIGURATION,externalTunnelIdentifier1,
import org.opendaylight.genius.itm.confighelpers.HwVtep;
import org.opendaylight.genius.itm.confighelpers.ItmExternalTunnelDeleteWorker;
import org.opendaylight.genius.itm.globals.ITMConstants;
-import org.opendaylight.genius.utils.cache.DataStoreCache;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
@Before
public void setUp() {
setupMocks();
- DataStoreCache.create(ITMConstants.ITM_MONIRORING_PARAMS_CACHE_NAME);
when(idManagerService.releaseId(any(ReleaseIdInput.class))).thenReturn(Futures.immediateFuture(RpcResultBuilder
.<Void>success().build()));
import org.opendaylight.genius.itm.confighelpers.ItmInternalTunnelAddWorker;
import org.opendaylight.genius.itm.globals.ITMConstants;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
-import org.opendaylight.genius.utils.cache.DataStoreCache;
+import org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl;
+import org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider;
import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
public void setUp() {
PowerMockito.mockStatic(ITMBatchingUtils.class);
setupMocks();
- DataStoreCache.create(ITMConstants.ITM_MONIRORING_PARAMS_CACHE_NAME);
tunnelMonitorParamsOptional = Optional.of(tunnelMonitorParams);
tunnelMonitorIntervalOptional = Optional.of(tunnelMonitorInterval);
doReturn(Futures.immediateCheckedFuture(tunnelMonitorIntervalOptional)).when(mockReadTx)
.read(LogicalDatastoreType.CONFIGURATION, tunnelMonitorIntervalIdentifier);
- itmInternalTunnelAddWorker = new ItmInternalTunnelAddWorker(dataBroker, jobCoordinator);
+ itmInternalTunnelAddWorker = new ItmInternalTunnelAddWorker(dataBroker, jobCoordinator,
+ new TunnelMonitoringConfig(dataBroker, new GuavaCacheProvider(new CacheManagersRegistryImpl())));
}
@After
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.itm.confighelpers.ItmInternalTunnelDeleteWorker;
-import org.opendaylight.genius.itm.globals.ITMConstants;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
-import org.opendaylight.genius.utils.cache.DataStoreCache;
+import org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl;
+import org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider;
import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
@Before
public void setUp() {
setupMocks();
- DataStoreCache.create(ITMConstants.ITM_MONIRORING_PARAMS_CACHE_NAME);
tunnelMonitorParamsOptional = Optional.of(tunnelMonitorParams);
tunnelMonitorIntervalOptional = Optional.of(tunnelMonitorInterval);
doReturn(Futures.immediateCheckedFuture(internalTunnelOptional)).when(mockReadTx)
.read(LogicalDatastoreType.CONFIGURATION,internalTunnelIdentifier);
- itmInternalTunnelDeleteWorker = new ItmInternalTunnelDeleteWorker(dataBroker, jobCoordinator);
+ itmInternalTunnelDeleteWorker = new ItmInternalTunnelDeleteWorker(dataBroker, jobCoordinator,
+ new TunnelMonitoringConfig(dataBroker, new GuavaCacheProvider(new CacheManagersRegistryImpl())));
}
@After
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.genius.itm.cache.DPNTEPsInfoCache;
import org.opendaylight.genius.itm.globals.ITMConstants;
import org.opendaylight.genius.itm.rpc.ItmManagerRpcService;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
+import org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl;
+import org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
doReturn(Futures.immediateCheckedFuture(transportZonesOptional)).when(mockReadTx).read(LogicalDatastoreType
.CONFIGURATION,transportZonesIdentifier);
- itmManagerRpcService = new ItmManagerRpcService(dataBroker, mdsalApiManager, itmConfig);
+ itmManagerRpcService = new ItmManagerRpcService(dataBroker, mdsalApiManager, itmConfig,
+ new DPNTEPsInfoCache(dataBroker, new GuavaCacheProvider(new CacheManagersRegistryImpl())));
}
@After
+++ /dev/null
-/*
- * Copyright (c) 2015 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.itm.impl;
-
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.genius.itm.cli.TepCommandHelper;
-import org.opendaylight.genius.itm.listeners.InterfaceStateListener;
-import org.opendaylight.genius.itm.listeners.OvsdbNodeListener;
-import org.opendaylight.genius.itm.listeners.TransportZoneListener;
-import org.opendaylight.genius.itm.listeners.TunnelMonitorChangeListener;
-import org.opendaylight.genius.itm.listeners.TunnelMonitorIntervalListener;
-import org.opendaylight.genius.itm.listeners.VtepConfigSchemaListener;
-import org.opendaylight.genius.itm.listeners.cache.DpnTepsInfoListener;
-import org.opendaylight.genius.itm.listeners.cache.ItmMonitoringIntervalListener;
-import org.opendaylight.genius.itm.listeners.cache.ItmMonitoringListener;
-import org.opendaylight.genius.itm.listeners.cache.StateTunnelListListener;
-import org.opendaylight.genius.itm.monitoring.ItmTunnelEventListener;
-import org.opendaylight.genius.itm.rpc.ItmManagerRpcService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
-
-public class ItmProviderTest {
-
- @Mock DataBroker dataBroker;
- @Mock DpnTepsInfoListener dpnTepsInfoListener;
- @Mock IdManagerService idManagerService;
- @Mock InterfaceStateListener interfaceStateListener;
- @Mock ITMManager itmManager;
- @Mock ItmManagerRpcService itmManagerRpcService;
- @Mock ItmMonitoringListener itmMonitoringListener;
- @Mock ItmMonitoringIntervalListener itmMonitoringIntervalListener;
- @Mock ItmTunnelEventListener itmTunnelEventListener;
- @Mock StateTunnelListListener stateTunnelListListener;
- @Mock TepCommandHelper tepCommandHelper;
- @Mock TunnelMonitorChangeListener tunnelMonitorChangeListener;
- @Mock TunnelMonitorIntervalListener tunnelMonitorIntervalListener;
- @Mock TransportZoneListener transportZoneListener;
- @Mock VtepConfigSchemaListener vtepConfigSchemaListener;
- @Mock OvsdbNodeListener ovsdbNodeListener;
-
- @Test
- public void testClose() {
- ItmProvider provider = new ItmProvider(dataBroker, dpnTepsInfoListener, idManagerService,
- interfaceStateListener, itmManager, itmManagerRpcService, itmMonitoringListener,
- itmMonitoringIntervalListener, itmTunnelEventListener, stateTunnelListListener,
- tepCommandHelper, tunnelMonitorChangeListener, tunnelMonitorIntervalListener,
- transportZoneListener, vtepConfigSchemaListener, ovsdbNodeListener);
- // ensure no exceptions
- // currently this method is empty
- provider.close();
- }
-}
import org.opendaylight.genius.itm.tests.xtend.ExpectedDeviceVtepsObjects;
import org.opendaylight.genius.itm.tests.xtend.ExpectedExternalTunnelObjects;
import org.opendaylight.genius.itm.tests.xtend.ExpectedInternalTunnelIdentifierObjects;
+import org.opendaylight.infrautils.caches.testutils.CacheModule;
import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
import org.opendaylight.infrautils.testutils.LogRule;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
public @Rule LogRule logRule = new LogRule();
// TODO public @Rule LogCaptureRule logCaptureRule = new LogCaptureRule();
- public @Rule MethodRule guice = new GuiceRule(ItmTestModule.class, JobCoordinatorTestModule.class);
+ public @Rule MethodRule guice = new GuiceRule(ItmTestModule.class, JobCoordinatorTestModule.class,
+ CacheModule.class);
String trunkInterfaceName;
import org.opendaylight.genius.itm.tests.xtend.ExpectedDefTransportZoneObjects;
import org.opendaylight.genius.itm.tests.xtend.ExpectedTepNotHostedTransportZoneObjects;
import org.opendaylight.genius.itm.tests.xtend.ExpectedTransportZoneObjects;
+import org.opendaylight.infrautils.caches.testutils.CacheModule;
import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
import org.opendaylight.infrautils.testutils.LogRule;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
public @Rule LogRule logRule = new LogRule();
// TODO public @Rule LogCaptureRule logCaptureRule = new LogCaptureRule();
- public @Rule MethodRule guice = new GuiceRule(ItmTestModule.class, JobCoordinatorTestModule.class);
+ public @Rule MethodRule guice = new GuiceRule(ItmTestModule.class, JobCoordinatorTestModule.class,
+ CacheModule.class);
TransportZone transportZone;
TransportZones transportZones;
import org.opendaylight.genius.datastoreutils.testutils.JobCoordinatorTestModule;
import org.opendaylight.genius.itm.impl.ItmTestUtils;
import org.opendaylight.genius.utils.cache.CacheTestUtil;
+import org.opendaylight.infrautils.caches.testutils.CacheModule;
import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
import org.opendaylight.infrautils.testutils.LogCaptureRule;
import org.opendaylight.infrautils.testutils.LogRule;
public @Rule LogRule logRule = new LogRule();
public @Rule LogCaptureRule logCaptureRule = new LogCaptureRule();
- public @Rule MethodRule guice = new GuiceRule(ItmTestModule.class, JobCoordinatorTestModule.class);
+ public @Rule MethodRule guice = new GuiceRule(ItmTestModule.class, JobCoordinatorTestModule.class,
+ CacheModule.class);
@Before
public void before() {
import org.opendaylight.genius.interfacemanager.interfaces.InterfaceManagerService;
import org.opendaylight.genius.interfacemanager.rpcservice.InterfaceManagerServiceImpl;
import org.opendaylight.genius.itm.globals.ITMConstants;
-import org.opendaylight.genius.itm.impl.ITMManager;
import org.opendaylight.genius.itm.impl.ItmProvider;
import org.opendaylight.genius.itm.listeners.InterfaceStateListener;
import org.opendaylight.genius.itm.listeners.OvsdbNodeListener;
import org.opendaylight.genius.itm.listeners.TunnelMonitorChangeListener;
import org.opendaylight.genius.itm.listeners.TunnelMonitorIntervalListener;
import org.opendaylight.genius.itm.listeners.VtepConfigSchemaListener;
-import org.opendaylight.genius.itm.listeners.cache.DpnTepsInfoListener;
-import org.opendaylight.genius.itm.listeners.cache.ItmMonitoringIntervalListener;
-import org.opendaylight.genius.itm.listeners.cache.ItmMonitoringListener;
-import org.opendaylight.genius.itm.listeners.cache.StateTunnelListListener;
import org.opendaylight.genius.itm.monitoring.ItmTunnelEventListener;
import org.opendaylight.genius.itm.rpc.ItmManagerRpcService;
import org.opendaylight.genius.lockmanager.impl.LockManagerServiceImpl;
protected void configureBindings() {
// Bindings for services from this project
bind(ItmRpcService.class).to(ItmManagerRpcService.class);
- bind(ITMManager.class);
bind(ItmProvider.class);
ItmConfig itmConfigObj = new ItmConfigBuilder()
.setDefTzEnabled(true)
.setGpeExtensionEnabled(false)
.build();
bind(ItmConfig.class).toInstance(itmConfigObj);
- bind(ItmMonitoringIntervalListener.class);
- bind(DpnTepsInfoListener.class);
- bind(StateTunnelListListener.class);
- bind(ItmMonitoringListener.class);
bind(TunnelMonitorIntervalListener.class);
bind(TransportZoneListener.class);
bind(OvsdbNodeListener.class);