Add MappingRepository type to signify where to store mapping info

Change-Id: If6e1deec011e85102a05b985306232f81834736b
This commit is contained in:
Jian Li 2017-02-02 19:43:46 +09:00
parent 01f6ae0209
commit c7badf9b4e
4 changed files with 22 additions and 6 deletions

View File

@ -26,8 +26,8 @@ public interface MappingProviderService extends ProviderService<MappingProvider>
/** /**
* Signals that a new mapping has been received. * Signals that a new mapping has been received.
* *
* @param mappingEntry newly added mapping entry * @param mappingEntry newly added mapping entry
* @param isMapDatabase indicate that where this map entry should be stored * @param type indicates that where this map entry should be stored
*/ */
void mappingAdded(MappingEntry mappingEntry, boolean isMapDatabase); void mappingAdded(MappingEntry mappingEntry, MappingStore.Type type);
} }

View File

@ -21,4 +21,17 @@ import org.onosproject.store.Store;
* Interface of a distributed store for managing mapping information. * Interface of a distributed store for managing mapping information.
*/ */
public interface MappingStore extends Store<MappingEvent, MappingStoreDelegate> { 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
}
} }

View File

@ -25,7 +25,7 @@ public class MappingProviderServiceAdapter implements MappingProviderService {
} }
@Override @Override
public void mappingAdded(MappingEntry mappingEntry, boolean isMapDatabase) { public void mappingAdded(MappingEntry mappingEntry, MappingStore.Type type) {
} }
} }

View File

@ -38,6 +38,9 @@ import org.onosproject.provider.lisp.mapping.util.MappingEntryBuilder;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; 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. * Provider which uses a LISP controller to manage EID-RLOC mapping.
*/ */
@ -137,14 +140,14 @@ public class LispMappingProvider extends AbstractProvider implements MappingProv
LispMapReply reply = (LispMapReply) msg; LispMapReply reply = (LispMapReply) msg;
MappingEntry replyMe = new MappingEntryBuilder(deviceId, reply).build(); MappingEntry replyMe = new MappingEntryBuilder(deviceId, reply).build();
providerService.mappingAdded(replyMe, false); providerService.mappingAdded(replyMe, MAP_CACHE);
break; break;
case LISP_MAP_NOTIFY: case LISP_MAP_NOTIFY:
LispMapNotify notify = (LispMapNotify) msg; LispMapNotify notify = (LispMapNotify) msg;
MappingEntry notifyMe = new MappingEntryBuilder(deviceId, notify).build(); MappingEntry notifyMe = new MappingEntryBuilder(deviceId, notify).build();
providerService.mappingAdded(notifyMe, true); providerService.mappingAdded(notifyMe, MAP_DATABASE);
break; break;
default: default: