From e599b1319651e2e5a4415033913d615e3617effa Mon Sep 17 00:00:00 2001 From: Michal Cmarada Date: Wed, 20 Mar 2019 10:34:09 +0100 Subject: Revert "fixes after Interfaces API udate" This reverts commit 596802d25220182f76b696b85c9fb4147baa425f. It is a temporary solution until CSIT adapts to these changes. Once done VPP will reintroduce these API changes and original patch can be applied again. Change-Id: Iccdcb3108a7dfa48bf36e485e8d60664c518949e Signed-off-by: Michal Cmarada --- .../fd/jvpp/core/examples/CallbackApiExample.java | 12 +++++------ .../core/examples/CreateSubInterfaceExample.java | 25 ++++++++++++---------- .../io/fd/jvpp/core/examples/FutureApiExample.java | 12 +++++------ .../fd/jvpp/core/examples/NotificationUtils.java | 8 ++----- 4 files changed, 28 insertions(+), 29 deletions(-) (limited to 'java/jvpp-core') 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 85a5e14..6b2d893 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 = false; - swInterfaceDumpRequest.nameFilter = ""; + swInterfaceDumpRequest.nameFilterValid = 0; + swInterfaceDumpRequest.nameFilter = "".getBytes(StandardCharsets.UTF_8); 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, flags=%s, " - + "linkSpeed=%d, linkMtu=%d%n", - msg.interfaceName, msg.l2Address.macaddress.length, msg.flags.getOptions(), - msg.linkSpeed, (int) msg.linkMtu); + 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); } @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 13cdd62..cc07520 100644 --- a/java/jvpp-core/io/fd/jvpp/core/examples/CreateSubInterfaceExample.java +++ b/java/jvpp-core/io/fd/jvpp/core/examples/CreateSubInterfaceExample.java @@ -26,10 +26,9 @@ 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 io.fd.jvpp.core.types.InterfaceIndex; -import io.fd.jvpp.core.types.SubIfFlags; +import java.nio.charset.StandardCharsets; -/**jvpp-core/io/fd/jvpp/core/examples/CreateSubInterfaceExample.java +/** *

Tests sub-interface creation.
Equivalent to:
* *

{@code
@@ -47,8 +46,8 @@ public class CreateSubInterfaceExample {
 
     private static SwInterfaceDump createSwInterfaceDumpRequest(final String ifaceName) {
         SwInterfaceDump request = new SwInterfaceDump();
-        request.nameFilter = ifaceName;
-        request.nameFilterValid = true;
+        request.nameFilter = ifaceName.getBytes(StandardCharsets.UTF_8);
+        request.nameFilterValid = 1;
         return request;
     }
 
@@ -60,14 +59,18 @@ public class CreateSubInterfaceExample {
         }
     }
 
-    private static CreateSubif createSubifRequest(final InterfaceIndex swIfIndex, final int subId) {
+    private static CreateSubif createSubifRequest(final int swIfIndex, final int subId) {
         CreateSubif request = new CreateSubif();
         request.swIfIndex = swIfIndex; // super interface id
         request.subId = subId;
-        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.noTags = 0;
+        request.oneTag = 0;
+        request.twoTags = 1;
+        request.dot1Ad = 0;
+        request.exactMatch = 1;
+        request.defaultSub = 0;
+        request.outerVlanIdAny = 0;
+        request.innerVlanIdAny = 1;
         request.outerVlanId = 100;
         request.innerVlanId = 0;
         return request;
@@ -93,7 +96,7 @@ public class CreateSubInterfaceExample {
             requireNonNull(swInterfaceDetails.swInterfaceDetails, "swInterfaceDetails is null");
             requireSingleIface(swInterfaceDetails, ifaceName);
 
-            final InterfaceIndex swIfIndex = swInterfaceDetails.swInterfaceDetails.get(0).swIfIndex;
+            final int 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 a2b1e6e..ff1755d 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 = false;
-        request.nameFilter = "";
+        request.nameFilterValid = 0;
+        request.nameFilter = "".getBytes(StandardCharsets.UTF_8);
 
         final Future 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, flags=%s, "
-                        + "linkSpeed=%d, linkMtu=%d%n",
+                String.format("Received SwInterfaceDetails: interfaceName=%s, l2AddressLength=%d, adminUpDown=%d, "
+                        + "linkUpDown=%d, linkSpeed=%d, linkMtu=%d%n",
                     details.interfaceName,
-                    details.l2Address.macaddress.length, details.flags.getOptions(),
-                    details.linkSpeed, (int) details.linkMtu));
+                    details.l2AddressLength, details.adminUpDown,
+                    details.linkUpDown, 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 aef953f..7b78389 100644
--- a/java/jvpp-core/io/fd/jvpp/core/examples/NotificationUtils.java
+++ b/java/jvpp-core/io/fd/jvpp/core/examples/NotificationUtils.java
@@ -16,9 +16,7 @@
 
 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;
@@ -33,10 +31,8 @@ final class NotificationUtils {
 
     static SwInterfaceSetFlags getChangeInterfaceState() {
         final SwInterfaceSetFlags swInterfaceSetFlags = new SwInterfaceSetFlags();
-        swInterfaceSetFlags.flags = new IfStatusFlags();
-        swInterfaceSetFlags.flags.add(IfStatusFlags.IfStatusFlagsOptions.IF_STATUS_API_FLAG_ADMIN_UP);
-        swInterfaceSetFlags.swIfIndex = new InterfaceIndex();
-        swInterfaceSetFlags.swIfIndex.interfaceindex = 0;
+        swInterfaceSetFlags.swIfIndex = 0;
+        swInterfaceSetFlags.adminUpDown = 1;
         return swInterfaceSetFlags;
     }
 
-- 
cgit 1.2.3-korg