Add MappingRepository type to signify where to store mapping info
Change-Id: If6e1deec011e85102a05b985306232f81834736b
diff --git a/apps/mappingmanagement/api/src/main/java/org/onosproject/mapping/MappingProviderService.java b/apps/mappingmanagement/api/src/main/java/org/onosproject/mapping/MappingProviderService.java
index 8392ee1..6cbd478 100644
--- a/apps/mappingmanagement/api/src/main/java/org/onosproject/mapping/MappingProviderService.java
+++ b/apps/mappingmanagement/api/src/main/java/org/onosproject/mapping/MappingProviderService.java
@@ -26,8 +26,8 @@
/**
* Signals that a new mapping has been received.
*
- * @param mappingEntry newly added mapping entry
- * @param isMapDatabase indicate that where this map entry should be stored
+ * @param mappingEntry newly added mapping entry
+ * @param type indicates that where this map entry should be stored
*/
- void mappingAdded(MappingEntry mappingEntry, boolean isMapDatabase);
+ void mappingAdded(MappingEntry mappingEntry, MappingStore.Type type);
}
diff --git a/apps/mappingmanagement/api/src/main/java/org/onosproject/mapping/MappingStore.java b/apps/mappingmanagement/api/src/main/java/org/onosproject/mapping/MappingStore.java
index e6f59a2..5a1614c 100644
--- a/apps/mappingmanagement/api/src/main/java/org/onosproject/mapping/MappingStore.java
+++ b/apps/mappingmanagement/api/src/main/java/org/onosproject/mapping/MappingStore.java
@@ -21,4 +21,17 @@
* Interface of a distributed store for managing mapping information.
*/
public interface MappingStore extends Store<MappingEvent, MappingStoreDelegate> {
+
+ enum Type {
+
+ /**
+ * Signifies that mapping information should be stored in map database.
+ */
+ MAP_DATABASE,
+
+ /**
+ * Signifies that mapping information should be stored in map cache.
+ */
+ MAP_CACHE
+ }
}
diff --git a/apps/mappingmanagement/api/src/test/java/org/onosproject/mapping/MappingProviderServiceAdapter.java b/apps/mappingmanagement/api/src/test/java/org/onosproject/mapping/MappingProviderServiceAdapter.java
index c6a3d87..b5a4311 100644
--- a/apps/mappingmanagement/api/src/test/java/org/onosproject/mapping/MappingProviderServiceAdapter.java
+++ b/apps/mappingmanagement/api/src/test/java/org/onosproject/mapping/MappingProviderServiceAdapter.java
@@ -25,7 +25,7 @@
}
@Override
- public void mappingAdded(MappingEntry mappingEntry, boolean isMapDatabase) {
+ public void mappingAdded(MappingEntry mappingEntry, MappingStore.Type type) {
}
}
diff --git a/providers/lisp/mapping/src/main/java/org/onosproject/provider/lisp/mapping/impl/LispMappingProvider.java b/providers/lisp/mapping/src/main/java/org/onosproject/provider/lisp/mapping/impl/LispMappingProvider.java
index 09bf3e6..05e5dd7 100644
--- a/providers/lisp/mapping/src/main/java/org/onosproject/provider/lisp/mapping/impl/LispMappingProvider.java
+++ b/providers/lisp/mapping/src/main/java/org/onosproject/provider/lisp/mapping/impl/LispMappingProvider.java
@@ -38,6 +38,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.onosproject.mapping.MappingStore.Type.MAP_CACHE;
+import static org.onosproject.mapping.MappingStore.Type.MAP_DATABASE;
+
/**
* Provider which uses a LISP controller to manage EID-RLOC mapping.
*/
@@ -137,14 +140,14 @@
LispMapReply reply = (LispMapReply) msg;
MappingEntry replyMe = new MappingEntryBuilder(deviceId, reply).build();
- providerService.mappingAdded(replyMe, false);
+ providerService.mappingAdded(replyMe, MAP_CACHE);
break;
case LISP_MAP_NOTIFY:
LispMapNotify notify = (LispMapNotify) msg;
MappingEntry notifyMe = new MappingEntryBuilder(deviceId, notify).build();
- providerService.mappingAdded(notifyMe, true);
+ providerService.mappingAdded(notifyMe, MAP_DATABASE);
break;
default: