import java.util.HashSet;
import java.util.List;
import java.util.Set;
+
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.lispflowmapping.config.ConfigIni;
import org.opendaylight.lispflowmapping.dsbackend.DataStoreBackEnd;
return;
}
if (xtrId != null && mappingMerge) {
- smc.addMapping(key, xtrId, mappingData);
if (mappingData.isMergeEnabled()) {
+ smc.addMapping(key, xtrId, mappingData);
mergeMappings(key);
return;
+ } else {
+ clearPresentXtrIdMappings(key);
+ smc.addMapping(key, xtrId, mappingData);
}
}
}
tableMap.get(origin).addMapping(key, mappingData);
}
+ private void clearPresentXtrIdMappings(Eid key) {
+ List<MappingData> allXtrMappingList = (List<MappingData>) (List<?>) smc.getAllXtrIdMappings(key);
+
+ if (((MappingData) smc.getMapping(key, (XtrId) null)).isMergeEnabled()) {
+ LOG.trace("Different xTRs have different merge configuration!");
+ }
+
+ for (MappingData mappingData : allXtrMappingList) {
+ smc.removeMapping(key, mappingData.getXtrId());
+ dsbe.removeXtrIdMapping(DSBEInputUtil.toXtrIdMapping(mappingData));
+ }
+ }
+
/*
* Since this method is only called when there is a hit in the southbound Map-Register cache, and that cache is
* not used when merge is on, it's OK to ignore the effects of timestamp changes on merging for now.