use of org.opendaylight.genius.itm.utils.DpnTepInterfaceInfoBuilder 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.DpnTepInterfaceInfoBuilder 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));
}
Aggregations