From 8014d193008a60ef3857f14d57d931973daa7cc4 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Sun, 5 Jun 2016 15:59:38 +0200 Subject: Fix CUD support for non-mandatory child nodes of list type Change-Id: Ic75221fe61a0bb35753dd6f3b4deec1b8c020974 Signed-off-by: Marek Gradzki --- .../v3po/translate/v3po/interfaces/InterfaceCustomizer.java | 5 +++-- .../v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java | 5 +++-- .../honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizer.java | 7 ++++--- 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'v3po/v3po2vpp/src') diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/InterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/InterfaceCustomizer.java index 4e81ca0f2..3a4638d90 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/InterfaceCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/InterfaceCustomizer.java @@ -16,6 +16,7 @@ package io.fd.honeycomb.v3po.translate.v3po.interfaces; +import com.google.common.base.Optional; import io.fd.honeycomb.v3po.translate.spi.write.ListWriterCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; @@ -89,9 +90,9 @@ public class InterfaceCustomizer extends FutureJVppCustomizer implements ListWri @Nonnull @Override - public List extract(@Nonnull final InstanceIdentifier currentId, + public Optional> extract(@Nonnull final InstanceIdentifier currentId, @Nonnull final DataObject parentData) { - return ((Interfaces) parentData).getInterface(); + return Optional.fromNullable(((Interfaces) parentData).getInterface()); } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java index b6c8d9a59..cb0a2c3df 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java @@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkState; import static io.fd.honeycomb.v3po.translate.v3po.util.SubInterfaceUtils.getSubInterfaceName; import static io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils.booleanToByte; +import com.google.common.base.Optional; import com.google.common.base.Preconditions; import io.fd.honeycomb.v3po.translate.spi.write.ListWriterCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; @@ -74,9 +75,9 @@ public class SubInterfaceCustomizer extends FutureJVppCustomizer @Nonnull @Override - public List extract(@Nonnull final InstanceIdentifier currentId, + public Optional> extract(@Nonnull final InstanceIdentifier currentId, @Nonnull final DataObject parentData) { - return ((SubInterfaces) parentData).getSubInterface(); + return Optional.fromNullable(((SubInterfaces) parentData).getSubInterface()); } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizer.java index 0b3545ddd..750ff575e 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizer.java @@ -19,12 +19,13 @@ package io.fd.honeycomb.v3po.translate.v3po.vpp; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; +import com.google.common.base.Optional; import com.google.common.base.Preconditions; import io.fd.honeycomb.v3po.translate.spi.write.ListWriterCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; -import io.fd.honeycomb.v3po.translate.v3po.util.VppApiInvocationException; import io.fd.honeycomb.v3po.translate.v3po.util.TranslateUtils; +import io.fd.honeycomb.v3po.translate.v3po.util.VppApiInvocationException; import io.fd.honeycomb.v3po.translate.write.WriteContext; import io.fd.honeycomb.v3po.translate.write.WriteFailedException; import java.util.List; @@ -57,9 +58,9 @@ public class BridgeDomainCustomizer @Nonnull @Override - public List extract(@Nonnull final InstanceIdentifier currentId, + public Optional> extract(@Nonnull final InstanceIdentifier currentId, @Nonnull final DataObject parentData) { - return ((BridgeDomains) parentData).getBridgeDomain(); + return Optional.fromNullable(((BridgeDomains) parentData).getBridgeDomain()); } private BridgeDomainAddDelReply addOrUpdateBridgeDomain(final int bdId, @Nonnull final BridgeDomain bd) -- cgit 1.2.3-korg