summaryrefslogtreecommitdiffstats
path: root/vpp-common/vpp-translate-utils/src/test/java/io/fd
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-11-20 15:27:44 +0100
committerMarek Gradzki <mgradzki@cisco.com>2017-11-20 17:12:59 +0100
commit868f11f4f4da49198b8102509fb0234578be25e8 (patch)
treebd77955fc9ad0e8268ce81390f28a5b4ed805c03 /vpp-common/vpp-translate-utils/src/test/java/io/fd
parentc3524b9d3b8579f1aa79bf8c123299a94f4dcc18 (diff)
Refactor IP translators to use IetfInetUtil
Use efficient factory methods for ietf-inet-types DTOs where possible. Also cleans up some duplicated and unused code. Change-Id: I58f4163edba0dcd30e5e044cf701788446d86a0f Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'vpp-common/vpp-translate-utils/src/test/java/io/fd')
-rw-r--r--vpp-common/vpp-translate-utils/src/test/java/io/fd/hc2vpp/common/translate/util/Ipv6TranslatorTest.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/vpp-common/vpp-translate-utils/src/test/java/io/fd/hc2vpp/common/translate/util/Ipv6TranslatorTest.java b/vpp-common/vpp-translate-utils/src/test/java/io/fd/hc2vpp/common/translate/util/Ipv6TranslatorTest.java
index fb4c61b55..3ed7433ea 100644
--- a/vpp-common/vpp-translate-utils/src/test/java/io/fd/hc2vpp/common/translate/util/Ipv6TranslatorTest.java
+++ b/vpp-common/vpp-translate-utils/src/test/java/io/fd/hc2vpp/common/translate/util/Ipv6TranslatorTest.java
@@ -63,13 +63,20 @@ public class Ipv6TranslatorTest implements Ipv6Translator {
}
@Test
+ public void testArrayToIpv6Prefix48() {
+ assertEquals("2001:db8:a0b:12f0::1/48",
+ toIpv6Prefix(new byte[]{32, 1, 13, -72, 10, 11, 18, -16, 0, 0, 0, 0, 0, 0, 0, 1},
+ (byte) 48).getValue());
+ }
+
+ @Test
public void testArrayToIpv6Prefix64() throws Exception {
- assertEquals(IPV6_COMPRESSED + "/64", arrayToIpv6Prefix(IPV6_BYTES, 64).getValue());
+ assertEquals(IPV6_COMPRESSED + "/64", toIpv6Prefix(IPV6_BYTES, 64).getValue());
}
@Test
public void testArrayToIpv6Prefix128() throws Exception {
- assertEquals(IPV6_COMPRESSED + "/128", arrayToIpv6Prefix(IPV6_BYTES, 128).getValue());
+ assertEquals(IPV6_COMPRESSED + "/128", toIpv6Prefix(IPV6_BYTES, 128).getValue());
}
@Test
@@ -129,11 +136,4 @@ public class Ipv6TranslatorTest implements Ipv6Translator {
public void testExtractPrefix() {
assertEquals(48, extractPrefix(new Ipv6Prefix("3ffe:1900:4545:3:200:f8ff:fe21:67cf/48")));
}
-
- @Test
- public void toPrefix() {
- assertEquals("2001:db8:a0b:12f0:0:0:0:1/48",
- toIpv6Prefix(new byte[]{32, 1, 13, -72, 10, 11, 18, -16, 0, 0, 0, 0, 0, 0, 0, 1},
- (byte) 48).getValue());
- }
} \ No newline at end of file