summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--java/jvpp-core/io/fd/jvpp/core/examples/CallbackApiExample.java12
-rw-r--r--java/jvpp-core/io/fd/jvpp/core/examples/CreateSubInterfaceExample.java25
-rw-r--r--java/jvpp-core/io/fd/jvpp/core/examples/FutureApiExample.java12
-rw-r--r--java/jvpp-core/io/fd/jvpp/core/examples/NotificationUtils.java8
4 files changed, 29 insertions, 28 deletions
diff --git a/java/jvpp-core/io/fd/jvpp/core/examples/CallbackApiExample.java b/java/jvpp-core/io/fd/jvpp/core/examples/CallbackApiExample.java
index 6b2d893..85a5e14 100644
--- a/java/jvpp-core/io/fd/jvpp/core/examples/CallbackApiExample.java
+++ b/java/jvpp-core/io/fd/jvpp/core/examples/CallbackApiExample.java
@@ -55,8 +55,8 @@ public class CallbackApiExample {
System.out.println("Sending SwInterfaceDump request...");
SwInterfaceDump swInterfaceDumpRequest = new SwInterfaceDump();
- swInterfaceDumpRequest.nameFilterValid = 0;
- swInterfaceDumpRequest.nameFilter = "".getBytes(StandardCharsets.UTF_8);
+ swInterfaceDumpRequest.nameFilterValid = false;
+ swInterfaceDumpRequest.nameFilter = "";
jvpp.send(swInterfaceDumpRequest);
Thread.sleep(1000);
@@ -85,10 +85,10 @@ public class CallbackApiExample {
@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",
- msg.interfaceName, msg.l2AddressLength, msg.adminUpDown,
- msg.linkUpDown, msg.linkSpeed, (int) msg.linkMtu);
+ System.out.printf("Received SwInterfaceDetails: interfaceName=%s, l2AddressLength=%d, flags=%s, "
+ + "linkSpeed=%d, linkMtu=%d%n",
+ msg.interfaceName, msg.l2Address.macaddress.length, msg.flags.getOptions(),
+ msg.linkSpeed, (int) msg.linkMtu);
}
@Override
diff --git a/java/jvpp-core/io/fd/jvpp/core/examples/CreateSubInterfaceExample.java b/java/jvpp-core/io/fd/jvpp/core/examples/CreateSubInterfaceExample.java
index cc07520..13cdd62 100644
--- a/java/jvpp-core/io/fd/jvpp/core/examples/CreateSubInterfaceExample.java
+++ b/java/jvpp-core/io/fd/jvpp/core/examples/CreateSubInterfaceExample.java
@@ -26,9 +26,10 @@ import io.fd.jvpp.core.dto.CreateSubifReply;
import io.fd.jvpp.core.dto.SwInterfaceDetailsReplyDump;
import io.fd.jvpp.core.dto.SwInterfaceDump;
import io.fd.jvpp.core.future.FutureJVppCoreFacade;
-import java.nio.charset.StandardCharsets;
+import io.fd.jvpp.core.types.InterfaceIndex;
+import io.fd.jvpp.core.types.SubIfFlags;
-/**
+/**jvpp-core/io/fd/jvpp/core/examples/CreateSubInterfaceExample.java
* <p>Tests sub-interface creation.<br> Equivalent to:<br>
*
* <pre>{@code
@@ -46,8 +47,8 @@ public class CreateSubInterfaceExample {
private static SwInterfaceDump createSwInterfaceDumpRequest(final String ifaceName) {
SwInterfaceDump request = new SwInterfaceDump();
- request.nameFilter = ifaceName.getBytes(StandardCharsets.UTF_8);
- request.nameFilterValid = 1;
+ request.nameFilter = ifaceName;
+ request.nameFilterValid = true;
return request;
}
@@ -59,18 +60,14 @@ public class CreateSubInterfaceExample {
}
}
- private static CreateSubif createSubifRequest(final int swIfIndex, final int subId) {
+ private static CreateSubif createSubifRequest(final InterfaceIndex swIfIndex, final int subId) {
CreateSubif request = new CreateSubif();
request.swIfIndex = swIfIndex; // super interface id
request.subId = subId;
- request.noTags = 0;
- request.oneTag = 0;
- request.twoTags = 1;
- request.dot1Ad = 0;
- request.exactMatch = 1;
- request.defaultSub = 0;
- request.outerVlanIdAny = 0;
- request.innerVlanIdAny = 1;
+ request.subIfFlags = new SubIfFlags();
+ request.subIfFlags.add(SubIfFlags.SubIfFlagsOptions.SUB_IF_API_FLAG_TWO_TAGS);
+ request.subIfFlags.add(SubIfFlags.SubIfFlagsOptions.SUB_IF_API_FLAG_EXACT_MATCH);
+ request.subIfFlags.add(SubIfFlags.SubIfFlagsOptions.SUB_IF_API_FLAG_INNER_VLAN_ID_ANY);
request.outerVlanId = 100;
request.innerVlanId = 0;
return request;
@@ -96,7 +93,7 @@ public class CreateSubInterfaceExample {
requireNonNull(swInterfaceDetails.swInterfaceDetails, "swInterfaceDetails is null");
requireSingleIface(swInterfaceDetails, ifaceName);
- final int swIfIndex = swInterfaceDetails.swInterfaceDetails.get(0).swIfIndex;
+ final InterfaceIndex swIfIndex = swInterfaceDetails.swInterfaceDetails.get(0).swIfIndex;
final int subId = 1;
final CreateSubifReply createSubifReply =
diff --git a/java/jvpp-core/io/fd/jvpp/core/examples/FutureApiExample.java b/java/jvpp-core/io/fd/jvpp/core/examples/FutureApiExample.java
index ff1755d..a2b1e6e 100644
--- a/java/jvpp-core/io/fd/jvpp/core/examples/FutureApiExample.java
+++ b/java/jvpp-core/io/fd/jvpp/core/examples/FutureApiExample.java
@@ -90,19 +90,19 @@ public class FutureApiExample {
private static void testSwInterfaceDump(final FutureJVppCoreFacade jvpp) throws Exception {
LOG.info("Sending SwInterfaceDump request...");
final SwInterfaceDump request = new SwInterfaceDump();
- request.nameFilterValid = 0;
- request.nameFilter = "".getBytes(StandardCharsets.UTF_8);
+ request.nameFilterValid = false;
+ request.nameFilter = "";
final Future<SwInterfaceDetailsReplyDump> replyFuture = jvpp.swInterfaceDump(request).toCompletableFuture();
final SwInterfaceDetailsReplyDump reply = replyFuture.get();
for (SwInterfaceDetails details : reply.swInterfaceDetails) {
Objects.requireNonNull(details, "reply.swInterfaceDetails contains null element!");
LOG.info(
- String.format("Received SwInterfaceDetails: interfaceName=%s, l2AddressLength=%d, adminUpDown=%d, "
- + "linkUpDown=%d, linkSpeed=%d, linkMtu=%d%n",
+ String.format("Received SwInterfaceDetails: interfaceName=%s, l2AddressLength=%d, flags=%s, "
+ + "linkSpeed=%d, linkMtu=%d%n",
details.interfaceName,
- details.l2AddressLength, details.adminUpDown,
- details.linkUpDown, details.linkSpeed, (int) details.linkMtu));
+ details.l2Address.macaddress.length, details.flags.getOptions(),
+ details.linkSpeed, (int) details.linkMtu));
}
}
diff --git a/java/jvpp-core/io/fd/jvpp/core/examples/NotificationUtils.java b/java/jvpp-core/io/fd/jvpp/core/examples/NotificationUtils.java
index 7b78389..aef953f 100644
--- a/java/jvpp-core/io/fd/jvpp/core/examples/NotificationUtils.java
+++ b/java/jvpp-core/io/fd/jvpp/core/examples/NotificationUtils.java
@@ -16,7 +16,9 @@
package io.fd.jvpp.core.examples;
+import io.fd.jvpp.core.types.InterfaceIndex;
import java.io.PrintStream;
+import io.fd.jvpp.core.types.IfStatusFlags;
import io.fd.jvpp.core.dto.SwInterfaceSetFlags;
import io.fd.jvpp.core.dto.SwInterfaceEvent;
import io.fd.jvpp.core.dto.WantInterfaceEvents;
@@ -31,8 +33,10 @@ final class NotificationUtils {
static SwInterfaceSetFlags getChangeInterfaceState() {
final SwInterfaceSetFlags swInterfaceSetFlags = new SwInterfaceSetFlags();
- swInterfaceSetFlags.swIfIndex = 0;
- swInterfaceSetFlags.adminUpDown = 1;
+ swInterfaceSetFlags.flags = new IfStatusFlags();
+ swInterfaceSetFlags.flags.add(IfStatusFlags.IfStatusFlagsOptions.IF_STATUS_API_FLAG_ADMIN_UP);
+ swInterfaceSetFlags.swIfIndex = new InterfaceIndex();
+ swInterfaceSetFlags.swIfIndex.interfaceindex = 0;
return swInterfaceSetFlags;
}