diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2017-08-01 13:43:14 +0200 |
---|---|---|
committer | Jan Srnicek <jsrnicek@cisco.com> | 2017-08-02 11:19:25 +0000 |
commit | 33ecedc83c01e4d33e8304d9759100dcd95cb244 (patch) | |
tree | 739f0fdd39960f53e3b11d5926ed5fde69687c7c /nat/nat2vpp/src/main | |
parent | c86637969d6fce3759b3ce8a693ec16eb14b04e6 (diff) |
HC2VPP-197: translation layert for post routing NAT
Change-Id: Icef6682fbc7a18a1e52953270ad26f6b3b7676eb
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'nat/nat2vpp/src/main')
12 files changed, 218 insertions, 197 deletions
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 2d48bd5e1..c3c81ffb8 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 @@ -16,14 +16,20 @@ package io.fd.hc2vpp.nat.read.ifc; +import static java.util.Objects.requireNonNull; + import com.google.common.base.Optional; +import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; import io.fd.hc2vpp.common.translate.util.NamingContext; 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.SnatInterfaceDetails; 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 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; @@ -32,48 +38,81 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; abstract class AbstractInterfaceNatCustomizer<C extends DataObject, B extends Builder<C>> - implements InitializingReaderCustomizer<C, B> { + implements InitializingReaderCustomizer<C, B>, JvppReplyConsumer { - private final DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> dumpMgr; + private final FutureJVppSnatFacade jvppSnat; + private final DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> preRoutingDumpMgr; + private final DumpCacheManager<SnatInterfaceOutputFeatureDetailsReplyDump, Void> postRoutingDumpMgr; private final NamingContext ifcContext; - AbstractInterfaceNatCustomizer(@Nonnull final DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> dumpMgr, + AbstractInterfaceNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, @Nonnull final NamingContext ifcContext) { - this.dumpMgr = dumpMgr; - this.ifcContext = ifcContext; + this.jvppSnat = requireNonNull(jvppSnat, "jvppSnat should not be null"); + this.ifcContext = requireNonNull(ifcContext, "ifcContext should not be null"); + this.preRoutingDumpMgr = new DumpCacheManager.DumpCacheManagerBuilder<SnatInterfaceDetailsReplyDump, Void>() + .withExecutor((id, params) -> getReplyForRead( + jvppSnat.snatInterfaceDump(new SnatInterfaceDump()).toCompletableFuture(), id)) + .acceptOnly(SnatInterfaceDetailsReplyDump.class) + .build(); + this.postRoutingDumpMgr = + new DumpCacheManager.DumpCacheManagerBuilder<SnatInterfaceOutputFeatureDetailsReplyDump, Void>() + .withExecutor((id, params) -> getReplyForRead( + jvppSnat.snatInterfaceOutputFeatureDump(new SnatInterfaceOutputFeatureDump()) + .toCompletableFuture(), id)) + .acceptOnly(SnatInterfaceOutputFeatureDetailsReplyDump.class) + .build(); } @Override public void readCurrentAttributes(@Nonnull final InstanceIdentifier<C> id, @Nonnull final B builder, @Nonnull final ReadContext ctx) throws ReadFailedException { - // NOOP + final String ifcName = getName(id); + getLog().debug("Reading NAT features on interface: {}", ifcName); + final int index = ifcContext.getIndex(ifcName, ctx.getMappingContext()); + + // There are no additional attributes for pre routing NAT, so it is enough to read post routing ifc mapping: + final Optional<SnatInterfaceOutputFeatureDetailsReplyDump> postRoutingDump = + postRoutingDumpMgr.getDump(id, ctx.getModificationCache(), null); + + postRoutingDump.or(new SnatInterfaceOutputFeatureDetailsReplyDump()).snatInterfaceOutputFeatureDetails.stream() + .filter(snatIfcDetail -> snatIfcDetail.swIfIndex == index) + .filter(snatIfcDetail -> isExpectedNatType(snatIfcDetail.isInside)) + .findFirst() + .ifPresent(snatIfcDetail -> setPostRouting(builder)); } @Override - public boolean isPresent(final InstanceIdentifier<C> id, final C built, final ReadContext ctx) throws ReadFailedException { + public boolean isPresent(final InstanceIdentifier<C> id, final C built, final ReadContext ctx) + throws ReadFailedException { + // In the post routing case, we can reuse default implementation: + if (InitializingReaderCustomizer.super.isPresent(id, built, ctx)) { + // post routing was set + return true; + } + // In the pre routing case, we need to inspect pre routing dump: final String ifcName = getName(id); - getLog().debug("Reading NAT features on interface: {}", ifcName); + getLog().debug("Checking NAT presence for interface: {}", ifcName); final int index = ifcContext.getIndex(ifcName, ctx.getMappingContext()); - // Cache dump for each interface under the same key since this is all ifc dump - final Optional<SnatInterfaceDetailsReplyDump> dump = - dumpMgr.getDump(id, ctx.getModificationCache(), null); + // Cache dump for each interface under the same key since this is all ifc dump: + final Optional<SnatInterfaceDetailsReplyDump> preRoutingDump = + preRoutingDumpMgr.getDump(id, ctx.getModificationCache(), null); - // Find entries for current ifc and if is marked as inside set the builder to return presence container - return dump.or(new SnatInterfaceDetailsReplyDump()).snatInterfaceDetails.stream() + // Find entries for current ifc and if is marked as inside set the builder to return presence container: + return preRoutingDump.or(new SnatInterfaceDetailsReplyDump()).snatInterfaceDetails.stream() .filter(snatIfcDetail -> snatIfcDetail.swIfIndex == index) - .filter(this::isExpectedNatType) - .findFirst() - .isPresent(); - // Not setting data, just marking the builder to propagate empty container to indicate presence + .anyMatch(snatIfcDetail -> isExpectedNatType(snatIfcDetail.isInside)); + // Not setting data, just marking the builder to propagate empty container to indicate presence. } protected String getName(final InstanceIdentifier<C> id) { return id.firstKeyOf(Interface.class).getName(); } - protected abstract Logger getLog(); + abstract Logger getLog(); + + abstract boolean isExpectedNatType(final int isInside); - abstract boolean isExpectedNatType(final SnatInterfaceDetails snatInterfaceDetails); + abstract void setPostRouting(final B builder); } 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 6ccadd181..f3872c44e 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,8 +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.honeycomb.translate.util.read.cache.DumpCacheManager; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetailsReplyDump; +import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; 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,18 +28,17 @@ import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; abstract class AbstractSubInterfaceNatCustomizer<C extends DataObject, B extends Builder<C>> - extends AbstractInterfaceNatCustomizer<C, B> { - AbstractSubInterfaceNatCustomizer( - @Nonnull final DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> dumpMgr, - @Nonnull final NamingContext ifcContext) { - super(dumpMgr, ifcContext); + extends AbstractInterfaceNatCustomizer<C, B> { + AbstractSubInterfaceNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, + @Nonnull final NamingContext ifcContext) { + super(jvppSnat, ifcContext); } @Override protected String getName(final InstanceIdentifier<C> id) { // TODO(HC2VPP-99): use SubInterfaceUtils after it is moved from v3po2vpp final String parentInterfaceName = - checkNotNull(id.firstKeyOf(Interface.class), "operational Interface identifier expected").getName(); + checkNotNull(id.firstKeyOf(Interface.class), "operational Interface identifier expected").getName(); final Long subIfId = id.firstKeyOf(SubInterface.class).getIdentifier(); return String.format("%s.%d", parentInterfaceName, subIfId.intValue()); } 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 3a9a39e3e..83c727839 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 @@ -19,16 +19,10 @@ package io.fd.hc2vpp.nat.read.ifc; import com.google.inject.Inject; import com.google.inject.name.Named; -import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.impl.read.GenericInitReader; -import io.fd.honeycomb.translate.read.ReadFailedException; 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.honeycomb.translate.util.read.cache.EntityDumpExecutor; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetailsReplyDump; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDump; import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState; @@ -51,17 +45,13 @@ public final class IfcNatReaderFactory implements ReaderFactory { private static final InstanceIdentifier<NatInterfaceStateAugmentation> NAT_AUG_ID = IFC_ID.augmentation(NatInterfaceStateAugmentation.class); private static final InstanceIdentifier<Nat> NAT_AUG_CONTAINER_ID = NAT_AUG_ID.child(Nat.class); - - private final DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> snatIfcDumpMgr; private final NamingContext ifcContext; + private final FutureJVppSnatFacade jvppSnat; @Inject public IfcNatReaderFactory(final FutureJVppSnatFacade jvppSnat, @Named("interface-context") final NamingContext ifcContext) { - this.snatIfcDumpMgr = new DumpCacheManager.DumpCacheManagerBuilder<SnatInterfaceDetailsReplyDump, Void>() - .withExecutor(new SnatInterfaceExecutor(jvppSnat)) - .acceptOnly(SnatInterfaceDetailsReplyDump.class) - .build(); + this.jvppSnat = jvppSnat; this.ifcContext = ifcContext; } @@ -71,27 +61,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(snatIfcDumpMgr, ifcContext)), IFC_ID); + new InterfaceInboundNatCustomizer(jvppSnat, ifcContext)), IFC_ID); registry.addAfter(new GenericInitReader<>(NAT_AUG_CONTAINER_ID.child(Outbound.class), - new InterfaceOutboundNatCustomizer(snatIfcDumpMgr, ifcContext)), IFC_ID); - } - - private static final class SnatInterfaceExecutor implements - EntityDumpExecutor<SnatInterfaceDetailsReplyDump, Void>, - JvppReplyConsumer { - - private final FutureJVppSnatFacade jvppSnat; - - SnatInterfaceExecutor(final FutureJVppSnatFacade jvppSnat) { - this.jvppSnat = jvppSnat; - } - - @Nonnull - @Override - public SnatInterfaceDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier, final Void params) - throws ReadFailedException { - return getReplyForRead( - jvppSnat.snatInterfaceDump(new SnatInterfaceDump()).toCompletableFuture(), identifier); - } + new InterfaceOutboundNatCustomizer(jvppSnat, 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 9bd80008c..a9099697f 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,9 +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.honeycomb.translate.util.read.cache.DumpCacheManager; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetails; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetailsReplyDump; +import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; 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; @@ -41,10 +39,9 @@ final class InterfaceInboundNatCustomizer extends AbstractInterfaceNatCustomizer private static final Logger LOG = LoggerFactory.getLogger(InterfaceInboundNatCustomizer.class); - InterfaceInboundNatCustomizer( - @Nonnull final DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> dumpMgr, - @Nonnull final NamingContext ifcContext) { - super(dumpMgr, ifcContext); + InterfaceInboundNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, + @Nonnull final NamingContext ifcContext) { + super(jvppSnat, ifcContext); } @Override @@ -53,8 +50,13 @@ final class InterfaceInboundNatCustomizer extends AbstractInterfaceNatCustomizer } @Override - boolean isExpectedNatType(final SnatInterfaceDetails snatInterfaceDetails) { - return snatInterfaceDetails.isInside == 1; + boolean isExpectedNatType(final int isInside) { + return isInside == 1; + } + + @Override + void setPostRouting(final InboundBuilder builder) { + builder.setPostRouting(true); } @Nonnull @@ -76,12 +78,13 @@ final class InterfaceInboundNatCustomizer extends AbstractInterfaceNatCustomizer @Nonnull final ReadContext ctx) { final InstanceIdentifier<Inbound> cfgId = InstanceIdentifier.create(Interfaces.class) - .child(Interface.class, - new InterfaceKey(id.firstKeyOf( - org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.class).getName())) - .augmentation(NatInterfaceAugmentation.class) - .child(Nat.class) - .child(Inbound.class); + .child(Interface.class, + new InterfaceKey(id.firstKeyOf( + org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.class) + .getName())) + .augmentation(NatInterfaceAugmentation.class) + .child(Nat.class) + .child(Inbound.class); return Initialized.create(cfgId, readValue); } } 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 80d8d94ea..8ea93487d 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 @@ -16,12 +16,10 @@ 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.honeycomb.translate.util.read.cache.DumpCacheManager; -import io.fd.hc2vpp.common.translate.util.NamingContext; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetails; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetailsReplyDump; +import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; 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; @@ -41,10 +39,9 @@ final class InterfaceOutboundNatCustomizer extends AbstractInterfaceNatCustomize private static final Logger LOG = LoggerFactory.getLogger(InterfaceOutboundNatCustomizer.class); - InterfaceOutboundNatCustomizer( - @Nonnull final DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> dumpMgr, - @Nonnull final NamingContext ifcContext) { - super(dumpMgr, ifcContext); + InterfaceOutboundNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, + @Nonnull final NamingContext ifcContext) { + super(jvppSnat, ifcContext); } @Override @@ -53,8 +50,13 @@ final class InterfaceOutboundNatCustomizer extends AbstractInterfaceNatCustomize } @Override - boolean isExpectedNatType(final SnatInterfaceDetails snatInterfaceDetails) { - return snatInterfaceDetails.isInside == 0; + boolean isExpectedNatType(final int isInside) { + return isInside == 0; + } + + @Override + void setPostRouting(final OutboundBuilder builder) { + builder.setPostRouting(true); } @Nonnull @@ -77,7 +79,8 @@ final class InterfaceOutboundNatCustomizer extends AbstractInterfaceNatCustomize InstanceIdentifier.create(Interfaces.class) .child(Interface.class, new InterfaceKey(id.firstKeyOf( - org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.class).getName())) + org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.class) + .getName())) .augmentation(NatInterfaceAugmentation.class) .child(Nat.class) .child(Outbound.class); 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 f9fb1d43c..851a3ef1b 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 @@ -19,16 +19,10 @@ package io.fd.hc2vpp.nat.read.ifc; import com.google.inject.Inject; import com.google.inject.name.Named; -import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.impl.read.GenericInitReader; -import io.fd.honeycomb.translate.read.ReadFailedException; 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.honeycomb.translate.util.read.cache.EntityDumpExecutor; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetailsReplyDump; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDump; import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState; @@ -51,21 +45,18 @@ public final class SubIfcNatReaderFactory implements ReaderFactory { private static final InstanceIdentifier<SubInterface> SUB_IFC_ID = InstanceIdentifier.create(InterfacesState.class).child(Interface.class).augmentation( - SubinterfaceStateAugmentation.class).child(SubInterfaces.class).child(SubInterface.class); + SubinterfaceStateAugmentation.class).child(SubInterfaces.class).child(SubInterface.class); private static final InstanceIdentifier<NatSubinterfaceStateAugmentation> NAT_SUB_AUG_ID = - SUB_IFC_ID.augmentation(NatSubinterfaceStateAugmentation.class); + SUB_IFC_ID.augmentation(NatSubinterfaceStateAugmentation.class); private static final InstanceIdentifier<Nat> NAT_AUG_CONTAINER_ID = NAT_SUB_AUG_ID.child(Nat.class); - private final DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> snatIfcDumpMgr; private final NamingContext ifcContext; + private final FutureJVppSnatFacade jvppSnat; @Inject public SubIfcNatReaderFactory(final FutureJVppSnatFacade jvppSnat, @Named("interface-context") final NamingContext ifcContext) { - this.snatIfcDumpMgr = new DumpCacheManager.DumpCacheManagerBuilder<SnatInterfaceDetailsReplyDump, Void>() - .withExecutor(new SnatInterfaceExecutor(jvppSnat)) - .acceptOnly(SnatInterfaceDetailsReplyDump.class) - .build(); + this.jvppSnat = jvppSnat; this.ifcContext = ifcContext; } @@ -75,27 +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(snatIfcDumpMgr, ifcContext)), SUB_IFC_ID); + new SubInterfaceInboundNatCustomizer(jvppSnat, ifcContext)), SUB_IFC_ID); registry.addAfter(new GenericInitReader<>(NAT_AUG_CONTAINER_ID.child(Outbound.class), - new SubInterfaceOutboundNatCustomizer(snatIfcDumpMgr, ifcContext)), SUB_IFC_ID); - } - - private static final class SnatInterfaceExecutor implements - EntityDumpExecutor<SnatInterfaceDetailsReplyDump, Void>, - JvppReplyConsumer { - - private final FutureJVppSnatFacade jvppSnat; - - SnatInterfaceExecutor(final FutureJVppSnatFacade jvppSnat) { - this.jvppSnat = jvppSnat; - } - - @Nonnull - @Override - public SnatInterfaceDetailsReplyDump executeDump(final InstanceIdentifier<?> identifier, final Void params) - throws ReadFailedException { - return getReplyForRead( - jvppSnat.snatInterfaceDump(new SnatInterfaceDump()).toCompletableFuture(), identifier); - } + new SubInterfaceOutboundNatCustomizer(jvppSnat, 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 1d6cff916..84e211fea 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,9 +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.honeycomb.translate.util.read.cache.DumpCacheManager; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetails; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetailsReplyDump; +import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; 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; @@ -45,10 +43,9 @@ final class SubInterfaceInboundNatCustomizer extends AbstractSubInterfaceNatCust private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceInboundNatCustomizer.class); - SubInterfaceInboundNatCustomizer( - @Nonnull final DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> dumpMgr, - @Nonnull final NamingContext ifcContext) { - super(dumpMgr, ifcContext); + SubInterfaceInboundNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, + @Nonnull final NamingContext ifcContext) { + super(jvppSnat, ifcContext); } @Override @@ -57,8 +54,13 @@ final class SubInterfaceInboundNatCustomizer extends AbstractSubInterfaceNatCust } @Override - boolean isExpectedNatType(final SnatInterfaceDetails snatInterfaceDetails) { - return snatInterfaceDetails.isInside == 1; + boolean isExpectedNatType(final int isInside) { + return isInside == 1; + } + + @Override + void setPostRouting(final InboundBuilder builder) { + builder.setPostRouting(true); } @Nonnull @@ -79,18 +81,20 @@ final class SubInterfaceInboundNatCustomizer extends AbstractSubInterfaceNatCust @Nonnull final Inbound readValue, @Nonnull final ReadContext ctx) { final InstanceIdentifier<Inbound> cfgId = - InstanceIdentifier.create(Interfaces.class) - .child(Interface.class, - new InterfaceKey(id.firstKeyOf( - org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.class).getName())) - .augmentation(SubinterfaceAugmentation.class) - .child(SubInterfaces.class) - .child(SubInterface.class, - new SubInterfaceKey(id.firstKeyOf( - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev170607.interfaces.state._interface.sub.interfaces.SubInterface.class).getIdentifier())) - .augmentation(NatSubinterfaceAugmentation.class) - .child(Nat.class) - .child(Inbound.class); + InstanceIdentifier.create(Interfaces.class) + .child(Interface.class, + new InterfaceKey(id.firstKeyOf( + org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.class) + .getName())) + .augmentation(SubinterfaceAugmentation.class) + .child(SubInterfaces.class) + .child(SubInterface.class, + new SubInterfaceKey(id.firstKeyOf( + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev170607.interfaces.state._interface.sub.interfaces.SubInterface.class) + .getIdentifier())) + .augmentation(NatSubinterfaceAugmentation.class) + .child(Nat.class) + .child(Inbound.class); return Initialized.create(cfgId, readValue); } } 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 1179e9fba..d4507877f 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,9 +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.honeycomb.translate.util.read.cache.DumpCacheManager; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetails; -import io.fd.vpp.jvpp.snat.dto.SnatInterfaceDetailsReplyDump; +import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; 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; @@ -45,10 +43,9 @@ final class SubInterfaceOutboundNatCustomizer extends AbstractSubInterfaceNatCus private static final Logger LOG = LoggerFactory.getLogger(SubInterfaceOutboundNatCustomizer.class); - SubInterfaceOutboundNatCustomizer( - @Nonnull final DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> dumpMgr, - @Nonnull final NamingContext ifcContext) { - super(dumpMgr, ifcContext); + SubInterfaceOutboundNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, + @Nonnull final NamingContext ifcContext) { + super(jvppSnat, ifcContext); } @Override @@ -57,8 +54,13 @@ final class SubInterfaceOutboundNatCustomizer extends AbstractSubInterfaceNatCus } @Override - boolean isExpectedNatType(final SnatInterfaceDetails snatInterfaceDetails) { - return snatInterfaceDetails.isInside == 0; + boolean isExpectedNatType(final int isInside) { + return isInside == 0; + } + + @Override + void setPostRouting(final OutboundBuilder builder) { + builder.setPostRouting(true); } @Nonnull @@ -78,18 +80,20 @@ final class SubInterfaceOutboundNatCustomizer extends AbstractSubInterfaceNatCus @Nonnull final Outbound readValue, @Nonnull final ReadContext ctx) { final InstanceIdentifier<Outbound> cfgId = - InstanceIdentifier.create(Interfaces.class) - .child(Interface.class, - new InterfaceKey(id.firstKeyOf( - org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.class).getName())) - .augmentation(SubinterfaceAugmentation.class) - .child(SubInterfaces.class) - .child(SubInterface.class, - new SubInterfaceKey(id.firstKeyOf( - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev170607.interfaces.state._interface.sub.interfaces.SubInterface.class).getIdentifier())) - .augmentation(NatSubinterfaceAugmentation.class) - .child(Nat.class) - .child(Outbound.class); + InstanceIdentifier.create(Interfaces.class) + .child(Interface.class, + new InterfaceKey(id.firstKeyOf( + org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.class) + .getName())) + .augmentation(SubinterfaceAugmentation.class) + .child(SubInterfaces.class) + .child(SubInterface.class, + new SubInterfaceKey(id.firstKeyOf( + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev170607.interfaces.state._interface.sub.interfaces.SubInterface.class) + .getIdentifier())) + .augmentation(NatSubinterfaceAugmentation.class) + .child(Nat.class) + .child(Outbound.class); return Initialized.create(cfgId, readValue); } } 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 455b4615f..82af93481 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 @@ -16,22 +16,28 @@ package io.fd.hc2vpp.nat.write.ifc; -import io.fd.honeycomb.translate.spi.write.WriterCustomizer; +import io.fd.hc2vpp.common.translate.util.ByteDataTranslator; import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; 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.dto.JVppReply; 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 java.util.concurrent.CompletionStage; 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.rev170801.InterfaceNatVppFeatureAttributes; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; -abstract class AbstractInterfaceNatCustomizer<D extends DataObject> implements JvppReplyConsumer, WriterCustomizer<D> { +abstract class AbstractInterfaceNatCustomizer<D extends InterfaceNatVppFeatureAttributes & DataObject> + implements ByteDataTranslator, JvppReplyConsumer, WriterCustomizer<D> { private final FutureJVppSnatFacade jvppSnat; private final NamingContext ifcContext; @@ -47,14 +53,16 @@ abstract class AbstractInterfaceNatCustomizer<D extends DataObject> implements J @Nonnull final WriteContext writeContext) throws WriteFailedException { final String ifcName = getName(id); getLog().debug("Enabling " + getType() + " NAT on interface: {}", ifcName); - getLog().debug("Enabling " + getType() + " NAT: {}", id); + getLog().debug("Enabling {} NAT: {}", dataAfter, id); final int ifcIndex = ifcContext.getIndex(ifcName, writeContext.getMappingContext()); - final SnatInterfaceAddDelFeature request = getRequest(ifcIndex, (byte)1); - final CompletionStage<SnatInterfaceAddDelFeatureReply> future = jvppSnat.snatInterfaceAddDelFeature(request); - - final SnatInterfaceAddDelFeatureReply reply = getReplyForWrite(future.toCompletableFuture(), id); - getLog().debug("NAT " + getType() + " enabled successfully on: {}, reply: {}", ifcName, reply); + final JVppReply reply; + if (dataAfter.isPostRouting()) { + reply = postRoutingNat(id, ifcIndex, true); + } else { + reply = preRoutingNat(id, ifcIndex, true); + } + getLog().debug("NAT {} enabled successfully on: {}, reply: {}", dataAfter, ifcName, reply); } @Override @@ -71,22 +79,47 @@ abstract class AbstractInterfaceNatCustomizer<D extends DataObject> implements J throws WriteFailedException { final String ifcName = getName(id); getLog().debug("Disabling " + getType() + " NAT on interface: {}", ifcName); - getLog().debug("Disabling " + getType() + " NAT: {}", id); + getLog().debug("Disabling {} NAT: {}", dataBefore, id); final int ifcIndex = ifcContext.getIndex(ifcName, writeContext.getMappingContext()); - final SnatInterfaceAddDelFeature request = getRequest(ifcIndex, (byte)0); - final CompletionStage<SnatInterfaceAddDelFeatureReply> future = jvppSnat.snatInterfaceAddDelFeature(request); - - final SnatInterfaceAddDelFeatureReply reply = getReplyForWrite(future.toCompletableFuture(), id); - getLog().debug("NAT " + getType() + " disabled successfully on: {}, reply: {}", ifcName, reply); + final JVppReply reply; + if (dataBefore.isPostRouting()) { + reply = postRoutingNat(id, ifcIndex, false); + } else { + reply = preRoutingNat(id, ifcIndex, false); + } + getLog().debug("NAT {} disabled successfully on: {}, reply: {}", dataBefore, ifcName, reply); } protected String getName(final InstanceIdentifier<D> id) { return id.firstKeyOf(Interface.class).getName(); } + private JVppReply postRoutingNat(@Nonnull final InstanceIdentifier<D> id, final int ifcIndex, final boolean enable) + throws WriteFailedException { + final SnatInterfaceAddDelOutputFeature request = new SnatInterfaceAddDelOutputFeature(); + request.isAdd = booleanToByte(enable); + request.isInside = getType().isInside; + request.swIfIndex = ifcIndex; + + final CompletionStage<SnatInterfaceAddDelOutputFeatureReply> future = + jvppSnat.snatInterfaceAddDelOutputFeature(request); + return getReplyForWrite(future.toCompletableFuture(), id); + } + + private JVppReply preRoutingNat(@Nonnull final InstanceIdentifier<D> id, final int ifcIndex, final boolean enable) + throws WriteFailedException { + final SnatInterfaceAddDelFeature request = new SnatInterfaceAddDelFeature(); + request.isAdd = booleanToByte(enable); + request.isInside = getType().isInside; + request.swIfIndex = ifcIndex; + + final CompletionStage<SnatInterfaceAddDelFeatureReply> future = jvppSnat.snatInterfaceAddDelFeature(request); + return getReplyForWrite(future.toCompletableFuture(), id); + } + enum NatType { - INBOUND((byte)1), OUTBOUND((byte)0); + INBOUND((byte) 1), OUTBOUND((byte) 0); private final byte isInside; @@ -96,14 +129,6 @@ abstract class AbstractInterfaceNatCustomizer<D extends DataObject> implements J } abstract NatType getType(); - abstract Logger getLog(); - - private SnatInterfaceAddDelFeature getRequest(final int ifcIdx, final byte isAdd) { - final SnatInterfaceAddDelFeature request = new SnatInterfaceAddDelFeature(); - request.isAdd = isAdd; - request.isInside = getType().isInside; - request.swIfIndex = ifcIdx; - return request; - } + abstract Logger getLog(); } 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 4e693ecde..ca40f8a98 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 @@ -37,13 +37,15 @@ import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.vpp.jvpp.snat.future.FutureJVppSnatFacade; 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.rev170801.InterfaceNatVppFeatureAttributes; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev170607.interfaces._interface.sub.interfaces.SubInterface; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -abstract class AbstractSubInterfaceNatCustomizer<D extends DataObject> extends AbstractInterfaceNatCustomizer<D> { +abstract class AbstractSubInterfaceNatCustomizer<D extends InterfaceNatVppFeatureAttributes & DataObject> + extends AbstractInterfaceNatCustomizer<D> { AbstractSubInterfaceNatCustomizer(@Nonnull final FutureJVppSnatFacade jvppSnat, - @Nonnull final NamingContext ifcContext) { + @Nonnull final NamingContext ifcContext) { super(jvppSnat, ifcContext); } @@ -51,7 +53,7 @@ abstract class AbstractSubInterfaceNatCustomizer<D extends DataObject> extends A protected String getName(final InstanceIdentifier<D> id) { // TODO(HC2VPP-99): use SubInterfaceUtils after it is moved from v3po2vpp final String parentInterfaceName = - checkNotNull(id.firstKeyOf(Interface.class), "Interface configuration identifier expected").getName(); + checkNotNull(id.firstKeyOf(Interface.class), "Interface configuration identifier expected").getName(); final Long subIfId = id.firstKeyOf(SubInterface.class).getIdentifier(); return String.format("%s.%d", parentInterfaceName, subIfId.intValue()); } 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 12a12b329..499c9a999 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 @@ -18,8 +18,8 @@ package io.fd.hc2vpp.nat.write.ifc; import com.google.inject.Inject; import com.google.inject.name.Named; -import io.fd.honeycomb.translate.impl.write.GenericWriter; 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; @@ -40,7 +40,7 @@ public final class IfcNatWriterFactory implements WriterFactory { private static final InstanceIdentifier<Interface> IFC_ID = InstanceIdentifier.create(Interfaces.class).child(Interface.class); private static final InstanceIdentifier<Nat> NAT_AUG_ID = - IFC_ID .augmentation(NatInterfaceAugmentation.class).child(Nat.class); + IFC_ID.augmentation(NatInterfaceAugmentation.class).child(Nat.class); private final FutureJVppSnatFacade jvppSnat; private final NamingContext ifcContext; 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 86209f627..231d73f72 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 @@ -41,10 +41,10 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public final class SubIfcNatWriterFactory implements WriterFactory { private static final InstanceIdentifier<SubInterface> - SUB_IFC_ID = InstanceIdentifier.create(Interfaces.class).child(Interface.class).augmentation( - SubinterfaceAugmentation.class).child(SubInterfaces.class).child(SubInterface.class); + SUB_IFC_ID = InstanceIdentifier.create(Interfaces.class).child(Interface.class).augmentation( + SubinterfaceAugmentation.class).child(SubInterfaces.class).child(SubInterface.class); private static final InstanceIdentifier<Nat> NAT_AUG_ID = - SUB_IFC_ID.augmentation(NatSubinterfaceAugmentation.class).child(Nat.class); + SUB_IFC_ID.augmentation(NatSubinterfaceAugmentation.class).child(Nat.class); private final FutureJVppSnatFacade jvppSnat; private final NamingContext ifcContext; @@ -59,8 +59,8 @@ public final class SubIfcNatWriterFactory implements WriterFactory { @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(jvppSnat, ifcContext)), SUB_IFC_ID); registry.addAfter(new GenericWriter<>(NAT_AUG_ID.child(Outbound.class), - new SubInterfaceOutboundNatCustomizer(jvppSnat, ifcContext)), SUB_IFC_ID); + new SubInterfaceOutboundNatCustomizer(jvppSnat, ifcContext)), SUB_IFC_ID); } } |