summaryrefslogtreecommitdiffstats
path: root/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/NatInstanceCustomizerTest.java
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2018-05-10 08:41:03 +0200
committerMarek Gradzki <mgradzki@cisco.com>2018-05-17 05:20:09 +0000
commit58bb277ee19627abbf5d8c7e77aeacfe8b63995f (patch)
tree274497583238d25fbcdc3b827d18adecf2597144 /nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/NatInstanceCustomizerTest.java
parent03f6001049d60c59c81408c472996cba4e703a75 (diff)
HC2VPP-321: bump nat model to ietf-nat@2018-02-23.yang
Uses ietf-nat module as defined in https://tools.ietf.org/html/draft-ietf-opsawg-nat-yang-14 Modifications to original model: - ip-address is used instead of ip-prefix (draft is not clear, see HC2VPP-325). API changes relevant to HC/VPP: - nat-config and nat-state merged into nat container - nat-instances and nat-instace renamed to instances and instance respectively - external-ip-address-pool has new parent - policy list - port-type choice was removed, port is now defined using start-port-number and end-port-number leaves. Missing end is equivalent to single-port-number case from the older version. TODOs: - HC2VPP-322: single nat64Prefix per NAT instance - HC2VPP-323: update postman collection - HC2VPP-324: update CSIT tests. Out of the scope of NAT model update: - HC2VPP-326: support for nat-type handling (vpp-nat model might become obsolete) - HC2VPP-327: support external-realm container (requires adding augmentations that are alredy present in the interface-nat model). Change-Id: Ie229a55b0a3f6ee3f8c97f4fd13c54a797a62438 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/NatInstanceCustomizerTest.java')
-rw-r--r--nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/read/NatInstanceCustomizerTest.java34
1 files changed, 17 insertions, 17 deletions
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 8978fe5ba..5974f4a45 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
@@ -35,28 +35,28 @@ import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.NatInstances;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.NatInstancesBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.NatInstance;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.NatInstanceBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev150908.nat.state.nat.instances.NatInstanceKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev180223.nat.Instances;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev180223.nat.InstancesBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev180223.nat.instances.Instance;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev180223.nat.instances.InstanceBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.nat.rev180223.nat.instances.InstanceKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
public class NatInstanceCustomizerTest
- extends InitializingListReaderCustomizerTest<NatInstance, NatInstanceKey, NatInstanceBuilder> {
+ extends InitializingListReaderCustomizerTest<Instance, InstanceKey, InstanceBuilder> {
@Mock
private EntityDumpExecutor<Nat44StaticMappingDetailsReplyDump, Void> nat44DumpExecutor;
@Mock
private EntityDumpExecutor<Nat64BibDetailsReplyDump, Void> nat64DumpExecutor;
- private KeyedInstanceIdentifier<NatInstance, NatInstanceKey> natInstanceId;
- private InstanceIdentifier<NatInstance> natInstanceWildcarded;
+ private KeyedInstanceIdentifier<Instance, InstanceKey> natInstanceId;
+ private InstanceIdentifier<Instance> natInstanceWildcarded;
private DumpCacheManager<Nat44StaticMappingDetailsReplyDump, Void> mapEntryNat44DumpMgr;
private DumpCacheManager<Nat64BibDetailsReplyDump, Void> mapEntryNat64DumpMgr;
public NatInstanceCustomizerTest() {
- super(NatInstance.class, NatInstancesBuilder.class);
+ super(Instance.class, InstancesBuilder.class);
}
@Override
@@ -66,10 +66,10 @@ public class NatInstanceCustomizerTest
@Override
protected void setUp() throws Exception {
- natInstanceId = InstanceIdentifier.create(NatInstances.class)
- .child(NatInstance.class, new NatInstanceKey(NatInstanceCustomizer.DEFAULT_VRF_ID));
- natInstanceWildcarded = InstanceIdentifier.create(NatInstances.class)
- .child(NatInstance.class);
+ natInstanceId = InstanceIdentifier.create(Instances.class)
+ .child(Instance.class, new InstanceKey(NatInstanceCustomizer.DEFAULT_VRF_ID));
+ natInstanceWildcarded = InstanceIdentifier.create(Instances.class)
+ .child(Instance.class);
mapEntryNat44DumpMgr = new DumpCacheManager.DumpCacheManagerBuilder<Nat44StaticMappingDetailsReplyDump, Void>()
.withExecutor(nat44DumpExecutor)
.acceptOnly(Nat44StaticMappingDetailsReplyDump.class)
@@ -82,7 +82,7 @@ public class NatInstanceCustomizerTest
@Test
public void testRead() throws ReadFailedException {
- final NatInstanceBuilder builder = mock(NatInstanceBuilder.class);
+ final InstanceBuilder builder = mock(InstanceBuilder.class);
getCustomizer().readCurrentAttributes(natInstanceId, builder, ctx);
verify(builder).setId(natInstanceId.getKey().getId());
}
@@ -91,11 +91,11 @@ public class NatInstanceCustomizerTest
public void testReadAll() throws ReadFailedException {
when(nat44DumpExecutor.executeDump(natInstanceWildcarded, null)).thenReturn(nat44NonEmptyDump());
when(nat64DumpExecutor.executeDump(natInstanceWildcarded, null)).thenReturn(nat64NonEmptyDump());
- final List<NatInstanceKey> allIds = getCustomizer().getAllIds(natInstanceWildcarded, ctx);
+ final List<InstanceKey> allIds = getCustomizer().getAllIds(natInstanceWildcarded, ctx);
assertThat(allIds, hasSize(6));
assertThat(allIds, hasItems(
- new NatInstanceKey(0L), new NatInstanceKey(1L), new NatInstanceKey(2L), new NatInstanceKey(3L),
- new NatInstanceKey(5L), new NatInstanceKey(6L)));
+ new InstanceKey(0L), new InstanceKey(1L), new InstanceKey(2L), new InstanceKey(3L),
+ new InstanceKey(5L), new InstanceKey(6L)));
}
private static Nat44StaticMappingDetailsReplyDump nat44NonEmptyDump() {