diff options
author | Jan Srnicek <jsrnicek@cisco.com> | 2016-09-28 14:42:39 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2016-09-28 13:02:01 +0000 |
commit | a5a20bd12ecd1c094555fe601a9c9b464776b232 (patch) | |
tree | ed2c5e44c90f5842f2c6222543c19e2df1252587 /v3po/v3po2vpp | |
parent | 9ced9dcdc725f8d892e3c1f9be81ff345a91a061 (diff) |
HONEYCOMB-210 - DumpEmptyCheck removed
Change-Id: I95ea94c3a1a581753f7eb667af7aacde832c21fd
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp')
3 files changed, 15 insertions, 36 deletions
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<IpAddressDetailsReplyDump, AddressDumpParams>() .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> 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> 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<IpAddressDetailsReplyDump, AddressDumpParams>() .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<IpAddressDetailsReplyDump> { - - @Override - public void assertNotEmpty(final IpAddressDetailsReplyDump data) throws DumpCheckFailedException { - if (data == null || data.ipAddressDetails == null) { - throw new DumpEmptyException("Invalid data dumped"); - } - } -} |