Class MappingSystem

  • All Implemented Interfaces:
    IMappingSystem

    public class MappingSystem
    extends java.lang.Object
    implements IMappingSystem
    The Mapping System coordinates caching of md-sal stored mappings and if so configured enables longest prefix match mapping lookups.
    Author:
    Florin Coras, Lorand Jakab
    • Constructor Detail

      • MappingSystem

        public MappingSystem​(ILispDAO dao,
                             boolean iterateMask,
                             org.opendaylight.mdsal.binding.api.NotificationPublishService nps,
                             boolean mappingMerge)
    • Method Detail

      • setDataStoreBackEnd

        public void setDataStoreBackEnd​(DataStoreBackEnd dataStoreBackEnd)
      • setMappingMerge

        public void setMappingMerge​(boolean mappingMerge)
        Description copied from interface: IMappingSystem
        Configure merge policy. If set to true, mappings are merged.
        Specified by:
        setMappingMerge in interface IMappingSystem
        Parameters:
        mappingMerge - Value to configure
      • setIterateMask

        public void setIterateMask​(boolean iterate)
        Description copied from interface: IMappingSystem
        Sets iterateMask. If set to true, longest prefix matching for IP keys is used.
        Specified by:
        setIterateMask in interface IMappingSystem
        Parameters:
        iterate - Value to configure
      • initialize

        public void initialize()
      • updateMapping

        public void updateMapping​(MappingOrigin origin,
                                  Eid key,
                                  MappingData mappingData)
        Description copied from interface: IMappingSystem
        Update mapping.
        Specified by:
        updateMapping in interface IMappingSystem
        Parameters:
        origin - Table where mapping should be added
        key - Key of the mapping
        mappingData - Mapping to be stored
      • addMapping

        public void addMapping​(MappingOrigin origin,
                               Eid key,
                               MappingData mappingData)
        Description copied from interface: IMappingSystem
        Add mapping.
        Specified by:
        addMapping in interface IMappingSystem
        Parameters:
        origin - Table where mapping should be added
        key - Key of the mapping
        mappingData - Mapping to be stored
      • addNegativeMapping

        public MappingData addNegativeMapping​(Eid key)
        Description copied from interface: IMappingSystem
        Generate and add a negative mapping entry originated from the southbound, and return the generated mapping.
        Specified by:
        addNegativeMapping in interface IMappingSystem
        Parameters:
        key - Key of the mapping
        Returns:
        Returns the generated negative mapping (which is never null).
      • refreshMappingRegistration

        public void refreshMappingRegistration​(Eid key,
                                               XtrId xtrId,
                                               java.lang.Long timestamp)
        Description copied from interface: IMappingSystem
        Refresh southbound mapping registration timestamp.
        Specified by:
        refreshMappingRegistration in interface IMappingSystem
        Parameters:
        key - The EID whose registration must be refreshed
        xtrId - xTR-ID of the mapping to be refreshed
        timestamp - New timestamp for the mapping
      • getMapping

        public MappingData getMapping​(Eid src,
                                      Eid dst)
        Description copied from interface: IMappingSystem
        Retrieves mapping for the provided src and dst key.
        Specified by:
        getMapping in interface IMappingSystem
        Parameters:
        src - Source Key to be looked up
        dst - Destination Key to be looked up
        Returns:
        Returns the mapping found in the MappingSystem or null if nothing is found.
      • getMapping

        public MappingData getMapping​(Eid dst)
        Description copied from interface: IMappingSystem
        Retrieves mapping for the provided dst key.
        Specified by:
        getMapping in interface IMappingSystem
        Parameters:
        dst - Destination Key to be looked up
        Returns:
        Returns the mapping found in the Mapping System or null if nothing is found.
      • getMapping

        public MappingData getMapping​(Eid src,
                                      Eid dst,
                                      XtrId xtrId)
        Description copied from interface: IMappingSystem
        Retrieves mapping for the provided dst key for a particular xtr id.
        Specified by:
        getMapping in interface IMappingSystem
        Parameters:
        src - Source Key to be looked up.
        dst - Destination Key to be looked up.
        xtrId - Xtr Id for which this look to be done. If null, this method works like regular getMapping(src, dst)
        Returns:
        Returns the mapping found in the simple map cache or null if nothing is found.
      • getMapping

        public MappingData getMapping​(MappingOrigin origin,
                                      Eid key)
        Description copied from interface: IMappingSystem
        Retrieves mapping from table for provided key.
        Specified by:
        getMapping in interface IMappingSystem
        Parameters:
        origin - Table where mapping should be looked up
        key - Key to be looked up
        Returns:
        Returns the mapping found in the cache or null if nothing is found.
      • getWidestNegativePrefix

        public Eid getWidestNegativePrefix​(Eid key)
        Description copied from interface: IMappingSystem
        Retrieves widest negative prefix from table for provided key.
        Specified by:
        getWidestNegativePrefix in interface IMappingSystem
        Parameters:
        key - Key to be looked up
        Returns:
        Returns the prefix found in the cache or null if nothing is found.
      • getSubtree

        public java.util.Set<Eid> getSubtree​(MappingOrigin origin,
                                             Eid key)
        Description copied from interface: IMappingSystem
        Retrieves the subtree of a maskable prefix from the given map-cache.
        Specified by:
        getSubtree in interface IMappingSystem
        Parameters:
        origin - Table where the key should be looked up
        key - Key to be looked up
        Returns:
        The child prefixes of the prefix, including the prefix itself if present
      • removeMapping

        public void removeMapping​(MappingOrigin origin,
                                  Eid key)
        Description copied from interface: IMappingSystem
        Remove mapping.
        Specified by:
        removeMapping in interface IMappingSystem
        Parameters:
        origin - Table for mapping that should be removed
        key - Key to be removed
      • subscribe

        public void subscribe​(Subscriber subscriber,
                              Eid subscribedEid)
        Description copied from interface: IMappingSystem
        Subscribe a Subscriber to receive updates about mapping changes for an EID.
        Specified by:
        subscribe in interface IMappingSystem
        Parameters:
        subscriber - The Subscriber object with information about the subscriber
        subscribedEid - The EID for which the subscriber will receive updates
      • getSubscribers

        public java.util.Set<Subscriber> getSubscribers​(Eid address)
        Description copied from interface: IMappingSystem
        Retrieves the subscribers for an EID.
        Specified by:
        getSubscribers in interface IMappingSystem
        Parameters:
        address - The EID to be looked up
        Returns:
        The set of subscribers for the EID
      • addAuthenticationKey

        public void addAuthenticationKey​(Eid key,
                                         MappingAuthkey authKey)
        Description copied from interface: IMappingSystem
        Add authentication key.
        Specified by:
        addAuthenticationKey in interface IMappingSystem
        Parameters:
        key - The key for which the authentication key is added
        authKey - The authentication key
      • getAuthenticationKey

        public MappingAuthkey getAuthenticationKey​(Eid key)
        Description copied from interface: IMappingSystem
        Retrieve authentication key.
        Specified by:
        getAuthenticationKey in interface IMappingSystem
        Parameters:
        key - The key for which the authentication key is being looked up.
        Returns:
        The authentication key.
      • removeAuthenticationKey

        public void removeAuthenticationKey​(Eid key)
        Description copied from interface: IMappingSystem
        Remove authentication key.
        Specified by:
        removeAuthenticationKey in interface IMappingSystem
        Parameters:
        key - Key for which the authentication key should be removed.
      • addData

        public void addData​(MappingOrigin origin,
                            Eid key,
                            java.lang.String subKey,
                            java.lang.Object data)
        Description copied from interface: IMappingSystem
        Add data for key.
        Specified by:
        addData in interface IMappingSystem
        Parameters:
        origin - Table for data that should be added
        key - The key for which data is inserted
        subKey - The subKey where data should be inserted
        data - The data to be stored
      • getData

        public java.lang.Object getData​(MappingOrigin origin,
                                        Eid key,
                                        java.lang.String subKey)
        Description copied from interface: IMappingSystem
        Generic retrieval of data.
        Specified by:
        getData in interface IMappingSystem
        Parameters:
        origin - Table from where data should be retrieved
        key - The key where the data is stored
        subKey - The subKey where data is stored
        Returns:
        The data
      • removeData

        public void removeData​(MappingOrigin origin,
                               Eid key,
                               java.lang.String subKey)
        Description copied from interface: IMappingSystem
        Generic removal of data.
        Specified by:
        removeData in interface IMappingSystem
        Parameters:
        origin - Table from where data should be removed
        key - The key of the data to be removed
        subKey - The subKey of the data to be removed
      • getParentPrefix

        public Eid getParentPrefix​(Eid key)
        Description copied from interface: IMappingSystem
        Returns the parent prefix for given key.
        Specified by:
        getParentPrefix in interface IMappingSystem
        Parameters:
        key - The key which parent is to be returned.
        Returns:
        The parent perfix of a specific key.
      • destroy

        public void destroy()
      • printMappings

        public java.lang.String printMappings()
        Description copied from interface: IMappingSystem
        Print all mappings. Used for testing, debugging and the karaf shell.
        Specified by:
        printMappings in interface IMappingSystem
        Returns:
        String consisting of all mappings
      • prettyPrintMappings

        public java.lang.String prettyPrintMappings()
        Description copied from interface: IMappingSystem
        Print mappings in cache in a human friendly format.
        Specified by:
        prettyPrintMappings in interface IMappingSystem
        Returns:
        a String consisting of all the mappings in the cache
      • printKeys

        public java.lang.String printKeys()
        Description copied from interface: IMappingSystem
        Print all authentication keys. Used for testing, debugging and the karaf shell.
        Specified by:
        printKeys in interface IMappingSystem
        Returns:
        String consisting of all mappings
      • prettyPrintKeys

        public java.lang.String prettyPrintKeys()
        Description copied from interface: IMappingSystem
        Print keys in cache in a human friendly format.
        Specified by:
        prettyPrintKeys in interface IMappingSystem
        Returns:
        a String consisting of all the keys in the cache
      • cleanCaches

        public void cleanCaches()
      • cleanSBMappings

        public void cleanSBMappings()
      • setIsMaster

        public void setIsMaster​(boolean isMaster)
        Description copied from interface: IMappingSystem
        Set cluster master status.
        Specified by:
        setIsMaster in interface IMappingSystem
        Parameters:
        isMaster - is|isn't master
      • isMaster

        public boolean isMaster()
        Description copied from interface: IMappingSystem
        Get cluster master status.
        Specified by:
        isMaster in interface IMappingSystem
        Returns:
        isMaster is|isn't master