diff options
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp')
2 files changed, 23 insertions, 22 deletions
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 371e39471..710a74be5 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 @@ -43,8 +43,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class BridgeDomainCustomizer - extends FutureJVppCustomizer - implements ListWriterCustomizer<BridgeDomain, BridgeDomainKey> { + extends FutureJVppCustomizer + implements ListWriterCustomizer<BridgeDomain, BridgeDomainKey> { private static final Logger LOG = LoggerFactory.getLogger(BridgeDomainCustomizer.class); @@ -59,12 +59,12 @@ public class BridgeDomainCustomizer @Nonnull @Override public Optional<List<BridgeDomain>> extract(@Nonnull final InstanceIdentifier<BridgeDomain> currentId, - @Nonnull final DataObject parentData) { + @Nonnull final DataObject parentData) { return Optional.fromNullable(((BridgeDomains) parentData).getBridgeDomain()); } private BridgeDomainAddDelReply addOrUpdateBridgeDomain(final int bdId, @Nonnull final BridgeDomain bd) - throws VppBaseCallException { + throws VppBaseCallException { final BridgeDomainAddDelReply reply; final BridgeDomainAddDel request = new BridgeDomainAddDel(); request.bdId = bdId; @@ -84,7 +84,7 @@ public class BridgeDomainCustomizer public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<BridgeDomain> id, @Nonnull final BridgeDomain dataBefore, @Nonnull final WriteContext ctx) - throws WriteFailedException.CreateFailedException { + throws WriteFailedException.CreateFailedException { LOG.debug("writeCurrentAttributes: id={}, current={}, ctx={}", id, dataBefore, ctx); final String bdName = dataBefore.getName(); @@ -93,7 +93,7 @@ public class BridgeDomainCustomizer // (maybe in context similar to artificial name) // Here we assign the next available ID from bdContext's perspective int index = 1; - while(bdContext.containsName(index, ctx.getMappingContext())) { + while (bdContext.containsName(index, ctx.getMappingContext())) { index++; } addOrUpdateBridgeDomain(index, dataBefore); @@ -106,41 +106,42 @@ public class BridgeDomainCustomizer private byte booleanToByte(@Nullable final Boolean aBoolean) { return aBoolean != null && aBoolean - ? (byte) 1 - : (byte) 0; + ? (byte) 1 + : (byte) 0; } @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<BridgeDomain> id, @Nonnull final BridgeDomain dataBefore, - @Nonnull final WriteContext ctx) throws WriteFailedException.DeleteFailedException { + @Nonnull final WriteContext ctx) + throws WriteFailedException.DeleteFailedException { LOG.debug("deleteCurrentAttributes: id={}, dataBefore={}, ctx={}", id, dataBefore, ctx); final String bdName = id.firstKeyOf(BridgeDomain.class).getName(); - int bdId = bdId = bdContext.getIndex(bdName, ctx.getMappingContext()); + int bdId = bdContext.getIndex(bdName, ctx.getMappingContext()); try { final BridgeDomainAddDel request = new BridgeDomainAddDel(); request.bdId = bdId; - final BridgeDomainAddDelReply reply = - TranslateUtils.getReply(getFutureJVpp().bridgeDomainAddDel(request).toCompletableFuture()); + TranslateUtils.getReply(getFutureJVpp().bridgeDomainAddDel(request).toCompletableFuture()); LOG.debug("Bridge domain {} (id={}) deleted successfully", bdName, bdId); } catch (VppBaseCallException e) { LOG.warn("Bridge domain {} (id={}) delete failed", bdName, bdId); - throw new WriteFailedException.DeleteFailedException(id,e); + throw new WriteFailedException.DeleteFailedException(id, e); } } @Override public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<BridgeDomain> id, @Nonnull final BridgeDomain dataBefore, @Nonnull final BridgeDomain dataAfter, - @Nonnull final WriteContext ctx) throws WriteFailedException.UpdateFailedException { + @Nonnull final WriteContext ctx) + throws WriteFailedException.UpdateFailedException { LOG.debug("updateCurrentAttributes: id={}, dataBefore={}, dataAfter={}, ctx={}", id, dataBefore, dataAfter, - ctx); + ctx); final String bdName = checkNotNull(dataAfter.getName()); checkArgument(bdName.equals(dataBefore.getName()), - "BridgeDomain name changed. It should be deleted and then created."); + "BridgeDomain name changed. It should be deleted and then created."); try { addOrUpdateBridgeDomain(bdContext.getIndex(bdName, ctx.getMappingContext()), dataAfter); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/L2FibEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/L2FibEntryCustomizer.java index 712938190..b4a51b01a 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/L2FibEntryCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/L2FibEntryCustomizer.java @@ -51,7 +51,7 @@ import org.slf4j.LoggerFactory; * VPP.<br> Equivalent of invoking {@code vppctl l2fib add/del} command. */ public class L2FibEntryCustomizer extends FutureJVppCustomizer - implements ListWriterCustomizer<L2FibEntry, L2FibEntryKey> { + implements ListWriterCustomizer<L2FibEntry, L2FibEntryKey> { private static final Logger LOG = LoggerFactory.getLogger(L2FibEntryCustomizer.class); @@ -75,7 +75,7 @@ public class L2FibEntryCustomizer extends FutureJVppCustomizer @Override public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<L2FibEntry> id, @Nonnull final L2FibEntry dataAfter, @Nonnull final WriteContext writeContext) - throws WriteFailedException.CreateFailedException { + throws WriteFailedException.CreateFailedException { try { LOG.debug("Creating L2 FIB entry: {} {}", id, dataAfter); l2FibAddDel(id, dataAfter, writeContext, true); @@ -91,13 +91,13 @@ public class L2FibEntryCustomizer extends FutureJVppCustomizer @Nonnull final L2FibEntry dataBefore, @Nonnull final L2FibEntry dataAfter, @Nonnull final WriteContext writeContext) throws WriteFailedException { throw new UnsupportedOperationException( - "L2 FIB entry update is not supported. It has to be deleted and then created."); + "L2 FIB entry update is not supported. It has to be deleted and then created."); } @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<L2FibEntry> id, @Nonnull final L2FibEntry dataBefore, @Nonnull final WriteContext writeContext) - throws WriteFailedException.DeleteFailedException { + throws WriteFailedException.DeleteFailedException { try { LOG.debug("Deleting L2 FIB entry: {} {}", id, dataBefore); l2FibAddDel(id, dataBefore, writeContext, false); @@ -122,7 +122,7 @@ public class L2FibEntryCustomizer extends FutureJVppCustomizer final L2FibAddDel l2FibRequest = createL2FibRequest(entry, bdId, swIfIndex, isAdd); LOG.debug("Sending l2FibAddDel request: {}", ReflectionToStringBuilder.toString(l2FibRequest)); final CompletionStage<L2FibAddDelReply> l2FibAddDelReplyCompletionStage = - getFutureJVpp().l2FibAddDel(l2FibRequest); + getFutureJVpp().l2FibAddDel(l2FibRequest); TranslateUtils.getReply(l2FibAddDelReplyCompletionStage.toCompletableFuture()); } @@ -145,6 +145,6 @@ public class L2FibEntryCustomizer extends FutureJVppCustomizer private static long macToLong(final String macAddress) { final byte[] mac = parseMac(macAddress); return Longs.fromBytes(mac[0], mac[1], mac[2], mac[3], - mac[4], mac[5], (byte) 0, (byte) 0); + mac[4], mac[5], (byte) 0, (byte) 0); } } |