From a7147d16c31d9028c6b5dc557264433de0f11c91 Mon Sep 17 00:00:00 2001 From: Jan Srnicek Date: Fri, 23 Sep 2016 16:39:09 +0200 Subject: HONEYCOMB-145 - Utility Class Refactoring problematic mockito-all changed to mockito-core( https://github.com/mockito/mockito/issues/324) Translate Utils Splitted to multiple Trait Interfaces Ipv4Translator - Logic for translation of ipv4-based data Ipv6Translator - Logic for translation of ipv6-based data MacTranslator - Logic for translation of mac-based data AddressTranslator - Aggregation trait for Ipv4/Ipv6/Mac JvppReplyConsumer - Logic for extracting replies from jvpp calls ByteDataTranslator - any byte-based conversions Plus some existing utility classes changed to traits Change-Id: I342b625954223966802e65dca0fabf8456c89345 Signed-off-by: Jan Srnicek --- .../translate/v3po/interfaces/RoutingCustomizer.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizer.java') diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizer.java index 51bf31d07..44fd8807c 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizer.java @@ -16,13 +16,13 @@ package io.fd.honeycomb.translate.v3po.interfaces; +import io.fd.honeycomb.translate.spi.write.WriterCustomizer; import io.fd.honeycomb.translate.v3po.util.FutureJVppCustomizer; +import io.fd.honeycomb.translate.v3po.util.JvppReplyConsumer; import io.fd.honeycomb.translate.v3po.util.NamingContext; import io.fd.honeycomb.translate.v3po.util.WriteTimeoutException; import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.write.WriteFailedException; -import io.fd.honeycomb.translate.spi.write.WriterCustomizer; -import io.fd.honeycomb.translate.v3po.util.TranslateUtils; import java.util.concurrent.CompletionStage; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; @@ -35,7 +35,7 @@ import org.openvpp.jvpp.core.future.FutureJVppCore; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class RoutingCustomizer extends FutureJVppCustomizer implements WriterCustomizer { +public class RoutingCustomizer extends FutureJVppCustomizer implements WriterCustomizer, JvppReplyConsumer { private static final Logger LOG = LoggerFactory.getLogger(RoutingCustomizer.class); private final NamingContext interfaceContext; @@ -48,7 +48,7 @@ public class RoutingCustomizer extends FutureJVppCustomizer implements WriterCus @Override public void writeCurrentAttributes(@Nonnull final InstanceIdentifier id, @Nonnull final Routing dataAfter, @Nonnull final WriteContext writeContext) - throws WriteFailedException { + throws WriteFailedException { final String ifName = id.firstKeyOf(Interface.class).getName(); try { @@ -63,7 +63,7 @@ public class RoutingCustomizer extends FutureJVppCustomizer implements WriterCus public void updateCurrentAttributes(@Nonnull final InstanceIdentifier id, @Nonnull final Routing dataBefore, @Nonnull final Routing dataAfter, @Nonnull final WriteContext writeContext) - throws WriteFailedException { + throws WriteFailedException { final String ifName = id.firstKeyOf(Interface.class).getName(); try { @@ -86,13 +86,14 @@ public class RoutingCustomizer extends FutureJVppCustomizer implements WriterCus LOG.debug("Setting routing for interface: {}, {}. Routing: {}", name, swIfc, rt); int vrfId = (rt != null) - ? rt.getVrfId().intValue() - : 0; + ? rt.getVrfId().intValue() + : 0; if (vrfId != 0) { final CompletionStage swInterfaceSetTableReplyCompletionStage = - getFutureJVpp().swInterfaceSetTable(getInterfaceSetTableRequest(swIfc, (byte) 0, /* isIpv6 */ vrfId)); - TranslateUtils.getReplyForWrite(swInterfaceSetTableReplyCompletionStage.toCompletableFuture(), id); + getFutureJVpp() + .swInterfaceSetTable(getInterfaceSetTableRequest(swIfc, (byte) 0, /* isIpv6 */ vrfId)); + getReplyForWrite(swInterfaceSetTableReplyCompletionStage.toCompletableFuture(), id); LOG.debug("Routing set successfully for interface: {}, {}, routing: {}", name, swIfc, rt); } } -- cgit 1.2.3-korg