Change-Id: I8333b7d19ebdacac5445b4505750dd0a46764b36
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
+import java.nio.charset.StandardCharsets;
public class CallbackApiTest {
public class CallbackApiTest {
System.out.println("Sending GetNodeIndex request...");
GetNodeIndex getNodeIndexRequest = new GetNodeIndex();
System.out.println("Sending GetNodeIndex request...");
GetNodeIndex getNodeIndexRequest = new GetNodeIndex();
- getNodeIndexRequest.nodeName = "non-existing-node".getBytes();
+ getNodeIndexRequest.nodeName = "non-existing-node".getBytes(StandardCharsets.UTF_8);
jvpp.send(getNodeIndexRequest);
System.out.println("Sending SwInterfaceDump request...");
SwInterfaceDump swInterfaceDumpRequest = new SwInterfaceDump();
swInterfaceDumpRequest.nameFilterValid = 0;
jvpp.send(getNodeIndexRequest);
System.out.println("Sending SwInterfaceDump request...");
SwInterfaceDump swInterfaceDumpRequest = new SwInterfaceDump();
swInterfaceDumpRequest.nameFilterValid = 0;
- swInterfaceDumpRequest.nameFilter = "".getBytes();
+ swInterfaceDumpRequest.nameFilter = "".getBytes(StandardCharsets.UTF_8);
jvpp.send(swInterfaceDumpRequest);
Thread.sleep(1000);
jvpp.send(swInterfaceDumpRequest);
Thread.sleep(1000);
public void onShowVersionReply(final ShowVersionReply msg) {
System.out.printf("Received ShowVersionReply: context=%d, program=%s, version=%s, "
+ "buildDate=%s, buildDirectory=%s%n",
public void onShowVersionReply(final ShowVersionReply msg) {
System.out.printf("Received ShowVersionReply: context=%d, program=%s, version=%s, "
+ "buildDate=%s, buildDirectory=%s%n",
- msg.context, new String(msg.program), new String(msg.version),
- new String(msg.buildDate), new String(msg.buildDirectory));
+ msg.context,
+ new String(msg.program, StandardCharsets.UTF_8),
+ new String(msg.version, StandardCharsets.UTF_8),
+ new String(msg.buildDate, StandardCharsets.UTF_8),
+ new String(msg.buildDirectory, StandardCharsets.UTF_8));
}
@Override
public void onSwInterfaceDetails(final SwInterfaceDetails msg) {
System.out.printf("Received SwInterfaceDetails: interfaceName=%s, l2AddressLength=%d, adminUpDown=%d, "
+ "linkUpDown=%d, linkSpeed=%d, linkMtu=%d%n",
}
@Override
public void onSwInterfaceDetails(final SwInterfaceDetails msg) {
System.out.printf("Received SwInterfaceDetails: interfaceName=%s, l2AddressLength=%d, adminUpDown=%d, "
+ "linkUpDown=%d, linkSpeed=%d, linkMtu=%d%n",
- new String(msg.interfaceName), msg.l2AddressLength, msg.adminUpDown,
+ new String(msg.interfaceName, StandardCharsets.UTF_8), msg.l2AddressLength, msg.adminUpDown,
msg.linkUpDown, msg.linkSpeed, (int) msg.linkMtu);
}
msg.linkUpDown, msg.linkSpeed, (int) msg.linkMtu);
}
import io.fd.vpp.jvpp.core.dto.GetNodeIndex;
import io.fd.vpp.jvpp.core.dto.GetNodeIndexReply;
import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
import io.fd.vpp.jvpp.core.dto.GetNodeIndex;
import io.fd.vpp.jvpp.core.dto.GetNodeIndexReply;
import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
+import java.nio.charset.StandardCharsets;
/**
* CallbackJVppFacade together with CallbackJVppFacadeCallback allow for setting different callback for each request.
/**
* CallbackJVppFacade together with CallbackJVppFacadeCallback allow for setting different callback for each request.
@Override
public void onShowVersionReply(final ShowVersionReply msg) {
System.out.printf("ShowVersionCallback1 received ShowVersionReply: context=%d, program=%s,"
@Override
public void onShowVersionReply(final ShowVersionReply msg) {
System.out.printf("ShowVersionCallback1 received ShowVersionReply: context=%d, program=%s,"
- + "version=%s, buildDate=%s, buildDirectory=%s%n", msg.context, new String(msg.program),
- new String(msg.version), new String(msg.buildDate), new String(msg.buildDirectory));
+ + "version=%s, buildDate=%s, buildDirectory=%s%n", msg.context,
+ new String(msg.program, StandardCharsets.UTF_8),
+ new String(msg.version, StandardCharsets.UTF_8),
+ new String(msg.buildDate, StandardCharsets.UTF_8),
+ new String(msg.buildDirectory, StandardCharsets.UTF_8));
@Override
public void onShowVersionReply(final ShowVersionReply msg) {
System.out.printf("ShowVersionCallback2 received ShowVersionReply: context=%d, program=%s,"
@Override
public void onShowVersionReply(final ShowVersionReply msg) {
System.out.printf("ShowVersionCallback2 received ShowVersionReply: context=%d, program=%s,"
- + "version=%s, buildDate=%s, buildDirectory=%s%n", msg.context, new String(msg.program),
- new String(msg.version), new String(msg.buildDate), new String(msg.buildDirectory));
+ + "version=%s, buildDate=%s, buildDirectory=%s%n", msg.context,
+ new String(msg.program, StandardCharsets.UTF_8),
+ new String(msg.version, StandardCharsets.UTF_8),
+ new String(msg.buildDate, StandardCharsets.UTF_8),
+ new String(msg.buildDirectory, StandardCharsets.UTF_8));
callbackFacade.showVersion(showVersionCallback2);
GetNodeIndex getNodeIndexRequest = new GetNodeIndex();
callbackFacade.showVersion(showVersionCallback2);
GetNodeIndex getNodeIndexRequest = new GetNodeIndex();
- getNodeIndexRequest.nodeName = "dummyNode".getBytes();
+ getNodeIndexRequest.nodeName = "dummyNode".getBytes(StandardCharsets.UTF_8);
callbackFacade.getNodeIndex(getNodeIndexRequest, getNodeIndexCallback);
Thread.sleep(2000);
callbackFacade.getNodeIndex(getNodeIndexRequest, getNodeIndexCallback);
Thread.sleep(2000);
import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump;
import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
import io.fd.vpp.jvpp.core.future.FutureJVppCoreFacade;
import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump;
import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
import io.fd.vpp.jvpp.core.future.FutureJVppCoreFacade;
+import java.nio.charset.StandardCharsets;
/**
* <p>Tests sub-interface creation.<br> Equivalent to:<br>
/**
* <p>Tests sub-interface creation.<br> Equivalent to:<br>
private static SwInterfaceDump createSwInterfaceDumpRequest(final String ifaceName) {
SwInterfaceDump request = new SwInterfaceDump();
private static SwInterfaceDump createSwInterfaceDumpRequest(final String ifaceName) {
SwInterfaceDump request = new SwInterfaceDump();
- request.nameFilter = ifaceName.getBytes();
+ request.nameFilter = ifaceName.getBytes(StandardCharsets.UTF_8);
request.nameFilterValid = 1;
return request;
}
request.nameFilterValid = 1;
return request;
}
import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump;
import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
import io.fd.vpp.jvpp.core.future.FutureJVppCoreFacade;
import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump;
import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
import io.fd.vpp.jvpp.core.future.FutureJVppCoreFacade;
+import java.nio.charset.StandardCharsets;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
LOG.info(
String.format(
"Received ShowVersionReply: context=%d, program=%s, version=%s, buildDate=%s, buildDirectory=%s%n",
LOG.info(
String.format(
"Received ShowVersionReply: context=%d, program=%s, version=%s, buildDate=%s, buildDirectory=%s%n",
- reply.context, new String(reply.program), new String(reply.version), new String(reply.buildDate),
- new String(reply.buildDirectory)));
+ reply.context, new String(reply.program, StandardCharsets.UTF_8),
+ new String(reply.version, StandardCharsets.UTF_8),
+ new String(reply.buildDate, StandardCharsets.UTF_8),
+ new String(reply.buildDirectory, StandardCharsets.UTF_8)));
}
private static void testEmptyBridgeDomainDump(final FutureJVppCoreFacade jvpp) throws Exception {
}
private static void testEmptyBridgeDomainDump(final FutureJVppCoreFacade jvpp) throws Exception {
private static void testGetNodeIndex(final FutureJVppCoreFacade jvpp) {
LOG.info("Sending GetNodeIndex request...");
final GetNodeIndex request = new GetNodeIndex();
private static void testGetNodeIndex(final FutureJVppCoreFacade jvpp) {
LOG.info("Sending GetNodeIndex request...");
final GetNodeIndex request = new GetNodeIndex();
- request.nodeName = "non-existing-node".getBytes();
+ request.nodeName = "non-existing-node".getBytes(StandardCharsets.UTF_8);
final Future<GetNodeIndexReply> replyFuture = jvpp.getNodeIndex(request).toCompletableFuture();
try {
final GetNodeIndexReply reply = replyFuture.get();
final Future<GetNodeIndexReply> replyFuture = jvpp.getNodeIndex(request).toCompletableFuture();
try {
final GetNodeIndexReply reply = replyFuture.get();
LOG.info("Sending SwInterfaceDump request...");
final SwInterfaceDump request = new SwInterfaceDump();
request.nameFilterValid = 0;
LOG.info("Sending SwInterfaceDump request...");
final SwInterfaceDump request = new SwInterfaceDump();
request.nameFilterValid = 0;
- request.nameFilter = "".getBytes();
+ request.nameFilter = "".getBytes(StandardCharsets.UTF_8);
final Future<SwInterfaceDetailsReplyDump> replyFuture = jvpp.swInterfaceDump(request).toCompletableFuture();
final SwInterfaceDetailsReplyDump reply = replyFuture.get();
final Future<SwInterfaceDetailsReplyDump> replyFuture = jvpp.swInterfaceDump(request).toCompletableFuture();
final SwInterfaceDetailsReplyDump reply = replyFuture.get();
LOG.info(
String.format("Received SwInterfaceDetails: interfaceName=%s, l2AddressLength=%d, adminUpDown=%d, "
+ "linkUpDown=%d, linkSpeed=%d, linkMtu=%d%n",
LOG.info(
String.format("Received SwInterfaceDetails: interfaceName=%s, l2AddressLength=%d, adminUpDown=%d, "
+ "linkUpDown=%d, linkSpeed=%d, linkMtu=%d%n",
- new String(details.interfaceName), details.l2AddressLength, details.adminUpDown,
+ new String(details.interfaceName, StandardCharsets.UTF_8),
+ details.l2AddressLength, details.adminUpDown,
details.linkUpDown, details.linkSpeed, (int) details.linkMtu));
}
}
details.linkUpDown, details.linkSpeed, (int) details.linkMtu));
}
}
import io.fd.vpp.jvpp.ioampot.callback.PotProfileAddCallback;
import io.fd.vpp.jvpp.ioampot.dto.PotProfileAdd;
import io.fd.vpp.jvpp.ioampot.dto.PotProfileAddReply;
import io.fd.vpp.jvpp.ioampot.callback.PotProfileAddCallback;
import io.fd.vpp.jvpp.ioampot.dto.PotProfileAdd;
import io.fd.vpp.jvpp.ioampot.dto.PotProfileAddReply;
+import java.nio.charset.StandardCharsets;
public class IoamPotApiTest {
public class IoamPotApiTest {
request.maxBits = 53;
request.lpc = 1234;
request.polynomialPublic = 1234;
request.maxBits = 53;
request.lpc = 1234;
request.polynomialPublic = 1234;
- request.listNameLen = (byte)"test pot profile".getBytes().length;
- request.listName = "test pot profile".getBytes();
+ request.listNameLen = (byte)"test pot profile".getBytes(StandardCharsets.UTF_8).length;
+ request.listName = "test pot profile".getBytes(StandardCharsets.UTF_8);
final int result = jvpp.send(request);
System.out.printf("PotProfileAdd send result = %d%n", result);
final int result = jvpp.send(request);
System.out.printf("PotProfileAdd send result = %d%n", result);