From ba6e99e27e2a54bd448c491e22a4e3fc26f45df6 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Tue, 3 Jul 2018 14:09:36 +0200 Subject: HC2VPP-79: use AddressTranslator for ip-address-no-zone translation Change-Id: I46955630709e3d837f95f488cb2fe089952865c4 Signed-off-by: Marek Gradzki --- .../hc2vpp/v3po/interfaces/VxlanGpeCustomizer.java | 29 +++++++--------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizer.java') 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 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 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 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