summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/test/java/io
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-11-20 14:00:32 +0100
committerMarek Gradzki <mgradzki@cisco.com>2017-11-20 14:00:35 +0100
commitc3524b9d3b8579f1aa79bf8c123299a94f4dcc18 (patch)
treea15cdec8ef50b5e0ad05acaea65df622a1e82e0e /v3po/v3po2vpp/src/test/java/io
parent87e37b4f78ff60e3b8c84c3c6670e20c18e20b04 (diff)
Use InetAddresses.forString instead of InetAddress.getByName
Unlike InetAddress.getByName(), Guava's InetAddresses.forString() never cause DNS services to be accessed. JDK equivalents whenever you are expecting to handle only IP address string literals, so there is no blocking DNS penalty for a malformed string. See: https://google.github.io/guava/releases/22.0/api/docs/com/google/common/net/InetAddresses.html#forString-java.lang.String- Change-Id: I7972c09f1f0a3a2688021302acbf6df112be7f72 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/test/java/io')
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/GreCustomizerTest.java9
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizerTest.java9
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanGpeCustomizerTest.java9
3 files changed, 12 insertions, 15 deletions
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 806da6858..fe0429b2b 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,6 +26,7 @@ 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.NamingContext;
import io.fd.hc2vpp.v3po.interfacesstate.cache.InterfaceCacheDumpManager;
@@ -36,8 +37,6 @@ import io.fd.vpp.jvpp.core.dto.GreTunnelDetails;
import io.fd.vpp.jvpp.core.dto.GreTunnelDetailsReplyDump;
import io.fd.vpp.jvpp.core.dto.GreTunnelDump;
import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
import org.junit.Test;
import org.mockito.Mock;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
@@ -68,7 +67,7 @@ public class GreCustomizerTest extends ReaderCustomizerTest<Gre, GreBuilder> {
}
@Override
- public void setUp() throws UnknownHostException, VppInvocationException, ReadFailedException {
+ public void setUp() throws VppInvocationException, ReadFailedException {
interfacesContext = new NamingContext("gre-tunnel", IFC_CTX_NAME);
defineMapping(mappingContext, IFACE_NAME, IFACE_ID, IFC_CTX_NAME);
@@ -80,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 = InetAddress.getByName("1.2.3.4").getAddress();
- greTunnelDetails.srcAddress = InetAddress.getByName("1.2.3.5").getAddress();
+ greTunnelDetails.dstAddress = InetAddresses.forString("1.2.3.4").getAddress();
+ greTunnelDetails.srcAddress = InetAddresses.forString("1.2.3.5").getAddress();
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 ba0cf2d2d..bfeb7eaa9 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,6 +26,7 @@ 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.NamingContext;
import io.fd.hc2vpp.v3po.interfacesstate.cache.InterfaceCacheDumpManager;
@@ -36,8 +37,6 @@ import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
import io.fd.vpp.jvpp.core.dto.VxlanTunnelDetails;
import io.fd.vpp.jvpp.core.dto.VxlanTunnelDetailsReplyDump;
import io.fd.vpp.jvpp.core.dto.VxlanTunnelDump;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
import org.junit.Test;
import org.mockito.Mock;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
@@ -69,7 +68,7 @@ public class VxlanCustomizerTest extends ReaderCustomizerTest<Vxlan, VxlanBuilde
}
@Override
- public void setUp() throws UnknownHostException, VppInvocationException, ReadFailedException {
+ public void setUp() throws VppInvocationException, ReadFailedException {
interfacesContext = new NamingContext("vxlan-tunnel", IFC_CTX_NAME);
defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_CTX_NAME);
@@ -81,8 +80,8 @@ public class VxlanCustomizerTest extends ReaderCustomizerTest<Vxlan, VxlanBuilde
final VxlanTunnelDetailsReplyDump value = new VxlanTunnelDetailsReplyDump();
final VxlanTunnelDetails vxlanTunnelDetails = new VxlanTunnelDetails();
vxlanTunnelDetails.isIpv6 = 0;
- vxlanTunnelDetails.dstAddress = InetAddress.getByName("1.2.3.4").getAddress();
- vxlanTunnelDetails.srcAddress = InetAddress.getByName("1.2.3.5").getAddress();
+ vxlanTunnelDetails.dstAddress = InetAddresses.forString("1.2.3.4").getAddress();
+ vxlanTunnelDetails.srcAddress = InetAddresses.forString("1.2.3.5").getAddress();
vxlanTunnelDetails.encapVrfId = 55;
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 ce794302b..6eafa268d 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,6 +27,7 @@ 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.NamingContext;
import io.fd.hc2vpp.v3po.interfacesstate.cache.InterfaceCacheDumpManager;
@@ -37,8 +38,6 @@ import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
import io.fd.vpp.jvpp.core.dto.VxlanGpeTunnelDetails;
import io.fd.vpp.jvpp.core.dto.VxlanGpeTunnelDetailsReplyDump;
import io.fd.vpp.jvpp.core.dto.VxlanGpeTunnelDump;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
import org.junit.Test;
import org.mockito.Mock;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
@@ -69,7 +68,7 @@ public class VxlanGpeCustomizerTest extends ReaderCustomizerTest<VxlanGpe, Vxlan
}
@Override
- public void setUp() throws UnknownHostException, VppBaseCallException, ReadFailedException {
+ public void setUp() throws VppBaseCallException, ReadFailedException {
interfacesContext = new NamingContext("vxlan_gpe_inf", IFC_CTX_NAME);
defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_CTX_NAME);
@@ -81,8 +80,8 @@ public class VxlanGpeCustomizerTest extends ReaderCustomizerTest<VxlanGpe, Vxlan
final VxlanGpeTunnelDetailsReplyDump value = new VxlanGpeTunnelDetailsReplyDump();
final VxlanGpeTunnelDetails vxlanGpeTunnelDetails = new VxlanGpeTunnelDetails();
vxlanGpeTunnelDetails.isIpv6 = 0;
- vxlanGpeTunnelDetails.local = InetAddress.getByName("1.2.3.4").getAddress();
- vxlanGpeTunnelDetails.remote = InetAddress.getByName("1.2.3.5").getAddress();
+ vxlanGpeTunnelDetails.local = InetAddresses.forString("1.2.3.4").getAddress();
+ vxlanGpeTunnelDetails.remote = InetAddresses.forString("1.2.3.5").getAddress();
vxlanGpeTunnelDetails.vni = 9;
vxlanGpeTunnelDetails.protocol = 1;
vxlanGpeTunnelDetails.encapVrfId = 55;