summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-10-31 14:37:57 +0100
committerMarek Gradzki <mgradzki@cisco.com>2016-10-31 15:46:07 +0100
commit51d5709128535d4da018f6ed7570877de6d6f405 (patch)
treec69ff13d9c3866d7546a921862d7ea7e7620ebf9 /v3po/v3po2vpp/src/main/java
parentaf201b3a66219b74b684c91895bce30189ccb245 (diff)
HONEYCOMB-70: add control ping to vpp-state
Change-Id: I7f02841d899465fd2156db0bb79fcc490cd4929f Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/main/java')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java
index 71826dcb4..dfa0f9632 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vppstate/VersionCustomizer.java
@@ -16,6 +16,7 @@
package io.fd.honeycomb.translate.v3po.vppstate;
+import com.google.common.primitives.UnsignedInts;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
@@ -25,6 +26,9 @@ import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.vpp.jvpp.core.dto.ShowVersion;
import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import io.fd.vpp.jvpp.dto.ControlPing;
+import io.fd.vpp.jvpp.dto.ControlPingReply;
+import io.fd.vpp.jvpp.dto.JVppReply;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppStateBuilder;
@@ -54,7 +58,7 @@ public final class VersionCustomizer
}
@Override
- public void readCurrentAttributes(@Nonnull InstanceIdentifier<Version> id, @Nonnull final VersionBuilder builder,
+ public void readCurrentAttributes(@Nonnull final InstanceIdentifier<Version> id, @Nonnull final VersionBuilder builder,
@Nonnull final ReadContext context) throws ReadFailedException {
// Execute with timeout
@@ -65,6 +69,14 @@ public final class VersionCustomizer
builder.setName(toString(reply.program));
builder.setBuildDate(toString(reply.buildDate));
builder.setBuildDirectory(toString(reply.buildDirectory));
+ builder.setPid(getPid(id));
}
+ private Long getPid(@Nonnull final InstanceIdentifier<Version> id) throws ReadFailedException {
+ final CompletionStage<JVppReply<ControlPing>> request = getFutureJVpp().send(new ControlPing());
+ final ControlPingReply reply = (ControlPingReply)getReplyForRead(request.toCompletableFuture(), id);
+ return UnsignedInts.toLong(reply.vpePid);
+ }
+
+
}