Class SimpleMapCache
- java.lang.Object
-
- org.opendaylight.lispflowmapping.mapcache.SimpleMapCache
-
- All Implemented Interfaces:
ILispMapCache,IMapCache
public class SimpleMapCache extends java.lang.Object implements ILispMapCache
Simple map-cache that works with 'simple' addresses (see lisp-proto.yang). It can do longest prefix matching for IP addresses.- Author:
- Florin Coras, Lorand Jakab
-
-
Constructor Summary
Constructors Constructor Description SimpleMapCache(ILispDAO dao)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddData(Eid eid, java.lang.String subKey, java.lang.Object data)Add data for key.voidaddMapping(Eid key, java.lang.Object value)Add mapping.voidaddMapping(Eid key, java.lang.Object value, java.util.Set<IpAddressBinary> sourceRlocs)Add mapping.voidaddMapping(Eid key, XtrId xtrId, java.lang.Object value)Add mapping.java.util.List<java.lang.Object>getAllXtrIdMappings(Eid eid)Retrieve all xTR-ID sub-mappings for an EID.EidgetCoveringLessSpecific(Eid eid)Look up the covering prefix for the argument, but exclude the argument itself, so the result is always less specific than the lookup key.java.lang.ObjectgetData(Eid eid, java.lang.String subKey)Generic retrieval of data.java.lang.ObjectgetMapping(Eid srcEid, Eid dstEid)Retrieves mapping for the provided srcKey and dstKey.java.lang.ObjectgetMapping(Eid eid, XtrId xtrId)Retrieves mapping for the provided srcKey, dstKey and a XtrId.EidgetParentPrefix(Eid eid)Returns the parent prefix for given key.EidgetSiblingPrefix(Eid eid)Returns the sibling prefix for given key.java.util.Set<Eid>getSubtree(Eid eid)Retrieves the subtree of a prefix.EidgetVirtualParentSiblingPrefix(Eid eid)Returns the virtual parent sibling prefix for given key.EidgetWidestNegativeMapping(Eid eid)Retrieves widest negative prefix.java.lang.StringprettyPrintMappings()Print mappings in cache in a human friendly format.java.lang.StringprintMappings()Print mappings in cache.voidremoveData(Eid eid, java.lang.String subKey)Generic removal of data.voidremoveMapping(Eid eid)Remove mapping.voidremoveMapping(Eid eid, XtrId xtrId)Remove mapping.voidremoveXtrIdMappings(Eid eid, java.util.List<XtrId> xtrIds)Batch remove several xTR-ID sub-mappings under a certain key.
-
-
-
Constructor Detail
-
SimpleMapCache
public SimpleMapCache(ILispDAO dao)
-
-
Method Detail
-
addMapping
public void addMapping(Eid key, java.lang.Object value)
Description copied from interface:IMapCacheAdd mapping.- Specified by:
addMappingin interfaceIMapCache- Parameters:
key- Key of the mappingvalue- Value to be stored
-
addMapping
public void addMapping(Eid key, java.lang.Object value, java.util.Set<IpAddressBinary> sourceRlocs)
Description copied from interface:ILispMapCacheAdd mapping.- Specified by:
addMappingin interfaceILispMapCache- Parameters:
key- Key of the mappingvalue- Mapping to be storedsourceRlocs- The set of RLOCs from all registrations. Used for merging
-
addMapping
public void addMapping(Eid key, XtrId xtrId, java.lang.Object value)
Description copied from interface:ILispMapCacheAdd mapping.- Specified by:
addMappingin interfaceILispMapCache- Parameters:
key- Key of the mappingxtrId- xTR-ID of the mappingvalue- Mapping to be stored
-
getMapping
public java.lang.Object getMapping(Eid srcEid, Eid dstEid)
Description copied from interface:IMapCacheRetrieves mapping for the provided srcKey and dstKey.- Specified by:
getMappingin interfaceIMapCache- Parameters:
srcEid- Source Key to be looked updstEid- Destination Key to be looked up- Returns:
- Returns the object found in the cache or null if nothing is found.
-
getMapping
public java.lang.Object getMapping(Eid eid, XtrId xtrId)
Description copied from interface:ILispMapCacheRetrieves mapping for the provided srcKey, dstKey and a XtrId.- Specified by:
getMappingin interfaceILispMapCache- Parameters:
eid- Key to be looked upxtrId- xTR-ID for which look-up to be done- Returns:
- Returns the mapping found in the cache
-
getAllXtrIdMappings
public java.util.List<java.lang.Object> getAllXtrIdMappings(Eid eid)
Description copied from interface:ILispMapCacheRetrieve all xTR-ID sub-mappings for an EID. Used for merging logic.- Specified by:
getAllXtrIdMappingsin interfaceILispMapCache- Parameters:
eid- Key to be looked up- Returns:
- The list of Objects which should be mappings
-
getWidestNegativeMapping
public Eid getWidestNegativeMapping(Eid eid)
Description copied from interface:IMapCacheRetrieves widest negative prefix.- Specified by:
getWidestNegativeMappingin interfaceIMapCache- Parameters:
eid- Source Key to be looked up- Returns:
- Returns the widest negative prefix or null if nothing is found.
-
getCoveringLessSpecific
public Eid getCoveringLessSpecific(Eid eid)
Description copied from interface:ILispMapCacheLook up the covering prefix for the argument, but exclude the argument itself, so the result is always less specific than the lookup key.- Specified by:
getCoveringLessSpecificin interfaceILispMapCache- Parameters:
eid- The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.- Returns:
- The covering prefix.
-
getParentPrefix
public Eid getParentPrefix(Eid eid)
Description copied from interface:ILispMapCacheReturns the parent prefix for given key.- Specified by:
getParentPrefixin interfaceILispMapCache- Parameters:
eid- The key for which parent is to be returned.- Returns:
- The parent prefix of a specific key.
-
getSiblingPrefix
public Eid getSiblingPrefix(Eid eid)
Description copied from interface:ILispMapCacheReturns the sibling prefix for given key.- Specified by:
getSiblingPrefixin interfaceILispMapCache- Parameters:
eid- The key for which sibling is to be returned.- Returns:
- The sibling prefix of a specific key.
-
getVirtualParentSiblingPrefix
public Eid getVirtualParentSiblingPrefix(Eid eid)
Description copied from interface:ILispMapCacheReturns the virtual parent sibling prefix for given key.- Specified by:
getVirtualParentSiblingPrefixin interfaceILispMapCache- Parameters:
eid- The key for which virtual parent sibling is to be returned.- Returns:
- The virtual parent sibling prefix of a specific key.
-
getSubtree
public java.util.Set<Eid> getSubtree(Eid eid)
Description copied from interface:IMapCacheRetrieves the subtree of a prefix.- Specified by:
getSubtreein interfaceIMapCache- Parameters:
eid- Key to be looked up- Returns:
- The set of prefixes in the subtree for the prefix
-
removeMapping
public void removeMapping(Eid eid)
Description copied from interface:IMapCacheRemove mapping.- Specified by:
removeMappingin interfaceIMapCache- Parameters:
eid- Key to be removed
-
removeMapping
public void removeMapping(Eid eid, XtrId xtrId)
Description copied from interface:ILispMapCacheRemove mapping.- Specified by:
removeMappingin interfaceILispMapCache- Parameters:
eid- Key to be removedxtrId- xTR-ID of the mapping to be removed
-
removeXtrIdMappings
public void removeXtrIdMappings(Eid eid, java.util.List<XtrId> xtrIds)
Description copied from interface:ILispMapCacheBatch remove several xTR-ID sub-mappings under a certain key.This is a performance optimization, since interactive calls to removeMapping() would result in LPM lookups of the key for each call. With this method, only one such lookup is performed.
- Specified by:
removeXtrIdMappingsin interfaceILispMapCache- Parameters:
eid- Key to be looked upxtrIds- List of xTR-IDs that need to be removed
-
addData
public void addData(Eid eid, java.lang.String subKey, java.lang.Object data)
Description copied from interface:IMapCacheAdd data for key.
-
getData
public java.lang.Object getData(Eid eid, java.lang.String subKey)
Description copied from interface:IMapCacheGeneric retrieval of data.
-
removeData
public void removeData(Eid eid, java.lang.String subKey)
Description copied from interface:IMapCacheGeneric removal of data.- Specified by:
removeDatain interfaceIMapCache- Parameters:
eid- The key of the data to be removedsubKey- The subKey of the data to be removed
-
printMappings
public java.lang.String printMappings()
Description copied from interface:IMapCachePrint mappings in cache. Used for testing, debugging and the karaf shell.- Specified by:
printMappingsin interfaceIMapCache- Returns:
- a String consisting of all the mappings in the cache
-
prettyPrintMappings
public java.lang.String prettyPrintMappings()
Description copied from interface:IMapCachePrint mappings in cache in a human friendly format.- Specified by:
prettyPrintMappingsin interfaceIMapCache- Returns:
- a String consisting of all the mappings in the cache
-
-