Class NaptManager


  • @Singleton
    public class NaptManager
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      NaptManager​(org.opendaylight.controller.md.sal.binding.api.DataBroker dataBroker, org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService idManager)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected @Nullable java.lang.String checkIpMap​(org.opendaylight.yangtools.yang.common.Uint32 segmentId, java.lang.String internalIp)  
      protected void createNaptPortPool​(java.lang.String poolName)  
      @Nullable SessionAddress getExternalAddressMapping​(org.opendaylight.yangtools.yang.common.Uint32 segmentId, SessionAddress sourceAddress, NAPTEntryEvent.Protocol protocol)
      method to get external ip/port mapping when provided with internal ip/port pair If already a mapping exist for the given input, then the existing mapping is returned instead of overwriting with new ip/port pair.
      protected @Nullable java.lang.String getExternalIpAllocatedForSubnet​(org.opendaylight.yangtools.yang.common.Uint32 segmentId, java.lang.String internalIp)  
      protected org.opendaylight.yangtools.yang.binding.InstanceIdentifier<ExternalIpCounter> getExternalIpsIdentifier​(org.opendaylight.yangtools.yang.common.Uint32 segmentId, java.lang.String external)  
      protected org.opendaylight.yangtools.yang.binding.InstanceIdentifier<IpMap> getIpMapIdentifier​(org.opendaylight.yangtools.yang.common.Uint32 segid, java.lang.String internal)  
      static @NonNull java.util.List<IpMap> getIpMapList​(org.opendaylight.controller.md.sal.binding.api.DataBroker broker, org.opendaylight.yangtools.yang.common.Uint32 routerId)  
      protected static org.opendaylight.yangtools.yang.binding.InstanceIdentifier<IpMapping> getIpMapList​(org.opendaylight.yangtools.yang.common.Uint32 routerId)  
      protected org.opendaylight.yangtools.yang.binding.InstanceIdentifier<IpPortMap> getIpPortMapIdentifier​(org.opendaylight.yangtools.yang.common.Uint32 segid, java.lang.String internal, NAPTEntryEvent.Protocol protocol)  
      protected void initialiseExternalCounter​(Routers routers, org.opendaylight.yangtools.yang.common.Uint32 routerId)  
      protected void initialiseNewExternalIpCounter​(org.opendaylight.yangtools.yang.common.Uint32 routerId, java.lang.String externalIp)  
      void registerMapping​(org.opendaylight.yangtools.yang.common.Uint32 segmentId, IPAddress internal, IPAddress external)
      This method is used to inform this service of what external IP address to be used as mapping when requested one for the internal IP address given in the input.
      protected void releaseIpExtPortMapping​(org.opendaylight.yangtools.yang.common.Uint32 segmentId, SessionAddress address, NAPTEntryEvent.Protocol protocol)  
      protected void removeExternalCounter​(org.opendaylight.yangtools.yang.common.Uint32 routerId)  
      protected void removeExternalIpCounter​(org.opendaylight.yangtools.yang.common.Uint32 routerId, java.lang.String externalIp)  
      protected void removeFromIpMapDS​(org.opendaylight.yangtools.yang.common.Uint32 segmentId, java.lang.String internalIp)  
      protected void removeFromIpPortMapDS​(org.opendaylight.yangtools.yang.common.Uint32 segmentId, java.lang.String internalIpPort, NAPTEntryEvent.Protocol protocol)  
      protected void removeFromIpPortMapDS​(org.opendaylight.yangtools.yang.common.Uint32 segmentId, java.lang.String internalIpPort, ProtocolTypes protocolType)  
      protected void removeFromSnatIpPortDS​(org.opendaylight.yangtools.yang.common.Uint32 segmentId, java.lang.String internalIp)  
      protected void removeIntExtIpMapDS​(org.opendaylight.yangtools.yang.common.Uint32 segmentId, java.lang.String internalIp)  
      boolean removeMapping​(org.opendaylight.yangtools.yang.common.Uint32 segmentId)
      Removes the internal ip to external ip mapping if present.
      protected void removeSnatIntIpPortDS​(org.opendaylight.yangtools.yang.common.Uint32 segmentId, SessionAddress address, ProtocolTypes protocolType)  
      void updateCounter​(org.opendaylight.yangtools.yang.common.Uint32 segmentId, java.lang.String externalIp, boolean isAdd)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NaptManager

        @Inject
        public NaptManager​(org.opendaylight.controller.md.sal.binding.api.DataBroker dataBroker,
                           org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService idManager)
    • Method Detail

      • createNaptPortPool

        protected void createNaptPortPool​(java.lang.String poolName)
      • registerMapping

        public void registerMapping​(org.opendaylight.yangtools.yang.common.Uint32 segmentId,
                                    IPAddress internal,
                                    IPAddress external)
        This method is used to inform this service of what external IP address to be used as mapping when requested one for the internal IP address given in the input.
        Parameters:
        segmentId - – segmentation in which the mapping to be used. Eg; routerid
        internal - subnet prefix or ip address
        external - subnet prefix or ip address
      • updateCounter

        public void updateCounter​(org.opendaylight.yangtools.yang.common.Uint32 segmentId,
                                  java.lang.String externalIp,
                                  boolean isAdd)
      • getExternalAddressMapping

        public @Nullable SessionAddress getExternalAddressMapping​(org.opendaylight.yangtools.yang.common.Uint32 segmentId,
                                                                  SessionAddress sourceAddress,
                                                                  NAPTEntryEvent.Protocol protocol)
        method to get external ip/port mapping when provided with internal ip/port pair If already a mapping exist for the given input, then the existing mapping is returned instead of overwriting with new ip/port pair.
        Parameters:
        segmentId - - Router ID
        sourceAddress - - internal ip address/port pair
        protocol - - TCP/UDP
        Returns:
        external ip address/port
      • releaseIpExtPortMapping

        protected void releaseIpExtPortMapping​(org.opendaylight.yangtools.yang.common.Uint32 segmentId,
                                               SessionAddress address,
                                               NAPTEntryEvent.Protocol protocol)
      • removeMapping

        public boolean removeMapping​(org.opendaylight.yangtools.yang.common.Uint32 segmentId)
        Removes the internal ip to external ip mapping if present.
        Parameters:
        segmentId - - Router ID
        Returns:
        true if successfully removed
      • getIpMapIdentifier

        protected org.opendaylight.yangtools.yang.binding.InstanceIdentifier<IpMap> getIpMapIdentifier​(org.opendaylight.yangtools.yang.common.Uint32 segid,
                                                                                                       java.lang.String internal)
      • getExternalIpsIdentifier

        protected org.opendaylight.yangtools.yang.binding.InstanceIdentifier<ExternalIpCounter> getExternalIpsIdentifier​(org.opendaylight.yangtools.yang.common.Uint32 segmentId,
                                                                                                                         java.lang.String external)
      • getIpMapList

        public static @NonNull java.util.List<IpMap> getIpMapList​(org.opendaylight.controller.md.sal.binding.api.DataBroker broker,
                                                                  org.opendaylight.yangtools.yang.common.Uint32 routerId)
      • getIpMapList

        protected static org.opendaylight.yangtools.yang.binding.InstanceIdentifier<IpMapping> getIpMapList​(org.opendaylight.yangtools.yang.common.Uint32 routerId)
      • getIpPortMapIdentifier

        protected org.opendaylight.yangtools.yang.binding.InstanceIdentifier<IpPortMap> getIpPortMapIdentifier​(org.opendaylight.yangtools.yang.common.Uint32 segid,
                                                                                                               java.lang.String internal,
                                                                                                               NAPTEntryEvent.Protocol protocol)
      • checkIpMap

        protected @Nullable java.lang.String checkIpMap​(org.opendaylight.yangtools.yang.common.Uint32 segmentId,
                                                        java.lang.String internalIp)
      • removeSnatIntIpPortDS

        protected void removeSnatIntIpPortDS​(org.opendaylight.yangtools.yang.common.Uint32 segmentId,
                                             SessionAddress address,
                                             ProtocolTypes protocolType)
      • removeFromSnatIpPortDS

        protected void removeFromSnatIpPortDS​(org.opendaylight.yangtools.yang.common.Uint32 segmentId,
                                              java.lang.String internalIp)
      • removeFromIpPortMapDS

        protected void removeFromIpPortMapDS​(org.opendaylight.yangtools.yang.common.Uint32 segmentId,
                                             java.lang.String internalIpPort,
                                             NAPTEntryEvent.Protocol protocol)
      • removeFromIpPortMapDS

        protected void removeFromIpPortMapDS​(org.opendaylight.yangtools.yang.common.Uint32 segmentId,
                                             java.lang.String internalIpPort,
                                             ProtocolTypes protocolType)
      • removeFromIpMapDS

        protected void removeFromIpMapDS​(org.opendaylight.yangtools.yang.common.Uint32 segmentId,
                                         java.lang.String internalIp)
      • removeIntExtIpMapDS

        protected void removeIntExtIpMapDS​(org.opendaylight.yangtools.yang.common.Uint32 segmentId,
                                           java.lang.String internalIp)
      • getExternalIpAllocatedForSubnet

        protected @Nullable java.lang.String getExternalIpAllocatedForSubnet​(org.opendaylight.yangtools.yang.common.Uint32 segmentId,
                                                                             java.lang.String internalIp)
      • initialiseExternalCounter

        protected void initialiseExternalCounter​(Routers routers,
                                                 org.opendaylight.yangtools.yang.common.Uint32 routerId)
      • initialiseNewExternalIpCounter

        protected void initialiseNewExternalIpCounter​(org.opendaylight.yangtools.yang.common.Uint32 routerId,
                                                      java.lang.String externalIp)
      • removeExternalCounter

        protected void removeExternalCounter​(org.opendaylight.yangtools.yang.common.Uint32 routerId)
      • removeExternalIpCounter

        protected void removeExternalIpCounter​(org.opendaylight.yangtools.yang.common.Uint32 routerId,
                                               java.lang.String externalIp)