Class MappingService
java.lang.Object
org.opendaylight.lispflowmapping.implementation.MappingService
- All Implemented Interfaces:
AutoCloseable
,IMappingService
Dispatcher of API calls that implements the RPC and Java APIs in mappingservice.yang and IMappingService
respectively. It also coordinates and acts as container for all objects in charge of
- saving and updating md-sal datastore stored mappings
- monitoring md-sal datastore mapping updates and pushing them to the in memory mapping-system
- in memory mapping-system
- Author:
- Lorand Jakab, Florin Coras
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingService
IMappingService.LookupPolicy
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAuthenticationKey
(Eid key, MappingAuthkey authKey) Add authentication key.void
addData
(MappingOrigin origin, Eid key, String subKey, Object data) Generic addition of data.void
addMapping
(MappingOrigin origin, Eid key, SiteId siteId, MappingData mappingData) Add mapping.addNegativeMapping
(Eid key) Generate and add a negative mapping entry originated from the southbound, and return the generated mapping.void
Cleans all cached mappings.Used for testing.void
close()
getAuthenticationKey
(Eid key) Retrieve authentication key.getData
(MappingOrigin origin, Eid key, String subKey) Generic retrieval of data.getMapping
(Eid key) Retrieves mapping for given key.The lookup policy for the key is defined in the Mapping System.getMapping
(Eid srcKey, Eid dstKey) Retrieves mapping with a Source/Dest policy.getMapping
(MappingOrigin origin, Eid key) Retrieves mapping with given origin for the provided key.getParentPrefix
(Eid key) Returns the parent prefix for given key.getSubscribers
(Eid eid) Retrieves the subscribers for an EID.getSubtree
(MappingOrigin origin, Eid key) Retrieves the subtree of a maskable prefix from the given map-cache.Retrieves widest negative prefix found in the Mapping System for given key.void
boolean
isMaster()
Get cluster master status.Print keys in cache in a human friendly format.Print mappings in cache in a human friendly format.Print all authentication keys.Print all mappings.void
refreshMappingRegistration
(Eid key, XtrId xtrId, Long timestamp) Refresh southbound mapping registration timestamp.void
Remove authentication key.void
removeData
(MappingOrigin origin, Eid key, String subKey) Generic removal of data.void
removeMapping
(MappingOrigin origin, Eid key) Remove mapping.void
setIsMaster
(boolean isMaster) Set cluster master status.void
Configures Mapping Service mapping lookup policy option.void
setMappingMerge
(boolean mergeMapping) Configures Mapping Service mapping merge option.void
subscribe
(Subscriber subscriber, Eid subscribedEid) Subscribe a Subscriber to receive updates about mapping changes for an EID.
-
Constructor Details
-
MappingService
public MappingService()
-
-
Method Details
-
setMappingMerge
public void setMappingMerge(boolean mergeMapping) Description copied from interface:IMappingService
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.- Specified by:
setMappingMerge
in interfaceIMappingService
- Parameters:
mergeMapping
- enables or disables mapping merge
-
setLookupPolicy
Description copied from interface:IMappingService
Configures Mapping Service mapping lookup policy option.- Specified by:
setLookupPolicy
in interfaceIMappingService
- Parameters:
policy
- the policy to be activated
-
initialize
public void initialize() -
addMapping
Description copied from interface:IMappingService
Add mapping.- Specified by:
addMapping
in interfaceIMappingService
- Parameters:
origin
- Table where mapping should be addedkey
- Key of the mappingsiteId
- Site that stores the mappingmappingData
- Mapping to be stored
-
addNegativeMapping
Description copied from interface:IMappingService
Generate and add a negative mapping entry originated from the southbound, and return the generated mapping.- Specified by:
addNegativeMapping
in interfaceIMappingService
- Parameters:
key
- Key of the mapping- Returns:
- Returns the generated negative mapping (which is never null).
-
refreshMappingRegistration
Description copied from interface:IMappingService
Refresh southbound mapping registration timestamp.- Specified by:
refreshMappingRegistration
in interfaceIMappingService
- Parameters:
key
- The EID whose registration must be refreshedxtrId
- xTR-ID of the mapping to be refreshedtimestamp
- New timestamp for the mapping
-
getMapping
Description copied from interface:IMappingService
Retrieves mapping with given origin for the provided key. The lookup policy for the key is defined in the Mapping System.- Specified by:
getMapping
in interfaceIMappingService
- 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
Description copied from interface:IMappingService
Retrieves mapping for given key.The lookup policy for the key is defined in the Mapping System.- Specified by:
getMapping
in interfaceIMappingService
- Parameters:
key
- Key to be looked up- Returns:
- Returns the mapping found in the Mapping System or null if nothing is found.
-
getMapping
Description copied from interface:IMappingService
Retrieves mapping with a Source/Dest policy. This method is meant to avoid the overhead of building LcafSourceDest addresses.- Specified by:
getMapping
in interfaceIMappingService
- 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.
-
subscribe
Description copied from interface:IMappingService
Subscribe a Subscriber to receive updates about mapping changes for an EID.- Specified by:
subscribe
in interfaceIMappingService
- Parameters:
subscriber
- The Subscriber object with information about the subscribersubscribedEid
- The EID for which the subscriber will receive updates
-
getSubscribers
Description copied from interface:IMappingService
Retrieves the subscribers for an EID.- Specified by:
getSubscribers
in interfaceIMappingService
- Parameters:
eid
- The EID to be looked up- Returns:
- The set of subscribers for the EID
-
removeMapping
Description copied from interface:IMappingService
Remove mapping.- Specified by:
removeMapping
in interfaceIMappingService
- Parameters:
origin
- Table from where the mapping should be removedkey
- Key to be removed
-
getWidestNegativePrefix
Description copied from interface:IMappingService
Retrieves widest negative prefix found in the Mapping System for given key.- Specified by:
getWidestNegativePrefix
in interfaceIMappingService
- Parameters:
key
- Key being looked up- Returns:
- Returns the widest negative prefix or null if nothing is found.
-
getSubtree
Description copied from interface:IMappingService
Retrieves the subtree of a maskable prefix from the given map-cache.- Specified by:
getSubtree
in interfaceIMappingService
- 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
-
addAuthenticationKey
Description copied from interface:IMappingService
Add authentication key.- Specified by:
addAuthenticationKey
in interfaceIMappingService
- Parameters:
key
- The key for which the authentication key is addedauthKey
- The authentication key
-
getAuthenticationKey
Description copied from interface:IMappingService
Retrieve authentication key.- Specified by:
getAuthenticationKey
in interfaceIMappingService
- Parameters:
key
- The key for which the authentication key is being looked up.- Returns:
- The authentication key.
-
removeAuthenticationKey
Description copied from interface:IMappingService
Remove authentication key.- Specified by:
removeAuthenticationKey
in interfaceIMappingService
- Parameters:
key
- Key for which the authentication key should be removed.
-
addData
Description copied from interface:IMappingService
Generic addition of data. Not stored in MD-SAL datastore!- Specified by:
addData
in interfaceIMappingService
- 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
Description copied from interface:IMappingService
Generic retrieval of data.- Specified by:
getData
in interfaceIMappingService
- 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
Description copied from interface:IMappingService
Generic removal of data.- Specified by:
removeData
in interfaceIMappingService
- 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
Description copied from interface:IMappingService
Returns the parent prefix for given key.- Specified by:
getParentPrefix
in interfaceIMappingService
- Parameters:
key
- The key which parent is to be returned.- Returns:
- The parent perfix of a specific key.
-
printMappings
Description copied from interface:IMappingService
Print all mappings. Used for testing, debugging and the karaf shell.- Specified by:
printMappings
in interfaceIMappingService
- Returns:
- String consisting of all mappings
-
prettyPrintMappings
Description copied from interface:IMappingService
Print mappings in cache in a human friendly format.- Specified by:
prettyPrintMappings
in interfaceIMappingService
- Returns:
- a String consisting of all the mappings in the cache
-
printKeys
Description copied from interface:IMappingService
Print all authentication keys. Used for testing, debugging and the karaf shell.- Specified by:
printKeys
in interfaceIMappingService
- Returns:
- String consisting of all mappings
-
prettyPrintKeys
Description copied from interface:IMappingService
Print keys in cache in a human friendly format.- Specified by:
prettyPrintKeys
in interfaceIMappingService
- Returns:
- a String consisting of all the keys in the cache
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
cleanCachedMappings
public void cleanCachedMappings()Description copied from interface:IMappingService
Cleans all cached mappings.Used for testing.- Specified by:
cleanCachedMappings
in interfaceIMappingService
-
setIsMaster
public void setIsMaster(boolean isMaster) Description copied from interface:IMappingService
Set cluster master status.- Specified by:
setIsMaster
in interfaceIMappingService
- Parameters:
isMaster
- is|isn't master
-
isMaster
public boolean isMaster()Description copied from interface:IMappingService
Get cluster master status.- Specified by:
isMaster
in interfaceIMappingService
- Returns:
- isMaster is|isn't master
-