From: Lorand Jakab Date: Tue, 6 Dec 2016 18:22:13 +0000 (+0200) Subject: Bug 7272: Fix prefix removal in MultiTableMapCache X-Git-Tag: release/carbon~58 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=0241b00bf9dddb826ae71904341de30e7f0b19a1;p=lispflowmapping.git Bug 7272: Fix prefix removal in MultiTableMapCache This fix is a bit of a brute-force, since it removes authentication keys and all data, when removing a mapping, but for the MultiTableMapCache in lispflowmapping as-is currently it is OK, since authentication keys are stored in SimpleMapCache. So this is just a band-aid for the particular use case reported in the bug, but a proper fix will require more changes, which need to be discussed. Change-Id: I295d2921f6b81505271887fbde2078ec38dbca0d Signed-off-by: Lorand Jakab --- diff --git a/mappingservice/mapcache/src/main/java/org/opendaylight/lispflowmapping/mapcache/MultiTableMapCache.java b/mappingservice/mapcache/src/main/java/org/opendaylight/lispflowmapping/mapcache/MultiTableMapCache.java index e2489decc..eee73855e 100644 --- a/mappingservice/mapcache/src/main/java/org/opendaylight/lispflowmapping/mapcache/MultiTableMapCache.java +++ b/mappingservice/mapcache/src/main/java/org/opendaylight/lispflowmapping/mapcache/MultiTableMapCache.java @@ -158,14 +158,10 @@ public class MultiTableMapCache implements IMapCache { if (key.getAddress() instanceof SourceDestKey) { ILispDAO db = getSDInnerDao(key, table); if (db != null) { - db.removeSpecific(SourceDestKeyHelper.getSrcBinary(key), - SubKeys.RECORD); - db.removeSpecific(SourceDestKeyHelper.getSrcBinary(key), - SubKeys.REGDATE); + db.remove(SourceDestKeyHelper.getSrcBinary(key)); } } else { - table.removeSpecific(key, SubKeys.RECORD); - table.removeSpecific(key, SubKeys.REGDATE); + table.remove(key); } } diff --git a/mappingservice/mapcache/src/test/java/org/opendaylight/lispflowmapping/mapcache/MultiTableMapCacheTest.java b/mappingservice/mapcache/src/test/java/org/opendaylight/lispflowmapping/mapcache/MultiTableMapCacheTest.java index 3fad6a177..22cee3399 100644 --- a/mappingservice/mapcache/src/test/java/org/opendaylight/lispflowmapping/mapcache/MultiTableMapCacheTest.java +++ b/mappingservice/mapcache/src/test/java/org/opendaylight/lispflowmapping/mapcache/MultiTableMapCacheTest.java @@ -192,10 +192,7 @@ public class MultiTableMapCacheTest { .getDstBinary(NORMALIZED_SRCDST_EID), SubKeys.LCAF_SRCDST)).thenReturn(dbMock); multiTableMapCache.removeMapping(EID_SOURCE_DEST_KEY_TYPE, true); - verify(dbMock).removeSpecific(SourceDestKeyHelper.getSrcBinary(NORMALIZED_SRCDST_EID), - SubKeys.RECORD); - verify(dbMock).removeSpecific(SourceDestKeyHelper.getSrcBinary(NORMALIZED_SRCDST_EID), - SubKeys.REGDATE); + verify(dbMock).remove(SourceDestKeyHelper.getSrcBinary(NORMALIZED_SRCDST_EID)); } /** @@ -207,8 +204,7 @@ public class MultiTableMapCacheTest { when(daoMock.getSpecific(VNI, SubKeys.VNI)).thenReturn(tableDaoMock); multiTableMapCache.removeMapping(EID_TEST, true); - verify(tableDaoMock).removeSpecific(NORMALIZED_EID, SubKeys.RECORD); - verify(tableDaoMock).removeSpecific(NORMALIZED_EID, SubKeys.REGDATE); + verify(tableDaoMock).remove(NORMALIZED_EID); } /**