use of org.opendaylight.genius.itm.utils.DpnTepInterfaceInfo in project genius by opendaylight.
the class DirectTunnelUtils method getEgressActionInfosForInterface.
private List<ActionInfo> getEgressActionInfosForInterface(String interfaceName, long tunnelKey, int actionKeyStart) {
DpnTepInterfaceInfo interfaceInfo = dpnTepStateCache.getTunnelFromCache(interfaceName);
if (interfaceInfo == null) {
LOG.error("Interface information not present in config DS for {}", interfaceName);
return Collections.singletonList(new ActionDrop());
}
Optional<StateTunnelList> ifState;
try {
ifState = tunnelStateCache.get(tunnelStateCache.getStateTunnelListIdentifier(interfaceName));
} catch (ReadFailedException e) {
LOG.error("Interface information not present in oper DS for {} ", interfaceName, e);
return Collections.singletonList(new ActionDrop());
}
if (ifState.isPresent()) {
String tunnelType = ItmUtils.convertTunnelTypetoString(interfaceInfo.getTunnelType());
return getEgressActionInfosForInterface(tunnelType, ifState.get().getPortNumber(), tunnelKey, actionKeyStart);
}
LOG.error("Interface information not present in oper DS for {}", interfaceName);
return Collections.singletonList(new ActionDrop());
}
use of org.opendaylight.genius.itm.utils.DpnTepInterfaceInfo in project genius by opendaylight.
the class DpnTepStateCache method added.
@Override
protected void added(InstanceIdentifier<DpnsTeps> path, DpnsTeps dpnsTeps) {
for (RemoteDpns remoteDpns : dpnsTeps.getRemoteDpns()) {
final String dpn = getDpnId(dpnsTeps.getSourceDpnId(), remoteDpns.getDestinationDpnId());
DpnTepInterfaceInfo value = new DpnTepInterfaceInfoBuilder().setTunnelName(remoteDpns.getTunnelName()).setGroupId(dpnsTeps.getGroupId()).setIsMonitoringEnabled(remoteDpns.isMonitoringEnabled()).setIsMonitoringEnabled(remoteDpns.isInternal()).setTunnelType(dpnsTeps.getTunnelType()).build();
dpnTepInterfaceMap.put(dpn, value);
addTunnelEndPointInfoToCache(remoteDpns.getTunnelName(), dpnsTeps.getSourceDpnId().toString(), remoteDpns.getDestinationDpnId().toString());
}
}
use of org.opendaylight.genius.itm.utils.DpnTepInterfaceInfo in project genius by opendaylight.
the class DpnTepStateCache method getDpnTepInterface.
public DpnTepInterfaceInfo getDpnTepInterface(BigInteger srcDpnId, BigInteger dstDpnId) {
DpnTepInterfaceInfo dpnTepInterfaceInfo = dpnTepInterfaceMap.get(getDpnId(srcDpnId, dstDpnId));
if (dpnTepInterfaceInfo == null) {
try {
Optional<DpnsTeps> dpnsTeps = super.get(srcDpnId);
if (dpnsTeps.isPresent()) {
DpnsTeps teps = dpnsTeps.get();
teps.getRemoteDpns().forEach(remoteDpns -> {
DpnTepInterfaceInfo value = new DpnTepInterfaceInfoBuilder().setTunnelName(remoteDpns.getTunnelName()).setGroupId(teps.getGroupId()).setIsMonitoringEnabled(remoteDpns.isMonitoringEnabled()).setIsMonitoringEnabled(remoteDpns.isInternal()).setTunnelType(teps.getTunnelType()).build();
dpnTepInterfaceMap.putIfAbsent(getDpnId(srcDpnId, remoteDpns.getDestinationDpnId()), value);
addTunnelEndPointInfoToCache(remoteDpns.getTunnelName(), teps.getSourceDpnId().toString(), remoteDpns.getDestinationDpnId().toString());
});
}
} catch (ReadFailedException e) {
LOG.error("cache read for dpnID {} in DpnTepStateCache failed ", srcDpnId, e);
}
}
return dpnTepInterfaceMap.get(getDpnId(srcDpnId, dstDpnId));
}
use of org.opendaylight.genius.itm.utils.DpnTepInterfaceInfo in project genius by opendaylight.
the class DpnTepStateCache method getInterfaceFromCache.
public Interface getInterfaceFromCache(String tunnelName) {
TunnelEndPointInfo endPointInfo = getTunnelEndPointInfoFromCache(tunnelName);
BigInteger srcDpnId = new BigInteger(endPointInfo.getSrcEndPointInfo());
BigInteger dstDpnId = new BigInteger(endPointInfo.getDstEndPointInfo());
Interface iface = null;
int monitoringInt = 1000;
DpnTepInterfaceInfo dpnTepInfo = getDpnTepInterface(srcDpnId, dstDpnId);
if (dpnTepInfo != null) {
List<DPNTEPsInfo> srcDpnTEPsInfo = dpnTepsInfoCache.getDPNTepListFromDPNId(Collections.singletonList(srcDpnId));
List<DPNTEPsInfo> dstDpnTEPsInfo = dpnTepsInfoCache.getDPNTepListFromDPNId(Collections.singletonList(dstDpnId));
iface = ItmUtils.buildTunnelInterface(srcDpnId, tunnelName, String.format("%s %s", ItmUtils.convertTunnelTypetoString(dpnTepInfo.getTunnelType()), "Trunk Interface"), true, dpnTepInfo.getTunnelType(), srcDpnTEPsInfo.get(0).getTunnelEndPoints().get(0).getIpAddress(), dstDpnTEPsInfo.get(0).getTunnelEndPoints().get(0).getIpAddress(), srcDpnTEPsInfo.get(0).getTunnelEndPoints().get(0).getGwIpAddress(), srcDpnTEPsInfo.get(0).getTunnelEndPoints().get(0).getVLANID(), true, dpnTepInfo.isMonitoringEnabled(), TunnelMonitoringTypeBfd.class, monitoringInt, true, null);
}
return iface;
}
Aggregations