Interface IMappingService
-
- All Known Implementing Classes:
MappingService
public interface IMappingService
Mapping Service Java API.- Author:
- Florin Coras
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
IMappingService.LookupPolicy
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addAuthenticationKey(Eid key, MappingAuthkey authKey)
Add authentication key.void
addData(MappingOrigin origin, Eid key, java.lang.String subKey, java.lang.Object data)
Generic addition of data.void
addMapping(MappingOrigin origin, Eid key, SiteId siteId, MappingData mapping)
Add mapping.MappingData
addNegativeMapping(Eid key)
Generate and add a negative mapping entry originated from the southbound, and return the generated mapping.void
cleanCachedMappings()
Cleans all cached mappings.Used for testing.MappingAuthkey
getAuthenticationKey(Eid key)
Retrieve authentication key.java.lang.Object
getData(MappingOrigin origin, Eid key, java.lang.String subKey)
Generic retrieval of data.MappingData
getMapping(Eid key)
Retrieves mapping for given key.The lookup policy for the key is defined in the Mapping System.MappingData
getMapping(Eid srcKey, Eid dstKey)
Retrieves mapping with a Source/Dest policy.MappingData
getMapping(MappingOrigin origin, Eid key)
Retrieves mapping with given origin for the provided key.Eid
getParentPrefix(Eid key)
Returns the parent prefix for given key.java.util.Set<Subscriber>
getSubscribers(Eid eid)
Retrieves the subscribers for an EID.java.util.Set<Eid>
getSubtree(MappingOrigin origin, Eid key)
Retrieves the subtree of a maskable prefix from the given map-cache.Eid
getWidestNegativePrefix(Eid key)
Retrieves widest negative prefix found in the Mapping System for given key.boolean
isMaster()
Get cluster master status.java.lang.String
prettyPrintKeys()
Print keys in cache in a human friendly format.java.lang.String
prettyPrintMappings()
Print mappings in cache in a human friendly format.java.lang.String
printKeys()
Print all authentication keys.java.lang.String
printMappings()
Print all mappings.void
refreshMappingRegistration(Eid key, XtrId xtrId, java.lang.Long timestamp)
Refresh southbound mapping registration timestamp.void
removeAuthenticationKey(Eid key)
Remove authentication key.void
removeData(MappingOrigin origin, Eid key, java.lang.String subKey)
Generic removal of data.void
removeMapping(MappingOrigin origin, Eid key)
Remove mapping.void
setIsMaster(boolean isMaster)
Set cluster master status.void
setLookupPolicy(IMappingService.LookupPolicy policy)
Configures Mapping Service mapping lookup policy option.void
setMappingMerge(boolean mappingMerge)
Configures Mapping Service mapping merge option.void
subscribe(Subscriber subscriber, Eid subscribedEid)
Subscribe a Subscriber to receive updates about mapping changes for an EID.
-
-
-
Method Detail
-
addMapping
void addMapping(MappingOrigin origin, Eid key, SiteId siteId, MappingData mapping)
Add mapping.- Parameters:
origin
- Table where mapping should be addedkey
- Key of the mappingsiteId
- Site that stores the mappingmapping
- Mapping to be stored
-
addNegativeMapping
MappingData addNegativeMapping(Eid key)
Generate and add a negative mapping entry originated from the southbound, and return the generated mapping.- Parameters:
key
- Key of the mapping- Returns:
- Returns the generated negative mapping (which is never null).
-
getMapping
MappingData getMapping(MappingOrigin origin, Eid key)
Retrieves mapping with given origin for the provided key. The lookup policy for the key is defined in the Mapping System.- Parameters:
origin
- Table where the mapping should be looked up.key
- Key to be looked up- Returns:
- Returns the mapping found in the Mapping System or null if nothing is found.
-
getMapping
MappingData getMapping(Eid key)
Retrieves mapping for given key.The lookup policy for the key is defined in the Mapping System.- Parameters:
key
- Key to be looked up- Returns:
- Returns the mapping found in the Mapping System or null if nothing is found.
-
getMapping
MappingData getMapping(Eid srcKey, Eid dstKey)
Retrieves mapping with a Source/Dest policy. This method is meant to avoid the overhead of building LcafSourceDest addresses.- Parameters:
srcKey
- Source key being looked updstKey
- Destination key being looked up- Returns:
- Returns the mapping found in the Mapping System or null if nothing is found.
-
getWidestNegativePrefix
Eid getWidestNegativePrefix(Eid key)
Retrieves widest negative prefix found in the Mapping System for given key.- Parameters:
key
- Key being looked up- Returns:
- Returns the widest negative prefix or null if nothing is found.
-
getSubtree
java.util.Set<Eid> getSubtree(MappingOrigin origin, Eid key)
Retrieves the subtree of a maskable prefix from the given map-cache.- Parameters:
origin
- Table where the key should be looked upkey
- Key to be looked up- Returns:
- The child prefixes of the prefix, including the prefix itself if present
-
refreshMappingRegistration
void refreshMappingRegistration(Eid key, XtrId xtrId, java.lang.Long timestamp)
Refresh southbound mapping registration timestamp.- Parameters:
key
- The EID whose registration must be refreshedxtrId
- xTR-ID of the mapping to be refreshedtimestamp
- New timestamp for the mapping
-
removeMapping
void removeMapping(MappingOrigin origin, Eid key)
Remove mapping.- Parameters:
origin
- Table from where the mapping should be removedkey
- Key to be removed
-
addAuthenticationKey
void addAuthenticationKey(Eid key, MappingAuthkey authKey)
Add authentication key.- Parameters:
key
- The key for which the authentication key is addedauthKey
- The authentication key
-
subscribe
void subscribe(Subscriber subscriber, Eid subscribedEid)
Subscribe a Subscriber to receive updates about mapping changes for an EID.- Parameters:
subscriber
- The Subscriber object with information about the subscribersubscribedEid
- The EID for which the subscriber will receive updates
-
getSubscribers
java.util.Set<Subscriber> getSubscribers(Eid eid)
Retrieves the subscribers for an EID.- Parameters:
eid
- The EID to be looked up- Returns:
- The set of subscribers for the EID
-
getAuthenticationKey
MappingAuthkey getAuthenticationKey(Eid key)
Retrieve authentication key.- Parameters:
key
- The key for which the authentication key is being looked up.- Returns:
- The authentication key.
-
removeAuthenticationKey
void removeAuthenticationKey(Eid key)
Remove authentication key.- Parameters:
key
- Key for which the authentication key should be removed.
-
addData
void addData(MappingOrigin origin, Eid key, java.lang.String subKey, java.lang.Object data)
Generic addition of data. Not stored in MD-SAL datastore!- Parameters:
origin
- Table where data should be insertedkey
- The key where data should be insertedsubKey
- The subKey where data should be inserteddata
- The data to be stored
-
getData
java.lang.Object getData(MappingOrigin origin, Eid key, java.lang.String subKey)
Generic retrieval of data.- Parameters:
origin
- Table from where the data should be readkey
- The key where the data is storedsubKey
- The subKey where data is stored- Returns:
- The data
-
removeData
void removeData(MappingOrigin origin, Eid key, java.lang.String subKey)
Generic removal of data.- Parameters:
origin
- The table from where the data should be removedkey
- The key of the data to be removedsubKey
- The subKey of the data to be removed
-
getParentPrefix
Eid getParentPrefix(Eid key)
Returns the parent prefix for given key.- Parameters:
key
- The key which parent is to be returned.- Returns:
- The parent perfix of a specific key.
-
setMappingMerge
void setMappingMerge(boolean mappingMerge)
Configures Mapping Service mapping merge option. If set to false, mappings with the same key are overwritten, otherwise, mappings with the same key but from different xTR-IDs are all stored.- Parameters:
mappingMerge
- enables or disables mapping merge
-
setLookupPolicy
void setLookupPolicy(IMappingService.LookupPolicy policy)
Configures Mapping Service mapping lookup policy option.- Parameters:
policy
- the policy to be activated
-
printMappings
java.lang.String printMappings()
Print all mappings. Used for testing, debugging and the karaf shell.- Returns:
- String consisting of all mappings
-
prettyPrintMappings
java.lang.String prettyPrintMappings()
Print mappings in cache in a human friendly format.- Returns:
- a String consisting of all the mappings in the cache
-
printKeys
java.lang.String printKeys()
Print all authentication keys. Used for testing, debugging and the karaf shell.- Returns:
- String consisting of all mappings
-
prettyPrintKeys
java.lang.String prettyPrintKeys()
Print keys in cache in a human friendly format.- Returns:
- a String consisting of all the keys in the cache
-
cleanCachedMappings
void cleanCachedMappings()
Cleans all cached mappings.Used for testing.
-
setIsMaster
void setIsMaster(boolean isMaster)
Set cluster master status.- Parameters:
isMaster
- is|isn't master
-
isMaster
boolean isMaster()
Get cluster master status.- Returns:
- isMaster is|isn't master
-
-