"This revision adds the following new features:
- ingress/egress ACLs support
- moved ACL definitions to vpp-acl module
- - updated l2 container constraint (permit IP address on BVI interface)";
+ - updated l2 container constraint (permit IP address on BVI interface)
+ - added PID of vpp process to vpp-state";
}
revision "2015-01-05" {
leaf branch {
type string;
}
+ leaf pid {
+ type uint32;
+ description
+ "PID of the vpp process";
+ }
description
"vlib version info";
}
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;
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;
}
@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
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);
+ }
+
+
}
import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
+import io.fd.vpp.jvpp.core.dto.ShowVersion;
+import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
+import io.fd.vpp.jvpp.dto.ControlPing;
+import io.fd.vpp.jvpp.dto.ControlPingReply;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppStateBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.Version;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.VersionBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.ShowVersion;
-import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
public class VersionCustomizerTest extends ReaderCustomizerTest<Version, VersionBuilder> {
reply.buildDirectory = new byte[] {};
when(api.showVersion(any(ShowVersion.class))).thenReturn(future(reply));
+ when(api.send(any(ControlPing.class))).thenReturn(future(new ControlPingReply()));
getCustomizer().readCurrentAttributes(InstanceIdentifier.create(Version.class), new VersionBuilder(), ctx);
verify(api).showVersion(any(ShowVersion.class));
+ verify(api).send(any(ControlPing.class));
}
}
\ No newline at end of file
import io.fd.honeycomb.vpp.test.util.NamingContextHelper;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.vpp.test.util.FutureProducer;
+import io.fd.vpp.jvpp.dto.ControlPing;
+import io.fd.vpp.jvpp.dto.ControlPingReply;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
.setBuildDirectory("1")
.setBranch("2")
.setBuildDate("3")
+ .setPid(0L)
.build();
}
reply.version = version.getBranch().getBytes();
reply.buildDirectory = version.getBuildDirectory().getBytes();
when(api.showVersion(any(ShowVersion.class))).thenReturn(future(reply));
+ // Version Customizer uses ControlPing to obtain PID
+ when(api.send(any(ControlPing.class))).thenReturn(future(new ControlPingReply()));
}
private void whenL2FibTableDumpThenReturn(final List<L2FibTableEntry> entryList) {