summaryrefslogtreecommitdiffstats
path: root/v3po
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-06-13 14:58:50 +0200
committerMaros Marsalek <mmarsale@cisco.com>2016-06-15 10:32:09 +0000
commit48616592e8fb84332bff5e6302043a0505dc629b (patch)
treed316a2cf4bca3ce4a210d66118dd7b2776a16121 /v3po
parentbbf5b67cad0e7b513cc2060fa721e385f80c2ad5 (diff)
HONEYCOMB-91: initializer for L2 FIB tables
Change-Id: I7f133ea56fc3bb11e0f4b584839dabc0754a8d50 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po')
-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
-rw-r--r--v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModule.java25
-rw-r--r--v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppStateHoneycombReaderModule.java28
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/L2CustomizerTest.java8
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/test/ContextTestUtils.java17
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizerTest.java46
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/L2FibEntryCustomizerTest.java8
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizerTest.java4
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizerTest.java4
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTest.java44
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTestUtils.java24
-rw-r--r--v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java30
19 files changed, 250 insertions, 192 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);
}
diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModule.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModule.java
index fbd7cd597..6bf3da104 100644
--- a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModule.java
+++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModule.java
@@ -21,12 +21,17 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomainKey;
import org.opendaylight.yangtools.yang.binding.ChildOf;
-public class VppHoneycombWriterModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractVppHoneycombWriterModule {
- public VppHoneycombWriterModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+public class VppHoneycombWriterModule extends
+ org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractVppHoneycombWriterModule {
+ public VppHoneycombWriterModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+ org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
}
- public VppHoneycombWriterModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.VppHoneycombWriterModule oldModule, java.lang.AutoCloseable oldInstance) {
+ public VppHoneycombWriterModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+ org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+ org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.VppHoneycombWriterModule oldModule,
+ java.lang.AutoCloseable oldInstance) {
super(identifier, dependencyResolver, oldModule, oldInstance);
}
@@ -39,7 +44,7 @@ public class VppHoneycombWriterModule extends org.opendaylight.yang.gen.v1.urn.h
public java.lang.AutoCloseable createInstance() {
final CompositeListWriter<BridgeDomain, BridgeDomainKey> bridgeDomainWriter = new CompositeListWriter<>(
BridgeDomain.class,
- RWUtils.singletonChildWriterList(l2FibTableWriter()),
+ RWUtils.singletonChildWriterList(l2FibTableWriter()),
new BridgeDomainCustomizer(getVppJvppWriterDependency(), getBridgeDomainContextVppDependency()));
final ChildWriter<BridgeDomains> bridgeDomainsWriter = new CompositeChildWriter<>(
@@ -57,18 +62,18 @@ public class VppHoneycombWriterModule extends org.opendaylight.yang.gen.v1.urn.h
}
private ChildWriter l2FibTableWriter() {
- final CompositeListWriter<L2FibEntry, L2FibEntryKey> l2FibEntryWriter = new CompositeListWriter<>(L2FibEntry.class,
+ final CompositeListWriter<L2FibEntry, L2FibEntryKey> l2FibEntryWriter =
+ new CompositeListWriter<>(L2FibEntry.class,
new L2FibEntryCustomizer(getVppJvppWriterDependency(),
- getBridgeDomainContextVppDependency(), getInterfaceContextVppDependency()));
+ getBridgeDomainContextVppDependency(), getInterfaceContextVppDependency()));
final ChildWriter<L2FibTable> l2FibTableWriter = new CompositeChildWriter<>(
- L2FibTable.class,
- RWUtils.singletonChildWriterList(l2FibEntryWriter),
- new ReflexiveChildWriterCustomizer<>());
+ L2FibTable.class,
+ RWUtils.singletonChildWriterList(l2FibEntryWriter),
+ new ReflexiveChildWriterCustomizer<>());
return l2FibTableWriter;
}
-
}
diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppStateHoneycombReaderModule.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppStateHoneycombReaderModule.java
index f56c824a6..abbde23ab 100644
--- a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppStateHoneycombReaderModule.java
+++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppStateHoneycombReaderModule.java
@@ -43,15 +43,20 @@ import org.openvpp.jvpp.future.FutureJVpp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class VppStateHoneycombReaderModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractVppStateHoneycombReaderModule {
+public class VppStateHoneycombReaderModule extends
+ org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractVppStateHoneycombReaderModule {
private static final Logger LOG = LoggerFactory.getLogger(VppStateHoneycombReaderModule.class);
- public VppStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ public VppStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+ org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
}
- public VppStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.VppStateHoneycombReaderModule oldModule, java.lang.AutoCloseable oldInstance) {
+ public VppStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+ org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+ org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.VppStateHoneycombReaderModule oldModule,
+ java.lang.AutoCloseable oldInstance) {
super(identifier, dependencyResolver, oldModule, oldInstance);
}
@@ -72,20 +77,21 @@ public class VppStateHoneycombReaderModule extends org.opendaylight.yang.gen.v1.
versionReader = new KeepaliveReaderWrapper<>(versionReader, getKeepaliveExecutorDependency().getExecutor(),
ReadTimeoutException.class, 30, () -> reinitializeJVpp(reinitializationCounter));
- final CompositeListReader<L2FibEntry, L2FibEntryKey, L2FibEntryBuilder> l2FibEntryReader = new CompositeListReader<>(L2FibEntry.class,
+ final CompositeListReader<L2FibEntry, L2FibEntryKey, L2FibEntryBuilder> l2FibEntryReader =
+ new CompositeListReader<>(L2FibEntry.class,
new L2FibEntryCustomizer(vppApi,
- getBridgeDomainContextVppStateDependency(), getInterfaceContextVppStateDependency()));
+ getBridgeDomainContextVppStateDependency(), getInterfaceContextVppStateDependency()));
final ChildReader<L2FibTable> l2FibTableReader = new CompositeChildReader<>(
- L2FibTable.class,
- RWUtils.singletonChildReaderList(l2FibEntryReader),
- new ReflexiveChildReaderCustomizer<>(L2FibTableBuilder.class));
+ L2FibTable.class,
+ RWUtils.singletonChildReaderList(l2FibEntryReader),
+ new ReflexiveChildReaderCustomizer<>(L2FibTableBuilder.class));
final CompositeListReader<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> bridgeDomainReader =
new CompositeListReader<>(BridgeDomain.class,
- RWUtils.singletonChildReaderList((ChildReader)l2FibTableReader),
- new BridgeDomainCustomizer(vppApi,
- getBridgeDomainContextVppStateDependency()));
+ RWUtils.singletonChildReaderList((ChildReader) l2FibTableReader),
+ new BridgeDomainCustomizer(vppApi,
+ getBridgeDomainContextVppStateDependency()));
final ChildReader<BridgeDomains> bridgeDomainsReader = new CompositeChildReader<>(
BridgeDomains.class,
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/L2CustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/L2CustomizerTest.java
index 7baa028d8..b6309d86b 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/L2CustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/L2CustomizerTest.java
@@ -88,13 +88,13 @@ public class L2CustomizerTest extends ChildReaderCustomizerTest<L2, L2Builder> {
private InstanceIdentifier<L2> getL2Id(final String name) {
return InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(name))
- .augmentation(
- VppInterfaceStateAugmentation.class).child(L2.class);
+ .augmentation(
+ VppInterfaceStateAugmentation.class).child(L2.class);
}
private void whenBridgeDomainSwIfDumpThenReturn(final List<BridgeDomainSwIfDetails> bdSwIfList,
final List<BridgeDomainDetails> bridgeDomainDetailses)
- throws ExecutionException, InterruptedException, VppInvocationException {
+ throws ExecutionException, InterruptedException, VppInvocationException {
final BridgeDomainDetailsReplyDump reply = new BridgeDomainDetailsReplyDump();
reply.bridgeDomainSwIfDetails = bdSwIfList;
reply.bridgeDomainDetails = bridgeDomainDetailses;
@@ -117,7 +117,7 @@ public class L2CustomizerTest extends ChildReaderCustomizerTest<L2, L2Builder> {
final BridgeBasedBuilder bbBuilder = new BridgeBasedBuilder();
bbBuilder.setBridgeDomain(bdName);
bbBuilder.setSplitHorizonGroup((short) 1);
- if(bvi != null) {
+ if (bvi != null) {
bbBuilder.setBridgedVirtualInterface(bvi);
} else {
bbBuilder.setBridgedVirtualInterface(false); // false is default
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/test/ContextTestUtils.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/test/ContextTestUtils.java
index 5828da850..7e916eaf4 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/test/ContextTestUtils.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/test/ContextTestUtils.java
@@ -38,20 +38,23 @@ public class ContextTestUtils {
return Optional.of(new MappingBuilder().setName(name).setIndex(index).build());
}
- public static KeyedInstanceIdentifier<Mapping, MappingKey> getMappingIid(final String name, final String namingContextName) {
+ public static KeyedInstanceIdentifier<Mapping, MappingKey> getMappingIid(final String name,
+ final String namingContextName) {
return InstanceIdentifier.create(Contexts.class).child(
- org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.NamingContext.class,
- new NamingContextKey(namingContextName)).child(Mappings.class).child(Mapping.class, new MappingKey(name));
+ org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.NamingContext.class,
+ new NamingContextKey(namingContextName)).child(Mappings.class).child(Mapping.class, new MappingKey(name));
}
- public static void mockMapping(final MappingContext mappingContext, final String name, final int id, final String namingContextName) {
- final InstanceIdentifier<Mappings> mappingsIid = getMappingIid(name, namingContextName).firstIdentifierOf(Mappings.class);
+ public static void mockMapping(final MappingContext mappingContext, final String name, final int id,
+ final String namingContextName) {
+ final InstanceIdentifier<Mappings> mappingsIid =
+ getMappingIid(name, namingContextName).firstIdentifierOf(Mappings.class);
final Optional<Mapping> singleMapping = getMapping(name, id);
final Optional<Mappings> previousMappings = mappingContext.read(mappingsIid);
final MappingsBuilder mappingsBuilder;
- if(previousMappings != null && previousMappings.isPresent()) {
+ if (previousMappings != null && previousMappings.isPresent()) {
mappingsBuilder = new MappingsBuilder(previousMappings.get());
} else {
mappingsBuilder = new MappingsBuilder();
@@ -61,7 +64,7 @@ public class ContextTestUtils {
final List<Mapping> mappingList = mappingsBuilder.getMapping();
mappingList.add(singleMapping.get());
doReturn(Optional.of(mappingsBuilder.setMapping(mappingList).build()))
- .when(mappingContext).read(mappingsIid);
+ .when(mappingContext).read(mappingsIid);
doReturn(singleMapping).when(mappingContext).read(getMappingIid(name, namingContextName));
}
}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizerTest.java
index 50311a945..ff9c0cf9b 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizerTest.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package io.fd.honeycomb.v3po.translate.v3po.vpp;
import static io.fd.honeycomb.v3po.translate.v3po.test.ContextTestUtils.getMapping;
@@ -87,17 +88,17 @@ public class BridgeDomainCustomizerTest {
private BridgeDomain generateBridgeDomain(final String bdName, final int arpTerm, final int flood,
final int forward, final int learn, final int uuf) {
return new BridgeDomainBuilder()
- .setName(bdName)
- .setArpTermination(BridgeDomainTestUtils.intToBoolean(arpTerm))
- .setFlood(BridgeDomainTestUtils.intToBoolean(flood))
- .setForward(BridgeDomainTestUtils.intToBoolean(forward))
- .setLearn(BridgeDomainTestUtils.intToBoolean(learn))
- .setUnknownUnicastFlood(BridgeDomainTestUtils.intToBoolean(uuf))
- .build();
+ .setName(bdName)
+ .setArpTermination(BridgeDomainTestUtils.intToBoolean(arpTerm))
+ .setFlood(BridgeDomainTestUtils.intToBoolean(flood))
+ .setForward(BridgeDomainTestUtils.intToBoolean(forward))
+ .setLearn(BridgeDomainTestUtils.intToBoolean(learn))
+ .setUnknownUnicastFlood(BridgeDomainTestUtils.intToBoolean(uuf))
+ .build();
}
private void verifyBridgeDomainAddOrUpdateWasInvoked(final BridgeDomain bd, final int bdId)
- throws VppInvocationException {
+ throws VppInvocationException {
final byte arpTerm = BridgeDomainTestUtils.booleanToByte(bd.isArpTermination());
final byte flood = BridgeDomainTestUtils.booleanToByte(bd.isFlood());
final byte forward = BridgeDomainTestUtils.booleanToByte(bd.isForward());
@@ -131,7 +132,7 @@ public class BridgeDomainCustomizerTest {
}
private void whenBridgeDomainAddDelThenSuccess()
- throws ExecutionException, InterruptedException, VppInvocationException {
+ throws ExecutionException, InterruptedException, VppInvocationException {
final CompletionStage<BridgeDomainAddDelReply> replyCS = mock(CompletionStage.class);
final CompletableFuture<BridgeDomainAddDelReply> replyFuture = mock(CompletableFuture.class);
when(replyCS.toCompletableFuture()).thenReturn(replyFuture);
@@ -141,9 +142,9 @@ public class BridgeDomainCustomizerTest {
}
private void whenBridgeDomainAddDelThenFailure()
- throws ExecutionException, InterruptedException, VppInvocationException {
+ throws ExecutionException, InterruptedException, VppInvocationException {
doReturn(TestHelperUtils.<BridgeDomainAddDelReply>createFutureException()).when(api)
- .bridgeDomainAddDel(any(BridgeDomainAddDel.class));
+ .bridgeDomainAddDel(any(BridgeDomainAddDel.class));
}
@Test
@@ -152,7 +153,7 @@ public class BridgeDomainCustomizerTest {
final String bdName = "bd1";
final BridgeDomain bd = generateBridgeDomain(bdName);
doReturn(Optional.absent()).when(mappingContext)
- .read(getMappingIid(bdName, "test-instance").firstIdentifierOf(Mappings.class));
+ .read(getMappingIid(bdName, "test-instance").firstIdentifierOf(Mappings.class));
whenBridgeDomainAddDelThenSuccess();
@@ -170,7 +171,7 @@ public class BridgeDomainCustomizerTest {
// Returning no Mappings for "test-instance" makes bdContext.containsName() return false
doReturn(Optional.absent()).when(mappingContext)
- .read(getMappingIid(bdName, "test-instance").firstIdentifierOf(Mappings.class));
+ .read(getMappingIid(bdName, "test-instance").firstIdentifierOf(Mappings.class));
whenBridgeDomainAddDelThenFailure();
@@ -244,16 +245,15 @@ public class BridgeDomainCustomizerTest {
final byte uufBefore = 0;
final BridgeDomain dataBefore =
- generateBridgeDomain(bdName, arpTermBefore, floodBefore, forwardBefore, learnBefore, uufBefore);
+ generateBridgeDomain(bdName, arpTermBefore, floodBefore, forwardBefore, learnBefore, uufBefore);
final BridgeDomain dataAfter =
- generateBridgeDomain(bdName, arpTermBefore ^ 1, floodBefore ^ 1, forwardBefore ^ 1, learnBefore ^ 1,
- uufBefore ^ 1);
+ generateBridgeDomain(bdName, arpTermBefore ^ 1, floodBefore ^ 1, forwardBefore ^ 1, learnBefore ^ 1,
+ uufBefore ^ 1);
whenBridgeDomainAddDelThenSuccess();
customizer
- .updateCurrentAttributes(BridgeDomainTestUtils.bdIdentifierForName(bdName), dataBefore, dataAfter, ctx);
-
+ .updateCurrentAttributes(BridgeDomainTestUtils.bdIdentifierForName(bdName), dataBefore, dataAfter, ctx);
verifyBridgeDomainAddOrUpdateWasInvoked(dataAfter, bdId);
}
@@ -266,7 +266,7 @@ public class BridgeDomainCustomizerTest {
try {
customizer
- .updateCurrentAttributes(BridgeDomainTestUtils.bdIdentifierForName(bdName), bdBefore, bdAfter, ctx);
+ .updateCurrentAttributes(BridgeDomainTestUtils.bdIdentifierForName(bdName), bdBefore, bdAfter, ctx);
} catch (IllegalArgumentException e) {
verify(api, never()).bridgeDomainAddDel(any(BridgeDomainAddDel.class));
return;
@@ -278,16 +278,16 @@ public class BridgeDomainCustomizerTest {
public void testUpdateBridgeDomainFailed() throws Exception {
final int bdId = 1;
final String bdName = "bd1";
- final BridgeDomain bdBefore = generateBridgeDomain(bdName, 0, 1, 0 ,1, 0);
- final BridgeDomain bdAfter = generateBridgeDomain(bdName, 1, 1, 0 ,1, 0);
+ final BridgeDomain bdBefore = generateBridgeDomain(bdName, 0, 1, 0, 1, 0);
+ final BridgeDomain bdAfter = generateBridgeDomain(bdName, 1, 1, 0, 1, 0);
doReturn(getMapping(bdName, bdId)).when(mappingContext).read(getMappingIid(bdName, "test-instance"));
whenBridgeDomainAddDelThenFailure();
try {
customizer
- .updateCurrentAttributes(BridgeDomainTestUtils.bdIdentifierForName(bdName), bdBefore, bdAfter, ctx);
- } catch (WriteFailedException.UpdateFailedException e) {
+ .updateCurrentAttributes(BridgeDomainTestUtils.bdIdentifierForName(bdName), bdBefore, bdAfter, ctx);
+ } catch (WriteFailedException.UpdateFailedException e) {
verifyBridgeDomainAddOrUpdateWasInvoked(bdAfter, bdId);
return;
}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/L2FibEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/L2FibEntryCustomizerTest.java
index 343794073..fb41b91c7 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/L2FibEntryCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/L2FibEntryCustomizerTest.java
@@ -86,7 +86,7 @@ public class L2FibEntryCustomizerTest {
private static InstanceIdentifier<L2FibEntry> getL2FibEntryId(final PhysAddress address) {
return InstanceIdentifier.create(BridgeDomains.class).child(BridgeDomain.class, new BridgeDomainKey(BD_NAME))
- .child(L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(address));
+ .child(L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(address));
}
private void whenL2FibAddDelThenSuccess() {
@@ -98,7 +98,7 @@ public class L2FibEntryCustomizerTest {
private void whenL2FibAddDelThenFailure() {
doReturn(TestHelperUtils.<L2InterfaceVlanTagRewriteReply>createFutureException()).when(api)
- .l2FibAddDel(any(L2FibAddDel.class));
+ .l2FibAddDel(any(L2FibAddDel.class));
}
private L2FibAddDel generateL2FibAddDelRequest(final long mac, final byte isAdd) {
@@ -126,7 +126,7 @@ public class L2FibEntryCustomizerTest {
}
private void verifyL2FibAddDelWasInvoked(final L2FibAddDel expected) throws
- VppInvocationException {
+ VppInvocationException {
ArgumentCaptor<L2FibAddDel> argumentCaptor = ArgumentCaptor.forClass(L2FibAddDel.class);
verify(api).l2FibAddDel(argumentCaptor.capture());
final L2FibAddDel actual = argumentCaptor.getValue();
@@ -180,7 +180,7 @@ public class L2FibEntryCustomizerTest {
@Test(expected = UnsupportedOperationException.class)
public void testUpdate() throws Exception {
customizer.updateCurrentAttributes(InstanceIdentifier.create(L2FibEntry.class), mock(L2FibEntry.class),
- mock(L2FibEntry.class), writeContext);
+ mock(L2FibEntry.class), writeContext);
}
@Test
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizerTest.java
index 80403eb58..7639f4849 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizerTest.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package io.fd.honeycomb.v3po.translate.v3po.vppstate;
import static org.mockito.Mockito.mock;
@@ -29,7 +30,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomainBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomainKey;
-public class BridgeDomainCustomizerTest extends ListReaderCustomizerTest<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> {
+public class BridgeDomainCustomizerTest
+ extends ListReaderCustomizerTest<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> {
private NamingContext bdContext;
private NamingContext interfacesContext;
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizerTest.java
index 4808b6d88..1f668b817 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizerTest.java
@@ -83,11 +83,11 @@ public class L2FibEntryCustomizerTest extends ListReaderCustomizerTest<L2FibEntr
private static InstanceIdentifier<L2FibEntry> getL2FibEntryId(final String bdName, final PhysAddress address) {
return InstanceIdentifier.create(BridgeDomains.class).child(BridgeDomain.class, new BridgeDomainKey(bdName))
- .child(L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(address));
+ .child(L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(address));
}
private void whenL2FibTableDumpThenReturn(final List<L2FibTableEntry> l2FibTableEntryList)
- throws ExecutionException, InterruptedException, VppInvocationException {
+ throws ExecutionException, InterruptedException, VppInvocationException {
final L2FibTableEntryReplyDump reply = new L2FibTableEntryReplyDump();
reply.l2FibTableEntry = l2FibTableEntryList;
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTest.java
index 8b11769d6..782924490 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTest.java
@@ -99,19 +99,21 @@ public class VppStateTest {
bdContext = new NamingContext("generatedBdName", "bd-test-instance");
interfaceContext = new NamingContext("generatedIfaceName", "ifc-test-instance");
vppStateReader = VppStateTestUtils.getVppStateReader(api, bdContext);
- readerRegistry = new DelegatingReaderRegistry(Collections.<Reader<? extends DataObject>>singletonList(vppStateReader));
+ readerRegistry =
+ new DelegatingReaderRegistry(Collections.<Reader<? extends DataObject>>singletonList(vppStateReader));
}
private static Version getVersion() {
return new VersionBuilder()
- .setName("test")
- .setBuildDirectory("1")
- .setBranch("2")
- .setBuildDate("3")
- .build();
+ .setName("test")
+ .setBuildDirectory("1")
+ .setBranch("2")
+ .setBuildDate("3")
+ .build();
}
- private void whenShowVersionThenReturn(int retval, Version version) throws ExecutionException, InterruptedException, VppInvocationException {
+ private void whenShowVersionThenReturn(int retval, Version version)
+ throws ExecutionException, InterruptedException, VppInvocationException {
final CompletableFuture<ShowVersionReply> replyFuture = new CompletableFuture<>();
final ShowVersionReply reply = new ShowVersionReply();
reply.buildDate = version.getBuildDate().getBytes();
@@ -123,7 +125,8 @@ public class VppStateTest {
when(api.showVersion(any(ShowVersion.class))).thenReturn(replyFuture);
}
- private void whenL2FibTableDumpThenReturn(final List<L2FibTableEntry> entryList) throws ExecutionException, InterruptedException, VppInvocationException {
+ private void whenL2FibTableDumpThenReturn(final List<L2FibTableEntry> entryList)
+ throws ExecutionException, InterruptedException, VppInvocationException {
final CompletionStage<L2FibTableEntryReplyDump> replyCS = mock(CompletionStage.class);
final CompletableFuture<L2FibTableEntryReplyDump> replyFuture = mock(CompletableFuture.class);
when(replyCS.toCompletableFuture()).thenReturn(replyFuture);
@@ -133,7 +136,8 @@ public class VppStateTest {
when(api.l2FibTableDump(any(L2FibTableDump.class))).thenReturn(replyCS);
}
- private void whenBridgeDomainDumpThenReturn(final List<BridgeDomainDetails> bdList) throws ExecutionException, InterruptedException, VppInvocationException {
+ private void whenBridgeDomainDumpThenReturn(final List<BridgeDomainDetails> bdList)
+ throws ExecutionException, InterruptedException, VppInvocationException {
final CompletionStage<BridgeDomainDetailsReplyDump> replyCS = mock(CompletionStage.class);
final CompletableFuture<BridgeDomainDetailsReplyDump> replyFuture = mock(CompletableFuture.class);
when(replyCS.toCompletableFuture()).thenReturn(replyFuture);
@@ -142,7 +146,7 @@ public class VppStateTest {
when(replyFuture.get()).thenReturn(reply);
doAnswer(invocation -> {
- BridgeDomainDump request = (BridgeDomainDump)invocation.getArguments()[0];
+ BridgeDomainDump request = (BridgeDomainDump) invocation.getArguments()[0];
if (request.bdId == -1) {
reply.bridgeDomainDetails = bdList;
} else {
@@ -167,9 +171,11 @@ public class VppStateTest {
whenBridgeDomainDumpThenReturn(bdList);
- final Multimap<InstanceIdentifier<? extends DataObject>, ? extends DataObject> dataObjects = readerRegistry.readAll(ctx);
+ final Multimap<InstanceIdentifier<? extends DataObject>, ? extends DataObject> dataObjects =
+ readerRegistry.readAll(ctx);
assertEquals(dataObjects.size(), 1);
- final VppState dataObject = (VppState)Iterables.getOnlyElement(dataObjects.get(Iterables.getOnlyElement(dataObjects.keySet())));
+ final VppState dataObject =
+ (VppState) Iterables.getOnlyElement(dataObjects.get(Iterables.getOnlyElement(dataObjects.keySet())));
assertEquals(version, dataObject.getVersion());
assertEquals(2, dataObject.getBridgeDomains().getBridgeDomain().size());
}
@@ -221,15 +227,19 @@ public class VppStateTest {
whenL2FibTableDumpThenReturn(Collections.singletonList(l2FibEntry));
// Deep child without a dedicated reader with specific l2fib key
- final InstanceIdentifier<? extends DataObject> idExisting = InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child(
- BridgeDomain.class, new BridgeDomainKey("bdn1")).child(L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(new PhysAddress("01:02:03:04:05:06")));
+ final InstanceIdentifier<? extends DataObject> idExisting =
+ InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child(
+ BridgeDomain.class, new BridgeDomainKey("bdn1")).child(L2FibTable.class)
+ .child(L2FibEntry.class, new L2FibEntryKey(new PhysAddress("01:02:03:04:05:06")));
Optional<? extends DataObject> read =
readerRegistry.read(idExisting, ctx);
assertTrue(read.isPresent());
// non existing l2fib
- final InstanceIdentifier<? extends DataObject> idNonExisting = InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child(
- BridgeDomain.class, new BridgeDomainKey("bdn1")).child(L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(new PhysAddress("FF:FF:FF:04:05:06")));
+ final InstanceIdentifier<? extends DataObject> idNonExisting =
+ InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child(
+ BridgeDomain.class, new BridgeDomainKey("bdn1")).child(L2FibTable.class)
+ .child(L2FibEntry.class, new L2FibEntryKey(new PhysAddress("FF:FF:FF:04:05:06")));
read = readerRegistry.read(idNonExisting, ctx);
assertFalse(read.isPresent());
}
@@ -276,7 +286,7 @@ public class VppStateTest {
assertTrue(read.isPresent());
assertEquals(readRoot.getBridgeDomains().getBridgeDomain().stream().filter(
- input -> input.getKey().getName().equals(bdName)).findFirst().get(),
+ input -> input.getKey().getName().equals(bdName)).findFirst().get(),
read.get());
}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTestUtils.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTestUtils.java
index 8fd57d679..27095c7d9 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTestUtils.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTestUtils.java
@@ -50,31 +50,31 @@ final class VppStateTestUtils {
@Nonnull final NamingContext bdContext) {
final ChildReader<Version> versionReader = new CompositeChildReader<>(
- Version.class, new VersionCustomizer(futureJVpp));
+ Version.class, new VersionCustomizer(futureJVpp));
final CompositeListReader<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> bridgeDomainReader =
- getBridgeDomainReader(futureJVpp, bdContext);
+ getBridgeDomainReader(futureJVpp, bdContext);
final ChildReader<BridgeDomains> bridgeDomainsReader = new CompositeChildReader<>(
- BridgeDomains.class,
- RWUtils.singletonChildReaderList(bridgeDomainReader),
- new ReflexiveChildReaderCustomizer<>(BridgeDomainsBuilder.class));
+ BridgeDomains.class,
+ RWUtils.singletonChildReaderList(bridgeDomainReader),
+ new ReflexiveChildReaderCustomizer<>(BridgeDomainsBuilder.class));
final List<ChildReader<? extends ChildOf<VppState>>> childVppReaders = new ArrayList<>();
childVppReaders.add(versionReader);
childVppReaders.add(bridgeDomainsReader);
return new CompositeRootReader<>(
- VppState.class,
- childVppReaders,
- RWUtils.<VppState>emptyAugReaderList(),
- new ReflexiveRootReaderCustomizer<>(VppStateBuilder.class));
+ VppState.class,
+ childVppReaders,
+ RWUtils.<VppState>emptyAugReaderList(),
+ new ReflexiveRootReaderCustomizer<>(VppStateBuilder.class));
}
static CompositeListReader<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> getBridgeDomainReader(
- final @Nonnull FutureJVpp futureJVpp, @Nonnull final NamingContext bdContext) {
+ final @Nonnull FutureJVpp futureJVpp, @Nonnull final NamingContext bdContext) {
return new CompositeListReader<>(
- BridgeDomain.class,
- new BridgeDomainCustomizer(futureJVpp, bdContext));
+ BridgeDomain.class,
+ new BridgeDomainCustomizer(futureJVpp, bdContext));
}
}
diff --git a/v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java b/v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java
index 9aed188d5..77e60877f 100644
--- a/v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java
+++ b/v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java
@@ -40,7 +40,8 @@ public final class TranslateUtils {
public static final Splitter COLON_SPLITTER = Splitter.on(':');
- private TranslateUtils() {}
+ private TranslateUtils() {
+ }
public static <REP extends JVppReply<?>> REP getReply(Future<REP> future) throws VppBaseCallException {
try {
@@ -51,7 +52,7 @@ public final class TranslateUtils {
} catch (ExecutionException e) {
// Execution exception could generally contains any exception
// when using exceptions instead of return codes just rethrow it for processing on corresponding place
- if (e instanceof ExecutionException && ( e.getCause() instanceof VppBaseCallException)) {
+ if (e instanceof ExecutionException && (e.getCause() instanceof VppBaseCallException)) {
throw (VppBaseCallException) (e.getCause());
}
throw new IllegalStateException(e);
@@ -71,8 +72,9 @@ public final class TranslateUtils {
} catch (ExecutionException e) {
// Execution exception could generally contains any exception
// when using exceptions instead of return codes just rethrow it for processing on corresponding place
- if ( e.getCause() instanceof VppBaseCallException)
- throw (VppBaseCallException)(e.getCause());
+ if (e.getCause() instanceof VppBaseCallException) {
+ throw (VppBaseCallException) (e.getCause());
+ }
throw new IllegalStateException(e);
} catch (TimeoutException e) {
throw new ReadTimeoutException(replyType, e);
@@ -80,8 +82,8 @@ public final class TranslateUtils {
}
/**
- * Transform Ipv4 address to a byte array acceptable by VPP. VPP expects incoming byte array to be
- * in the same order as the address.
+ * Transform Ipv4 address to a byte array acceptable by VPP. VPP expects incoming byte array to be in the same order
+ * as the address.
*
* @return byte array with address bytes
*/
@@ -104,7 +106,7 @@ public final class TranslateUtils {
@Nonnull
public static Ipv4AddressNoZone arrayToIpv4AddressNoZone(@Nonnull byte[] ip) {
// VPP sends ipv4 in a 16 byte array
- if(ip.length == 16) {
+ if (ip.length == 16) {
ip = Arrays.copyOfRange(ip, 0, 4);
}
try {
@@ -117,8 +119,8 @@ public final class TranslateUtils {
}
/**
- * Return (interned) string from byte array while removing \u0000.
- * Strings represented as fixed length byte[] from vpp contain \u0000.
+ * Return (interned) string from byte array while removing \u0000. Strings represented as fixed length byte[] from
+ * vpp contain \u0000.
*/
public static String toString(final byte[] cString) {
return new String(cString).replaceAll("\\u0000", "").intern();
@@ -152,20 +154,24 @@ public final class TranslateUtils {
}
public static byte parseHexByte(final String aByte) {
- return (byte)Integer.parseInt(aByte, 16);
+ return (byte) Integer.parseInt(aByte, 16);
}
- /**
+ /**
* Returns 0 if argument is null or false, 1 otherwise.
+ *
* @param value Boolean value to be converted
* @return byte value equal to 0 or 1
*/
public static byte booleanToByte(@Nullable final Boolean value) {
- return value != null && value ? (byte) 1 : (byte) 0;
+ return value != null && value
+ ? (byte) 1
+ : (byte) 0;
}
/**
* Returns Boolean.TRUE if argument is 0, Boolean.FALSE otherwise.
+ *
* @param value byte value to be converted
* @return Boolean value
* @throws IllegalArgumentException if argument is neither 0 nor 1