use of org.opendaylight.lispflowmapping.interfaces.lisp.SmrEvent in project lispflowmapping by opendaylight.
the class MapResolver method handleMapRequest.
public void handleMapRequest(MapRequest request) {
LOG.trace("Map-Request received: {}", request);
// SMRs and RLOC probes are directed towards xTRs and we're a Map-Resolver here, so ignore them
if (request.isSmr() != null && request.isSmr()) {
LOG.debug("Map-Resolver ignoring incoming SMR control message.");
return;
}
if (request.isProbe() != null && request.isProbe()) {
LOG.debug("Map-Resolver ignoring incoming RLOC probe control message.");
return;
}
if (request.isSmrInvoked()) {
LOG.debug("SMR-invoked request received.");
LOG.trace("Map-Request object: {}", request);
for (EidItem eidItem : request.getEidItem()) {
final SmrEvent event = new SmrEvent(subscriberListFromItrRlocs(request.getItrRloc(), request.getSourceEid().getEid()), eidItem.getEid(), request.getNonce());
smrNotificationListener.onSmrInvokedReceived(event);
}
}
Eid srcEid = null;
if (request.getSourceEid() != null) {
srcEid = request.getSourceEid().getEid();
}
MapReplyBuilder replyBuilder = new MapReplyBuilder();
replyBuilder.setEchoNonceEnabled(false);
replyBuilder.setProbe(false);
replyBuilder.setSecurityEnabled(false);
replyBuilder.setNonce(request.getNonce());
replyBuilder.setMappingRecordItem(new ArrayList<>());
List<ItrRloc> itrRlocs = request.getItrRloc();
final IpAddressBinary sourceRloc = request.getSourceRloc();
for (EidItem eidRecord : request.getEidItem()) {
MappingData mappingData = mapService.getMapping(srcEid, eidRecord.getEid());
MappingRecord mapping;
if (mappingData == null) {
mapping = mapService.addNegativeMapping(eidRecord.getEid()).getRecord();
} else {
mapping = mappingData.getRecord();
}
if (itrRlocs != null && itrRlocs.size() != 0) {
if (subscriptionService && isValidSourceEidForSubscriber(srcEid)) {
final Rloc resolvedRloc = resolveRloc(itrRlocs, sourceRloc);
updateSubscribers(resolvedRloc, eidRecord.getEid(), mapping.getEid(), srcEid, mapping.getRecordTtl());
}
mapping = updateLocators(mapping, itrRlocs);
}
mapping = fixIfNotSDRequest(mapping, eidRecord.getEid());
mapping = fixTtlIfSmrInvoked(request, mapping);
replyBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(mapping).build());
}
requestHandler.handleMapReply(replyBuilder.build());
}
Aggregations