diff options
Diffstat (limited to 'nat')
44 files changed, 451 insertions, 463 deletions
diff --git a/nat/asciidoc/Readme.adoc b/nat/asciidoc/Readme.adoc index c2c584c5f..e53b50f97 100644 --- a/nat/asciidoc/Readme.adoc +++ b/nat/asciidoc/Readme.adoc @@ -1,7 +1,7 @@ -= SNAT += NAT -Support fot VPP's SNAT plugin: -https://docs.fd.io/vpp/17.07/plugins_snat-plugin_snat.html +Support for VPP's NAT plugin: +https://wiki.fd.io/view/VPP/NAT == Supported features diff --git a/nat/nat-api/src/main/yang/interface-nat@2016-08-16.yang b/nat/nat-api/src/main/yang/interface-nat@2016-08-16.yang index 4414e1356..421d03944 100644 --- a/nat/nat-api/src/main/yang/interface-nat@2016-08-16.yang +++ b/nat/nat-api/src/main/yang/interface-nat@2016-08-16.yang @@ -8,7 +8,7 @@ module interface-nat { } revision "2017-08-01" { - description "Added support for snat_interface_add_del_output_feature."; + description "Added support for nat_interface_add_del_output_feature."; } revision "2016-12-14" { @@ -33,10 +33,10 @@ module interface-nat { default false; description "Indicates whether NAT translation should be applied after routing. - If true, snat_interface_add_del_output_feature message is used to enable NAT. - By default snat_interface_add_del_feature is used."; + If true, nat_interface_add_del_output_feature message is used to enable NAT. + By default nat_interface_add_del_feature is used."; reference - "https://git.fd.io/vpp/tree/src/plugins/snat/snat.api"; + "https://git.fd.io/vpp/tree/src/plugins/nat/nat.api"; } leaf nat44-support { diff --git a/nat/nat-api/src/main/yang/vpp-nat@2017-08-04.yang b/nat/nat-api/src/main/yang/vpp-nat@2017-08-04.yang index 7a2e2342a..e085c24b7 100644 --- a/nat/nat-api/src/main/yang/vpp-nat@2017-08-04.yang +++ b/nat/nat-api/src/main/yang/vpp-nat@2017-08-04.yang @@ -29,7 +29,7 @@ module vpp-nat { description "Indicates whether the pool is designated to be used for nat44 or nat64."; reference - "https://git.fd.io/vpp/tree/src/plugins/snat/snat.api"; + "https://git.fd.io/vpp/tree/src/plugins/nat/nat.api"; } } diff --git a/nat/nat2vpp/asciidoc/Readme.adoc b/nat/nat2vpp/asciidoc/Readme.adoc index 732401198..3e1041aae 100644 --- a/nat/nat2vpp/asciidoc/Readme.adoc +++ b/nat/nat2vpp/asciidoc/Readme.adoc @@ -1,3 +1,3 @@ = nat2vpp -Uses jvpp-snat to work with VPP's SNAT plugin.
\ No newline at end of file +Uses jvpp-nat to work with VPP's NAT plugin.
\ No newline at end of file diff --git a/nat/nat2vpp/pom.xml b/nat/nat2vpp/pom.xml index 44ba78b61..479a96fef 100644 --- a/nat/nat2vpp/pom.xml +++ b/nat/nat2vpp/pom.xml @@ -53,7 +53,7 @@ </dependency> <dependency> <groupId>io.fd.vpp</groupId> - <artifactId>jvpp-snat</artifactId> + <artifactId>jvpp-nat</artifactId> <version>17.10-SNAPSHOT</version> </dependency> diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/NatModule.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/NatModule.java index fece7b011..bfc502e89 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/NatModule.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/NatModule.java @@ -21,7 +21,7 @@ import com.google.inject.AbstractModule; import com.google.inject.Provider; import com.google.inject.Singleton; import com.google.inject.multibindings.Multibinder; -import io.fd.hc2vpp.nat.jvpp.JVppSnatProvider; +import io.fd.hc2vpp.nat.jvpp.JVppNatProvider; import io.fd.hc2vpp.nat.read.NatReaderFactory; import io.fd.hc2vpp.nat.read.ifc.IfcNatReaderFactory; import io.fd.hc2vpp.nat.read.ifc.SubIfcNatReaderFactory; @@ -31,7 +31,7 @@ import io.fd.hc2vpp.nat.write.ifc.IfcNatWriterFactory; import io.fd.hc2vpp.nat.write.ifc.SubIfcNatWriterFactory; import io.fd.honeycomb.translate.read.ReaderFactory; import io.fd.honeycomb.translate.write.WriterFactory; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,15 +41,15 @@ import org.slf4j.LoggerFactory; public class NatModule extends AbstractModule { private static final Logger LOG = LoggerFactory.getLogger(NatModule.class); - private final Class<? extends Provider<FutureJVppSnatFacade>> jvppSnatProviderClass; + private final Class<? extends Provider<FutureJVppNatFacade>> jvppNatProviderClass; public NatModule() { - this(JVppSnatProvider.class); + this(JVppNatProvider.class); } @VisibleForTesting - protected NatModule(Class<? extends Provider<FutureJVppSnatFacade>> jvppSnatProvider) { - this.jvppSnatProviderClass = jvppSnatProvider; + protected NatModule(Class<? extends Provider<FutureJVppNatFacade>> jvppNatProvider) { + this.jvppNatProviderClass = jvppNatProvider; } @Override @@ -60,7 +60,7 @@ public class NatModule extends AbstractModule { LOG.debug("Installing NAT module"); // Bind to Plugin's JVPP - bind(FutureJVppSnatFacade.class).toProvider(jvppSnatProviderClass).in(Singleton.class); + bind(FutureJVppNatFacade.class).toProvider(jvppNatProviderClass).in(Singleton.class); final Multibinder<ReaderFactory> readBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class); readBinder.addBinding().to(IfcNatReaderFactory.class).in(Singleton.class); diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/jvpp/JVppSnatProvider.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/jvpp/JVppNatProvider.java index d1a1b766c..97c5ebb3e 100755 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/jvpp/JVppSnatProvider.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/jvpp/JVppNatProvider.java @@ -20,8 +20,8 @@ import com.google.inject.Inject; import io.fd.honeycomb.binding.init.ProviderTrait; import io.fd.honeycomb.data.init.ShutdownHandler; import io.fd.vpp.jvpp.JVppRegistry; -import io.fd.vpp.jvpp.snat.JVppSnatImpl; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.JVppNatImpl; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import java.io.IOException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,9 +30,9 @@ import org.slf4j.LoggerFactory; * Provides future API for jvpp-nsh plugin. Must be a singleton due to shutdown hook usage. Registers shutdown hook to * free plugin's resources on shutdown. */ -public final class JVppSnatProvider extends ProviderTrait<FutureJVppSnatFacade> { +public final class JVppNatProvider extends ProviderTrait<FutureJVppNatFacade> { - private static final Logger LOG = LoggerFactory.getLogger(JVppSnatProvider.class); + private static final Logger LOG = LoggerFactory.getLogger(JVppNatProvider.class); @Inject private JVppRegistry registry; @@ -41,14 +41,14 @@ public final class JVppSnatProvider extends ProviderTrait<FutureJVppSnatFacade> private ShutdownHandler shutdownHandler; @Override - protected FutureJVppSnatFacade create() { + protected FutureJVppNatFacade create() { try { - final JVppSnatImpl jvppSnat = new JVppSnatImpl(); + final JVppNatImpl jvppNat = new JVppNatImpl(); // Free jvpp-nsh plugin's resources on shutdown - shutdownHandler.register("jvpp-snat", jvppSnat); + shutdownHandler.register("jvpp-nat", jvppNat); - LOG.info("Successfully loaded jvpp-snat plugin"); - return new FutureJVppSnatFacade(registry, jvppSnat); + LOG.info("Successfully loaded jvpp-nat plugin"); + return new FutureJVppNatFacade(registry, jvppNat); } catch (IOException e) { throw new IllegalStateException("Unable to open VPP management connection", e); } diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ExternalIpPoolCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ExternalIpPoolCustomizer.java index 451c694d1..0fd149e5a 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ExternalIpPoolCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ExternalIpPoolCustomizer.java @@ -26,13 +26,13 @@ import io.fd.honeycomb.translate.spi.read.Initialized; import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer; import io.fd.honeycomb.translate.util.RWUtils; import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager; -import io.fd.vpp.jvpp.snat.dto.Nat64PoolAddrDetails; -import io.fd.vpp.jvpp.snat.dto.Nat64PoolAddrDetailsReplyDump; -import io.fd.vpp.jvpp.snat.dto.Nat64PoolAddrDump; -import io.fd.vpp.jvpp.snat.dto.SnatAddressDetails; -import io.fd.vpp.jvpp.snat.dto.SnatAddressDetailsReplyDump; -import io.fd.vpp.jvpp.snat.dto.SnatAddressDump; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.dto.Nat44AddressDetails; +import io.fd.vpp.jvpp.nat.dto.Nat44AddressDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat44AddressDump; +import io.fd.vpp.jvpp.nat.dto.Nat64PoolAddrDetails; +import io.fd.vpp.jvpp.nat.dto.Nat64PoolAddrDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat64PoolAddrDump; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -60,17 +60,17 @@ final class ExternalIpPoolCustomizer implements private static final Logger LOG = LoggerFactory.getLogger(ExternalIpPoolCustomizer.class); - private final DumpCacheManager<SnatAddressDetailsReplyDump, Void> nat44DumpMgr; + private final DumpCacheManager<Nat44AddressDetailsReplyDump, Void> nat44DumpMgr; private final DumpCacheManager<Nat64PoolAddrDetailsReplyDump, Void> nat64DumpMgr; - ExternalIpPoolCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat) { - checkNotNull(jvppSnat, "jvppSnat should not be null"); - this.nat44DumpMgr = new DumpCacheManager.DumpCacheManagerBuilder<SnatAddressDetailsReplyDump, Void>() - .withExecutor((id, params) -> getReplyForRead(jvppSnat.snatAddressDump(new SnatAddressDump()).toCompletableFuture(), id)) - .acceptOnly(SnatAddressDetailsReplyDump.class) + ExternalIpPoolCustomizer(@Nonnull final FutureJVppNatFacade jvppNat) { + checkNotNull(jvppNat, "jvppNat should not be null"); + this.nat44DumpMgr = new DumpCacheManager.DumpCacheManagerBuilder<Nat44AddressDetailsReplyDump, Void>() + .withExecutor((id, params) -> getReplyForRead(jvppNat.nat44AddressDump(new Nat44AddressDump()).toCompletableFuture(), id)) + .acceptOnly(Nat44AddressDetailsReplyDump.class) .build(); this.nat64DumpMgr = new DumpCacheManager.DumpCacheManagerBuilder<Nat64PoolAddrDetailsReplyDump, Void>() - .withExecutor((id, params) -> getReplyForRead(jvppSnat.nat64PoolAddrDump(new Nat64PoolAddrDump()).toCompletableFuture(), id)) + .withExecutor((id, params) -> getReplyForRead(jvppNat.nat64PoolAddrDump(new Nat64PoolAddrDump()).toCompletableFuture(), id)) .acceptOnly(Nat64PoolAddrDetailsReplyDump.class) .build(); } @@ -98,14 +98,14 @@ final class ExternalIpPoolCustomizer implements LOG.trace("Reading current attributes for external IP pool: {}", id); final Long poolId = id.firstKeyOf(ExternalIpAddressPool.class).getPoolId(); - final List<SnatAddressDetails> nat44Details = + final List<Nat44AddressDetails> nat44Details = nat44DumpMgr.getDump(id, ctx.getModificationCache(), null) - .or(new SnatAddressDetailsReplyDump()).snatAddressDetails; + .or(new Nat44AddressDetailsReplyDump()).nat44AddressDetails; final int nat44PoolCount = nat44Details.size(); // Uses ID<->address mapping as defined by getAllIds (nat44 mappings go before nat64): if (poolId < nat44PoolCount) { - final SnatAddressDetails detail = nat44Details.get(Math.toIntExact(poolId)); + final Nat44AddressDetails detail = nat44Details.get(Math.toIntExact(poolId)); readPoolIp(builder, detail.ipAddress); setPoolType(builder, NatPoolType.Nat44); } else { @@ -153,7 +153,7 @@ final class ExternalIpPoolCustomizer implements // this customizer also returns every single address as a 32 prefix and assigns an artificial key to them long addressCount = nat44DumpMgr.getDump(id, ctx.getModificationCache(), null) - .or(new SnatAddressDetailsReplyDump()).snatAddressDetails.stream() + .or(new Nat44AddressDetailsReplyDump()).nat44AddressDetails.stream() .count(); // The ietf-nat model groups address pools for Nat44 and Nat64 under the same list, diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/MappingEntryCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/MappingEntryCustomizer.java index 2732c5fcc..8f22b756f 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/MappingEntryCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/MappingEntryCustomizer.java @@ -27,13 +27,13 @@ import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer; import io.fd.honeycomb.translate.util.RWUtils; import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager; import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor; -import io.fd.vpp.jvpp.snat.dto.Nat64BibDetails; -import io.fd.vpp.jvpp.snat.dto.Nat64BibDetailsReplyDump; -import io.fd.vpp.jvpp.snat.dto.Nat64BibDump; -import io.fd.vpp.jvpp.snat.dto.SnatStaticMappingDetails; -import io.fd.vpp.jvpp.snat.dto.SnatStaticMappingDetailsReplyDump; -import io.fd.vpp.jvpp.snat.dto.SnatStaticMappingDump; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.dto.Nat44StaticMappingDetails; +import io.fd.vpp.jvpp.nat.dto.Nat44StaticMappingDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat44StaticMappingDump; +import io.fd.vpp.jvpp.nat.dto.Nat64BibDetails; +import io.fd.vpp.jvpp.nat.dto.Nat64BibDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat64BibDump; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; @@ -60,12 +60,12 @@ final class MappingEntryCustomizer implements Ipv4Translator, Ipv6Translator, private static final Logger LOG = LoggerFactory.getLogger(MappingEntryCustomizer.class); - private final DumpCacheManager<SnatStaticMappingDetailsReplyDump, Void> nat44DumpManager; + private final DumpCacheManager<Nat44StaticMappingDetailsReplyDump, Void> nat44DumpManager; private final DumpCacheManager<Nat64BibDetailsReplyDump, Void> nat64DumpManager; private final MappingEntryContext mappingEntryContext; MappingEntryCustomizer( - final DumpCacheManager<SnatStaticMappingDetailsReplyDump, Void> nat44DumpManager, + final DumpCacheManager<Nat44StaticMappingDetailsReplyDump, Void> nat44DumpManager, final DumpCacheManager<Nat64BibDetailsReplyDump, Void> nat64DumpManager, final MappingEntryContext mappingEntryContext) { this.nat44DumpManager = nat44DumpManager; @@ -87,24 +87,24 @@ final class MappingEntryCustomizer implements Ipv4Translator, Ipv6Translator, final int idx = id.firstKeyOf(MappingEntry.class).getIndex().intValue(); final int natInstanceId = id.firstKeyOf(NatInstance.class).getId().intValue(); - final List<SnatStaticMappingDetails> nat44Details = + final List<Nat44StaticMappingDetails> nat44Details = nat44DumpManager.getDump(id, ctx.getModificationCache(), null) - .or(new SnatStaticMappingDetailsReplyDump()).snatStaticMappingDetails; - final Optional<SnatStaticMappingDetails> snat44StaticMappingDetails = + .or(new Nat44StaticMappingDetailsReplyDump()).nat44StaticMappingDetails; + final Optional<Nat44StaticMappingDetails> nat44StaticMappingDetails = mappingEntryContext.findDetailsNat44(nat44Details, natInstanceId, idx, ctx.getMappingContext()); - if (snat44StaticMappingDetails.isPresent()) { - readNat44Entry(builder, idx, snat44StaticMappingDetails.get()); + if (nat44StaticMappingDetails.isPresent()) { + readNat44Entry(builder, idx, nat44StaticMappingDetails.get()); } else { final List<Nat64BibDetails> nat64Details = nat64DumpManager.getDump(id, ctx.getModificationCache(), null) .or(new Nat64BibDetailsReplyDump()).nat64BibDetails; - final Optional<Nat64BibDetails> snat64StaticMappingDetails = + final Optional<Nat64BibDetails> nat64StaticMappingDetails = mappingEntryContext.findDetailsNat64(nat64Details, natInstanceId, idx, ctx.getMappingContext()); - if (snat64StaticMappingDetails.isPresent()) { - readNat64Entry(builder, idx, snat64StaticMappingDetails.get()); + if (nat64StaticMappingDetails.isPresent()) { + readNat64Entry(builder, idx, nat64StaticMappingDetails.get()); } } @@ -113,7 +113,7 @@ final class MappingEntryCustomizer implements Ipv4Translator, Ipv6Translator, } private void readNat44Entry(@Nonnull final MappingEntryBuilder builder, - final int index, final SnatStaticMappingDetails detail) { + final int index, final Nat44StaticMappingDetails detail) { builder.setIndex((long) index); builder.setType( org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.MappingEntry.Type.Static); @@ -170,7 +170,7 @@ final class MappingEntryCustomizer implements Ipv4Translator, Ipv6Translator, final List<MappingEntryKey> entryKeys = nat44DumpManager.getDump(id, context.getModificationCache(), null) - .or(new SnatStaticMappingDetailsReplyDump()).snatStaticMappingDetails.stream() + .or(new Nat44StaticMappingDetailsReplyDump()).nat44StaticMappingDetails.stream() .filter(detail -> natInstanceId == detail.vrfId) .map(detail -> mappingEntryContext .getStoredOrArtificialIndex(natInstanceId, detail, context.getMappingContext())) @@ -219,19 +219,19 @@ final class MappingEntryCustomizer implements Ipv4Translator, Ipv6Translator, } static final class MappingEntryNat44DumpExecutor - implements EntityDumpExecutor<SnatStaticMappingDetailsReplyDump, Void>, JvppReplyConsumer { + implements EntityDumpExecutor<Nat44StaticMappingDetailsReplyDump, Void>, JvppReplyConsumer { - private final FutureJVppSnatFacade jvppSnat; + private final FutureJVppNatFacade jvppNat; - MappingEntryNat44DumpExecutor(final FutureJVppSnatFacade jvppSnat) { - this.jvppSnat = jvppSnat; + MappingEntryNat44DumpExecutor(final FutureJVppNatFacade jvppNat) { + this.jvppNat = jvppNat; } @Nonnull @Override - public SnatStaticMappingDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier, final Void params) + public Nat44StaticMappingDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier, final Void params) throws ReadFailedException { - return getReplyForRead(jvppSnat.snatStaticMappingDump(new SnatStaticMappingDump()).toCompletableFuture(), + return getReplyForRead(jvppNat.nat44StaticMappingDump(new Nat44StaticMappingDump()).toCompletableFuture(), identifier); } } @@ -239,10 +239,10 @@ final class MappingEntryCustomizer implements Ipv4Translator, Ipv6Translator, static final class MappingEntryNat64DumpExecutor implements EntityDumpExecutor<Nat64BibDetailsReplyDump, Void>, JvppReplyConsumer { - private final FutureJVppSnatFacade jvppSnat; + private final FutureJVppNatFacade jvppNat; - MappingEntryNat64DumpExecutor(final FutureJVppSnatFacade jvppSnat) { - this.jvppSnat = jvppSnat; + MappingEntryNat64DumpExecutor(final FutureJVppNatFacade jvppNat) { + this.jvppNat = jvppNat; } @Nonnull @@ -251,7 +251,7 @@ final class MappingEntryCustomizer implements Ipv4Translator, Ipv6Translator, throws ReadFailedException { final Nat64BibDump dump = new Nat64BibDump(); dump.proto = -1; // dump entries for all protocols - return getReplyForRead(jvppSnat.nat64BibDump(dump).toCompletableFuture(), identifier); + return getReplyForRead(jvppNat.nat64BibDump(dump).toCompletableFuture(), identifier); } } } diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/NatInstanceCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/NatInstanceCustomizer.java index 18a959274..8468289da 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/NatInstanceCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/NatInstanceCustomizer.java @@ -21,8 +21,8 @@ import io.fd.honeycomb.translate.read.ReadFailedException; import io.fd.honeycomb.translate.spi.read.Initialized; import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer; import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager; -import io.fd.vpp.jvpp.snat.dto.Nat64BibDetailsReplyDump; -import io.fd.vpp.jvpp.snat.dto.SnatStaticMappingDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat44StaticMappingDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat64BibDetailsReplyDump; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -47,11 +47,11 @@ final class NatInstanceCustomizer private static final Logger LOG = LoggerFactory.getLogger(NatInstanceCustomizer.class); static final NatInstanceKey DEFAULT_VRF_ID = new NatInstanceKey(0L); - private final DumpCacheManager<SnatStaticMappingDetailsReplyDump, Void> nat44DumpManager; + private final DumpCacheManager<Nat44StaticMappingDetailsReplyDump, Void> nat44DumpManager; private final DumpCacheManager<Nat64BibDetailsReplyDump, Void> nat64DumpManager; NatInstanceCustomizer( - final DumpCacheManager<SnatStaticMappingDetailsReplyDump, Void> nat44DumpManager, + final DumpCacheManager<Nat44StaticMappingDetailsReplyDump, Void> nat44DumpManager, final DumpCacheManager<Nat64BibDetailsReplyDump, Void> nat64DumpManager) { this.nat44DumpManager = nat44DumpManager; this.nat64DumpManager = nat64DumpManager; @@ -80,7 +80,7 @@ final class NatInstanceCustomizer // Find the nat instance IDs (vrf-ids) by listing all static mappings and their VRF assignment final List<NatInstanceKey> vrfIds = Stream.concat( nat44DumpManager.getDump(id, context.getModificationCache(), null) - .or(new SnatStaticMappingDetailsReplyDump()).snatStaticMappingDetails.stream() + .or(new Nat44StaticMappingDetailsReplyDump()).nat44StaticMappingDetails.stream() .map(detail -> detail.vrfId), nat64DumpManager.getDump(id, context.getModificationCache(), null) .or(new Nat64BibDetailsReplyDump()).nat64BibDetails.stream() diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/NatReaderFactory.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/NatReaderFactory.java index d9c7f3380..754f19337 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/NatReaderFactory.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/NatReaderFactory.java @@ -23,9 +23,9 @@ import io.fd.honeycomb.translate.impl.read.GenericInitListReader; import io.fd.honeycomb.translate.read.ReaderFactory; import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder; import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager; -import io.fd.vpp.jvpp.snat.dto.Nat64BibDetailsReplyDump; -import io.fd.vpp.jvpp.snat.dto.SnatStaticMappingDetailsReplyDump; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.dto.Nat44StaticMappingDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat64BibDetailsReplyDump; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.NatState; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.NatStateBuilder; @@ -52,25 +52,25 @@ public class NatReaderFactory implements ReaderFactory { private static final InstanceIdentifier<MappingTable> MAP_TABLE_ID = NAT_INSTANCE_ID.child(MappingTable.class); private static final InstanceIdentifier<MappingEntry> MAP_ENTRY_ID = MAP_TABLE_ID.child(MappingEntry.class); - private final FutureJVppSnatFacade jvppSnat; + private final FutureJVppNatFacade jvppNat; private final MappingEntryContext mappingEntryContext; - private final DumpCacheManager<SnatStaticMappingDetailsReplyDump, Void> mapEntryNat44DumpMgr; + private final DumpCacheManager<Nat44StaticMappingDetailsReplyDump, Void> mapEntryNat44DumpMgr; private final DumpCacheManager<Nat64BibDetailsReplyDump, Void> mapEntryNat64DumpMgr; @Inject - public NatReaderFactory(final FutureJVppSnatFacade jvppSnat, + public NatReaderFactory(final FutureJVppNatFacade jvppNat, final MappingEntryContext mappingEntryContext) { - this.jvppSnat = jvppSnat; + this.jvppNat = jvppNat; this.mappingEntryContext = mappingEntryContext; this.mapEntryNat44DumpMgr = - new DumpCacheManager.DumpCacheManagerBuilder<SnatStaticMappingDetailsReplyDump, Void>() - .withExecutor(new MappingEntryCustomizer.MappingEntryNat44DumpExecutor(jvppSnat)) - .acceptOnly(SnatStaticMappingDetailsReplyDump.class) + new DumpCacheManager.DumpCacheManagerBuilder<Nat44StaticMappingDetailsReplyDump, Void>() + .withExecutor(new MappingEntryCustomizer.MappingEntryNat44DumpExecutor(jvppNat)) + .acceptOnly(Nat44StaticMappingDetailsReplyDump.class) .build(); this.mapEntryNat64DumpMgr = new DumpCacheManager.DumpCacheManagerBuilder<Nat64BibDetailsReplyDump, Void>() - .withExecutor(new MappingEntryCustomizer.MappingEntryNat64DumpExecutor(jvppSnat)) + .withExecutor(new MappingEntryCustomizer.MappingEntryNat64DumpExecutor(jvppNat)) .acceptOnly(Nat64BibDetailsReplyDump.class) .build(); } @@ -89,6 +89,6 @@ public class NatReaderFactory implements ReaderFactory { registry.addStructuralReader(CURRENT_CONFIG, NatCurrentConfigBuilder.class); registry.add(new GenericInitListReader<>(CURRENT_CONFIG.child(ExternalIpAddressPool.class), - new ExternalIpPoolCustomizer(jvppSnat))); + new ExternalIpPoolCustomizer(jvppNat))); } } diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/AbstractInterfaceNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/AbstractInterfaceNatCustomizer.java index 5079f1630..3ef2035e4 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/AbstractInterfaceNatCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/AbstractInterfaceNatCustomizer.java @@ -25,13 +25,13 @@ import io.fd.honeycomb.translate.read.ReadContext; import io.fd.honeycomb.translate.read.ReadFailedException; import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer; import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager; -import io.fd.vpp.jvpp.snat.dto.Nat64InterfaceDetailsReplyDump; -import io.fd.vpp.jvpp.snat.dto.Nat64InterfaceDump; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetailsReplyDump; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDump; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceOutputFeatureDetailsReplyDump; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceOutputFeatureDump; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceDump; +import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceOutputFeatureDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceOutputFeatureDump; +import io.fd.vpp.jvpp.nat.dto.Nat64InterfaceDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat64InterfaceDump; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface; import org.opendaylight.yangtools.concepts.Builder; @@ -42,36 +42,36 @@ import org.slf4j.Logger; abstract class AbstractInterfaceNatCustomizer<C extends DataObject, B extends Builder<C>> implements InitializingReaderCustomizer<C, B>, JvppReplyConsumer { - private final DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> preRoutingNat44DumpMgr; + private final DumpCacheManager<Nat44InterfaceDetailsReplyDump, Void> preRoutingNat44DumpMgr; private final DumpCacheManager<Nat64InterfaceDetailsReplyDump, Void> preRoutingNat64DumpMgr; - private final DumpCacheManager<SnatInterfaceOutputFeatureDetailsReplyDump, Void> postRoutingNat44DumpMgr; + private final DumpCacheManager<Nat44InterfaceOutputFeatureDetailsReplyDump, Void> postRoutingNat44DumpMgr; private final NamingContext ifcContext; private final VppAttributesBuilder vppAttributesBuilder; - AbstractInterfaceNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, + AbstractInterfaceNatCustomizer(@Nonnull final FutureJVppNatFacade jvppNat, @Nonnull final NamingContext ifcContext, @Nonnull final VppAttributesBuilder vppAttributesBuilder) { - requireNonNull(jvppSnat, "jvppSnat should not be null"); + requireNonNull(jvppNat, "jvppNat should not be null"); this.ifcContext = requireNonNull(ifcContext, "ifcContext should not be null"); this.vppAttributesBuilder = requireNonNull(vppAttributesBuilder, "ifcContext should not be null"); this.preRoutingNat44DumpMgr = - new DumpCacheManager.DumpCacheManagerBuilder<SnatInterfaceDetailsReplyDump, Void>() + new DumpCacheManager.DumpCacheManagerBuilder<Nat44InterfaceDetailsReplyDump, Void>() .withExecutor((id, params) -> getReplyForRead( - jvppSnat.snatInterfaceDump(new SnatInterfaceDump()).toCompletableFuture(), id)) - .acceptOnly(SnatInterfaceDetailsReplyDump.class) + jvppNat.nat44InterfaceDump(new Nat44InterfaceDump()).toCompletableFuture(), id)) + .acceptOnly(Nat44InterfaceDetailsReplyDump.class) .build(); this.preRoutingNat64DumpMgr = new DumpCacheManager.DumpCacheManagerBuilder<Nat64InterfaceDetailsReplyDump, Void>() .withExecutor((id, params) -> getReplyForRead( - jvppSnat.nat64InterfaceDump(new Nat64InterfaceDump()).toCompletableFuture(), id)) + jvppNat.nat64InterfaceDump(new Nat64InterfaceDump()).toCompletableFuture(), id)) .acceptOnly(Nat64InterfaceDetailsReplyDump.class) .build(); this.postRoutingNat44DumpMgr = - new DumpCacheManager.DumpCacheManagerBuilder<SnatInterfaceOutputFeatureDetailsReplyDump, Void>() + new DumpCacheManager.DumpCacheManagerBuilder<Nat44InterfaceOutputFeatureDetailsReplyDump, Void>() .withExecutor((id, params) -> getReplyForRead( - jvppSnat.snatInterfaceOutputFeatureDump(new SnatInterfaceOutputFeatureDump()) + jvppNat.nat44InterfaceOutputFeatureDump(new Nat44InterfaceOutputFeatureDump()) .toCompletableFuture(), id)) - .acceptOnly(SnatInterfaceOutputFeatureDetailsReplyDump.class) + .acceptOnly(Nat44InterfaceOutputFeatureDetailsReplyDump.class) .build(); } @@ -92,14 +92,14 @@ abstract class AbstractInterfaceNatCustomizer<C extends DataObject, B extends Bu private void readPreRoutingNat44(final InstanceIdentifier<C> id, final int index, final B builder, final ReadContext ctx) throws ReadFailedException { - final Optional<SnatInterfaceDetailsReplyDump> dump = + final Optional<Nat44InterfaceDetailsReplyDump> dump = preRoutingNat44DumpMgr.getDump(id, ctx.getModificationCache(), null); - dump.or(new SnatInterfaceDetailsReplyDump()).snatInterfaceDetails.stream() - .filter(snatIfcDetail -> snatIfcDetail.swIfIndex == index) - .filter(snatIfcDetail -> isExpectedNatType(snatIfcDetail.isInside)) + dump.or(new Nat44InterfaceDetailsReplyDump()).nat44InterfaceDetails.stream() + .filter(natIfcDetail -> natIfcDetail.swIfIndex == index) + .filter(natIfcDetail -> isExpectedNatType(natIfcDetail.isInside)) .findAny() - .ifPresent(snatIfcDetail -> vppAttributesBuilder.enableNat44(builder)); + .ifPresent(natIfcDetail -> vppAttributesBuilder.enableNat44(builder)); // do not modify builder is feature is absent (inbound/outbound are presence containers) } @@ -109,24 +109,24 @@ abstract class AbstractInterfaceNatCustomizer<C extends DataObject, B extends Bu preRoutingNat64DumpMgr.getDump(id, ctx.getModificationCache(), null); dump.or(new Nat64InterfaceDetailsReplyDump()).nat64InterfaceDetails.stream() - .filter(snatIfcDetail -> snatIfcDetail.swIfIndex == index) - .filter(snatIfcDetail -> isExpectedNatType(snatIfcDetail.isInside)) + .filter(natIfcDetail -> natIfcDetail.swIfIndex == index) + .filter(natIfcDetail -> isExpectedNatType(natIfcDetail.isInside)) .findAny() - .ifPresent(snatIfcDetail -> vppAttributesBuilder.enableNat64(builder)); + .ifPresent(natIfcDetail -> vppAttributesBuilder.enableNat64(builder)); // do not modify builder is feature is absent (inbound/outbound are presence containers) } private void readPostRoutingNat44(final InstanceIdentifier<C> id, final int index, final B builder, final ReadContext ctx) throws ReadFailedException { - final Optional<SnatInterfaceOutputFeatureDetailsReplyDump> dump = + final Optional<Nat44InterfaceOutputFeatureDetailsReplyDump> dump = postRoutingNat44DumpMgr.getDump(id, ctx.getModificationCache(), null); - dump.or(new SnatInterfaceOutputFeatureDetailsReplyDump()).snatInterfaceOutputFeatureDetails + dump.or(new Nat44InterfaceOutputFeatureDetailsReplyDump()).nat44InterfaceOutputFeatureDetails .stream() - .filter(snatIfcDetail -> snatIfcDetail.swIfIndex == index) - .filter(snatIfcDetail -> isExpectedNatType(snatIfcDetail.isInside)) + .filter(natIfcDetail -> natIfcDetail.swIfIndex == index) + .filter(natIfcDetail -> isExpectedNatType(natIfcDetail.isInside)) .findAny() - .ifPresent(snatIfcDetail -> vppAttributesBuilder.enablePostRouting(builder)); + .ifPresent(natIfcDetail -> vppAttributesBuilder.enablePostRouting(builder)); // do not modify builder is feature is absent (inbound/outbound are presence containers) } diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/AbstractSubInterfaceNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/AbstractSubInterfaceNatCustomizer.java index 449d57e7d..6edfbe9ca 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/AbstractSubInterfaceNatCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/AbstractSubInterfaceNatCustomizer.java @@ -19,7 +19,7 @@ package io.fd.hc2vpp.nat.read.ifc; import static com.google.common.base.Preconditions.checkNotNull; import io.fd.hc2vpp.common.translate.util.NamingContext; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev170607.interfaces.state._interface.sub.interfaces.SubInterface; @@ -29,10 +29,10 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; abstract class AbstractSubInterfaceNatCustomizer<C extends DataObject, B extends Builder<C>> extends AbstractInterfaceNatCustomizer<C, B> { - AbstractSubInterfaceNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, + AbstractSubInterfaceNatCustomizer(@Nonnull final FutureJVppNatFacade jvppNat, @Nonnull final NamingContext ifcContext, @Nonnull final VppAttributesBuilder vppAttributesBuilder) { - super(jvppSnat, ifcContext, vppAttributesBuilder); + super(jvppNat, ifcContext, vppAttributesBuilder); } @Override diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/IfcNatReaderFactory.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/IfcNatReaderFactory.java index 86dc605ce..c86bbef8f 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/IfcNatReaderFactory.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/IfcNatReaderFactory.java @@ -22,7 +22,7 @@ import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.impl.read.GenericInitReader; import io.fd.honeycomb.translate.read.ReaderFactory; import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface; @@ -45,12 +45,12 @@ public final class IfcNatReaderFactory implements ReaderFactory { IFC_ID.augmentation(NatInterfaceStateAugmentation.class); private static final InstanceIdentifier<Nat> NAT_AUG_CONTAINER_ID = NAT_AUG_ID.child(Nat.class); private final NamingContext ifcContext; - private final FutureJVppSnatFacade jvppSnat; + private final FutureJVppNatFacade jvppNat; @Inject - public IfcNatReaderFactory(final FutureJVppSnatFacade jvppSnat, + public IfcNatReaderFactory(final FutureJVppNatFacade jvppNat, @Named("interface-context") final NamingContext ifcContext) { - this.jvppSnat = jvppSnat; + this.jvppNat = jvppNat; this.ifcContext = ifcContext; } @@ -60,8 +60,8 @@ public final class IfcNatReaderFactory implements ReaderFactory { registry.addStructuralReader(NAT_AUG_CONTAINER_ID, NatBuilder.class); registry.addAfter(new GenericInitReader<>(NAT_AUG_CONTAINER_ID.child(Inbound.class), - new InterfaceInboundNatCustomizer(jvppSnat, ifcContext)), IFC_ID); + new InterfaceInboundNatCustomizer(jvppNat, ifcContext)), IFC_ID); registry.addAfter(new GenericInitReader<>(NAT_AUG_CONTAINER_ID.child(Outbound.class), - new InterfaceOutboundNatCustomizer(jvppSnat, ifcContext)), IFC_ID); + new InterfaceOutboundNatCustomizer(jvppNat, ifcContext)), IFC_ID); } } diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/InterfaceInboundNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/InterfaceInboundNatCustomizer.java index cabdd0f8b..269ddd229 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/InterfaceInboundNatCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/InterfaceInboundNatCustomizer.java @@ -19,7 +19,7 @@ package io.fd.hc2vpp.nat.read.ifc; import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.read.ReadContext; import io.fd.honeycomb.translate.spi.read.Initialized; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; @@ -39,9 +39,9 @@ final class InterfaceInboundNatCustomizer extends AbstractInterfaceNatCustomizer private static final Logger LOG = LoggerFactory.getLogger(InterfaceInboundNatCustomizer.class); - InterfaceInboundNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, + InterfaceInboundNatCustomizer(@Nonnull final FutureJVppNatFacade jvppNat, @Nonnull final NamingContext ifcContext) { - super(jvppSnat, ifcContext, new InboundAttributesBuilder()); + super(jvppNat, ifcContext, new InboundAttributesBuilder()); } @Override diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/InterfaceOutboundNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/InterfaceOutboundNatCustomizer.java index 438e43862..5b601e87c 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/InterfaceOutboundNatCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/InterfaceOutboundNatCustomizer.java @@ -19,7 +19,7 @@ package io.fd.hc2vpp.nat.read.ifc; import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.read.ReadContext; import io.fd.honeycomb.translate.spi.read.Initialized; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; @@ -39,9 +39,9 @@ final class InterfaceOutboundNatCustomizer extends AbstractInterfaceNatCustomize private static final Logger LOG = LoggerFactory.getLogger(InterfaceOutboundNatCustomizer.class); - InterfaceOutboundNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, + InterfaceOutboundNatCustomizer(@Nonnull final FutureJVppNatFacade jvppNat, @Nonnull final NamingContext ifcContext) { - super(jvppSnat, ifcContext, new OutboundAttributesReader()); + super(jvppNat, ifcContext, new OutboundAttributesReader()); } @Override diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/SubIfcNatReaderFactory.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/SubIfcNatReaderFactory.java index 18a81639b..b431f512b 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/SubIfcNatReaderFactory.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/SubIfcNatReaderFactory.java @@ -23,7 +23,7 @@ import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.impl.read.GenericInitReader; import io.fd.honeycomb.translate.read.ReaderFactory; import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface; @@ -51,12 +51,12 @@ public final class SubIfcNatReaderFactory implements ReaderFactory { private static final InstanceIdentifier<Nat> NAT_AUG_CONTAINER_ID = NAT_SUB_AUG_ID.child(Nat.class); private final NamingContext ifcContext; - private final FutureJVppSnatFacade jvppSnat; + private final FutureJVppNatFacade jvppNat; @Inject - public SubIfcNatReaderFactory(final FutureJVppSnatFacade jvppSnat, + public SubIfcNatReaderFactory(final FutureJVppNatFacade jvppNat, @Named("interface-context") final NamingContext ifcContext) { - this.jvppSnat = jvppSnat; + this.jvppNat = jvppNat; this.ifcContext = ifcContext; } @@ -66,8 +66,8 @@ public final class SubIfcNatReaderFactory implements ReaderFactory { registry.addStructuralReader(NAT_AUG_CONTAINER_ID, NatBuilder.class); registry.addAfter(new GenericInitReader<>(NAT_AUG_CONTAINER_ID.child(Inbound.class), - new SubInterfaceInboundNatCustomizer(jvppSnat, ifcContext)), SUB_IFC_ID); + new SubInterfaceInboundNatCustomizer(jvppNat, ifcContext)), SUB_IFC_ID); registry.addAfter(new GenericInitReader<>(NAT_AUG_CONTAINER_ID.child(Outbound.class), - new SubInterfaceOutboundNatCustomizer(jvppSnat, ifcContext)), SUB_IFC_ID); + new SubInterfaceOutboundNatCustomizer(jvppNat, ifcContext)), SUB_IFC_ID); } } diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/SubInterfaceInboundNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/SubInterfaceInboundNatCustomizer.java index 39ee7c9f3..49d0301be 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/SubInterfaceInboundNatCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/SubInterfaceInboundNatCustomizer.java @@ -19,7 +19,7 @@ package io.fd.hc2vpp.nat.read.ifc; import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.read.ReadContext; import io.fd.honeycomb.translate.spi.read.Initialized; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; @@ -43,9 +43,9 @@ final class SubInterfaceInboundNatCustomizer extends AbstractSubInterfaceNatCust private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceInboundNatCustomizer.class); - SubInterfaceInboundNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, + SubInterfaceInboundNatCustomizer(@Nonnull final FutureJVppNatFacade jvppNat, @Nonnull final NamingContext ifcContext) { - super(jvppSnat, ifcContext, new InboundAttributesBuilder()); + super(jvppNat, ifcContext, new InboundAttributesBuilder()); } @Override diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/SubInterfaceOutboundNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/SubInterfaceOutboundNatCustomizer.java index 330e4c4b3..4fe472f3d 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/SubInterfaceOutboundNatCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/SubInterfaceOutboundNatCustomizer.java @@ -19,7 +19,7 @@ package io.fd.hc2vpp.nat.read.ifc; import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.read.ReadContext; import io.fd.honeycomb.translate.spi.read.Initialized; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; @@ -43,9 +43,9 @@ final class SubInterfaceOutboundNatCustomizer extends AbstractSubInterfaceNatCus private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceOutboundNatCustomizer.class); - SubInterfaceOutboundNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, + SubInterfaceOutboundNatCustomizer(@Nonnull final FutureJVppNatFacade jvppNat, @Nonnull final NamingContext ifcContext) { - super(jvppSnat, ifcContext, new OutboundAttributesReader()); + super(jvppNat, ifcContext, new OutboundAttributesReader()); } @Override diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/util/MappingEntryContext.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/util/MappingEntryContext.java index 292adc3aa..0f3924ec6 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/util/MappingEntryContext.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/util/MappingEntryContext.java @@ -23,8 +23,8 @@ import com.google.common.base.Optional; import io.fd.hc2vpp.common.translate.util.Ipv4Translator; import io.fd.hc2vpp.common.translate.util.Ipv6Translator; import io.fd.honeycomb.translate.MappingContext; -import io.fd.vpp.jvpp.snat.dto.Nat64BibDetails; -import io.fd.vpp.jvpp.snat.dto.SnatStaticMappingDetails; +import io.fd.vpp.jvpp.nat.dto.Nat44StaticMappingDetails; +import io.fd.vpp.jvpp.nat.dto.Nat64BibDetails; import java.util.Collections; import java.util.Comparator; import java.util.List; @@ -97,7 +97,7 @@ public class MappingEntryContext implements Ipv4Translator, Ipv6Translator { return new MappingEntryKey(new IpAddress(entry.getExternalSrcAddress()), entry.getInternalSrcAddress()); } - private MappingEntryKey entryToKey(final SnatStaticMappingDetails entry) { + private MappingEntryKey entryToKey(final Nat44StaticMappingDetails entry) { // Only IPv4 return new MappingEntryKey( new IpAddress(new Ipv4Address(arrayToIpv4AddressNoZone(entry.externalIpAddress))), @@ -110,7 +110,7 @@ public class MappingEntryContext implements Ipv4Translator, Ipv6Translator { new IpAddress(new Ipv6Address(arrayToIpv6AddressNoZone(entry.iAddr)))); } - private boolean equalEntries(final SnatStaticMappingDetails detail, final MappingEntry ctxMappingEntry) { + private boolean equalEntries(final Nat44StaticMappingDetails detail, final MappingEntry ctxMappingEntry) { final IpAddress internalAddrFromDetails = new IpAddress(new Ipv4Address(arrayToIpv4AddressNoZone(detail.localIpAddress))); // Only IPv4 @@ -152,7 +152,7 @@ public class MappingEntryContext implements Ipv4Translator, Ipv6Translator { .build(); } - private MappingEntry toCtxMapEntry(@Nonnull final SnatStaticMappingDetails details, final long entryId) { + private MappingEntry toCtxMapEntry(@Nonnull final Nat44StaticMappingDetails details, final long entryId) { return new MappingEntryBuilder() .setKey(entryToKey(details)) .setIndex(entryId) @@ -178,9 +178,9 @@ public class MappingEntryContext implements Ipv4Translator, Ipv6Translator { /** * Find specific details in provided collection identified with provided index. */ - public synchronized java.util.Optional<SnatStaticMappingDetails> findDetailsNat44(@Nonnull final List<SnatStaticMappingDetails> details, - final long natInstanceId, final long idx, - @Nonnull final MappingContext mappingContext) { + public synchronized java.util.Optional<Nat44StaticMappingDetails> findDetailsNat44(@Nonnull final List<Nat44StaticMappingDetails> details, + final long natInstanceId, final long idx, + @Nonnull final MappingContext mappingContext) { // Find mapping entry for Index final MappingEntry ctxMappingEntry = mappingContext.read(getTableId(natInstanceId)) .transform(MappingTable::getMappingEntry) @@ -223,7 +223,7 @@ public class MappingEntryContext implements Ipv4Translator, Ipv6Translator { * Get index for a mapping entry details or create an artificial one. */ public synchronized long getStoredOrArtificialIndex(final Long natInstanceId, - @Nonnull final SnatStaticMappingDetails details, + @Nonnull final Nat44StaticMappingDetails details, @Nonnull final MappingContext mappingContext) { return mappingContext.read(getId(natInstanceId, entryToKey(details))) .transform(MappingEntry::getIndex) @@ -251,7 +251,7 @@ public class MappingEntryContext implements Ipv4Translator, Ipv6Translator { .transform(MappingEntry::getIndex); } - private long getArtificialId(final SnatStaticMappingDetails details, final Long natInstanceId, + private long getArtificialId(final Nat44StaticMappingDetails details, final Long natInstanceId, final MappingContext mappingContext) { LOG.trace("Assigning artificial ID for {}", details); final long artificialIdx = findFreeIndex(natInstanceId, mappingContext); diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ExternalIpPoolCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ExternalIpPoolCustomizer.java index 62331620d..775c9a6dd 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ExternalIpPoolCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ExternalIpPoolCustomizer.java @@ -26,9 +26,9 @@ import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer; import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.write.WriteFailedException; -import io.fd.vpp.jvpp.snat.dto.Nat64AddDelPoolAddrRange; -import io.fd.vpp.jvpp.snat.dto.SnatAddAddressRange; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.dto.Nat44AddDelAddressRange; +import io.fd.vpp.jvpp.nat.dto.Nat64AddDelPoolAddrRange; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.config.nat.instances.NatInstance; @@ -44,10 +44,10 @@ final class ExternalIpPoolCustomizer implements ListWriterCustomizer<ExternalIpA private static final Logger LOG = LoggerFactory.getLogger(ExternalIpPoolCustomizer.class); - private final FutureJVppSnatFacade jvppSnat; + private final FutureJVppNatFacade jvppNat; - ExternalIpPoolCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat) { - this.jvppSnat = jvppSnat; + ExternalIpPoolCustomizer(@Nonnull final FutureJVppNatFacade jvppNat) { + this.jvppNat = jvppNat; } @Override @@ -82,18 +82,17 @@ final class ExternalIpPoolCustomizer implements ListWriterCustomizer<ExternalIpA } if (isNat64) { final Nat64AddDelPoolAddrRange request = getNat64Request(addressPool.getExternalIpPool(), isAdd); - getReplyForWrite(jvppSnat.nat64AddDelPoolAddrRange(request).toCompletableFuture(), id); + getReplyForWrite(jvppNat.nat64AddDelPoolAddrRange(request).toCompletableFuture(), id); } else { - final SnatAddAddressRange request = getNat44Request(addressPool.getExternalIpPool(), isAdd); - getReplyForWrite(jvppSnat.snatAddAddressRange(request).toCompletableFuture(), id); + final Nat44AddDelAddressRange request = getNat44Request(addressPool.getExternalIpPool(), isAdd); + getReplyForWrite(jvppNat.nat44AddDelAddressRange(request).toCompletableFuture(), id); } } - private SnatAddAddressRange getNat44Request(final Ipv4Prefix externalIpPool, boolean isAdd) { - final SnatAddAddressRange request = new SnatAddAddressRange(); + private Nat44AddDelAddressRange getNat44Request(final Ipv4Prefix externalIpPool, boolean isAdd) { + final Nat44AddDelAddressRange request = new Nat44AddDelAddressRange(); final Ipv4AddressRange range = Ipv4AddressRange.fromPrefix(externalIpPool); LOG.trace("Handling NAT44 address range: {}", range); - request.isIp4 = 1; request.isAdd = booleanToByte(isAdd); request.firstIpAddress = ipv4AddressNoZoneToArray(range.getStart()); request.lastIpAddress = ipv4AddressNoZoneToArray(range.getEnd()); diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/MappingEntryCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/MappingEntryCustomizer.java index 35ed9e2d8..97a41c0ca 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/MappingEntryCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/MappingEntryCustomizer.java @@ -28,9 +28,9 @@ import io.fd.hc2vpp.nat.util.MappingEntryContext; import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer; import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.write.WriteFailedException; -import io.fd.vpp.jvpp.snat.dto.Nat64AddDelStaticBib; -import io.fd.vpp.jvpp.snat.dto.SnatAddStaticMapping; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.dto.Nat44AddDelStaticMapping; +import io.fd.vpp.jvpp.nat.dto.Nat64AddDelStaticBib; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; @@ -50,11 +50,11 @@ final class MappingEntryCustomizer implements ListWriterCustomizer<MappingEntry, private static final Logger LOG = LoggerFactory.getLogger(MappingEntryCustomizer.class); - private final FutureJVppSnatFacade jvppSnat; + private final FutureJVppNatFacade jvppNat; private final MappingEntryContext mappingEntryContext; - MappingEntryCustomizer(final FutureJVppSnatFacade jvppSnat, final MappingEntryContext mappingEntryContext) { - this.jvppSnat = jvppSnat; + MappingEntryCustomizer(final FutureJVppNatFacade jvppNat, final MappingEntryContext mappingEntryContext) { + this.jvppNat = jvppNat; this.mappingEntryContext = mappingEntryContext; } @@ -91,13 +91,13 @@ final class MappingEntryCustomizer implements ListWriterCustomizer<MappingEntry, final Ipv4Address internalV4SrcAddress = internalSrcAddress.getIpv4Address(); final Ipv6Address internalV6SrcAddress = internalSrcAddress.getIpv6Address(); if (internalV4SrcAddress != null) { - final SnatAddStaticMapping request = getNat44Request(id, entry, natInstanceId, isAdd); - getReplyForWrite(jvppSnat.snatAddStaticMapping(request).toCompletableFuture(), id); + final Nat44AddDelStaticMapping request = getNat44Request(id, entry, natInstanceId, isAdd); + getReplyForWrite(jvppNat.nat44AddDelStaticMapping(request).toCompletableFuture(), id); } else { checkState(internalV6SrcAddress != null, "internalSrcAddress.getIpv6Address() should not return null if v4 address is not given"); final Nat64AddDelStaticBib request = getNat64Request(id, entry, natInstanceId, isAdd); - getReplyForWrite(jvppSnat.nat64AddDelStaticBib(request).toCompletableFuture(), id); + getReplyForWrite(jvppNat.nat64AddDelStaticBib(request).toCompletableFuture(), id); } } @@ -139,14 +139,13 @@ final class MappingEntryCustomizer implements ListWriterCustomizer<MappingEntry, LOG.trace("Mapping entry: {} for nat-instance(vrf): {} deleted successfully", natInstanceId, id); } - private SnatAddStaticMapping getNat44Request(final InstanceIdentifier<MappingEntry> id, + private Nat44AddDelStaticMapping getNat44Request(final InstanceIdentifier<MappingEntry> id, final MappingEntry mappingEntry, final Long natInstanceId, final boolean isAdd) throws WriteFailedException.CreateFailedException { - final SnatAddStaticMapping request = new SnatAddStaticMapping(); + final Nat44AddDelStaticMapping request = new Nat44AddDelStaticMapping(); request.isAdd = booleanToByte(isAdd); - request.isIp4 = 1; // VPP uses int, model long request.vrfId = natInstanceId.intValue(); diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/NatWriterFactory.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/NatWriterFactory.java index ef2a2afdd..e315da637 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/NatWriterFactory.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/NatWriterFactory.java @@ -22,7 +22,7 @@ import io.fd.hc2vpp.nat.util.MappingEntryContext; import io.fd.honeycomb.translate.impl.write.GenericListWriter; import io.fd.honeycomb.translate.write.WriterFactory; import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.NatConfig; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.mapping.entry.ExternalSrcPort; @@ -46,13 +46,13 @@ public final class NatWriterFactory implements WriterFactory { private static final InstanceIdentifier<MappingEntry> MAP_ENTRY_ID = NAT_INSTANCE_ID.child(MappingTable.class).child(MappingEntry.class); - private final FutureJVppSnatFacade jvppSnat; + private final FutureJVppNatFacade jvppNat; private final MappingEntryContext mappingEntryContext; @Inject - public NatWriterFactory(final FutureJVppSnatFacade jvppSnat, + public NatWriterFactory(final FutureJVppNatFacade jvppNat, final MappingEntryContext mappingEntryContext) { - this.jvppSnat = jvppSnat; + this.jvppNat = jvppNat; this.mappingEntryContext = mappingEntryContext; } @@ -63,7 +63,7 @@ public final class NatWriterFactory implements WriterFactory { // Mapping-entry registry.subtreeAdd(Sets.newHashSet(InstanceIdentifier.create(MappingEntry.class).child(ExternalSrcPort.class), InstanceIdentifier.create(MappingEntry.class).child(InternalSrcPort.class)), - new GenericListWriter<>(MAP_ENTRY_ID, new MappingEntryCustomizer(jvppSnat, mappingEntryContext))); + new GenericListWriter<>(MAP_ENTRY_ID, new MappingEntryCustomizer(jvppNat, mappingEntryContext))); // External address pool has to be executed before mapping entry. Because adding mapping entries requires to // already have an IP range predefined ... in some cases @@ -71,7 +71,7 @@ public final class NatWriterFactory implements WriterFactory { Sets.newHashSet(InstanceIdentifier.create(ExternalIpAddressPool.class) .augmentation(ExternalIpAddressPoolConfigAugmentation.class)), new GenericListWriter<>(NAT_INSTANCE_ID.child(ExternalIpAddressPool.class), - new ExternalIpPoolCustomizer(jvppSnat)), + new ExternalIpPoolCustomizer(jvppNat)), MAP_ENTRY_ID); } } diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/AbstractInterfaceNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/AbstractInterfaceNatCustomizer.java index 4a44fe9a6..28128bec5 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/AbstractInterfaceNatCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/AbstractInterfaceNatCustomizer.java @@ -24,10 +24,10 @@ import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.spi.write.WriterCustomizer; import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.write.WriteFailedException; -import io.fd.vpp.jvpp.snat.dto.Nat64AddDelInterface; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceAddDelFeature; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceAddDelOutputFeature; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceAddDelFeature; +import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceAddDelOutputFeature; +import io.fd.vpp.jvpp.nat.dto.Nat64AddDelInterface; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev170816.InterfaceNatVppFeatureAttributes; @@ -38,12 +38,12 @@ import org.slf4j.Logger; abstract class AbstractInterfaceNatCustomizer<D extends InterfaceNatVppFeatureAttributes & DataObject> implements ByteDataTranslator, JvppReplyConsumer, WriterCustomizer<D> { - private final FutureJVppSnatFacade jvppSnat; + private final FutureJVppNatFacade jvppNat; private final NamingContext ifcContext; - AbstractInterfaceNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, + AbstractInterfaceNatCustomizer(@Nonnull final FutureJVppNatFacade jvppNat, @Nonnull final NamingContext ifcContext) { - this.jvppSnat = jvppSnat; + this.jvppNat = jvppNat; this.ifcContext = ifcContext; } @@ -88,11 +88,11 @@ abstract class AbstractInterfaceNatCustomizer<D extends InterfaceNatVppFeatureAt final boolean enable) throws WriteFailedException { checkArgument(!isNat64Supported(natAttributes), "Post routing Nat64 is not supported by VPP"); - final SnatInterfaceAddDelOutputFeature request = new SnatInterfaceAddDelOutputFeature(); + final Nat44InterfaceAddDelOutputFeature request = new Nat44InterfaceAddDelOutputFeature(); request.isAdd = booleanToByte(enable); request.isInside = getType().isInside; request.swIfIndex = ifcIndex; - getReplyForWrite(jvppSnat.snatInterfaceAddDelOutputFeature(request).toCompletableFuture(), id); + getReplyForWrite(jvppNat.nat44InterfaceAddDelOutputFeature(request).toCompletableFuture(), id); } private void preRoutingNat(@Nonnull final InstanceIdentifier<D> id, final D natAttributes, final int ifcIndex, @@ -113,11 +113,11 @@ abstract class AbstractInterfaceNatCustomizer<D extends InterfaceNatVppFeatureAt private void preRoutingNat44(@Nonnull final InstanceIdentifier<D> id, final int ifcIndex, final boolean enable) throws WriteFailedException { - final SnatInterfaceAddDelFeature request = new SnatInterfaceAddDelFeature(); + final Nat44InterfaceAddDelFeature request = new Nat44InterfaceAddDelFeature(); request.isAdd = booleanToByte(enable); request.isInside = getType().isInside; request.swIfIndex = ifcIndex; - getReplyForWrite(jvppSnat.snatInterfaceAddDelFeature(request).toCompletableFuture(), id); + getReplyForWrite(jvppNat.nat44InterfaceAddDelFeature(request).toCompletableFuture(), id); } private void preRoutingNat64(@Nonnull final InstanceIdentifier<D> id, final int ifcIndex, final boolean enable) @@ -126,7 +126,7 @@ abstract class AbstractInterfaceNatCustomizer<D extends InterfaceNatVppFeatureAt request.isAdd = booleanToByte(enable); request.isInside = getType().isInside; request.swIfIndex = ifcIndex; - getReplyForWrite(jvppSnat.nat64AddDelInterface(request).toCompletableFuture(), id); + getReplyForWrite(jvppNat.nat64AddDelInterface(request).toCompletableFuture(), id); } enum NatType { diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/AbstractSubInterfaceNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/AbstractSubInterfaceNatCustomizer.java index a1c4fa522..6ed6c01a4 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/AbstractSubInterfaceNatCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/AbstractSubInterfaceNatCustomizer.java @@ -34,7 +34,7 @@ package io.fd.hc2vpp.nat.write.ifc; import static com.google.common.base.Preconditions.checkNotNull; import io.fd.hc2vpp.common.translate.util.NamingContext; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev170816.InterfaceNatVppFeatureAttributes; @@ -44,9 +44,9 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; abstract class AbstractSubInterfaceNatCustomizer<D extends InterfaceNatVppFeatureAttributes & DataObject> extends AbstractInterfaceNatCustomizer<D> { - AbstractSubInterfaceNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, + AbstractSubInterfaceNatCustomizer(@Nonnull final FutureJVppNatFacade jvppNat, @Nonnull final NamingContext ifcContext) { - super(jvppSnat, ifcContext); + super(jvppNat, ifcContext); } @Override diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/IfcNatWriterFactory.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/IfcNatWriterFactory.java index 008f2f561..baaf98ced 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/IfcNatWriterFactory.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/IfcNatWriterFactory.java @@ -22,7 +22,7 @@ import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.impl.write.GenericWriter; import io.fd.honeycomb.translate.write.WriterFactory; import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; @@ -42,21 +42,21 @@ public final class IfcNatWriterFactory implements WriterFactory { private static final InstanceIdentifier<Nat> NAT_AUG_ID = IFC_ID.augmentation(NatInterfaceAugmentation.class).child(Nat.class); - private final FutureJVppSnatFacade jvppSnat; + private final FutureJVppNatFacade jvppNat; private final NamingContext ifcContext; @Inject - public IfcNatWriterFactory(final FutureJVppSnatFacade jvppSnat, + public IfcNatWriterFactory(final FutureJVppNatFacade jvppNat, @Named("interface-context") final NamingContext ifcContext) { - this.jvppSnat = jvppSnat; + this.jvppNat = jvppNat; this.ifcContext = ifcContext; } @Override public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) { registry.addAfter(new GenericWriter<>(NAT_AUG_ID.child(Inbound.class), - new InterfaceInboundNatCustomizer(jvppSnat, ifcContext)), IFC_ID); + new InterfaceInboundNatCustomizer(jvppNat, ifcContext)), IFC_ID); registry.addAfter(new GenericWriter<>(NAT_AUG_ID.child(Outbound.class), - new InterfaceOutboundNatCustomizer(jvppSnat, ifcContext)), IFC_ID); + new InterfaceOutboundNatCustomizer(jvppNat, ifcContext)), IFC_ID); } } diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/InterfaceInboundNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/InterfaceInboundNatCustomizer.java index f457e033a..28f3b77d2 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/InterfaceInboundNatCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/InterfaceInboundNatCustomizer.java @@ -17,7 +17,7 @@ package io.fd.hc2vpp.nat.write.ifc; import io.fd.hc2vpp.common.translate.util.NamingContext; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev170816._interface.nat.attributes.nat.Inbound; import org.slf4j.Logger; @@ -27,9 +27,9 @@ final class InterfaceInboundNatCustomizer extends AbstractInterfaceNatCustomizer private static final Logger LOG = LoggerFactory.getLogger(InterfaceInboundNatCustomizer.class); - InterfaceInboundNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, + InterfaceInboundNatCustomizer(@Nonnull final FutureJVppNatFacade jvppNat, @Nonnull final NamingContext ifcContext) { - super(jvppSnat, ifcContext); + super(jvppNat, ifcContext); } @Override diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/InterfaceOutboundNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/InterfaceOutboundNatCustomizer.java index 429278be5..e4d0de2c4 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/InterfaceOutboundNatCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/InterfaceOutboundNatCustomizer.java @@ -17,7 +17,7 @@ package io.fd.hc2vpp.nat.write.ifc; import io.fd.hc2vpp.common.translate.util.NamingContext; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev170816._interface.nat.attributes.nat.Outbound; import org.slf4j.Logger; @@ -27,9 +27,9 @@ final class InterfaceOutboundNatCustomizer extends AbstractInterfaceNatCustomize private static final Logger LOG = LoggerFactory.getLogger(InterfaceOutboundNatCustomizer.class); - InterfaceOutboundNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, + InterfaceOutboundNatCustomizer(@Nonnull final FutureJVppNatFacade jvppNat, @Nonnull final NamingContext ifcContext) { - super(jvppSnat, ifcContext); + super(jvppNat, ifcContext); } @Override diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/SubIfcNatWriterFactory.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/SubIfcNatWriterFactory.java index 23f5ff715..8710acf1b 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/SubIfcNatWriterFactory.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/SubIfcNatWriterFactory.java @@ -22,7 +22,7 @@ import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.impl.write.GenericWriter; import io.fd.honeycomb.translate.write.WriterFactory; import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; @@ -46,21 +46,21 @@ public final class SubIfcNatWriterFactory implements WriterFactory { private static final InstanceIdentifier<Nat> NAT_AUG_ID = SUB_IFC_ID.augmentation(NatSubinterfaceAugmentation.class).child(Nat.class); - private final FutureJVppSnatFacade jvppSnat; + private final FutureJVppNatFacade jvppNat; private final NamingContext ifcContext; @Inject - public SubIfcNatWriterFactory(final FutureJVppSnatFacade jvppSnat, + public SubIfcNatWriterFactory(final FutureJVppNatFacade jvppNat, @Named("interface-context") final NamingContext ifcContext) { - this.jvppSnat = jvppSnat; + this.jvppNat = jvppNat; this.ifcContext = ifcContext; } @Override public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) { registry.addAfter(new GenericWriter<>(NAT_AUG_ID.child(Inbound.class), - new SubInterfaceInboundNatCustomizer(jvppSnat, ifcContext)), SUB_IFC_ID); + new SubInterfaceInboundNatCustomizer(jvppNat, ifcContext)), SUB_IFC_ID); registry.addAfter(new GenericWriter<>(NAT_AUG_ID.child(Outbound.class), - new SubInterfaceOutboundNatCustomizer(jvppSnat, ifcContext)), SUB_IFC_ID); + new SubInterfaceOutboundNatCustomizer(jvppNat, ifcContext)), SUB_IFC_ID); } } diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/SubInterfaceInboundNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/SubInterfaceInboundNatCustomizer.java index b31fec075..5c4b43aa0 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/SubInterfaceInboundNatCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/SubInterfaceInboundNatCustomizer.java @@ -17,7 +17,7 @@ package io.fd.hc2vpp.nat.write.ifc; import io.fd.hc2vpp.common.translate.util.NamingContext; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev170816._interface.nat.attributes.nat.Inbound; import org.slf4j.Logger; @@ -27,9 +27,9 @@ final class SubInterfaceInboundNatCustomizer extends AbstractSubInterfaceNatCust private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceInboundNatCustomizer.class); - SubInterfaceInboundNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, + SubInterfaceInboundNatCustomizer(@Nonnull final FutureJVppNatFacade jvppNat, @Nonnull final NamingContext ifcContext) { - super(jvppSnat, ifcContext); + super(jvppNat, ifcContext); } @Override diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/SubInterfaceOutboundNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/SubInterfaceOutboundNatCustomizer.java index 281c61c3c..775ea6317 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/SubInterfaceOutboundNatCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/SubInterfaceOutboundNatCustomizer.java @@ -17,7 +17,7 @@ package io.fd.hc2vpp.nat.write.ifc; import io.fd.hc2vpp.common.translate.util.NamingContext; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev170816._interface.nat.attributes.nat.Outbound; import org.slf4j.Logger; @@ -27,9 +27,9 @@ final class SubInterfaceOutboundNatCustomizer extends AbstractSubInterfaceNatCus private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceOutboundNatCustomizer.class); - SubInterfaceOutboundNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, + SubInterfaceOutboundNatCustomizer(@Nonnull final FutureJVppNatFacade jvppNat, @Nonnull final NamingContext ifcContext) { - super(jvppSnat, ifcContext); + super(jvppNat, ifcContext); } @Override diff --git a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/NatModuleTest.java b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/NatModuleTest.java index 041a1fc0d..f8d384bd5 100644 --- a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/NatModuleTest.java +++ b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/NatModuleTest.java @@ -39,7 +39,7 @@ import io.fd.honeycomb.translate.read.ReaderFactory; import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer; import io.fd.honeycomb.translate.util.YangDAG; import io.fd.honeycomb.translate.write.WriterFactory; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import java.util.HashSet; import java.util.Set; import org.junit.Before; @@ -94,7 +94,7 @@ public class NatModuleTest { registry.add(new GenericListReader<>( InstanceIdentifier.create(InterfacesState.class).child(Interface.class), mock(ListReaderCustomizer.class))); - }), new NatModule(MockJVppSnatProvider.class), BoundFieldModule.of(this)).injectMembers(this); + }), new NatModule(MockJVppNatProvider.class), BoundFieldModule.of(this)).injectMembers(this); } @Test @@ -117,11 +117,11 @@ public class NatModuleTest { assertNotNull(registryBuilder.build()); } - private static final class MockJVppSnatProvider implements Provider<FutureJVppSnatFacade> { + private static final class MockJVppNatProvider implements Provider<FutureJVppNatFacade> { @Override - public FutureJVppSnatFacade get() { - return mock(FutureJVppSnatFacade.class); + public FutureJVppNatFacade get() { + return mock(FutureJVppNatFacade.class); } } }
\ No newline at end of file diff --git a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/ExternalIpPoolCustomizerTest.java b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/ExternalIpPoolCustomizerTest.java index e6dfeb86f..521320591 100644 --- a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/ExternalIpPoolCustomizerTest.java +++ b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/ExternalIpPoolCustomizerTest.java @@ -27,11 +27,11 @@ import static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v import io.fd.hc2vpp.common.test.read.ListReaderCustomizerTest; import io.fd.honeycomb.translate.spi.read.ReaderCustomizer; -import io.fd.vpp.jvpp.snat.dto.Nat64PoolAddrDetails; -import io.fd.vpp.jvpp.snat.dto.Nat64PoolAddrDetailsReplyDump; -import io.fd.vpp.jvpp.snat.dto.SnatAddressDetails; -import io.fd.vpp.jvpp.snat.dto.SnatAddressDetailsReplyDump; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.dto.Nat44AddressDetails; +import io.fd.vpp.jvpp.nat.dto.Nat44AddressDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat64PoolAddrDetails; +import io.fd.vpp.jvpp.nat.dto.Nat64PoolAddrDetailsReplyDump; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import java.util.Arrays; import java.util.List; import java.util.stream.LongStream; @@ -64,7 +64,7 @@ public class ExternalIpPoolCustomizerTest .child(NatCurrentConfig.class).child(ExternalIpAddressPool.class); @Mock - private FutureJVppSnatFacade jvppSnat; + private FutureJVppNatFacade jvppNat; public ExternalIpPoolCustomizerTest() { super(ExternalIpAddressPool.class, NatCurrentConfigBuilder.class); @@ -72,12 +72,12 @@ public class ExternalIpPoolCustomizerTest @Override protected ReaderCustomizer<ExternalIpAddressPool, ExternalIpAddressPoolBuilder> initCustomizer() { - return new ExternalIpPoolCustomizer(jvppSnat); + return new ExternalIpPoolCustomizer(jvppNat); } @Test public void testReadAttributesNat44() throws Exception { - when(jvppSnat.snatAddressDump(any())).thenReturn(future(dumpReplyNat44NonEmpty())); + when(jvppNat.nat44AddressDump(any())).thenReturn(future(dumpReplyNat44NonEmpty())); final long poolId = 2; final ExternalIpAddressPoolBuilder builder = new ExternalIpAddressPoolBuilder(); getCustomizer().readCurrentAttributes(getId(poolId), builder, ctx); @@ -89,8 +89,8 @@ public class ExternalIpPoolCustomizerTest @Test public void testReadAttributesNat64() throws Exception { - when(jvppSnat.snatAddressDump(any())).thenReturn(future(dumpReplyNat44Empty())); - when(jvppSnat.nat64PoolAddrDump(any())).thenReturn(future(dumpReplyNat64NonEmpty())); + when(jvppNat.nat44AddressDump(any())).thenReturn(future(dumpReplyNat44Empty())); + when(jvppNat.nat64PoolAddrDump(any())).thenReturn(future(dumpReplyNat64NonEmpty())); final long poolId = 2; final ExternalIpAddressPoolBuilder builder = new ExternalIpAddressPoolBuilder(); @@ -103,8 +103,8 @@ public class ExternalIpPoolCustomizerTest @Test public void testReadAttributes() throws Exception { - when(jvppSnat.snatAddressDump(any())).thenReturn(future(dumpReplyNat44NonEmpty())); - when(jvppSnat.nat64PoolAddrDump(any())).thenReturn(future(dumpReplyNat64NonEmpty())); + when(jvppNat.nat44AddressDump(any())).thenReturn(future(dumpReplyNat44NonEmpty())); + when(jvppNat.nat64PoolAddrDump(any())).thenReturn(future(dumpReplyNat64NonEmpty())); final long poolId = 5; final ExternalIpAddressPoolBuilder builder = new ExternalIpAddressPoolBuilder(); @@ -117,8 +117,8 @@ public class ExternalIpPoolCustomizerTest @Test public void testGetAllNat44() throws Exception { - when(jvppSnat.snatAddressDump(any())).thenReturn(future(dumpReplyNat44NonEmpty())); - when(jvppSnat.nat64PoolAddrDump(any())).thenReturn(future(dumpReplyNat64Empty())); + when(jvppNat.nat44AddressDump(any())).thenReturn(future(dumpReplyNat44NonEmpty())); + when(jvppNat.nat64PoolAddrDump(any())).thenReturn(future(dumpReplyNat64Empty())); final List<ExternalIpAddressPoolKey> allIds = getCustomizer().getAllIds(NAT_DEFAULT_POOL_WILDCARDED_ID, ctx); assertThat(allIds, hasItems( @@ -128,8 +128,8 @@ public class ExternalIpPoolCustomizerTest @Test public void testGetAllNat64() throws Exception { - when(jvppSnat.snatAddressDump(any())).thenReturn(future(dumpReplyNat44Empty())); - when(jvppSnat.nat64PoolAddrDump(any())).thenReturn(future(dumpReplyNat64NonEmpty())); + when(jvppNat.nat44AddressDump(any())).thenReturn(future(dumpReplyNat44Empty())); + when(jvppNat.nat64PoolAddrDump(any())).thenReturn(future(dumpReplyNat64NonEmpty())); final List<ExternalIpAddressPoolKey> allIds = getCustomizer().getAllIds(NAT_DEFAULT_POOL_WILDCARDED_ID, ctx); assertThat(allIds, hasItems( @@ -139,8 +139,8 @@ public class ExternalIpPoolCustomizerTest @Test public void testGetAll() throws Exception { - when(jvppSnat.snatAddressDump(any())).thenReturn(future(dumpReplyNat44NonEmpty())); - when(jvppSnat.nat64PoolAddrDump(any())).thenReturn(future(dumpReplyNat64NonEmpty())); + when(jvppNat.nat44AddressDump(any())).thenReturn(future(dumpReplyNat44NonEmpty())); + when(jvppNat.nat64PoolAddrDump(any())).thenReturn(future(dumpReplyNat64NonEmpty())); final List<ExternalIpAddressPoolKey> allIds = getCustomizer().getAllIds(NAT_DEFAULT_POOL_WILDCARDED_ID, ctx); assertThat(allIds, hasItems( @@ -155,8 +155,8 @@ public class ExternalIpPoolCustomizerTest @Test public void testGetAllNoDump() throws Exception { - when(jvppSnat.snatAddressDump(any())).thenReturn(future(dumpReplyNat44Empty())); - when(jvppSnat.nat64PoolAddrDump(any())).thenReturn(future(dumpReplyNat64Empty())); + when(jvppNat.nat44AddressDump(any())).thenReturn(future(dumpReplyNat44Empty())); + when(jvppNat.nat64PoolAddrDump(any())).thenReturn(future(dumpReplyNat64Empty())); assertThat(getCustomizer().getAllIds(NAT_DEFAULT_POOL_WILDCARDED_ID, ctx), empty()); } @@ -164,26 +164,23 @@ public class ExternalIpPoolCustomizerTest return NAT_CONFIG_ID.child(ExternalIpAddressPool.class, new ExternalIpAddressPoolKey(id)); } - private static SnatAddressDetailsReplyDump dumpReplyNat44Empty() { - return new SnatAddressDetailsReplyDump(); + private static Nat44AddressDetailsReplyDump dumpReplyNat44Empty() { + return new Nat44AddressDetailsReplyDump(); } - private static SnatAddressDetailsReplyDump dumpReplyNat44NonEmpty() { - SnatAddressDetailsReplyDump replyDump = dumpReplyNat44Empty(); + private static Nat44AddressDetailsReplyDump dumpReplyNat44NonEmpty() { + Nat44AddressDetailsReplyDump replyDump = dumpReplyNat44Empty(); - SnatAddressDetails detailsOne = new SnatAddressDetails(); + Nat44AddressDetails detailsOne = new Nat44AddressDetails(); detailsOne.ipAddress = new byte[]{-64, -88, 44, 1}; - detailsOne.isIp4 = 1; - SnatAddressDetails detailsTwo = new SnatAddressDetails(); + Nat44AddressDetails detailsTwo = new Nat44AddressDetails(); detailsTwo.ipAddress = new byte[]{-64, -88, 44, 2}; - detailsTwo.isIp4 = 1; - SnatAddressDetails detailsThree = new SnatAddressDetails(); + Nat44AddressDetails detailsThree = new Nat44AddressDetails(); detailsThree.ipAddress = new byte[]{-64, -88, 44, 3}; - detailsThree.isIp4 = 1; - replyDump.snatAddressDetails = Arrays.asList(detailsOne, detailsTwo, detailsThree); + replyDump.nat44AddressDetails = Arrays.asList(detailsOne, detailsTwo, detailsThree); return replyDump; } diff --git a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/MappingEntryCustomizerTest.java b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/MappingEntryCustomizerTest.java index 05513b6e9..5402746ae 100644 --- a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/MappingEntryCustomizerTest.java +++ b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/MappingEntryCustomizerTest.java @@ -27,10 +27,10 @@ import io.fd.hc2vpp.nat.util.MappingEntryContext; import io.fd.honeycomb.translate.spi.read.ReaderCustomizer; import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager; import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor; -import io.fd.vpp.jvpp.snat.dto.Nat64BibDetails; -import io.fd.vpp.jvpp.snat.dto.Nat64BibDetailsReplyDump; -import io.fd.vpp.jvpp.snat.dto.SnatStaticMappingDetails; -import io.fd.vpp.jvpp.snat.dto.SnatStaticMappingDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat44StaticMappingDetails; +import io.fd.vpp.jvpp.nat.dto.Nat44StaticMappingDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat64BibDetails; +import io.fd.vpp.jvpp.nat.dto.Nat64BibDetailsReplyDump; import java.util.Arrays; import java.util.List; import java.util.Optional; @@ -53,14 +53,14 @@ public class MappingEntryCustomizerTest private static final long NAT_MAPPING_ID = 2L; private InstanceIdentifier<MappingEntry> mappingEntryId; private InstanceIdentifier<MappingEntry> mappingEntryWildcarded; - private DumpCacheManager<SnatStaticMappingDetailsReplyDump, Void> nat44DumpManager; + private DumpCacheManager<Nat44StaticMappingDetailsReplyDump, Void> nat44DumpManager; private DumpCacheManager<Nat64BibDetailsReplyDump, Void> nat64DumpManager; @Mock private MappingEntryContext mappingContext; @Mock - private EntityDumpExecutor<SnatStaticMappingDetailsReplyDump, Void> nat44DumpExecutor; + private EntityDumpExecutor<Nat44StaticMappingDetailsReplyDump, Void> nat44DumpExecutor; @Mock private EntityDumpExecutor<Nat64BibDetailsReplyDump, Void> nat64DumpExecutor; @@ -79,9 +79,9 @@ public class MappingEntryCustomizerTest .child(NatInstance.class, new NatInstanceKey(NatInstanceCustomizer.DEFAULT_VRF_ID)) .child(MappingTable.class) .child(MappingEntry.class); - nat44DumpManager = new DumpCacheManager.DumpCacheManagerBuilder<SnatStaticMappingDetailsReplyDump, Void>() + nat44DumpManager = new DumpCacheManager.DumpCacheManagerBuilder<Nat44StaticMappingDetailsReplyDump, Void>() .withExecutor(nat44DumpExecutor) - .acceptOnly(SnatStaticMappingDetailsReplyDump.class) + .acceptOnly(Nat44StaticMappingDetailsReplyDump.class) .build(); nat64DumpManager = new DumpCacheManager.DumpCacheManagerBuilder<Nat64BibDetailsReplyDump, Void>() .withExecutor(nat64DumpExecutor) @@ -91,13 +91,13 @@ public class MappingEntryCustomizerTest @Test public void testReadNat44() throws Exception { - final SnatStaticMappingDetailsReplyDump dumpNat44 = dumpReplyNat44NonEmpty(); + final Nat44StaticMappingDetailsReplyDump dumpNat44 = dumpReplyNat44NonEmpty(); when(nat44DumpExecutor.executeDump(mappingEntryId, null)).thenReturn(dumpNat44); final MappingEntryBuilder builder = new MappingEntryBuilder(); when(mappingContext - .findDetailsNat44(dumpNat44.snatStaticMappingDetails, NatInstanceCustomizer.DEFAULT_VRF_ID.getId(), + .findDetailsNat44(dumpNat44.nat44StaticMappingDetails, NatInstanceCustomizer.DEFAULT_VRF_ID.getId(), NAT_MAPPING_ID, ctx.getMappingContext())) - .thenReturn(Optional.of(dumpNat44.snatStaticMappingDetails.get(2))); + .thenReturn(Optional.of(dumpNat44.nat44StaticMappingDetails.get(2))); getCustomizer().readCurrentAttributes(mappingEntryId, builder, ctx); assertEquals(NAT_MAPPING_ID, builder.getIndex().longValue()); @@ -113,7 +113,7 @@ public class MappingEntryCustomizerTest @Test public void testReadNat64() throws Exception { - when(nat44DumpExecutor.executeDump(mappingEntryId, null)).thenReturn(new SnatStaticMappingDetailsReplyDump()); + when(nat44DumpExecutor.executeDump(mappingEntryId, null)).thenReturn(new Nat44StaticMappingDetailsReplyDump()); final Nat64BibDetailsReplyDump dumpNat64 = dumpReplyNat64NonEmpty(); when(nat64DumpExecutor.executeDump(mappingEntryId, null)).thenReturn(dumpNat64); final MappingEntryBuilder builder = new MappingEntryBuilder(); @@ -136,15 +136,15 @@ public class MappingEntryCustomizerTest @Test public void testReadAllNat44() throws Exception { - final SnatStaticMappingDetailsReplyDump dumpNat44 = dumpReplyNat44NonEmpty(); + final Nat44StaticMappingDetailsReplyDump dumpNat44 = dumpReplyNat44NonEmpty(); when(nat44DumpExecutor.executeDump(mappingEntryWildcarded, null)).thenReturn(dumpNat44); when(nat64DumpExecutor.executeDump(mappingEntryWildcarded, null)).thenReturn(new Nat64BibDetailsReplyDump()); when(mappingContext.getStoredOrArtificialIndex(NatInstanceCustomizer.DEFAULT_VRF_ID.getId(), - dumpNat44.snatStaticMappingDetails.get(0), ctx.getMappingContext())).thenReturn(0L); + dumpNat44.nat44StaticMappingDetails.get(0), ctx.getMappingContext())).thenReturn(0L); when(mappingContext.getStoredOrArtificialIndex(NatInstanceCustomizer.DEFAULT_VRF_ID.getId(), - dumpNat44.snatStaticMappingDetails.get(1), ctx.getMappingContext())).thenReturn(1L); + dumpNat44.nat44StaticMappingDetails.get(1), ctx.getMappingContext())).thenReturn(1L); when(mappingContext.getStoredOrArtificialIndex(NatInstanceCustomizer.DEFAULT_VRF_ID.getId(), - dumpNat44.snatStaticMappingDetails.get(2), ctx.getMappingContext())).thenReturn(2L); + dumpNat44.nat44StaticMappingDetails.get(2), ctx.getMappingContext())).thenReturn(2L); final List<MappingEntryKey> allIds = getCustomizer().getAllIds(mappingEntryWildcarded, ctx); assertThat(allIds, hasItems(new MappingEntryKey(0L), new MappingEntryKey(2L))); @@ -154,7 +154,7 @@ public class MappingEntryCustomizerTest public void testReadAllNat64() throws Exception { final Nat64BibDetailsReplyDump dumpNat64 = dumpReplyNat64NonEmpty(); when(nat44DumpExecutor.executeDump(mappingEntryWildcarded, null)) - .thenReturn(new SnatStaticMappingDetailsReplyDump()); + .thenReturn(new Nat44StaticMappingDetailsReplyDump()); when(nat64DumpExecutor.executeDump(mappingEntryWildcarded, null)).thenReturn(dumpNat64); when(mappingContext.getStoredOrArtificialIndex(NatInstanceCustomizer.DEFAULT_VRF_ID.getId(), dumpNat64.nat64BibDetails.get(0), ctx.getMappingContext())).thenReturn(0L); @@ -169,17 +169,17 @@ public class MappingEntryCustomizerTest @Test public void testReadAll() throws Exception { - final SnatStaticMappingDetailsReplyDump dumpNat44 = dumpReplyNat44NonEmpty(); + final Nat44StaticMappingDetailsReplyDump dumpNat44 = dumpReplyNat44NonEmpty(); final Nat64BibDetailsReplyDump dumpNat64 = dumpReplyNat64NonEmpty(); when(nat44DumpExecutor.executeDump(mappingEntryWildcarded, null)) .thenReturn(dumpNat44); when(nat64DumpExecutor.executeDump(mappingEntryWildcarded, null)).thenReturn(dumpNat64); when(mappingContext.getStoredOrArtificialIndex(NatInstanceCustomizer.DEFAULT_VRF_ID.getId(), - dumpNat44.snatStaticMappingDetails.get(0), ctx.getMappingContext())).thenReturn(0L); + dumpNat44.nat44StaticMappingDetails.get(0), ctx.getMappingContext())).thenReturn(0L); when(mappingContext.getStoredOrArtificialIndex(NatInstanceCustomizer.DEFAULT_VRF_ID.getId(), - dumpNat44.snatStaticMappingDetails.get(1), ctx.getMappingContext())).thenReturn(1L); + dumpNat44.nat44StaticMappingDetails.get(1), ctx.getMappingContext())).thenReturn(1L); when(mappingContext.getStoredOrArtificialIndex(NatInstanceCustomizer.DEFAULT_VRF_ID.getId(), - dumpNat44.snatStaticMappingDetails.get(2), ctx.getMappingContext())).thenReturn(2L); + dumpNat44.nat44StaticMappingDetails.get(2), ctx.getMappingContext())).thenReturn(2L); when(mappingContext.getStoredOrArtificialIndex(NatInstanceCustomizer.DEFAULT_VRF_ID.getId(), dumpNat64.nat64BibDetails.get(0), ctx.getMappingContext())).thenReturn(3L); when(mappingContext.getStoredOrArtificialIndex(NatInstanceCustomizer.DEFAULT_VRF_ID.getId(), @@ -197,11 +197,10 @@ public class MappingEntryCustomizerTest return new MappingEntryCustomizer(nat44DumpManager, nat64DumpManager, mappingContext); } - private static SnatStaticMappingDetailsReplyDump dumpReplyNat44NonEmpty() { - SnatStaticMappingDetailsReplyDump replyDump = new SnatStaticMappingDetailsReplyDump(); + private static Nat44StaticMappingDetailsReplyDump dumpReplyNat44NonEmpty() { + Nat44StaticMappingDetailsReplyDump replyDump = new Nat44StaticMappingDetailsReplyDump(); - SnatStaticMappingDetails detailsOne = new SnatStaticMappingDetails(); - detailsOne.isIp4 = 1; + Nat44StaticMappingDetails detailsOne = new Nat44StaticMappingDetails(); detailsOne.addrOnly = 1; detailsOne.localIpAddress = new byte[]{-64, -88, 2, 1}; detailsOne.localPort = 1234; @@ -209,8 +208,7 @@ public class MappingEntryCustomizerTest detailsOne.externalPort = 5874; detailsOne.vrfId = NatInstanceCustomizer.DEFAULT_VRF_ID.getId().byteValue(); - SnatStaticMappingDetails detailsTwo = new SnatStaticMappingDetails(); - detailsTwo.isIp4 = 1; + Nat44StaticMappingDetails detailsTwo = new Nat44StaticMappingDetails(); detailsTwo.addrOnly = 1; detailsTwo.localIpAddress = new byte[]{-64, -88, 2, 3}; detailsTwo.localPort = 1235; @@ -218,8 +216,7 @@ public class MappingEntryCustomizerTest detailsTwo.externalPort = 5874; detailsTwo.vrfId = 2; - SnatStaticMappingDetails detailsThree = new SnatStaticMappingDetails(); - detailsThree.isIp4 = 1; + Nat44StaticMappingDetails detailsThree = new Nat44StaticMappingDetails(); detailsThree.addrOnly = 0; detailsThree.localIpAddress = new byte[]{-64, -88, 2, 2}; detailsThree.localPort = 1274; @@ -227,7 +224,7 @@ public class MappingEntryCustomizerTest detailsThree.externalPort = 6874; detailsThree.vrfId = NatInstanceCustomizer.DEFAULT_VRF_ID.getId().byteValue(); - replyDump.snatStaticMappingDetails = Arrays.asList(detailsOne, detailsTwo, detailsThree); + replyDump.nat44StaticMappingDetails = Arrays.asList(detailsOne, detailsTwo, detailsThree); return replyDump; } diff --git a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/NatInstanceCustomizerTest.java b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/NatInstanceCustomizerTest.java index 0fad2abee..8978fe5ba 100644 --- a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/NatInstanceCustomizerTest.java +++ b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/NatInstanceCustomizerTest.java @@ -27,10 +27,10 @@ import io.fd.hc2vpp.common.test.read.InitializingListReaderCustomizerTest; import io.fd.honeycomb.translate.read.ReadFailedException; import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager; import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor; -import io.fd.vpp.jvpp.snat.dto.Nat64BibDetails; -import io.fd.vpp.jvpp.snat.dto.Nat64BibDetailsReplyDump; -import io.fd.vpp.jvpp.snat.dto.SnatStaticMappingDetails; -import io.fd.vpp.jvpp.snat.dto.SnatStaticMappingDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat44StaticMappingDetails; +import io.fd.vpp.jvpp.nat.dto.Nat44StaticMappingDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat64BibDetails; +import io.fd.vpp.jvpp.nat.dto.Nat64BibDetailsReplyDump; import java.util.Arrays; import java.util.List; import org.junit.Test; @@ -46,13 +46,13 @@ import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; public class NatInstanceCustomizerTest extends InitializingListReaderCustomizerTest<NatInstance, NatInstanceKey, NatInstanceBuilder> { @Mock - private EntityDumpExecutor<SnatStaticMappingDetailsReplyDump, Void> nat44DumpExecutor; + private EntityDumpExecutor<Nat44StaticMappingDetailsReplyDump, Void> nat44DumpExecutor; @Mock private EntityDumpExecutor<Nat64BibDetailsReplyDump, Void> nat64DumpExecutor; private KeyedInstanceIdentifier<NatInstance, NatInstanceKey> natInstanceId; private InstanceIdentifier<NatInstance> natInstanceWildcarded; - private DumpCacheManager<SnatStaticMappingDetailsReplyDump, Void> mapEntryNat44DumpMgr; + private DumpCacheManager<Nat44StaticMappingDetailsReplyDump, Void> mapEntryNat44DumpMgr; private DumpCacheManager<Nat64BibDetailsReplyDump, Void> mapEntryNat64DumpMgr; public NatInstanceCustomizerTest() { @@ -70,9 +70,9 @@ public class NatInstanceCustomizerTest .child(NatInstance.class, new NatInstanceKey(NatInstanceCustomizer.DEFAULT_VRF_ID)); natInstanceWildcarded = InstanceIdentifier.create(NatInstances.class) .child(NatInstance.class); - mapEntryNat44DumpMgr = new DumpCacheManager.DumpCacheManagerBuilder<SnatStaticMappingDetailsReplyDump, Void>() + mapEntryNat44DumpMgr = new DumpCacheManager.DumpCacheManagerBuilder<Nat44StaticMappingDetailsReplyDump, Void>() .withExecutor(nat44DumpExecutor) - .acceptOnly(SnatStaticMappingDetailsReplyDump.class) + .acceptOnly(Nat44StaticMappingDetailsReplyDump.class) .build(); mapEntryNat64DumpMgr = new DumpCacheManager.DumpCacheManagerBuilder<Nat64BibDetailsReplyDump, Void>() .withExecutor(nat64DumpExecutor) @@ -98,18 +98,18 @@ public class NatInstanceCustomizerTest new NatInstanceKey(5L), new NatInstanceKey(6L))); } - private static SnatStaticMappingDetailsReplyDump nat44NonEmptyDump() { - SnatStaticMappingDetailsReplyDump replyDump = new SnatStaticMappingDetailsReplyDump(); - SnatStaticMappingDetails detailsOne = new SnatStaticMappingDetails(); + private static Nat44StaticMappingDetailsReplyDump nat44NonEmptyDump() { + Nat44StaticMappingDetailsReplyDump replyDump = new Nat44StaticMappingDetailsReplyDump(); + Nat44StaticMappingDetails detailsOne = new Nat44StaticMappingDetails(); detailsOne.vrfId = 1; - SnatStaticMappingDetails detailsTwo = new SnatStaticMappingDetails(); + Nat44StaticMappingDetails detailsTwo = new Nat44StaticMappingDetails(); detailsTwo.vrfId = 2; - SnatStaticMappingDetails detailsThree = new SnatStaticMappingDetails(); + Nat44StaticMappingDetails detailsThree = new Nat44StaticMappingDetails(); detailsThree.vrfId = 3; - replyDump.snatStaticMappingDetails = Arrays.asList(detailsOne, detailsTwo, detailsThree); + replyDump.nat44StaticMappingDetails = Arrays.asList(detailsOne, detailsTwo, detailsThree); return replyDump; } diff --git a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/ifc/InterfaceInboundNatCustomizerTest.java b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/ifc/InterfaceInboundNatCustomizerTest.java index a2d92b4d0..837056f55 100644 --- a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/ifc/InterfaceInboundNatCustomizerTest.java +++ b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/ifc/InterfaceInboundNatCustomizerTest.java @@ -28,12 +28,12 @@ import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.impl.read.GenericReader; import io.fd.honeycomb.translate.spi.read.ReaderCustomizer; import io.fd.honeycomb.translate.util.RWUtils; -import io.fd.vpp.jvpp.snat.dto.Nat64InterfaceDetailsReplyDump; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetails; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetailsReplyDump; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceOutputFeatureDetails; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceOutputFeatureDetailsReplyDump; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceDetails; +import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceOutputFeatureDetails; +import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceOutputFeatureDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat64InterfaceDetailsReplyDump; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import org.junit.Test; import org.mockito.Mock; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState; @@ -55,7 +55,7 @@ public class InterfaceInboundNatCustomizerTest private static final String CTX_NAME = "ifc"; @Mock - private FutureJVppSnatFacade jvppSnat; + private FutureJVppNatFacade jvppNat; private NamingContext ifcContext = new NamingContext(CTX_NAME, CTX_NAME); private InstanceIdentifier<Inbound> id; @@ -76,10 +76,10 @@ public class InterfaceInboundNatCustomizerTest protected void setUp() throws Exception { id = getId(Inbound.class); defineMapping(mappingContext, IFC_NAME, IFC_IDX, CTX_NAME); - when(jvppSnat.snatInterfaceDump(any())).thenReturn(future(new SnatInterfaceDetailsReplyDump())); - when(jvppSnat.snatInterfaceOutputFeatureDump(any())) - .thenReturn(future(new SnatInterfaceOutputFeatureDetailsReplyDump())); - when(jvppSnat.nat64InterfaceDump(any())) + when(jvppNat.nat44InterfaceDump(any())).thenReturn(future(new Nat44InterfaceDetailsReplyDump())); + when(jvppNat.nat44InterfaceOutputFeatureDump(any())) + .thenReturn(future(new Nat44InterfaceOutputFeatureDetailsReplyDump())); + when(jvppNat.nat64InterfaceDump(any())) .thenReturn(future(new Nat64InterfaceDetailsReplyDump())); } @@ -88,22 +88,22 @@ public class InterfaceInboundNatCustomizerTest } private void mockPostRoutingDump() { - final SnatInterfaceOutputFeatureDetailsReplyDump details = new SnatInterfaceOutputFeatureDetailsReplyDump(); - final SnatInterfaceOutputFeatureDetails detail = new SnatInterfaceOutputFeatureDetails(); + final Nat44InterfaceOutputFeatureDetailsReplyDump details = new Nat44InterfaceOutputFeatureDetailsReplyDump(); + final Nat44InterfaceOutputFeatureDetails detail = new Nat44InterfaceOutputFeatureDetails(); detail.isInside = 1; detail.swIfIndex = IFC_IDX; - details.snatInterfaceOutputFeatureDetails = Lists.newArrayList(detail); - when(jvppSnat.snatInterfaceOutputFeatureDump(any())).thenReturn(future(details)); + details.nat44InterfaceOutputFeatureDetails = Lists.newArrayList(detail); + when(jvppNat.nat44InterfaceOutputFeatureDump(any())).thenReturn(future(details)); } @Test public void testPresencePreRouting() throws Exception { - final SnatInterfaceDetailsReplyDump details = new SnatInterfaceDetailsReplyDump(); - final SnatInterfaceDetails detail = new SnatInterfaceDetails(); + final Nat44InterfaceDetailsReplyDump details = new Nat44InterfaceDetailsReplyDump(); + final Nat44InterfaceDetails detail = new Nat44InterfaceDetails(); detail.isInside = 1; detail.swIfIndex = IFC_IDX; - details.snatInterfaceDetails = Lists.newArrayList(detail); - when(jvppSnat.snatInterfaceDump(any())).thenReturn(future(details)); + details.nat44InterfaceDetails = Lists.newArrayList(detail); + when(jvppNat.nat44InterfaceDump(any())).thenReturn(future(details)); assertTrue(getReader().read(id, ctx).isPresent()); } @@ -124,6 +124,6 @@ public class InterfaceInboundNatCustomizerTest @Override protected ReaderCustomizer<Inbound, InboundBuilder> initCustomizer() { - return new InterfaceInboundNatCustomizer(jvppSnat, ifcContext); + return new InterfaceInboundNatCustomizer(jvppNat, ifcContext); } }
\ No newline at end of file diff --git a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/ifc/InterfaceOutboundNatCustomizerTest.java b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/ifc/InterfaceOutboundNatCustomizerTest.java index 4640944a5..0e1bad3da 100644 --- a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/ifc/InterfaceOutboundNatCustomizerTest.java +++ b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/ifc/InterfaceOutboundNatCustomizerTest.java @@ -29,12 +29,12 @@ import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.impl.read.GenericReader; import io.fd.honeycomb.translate.spi.read.ReaderCustomizer; import io.fd.honeycomb.translate.util.RWUtils; -import io.fd.vpp.jvpp.snat.dto.Nat64InterfaceDetailsReplyDump; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetails; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetailsReplyDump; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceOutputFeatureDetails; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceOutputFeatureDetailsReplyDump; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceDetails; +import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceOutputFeatureDetails; +import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceOutputFeatureDetailsReplyDump; +import io.fd.vpp.jvpp.nat.dto.Nat64InterfaceDetailsReplyDump; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import org.junit.Test; import org.mockito.Mock; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev170816._interface.nat.attributes.NatBuilder; @@ -50,7 +50,7 @@ public class InterfaceOutboundNatCustomizerTest private static final String CTX_NAME = "ifc"; @Mock - private FutureJVppSnatFacade jvppSnat; + private FutureJVppNatFacade jvppNat; private NamingContext ifcContext = new NamingContext(CTX_NAME, CTX_NAME); private InstanceIdentifier<Outbound> id; @@ -62,10 +62,10 @@ public class InterfaceOutboundNatCustomizerTest protected void setUp() throws Exception { id = getId(Outbound.class); defineMapping(mappingContext, IFC_NAME, IFC_IDX, CTX_NAME); - when(jvppSnat.snatInterfaceDump(any())).thenReturn(future(new SnatInterfaceDetailsReplyDump())); - when(jvppSnat.snatInterfaceOutputFeatureDump(any())) - .thenReturn(future(new SnatInterfaceOutputFeatureDetailsReplyDump())); - when(jvppSnat.nat64InterfaceDump(any())) + when(jvppNat.nat44InterfaceDump(any())).thenReturn(future(new Nat44InterfaceDetailsReplyDump())); + when(jvppNat.nat44InterfaceOutputFeatureDump(any())) + .thenReturn(future(new Nat44InterfaceOutputFeatureDetailsReplyDump())); + when(jvppNat.nat64InterfaceDump(any())) .thenReturn(future(new Nat64InterfaceDetailsReplyDump())); } @@ -74,22 +74,22 @@ public class InterfaceOutboundNatCustomizerTest } private void mockPostRoutingDump() { - final SnatInterfaceOutputFeatureDetailsReplyDump details = new SnatInterfaceOutputFeatureDetailsReplyDump(); - final SnatInterfaceOutputFeatureDetails detail = new SnatInterfaceOutputFeatureDetails(); + final Nat44InterfaceOutputFeatureDetailsReplyDump details = new Nat44InterfaceOutputFeatureDetailsReplyDump(); + final Nat44InterfaceOutputFeatureDetails detail = new Nat44InterfaceOutputFeatureDetails(); detail.isInside = 0; detail.swIfIndex = IFC_IDX; - details.snatInterfaceOutputFeatureDetails = Lists.newArrayList(detail); - when(jvppSnat.snatInterfaceOutputFeatureDump(any())).thenReturn(future(details)); + details.nat44InterfaceOutputFeatureDetails = Lists.newArrayList(detail); + when(jvppNat.nat44InterfaceOutputFeatureDump(any())).thenReturn(future(details)); } @Test public void testPresencePreRouting() throws Exception { - final SnatInterfaceDetailsReplyDump details = new SnatInterfaceDetailsReplyDump(); - final SnatInterfaceDetails detail = new SnatInterfaceDetails(); + final Nat44InterfaceDetailsReplyDump details = new Nat44InterfaceDetailsReplyDump(); + final Nat44InterfaceDetails detail = new Nat44InterfaceDetails(); detail.isInside = 0; detail.swIfIndex = IFC_IDX; - details.snatInterfaceDetails = Lists.newArrayList(detail); - when(jvppSnat.snatInterfaceDump(any())).thenReturn(future(details)); + details.nat44InterfaceDetails = Lists.newArrayList(detail); + when(jvppNat.nat44InterfaceDump(any())).thenReturn(future(details)); assertTrue(getReader().read(id, ctx).isPresent()); } @@ -110,6 +110,6 @@ public class InterfaceOutboundNatCustomizerTest @Override protected ReaderCustomizer<Outbound, OutboundBuilder> initCustomizer() { - return new InterfaceOutboundNatCustomizer(jvppSnat, ifcContext); + return new InterfaceOutboundNatCustomizer(jvppNat, ifcContext); } }
\ No newline at end of file diff --git a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/util/MappingEntryContextTest.java b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/util/MappingEntryContextTest.java index a6643601e..cd173fddc 100644 --- a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/util/MappingEntryContextTest.java +++ b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/util/MappingEntryContextTest.java @@ -28,7 +28,7 @@ import com.google.common.base.Optional; import com.google.common.collect.Lists; import io.fd.honeycomb.translate.MappingContext; import io.fd.hc2vpp.common.translate.util.Ipv4Translator; -import io.fd.vpp.jvpp.snat.dto.SnatStaticMappingDetails; +import io.fd.vpp.jvpp.nat.dto.Nat44StaticMappingDetails; import java.util.Collections; import java.util.List; import org.junit.Before; @@ -81,7 +81,7 @@ public class MappingEntryContextTest implements Ipv4Translator { final long natId = 0; final long entryId = 12; final MappingEntry entry = getEntry(entryId, "192.168.1.5", "17.14.4.6"); - final SnatStaticMappingDetails details = getDetails(entryId, "192.168.1.5", "17.14.4.6"); + final Nat44StaticMappingDetails details = getDetails(entryId, "192.168.1.5", "17.14.4.6"); when(mappingCtx.read(MappingEntryContext.getId(natId, MappingEntryContext.entryToKey(entry)))) .thenReturn(Optional.of(MappingEntryContext.toCtxMapEntry(entry, entryId))); @@ -94,11 +94,11 @@ public class MappingEntryContextTest implements Ipv4Translator { public void testFindDetails() throws Exception { final long natId = 0; final MappingEntry entry = getEntry(0, "192.168.1.5", "17.14.4.6"); - final SnatStaticMappingDetails details = getDetails(0, "192.168.1.5", "17.14.4.6"); + final Nat44StaticMappingDetails details = getDetails(0, "192.168.1.5", "17.14.4.6"); final MappingEntry entry2 = getEntry(1, "192.168.1.8", "17.14.4.10"); - final SnatStaticMappingDetails details2 = getDetails(1, "192.168.1.8", "17.14.4.10"); + final Nat44StaticMappingDetails details2 = getDetails(1, "192.168.1.8", "17.14.4.10"); - final List<SnatStaticMappingDetails> someDetails = Lists.newArrayList(details, details2); + final List<Nat44StaticMappingDetails> someDetails = Lists.newArrayList(details, details2); when(mappingCtx.read(MappingEntryContext.getTableId(natId))) .thenReturn(Optional.of(new MappingTableBuilder() @@ -114,8 +114,8 @@ public class MappingEntryContextTest implements Ipv4Translator { public void testFindDetailsNoMappingStored() throws Exception { final long natId = 0; final long entryId = 12; - final SnatStaticMappingDetails details = getDetails(entryId, "192.168.1.5", "17.14.4.6"); - final List<SnatStaticMappingDetails> someDetails = Lists.newArrayList(details); + final Nat44StaticMappingDetails details = getDetails(entryId, "192.168.1.5", "17.14.4.6"); + final List<Nat44StaticMappingDetails> someDetails = Lists.newArrayList(details); when(mappingCtx.read(MappingEntryContext.getTableId(natId))).thenReturn(Optional.absent()); ctx.findDetailsNat44(someDetails, natId, entryId, mappingCtx); @@ -125,8 +125,8 @@ public class MappingEntryContextTest implements Ipv4Translator { public void testFindDetailsNoMappingStored2() throws Exception { final long natId = 0; final long entryId = 12; - final SnatStaticMappingDetails details = getDetails(entryId, "192.168.1.5", "17.14.4.6"); - final List<SnatStaticMappingDetails> someDetails = Lists.newArrayList(details); + final Nat44StaticMappingDetails details = getDetails(entryId, "192.168.1.5", "17.14.4.6"); + final List<Nat44StaticMappingDetails> someDetails = Lists.newArrayList(details); when(mappingCtx.read(MappingEntryContext.getTableId(natId))) .thenReturn(Optional.of(new MappingTableBuilder().setMappingEntry(Collections.emptyList()).build())); @@ -148,7 +148,7 @@ public class MappingEntryContextTest implements Ipv4Translator { final long newEntryId = 18956; final MappingEntry newEntry = getEntry(newEntryId, "192.168.1.99", "17.14.4.99"); - final SnatStaticMappingDetails newDetails = getDetails(newEntryId, "192.168.1.99", "17.14.4.99"); + final Nat44StaticMappingDetails newDetails = getDetails(newEntryId, "192.168.1.99", "17.14.4.99"); when(mappingCtx.read(MappingEntryContext.getId(natId, MappingEntryContext.entryToKey(newEntry)))) .thenReturn(Optional.absent()); @@ -165,14 +165,13 @@ public class MappingEntryContextTest implements Ipv4Translator { assertEquals(newEntryId, ctx.getStoredOrArtificialIndex(natId, newDetails, mappingCtx)); } - private SnatStaticMappingDetails getDetails(final long vrfId, final String localIp, final String externIp) { - final SnatStaticMappingDetails snatStaticMappingDetails = new SnatStaticMappingDetails(); - snatStaticMappingDetails.vrfId = (int) vrfId; - snatStaticMappingDetails.addrOnly = 1; - snatStaticMappingDetails.isIp4 = 1; - snatStaticMappingDetails.localIpAddress = ipv4AddressNoZoneToArray(localIp); - snatStaticMappingDetails.externalIpAddress = ipv4AddressNoZoneToArray(externIp); - return snatStaticMappingDetails; + private Nat44StaticMappingDetails getDetails(final long vrfId, final String localIp, final String externIp) { + final Nat44StaticMappingDetails nat44StaticMappingDetails = new Nat44StaticMappingDetails(); + nat44StaticMappingDetails.vrfId = (int) vrfId; + nat44StaticMappingDetails.addrOnly = 1; + nat44StaticMappingDetails.localIpAddress = ipv4AddressNoZoneToArray(localIp); + nat44StaticMappingDetails.externalIpAddress = ipv4AddressNoZoneToArray(externIp); + return nat44StaticMappingDetails; } @Test(expected = IllegalArgumentException.class) diff --git a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ExternalIpPoolCustomizerTest.java b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ExternalIpPoolCustomizerTest.java index 8f25bfa12..db68ecf6a 100644 --- a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ExternalIpPoolCustomizerTest.java +++ b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ExternalIpPoolCustomizerTest.java @@ -27,11 +27,11 @@ import io.fd.hc2vpp.nat.NatTestSchemaContext; import io.fd.honeycomb.test.tools.HoneycombTestRunner; import io.fd.honeycomb.test.tools.annotations.InjectTestData; import io.fd.honeycomb.translate.write.WriteFailedException; -import io.fd.vpp.jvpp.snat.dto.Nat64AddDelPoolAddrRange; -import io.fd.vpp.jvpp.snat.dto.Nat64AddDelPoolAddrRangeReply; -import io.fd.vpp.jvpp.snat.dto.SnatAddAddressRange; -import io.fd.vpp.jvpp.snat.dto.SnatAddAddressRangeReply; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.dto.Nat44AddDelAddressRange; +import io.fd.vpp.jvpp.nat.dto.Nat44AddDelAddressRangeReply; +import io.fd.vpp.jvpp.nat.dto.Nat64AddDelPoolAddrRange; +import io.fd.vpp.jvpp.nat.dto.Nat64AddDelPoolAddrRangeReply; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; @@ -56,14 +56,14 @@ public class ExternalIpPoolCustomizerTest extends WriterCustomizerTest implement private static final String NAT_INSTANCES_PATH = "/ietf-nat:nat-config/ietf-nat:nat-instances"; @Mock - private FutureJVppSnatFacade jvppSnat; + private FutureJVppNatFacade jvppNat; private ExternalIpPoolCustomizer customizer; @Override public void setUpTest() { - customizer = new ExternalIpPoolCustomizer(jvppSnat); - when(jvppSnat.snatAddAddressRange(any())).thenReturn(future(new SnatAddAddressRangeReply())); - when(jvppSnat.nat64AddDelPoolAddrRange(any())).thenReturn(future(new Nat64AddDelPoolAddrRangeReply())); + customizer = new ExternalIpPoolCustomizer(jvppNat); + when(jvppNat.nat44AddDelAddressRange(any())).thenReturn(future(new Nat44AddDelAddressRangeReply())); + when(jvppNat.nat64AddDelPoolAddrRange(any())).thenReturn(future(new Nat64AddDelPoolAddrRangeReply())); } @Test @@ -71,8 +71,8 @@ public class ExternalIpPoolCustomizerTest extends WriterCustomizerTest implement @InjectTestData(resourcePath = "/nat44/external-ip-pool.json", id = NAT_INSTANCES_PATH) NatInstances data) throws WriteFailedException { customizer.writeCurrentAttributes(IID, extractIpPool(data), writeContext); - final SnatAddAddressRange expectedRequest = getExpectedRequestNat44(true); - verify(jvppSnat).snatAddAddressRange(expectedRequest); + final Nat44AddDelAddressRange expectedRequest = getExpectedRequestNat44(true); + verify(jvppNat).nat44AddDelAddressRange(expectedRequest); } @Test @@ -81,7 +81,7 @@ public class ExternalIpPoolCustomizerTest extends WriterCustomizerTest implement throws WriteFailedException { customizer.writeCurrentAttributes(IID, extractIpPool(data), writeContext); final Nat64AddDelPoolAddrRange expectedRequest = getExpectedRequestNat64(true); - verify(jvppSnat).nat64AddDelPoolAddrRange(expectedRequest); + verify(jvppNat).nat64AddDelPoolAddrRange(expectedRequest); } @Test(expected = UnsupportedOperationException.class) @@ -95,8 +95,8 @@ public class ExternalIpPoolCustomizerTest extends WriterCustomizerTest implement @InjectTestData(resourcePath = "/nat44/external-ip-pool.json", id = NAT_INSTANCES_PATH) NatInstances data) throws WriteFailedException { customizer.deleteCurrentAttributes(IID, extractIpPool(data), writeContext); - final SnatAddAddressRange expectedRequest = getExpectedRequestNat44(false); - verify(jvppSnat).snatAddAddressRange(expectedRequest); + final Nat44AddDelAddressRange expectedRequest = getExpectedRequestNat44(false); + verify(jvppNat).nat44AddDelAddressRange(expectedRequest); } @Test @@ -105,7 +105,7 @@ public class ExternalIpPoolCustomizerTest extends WriterCustomizerTest implement throws WriteFailedException { customizer.deleteCurrentAttributes(IID, extractIpPool(data), writeContext); final Nat64AddDelPoolAddrRange expectedRequest = getExpectedRequestNat64(false); - verify(jvppSnat).nat64AddDelPoolAddrRange(expectedRequest); + verify(jvppNat).nat64AddDelPoolAddrRange(expectedRequest); } private static ExternalIpAddressPool extractIpPool(NatInstances data) { @@ -113,10 +113,9 @@ public class ExternalIpPoolCustomizerTest extends WriterCustomizerTest implement return data.getNatInstance().get(0).getExternalIpAddressPool().get(0); } - private SnatAddAddressRange getExpectedRequestNat44(final boolean isAdd) { - final SnatAddAddressRange expectedRequest = new SnatAddAddressRange(); + private Nat44AddDelAddressRange getExpectedRequestNat44(final boolean isAdd) { + final Nat44AddDelAddressRange expectedRequest = new Nat44AddDelAddressRange(); expectedRequest.isAdd = booleanToByte(isAdd); - expectedRequest.isIp4 = 1; expectedRequest.firstIpAddress = new byte[] {(byte) 192, (byte) 168, 1, 0}; expectedRequest.lastIpAddress = new byte[] {(byte) 192, (byte) 168, 1, (byte) 255}; return expectedRequest; diff --git a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/MappingEntryCustomizerTest.java b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/MappingEntryCustomizerTest.java index 96726cb11..29869381a 100644 --- a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/MappingEntryCustomizerTest.java +++ b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/MappingEntryCustomizerTest.java @@ -26,11 +26,11 @@ import io.fd.hc2vpp.nat.util.MappingEntryContext; import io.fd.honeycomb.test.tools.HoneycombTestRunner; import io.fd.honeycomb.test.tools.annotations.InjectTestData; import io.fd.honeycomb.translate.write.WriteFailedException; -import io.fd.vpp.jvpp.snat.dto.Nat64AddDelStaticBib; -import io.fd.vpp.jvpp.snat.dto.Nat64AddDelStaticBibReply; -import io.fd.vpp.jvpp.snat.dto.SnatAddStaticMapping; -import io.fd.vpp.jvpp.snat.dto.SnatAddStaticMappingReply; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.dto.Nat44AddDelStaticMapping; +import io.fd.vpp.jvpp.nat.dto.Nat44AddDelStaticMappingReply; +import io.fd.vpp.jvpp.nat.dto.Nat64AddDelStaticBib; +import io.fd.vpp.jvpp.nat.dto.Nat64AddDelStaticBibReply; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; @@ -56,16 +56,16 @@ public class MappingEntryCustomizerTest extends WriterCustomizerTest implements + "ietf-nat:nat-instance[ietf-nat:id='" + NAT_INSTANCE_ID + "']/ietf-nat:mapping-table"; @Mock - private FutureJVppSnatFacade jvppSnat; + private FutureJVppNatFacade jvppNat; @Mock private MappingEntryContext mappingContext; private MappingEntryCustomizer customizer; @Override public void setUpTest() { - customizer = new MappingEntryCustomizer(jvppSnat, mappingContext); - when(jvppSnat.snatAddStaticMapping(any())).thenReturn(future(new SnatAddStaticMappingReply())); - when(jvppSnat.nat64AddDelStaticBib(any())).thenReturn(future(new Nat64AddDelStaticBibReply())); + customizer = new MappingEntryCustomizer(jvppNat, mappingContext); + when(jvppNat.nat44AddDelStaticMapping(any())).thenReturn(future(new Nat44AddDelStaticMappingReply())); + when(jvppNat.nat64AddDelStaticBib(any())).thenReturn(future(new Nat64AddDelStaticBibReply())); } @Test @@ -73,9 +73,9 @@ public class MappingEntryCustomizerTest extends WriterCustomizerTest implements @InjectTestData(resourcePath = "/nat44/static-mapping.json", id = MAPPING_TABLE_PATH) MappingTable data) throws WriteFailedException { customizer.writeCurrentAttributes(IID, extractMappingEntry(data), writeContext); - final SnatAddStaticMapping expectedRequest = getExpectedNat44Request(); + final Nat44AddDelStaticMapping expectedRequest = getExpectedNat44Request(); expectedRequest.isAdd = 1; - verify(jvppSnat).snatAddStaticMapping(expectedRequest); + verify(jvppNat).nat44AddDelStaticMapping(expectedRequest); } @Test @@ -85,7 +85,7 @@ public class MappingEntryCustomizerTest extends WriterCustomizerTest implements customizer.writeCurrentAttributes(IID, extractMappingEntry(data), writeContext); final Nat64AddDelStaticBib expectedRequest = getExpectedNat64Request(); expectedRequest.isAdd = 1; - verify(jvppSnat).nat64AddDelStaticBib(expectedRequest); + verify(jvppNat).nat64AddDelStaticBib(expectedRequest); } @Test(expected = IllegalArgumentException.class) @@ -102,10 +102,10 @@ public class MappingEntryCustomizerTest extends WriterCustomizerTest implements throws WriteFailedException { customizer.updateCurrentAttributes(IID, extractMappingEntry(before), extractMappingEntry(after), writeContext); final Nat64AddDelStaticBib expectedDeleteRequest = getExpectedNat64Request(); - verify(jvppSnat).nat64AddDelStaticBib(expectedDeleteRequest); + verify(jvppNat).nat64AddDelStaticBib(expectedDeleteRequest); final Nat64AddDelStaticBib expectedUpdateRequest = getExpectedNat64UpdateRequest(); expectedUpdateRequest.isAdd = 1; - verify(jvppSnat).nat64AddDelStaticBib(expectedUpdateRequest); + verify(jvppNat).nat64AddDelStaticBib(expectedUpdateRequest); } @Test @@ -113,7 +113,7 @@ public class MappingEntryCustomizerTest extends WriterCustomizerTest implements @InjectTestData(resourcePath = "/nat44/static-mapping.json", id = MAPPING_TABLE_PATH) MappingTable data) throws WriteFailedException { customizer.deleteCurrentAttributes(IID, extractMappingEntry(data), writeContext); - verify(jvppSnat).snatAddStaticMapping(getExpectedNat44Request()); + verify(jvppNat).nat44AddDelStaticMapping(getExpectedNat44Request()); } @Test @@ -121,7 +121,7 @@ public class MappingEntryCustomizerTest extends WriterCustomizerTest implements @InjectTestData(resourcePath = "/nat64/static-mapping.json", id = MAPPING_TABLE_PATH) MappingTable data) throws WriteFailedException { customizer.deleteCurrentAttributes(IID, extractMappingEntry(data), writeContext); - verify(jvppSnat).nat64AddDelStaticBib(getExpectedNat64Request()); + verify(jvppNat).nat64AddDelStaticBib(getExpectedNat64Request()); } private static MappingEntry extractMappingEntry(MappingTable data) { @@ -129,9 +129,8 @@ public class MappingEntryCustomizerTest extends WriterCustomizerTest implements return data.getMappingEntry().get(0); } - private static SnatAddStaticMapping getExpectedNat44Request() { - final SnatAddStaticMapping expectedRequest = new SnatAddStaticMapping(); - expectedRequest.isIp4 = 1; + private static Nat44AddDelStaticMapping getExpectedNat44Request() { + final Nat44AddDelStaticMapping expectedRequest = new Nat44AddDelStaticMapping(); expectedRequest.addrOnly = 1; expectedRequest.protocol = 17; // udp expectedRequest.vrfId = (int) NAT_INSTANCE_ID; @@ -150,9 +149,8 @@ public class MappingEntryCustomizerTest extends WriterCustomizerTest implements return expectedRequest; } - private static SnatAddStaticMapping getExpectedNat44UpdateRequest() { - final SnatAddStaticMapping expectedRequest = new SnatAddStaticMapping(); - expectedRequest.isIp4 = 1; + private static Nat44AddDelStaticMapping getExpectedNat44UpdateRequest() { + final Nat44AddDelStaticMapping expectedRequest = new Nat44AddDelStaticMapping(); expectedRequest.addrOnly = 1; expectedRequest.protocol = 17; // udp expectedRequest.vrfId = (int) NAT_INSTANCE_ID; diff --git a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/AbstractNatCustomizerTest.java b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/AbstractNatCustomizerTest.java index c70999907..611103d40 100644 --- a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/AbstractNatCustomizerTest.java +++ b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/AbstractNatCustomizerTest.java @@ -24,13 +24,13 @@ import static org.mockito.Mockito.when; import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; import io.fd.hc2vpp.common.translate.util.ByteDataTranslator; import io.fd.hc2vpp.common.translate.util.NamingContext; -import io.fd.vpp.jvpp.snat.dto.Nat64AddDelInterface; -import io.fd.vpp.jvpp.snat.dto.Nat64AddDelInterfaceReply; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceAddDelFeature; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceAddDelFeatureReply; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceAddDelOutputFeature; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceAddDelOutputFeatureReply; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceAddDelFeature; +import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceAddDelFeatureReply; +import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceAddDelOutputFeature; +import io.fd.vpp.jvpp.nat.dto.Nat44InterfaceAddDelOutputFeatureReply; +import io.fd.vpp.jvpp.nat.dto.Nat64AddDelInterface; +import io.fd.vpp.jvpp.nat.dto.Nat64AddDelInterfaceReply; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import org.junit.Test; import org.mockito.Mock; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev170816.InterfaceNatVppFeatureAttributes; @@ -47,17 +47,17 @@ abstract class AbstractNatCustomizerTest<D extends InterfaceNatVppFeatureAttribu private T customizer; @Mock - private FutureJVppSnatFacade snatApi; + private FutureJVppNatFacade natApi; private NamingContext ifcNamingCtx = new NamingContext("generatedIfaceName", IFC_CTX_NAME); @Override public void setUpTest() { - customizer = getCustomizer(snatApi, ifcNamingCtx); + customizer = getCustomizer(natApi, ifcNamingCtx); defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME); - when(snatApi.snatInterfaceAddDelFeature(any())).thenReturn(future(new SnatInterfaceAddDelFeatureReply())); - when(snatApi.snatInterfaceAddDelOutputFeature(any())) - .thenReturn(future(new SnatInterfaceAddDelOutputFeatureReply())); - when(snatApi.nat64AddDelInterface(any())).thenReturn(future(new Nat64AddDelInterfaceReply())); + when(natApi.nat44InterfaceAddDelFeature(any())).thenReturn(future(new Nat44InterfaceAddDelFeatureReply())); + when(natApi.nat44InterfaceAddDelOutputFeature(any())) + .thenReturn(future(new Nat44InterfaceAddDelOutputFeatureReply())); + when(natApi.nat64AddDelInterface(any())).thenReturn(future(new Nat64AddDelInterfaceReply())); } @Test @@ -71,8 +71,8 @@ abstract class AbstractNatCustomizerTest<D extends InterfaceNatVppFeatureAttribu public void testWritePostRouting() throws Exception { final D data = getPostRoutingConfig(); customizer.writeCurrentAttributes(getIId(IFACE_NAME), data, writeContext); - verify(snatApi).snatInterfaceAddDelOutputFeature(expectedPostRoutingRequest(data, true)); - verify(snatApi, never()).nat64AddDelInterface(any()); // VPP does not support it currently + verify(natApi).nat44InterfaceAddDelOutputFeature(expectedPostRoutingRequest(data, true)); + verify(natApi, never()).nat64AddDelInterface(any()); // VPP does not support it currently } @Test(expected = UnsupportedOperationException.class) @@ -98,26 +98,26 @@ abstract class AbstractNatCustomizerTest<D extends InterfaceNatVppFeatureAttribu public void testDeletePostRouting() throws Exception { final D data = getPostRoutingConfig(); customizer.deleteCurrentAttributes(getIId(IFACE_NAME), data, writeContext); - verify(snatApi).snatInterfaceAddDelOutputFeature(expectedPostRoutingRequest(data, false)); - verify(snatApi, never()).nat64AddDelInterface(any()); // VPP does not support it currently + verify(natApi).nat44InterfaceAddDelOutputFeature(expectedPostRoutingRequest(data, false)); + verify(natApi, never()).nat64AddDelInterface(any()); // VPP does not support it currently } private void verifyPreRouting(final D data, final boolean isAdd) { if (data.isNat44Support()) { - verify(snatApi).snatInterfaceAddDelFeature(expectedPreRoutingNat44Request(data, isAdd)); + verify(natApi).nat44InterfaceAddDelFeature(expectedPreRoutingNat44Request(data, isAdd)); } else { - verify(snatApi, never()).snatInterfaceAddDelFeature(any()); + verify(natApi, never()).nat44InterfaceAddDelFeature(any()); } if (data.isNat64Support() != null && data.isNat64Support()) { - verify(snatApi).nat64AddDelInterface(expectedPreRoutingNat64Request(data, isAdd)); + verify(natApi).nat64AddDelInterface(expectedPreRoutingNat64Request(data, isAdd)); } else { - verify(snatApi, never()).nat64AddDelInterface(any()); + verify(natApi, never()).nat64AddDelInterface(any()); } } - private SnatInterfaceAddDelFeature expectedPreRoutingNat44Request(final D data, boolean isAdd) { - SnatInterfaceAddDelFeature request = new SnatInterfaceAddDelFeature(); + private Nat44InterfaceAddDelFeature expectedPreRoutingNat44Request(final D data, boolean isAdd) { + Nat44InterfaceAddDelFeature request = new Nat44InterfaceAddDelFeature(); request.isInside = booleanToByte(data instanceof Inbound); request.swIfIndex = IFACE_ID; request.isAdd = booleanToByte(isAdd); @@ -132,8 +132,8 @@ abstract class AbstractNatCustomizerTest<D extends InterfaceNatVppFeatureAttribu return request; } - private SnatInterfaceAddDelOutputFeature expectedPostRoutingRequest(final D data, boolean isAdd) { - SnatInterfaceAddDelOutputFeature request = new SnatInterfaceAddDelOutputFeature(); + private Nat44InterfaceAddDelOutputFeature expectedPostRoutingRequest(final D data, boolean isAdd) { + Nat44InterfaceAddDelOutputFeature request = new Nat44InterfaceAddDelOutputFeature(); request.isInside = booleanToByte(data instanceof Inbound); request.swIfIndex = IFACE_ID; request.isAdd = booleanToByte(isAdd); @@ -146,5 +146,5 @@ abstract class AbstractNatCustomizerTest<D extends InterfaceNatVppFeatureAttribu protected abstract InstanceIdentifier<D> getIId(final String ifaceName); - protected abstract T getCustomizer(final FutureJVppSnatFacade snatApi, final NamingContext ifcNamingCtx); + protected abstract T getCustomizer(final FutureJVppNatFacade natApi, final NamingContext ifcNamingCtx); }
\ No newline at end of file diff --git a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/InterfaceInboundNatCustomizerTest.java b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/InterfaceInboundNatCustomizerTest.java index 74dd59938..b05c83e1a 100644 --- a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/InterfaceInboundNatCustomizerTest.java +++ b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/InterfaceInboundNatCustomizerTest.java @@ -17,7 +17,7 @@ package io.fd.hc2vpp.nat.write.ifc; import io.fd.hc2vpp.common.translate.util.NamingContext; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey; @@ -48,8 +48,8 @@ public class InterfaceInboundNatCustomizerTest } @Override - protected InterfaceInboundNatCustomizer getCustomizer(final FutureJVppSnatFacade snatApi, + protected InterfaceInboundNatCustomizer getCustomizer(final FutureJVppNatFacade natApi, final NamingContext ifcNamingCtx) { - return new InterfaceInboundNatCustomizer(snatApi, ifcNamingCtx); + return new InterfaceInboundNatCustomizer(natApi, ifcNamingCtx); } }
\ No newline at end of file diff --git a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/InterfaceOutboundNatCustomizerTest.java b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/InterfaceOutboundNatCustomizerTest.java index ddd589472..f15182659 100644 --- a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/InterfaceOutboundNatCustomizerTest.java +++ b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/InterfaceOutboundNatCustomizerTest.java @@ -17,7 +17,7 @@ package io.fd.hc2vpp.nat.write.ifc; import io.fd.hc2vpp.common.translate.util.NamingContext; -import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; +import io.fd.vpp.jvpp.nat.future.FutureJVppNatFacade; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey; @@ -48,8 +48,8 @@ public class InterfaceOutboundNatCustomizerTest } @Override - protected InterfaceOutboundNatCustomizer getCustomizer(final FutureJVppSnatFacade snatApi, + protected InterfaceOutboundNatCustomizer getCustomizer(final FutureJVppNatFacade natApi, final NamingContext ifcNamingCtx) { - return new InterfaceOutboundNatCustomizer(snatApi, ifcNamingCtx); + return new InterfaceOutboundNatCustomizer(natApi, ifcNamingCtx); } }
\ No newline at end of file diff --git a/nat/nat_postman_collection.json b/nat/nat_postman_collection.json index b7d918417..49ea7b91f 100644 --- a/nat/nat_postman_collection.json +++ b/nat/nat_postman_collection.json @@ -100,7 +100,7 @@ "helperAttributes": {}, "time": 1475154424741, "name": "Set NAT outbound for ifc - cfg", - "description": "Setting interface NAT outbound feature\n\nCLI: set interface snat in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT", + "description": "Setting interface NAT outbound feature\n\nCLI: set interface nat44 in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/NAT", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "{\r\n \r\n \"outbound\" : {}\r\n \r\n}", @@ -164,7 +164,7 @@ "helperAttributes": {}, "time": 1502799964039, "name": "Add Nat64 address pool", - "description": "CLI: vppctl nat64 add pool address 172.16.2.0 - 172.16.2.4\n\nCan be verified with\nvppctl show nat64 pool\n\nMore information:\nhttps://wiki.fd.io/view/VPP/SNAT\nhttps://docs.fd.io/vpp/17.10/clicmd_src_plugins_snat.html#clicmd_nat64_add_pool_address", + "description": "CLI: vppctl nat64 add pool address 172.16.2.0 - 172.16.2.4\n\nCan be verified with\nvppctl show nat64 pool\n\nMore information:\nhttps://wiki.fd.io/view/VPP/NAT", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "{\r\n\t\"external-ip-address-pool\" : {\r\n\t\t\"pool-id\": 1,\r\n\t\t\"external-ip-pool\": \"172.16.2.0/30\",\r\n \"vpp-nat:pool-type\": \"nat64\"\r\n\t}\r\n}" @@ -184,7 +184,7 @@ "helperAttributes": {}, "time": 1501658658435, "name": "Set NAT inbound for ifc (post routing) - cfg", - "description": "Setting interface NAT inbound output-feature (post routing)\n\nCLI: set interface snat in <intfc> out <intfc> output-feature [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT", + "description": "Setting interface NAT inbound output-feature (post routing)\n\nCLI: set interface nat44 in <intfc> out <intfc> output-feature [del]\n\nMore information: https://wiki.fd.io/view/VPP/NAT", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "{\r\n \r\n \"inbound\" : {\r\n \t\"post-routing\" : true\r\n }\r\n \r\n}", @@ -205,7 +205,7 @@ "helperAttributes": {}, "time": 1502969752143, "name": "Disable NAT64 inbound for ifc - cfg", - "description": "Disabling interface NAT64 inbound feature\n\nCLI: set interface nat64 in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT", + "description": "Disabling interface NAT64 inbound feature\n\nCLI: set interface nat64 in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/NAT", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "" @@ -225,7 +225,7 @@ "helperAttributes": {}, "time": 1502969982987, "name": "Delete NAT64 static BIB entry -cfg", - "description": "CLI: nat64 add static bib 2001:db8:85a3::8a2e:370:7334 1234 10.1.1.3 5678 tcp del\n\nMore information: https://wiki.fd.io/view/VPP/SNAT#Stateful_NAT64", + "description": "CLI: nat64 add static bib 2001:db8:85a3::8a2e:370:7334 1234 10.1.1.3 5678 tcp del\n\nMore information: https://wiki.fd.io/view/VPP/NAT#Stateful_NAT64", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "" @@ -245,7 +245,7 @@ "helperAttributes": {}, "time": 1502969736196, "name": "Set NAT64 outbound for ifc - cfg", - "description": "Setting interface NAT64 outbound feature\n\nCLI: set interface nat64 in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT", + "description": "Setting interface NAT64 outbound feature\n\nCLI: set interface nat64 in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/NAT", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "{\r\n \r\n \"outbound\" : {\r\n \t\"nat44-support\" : false,\r\n \t\"nat64-support\" : true\r\n }\r\n \r\n}" @@ -265,7 +265,7 @@ "helperAttributes": {}, "time": 1487678255065, "name": "Delete SNAT address pool", - "description": "CLI: vppctl snat del address 172.16.2.0 - 172.16.2.4\n\nCan be verified with\nvat# snat_address_dump\n\nMore information:\nhttps://wiki.fd.io/view/VPP/SNAT\nhttps://docs.fd.io/vpp/17.07/clicmd_src_plugins_snat.html#clicmd_set_interface_snat", + "description": "CLI: vppctl nat44 del address 172.16.2.0 - 172.16.2.4\n\nCan be verified with\nvat# nat44_address_dump\n\nMore information:\nhttps://wiki.fd.io/view/VPP/NAT", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "", @@ -302,7 +302,7 @@ "helperAttributes": {}, "time": 1498726954006, "name": "Set NAT outbound for subifc - cfg", - "description": "Setting sub-interface NAT outbound feature\n\nCLI: set interface snat in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT", + "description": "Setting sub-interface NAT outbound feature\n\nCLI: set interface nat44 in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/NAT", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "{\r\n \r\n \"outbound\" : {}\r\n \r\n}", @@ -346,7 +346,7 @@ "helperAttributes": {}, "time": 1487676902330, "name": "Add single address to pool", - "description": "CLI: vppctl snat add address 172.16.2.123\n\nCan be verified with\nvat# snat_address_dump\n\nMore information:\nhttps://wiki.fd.io/view/VPP/SNAT\nhttps://docs.fd.io/vpp/17.07/clicmd_src_plugins_snat.html#clicmd_set_interface_snat", + "description": "CLI: vppctl nat44 add address 172.16.2.123\n\nCan be verified with\nvat# nat44_address_dump\n\nMore information:\nhttps://wiki.fd.io/view/VPP/NAT", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "{\r\n\t\"external-ip-address-pool\" : {\r\n\t\t\"pool-id\": 2,\r\n\t\t\"external-ip-pool\": \"172.16.2.123/32\"\r\n\t}\r\n}", @@ -363,7 +363,7 @@ "data": [], "dataMode": "raw", "name": "Disable NAT inbound for ifc - cfg", - "description": "Unsetting interface NAT inbound feature\n\nCLI: set interface snat in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT", + "description": "Unsetting interface NAT inbound feature\n\nCLI: set interface nat44 in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/NAT", "descriptionFormat": "html", "time": 1475835912474, "version": 2, @@ -389,7 +389,7 @@ "helperAttributes": {}, "time": 1502970015631, "name": "Delete Nat64 address pool", - "description": "CLI: vppctl nat64 add pool address 172.16.2.0 - 172.16.2.4 del\n\nCan be verified with\nvppctl show nat64 pool\n\nMore information:\nhttps://wiki.fd.io/view/VPP/SNAT\nhttps://docs.fd.io/vpp/17.10/clicmd_src_plugins_snat.html#clicmd_nat64_add_pool_address", + "description": "CLI: vppctl nat64 add pool address 172.16.2.0 - 172.16.2.4 del\n\nCan be verified with\nvppctl show nat64 pool\n\nMore information:\nhttps://wiki.fd.io/view/VPP/NAT", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "" @@ -409,7 +409,7 @@ "helperAttributes": {}, "time": 1475758450889, "name": "Add SNAT 1:1 static entry IPv4 -cfg", - "description": "CLI: snat add static mapping local 10.0.0.3 external 4.4.4.4\n\nMore information: https://wiki.fd.io/view/VPP/SNAT", + "description": "CLI: nat44 add static mapping local 10.0.0.3 external 4.4.4.4\n\nMore information: https://wiki.fd.io/view/VPP/NAT", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "{\r\n\t\"mapping-entry\" : {\r\n\t\t\"index\": 1,\r\n\t\t\"type\": \"static\",\r\n\t\t\"internal-src-address\": \"192.168.1.87\",\r\n\t\t\"external-src-address\": \"45.1.5.7\"\r\n\t}\r\n}", @@ -426,7 +426,7 @@ "data": [], "dataMode": "raw", "name": "Disable NAT outbound for ifc - cfg", - "description": "Unsetting interface NAT outbound feature\n\nCLI: set interface snat in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT", + "description": "Unsetting interface NAT outbound feature\n\nCLI: set interface nat44 in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/NAT", "descriptionFormat": "html", "time": 1475835941689, "version": 2, @@ -452,7 +452,7 @@ "helperAttributes": {}, "time": 1487676498064, "name": "Add SNAT address pool", - "description": "CLI: vppctl snat add address 172.16.2.0 - 172.16.2.4\n\nCan be verified with\nvat# snat_address_dump\n\nMore information:\nhttps://wiki.fd.io/view/VPP/SNAT\nhttps://docs.fd.io/vpp/17.07/clicmd_src_plugins_snat.html#clicmd_set_interface_snat", + "description": "CLI: vppctl nat44 add address 172.16.2.0 - 172.16.2.4\n\nCan be verified with\nvat# nat44_address_dump\n\nMore information:\nhttps://wiki.fd.io/view/VPP/NAT", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "{\r\n\t\"external-ip-address-pool\" : {\r\n\t\t\"pool-id\": 1,\r\n\t\t\"external-ip-pool\": \"172.16.2.0/30\"\r\n\t}\r\n}", @@ -495,7 +495,7 @@ "helperAttributes": {}, "time": 1487678215755, "name": "Delete single address", - "description": "CLI: vppctl snat del address 172.16.2.123\n\nCan be verified with\nvat# snat_address_dump\n\nMore information:\nhttps://wiki.fd.io/view/VPP/SNAT\nhttps://docs.fd.io/vpp/17.07/clicmd_src_plugins_snat.html#clicmd_set_interface_snat", + "description": "CLI: vppctl nat44 del address 172.16.2.123\n\nCan be verified with\nvat# nat44_address_dump\n\nMore information:\nhttps://wiki.fd.io/view/VPP/NAT", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "", @@ -516,7 +516,7 @@ "helperAttributes": {}, "time": 1501658393667, "name": "Set NAT outbound for ifc (post routing) - cfg", - "description": "Setting interface NAT outbound feature (post routing)\n\nCLI: set interface snat in <intfc> out <intfc> output-feature [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT", + "description": "Setting interface NAT outbound feature (post routing)\n\nCLI: set interface nat44 in <intfc> out <intfc> output-feature [del]\n\nMore information: https://wiki.fd.io/view/VPP/NAT", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "{\r\n \r\n \"outbound\" : {\r\n \t\"post-routing\" : true\r\n }\r\n \r\n}", @@ -537,7 +537,7 @@ "helperAttributes": {}, "time": 1502969748622, "name": "Disable NAT64 outbound for ifc - cfg", - "description": "Disabling interface NAT64 outbound feature\n\nCLI: set interface nat64 in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT", + "description": "Disabling interface NAT64 outbound feature\n\nCLI: set interface nat64 in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/NAT", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "" @@ -573,7 +573,7 @@ "helperAttributes": {}, "time": 1498726948962, "name": "Disable NAT inbound for subifc - cfg", - "description": "Unsetting sub-interface NAT inbound feature\n\nCLI: set interface snat in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT", + "description": "Unsetting sub-interface NAT inbound feature\n\nCLI: set interface nat44 in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/NAT", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "{\r\n \r\n \"inbound\" : {}\r\n \r\n}", @@ -594,7 +594,7 @@ "helperAttributes": {}, "time": 1501658697686, "name": "Disable NAT inbound for ifc (post routing) - cfg", - "description": "Unsetting interface NAT inbound output-feature (post routing)\n\nCLI: set interface snat in <intfc> out <intfc> output-feature [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT", + "description": "Unsetting interface NAT inbound output-feature (post routing)\n\nCLI: set interface nat44 in <intfc> out <intfc> output-feature [del]\n\nMore information: https://wiki.fd.io/view/VPP/NAT", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "", @@ -615,7 +615,7 @@ "helperAttributes": {}, "time": 1502272808631, "name": "Add NAT64 static BIB entry -cfg", - "description": "CLI: nat64 add static bib 2001:db8:85a3::8a2e:370:7334 1234 10.1.1.3 5678 tcp\n\nMore information: https://wiki.fd.io/view/VPP/SNAT#Stateful_NAT64", + "description": "CLI: nat64 add static bib 2001:db8:85a3::8a2e:370:7334 1234 10.1.1.3 5678 tcp\n\nMore information: https://wiki.fd.io/view/VPP/NAT#Stateful_NAT64", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "{\n \"mapping-entry\": {\n \"index\": 1,\n \"type\": \"static\",\n \"transport-protocol\": 6,\n \"internal-src-address\": \"2001:db8:85a3::8a2e:370:7334\",\n \"external-src-address\": \"10.1.1.3\",\n \"internal-src-port\": {\n \"single-port-number\": 1234\n },\n \"external-src-port\": {\n \"single-port-number\": 5678\n }\n }\n}" @@ -647,7 +647,7 @@ "data": [], "dataMode": "raw", "name": "Disable NAT outbound for subifc - cfg", - "description": "Unsetting sub-interface NAT outbound feature\n\nCLI: set interface snat in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT", + "description": "Unsetting sub-interface NAT outbound feature\n\nCLI: set interface nat44 in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/NAT", "descriptionFormat": "html", "time": 1498726898787, "version": 2, @@ -669,7 +669,7 @@ "data": [], "dataMode": "raw", "name": "Get NAT state", - "description": "Read nat-state\n\nCLI: show snat [detail|verbose]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT", + "description": "Read nat-state\n\nCLI: show nat44 [detail|verbose]\n\nMore information: https://wiki.fd.io/view/VPP/NAT", "descriptionFormat": "html", "time": 1475677867416, "version": 2, @@ -696,7 +696,7 @@ "helperAttributes": {}, "time": 1502969740040, "name": "Set NAT64 inbound for ifc - cfg", - "description": "Setting interface NAT64 inbound feature\n\nCLI: set interface nat64 in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT", + "description": "Setting interface NAT64 inbound feature\n\nCLI: set interface nat64 in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/NAT", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "{\r\n \r\n \"inbound\" : {\r\n \t\"nat44-support\" : false,\r\n \t\"nat64-support\" : true\r\n }\r\n \r\n}" @@ -737,7 +737,7 @@ "helperAttributes": {}, "time": 1501658438697, "name": "Disable NAT outbound for ifc (post routing) - cfg", - "description": "Unsetting interface NAT outbound feature (post routing)\n\nCLI: set interface snat in <intfc> out <intfc> output-feature [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT", + "description": "Unsetting interface NAT outbound feature (post routing)\n\nCLI: set interface nat44 in <intfc> out <intfc> output-feature [del]\n\nMore information: https://wiki.fd.io/view/VPP/NAT", "collectionId": "87e0bcaa-5031-9a2b-8a6b-329758310154", "responses": [], "rawModeData": "", @@ -772,7 +772,7 @@ "data": [], "dataMode": "raw", "name": "Set NAT inbound for subifc - cfg", - "description": "Setting sub-interface NAT inbound feature\n\nCLI: set interface snat in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT", + "description": "Setting sub-interface NAT inbound feature\n\nCLI: set interface nat44 in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/NAT", "descriptionFormat": "html", "time": 1498726706031, "version": 2, @@ -795,7 +795,7 @@ "data": [], "dataMode": "raw", "name": "Set NAT inbound for ifc - cfg", - "description": "Setting interface NAT inbound feature\n\nCLI: set interface snat in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/SNAT", + "description": "Setting interface NAT inbound feature\n\nCLI: set interface nat44 in <intfc> out <intfc> [del]\n\nMore information: https://wiki.fd.io/view/VPP/NAT", "descriptionFormat": "html", "time": 1475154374071, "version": 2, |