use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin in project lispflowmapping by opendaylight.
the class MappingSystem method handleAddMappingNotifications.
private void handleAddMappingNotifications(MappingOrigin origin, Eid key, MappingData mappingData, MappingRecord oldMapping, MappingRecord newMapping, MappingChange changeType) {
// account policy as well
if (origin != MappingOrigin.Southbound || MappingRecordUtil.mappingChanged(oldMapping, newMapping)) {
notifyChange(key, mappingData.getRecord(), changeType);
Eid dstKey = key;
// for the checks that we do afterwards
if (key.getAddress() instanceof SourceDestKey) {
dstKey = SourceDestKeyHelper.getDstBinary(key);
}
// If the old mapping had a different EID than what was just added, notify those subscribers too
if (oldMapping != null && !oldMapping.getEid().equals(key) && !oldMapping.getEid().equals(dstKey)) {
notifyChange(oldMapping.getEid(), oldMapping, changeType);
}
// subscribers too
if (newMapping != null && !newMapping.getEid().equals(key) && !newMapping.getEid().equals(dstKey)) {
notifyChange(newMapping.getEid(), newMapping, changeType);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin in project lispflowmapping by opendaylight.
the class MappingSystem method removeMapping.
@Override
public void removeMapping(MappingOrigin origin, Eid key) {
Eid dstAddr = null;
Set<Subscriber> subscribers = null;
Set<Subscriber> dstSubscribers = null;
MappingData mapping = (MappingData) tableMap.get(origin).getMapping(null, key);
if (LOG.isDebugEnabled()) {
LOG.debug("Removing mapping for EID {} from {}", LispAddressStringifier.getString(key), origin);
}
if (LOG.isTraceEnabled() && mapping != null) {
LOG.trace(mapping.getString());
}
MappingRecord notificationMapping = null;
if (mapping != null) {
notificationMapping = mapping.getRecord();
subscribers = getSubscribers(key);
// For SrcDst LCAF also send SMRs to Dst prefix
if (key.getAddress() instanceof SourceDestKey) {
dstAddr = SourceDestKeyHelper.getDstBinary(key);
dstSubscribers = getSubscribers(dstAddr);
}
}
removeSubscribersConditionally(origin, key);
if (origin == MappingOrigin.Southbound) {
removeFromSbTimeoutService(key);
}
if (origin == MappingOrigin.Southbound && mapping != null && mapping.isPositive().or(false)) {
mergeNegativePrefixes(key);
} else {
// mergeNegativePrefixes() above removes the mapping, so addNegativeMapping() will work correctly
tableMap.get(origin).removeMapping(key);
}
if (notificationMapping != null) {
publishNotification(notificationMapping, key, subscribers, dstSubscribers, MappingChange.Removed);
notifyChildren(key, notificationMapping, MappingChange.Removed);
if (dstAddr != null) {
notifyChildren(dstAddr, notificationMapping, MappingChange.Removed);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin in project lispflowmapping by opendaylight.
the class DSBEInputUtil method toMapping.
public static Mapping toMapping(MappingOrigin origin, Eid key, SiteId siteId, MappingData mappingData) {
MappingRecord record = (mappingData != null) ? mappingData.getRecord() : null;
List<SiteId> siteIds = (siteId != null) ? Arrays.asList(siteId) : null;
return new MappingBuilder().setEidUri(new EidUri(LispAddressStringifier.getURIString(key))).setOrigin(origin).setSiteId(siteIds).setMappingRecord(record).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin in project lispflowmapping by opendaylight.
the class DSBEInputUtil method toMapping.
public static Mapping toMapping(MappingOrigin origin, Eid key, @Nullable MappingData mappingData) {
MappingRecord record = (mappingData != null) ? mappingData.getRecord() : new MappingRecordBuilder().setEid(key).build();
SiteId siteId = (record != null) ? record.getSiteId() : null;
List<SiteId> siteIds = (siteId != null) ? Arrays.asList(siteId) : null;
return new MappingBuilder().setEidUri(new EidUri(LispAddressStringifier.getURIString(key))).setOrigin(origin).setSiteId(siteIds).setMappingRecord(record).build();
}
Aggregations