- if (checkForChanges) {
- oldLocators = DAOMappingUtil.getLocatorsByEidToLocatorRecord(eidRecord, dao, shouldIterateMask());
- }
- dao.put(key, entries.toArray(new MappingEntry[entries.size()]));
- if (checkForChanges) {
- newLocators = DAOMappingUtil.getLocatorsByEidToLocatorRecord(eidRecord, dao, shouldIterateMask());
- if (!newLocators.equals(oldLocators)) {
- return true;
+
+ if (eidRecord.getLispAddressContainer().getAddress() instanceof LcafSourceDest) {
+ Entry<IMappingServiceKey, List<MappingServiceRLOCGroup>> oldMapping= null, newMapping = null;
+ LispAFIAddress srcAddr = getSrcForLcafSrcDst(eidRecord.getLispAddressContainer());
+ LispAFIAddress dstAddr = getDstForLcafSrcDst(eidRecord.getLispAddressContainer());
+ short srcMask = getSrcMaskForLcafSrcDst(eidRecord.getLispAddressContainer());
+ short dstMask = getDstMaskForLcafSrcDst(eidRecord.getLispAddressContainer());
+
+ if (checkForChanges) {
+ oldMapping = DAOMappingUtil.getMappingExact(srcAddr, dstAddr, srcMask, dstMask, dao);
+ }
+ IMappingServiceKey dstKey = MappingServiceKeyUtil.generateMappingServiceKey(dstAddr, dstMask);
+ ILispDAO srcDstDao = (ILispDAO) dao.getSpecific(dstKey, LCAF_SRCDST_SUBKEY);
+ if (srcDstDao == null) {
+ srcDstDao = new HashMapDb();
+ dao.put(dstKey, new MappingEntry<>(LCAF_SRCDST_SUBKEY, srcDstDao));
+ }
+ IMappingServiceKey srcKey = MappingServiceKeyUtil.generateMappingServiceKey(srcAddr, srcMask);
+ srcDstDao.put(srcKey, entries.toArray(new MappingEntry[entries.size()]));
+ if (checkForChanges) {
+ newMapping = DAOMappingUtil.getMappingExact(srcAddr, dstAddr, srcMask, dstMask, dao);
+ return (newMapping.getValue() == null) ? oldMapping.getValue() != null :
+ !newMapping.getValue().equals(oldMapping.getValue());
+ }
+ } else {
+ List<MappingServiceRLOCGroup> oldLocators = null, newLocators = null;
+ if (checkForChanges) {
+ oldLocators = DAOMappingUtil.getLocatorsByEidToLocatorRecord(eidRecord, dao, shouldIterateMask());
+ }
+ IMappingServiceKey key = MappingServiceKeyUtil.generateMappingServiceKey(eidRecord.getLispAddressContainer(),
+ eidRecord.getMaskLength());
+ dao.put(key, entries.toArray(new MappingEntry[entries.size()]));
+ if (checkForChanges) {
+ newLocators = DAOMappingUtil.getLocatorsByEidToLocatorRecord(eidRecord, dao, shouldIterateMask());
+ return (newLocators == null) ? oldLocators != null : !newLocators.equals(oldLocators);