Class MappingService
java.lang.Object
org.opendaylight.lispflowmapping.implementation.MappingService
- All Implemented Interfaces:
AutoCloseable,IMappingService,OdlMappingserviceService,org.opendaylight.yangtools.yang.binding.RpcService
public class MappingService
extends Object
implements OdlMappingserviceService, IMappingService, AutoCloseable
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
ConstructorsConstructorDescriptionMappingService(org.opendaylight.mdsal.binding.api.DataBroker broker, org.opendaylight.mdsal.binding.api.NotificationPublishService notificationPublishService, ILispDAO lispDAO) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAuthenticationKey(Eid key, MappingAuthkey authKey) Add authentication key.voidaddData(MappingOrigin origin, Eid key, String subKey, Object data) Generic addition of data.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<AddKeyOutput>>addKey(AddKeyInput input) Invokeadd-keyRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<AddKeysOutput>>addKeys(AddKeysInput input) Invokeadd-keysRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<AddMappingOutput>>addMapping(AddMappingInput input) Invokeadd-mappingRPC.voidaddMapping(MappingOrigin origin, Eid key, SiteId siteId, MappingData mappingData) Add mapping.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<AddMappingsOutput>>addMappings(AddMappingsInput input) Invokeadd-mappingsRPC.addNegativeMapping(Eid key) Generate and add a negative mapping entry originated from the southbound, and return the generated mapping.voidCleans all cached mappings.Used for testing.voidclose()com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetAllKeysOutput>>getAllKeys(GetAllKeysInput input) Invokeget-all-keysRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetAllMappingsOutput>>Invokeget-all-mappingsRPC.getAuthenticationKey(Eid key) Retrieve authentication key.getData(MappingOrigin origin, Eid key, String subKey) Generic retrieval of data.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetKeyOutput>>getKey(GetKeyInput input) Invokeget-keyRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetKeysOutput>>getKeys(GetKeysInput input) Invokeget-keysRPC.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.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetMappingOutput>>getMapping(GetMappingInput input) Invokeget-mappingRPC.getMapping(MappingOrigin origin, Eid key) Retrieves mapping with given origin for the provided key.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetMappingsOutput>>getMappings(GetMappingsInput input) Invokeget-mappingsRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetMappingWithXtrIdOutput>>Invokeget-mapping-with-xtr-idRPC.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.voidbooleanisMaster()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.voidrefreshMappingRegistration(Eid key, XtrId xtrId, Long timestamp) Refresh southbound mapping registration timestamp.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<RemoveAllKeysOutput>>removeAllKeys(RemoveAllKeysInput input) Invokeremove-all-keysRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<RemoveAllMappingsOutput>>Invokeremove-all-mappingsRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<RemoveAllOperationalContentOutput>>Invokeremove-all-operational-contentRPC.voidRemove authentication key.voidremoveData(MappingOrigin origin, Eid key, String subKey) Generic removal of data.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<RemoveKeyOutput>>removeKey(RemoveKeyInput input) Invokeremove-keyRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<RemoveKeysOutput>>removeKeys(RemoveKeysInput input) Invokeremove-keysRPC.voidremoveMapping(MappingOrigin origin, Eid key) Remove mapping.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<RemoveMappingOutput>>removeMapping(RemoveMappingInput input) Invokeremove-mappingRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<RemoveMappingsOutput>>Invokeremove-mappingsRPC.voidsetIsMaster(boolean isMaster) Set cluster master status.voidConfigures Mapping Service mapping lookup policy option.voidsetMappingMerge(boolean mergeMapping) Configures Mapping Service mapping merge option.voidsubscribe(Subscriber subscriber, Eid subscribedEid) Subscribe a Subscriber to receive updates about mapping changes for an EID.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<UpdateKeyOutput>>updateKey(UpdateKeyInput input) Invokeupdate-keyRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<UpdateKeysOutput>>updateKeys(UpdateKeysInput input) Invokeupdate-keysRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<UpdateMappingOutput>>updateMapping(UpdateMappingInput input) Invokeupdate-mappingRPC.com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<UpdateMappingsOutput>>Invokeupdate-mappingsRPC.
-
Constructor Details
-
MappingService
public MappingService(org.opendaylight.mdsal.binding.api.DataBroker broker, org.opendaylight.mdsal.binding.api.NotificationPublishService notificationPublishService, ILispDAO lispDAO)
-
-
Method Details
-
setMappingMerge
public void setMappingMerge(boolean mergeMapping) Description copied from interface:IMappingServiceConfigures 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:
setMappingMergein interfaceIMappingService- Parameters:
mergeMapping- enables or disables mapping merge
-
setLookupPolicy
Description copied from interface:IMappingServiceConfigures Mapping Service mapping lookup policy option.- Specified by:
setLookupPolicyin interfaceIMappingService- Parameters:
policy- the policy to be activated
-
initialize
public void initialize() -
addKey
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<AddKeyOutput>> addKey(AddKeyInput input) Description copied from interface:OdlMappingserviceServiceInvokeadd-keyRPC.- Specified by:
addKeyin interfaceOdlMappingserviceService- Parameters:
input- ofadd-key- Returns:
- output of
add-key
-
addMapping
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<AddMappingOutput>> addMapping(AddMappingInput input) Description copied from interface:OdlMappingserviceServiceInvokeadd-mappingRPC.- Specified by:
addMappingin interfaceOdlMappingserviceService- Parameters:
input- ofadd-mapping- Returns:
- output of
add-mapping
-
addMapping
Description copied from interface:IMappingServiceAdd mapping.- Specified by:
addMappingin 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:IMappingServiceGenerate and add a negative mapping entry originated from the southbound, and return the generated mapping.- Specified by:
addNegativeMappingin interfaceIMappingService- Parameters:
key- Key of the mapping- Returns:
- Returns the generated negative mapping (which is never null).
-
refreshMappingRegistration
Description copied from interface:IMappingServiceRefresh southbound mapping registration timestamp.- Specified by:
refreshMappingRegistrationin interfaceIMappingService- Parameters:
key- The EID whose registration must be refreshedxtrId- xTR-ID of the mapping to be refreshedtimestamp- New timestamp for the mapping
-
getKey
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetKeyOutput>> getKey(GetKeyInput input) Description copied from interface:OdlMappingserviceServiceInvokeget-keyRPC.- Specified by:
getKeyin interfaceOdlMappingserviceService- Parameters:
input- ofget-key- Returns:
- output of
get-key
-
getMapping
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetMappingOutput>> getMapping(GetMappingInput input) Description copied from interface:OdlMappingserviceServiceInvokeget-mappingRPC.- Specified by:
getMappingin interfaceOdlMappingserviceService- Parameters:
input- ofget-mapping- Returns:
- output of
get-mapping
-
getMapping
Description copied from interface:IMappingServiceRetrieves mapping with given origin for the provided key. The lookup policy for the key is defined in the Mapping System.- Specified by:
getMappingin 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:IMappingServiceRetrieves mapping for given key.The lookup policy for the key is defined in the Mapping System.- Specified by:
getMappingin 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:IMappingServiceRetrieves mapping with a Source/Dest policy. This method is meant to avoid the overhead of building LcafSourceDest addresses.- Specified by:
getMappingin 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:IMappingServiceSubscribe a Subscriber to receive updates about mapping changes for an EID.- Specified by:
subscribein 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:IMappingServiceRetrieves the subscribers for an EID.- Specified by:
getSubscribersin interfaceIMappingService- Parameters:
eid- The EID to be looked up- Returns:
- The set of subscribers for the EID
-
getMappingWithXtrId
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetMappingWithXtrIdOutput>> getMappingWithXtrId(GetMappingWithXtrIdInput input) Description copied from interface:OdlMappingserviceServiceInvokeget-mapping-with-xtr-idRPC.- Specified by:
getMappingWithXtrIdin interfaceOdlMappingserviceService- Parameters:
input- ofget-mapping-with-xtr-id- Returns:
- output of
get-mapping-with-xtr-id
-
removeKey
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<RemoveKeyOutput>> removeKey(RemoveKeyInput input) Description copied from interface:OdlMappingserviceServiceInvokeremove-keyRPC.- Specified by:
removeKeyin interfaceOdlMappingserviceService- Parameters:
input- ofremove-key- Returns:
- output of
remove-key
-
removeMapping
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<RemoveMappingOutput>> removeMapping(RemoveMappingInput input) Description copied from interface:OdlMappingserviceServiceInvokeremove-mappingRPC.- Specified by:
removeMappingin interfaceOdlMappingserviceService- Parameters:
input- ofremove-mapping- Returns:
- output of
remove-mapping
-
removeMapping
Description copied from interface:IMappingServiceRemove mapping.- Specified by:
removeMappingin interfaceIMappingService- Parameters:
origin- Table from where the mapping should be removedkey- Key to be removed
-
updateKey
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<UpdateKeyOutput>> updateKey(UpdateKeyInput input) Description copied from interface:OdlMappingserviceServiceInvokeupdate-keyRPC.- Specified by:
updateKeyin interfaceOdlMappingserviceService- Parameters:
input- ofupdate-key- Returns:
- output of
update-key
-
updateMapping
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<UpdateMappingOutput>> updateMapping(UpdateMappingInput input) Description copied from interface:OdlMappingserviceServiceInvokeupdate-mappingRPC.- Specified by:
updateMappingin interfaceOdlMappingserviceService- Parameters:
input- ofupdate-mapping- Returns:
- output of
update-mapping
-
removeKeys
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<RemoveKeysOutput>> removeKeys(RemoveKeysInput input) Description copied from interface:OdlMappingserviceServiceInvokeremove-keysRPC.- Specified by:
removeKeysin interfaceOdlMappingserviceService- Parameters:
input- ofremove-keys- Returns:
- output of
remove-keys
-
removeMappings
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<RemoveMappingsOutput>> removeMappings(RemoveMappingsInput input) Description copied from interface:OdlMappingserviceServiceInvokeremove-mappingsRPC.- Specified by:
removeMappingsin interfaceOdlMappingserviceService- Parameters:
input- ofremove-mappings- Returns:
- output of
remove-mappings
-
getKeys
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetKeysOutput>> getKeys(GetKeysInput input) Description copied from interface:OdlMappingserviceServiceInvokeget-keysRPC.- Specified by:
getKeysin interfaceOdlMappingserviceService- Parameters:
input- ofget-keys- Returns:
- output of
get-keys
-
addMappings
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<AddMappingsOutput>> addMappings(AddMappingsInput input) Description copied from interface:OdlMappingserviceServiceInvokeadd-mappingsRPC.- Specified by:
addMappingsin interfaceOdlMappingserviceService- Parameters:
input- ofadd-mappings- Returns:
- output of
add-mappings
-
updateKeys
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<UpdateKeysOutput>> updateKeys(UpdateKeysInput input) Description copied from interface:OdlMappingserviceServiceInvokeupdate-keysRPC.- Specified by:
updateKeysin interfaceOdlMappingserviceService- Parameters:
input- ofupdate-keys- Returns:
- output of
update-keys
-
removeAllMappings
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<RemoveAllMappingsOutput>> removeAllMappings(RemoveAllMappingsInput input) Description copied from interface:OdlMappingserviceServiceInvokeremove-all-mappingsRPC.- Specified by:
removeAllMappingsin interfaceOdlMappingserviceService- Parameters:
input- ofremove-all-mappings- Returns:
- output of
remove-all-mappings
-
removeAllKeys
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<RemoveAllKeysOutput>> removeAllKeys(RemoveAllKeysInput input) Description copied from interface:OdlMappingserviceServiceInvokeremove-all-keysRPC.- Specified by:
removeAllKeysin interfaceOdlMappingserviceService- Parameters:
input- ofremove-all-keys- Returns:
- output of
remove-all-keys
-
getAllKeys
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetAllKeysOutput>> getAllKeys(GetAllKeysInput input) Description copied from interface:OdlMappingserviceServiceInvokeget-all-keysRPC.- Specified by:
getAllKeysin interfaceOdlMappingserviceService- Parameters:
input- ofget-all-keys- Returns:
- output of
get-all-keys
-
updateMappings
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<UpdateMappingsOutput>> updateMappings(UpdateMappingsInput input) Description copied from interface:OdlMappingserviceServiceInvokeupdate-mappingsRPC.- Specified by:
updateMappingsin interfaceOdlMappingserviceService- Parameters:
input- ofupdate-mappings- Returns:
- output of
update-mappings
-
addKeys
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<AddKeysOutput>> addKeys(AddKeysInput input) Description copied from interface:OdlMappingserviceServiceInvokeadd-keysRPC.- Specified by:
addKeysin interfaceOdlMappingserviceService- Parameters:
input- ofadd-keys- Returns:
- output of
add-keys
-
getAllMappings
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetAllMappingsOutput>> getAllMappings(GetAllMappingsInput input) Description copied from interface:OdlMappingserviceServiceInvokeget-all-mappingsRPC.- Specified by:
getAllMappingsin interfaceOdlMappingserviceService- Parameters:
input- ofget-all-mappings- Returns:
- output of
get-all-mappings
-
getMappings
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<GetMappingsOutput>> getMappings(GetMappingsInput input) Description copied from interface:OdlMappingserviceServiceInvokeget-mappingsRPC.- Specified by:
getMappingsin interfaceOdlMappingserviceService- Parameters:
input- ofget-mappings- Returns:
- output of
get-mappings
-
removeAllOperationalContent
public com.google.common.util.concurrent.ListenableFuture<org.opendaylight.yangtools.yang.common.RpcResult<RemoveAllOperationalContentOutput>> removeAllOperationalContent(RemoveAllOperationalContentInput input) Description copied from interface:OdlMappingserviceServiceInvokeremove-all-operational-contentRPC.- Specified by:
removeAllOperationalContentin interfaceOdlMappingserviceService- Parameters:
input- ofremove-all-operational-content- Returns:
- output of
remove-all-operational-content
-
getWidestNegativePrefix
Description copied from interface:IMappingServiceRetrieves widest negative prefix found in the Mapping System for given key.- Specified by:
getWidestNegativePrefixin interfaceIMappingService- Parameters:
key- Key being looked up- Returns:
- Returns the widest negative prefix or null if nothing is found.
-
getSubtree
Description copied from interface:IMappingServiceRetrieves the subtree of a maskable prefix from the given map-cache.- Specified by:
getSubtreein 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:IMappingServiceAdd authentication key.- Specified by:
addAuthenticationKeyin interfaceIMappingService- Parameters:
key- The key for which the authentication key is addedauthKey- The authentication key
-
getAuthenticationKey
Description copied from interface:IMappingServiceRetrieve authentication key.- Specified by:
getAuthenticationKeyin interfaceIMappingService- Parameters:
key- The key for which the authentication key is being looked up.- Returns:
- The authentication key.
-
removeAuthenticationKey
Description copied from interface:IMappingServiceRemove authentication key.- Specified by:
removeAuthenticationKeyin interfaceIMappingService- Parameters:
key- Key for which the authentication key should be removed.
-
addData
Description copied from interface:IMappingServiceGeneric addition of data. Not stored in MD-SAL datastore!- Specified by:
addDatain 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:IMappingServiceGeneric retrieval of data.- Specified by:
getDatain 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:IMappingServiceGeneric removal of data.- Specified by:
removeDatain 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:IMappingServiceReturns the parent prefix for given key.- Specified by:
getParentPrefixin interfaceIMappingService- Parameters:
key- The key which parent is to be returned.- Returns:
- The parent perfix of a specific key.
-
printMappings
Description copied from interface:IMappingServicePrint all mappings. Used for testing, debugging and the karaf shell.- Specified by:
printMappingsin interfaceIMappingService- Returns:
- String consisting of all mappings
-
prettyPrintMappings
Description copied from interface:IMappingServicePrint mappings in cache in a human friendly format.- Specified by:
prettyPrintMappingsin interfaceIMappingService- Returns:
- a String consisting of all the mappings in the cache
-
printKeys
Description copied from interface:IMappingServicePrint all authentication keys. Used for testing, debugging and the karaf shell.- Specified by:
printKeysin interfaceIMappingService- Returns:
- String consisting of all mappings
-
prettyPrintKeys
Description copied from interface:IMappingServicePrint keys in cache in a human friendly format.- Specified by:
prettyPrintKeysin interfaceIMappingService- Returns:
- a String consisting of all the keys in the cache
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
cleanCachedMappings
public void cleanCachedMappings()Description copied from interface:IMappingServiceCleans all cached mappings.Used for testing.- Specified by:
cleanCachedMappingsin interfaceIMappingService
-
setIsMaster
public void setIsMaster(boolean isMaster) Description copied from interface:IMappingServiceSet cluster master status.- Specified by:
setIsMasterin interfaceIMappingService- Parameters:
isMaster- is|isn't master
-
isMaster
public boolean isMaster()Description copied from interface:IMappingServiceGet cluster master status.- Specified by:
isMasterin interfaceIMappingService- Returns:
- isMaster is|isn't master
-