From a5a20bd12ecd1c094555fe601a9c9b464776b232 Mon Sep 17 00:00:00 2001 From: Jan Srnicek Date: Wed, 28 Sep 2016 14:42:39 +0200 Subject: HONEYCOMB-210 - DumpEmptyCheck removed Change-Id: I95ea94c3a1a581753f7eb667af7aacde832c21fd Signed-off-by: Jan Srnicek --- .../interfacesstate/ip/Ipv4AddressCustomizer.java | 33 ++++++++++------------ .../ip/SubInterfaceIpv4AddressCustomizer.java | 2 -- .../ip/dump/check/AddressDumpCheck.java | 16 ----------- 3 files changed, 15 insertions(+), 36 deletions(-) delete mode 100644 v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/dump/check/AddressDumpCheck.java (limited to 'v3po/v3po2vpp') diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4AddressCustomizer.java index 16aa5fe17..ca191d46c 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4AddressCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/Ipv4AddressCustomizer.java @@ -25,7 +25,6 @@ import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer; import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager; import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException; import io.fd.honeycomb.translate.v3po.interfacesstate.ip.dump.AddressDumpExecutor; -import io.fd.honeycomb.translate.v3po.interfacesstate.ip.dump.check.AddressDumpCheck; import io.fd.honeycomb.translate.v3po.interfacesstate.ip.dump.params.AddressDumpParams; import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer; import io.fd.honeycomb.translate.vpp.util.NamingContext; @@ -64,7 +63,6 @@ public class Ipv4AddressCustomizer extends FutureJVppCustomizer this.interfaceContext = checkNotNull(interfaceContext, "interfaceContext should not be null"); this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder() .withExecutor(new AddressDumpExecutor(futureJVppCore)) - .withNonEmptyPredicate(new AddressDumpCheck()) .build(); } @@ -91,24 +89,23 @@ public class Ipv4AddressCustomizer extends FutureJVppCustomizer throw new ReadFailedException(id, e); } - if (dumpOptional.isPresent()) { - final Optional ipAddressDetails = - findIpAddressDetailsByIp(dumpOptional, id.firstKeyOf(Address.class).getIp()); - - if (ipAddressDetails.isPresent()) { - final IpAddressDetails detail = ipAddressDetails.get(); - builder.setIp(arrayToIpv4AddressNoZone(detail.ip)) - .setSubnet( - new PrefixLengthBuilder().setPrefixLength(Short.valueOf(detail.prefixLength)).build()); - - if (LOG.isDebugEnabled()) { - LOG.debug("Attributes for {} interface (id={}) address {} successfully read: {}", - interfaceName, interfaceIndex, id, builder.build()); - } + if (!dumpOptional.isPresent() || dumpOptional.get().ipAddressDetails.isEmpty()) { + return; + } + final Optional ipAddressDetails = + findIpAddressDetailsByIp(dumpOptional, id.firstKeyOf(Address.class).getIp()); + + if (ipAddressDetails.isPresent()) { + final IpAddressDetails detail = ipAddressDetails.get(); + builder.setIp(arrayToIpv4AddressNoZone(detail.ip)) + .setSubnet( + new PrefixLengthBuilder().setPrefixLength(Short.valueOf(detail.prefixLength)).build()); + + if (LOG.isDebugEnabled()) { + LOG.debug("Attributes for {} interface (id={}) address {} successfully read: {}", + interfaceName, interfaceIndex, id, builder.build()); } } - - } @Override diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizer.java index 3693433da..75791865e 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizer.java @@ -25,7 +25,6 @@ import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer; import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager; import io.fd.honeycomb.translate.util.read.cache.exceptions.execution.DumpExecutionFailedException; import io.fd.honeycomb.translate.v3po.interfacesstate.ip.dump.AddressDumpExecutor; -import io.fd.honeycomb.translate.v3po.interfacesstate.ip.dump.check.AddressDumpCheck; import io.fd.honeycomb.translate.v3po.interfacesstate.ip.dump.params.AddressDumpParams; import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer; import io.fd.honeycomb.translate.vpp.util.NamingContext; @@ -66,7 +65,6 @@ public class SubInterfaceIpv4AddressCustomizer extends FutureJVppCustomizer this.interfaceContext = checkNotNull(interfaceContext, "interfaceContext should not be null"); this.dumpManager = new DumpCacheManager.DumpCacheManagerBuilder() .withExecutor(new AddressDumpExecutor(futureJVppCore)) - .withNonEmptyPredicate(new AddressDumpCheck()) .build(); } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/dump/check/AddressDumpCheck.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/dump/check/AddressDumpCheck.java deleted file mode 100644 index d6ab28db0..000000000 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfacesstate/ip/dump/check/AddressDumpCheck.java +++ /dev/null @@ -1,16 +0,0 @@ -package io.fd.honeycomb.translate.v3po.interfacesstate.ip.dump.check; - -import io.fd.honeycomb.translate.util.read.cache.EntityDumpNonEmptyCheck; -import io.fd.honeycomb.translate.util.read.cache.exceptions.check.DumpCheckFailedException; -import io.fd.honeycomb.translate.util.read.cache.exceptions.check.i.DumpEmptyException; -import org.openvpp.jvpp.core.dto.IpAddressDetailsReplyDump; - -public class AddressDumpCheck implements EntityDumpNonEmptyCheck { - - @Override - public void assertNotEmpty(final IpAddressDetailsReplyDump data) throws DumpCheckFailedException { - if (data == null || data.ipAddressDetails == null) { - throw new DumpEmptyException("Invalid data dumped"); - } - } -} -- cgit 1.2.3-korg