summaryrefslogtreecommitdiffstats
path: root/v3po
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2018-07-03 14:09:36 +0200
committerMarek Gradzki <mgradzki@cisco.com>2018-07-04 10:57:22 +0000
commitba6e99e27e2a54bd448c491e22a4e3fc26f45df6 (patch)
treecc1b29773b67280d79530715336c00b669a88f81 /v3po
parentb6ead1d5525b5b1500729959acbce905bbcbf04a (diff)
HC2VPP-79: use AddressTranslator for ip-address-no-zone translation
Change-Id: I46955630709e3d837f95f488cb2fe089952865c4 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/GreCustomizer.java31
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizer.java40
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizer.java29
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/GreCustomizerTest.java10
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizerTest.java11
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizerTest.java10
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/GreCustomizerTest.java8
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizerTest.java6
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanGpeCustomizerTest.java9
9 files changed, 59 insertions, 95 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/GreCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/GreCustomizer.java
index 2f6d4a51c..4e99c9397 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/GreCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/GreCustomizer.java
@@ -18,8 +18,8 @@ package io.fd.hc2vpp.v3po.interfaces;
import static com.google.common.base.Preconditions.checkArgument;
-import com.google.common.net.InetAddresses;
import io.fd.hc2vpp.common.translate.util.AbstractInterfaceTypeCustomizer;
+import io.fd.hc2vpp.common.translate.util.AddressTranslator;
import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.honeycomb.translate.write.WriteContext;
@@ -27,7 +27,6 @@ import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.vpp.jvpp.core.dto.GreAddDelTunnel;
import io.fd.vpp.jvpp.core.dto.GreAddDelTunnelReply;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.net.InetAddress;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
@@ -49,12 +48,13 @@ public class GreCustomizer extends AbstractInterfaceTypeCustomizer<Gre> implemen
this.interfaceContext = interfaceContext;
}
- private static GreAddDelTunnel getGreTunnelRequest(final byte isAdd, final byte[] srcAddr, final byte[] dstAddr,
- final int outerFibId, final byte isIpv6) {
+ private static GreAddDelTunnel getGreTunnelRequest(final byte isAdd, final IpAddressNoZone srcAddr,
+ final IpAddressNoZone dstAddr, final int outerFibId,
+ final byte isIpv6) {
final GreAddDelTunnel greAddDelTunnel = new GreAddDelTunnel();
greAddDelTunnel.isAdd = isAdd;
- greAddDelTunnel.srcAddress = srcAddr;
- greAddDelTunnel.dstAddress = dstAddr;
+ greAddDelTunnel.srcAddress = AddressTranslator.INSTANCE.ipAddressToArray(srcAddr);
+ greAddDelTunnel.dstAddress = AddressTranslator.INSTANCE.ipAddressToArray(dstAddr);
greAddDelTunnel.outerFibId = outerFibId;
greAddDelTunnel.isIpv6 = isIpv6;
return greAddDelTunnel;
@@ -87,15 +87,12 @@ public class GreCustomizer extends AbstractInterfaceTypeCustomizer<Gre> implemen
final byte isIpv6 = (byte) (isIpv6(gre)
? 1
: 0);
- final InetAddress srcAddress = InetAddresses.forString(getAddressString(gre.getSrc()));
- final InetAddress dstAddress = InetAddresses.forString(getAddressString(gre.getDst()));
-
int outerFibId = gre.getOuterFibId().intValue();
LOG.debug("Setting gre tunnel for interface: {}. Gre: {}", swIfName, gre);
final CompletionStage<GreAddDelTunnelReply> greAddDelTunnelReplyCompletionStage =
- getFutureJVpp().greAddDelTunnel(getGreTunnelRequest((byte) 1 /* is add */, srcAddress.getAddress(),
- dstAddress.getAddress(), outerFibId, isIpv6));
+ getFutureJVpp().greAddDelTunnel(getGreTunnelRequest((byte) 1 /* is add */, gre.getSrc(),
+ gre.getDst(), outerFibId, isIpv6));
final GreAddDelTunnelReply reply =
getReplyForCreate(greAddDelTunnelReplyCompletionStage.toCompletableFuture(), id, gre);
@@ -129,26 +126,18 @@ public class GreCustomizer extends AbstractInterfaceTypeCustomizer<Gre> implemen
}
}
- private String getAddressString(final IpAddressNoZone addr) {
- return addr.getIpv4AddressNoZone() == null
- ? addr.getIpv6AddressNoZone().getValue()
- : addr.getIpv4AddressNoZone().getValue();
- }
-
private void deleteGreTunnel(final InstanceIdentifier<Gre> id, final String swIfName, final Gre gre,
final WriteContext writeContext) throws WriteFailedException {
final byte isIpv6 = (byte) (isIpv6(gre)
? 1
: 0);
- final InetAddress srcAddress = InetAddresses.forString(getAddressString(gre.getSrc()));
- final InetAddress dstAddress = InetAddresses.forString(getAddressString(gre.getDst()));
int outerFibId = gre.getOuterFibId().intValue();
LOG.debug("Deleting gre tunnel for interface: {}. Gre: {}", swIfName, gre);
final CompletionStage<GreAddDelTunnelReply> greAddDelTunnelReplyCompletionStage =
- getFutureJVpp().greAddDelTunnel(getGreTunnelRequest((byte) 0 /* is add */, srcAddress.getAddress(),
- dstAddress.getAddress(), outerFibId, isIpv6));
+ getFutureJVpp().greAddDelTunnel(getGreTunnelRequest((byte) 0 /* is add */, gre.getSrc(),
+ gre.getDst(), outerFibId, isIpv6));
getReplyForDelete(greAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
LOG.debug("Gre tunnel deleted successfully for: {}, gre: {}", swIfName, gre);
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizer.java
index b0387d1b6..5d5b086ec 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizer.java
@@ -18,8 +18,8 @@ package io.fd.hc2vpp.v3po.interfaces;
import static com.google.common.base.Preconditions.checkArgument;
-import com.google.common.net.InetAddresses;
import io.fd.hc2vpp.common.translate.util.AbstractInterfaceTypeCustomizer;
+import io.fd.hc2vpp.common.translate.util.AddressTranslator;
import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.hc2vpp.v3po.DisabledInterfacesManager;
@@ -28,7 +28,6 @@ import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.vpp.jvpp.core.dto.VxlanAddDelTunnel;
import io.fd.vpp.jvpp.core.dto.VxlanAddDelTunnelReply;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.net.InetAddress;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
@@ -82,10 +81,8 @@ public class VxlanCustomizer extends AbstractInterfaceTypeCustomizer<Vxlan> impl
final WriteContext writeContext)
throws WriteFailedException {
final byte isIpv6 = (byte) (isIpv6(vxlan)
- ? 1
- : 0);
- final InetAddress srcAddress = InetAddresses.forString(getAddressString(vxlan.getSrc()));
- final InetAddress dstAddress = InetAddresses.forString(getAddressString(vxlan.getDst()));
+ ? 1
+ : 0);
checkArgument(vxlan.getEncapVrfId() != null && vxlan.getEncapVrfId().getValue() != null,
"encap-vrf-id is mandatory but was not given");
@@ -101,8 +98,8 @@ public class VxlanCustomizer extends AbstractInterfaceTypeCustomizer<Vxlan> impl
LOG.debug("Setting vxlan tunnel for interface: {}. Vxlan: {}", swIfName, vxlan);
final CompletionStage<VxlanAddDelTunnelReply> vxlanAddDelTunnelReplyCompletionStage =
- getFutureJVpp().vxlanAddDelTunnel(getVxlanTunnelRequest((byte) 1 /* is add */, srcAddress.getAddress(),
- dstAddress.getAddress(), encapVrfId, decapNext, vni, isIpv6));
+ getFutureJVpp().vxlanAddDelTunnel(getVxlanTunnelRequest((byte) 1 /* is add */, vxlan.getSrc(),
+ vxlan.getDst(), encapVrfId, decapNext, vni, isIpv6));
final VxlanAddDelTunnelReply reply =
getReplyForCreate(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture(), id, vxlan);
@@ -145,19 +142,11 @@ public class VxlanCustomizer extends AbstractInterfaceTypeCustomizer<Vxlan> impl
}
}
- private String getAddressString(final IpAddressNoZone addr) {
- return addr.getIpv4AddressNoZone() == null
- ? addr.getIpv6AddressNoZone().getValue()
- : addr.getIpv4AddressNoZone().getValue();
- }
-
private void deleteVxlanTunnel(final InstanceIdentifier<Vxlan> id, final String swIfName, final Vxlan vxlan,
final WriteContext writeContext) throws WriteFailedException {
final byte isIpv6 = (byte) (isIpv6(vxlan)
- ? 1
- : 0);
- final InetAddress srcAddress = InetAddresses.forString(getAddressString(vxlan.getSrc()));
- final InetAddress dstAddress = InetAddresses.forString(getAddressString(vxlan.getDst()));
+ ? 1
+ : 0);
checkArgument(vxlan.getEncapVrfId() != null && vxlan.getEncapVrfId().getValue() != null,
"encap-vrf-id is mandatory but was not given");
@@ -173,8 +162,8 @@ public class VxlanCustomizer extends AbstractInterfaceTypeCustomizer<Vxlan> impl
LOG.debug("Deleting vxlan tunnel for interface: {}. Vxlan: {}", swIfName, vxlan);
final CompletionStage<VxlanAddDelTunnelReply> vxlanAddDelTunnelReplyCompletionStage =
- getFutureJVpp().vxlanAddDelTunnel(getVxlanTunnelRequest((byte) 0 /* is add */, srcAddress.getAddress(),
- dstAddress.getAddress(), encapVrfId, decapNext, vni, isIpv6));
+ getFutureJVpp().vxlanAddDelTunnel(getVxlanTunnelRequest((byte) 0 /* is add */, vxlan.getSrc(),
+ vxlan.getDst(), encapVrfId, decapNext, vni, isIpv6));
getReplyForDelete(vxlanAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
LOG.debug("Vxlan tunnel deleted successfully for: {}, vxlan: {}", swIfName, vxlan);
@@ -188,13 +177,14 @@ public class VxlanCustomizer extends AbstractInterfaceTypeCustomizer<Vxlan> impl
interfaceNamingContext.removeName(swIfName, writeContext.getMappingContext());
}
- private static VxlanAddDelTunnel getVxlanTunnelRequest(final byte isAdd, final byte[] srcAddr, final byte[] dstAddr,
- final int encapVrfId,
- final int decapNextIndex, final int vni, final byte isIpv6) {
+ private static VxlanAddDelTunnel getVxlanTunnelRequest(final byte isAdd, final IpAddressNoZone srcAddr,
+ final IpAddressNoZone dstAddr,
+ final int encapVrfId,
+ final int decapNextIndex, final int vni, final byte isIpv6) {
final VxlanAddDelTunnel vxlanAddDelTunnel = new VxlanAddDelTunnel();
vxlanAddDelTunnel.isAdd = isAdd;
- vxlanAddDelTunnel.srcAddress = srcAddr;
- vxlanAddDelTunnel.dstAddress = dstAddr;
+ vxlanAddDelTunnel.srcAddress = AddressTranslator.INSTANCE.ipAddressToArray(srcAddr);
+ vxlanAddDelTunnel.dstAddress = AddressTranslator.INSTANCE.ipAddressToArray(dstAddr);
vxlanAddDelTunnel.encapVrfId = encapVrfId;
vxlanAddDelTunnel.vni = vni;
vxlanAddDelTunnel.decapNextIndex = decapNextIndex;
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizer.java
index ac21c4dbd..c875b87dc 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizer.java
@@ -18,8 +18,8 @@ package io.fd.hc2vpp.v3po.interfaces;
import static com.google.common.base.Preconditions.checkArgument;
-import com.google.common.net.InetAddresses;
import io.fd.hc2vpp.common.translate.util.AbstractInterfaceTypeCustomizer;
+import io.fd.hc2vpp.common.translate.util.AddressTranslator;
import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.hc2vpp.v3po.DisabledInterfacesManager;
@@ -28,7 +28,6 @@ import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.vpp.jvpp.core.dto.VxlanGpeAddDelTunnel;
import io.fd.vpp.jvpp.core.dto.VxlanGpeAddDelTunnelReply;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import java.net.InetAddress;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
@@ -83,8 +82,6 @@ public class VxlanGpeCustomizer extends AbstractInterfaceTypeCustomizer<VxlanGpe
final byte isIpv6 = (byte) (isIpv6(vxlanGpe)
? 1
: 0);
- final InetAddress Local = InetAddresses.forString(getAddressString(vxlanGpe.getLocal()));
- final InetAddress Remote = InetAddresses.forString(getAddressString(vxlanGpe.getRemote()));
int vni = vxlanGpe.getVni().getValue().intValue();
byte protocol = (byte) vxlanGpe.getNextProtocol().getIntValue();
@@ -93,8 +90,8 @@ public class VxlanGpeCustomizer extends AbstractInterfaceTypeCustomizer<VxlanGpe
LOG.debug("Setting VxlanGpe tunnel for interface: {}. VxlanGpe: {}", swIfName, vxlanGpe);
final CompletionStage<VxlanGpeAddDelTunnelReply> VxlanGpeAddDelTunnelReplyCompletionStage =
- getFutureJVpp().vxlanGpeAddDelTunnel(getVxlanGpeTunnelRequest((byte) 1 /* is add */, Local.getAddress(),
- Remote.getAddress(), vni, protocol, encapVrfId, decapVrfId, isIpv6));
+ getFutureJVpp().vxlanGpeAddDelTunnel(getVxlanGpeTunnelRequest((byte) 1 /* is add */, vxlanGpe.getLocal(),
+ vxlanGpe.getRemote(), vni, protocol, encapVrfId, decapVrfId, isIpv6));
final VxlanGpeAddDelTunnelReply reply =
getReplyForCreate(VxlanGpeAddDelTunnelReplyCompletionStage.toCompletableFuture(), id, vxlanGpe);
@@ -131,20 +128,12 @@ public class VxlanGpeCustomizer extends AbstractInterfaceTypeCustomizer<VxlanGpe
}
}
- private String getAddressString(final IpAddressNoZone addr) {
- return addr.getIpv4AddressNoZone() == null
- ? addr.getIpv6AddressNoZone().getValue()
- : addr.getIpv4AddressNoZone().getValue();
- }
-
private void deleteVxlanGpeTunnel(final InstanceIdentifier<VxlanGpe> id, final String swIfName,
final VxlanGpe vxlanGpe, final WriteContext writeContext)
throws WriteFailedException {
final byte isIpv6 = (byte) (isIpv6(vxlanGpe)
? 1
: 0);
- final InetAddress local = InetAddresses.forString(getAddressString(vxlanGpe.getLocal()));
- final InetAddress remote = InetAddresses.forString(getAddressString(vxlanGpe.getRemote()));
int vni = vxlanGpe.getVni().getValue().intValue();
byte protocol = (byte) vxlanGpe.getNextProtocol().getIntValue();
@@ -154,8 +143,8 @@ public class VxlanGpeCustomizer extends AbstractInterfaceTypeCustomizer<VxlanGpe
LOG.debug("Deleting VxlanGpe tunnel for interface: {}. VxlanGpe: {}", swIfName, vxlanGpe);
final CompletionStage<VxlanGpeAddDelTunnelReply> VxlanGpeAddDelTunnelReplyCompletionStage =
getFutureJVpp()
- .vxlanGpeAddDelTunnel(getVxlanGpeTunnelRequest((byte) 0 /* is delete */, local.getAddress(),
- remote.getAddress(), vni, protocol, encapVrfId, decapVrfId, isIpv6));
+ .vxlanGpeAddDelTunnel(getVxlanGpeTunnelRequest((byte) 0 /* is delete */, vxlanGpe.getLocal(),
+ vxlanGpe.getRemote(), vni, protocol, encapVrfId, decapVrfId, isIpv6));
getReplyForDelete(VxlanGpeAddDelTunnelReplyCompletionStage.toCompletableFuture(), id);
final int index = interfaceNamingContext.getIndex(swIfName, writeContext.getMappingContext());
// Mark this interface as disabled to not include it in operational reads
@@ -166,15 +155,15 @@ public class VxlanGpeCustomizer extends AbstractInterfaceTypeCustomizer<VxlanGpe
interfaceNamingContext.removeName(swIfName, writeContext.getMappingContext());
}
- private static VxlanGpeAddDelTunnel getVxlanGpeTunnelRequest(final byte isAdd, final byte[] local,
- final byte[] remote,
+ private static VxlanGpeAddDelTunnel getVxlanGpeTunnelRequest(final byte isAdd, final IpAddressNoZone local,
+ final IpAddressNoZone remote,
final int vni, final byte protocol,
final int encapVrfId, final int decapVrfId,
final byte isIpv6) {
final VxlanGpeAddDelTunnel VxlanGpeAddDelTunnel = new VxlanGpeAddDelTunnel();
VxlanGpeAddDelTunnel.isAdd = isAdd;
- VxlanGpeAddDelTunnel.local = local;
- VxlanGpeAddDelTunnel.remote = remote;
+ VxlanGpeAddDelTunnel.local = AddressTranslator.INSTANCE.ipAddressToArray(local);
+ VxlanGpeAddDelTunnel.remote = AddressTranslator.INSTANCE.ipAddressToArray(remote);
VxlanGpeAddDelTunnel.vni = vni;
VxlanGpeAddDelTunnel.protocol = protocol;
VxlanGpeAddDelTunnel.encapVrfId = encapVrfId;
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/GreCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/GreCustomizerTest.java
index 68f266d52..087110e49 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/GreCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/GreCustomizerTest.java
@@ -26,8 +26,8 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import com.google.common.net.InetAddresses;
import io.fd.hc2vpp.common.test.write.WriterCustomizerTest;
+import io.fd.hc2vpp.common.translate.util.AddressTranslator;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.vpp.jvpp.VppBaseCallException;
@@ -46,7 +46,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev180703.interfaces._interface.GreBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-public class GreCustomizerTest extends WriterCustomizerTest {
+public class GreCustomizerTest extends WriterCustomizerTest implements AddressTranslator {
private static final String IFC_TEST_INSTANCE = "ifc-test-instance";
private static final byte ADD_GRE = 1;
@@ -87,10 +87,8 @@ public class GreCustomizerTest extends WriterCustomizerTest {
verify(api).greAddDelTunnel(argumentCaptor.capture());
final GreAddDelTunnel actual = argumentCaptor.getValue();
assertEquals(0, actual.isIpv6);
- assertArrayEquals(InetAddresses.forString(gre.getSrc().getIpv4AddressNoZone().getValue()).getAddress(),
- actual.srcAddress);
- assertArrayEquals(InetAddresses.forString(gre.getDst().getIpv4AddressNoZone().getValue()).getAddress(),
- actual.dstAddress);
+ assertArrayEquals(ipAddressToArray(gre.getSrc()), actual.srcAddress);
+ assertArrayEquals(ipAddressToArray(gre.getDst()), actual.dstAddress);
assertEquals(gre.getOuterFibId().intValue(), actual.outerFibId);
return actual;
}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizerTest.java
index 5e758c4d4..9a1994b11 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizerTest.java
@@ -27,8 +27,8 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import com.google.common.net.InetAddresses;
import io.fd.hc2vpp.common.test.write.WriterCustomizerTest;
+import io.fd.hc2vpp.common.translate.util.AddressTranslator;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.hc2vpp.v3po.DisabledInterfacesManager;
import io.fd.honeycomb.translate.write.WriteFailedException;
@@ -52,7 +52,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.VniReference;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-public class VxlanCustomizerTest extends WriterCustomizerTest {
+public class VxlanCustomizerTest extends WriterCustomizerTest implements AddressTranslator {
private static final byte ADD_VXLAN = 1;
private static final byte DEL_VXLAN = 0;
@@ -105,10 +105,9 @@ public class VxlanCustomizerTest extends WriterCustomizerTest {
final VxlanAddDelTunnel actual = argumentCaptor.getValue();
assertEquals(0, actual.isIpv6);
assertEquals(1, actual.decapNextIndex);
- assertArrayEquals(InetAddresses.forString(vxlan.getSrc().getIpv4AddressNoZone().getValue()).getAddress(),
- actual.srcAddress);
- assertArrayEquals(InetAddresses.forString(vxlan.getDst().getIpv4AddressNoZone().getValue()).getAddress(),
- actual.dstAddress);
+
+ assertArrayEquals(ipAddressToArray(vxlan.getSrc()), actual.srcAddress);
+ assertArrayEquals(ipAddressToArray(vxlan.getDst()), actual.dstAddress);
assertEquals(vxlan.getEncapVrfId().getValue().intValue(), actual.encapVrfId);
assertEquals(vxlan.getVni().getValue().intValue(), actual.vni);
return actual;
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizerTest.java
index 7d282c09c..946f837b9 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizerTest.java
@@ -27,8 +27,8 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import com.google.common.net.InetAddresses;
import io.fd.hc2vpp.common.test.write.WriterCustomizerTest;
+import io.fd.hc2vpp.common.translate.util.AddressTranslator;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.hc2vpp.v3po.DisabledInterfacesManager;
import io.fd.honeycomb.translate.write.WriteFailedException;
@@ -50,7 +50,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev180703.interfaces._interface.VxlanGpeBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-public class VxlanGpeCustomizerTest extends WriterCustomizerTest {
+public class VxlanGpeCustomizerTest extends WriterCustomizerTest implements AddressTranslator {
private static final byte ADD_VXLAN_GPE = 1;
private static final byte DEL_VXLAN_GPE = 0;
@@ -104,10 +104,8 @@ public class VxlanGpeCustomizerTest extends WriterCustomizerTest {
verify(api).vxlanGpeAddDelTunnel(argumentCaptor.capture());
final VxlanGpeAddDelTunnel actual = argumentCaptor.getValue();
assertEquals(0, actual.isIpv6);
- assertArrayEquals(InetAddresses.forString(vxlanGpe.getLocal().getIpv4AddressNoZone().getValue()).getAddress(),
- actual.local);
- assertArrayEquals(InetAddresses.forString(vxlanGpe.getRemote().getIpv4AddressNoZone().getValue()).getAddress(),
- actual.remote);
+ assertArrayEquals(ipAddressToArray(vxlanGpe.getLocal()), actual.local);
+ assertArrayEquals(ipAddressToArray(vxlanGpe.getRemote()), actual.remote);
assertEquals(vxlanGpe.getVni().getValue().intValue(), actual.vni);
assertEquals(vxlanGpe.getNextProtocol().getIntValue(), actual.protocol);
assertEquals(vxlanGpe.getEncapVrfId().intValue(), actual.encapVrfId);
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/GreCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/GreCustomizerTest.java
index 686126247..ab5ca58b3 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/GreCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/GreCustomizerTest.java
@@ -26,8 +26,8 @@ import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
import com.google.common.collect.Lists;
-import com.google.common.net.InetAddresses;
import io.fd.hc2vpp.common.test.read.ReaderCustomizerTest;
+import io.fd.hc2vpp.common.translate.util.AddressTranslator;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.hc2vpp.v3po.interfacesstate.cache.InterfaceCacheDumpManager;
import io.fd.honeycomb.translate.read.ReadFailedException;
@@ -48,7 +48,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev180703.interfaces.state._interface.GreBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-public class GreCustomizerTest extends ReaderCustomizerTest<Gre, GreBuilder> {
+public class GreCustomizerTest extends ReaderCustomizerTest<Gre, GreBuilder> implements AddressTranslator {
private static final String IFACE_NAME = "ifc1";
private static final int IFACE_ID = 0;
@@ -79,8 +79,8 @@ public class GreCustomizerTest extends ReaderCustomizerTest<Gre, GreBuilder> {
final GreTunnelDetailsReplyDump value = new GreTunnelDetailsReplyDump();
final GreTunnelDetails greTunnelDetails = new GreTunnelDetails();
greTunnelDetails.isIpv6 = 0;
- greTunnelDetails.dstAddress = InetAddresses.forString("1.2.3.4").getAddress();
- greTunnelDetails.srcAddress = InetAddresses.forString("1.2.3.5").getAddress();
+ greTunnelDetails.dstAddress = ipv4AddressNoZoneToArray("1.2.3.4");
+ greTunnelDetails.srcAddress = ipv4AddressNoZoneToArray("1.2.3.5");
greTunnelDetails.outerFibId = 55;
greTunnelDetails.swIfIndex = 0;
value.greTunnelDetails = Lists.newArrayList(greTunnelDetails);
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizerTest.java
index 6ce09132b..a98a2cf67 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizerTest.java
@@ -26,8 +26,8 @@ import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
import com.google.common.collect.Lists;
-import com.google.common.net.InetAddresses;
import io.fd.hc2vpp.common.test.read.ReaderCustomizerTest;
+import io.fd.hc2vpp.common.translate.util.AddressTranslator;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.hc2vpp.v3po.interfacesstate.cache.InterfaceCacheDumpManager;
import io.fd.honeycomb.translate.read.ReadFailedException;
@@ -143,8 +143,8 @@ public class VxlanCustomizerTest extends ReaderCustomizerTest<Vxlan, VxlanBuilde
final VxlanTunnelDetailsReplyDump replyDump = new VxlanTunnelDetailsReplyDump();
final VxlanTunnelDetails vxlanTunnelDetails = new VxlanTunnelDetails();
vxlanTunnelDetails.isIpv6 = 0;
- vxlanTunnelDetails.dstAddress = InetAddresses.forString("1.2.3.4").getAddress();
- vxlanTunnelDetails.srcAddress = InetAddresses.forString("1.2.3.5").getAddress();
+ vxlanTunnelDetails.dstAddress = AddressTranslator.INSTANCE.ipv4AddressNoZoneToArray("1.2.3.4");
+ vxlanTunnelDetails.srcAddress = AddressTranslator.INSTANCE.ipv4AddressNoZoneToArray("1.2.3.5");
vxlanTunnelDetails.encapVrfId = encapVrfId;
vxlanTunnelDetails.swIfIndex = 0;
vxlanTunnelDetails.vni = 9;
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanGpeCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanGpeCustomizerTest.java
index 319ef93e1..c10a7febb 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanGpeCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanGpeCustomizerTest.java
@@ -27,8 +27,8 @@ import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
import com.google.common.collect.Lists;
-import com.google.common.net.InetAddresses;
import io.fd.hc2vpp.common.test.read.ReaderCustomizerTest;
+import io.fd.hc2vpp.common.translate.util.AddressTranslator;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.hc2vpp.v3po.interfacesstate.cache.InterfaceCacheDumpManager;
import io.fd.honeycomb.translate.read.ReadFailedException;
@@ -49,7 +49,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev180703.interfaces.state._interface.VxlanGpeBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-public class VxlanGpeCustomizerTest extends ReaderCustomizerTest<VxlanGpe, VxlanGpeBuilder> {
+public class VxlanGpeCustomizerTest extends ReaderCustomizerTest<VxlanGpe, VxlanGpeBuilder>
+ implements AddressTranslator {
private static final String IFC_CTX_NAME = "ifc-test-instance";
private static final String IF_NAME = "ifc2";
@@ -80,8 +81,8 @@ public class VxlanGpeCustomizerTest extends ReaderCustomizerTest<VxlanGpe, Vxlan
final VxlanGpeTunnelDetailsReplyDump value = new VxlanGpeTunnelDetailsReplyDump();
final VxlanGpeTunnelDetails vxlanGpeTunnelDetails = new VxlanGpeTunnelDetails();
vxlanGpeTunnelDetails.isIpv6 = 0;
- vxlanGpeTunnelDetails.local = InetAddresses.forString("1.2.3.4").getAddress();
- vxlanGpeTunnelDetails.remote = InetAddresses.forString("1.2.3.5").getAddress();
+ vxlanGpeTunnelDetails.local = ipv4AddressNoZoneToArray("1.2.3.4");
+ vxlanGpeTunnelDetails.remote = ipv4AddressNoZoneToArray("1.2.3.5");
vxlanGpeTunnelDetails.vni = 9;
vxlanGpeTunnelDetails.protocol = 1;
vxlanGpeTunnelDetails.encapVrfId = 55;