summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeWriter.java
diff options
context:
space:
mode:
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeWriter.java')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeWriter.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeWriter.java
index a4667bf4d..abc49cccb 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeWriter.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppclassifier/VppNodeWriter.java
@@ -20,8 +20,8 @@ import static com.google.common.base.Preconditions.checkArgument;
import io.fd.honeycomb.translate.MappingContext;
import io.fd.honeycomb.translate.v3po.util.FutureJVppCustomizer;
+import io.fd.honeycomb.translate.v3po.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.v3po.util.ReadTimeoutException;
-import io.fd.honeycomb.translate.v3po.util.TranslateUtils;
import io.fd.honeycomb.translate.write.WriteFailedException;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
@@ -33,7 +33,7 @@ import org.openvpp.jvpp.core.dto.GetNextIndex;
import org.openvpp.jvpp.core.dto.GetNextIndexReply;
import org.openvpp.jvpp.core.future.FutureJVppCore;
-abstract class VppNodeWriter extends FutureJVppCustomizer {
+abstract class VppNodeWriter extends FutureJVppCustomizer implements JvppReplyConsumer {
protected VppNodeWriter(@Nonnull final FutureJVppCore futureJvpp) {
super(futureJvpp);
@@ -42,35 +42,37 @@ abstract class VppNodeWriter extends FutureJVppCustomizer {
protected int getNodeIndex(@Nonnull final VppNode node, @Nonnull final ClassifyTable classifyTable,
@Nonnull final VppClassifierContextManager vppClassifierContextManager,
@Nonnull final MappingContext ctx, @Nonnull final InstanceIdentifier<?> id)
- throws VppBaseCallException, WriteFailedException {
+ throws VppBaseCallException, WriteFailedException {
if (node.getPacketHandlingAction() != null) {
return node.getPacketHandlingAction().getIntValue();
} else {
- return nodeNameToIndex(classifyTable, node.getVppNodeName().getValue(), vppClassifierContextManager, ctx, id);
+ return nodeNameToIndex(classifyTable, node.getVppNodeName().getValue(), vppClassifierContextManager, ctx,
+ id);
}
}
private int nodeNameToIndex(@Nonnull final ClassifyTable classifyTable, @Nonnull final String nextNodeName,
@Nonnull final VppClassifierContextManager vppClassifierContextManager,
@Nonnull final MappingContext ctx, @Nonnull final InstanceIdentifier<?> id)
- throws VppBaseCallException, WriteFailedException {
- checkArgument(classifyTable != null && classifyTable.getClassifierNode() != null, "to use relative node names, table classifier node needs to be provided");
+ throws VppBaseCallException, WriteFailedException {
+ checkArgument(classifyTable != null && classifyTable.getClassifierNode() != null,
+ "to use relative node names, table classifier node needs to be provided");
final GetNextIndex request = new GetNextIndex();
request.nodeName = classifyTable.getClassifierNode().getValue().getBytes();
request.nextName = nextNodeName.getBytes();
final CompletionStage<GetNextIndexReply> getNextIndexCompletionStage =
- getFutureJVpp().getNextIndex(request);
+ getFutureJVpp().getNextIndex(request);
final GetNextIndexReply reply;
try {
- reply = TranslateUtils.getReplyForRead(getNextIndexCompletionStage.toCompletableFuture(), id);
+ reply = getReplyForRead(getNextIndexCompletionStage.toCompletableFuture(), id);
// vpp does not provide relative node index to node name conversion (https://jira.fd.io/browse/VPP-219)
// as a workaround we need to add mapping to vpp-classfier-context
vppClassifierContextManager.addNodeName(classifyTable.getName(), reply.nextIndex, nextNodeName, ctx);
} catch (ReadTimeoutException e) {
throw new WriteFailedException(id, String.format("Failed to get node index for %s relative to %s",
- nextNodeName, classifyTable.getClassifierNode()), e);
+ nextNodeName, classifyTable.getClassifierNode()), e);
}
return reply.nextIndex;
}