summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate
diff options
context:
space:
mode:
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/VppInitializer.java56
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/InterconnectionWriteUtils.java31
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterconnectionReadUtils.java16
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceUtils.java26
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizer.java33
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/L2FibEntryCustomizer.java12
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java8
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizer.java22
8 files changed, 115 insertions, 89 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/VppInitializer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/VppInitializer.java
index da943f530..4cb4a92e9 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/VppInitializer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/VppInitializer.java
@@ -25,6 +25,9 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.Vpp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.fib.attributes.L2FibTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.fib.attributes.L2FibTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.fib.attributes.l2.fib.table.L2FibEntryBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.BridgeDomainsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomainBuilder;
@@ -58,22 +61,39 @@ public class VppInitializer extends AbstractDataTreeConverter<VppState, Vpp> {
}
private static final Function<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomain, BridgeDomain>
- CONVERT_BD =
- new Function<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomain, BridgeDomain>() {
- @Nullable
- @Override
- public BridgeDomain apply(
- @Nullable final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomain input) {
- final BridgeDomainBuilder builder = new BridgeDomainBuilder();
- builder.setLearn(input.isLearn());
- builder.setUnknownUnicastFlood(input.isUnknownUnicastFlood());
- builder.setArpTermination(input.isArpTermination());
- builder.setFlood(input.isFlood());
- builder.setForward(input.isForward());
- builder.setKey(new BridgeDomainKey(input.getKey().getName()));
- // bdBuilder.setL2Fib(bd.getL2Fib()); // TODO we need state=>oper converter for L2Fib
- builder.setName(input.getName());
- return builder.build();
- }
- };
+ CONVERT_BD =
+ new Function<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomain, BridgeDomain>() {
+ @Nullable
+ @Override
+ public BridgeDomain apply(
+ @Nullable final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomain input) {
+ final BridgeDomainBuilder builder = new BridgeDomainBuilder();
+ builder.setLearn(input.isLearn());
+ builder.setUnknownUnicastFlood(input.isUnknownUnicastFlood());
+ builder.setArpTermination(input.isArpTermination());
+ builder.setFlood(input.isFlood());
+ builder.setForward(input.isForward());
+ builder.setKey(new BridgeDomainKey(input.getKey().getName()));
+ builder.setName(input.getName());
+ setL2FibTable(builder, input.getL2FibTable());
+ return builder.build();
+ }
+ };
+
+ private static void setL2FibTable(@Nonnull final BridgeDomainBuilder builder,
+ @Nullable final L2FibTable l2FibTable) {
+ if (l2FibTable == null) {
+ return;
+ }
+ final L2FibTableBuilder tableBuilder = new L2FibTableBuilder();
+ tableBuilder.setL2FibEntry(
+ Lists.transform(l2FibTable.getL2FibEntry(),
+ oper -> {
+ final L2FibEntryBuilder config = new L2FibEntryBuilder(oper);
+ config.setBridgedVirtualInterface(null);
+ return config.build();
+ }));
+ builder.setL2FibTable(tableBuilder.build());
+ }
+
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/InterconnectionWriteUtils.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/InterconnectionWriteUtils.java
index b3b05500a..463acc84e 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/InterconnectionWriteUtils.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/InterconnectionWriteUtils.java
@@ -61,7 +61,7 @@ final class InterconnectionWriteUtils {
void setInterconnection(final InstanceIdentifier<? extends DataObject> id, final int swIfIndex,
final String ifcName,
final Interconnection ic, final WriteContext writeContext)
- throws WriteFailedException {
+ throws WriteFailedException {
try {
if (ic == null) { // TODO in case of update we should delete interconnection
LOG.trace("Interconnection is not set. Skipping");
@@ -78,35 +78,36 @@ final class InterconnectionWriteUtils {
throw new WriteFailedException(id, "Unable to handle Interconnection of type " + ic.getClass());
}
} catch (VppBaseCallException e) {
- LOG.warn("Failed to update bridge/xconnect based interconnection flags for: {}, interconnection: {}", ifcName, ic);
+ LOG.warn("Failed to update bridge/xconnect based interconnection flags for: {}, interconnection: {}",
+ ifcName, ic);
throw new WriteFailedException(id, "Unable to handle Interconnection of type " + ic.getClass(), e);
}
}
private void setBridgeBasedL2(final int swIfIndex, final String ifcName, final BridgeBased bb,
final WriteContext writeContext)
- throws VppBaseCallException {
+ throws VppBaseCallException {
LOG.debug("Setting bridge based interconnection(bridge-domain={}) for interface: {}", bb.getBridgeDomain(),
- ifcName);
+ ifcName);
String bdName = bb.getBridgeDomain();
int bdId = bridgeDomainContext.getIndex(bdName, writeContext.getMappingContext());
checkArgument(bdId > 0, "Unable to set Interconnection for Interface: %s, bridge domain: %s does not exist",
- ifcName, bdName);
+ ifcName, bdName);
byte bvi = bb.isBridgedVirtualInterface()
- ? (byte) 1
- : (byte) 0;
+ ? (byte) 1
+ : (byte) 0;
byte shg = 0;
if (bb.getSplitHorizonGroup() != null) {
shg = bb.getSplitHorizonGroup().byteValue();
}
final CompletionStage<SwInterfaceSetL2BridgeReply> swInterfaceSetL2BridgeReplyCompletionStage = futureJvpp
- .swInterfaceSetL2Bridge(getL2BridgeRequest(swIfIndex, bdId, shg, bvi, (byte) 1 /* enable */));
+ .swInterfaceSetL2Bridge(getL2BridgeRequest(swIfIndex, bdId, shg, bvi, (byte) 1 /* enable */));
final SwInterfaceSetL2BridgeReply reply =
- TranslateUtils.getReply(swInterfaceSetL2BridgeReplyCompletionStage.toCompletableFuture());
+ TranslateUtils.getReply(swInterfaceSetL2BridgeReplyCompletionStage.toCompletableFuture());
LOG.debug("Bridge based interconnection updated successfully for: {}, interconnection: {}", ifcName, bb);
}
@@ -124,20 +125,20 @@ final class InterconnectionWriteUtils {
private void setXconnectBasedL2(final int swIfIndex, final String ifcName, final XconnectBased ic,
final WriteContext writeContext)
- throws VppBaseCallException {
+ throws VppBaseCallException {
String outSwIfName = ic.getXconnectOutgoingInterface();
LOG.debug("Setting xconnect based interconnection(outgoing ifc={}) for interface: {}", outSwIfName, ifcName);
int outSwIfIndex = interfaceContext.getIndex(outSwIfName, writeContext.getMappingContext());
checkArgument(outSwIfIndex > 0,
- "Unable to set Interconnection for Interface: %s, outgoing interface: %s does not exist",
- ifcName, outSwIfIndex);
+ "Unable to set Interconnection for Interface: %s, outgoing interface: %s does not exist",
+ ifcName, outSwIfIndex);
final CompletionStage<SwInterfaceSetL2XconnectReply> swInterfaceSetL2XconnectReplyCompletionStage =
- futureJvpp
- .swInterfaceSetL2Xconnect(getL2XConnectRequest(swIfIndex, outSwIfIndex, (byte) 1 /* enable */));
+ futureJvpp
+ .swInterfaceSetL2Xconnect(getL2XConnectRequest(swIfIndex, outSwIfIndex, (byte) 1 /* enable */));
final SwInterfaceSetL2XconnectReply reply =
- TranslateUtils.getReply(swInterfaceSetL2XconnectReplyCompletionStage.toCompletableFuture());
+ TranslateUtils.getReply(swInterfaceSetL2XconnectReplyCompletionStage.toCompletableFuture());
LOG.debug("Xconnect based interconnection updated successfully for: {}, interconnection: {}", ifcName, ic);
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterconnectionReadUtils.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterconnectionReadUtils.java
index b60121a45..43be0d4ab 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterconnectionReadUtils.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterconnectionReadUtils.java
@@ -61,12 +61,13 @@ final class InterconnectionReadUtils {
}
@Nullable
- Interconnection readInterconnection(@Nonnull final InstanceIdentifier<?> id, @Nonnull final String ifaceName, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
+ Interconnection readInterconnection(@Nonnull final InstanceIdentifier<?> id, @Nonnull final String ifaceName,
+ @Nonnull final ReadContext ctx)
+ throws ReadFailedException {
final int ifaceId = interfaceContext.getIndex(ifaceName, ctx.getMappingContext());
final SwInterfaceDetails iface = InterfaceUtils.getVppInterfaceDetails(futureJvpp, id, ifaceName,
- ifaceId, ctx.getModificationCache());
+ ifaceId, ctx.getModificationCache());
LOG.debug("Interface details for interface: {}, details: {}", ifaceName, iface);
final BridgeDomainDetailsReplyDump dumpReply = getDumpReply(id);
@@ -78,7 +79,7 @@ final class InterconnectionReadUtils {
// Set BVI if the bridgeDomainDetails.bviSwIfIndex == current sw if index
final Optional<BridgeDomainDetails> bridgeDomainForInterface =
- getBridgeDomainForInterface(dumpReply, bdForInterface.get().bdId);
+ getBridgeDomainForInterface(dumpReply, bdForInterface.get().bdId);
// Since we already found an interface assigned to a bridge domain, the details for BD must be present
checkState(bridgeDomainForInterface.isPresent());
if (bridgeDomainForInterface.get().bviSwIfIndex == ifaceId) {
@@ -111,7 +112,8 @@ final class InterconnectionReadUtils {
return reply.bridgeDomainDetails.stream().filter(a -> a.bdId == bdId).findFirst();
}
- private BridgeDomainDetailsReplyDump getDumpReply(@Nonnull final InstanceIdentifier<?> id) throws ReadFailedException {
+ private BridgeDomainDetailsReplyDump getDumpReply(@Nonnull final InstanceIdentifier<?> id)
+ throws ReadFailedException {
try {
// We need to perform full bd dump, because there is no way
// to ask VPP for BD details given interface id/name (TODO add it to vpp.api?)
@@ -120,10 +122,10 @@ final class InterconnectionReadUtils {
request.bdId = -1;
final CompletableFuture<BridgeDomainDetailsReplyDump> bdCompletableFuture =
- futureJvpp.bridgeDomainSwIfDump(request).toCompletableFuture();
+ futureJvpp.bridgeDomainSwIfDump(request).toCompletableFuture();
return TranslateUtils.getReply(bdCompletableFuture);
} catch (VppBaseCallException e) {
- throw new ReadFailedException(id,e);
+ throw new ReadFailedException(id, e);
}
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceUtils.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceUtils.java
index 1db7b8a42..e2d3002d7 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceUtils.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceUtils.java
@@ -64,7 +64,7 @@ public final class InterfaceUtils {
private static final int PHYSICAL_ADDRESS_LENGTH = 6;
private static final Collector<SwInterfaceDetails, ?, SwInterfaceDetails> SINGLE_ITEM_COLLECTOR =
- RWUtils.singleItemCollector();
+ RWUtils.singleItemCollector();
private InterfaceUtils() {
throw new UnsupportedOperationException("This utility class cannot be instantiated");
@@ -102,6 +102,7 @@ public final class InterfaceUtils {
}
// TODO rename and move to V3poUtils
+
/**
* Reads first 6 bytes of supplied byte array and converts to string as Yang dictates <p> Replace later with
* https://git.opendaylight.org/gerrit/#/c/34869/10/model/ietf/ietf-type- util/src/main/
@@ -118,13 +119,14 @@ public final class InterfaceUtils {
public static String vppPhysAddrToYang(@Nonnull final byte[] vppPhysAddress, int startIndex) {
Objects.requireNonNull(vppPhysAddress, "Empty physical address bytes");
- final int endIndex = startIndex+PHYSICAL_ADDRESS_LENGTH;
+ final int endIndex = startIndex + PHYSICAL_ADDRESS_LENGTH;
Preconditions.checkArgument(endIndex <= vppPhysAddress.length,
- "Invalid physical address size (%s) for given startIndex (%d), expected >= %d", vppPhysAddress.length, startIndex, endIndex);
+ "Invalid physical address size (%s) for given startIndex (%d), expected >= %d", vppPhysAddress.length,
+ startIndex, endIndex);
StringBuilder physAddr = new StringBuilder();
appendHexByte(physAddr, vppPhysAddress[startIndex]);
- for (int i = startIndex+1; i < endIndex; i++) {
+ for (int i = startIndex + 1; i < endIndex; i++) {
physAddr.append(":");
appendHexByte(physAddr, vppPhysAddress[i]);
}
@@ -159,21 +161,21 @@ public final class InterfaceUtils {
* Queries VPP for interface description given interface key.
*
* @param futureJvpp VPP Java Future API
- * @param id InstanceIdentifier, which is passed in ReadFailedException
+ * @param id InstanceIdentifier, which is passed in ReadFailedException
* @param name interface name
* @param index VPP index of the interface
* @param ctx per-tx scope context containing cached dump with all the interfaces. If the cache is not
* available or outdated, another dump will be performed.
* @return SwInterfaceDetails DTO or null if interface was not found
* @throws IllegalArgumentException If interface cannot be found
- * @throws ReadFailedException If read operation had failed
+ * @throws ReadFailedException If read operation had failed
*/
@Nonnull
public static SwInterfaceDetails getVppInterfaceDetails(@Nonnull final FutureJVpp futureJvpp,
@Nonnull final InstanceIdentifier<?> id,
@Nonnull final String name, final int index,
@Nonnull final ModificationCache ctx)
- throws ReadFailedException {
+ throws ReadFailedException {
requireNonNull(futureJvpp, "futureJvpp should not be null");
requireNonNull(name, "name should not be null");
requireNonNull(ctx, "ctx should not be null");
@@ -206,7 +208,7 @@ public final class InterfaceUtils {
// Update the cache
allInterfaces.clear();
allInterfaces
- .putAll(ifaces.swInterfaceDetails.stream().collect(Collectors.toMap(d -> d.swIfIndex, d -> d)));
+ .putAll(ifaces.swInterfaceDetails.stream().collect(Collectors.toMap(d -> d.swIfIndex, d -> d)));
if (allInterfaces.containsKey(index)) {
return allInterfaces.get(index);
@@ -220,7 +222,7 @@ public final class InterfaceUtils {
// SwInterfaceDump's name filter does prefix match, so we need additional filtering:
final SwInterfaceDetails iface =
- ifaces.swInterfaceDetails.stream().filter(d -> d.swIfIndex == index).collect(SINGLE_ITEM_COLLECTOR);
+ ifaces.swInterfaceDetails.stream().filter(d -> d.swIfIndex == index).collect(SINGLE_ITEM_COLLECTOR);
allInterfaces.put(index, iface); // update the cache
return iface;
}
@@ -253,9 +255,9 @@ public final class InterfaceUtils {
}
/**
- * Check interface type. Uses interface details from VPP to determine.
- * Uses {@link #getVppInterfaceDetails(FutureJVpp, InstanceIdentifier, String, int, ModificationCache)} internally
- * so tries to utilize cache before asking VPP.
+ * Check interface type. Uses interface details from VPP to determine. Uses {@link
+ * #getVppInterfaceDetails(FutureJVpp, InstanceIdentifier, String, int, ModificationCache)} internally so tries to
+ * utilize cache before asking VPP.
*/
static boolean isInterfaceOfType(@Nonnull final FutureJVpp jvpp,
@Nonnull final ModificationCache cache,
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);
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java
index 4f0b0f741..1ef6fcec3 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java
@@ -44,7 +44,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public final class BridgeDomainCustomizer extends FutureJVppCustomizer
- implements ListReaderCustomizer<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> {
+ implements ListReaderCustomizer<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> {
private static final Logger LOG = LoggerFactory.getLogger(BridgeDomainCustomizer.class);
private final NamingContext bdContext;
@@ -57,9 +57,9 @@ public final class BridgeDomainCustomizer extends FutureJVppCustomizer
@Override
public void readCurrentAttributes(@Nonnull final InstanceIdentifier<BridgeDomain> id,
@Nonnull final BridgeDomainBuilder builder, @Nonnull final ReadContext context)
- throws ReadFailedException {
+ throws ReadFailedException {
LOG.debug("vppstate.BridgeDomainCustomizer.readCurrentAttributes: id={}, builderbuilder={}, context={}",
- id, builder, context);
+ id, builder, context);
final BridgeDomainKey key = id.firstKeyOf(id.getTargetType());
LOG.debug("vppstate.BridgeDomainCustomizer.readCurrentAttributes: key={}", key);
@@ -123,7 +123,7 @@ public final class BridgeDomainCustomizer extends FutureJVppCustomizer
throw new IllegalStateException("Bridge domain dump failed", e); // TODO ReadFailedException?
}
- if(reply == null || reply.bridgeDomainDetails == null) {
+ if (reply == null || reply.bridgeDomainDetails == null) {
return Collections.emptyList();
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizer.java
index f3393c26d..b7ff1e70d 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizer.java
@@ -55,12 +55,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public final class L2FibEntryCustomizer extends FutureJVppCustomizer
- implements ListReaderCustomizer<L2FibEntry, L2FibEntryKey, L2FibEntryBuilder> {
+ implements ListReaderCustomizer<L2FibEntry, L2FibEntryKey, L2FibEntryBuilder> {
private static final Logger LOG = LoggerFactory.getLogger(L2FibEntryCustomizer.class);
- Collector<L2FibTableEntry, ?, L2FibTableEntry> SINGLE_ITEM_COLLECTOR =
- RWUtils.singleItemCollector();
+ private static final Collector<L2FibTableEntry, ?, L2FibTableEntry> SINGLE_ITEM_COLLECTOR =
+ RWUtils.singleItemCollector();
private final NamingContext bdContext;
private final NamingContext interfaceContext;
@@ -75,7 +75,7 @@ public final class L2FibEntryCustomizer extends FutureJVppCustomizer
@Override
public void readCurrentAttributes(@Nonnull final InstanceIdentifier<L2FibEntry> id,
@Nonnull final L2FibEntryBuilder builder, @Nonnull final ReadContext ctx)
- throws ReadFailedException {
+ throws ReadFailedException {
final L2FibEntryKey key = id.firstKeyOf(id.getTargetType());
final BridgeDomainKey bridgeDomainKey = id.firstKeyOf(BridgeDomain.class);
@@ -85,12 +85,12 @@ public final class L2FibEntryCustomizer extends FutureJVppCustomizer
try {
// TODO use cached l2FibTable
final L2FibTableEntry entry = dumpL2Fibs(bdId).stream().filter(e -> key.getPhysAddress()
- .equals(new PhysAddress(vppPhysAddrToYang(Longs.toByteArray(e.mac), 2))))
- .collect(SINGLE_ITEM_COLLECTOR);
+ .equals(new PhysAddress(vppPhysAddrToYang(Longs.toByteArray(e.mac), 2))))
+ .collect(SINGLE_ITEM_COLLECTOR);
builder.setAction(byteToBoolean(entry.filterMac)
- ? L2FibFilter.class
- : L2FibForward.class);
+ ? L2FibFilter.class
+ : L2FibForward.class);
builder.setBridgedVirtualInterface(byteToBoolean(entry.bviMac));
if (entry.swIfIndex != -1) {
@@ -110,7 +110,7 @@ public final class L2FibEntryCustomizer extends FutureJVppCustomizer
l2FibRequest.bdId = bdId;
final CompletableFuture<L2FibTableEntryReplyDump> l2FibTableDumpCompletableFuture =
- getFutureJVpp().l2FibTableDump(l2FibRequest).toCompletableFuture();
+ getFutureJVpp().l2FibTableDump(l2FibRequest).toCompletableFuture();
final L2FibTableEntryReplyDump dump = TranslateUtils.getReply(l2FibTableDumpCompletableFuture);
@@ -131,8 +131,8 @@ public final class L2FibEntryCustomizer extends FutureJVppCustomizer
LOG.debug("Reading L2 FIB for bridge domain {} (bdId={})", bridgeDomainKey, bdId);
try {
return dumpL2Fibs(bdId).stream()
- .map(entry -> new L2FibEntryKey(new PhysAddress(vppPhysAddrToYang(Longs.toByteArray(entry.mac), 2)))
- ).collect(Collectors.toList());
+ .map(entry -> new L2FibEntryKey(new PhysAddress(vppPhysAddrToYang(Longs.toByteArray(entry.mac), 2)))
+ ).collect(Collectors.toList());
} catch (VppBaseCallException e) {
throw new ReadFailedException(id, e);
}