use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.DpnsTeps 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.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.DpnsTeps 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.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.DpnsTeps in project genius by opendaylight.
the class DpnTepStateCache method removeTepFromDpnTepInterfaceConfigDS.
public void removeTepFromDpnTepInterfaceConfigDS(BigInteger srcDpnId) throws TransactionCommitFailedException {
Collection<DpnsTeps> dpnsTeps = this.getAllPresent();
for (DpnsTeps dpnTep : dpnsTeps) {
if (!dpnTep.getSourceDpnId().equals(srcDpnId)) {
List<RemoteDpns> remoteDpns = dpnTep.getRemoteDpns();
for (RemoteDpns remoteDpn : remoteDpns) {
if (remoteDpn.getDestinationDpnId().equals(srcDpnId)) {
// Remote the SrcDpnId from the remote List. Remove it from COnfig DS. 4
// This will be reflected in cache by the ClusteredDTCN. Not removing it here !
// Caution :- Batching Delete !!
InstanceIdentifier<RemoteDpns> remoteDpnII = buildRemoteDpnsInstanceIdentifier(dpnTep.getSourceDpnId(), remoteDpn.getDestinationDpnId());
SingleTransactionDataBroker.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, remoteDpnII);
break;
}
}
} else {
// The source DPn id is the one to be removed
InstanceIdentifier<DpnsTeps> dpnsTepsII = buildDpnsTepsInstanceIdentifier(dpnTep.getSourceDpnId());
SingleTransactionDataBroker.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, dpnsTepsII);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.DpnsTeps in project genius by opendaylight.
the class DpnTepStateCache method removed.
@Override
protected void removed(InstanceIdentifier<DpnsTeps> path, DpnsTeps dpnsTeps) {
for (RemoteDpns remoteDpns : dpnsTeps.getRemoteDpns()) {
dpnTepInterfaceMap.remove(getDpnId(dpnsTeps.getSourceDpnId(), remoteDpns.getDestinationDpnId()));
tunnelEndpointMap.remove(remoteDpns.getTunnelName());
}
}
Aggregations