summaryrefslogtreecommitdiffstats
path: root/nat/nat2vpp/src/test
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-08-01 13:43:14 +0200
committerJan Srnicek <jsrnicek@cisco.com>2017-08-02 11:19:25 +0000
commit33ecedc83c01e4d33e8304d9759100dcd95cb244 (patch)
tree739f0fdd39960f53e3b11d5926ed5fde69687c7c /nat/nat2vpp/src/test
parentc86637969d6fce3759b3ce8a693ec16eb14b04e6 (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/test')
-rw-r--r--nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/ifc/InterfaceInboundNatCustomizerTest.java56
-rw-r--r--nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/ifc/InterfaceOutboundNatCustomizerTest.java55
-rw-r--r--nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/AbstractNatCustomizerTest.java72
-rw-r--r--nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/InterfaceInboundNatCustomizerTest.java19
-rw-r--r--nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/InterfaceOutboundNatCustomizerTest.java19
5 files changed, 160 insertions, 61 deletions
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 859d78fb3..a71461f4a 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
@@ -18,6 +18,10 @@ package io.fd.hc2vpp.nat.read.ifc;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import com.google.common.collect.Lists;
import io.fd.hc2vpp.common.test.read.ReaderCustomizerTest;
@@ -25,13 +29,13 @@ 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.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
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 org.junit.Test;
import org.mockito.Mock;
-import org.mockito.Mockito;
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;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
@@ -51,8 +55,8 @@ public class InterfaceInboundNatCustomizerTest
private static final String CTX_NAME = "ifc";
@Mock
- private EntityDumpExecutor<SnatInterfaceDetailsReplyDump, Void> natExecutor;
- private DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> dumpMgr;
+ private FutureJVppSnatFacade jvppSnat;
+
private NamingContext ifcContext = new NamingContext(CTX_NAME, CTX_NAME);
private InstanceIdentifier<Inbound> id;
@@ -72,12 +76,13 @@ public class InterfaceInboundNatCustomizerTest
protected void setUp() throws Exception {
id = getId(Inbound.class);
defineMapping(mappingContext, IFC_NAME, IFC_IDX, CTX_NAME);
- // empty dump
- Mockito.doReturn(new SnatInterfaceDetailsReplyDump()).when(natExecutor).executeDump(id, null);
- dumpMgr = new DumpCacheManager.DumpCacheManagerBuilder<SnatInterfaceDetailsReplyDump, Void>()
- .withExecutor(natExecutor)
- .acceptOnly(SnatInterfaceDetailsReplyDump.class)
- .build();
+ when(jvppSnat.snatInterfaceDump(any())).thenReturn(future(new SnatInterfaceDetailsReplyDump()));
+ when(jvppSnat.snatInterfaceOutputFeatureDump(any()))
+ .thenReturn(future(new SnatInterfaceOutputFeatureDetailsReplyDump()));
+ }
+
+ private GenericReader<Inbound, InboundBuilder> getReader() {
+ return new GenericReader<>(RWUtils.makeIidWildcarded(id), customizer);
}
@Test
@@ -85,24 +90,43 @@ public class InterfaceInboundNatCustomizerTest
assertFalse(getReader().read(id, ctx).isPresent());
}
- private GenericReader<Inbound, InboundBuilder> getReader() {
- return new GenericReader<>(RWUtils.makeIidWildcarded(id), customizer);
+ private void mockPostRoutingDump() {
+ final SnatInterfaceOutputFeatureDetailsReplyDump details = new SnatInterfaceOutputFeatureDetailsReplyDump();
+ final SnatInterfaceOutputFeatureDetails detail = new SnatInterfaceOutputFeatureDetails();
+ detail.isInside = 1;
+ detail.swIfIndex = IFC_IDX;
+ details.snatInterfaceOutputFeatureDetails = Lists.newArrayList(detail);
+ when(jvppSnat.snatInterfaceOutputFeatureDump(any())).thenReturn(future(details));
}
@Test
- public void testPresence() throws Exception {
+ public void testPresencePreRouting() throws Exception {
final SnatInterfaceDetailsReplyDump details = new SnatInterfaceDetailsReplyDump();
final SnatInterfaceDetails detail = new SnatInterfaceDetails();
detail.isInside = 1;
detail.swIfIndex = IFC_IDX;
details.snatInterfaceDetails = Lists.newArrayList(detail);
- Mockito.doReturn(details).when(natExecutor).executeDump(id, null);
+ when(jvppSnat.snatInterfaceDump(any())).thenReturn(future(details));
+
+ assertTrue(getReader().read(id, ctx).isPresent());
+ }
+ @Test
+ public void testPresencePostRouting() throws Exception {
+ mockPostRoutingDump();
assertTrue(getReader().read(id, ctx).isPresent());
}
+ @Test
+ public void testReadPostRouting() throws Exception {
+ mockPostRoutingDump();
+ final InboundBuilder builder = mock(InboundBuilder.class);
+ customizer.readCurrentAttributes(id, builder, ctx);
+ verify(builder).setPostRouting(true);
+ }
+
@Override
protected ReaderCustomizer<Inbound, InboundBuilder> initCustomizer() {
- return new InterfaceInboundNatCustomizer(dumpMgr, ifcContext);
+ return new InterfaceInboundNatCustomizer(jvppSnat, 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 b19878be8..833a4fa74 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
@@ -19,6 +19,10 @@ package io.fd.hc2vpp.nat.read.ifc;
import static io.fd.hc2vpp.nat.read.ifc.InterfaceInboundNatCustomizerTest.getId;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import com.google.common.collect.Lists;
import io.fd.hc2vpp.common.test.read.ReaderCustomizerTest;
@@ -26,13 +30,13 @@ 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.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
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 org.junit.Test;
import org.mockito.Mock;
-import org.mockito.Mockito;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev170801._interface.nat.attributes.NatBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev170801._interface.nat.attributes.nat.Outbound;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev170801._interface.nat.attributes.nat.OutboundBuilder;
@@ -46,8 +50,7 @@ public class InterfaceOutboundNatCustomizerTest
private static final String CTX_NAME = "ifc";
@Mock
- private EntityDumpExecutor<SnatInterfaceDetailsReplyDump, Void> abc;
- private DumpCacheManager<SnatInterfaceDetailsReplyDump, Void> dumpMgr;
+ private FutureJVppSnatFacade jvppSnat;
private NamingContext ifcContext = new NamingContext(CTX_NAME, CTX_NAME);
private InstanceIdentifier<Outbound> id;
@@ -59,12 +62,13 @@ public class InterfaceOutboundNatCustomizerTest
protected void setUp() throws Exception {
id = getId(Outbound.class);
defineMapping(mappingContext, IFC_NAME, IFC_IDX, CTX_NAME);
- // empty dump
- Mockito.doReturn(new SnatInterfaceDetailsReplyDump()).when(abc).executeDump(id, null);
- dumpMgr = new DumpCacheManager.DumpCacheManagerBuilder<SnatInterfaceDetailsReplyDump, Void>()
- .withExecutor(abc)
- .acceptOnly(SnatInterfaceDetailsReplyDump.class)
- .build();
+ when(jvppSnat.snatInterfaceDump(any())).thenReturn(future(new SnatInterfaceDetailsReplyDump()));
+ when(jvppSnat.snatInterfaceOutputFeatureDump(any()))
+ .thenReturn(future(new SnatInterfaceOutputFeatureDetailsReplyDump()));
+ }
+
+ private GenericReader<Outbound, OutboundBuilder> getReader() {
+ return new GenericReader<>(RWUtils.makeIidWildcarded(id), customizer);
}
@Test
@@ -72,24 +76,43 @@ public class InterfaceOutboundNatCustomizerTest
assertFalse(getReader().read(id, ctx).isPresent());
}
- private GenericReader<Outbound, OutboundBuilder> getReader() {
- return new GenericReader<>(RWUtils.makeIidWildcarded(id), customizer);
+ private void mockPostRoutingDump() {
+ final SnatInterfaceOutputFeatureDetailsReplyDump details = new SnatInterfaceOutputFeatureDetailsReplyDump();
+ final SnatInterfaceOutputFeatureDetails detail = new SnatInterfaceOutputFeatureDetails();
+ detail.isInside = 0;
+ detail.swIfIndex = IFC_IDX;
+ details.snatInterfaceOutputFeatureDetails = Lists.newArrayList(detail);
+ when(jvppSnat.snatInterfaceOutputFeatureDump(any())).thenReturn(future(details));
}
@Test
- public void testPresence() throws Exception {
+ public void testPresencePreRouting() throws Exception {
final SnatInterfaceDetailsReplyDump details = new SnatInterfaceDetailsReplyDump();
final SnatInterfaceDetails detail = new SnatInterfaceDetails();
detail.isInside = 0;
detail.swIfIndex = IFC_IDX;
details.snatInterfaceDetails = Lists.newArrayList(detail);
- Mockito.doReturn(details).when(abc).executeDump(id, null);
+ when(jvppSnat.snatInterfaceDump(any())).thenReturn(future(details));
assertTrue(getReader().read(id, ctx).isPresent());
}
+ @Test
+ public void testPresencePostRouting() throws Exception {
+ mockPostRoutingDump();
+ assertTrue(getReader().read(id, ctx).isPresent());
+ }
+
+ @Test
+ public void testReadPostRouting() throws Exception {
+ mockPostRoutingDump();
+ final OutboundBuilder builder = mock(OutboundBuilder.class);
+ customizer.readCurrentAttributes(id, builder, ctx);
+ verify(builder).setPostRouting(true);
+ }
+
@Override
protected ReaderCustomizer<Outbound, OutboundBuilder> initCustomizer() {
- return new InterfaceOutboundNatCustomizer(dumpMgr, ifcContext);
+ return new InterfaceOutboundNatCustomizer(jvppSnat, ifcContext);
}
} \ No newline at end of file
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 c4886a43f..273d376cd 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
@@ -26,15 +26,18 @@ import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
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 org.junit.Test;
import org.mockito.Mock;
+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._interface.nat.rev170801._interface.nat.attributes.nat.Inbound;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-abstract class AbstractNatCustomizerTest<D extends DataObject, T extends AbstractInterfaceNatCustomizer<D>>
- extends WriterCustomizerTest implements ByteDataTranslator {
+abstract class AbstractNatCustomizerTest<D extends InterfaceNatVppFeatureAttributes & DataObject, T extends AbstractInterfaceNatCustomizer<D>>
+ extends WriterCustomizerTest implements ByteDataTranslator {
private static final String IFC_CTX_NAME = "ifc-test-instance";
private static final String IFACE_NAME = "eth0";
@@ -48,40 +51,75 @@ abstract class AbstractNatCustomizerTest<D extends DataObject, T extends Abstrac
@Override
public void setUpTest() {
customizer = getCustomizer(snatApi, 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()));
}
@Test
- public void testWrite() throws Exception {
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
- when(snatApi.snatInterfaceAddDelFeature(any())).thenReturn(future(new SnatInterfaceAddDelFeatureReply()));
- final D data = getData();
+ public void testWritePreRouting() throws Exception {
+ final D data = getPreRoutingConfig();
+ customizer.writeCurrentAttributes(getIId(IFACE_NAME), data, writeContext);
+ verify(snatApi).snatInterfaceAddDelFeature(expectedPreRoutingRequest(data, true));
+ }
+
+ @Test
+ public void testWritePostRouting() throws Exception {
+ final D data = getPostRoutingConfig();
customizer.writeCurrentAttributes(getIId(IFACE_NAME), data, writeContext);
- verify(snatApi).snatInterfaceAddDelFeature(expectedRequest(data, true));
+ verify(snatApi).snatInterfaceAddDelOutputFeature(expectedPostRoutingRequest(data, true));
+ }
+
+ @Test(expected = WriteFailedException.UpdateFailedException.class)
+ public void testUpdatePreRouting() throws Exception {
+ customizer.updateCurrentAttributes(getIId(IFACE_NAME), getPreRoutingConfig(), getPreRoutingConfig(),
+ writeContext);
}
@Test(expected = WriteFailedException.UpdateFailedException.class)
- public void testUpdate() throws Exception {
- customizer.updateCurrentAttributes(getIId(IFACE_NAME), getData(), getData(), writeContext);
+ public void testUpdatePostRouting() throws Exception {
+ customizer.updateCurrentAttributes(getIId(IFACE_NAME), getPostRoutingConfig(), getPostRoutingConfig(),
+ writeContext);
}
@Test
- public void testDelete() throws Exception {
- defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
- when(snatApi.snatInterfaceAddDelFeature(any())).thenReturn(future(new SnatInterfaceAddDelFeatureReply()));
- final D data = getData();
+ public void testDeletePreRouting() throws Exception {
+ final D data = getPreRoutingConfig();
+ customizer.deleteCurrentAttributes(getIId(IFACE_NAME), data, writeContext);
+ verify(snatApi).snatInterfaceAddDelFeature(expectedPreRoutingRequest(data, false));
+ }
+
+ @Test
+ public void testDeletePostRouting() throws Exception {
+ final D data = getPostRoutingConfig();
customizer.deleteCurrentAttributes(getIId(IFACE_NAME), data, writeContext);
- verify(snatApi).snatInterfaceAddDelFeature(expectedRequest(data, false));
+ verify(snatApi).snatInterfaceAddDelOutputFeature(expectedPostRoutingRequest(data, false));
}
- private SnatInterfaceAddDelFeature expectedRequest(final D data, boolean isAdd) {
+ private SnatInterfaceAddDelFeature expectedPreRoutingRequest(final D data, boolean isAdd) {
SnatInterfaceAddDelFeature request = new SnatInterfaceAddDelFeature();
- request.isInside = (byte) ((data instanceof Inbound) ? 1 : 0);
+ request.isInside = (byte) ((data instanceof Inbound)
+ ? 1
+ : 0);
request.swIfIndex = IFACE_ID;
request.isAdd = booleanToByte(isAdd);
return request;
}
- protected abstract D getData();
+ private SnatInterfaceAddDelOutputFeature expectedPostRoutingRequest(final D data, boolean isAdd) {
+ SnatInterfaceAddDelOutputFeature request = new SnatInterfaceAddDelOutputFeature();
+ request.isInside = (byte) ((data instanceof Inbound)
+ ? 1
+ : 0);
+ request.swIfIndex = IFACE_ID;
+ request.isAdd = booleanToByte(isAdd);
+ return request;
+ }
+
+ protected abstract D getPreRoutingConfig();
+
+ protected abstract D getPostRoutingConfig();
protected abstract InstanceIdentifier<D> getIId(final String ifaceName);
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 8c16b1c98..17efc4095 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
@@ -27,22 +27,29 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interfa
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev170801._interface.nat.attributes.nat.InboundBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-public class InterfaceInboundNatCustomizerTest extends AbstractNatCustomizerTest<Inbound, InterfaceInboundNatCustomizer> {
+public class InterfaceInboundNatCustomizerTest
+ extends AbstractNatCustomizerTest<Inbound, InterfaceInboundNatCustomizer> {
@Override
- protected Inbound getData() {
- return new InboundBuilder().build();
+ protected Inbound getPreRoutingConfig() {
+ return new InboundBuilder().setPostRouting(false).build();
+ }
+
+ @Override
+ protected Inbound getPostRoutingConfig() {
+ return new InboundBuilder().setPostRouting(true).build();
}
@Override
protected InstanceIdentifier<Inbound> getIId(final String ifaceName) {
return InstanceIdentifier.create(Interfaces.class)
- .child(Interface.class, new InterfaceKey(ifaceName)).augmentation(NatInterfaceAugmentation.class)
- .child(Nat.class).child(Inbound.class);
+ .child(Interface.class, new InterfaceKey(ifaceName)).augmentation(NatInterfaceAugmentation.class)
+ .child(Nat.class).child(Inbound.class);
}
@Override
- protected InterfaceInboundNatCustomizer getCustomizer(final FutureJVppSnatFacade snatApi, final NamingContext ifcNamingCtx) {
+ protected InterfaceInboundNatCustomizer getCustomizer(final FutureJVppSnatFacade snatApi,
+ final NamingContext ifcNamingCtx) {
return new InterfaceInboundNatCustomizer(snatApi, 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 1daa0530a..fcc9d376a 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
@@ -27,22 +27,29 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interfa
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang._interface.nat.rev170801._interface.nat.attributes.nat.OutboundBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-public class InterfaceOutboundNatCustomizerTest extends AbstractNatCustomizerTest<Outbound, InterfaceOutboundNatCustomizer> {
+public class InterfaceOutboundNatCustomizerTest
+ extends AbstractNatCustomizerTest<Outbound, InterfaceOutboundNatCustomizer> {
@Override
- protected Outbound getData() {
- return new OutboundBuilder().build();
+ protected Outbound getPreRoutingConfig() {
+ return new OutboundBuilder().setPostRouting(false).build();
+ }
+
+ @Override
+ protected Outbound getPostRoutingConfig() {
+ return new OutboundBuilder().setPostRouting(true).build();
}
@Override
protected InstanceIdentifier<Outbound> getIId(final String ifaceName) {
return InstanceIdentifier.create(Interfaces.class)
- .child(Interface.class, new InterfaceKey(ifaceName)).augmentation(NatInterfaceAugmentation.class)
- .child(Nat.class).child(Outbound.class);
+ .child(Interface.class, new InterfaceKey(ifaceName)).augmentation(NatInterfaceAugmentation.class)
+ .child(Nat.class).child(Outbound.class);
}
@Override
- protected InterfaceOutboundNatCustomizer getCustomizer(final FutureJVppSnatFacade snatApi, final NamingContext ifcNamingCtx) {
+ protected InterfaceOutboundNatCustomizer getCustomizer(final FutureJVppSnatFacade snatApi,
+ final NamingContext ifcNamingCtx) {
return new InterfaceOutboundNatCustomizer(snatApi, ifcNamingCtx);
}
} \ No newline at end of file