diff options
Diffstat (limited to 'src/vpp-api/java/jvpp-core')
-rw-r--r-- | src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackApiExample.java (renamed from src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java) | 6 | ||||
-rw-r--r-- | src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeExample.java (renamed from src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java) | 8 | ||||
-rw-r--r-- | src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeNotificationExample.java (renamed from src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeNotificationTest.java) | 6 | ||||
-rw-r--r-- | src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackNotificationApiExample.java (renamed from src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackNotificationApiTest.java) | 14 | ||||
-rw-r--r-- | src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CreateSubInterfaceExample.java (renamed from src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java) | 10 | ||||
-rw-r--r-- | src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/FutureApiExample.java (renamed from src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java) | 8 | ||||
-rw-r--r-- | src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/FutureApiNotificationExample.java (renamed from src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiNotificationTest.java) | 12 | ||||
-rw-r--r-- | src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/L2AclExample.java (renamed from src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/L2AclTest.java) | 6 | ||||
-rw-r--r-- | src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/LispAdjacencyExample.java (renamed from src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/LispAdjacencyTest.java) | 8 | ||||
-rw-r--r-- | src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/NotificationUtils.java (renamed from src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/NotificationUtils.java) | 2 | ||||
-rw-r--r-- | src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/Readme.txt | 16 | ||||
-rw-r--r-- | src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/ControlPingTest.java | 68 | ||||
-rw-r--r-- | src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/Readme.txt | 17 |
13 files changed, 56 insertions, 125 deletions
diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackApiExample.java index 8fcef967b1d..554a21bd411 100644 --- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java +++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackApiExample.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.vpp.jvpp.core.test; +package io.fd.vpp.jvpp.core.examples; import io.fd.vpp.jvpp.JVpp; import io.fd.vpp.jvpp.JVppRegistry; @@ -32,7 +32,7 @@ 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 CallbackApiExample { public static void main(String[] args) throws Exception { testCallbackApi(); @@ -40,7 +40,7 @@ public class CallbackApiTest { private static void testCallbackApi() throws Exception { System.out.println("Testing Java callback API with JVppRegistry"); - try (final JVppRegistry registry = new JVppRegistryImpl("CallbackApiTest"); + try (final JVppRegistry registry = new JVppRegistryImpl("CallbackApiExample"); final JVpp jvpp = new JVppCoreImpl()) { registry.register(jvpp, new TestCallback()); diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeExample.java index cf6b0bb3141..2f77f0f136f 100644 --- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java +++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeExample.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.vpp.jvpp.core.test; +package io.fd.vpp.jvpp.core.examples; import io.fd.vpp.jvpp.JVppRegistry; import io.fd.vpp.jvpp.JVppRegistryImpl; @@ -30,9 +30,9 @@ import java.nio.charset.StandardCharsets; /** * CallbackJVppFacade together with CallbackJVppFacadeCallback allow for setting different callback for each request. - * This is more convenient than the approach shown in CallbackApiTest. + * This is more convenient than the approach shown in CallbackApiExample. */ -public class CallbackJVppFacadeTest { +public class CallbackJVppFacadeExample { private static ShowVersionCallback showVersionCallback1 = new ShowVersionCallback() { @Override @@ -87,7 +87,7 @@ public class CallbackJVppFacadeTest { private static void testCallbackFacade() throws Exception { System.out.println("Testing CallbackJVppFacade"); - try (final JVppRegistry registry = new JVppRegistryImpl("CallbackFacadeTest"); + try (final JVppRegistry registry = new JVppRegistryImpl("CallbackFacadeExample"); final CallbackJVppCoreFacade callbackFacade = new CallbackJVppCoreFacade(registry, new JVppCoreImpl())) { System.out.println("Successfully connected to VPP"); diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeNotificationTest.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeNotificationExample.java index d84cb034ef1..b8b108b602e 100644 --- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeNotificationTest.java +++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeNotificationExample.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.vpp.jvpp.core.test; +package io.fd.vpp.jvpp.core.examples; import io.fd.vpp.jvpp.JVppRegistry; import io.fd.vpp.jvpp.JVppRegistryImpl; @@ -25,12 +25,12 @@ import io.fd.vpp.jvpp.core.callback.WantInterfaceEventsCallback; import io.fd.vpp.jvpp.core.callfacade.CallbackJVppCoreFacade; import io.fd.vpp.jvpp.core.dto.WantInterfaceEventsReply; -public class CallbackJVppFacadeNotificationTest { +public class CallbackJVppFacadeNotificationExample { private static void testCallbackFacade() throws Exception { System.out.println("Testing CallbackJVppFacade for notifications"); - try (final JVppRegistry registry = new JVppRegistryImpl("CallbackFacadeTest"); + try (final JVppRegistry registry = new JVppRegistryImpl("CallbackFacadeExample"); final JVppCore jvpp = new JVppCoreImpl()) { final CallbackJVppCoreFacade jvppCallbackFacade = new CallbackJVppCoreFacade(registry, jvpp); System.out.println("Successfully connected to VPP"); diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackNotificationApiTest.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackNotificationApiExample.java index a9f71f11b00..6ee2de31bc8 100644 --- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackNotificationApiTest.java +++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackNotificationApiExample.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package io.fd.vpp.jvpp.core.test; +package io.fd.vpp.jvpp.core.examples; -import static io.fd.vpp.jvpp.core.test.NotificationUtils.getChangeInterfaceState; -import static io.fd.vpp.jvpp.core.test.NotificationUtils.getDisableInterfaceNotificationsReq; -import static io.fd.vpp.jvpp.core.test.NotificationUtils.getEnableInterfaceNotificationsReq; -import static io.fd.vpp.jvpp.core.test.NotificationUtils.printNotification; +import static io.fd.vpp.jvpp.core.examples.NotificationUtils.getChangeInterfaceState; +import static io.fd.vpp.jvpp.core.examples.NotificationUtils.getDisableInterfaceNotificationsReq; +import static io.fd.vpp.jvpp.core.examples.NotificationUtils.getEnableInterfaceNotificationsReq; +import static io.fd.vpp.jvpp.core.examples.NotificationUtils.printNotification; import io.fd.vpp.jvpp.JVpp; import io.fd.vpp.jvpp.JVppRegistry; @@ -33,11 +33,11 @@ import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsNotification; import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsReply; import io.fd.vpp.jvpp.core.dto.WantInterfaceEventsReply; -public class CallbackNotificationApiTest { +public class CallbackNotificationApiExample { private static void testCallbackApi() throws Exception { System.out.println("Testing Java callback API for notifications"); - try (final JVppRegistry registry = new JVppRegistryImpl("CallbackNotificationTest"); + try (final JVppRegistry registry = new JVppRegistryImpl("CallbackNotificationApiExample"); final JVpp jvpp = new JVppCoreImpl()) { registry.register(jvpp, new TestCallback()); System.out.println("Successfully connected to VPP"); diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CreateSubInterfaceExample.java index 7684721f388..3db6d30a13e 100644 --- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java +++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CreateSubInterfaceExample.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.vpp.jvpp.core.test; +package io.fd.vpp.jvpp.core.examples; import static java.util.Objects.requireNonNull; @@ -42,7 +42,7 @@ import java.nio.charset.StandardCharsets; * vat# sw_interface_dump * } */ -public class CreateSubInterfaceTest { +public class CreateSubInterfaceExample { private static SwInterfaceDump createSwInterfaceDumpRequest(final String ifaceName) { SwInterfaceDump request = new SwInterfaceDump(); @@ -82,12 +82,12 @@ public class CreateSubInterfaceTest { private static void testCreateSubInterface() throws Exception { System.out.println("Testing sub-interface creation using Java callback API"); - try (final JVppRegistry registry = new JVppRegistryImpl("CreateSubInterface"); + try (final JVppRegistry registry = new JVppRegistryImpl("CreateSubInterfaceExample"); final FutureJVppCoreFacade jvppFacade = new FutureJVppCoreFacade(registry, new JVppCoreImpl())) { System.out.println("Successfully connected to VPP"); Thread.sleep(1000); - final String ifaceName = "GigabitEthernet0/8/0"; + final String ifaceName = "Gigabitethernet0/8/0"; final SwInterfaceDetailsReplyDump swInterfaceDetails = jvppFacade.swInterfaceDump(createSwInterfaceDumpRequest(ifaceName)).toCompletableFuture().get(); @@ -103,7 +103,7 @@ public class CreateSubInterfaceTest { jvppFacade.createSubif(createSubifRequest(swIfIndex, subId)).toCompletableFuture().get(); print(createSubifReply); - final String subIfaceName = "GigabitEthernet0/8/0." + subId; + final String subIfaceName = "Gigabitethernet0/8/0." + subId; final SwInterfaceDetailsReplyDump subIface = jvppFacade.swInterfaceDump(createSwInterfaceDumpRequest(subIfaceName)).toCompletableFuture().get(); requireNonNull(swInterfaceDetails, "swInterfaceDump returned null"); diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/FutureApiExample.java index 63659f82c63..931c9b337aa 100644 --- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java +++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/FutureApiExample.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.vpp.jvpp.core.test; +package io.fd.vpp.jvpp.core.examples; import io.fd.vpp.jvpp.JVppRegistry; import io.fd.vpp.jvpp.JVppRegistryImpl; @@ -36,9 +36,9 @@ import java.util.concurrent.Future; import java.util.logging.Level; import java.util.logging.Logger; -public class FutureApiTest { +public class FutureApiExample { - private static final Logger LOG = Logger.getLogger(FutureApiTest.class.getName()); + private static final Logger LOG = Logger.getLogger(FutureApiExample.class.getName()); private static void testShowVersion(final FutureJVppCoreFacade jvpp) throws Exception { LOG.info("Sending ShowVersion request..."); @@ -108,7 +108,7 @@ public class FutureApiTest { private static void testFutureApi() throws Exception { LOG.info("Testing Java future API"); - try (final JVppRegistry registry = new JVppRegistryImpl("FutureApiTest"); + try (final JVppRegistry registry = new JVppRegistryImpl("FutureApiExample"); final FutureJVppCoreFacade jvppFacade = new FutureJVppCoreFacade(registry, new JVppCoreImpl())) { LOG.info("Successfully connected to VPP"); diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiNotificationTest.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/FutureApiNotificationExample.java index 9efeae19f8b..f445dcc87e4 100644 --- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiNotificationTest.java +++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/FutureApiNotificationExample.java @@ -14,22 +14,22 @@ * limitations under the License. */ -package io.fd.vpp.jvpp.core.test; +package io.fd.vpp.jvpp.core.examples; -import static io.fd.vpp.jvpp.core.test.NotificationUtils.getChangeInterfaceState; -import static io.fd.vpp.jvpp.core.test.NotificationUtils.getDisableInterfaceNotificationsReq; -import static io.fd.vpp.jvpp.core.test.NotificationUtils.getEnableInterfaceNotificationsReq; +import static io.fd.vpp.jvpp.core.examples.NotificationUtils.getChangeInterfaceState; +import static io.fd.vpp.jvpp.core.examples.NotificationUtils.getDisableInterfaceNotificationsReq; +import static io.fd.vpp.jvpp.core.examples.NotificationUtils.getEnableInterfaceNotificationsReq; import io.fd.vpp.jvpp.JVppRegistry; import io.fd.vpp.jvpp.JVppRegistryImpl; import io.fd.vpp.jvpp.core.JVppCoreImpl; import io.fd.vpp.jvpp.core.future.FutureJVppCoreFacade; -public class FutureApiNotificationTest { +public class FutureApiNotificationExample { private static void testFutureApi() throws Exception { System.out.println("Testing Java future API for notifications"); - try (final JVppRegistry registry = new JVppRegistryImpl("FutureApiNotificationTest"); + try (final JVppRegistry registry = new JVppRegistryImpl("FutureApiNotificationExample"); final FutureJVppCoreFacade jvppFacade = new FutureJVppCoreFacade(registry, new JVppCoreImpl()); final AutoCloseable notificationListenerReg = jvppFacade.getNotificationRegistry() diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/L2AclTest.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/L2AclExample.java index 6b3fa993f4d..f89043a3b0a 100644 --- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/L2AclTest.java +++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/L2AclExample.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.vpp.jvpp.core.test; +package io.fd.vpp.jvpp.core.examples; import io.fd.vpp.jvpp.JVppRegistry; import io.fd.vpp.jvpp.JVppRegistryImpl; @@ -47,7 +47,7 @@ import javax.xml.bind.DatatypeConverter; * } * </pre> */ -public class L2AclTest { +public class L2AclExample { private static final int LOCAL0_IFACE_ID = 0; @@ -146,7 +146,7 @@ public class L2AclTest { private static void testL2Acl() throws Exception { System.out.println("Testing L2 ACLs using Java callback API"); - try (final JVppRegistry registry = new JVppRegistryImpl("L2AclTest"); + try (final JVppRegistry registry = new JVppRegistryImpl("L2AclExample"); final FutureJVppCoreFacade jvppFacade = new FutureJVppCoreFacade(registry, new JVppCoreImpl())) { System.out.println("Successfully connected to VPP"); diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/LispAdjacencyTest.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/LispAdjacencyExample.java index e7b17335748..f637669dae1 100644 --- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/LispAdjacencyTest.java +++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/LispAdjacencyExample.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.vpp.jvpp.core.test; +package io.fd.vpp.jvpp.core.examples; import io.fd.vpp.jvpp.JVppRegistry; import io.fd.vpp.jvpp.JVppRegistryImpl; @@ -34,9 +34,9 @@ import java.util.logging.Logger; /** * Tests lisp adjacency creation and read (custom vpe.api type support showcase). */ -public class LispAdjacencyTest { +public class LispAdjacencyExample { - private static final Logger LOG = Logger.getLogger(LispAdjacencyTest.class.getName()); + private static final Logger LOG = Logger.getLogger(LispAdjacencyExample.class.getName()); private static void enableLisp(final FutureJVppCoreFacade jvpp) throws ExecutionException, InterruptedException { final LispEnableDisable request = new LispEnableDisable(); @@ -110,7 +110,7 @@ public class LispAdjacencyTest { private static void testFutureApi() throws Exception { LOG.info("Create lisp adjacency test"); - try (final JVppRegistry registry = new JVppRegistryImpl("LispAdjacencyTest"); + try (final JVppRegistry registry = new JVppRegistryImpl("LispAdjacencyExample"); final FutureJVppCoreFacade jvppFacade = new FutureJVppCoreFacade(registry, new JVppCoreImpl())) { LOG.info("Successfully connected to VPP"); diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/NotificationUtils.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/NotificationUtils.java index f82946c3a5f..7791cafe2a7 100644 --- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/NotificationUtils.java +++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/NotificationUtils.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.fd.vpp.jvpp.core.test; +package io.fd.vpp.jvpp.core.examples; import java.io.PrintStream; import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlags; diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/Readme.txt b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/Readme.txt new file mode 100644 index 00000000000..d1c79dd8707 --- /dev/null +++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/Readme.txt @@ -0,0 +1,16 @@ +This package contains basic examples for jvpp. To run the examples: + +- Make sure VPP is running +- From VPP's build-root/ folder execute: + - sudo java -cp build-vpp-native/vpp/vpp-api/java/jvpp-registry-17.10.jar:build-vpp-native/vpp/vpp-api/java/jvpp-core-17.10.jar io.fd.vpp.jvpp.core.examples.[test name] + +Available examples: +CallbackApiExample - Similar to ControlPingTest, invokes more complex calls (e.g. interface dump) using low level JVpp APIs +CallbackJVppFacadeNotificationExample - Example of interface notifications using Callback based JVpp facade +CallbackJVppFacadeExample - Execution of more complex calls using Callback based JVpp facade +CallbackNotificationApiExample - Example of interface notifications using low level JVpp APIs +CreateSubInterfaceExample - Example of sub-interface creation +FutureApiNotificationExample - Example of interface notifications using Future based JVpp facade +FutureApiExample - Execution of more complex calls using Future based JVpp facade +L2AclExample - Example of L2 ACL creation +LispAdjacencyExample - Example of lisp adjacency creation and read (custom vpe.api type support showcase) diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/ControlPingTest.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/ControlPingTest.java deleted file mode 100644 index e97f4e3ac9a..00000000000 --- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/ControlPingTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2016 Cisco and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.fd.vpp.jvpp.core.test; - -import io.fd.vpp.jvpp.JVpp; -import io.fd.vpp.jvpp.JVppRegistry; -import io.fd.vpp.jvpp.JVppRegistryImpl; -import io.fd.vpp.jvpp.VppCallbackException; -import io.fd.vpp.jvpp.callback.ControlPingCallback; -import io.fd.vpp.jvpp.core.JVppCoreImpl; -import io.fd.vpp.jvpp.dto.ControlPing; -import io.fd.vpp.jvpp.dto.ControlPingReply; - -public class ControlPingTest { - - private static void testControlPing() throws Exception { - System.out.println("Testing ControlPing using Java callback API"); - try (JVppRegistry registry = new JVppRegistryImpl("ControlPingTest"); - JVpp jvpp = new JVppCoreImpl()) { - - registry.register(jvpp, new ControlPingCallback() { - @Override - public void onControlPingReply(final ControlPingReply reply) { - System.out.printf("Received ControlPingReply: %s%n", reply); - } - - @Override - public void onError(VppCallbackException ex) { - System.out.printf("Received onError exception: call=%s, reply=%d, context=%d ", ex.getMethodName(), - ex.getErrorCode(), ex.getCtxId()); - } - - }); - System.out.println("Successfully connected to VPP"); - Thread.sleep(1000); - - System.out.println("Sending control ping using JVppRegistry"); - registry.controlPing(jvpp.getClass()); - - Thread.sleep(2000); - - System.out.println("Sending control ping using JVpp plugin"); - jvpp.send(new ControlPing()); - - Thread.sleep(2000); - System.out.println("Disconnecting..."); - } - Thread.sleep(1000); - } - - public static void main(String[] args) throws Exception { - testControlPing(); - } -} diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/Readme.txt b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/Readme.txt deleted file mode 100644 index 1344dc9ebdb..00000000000 --- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/Readme.txt +++ /dev/null @@ -1,17 +0,0 @@ -This package contains basic tests for jvpp. To run the tests: - -- Make sure VPP is running -- From VPP's build-root/ folder execute: - - sudo java -cp build-vpp-native/vpp-api/java/jvpp-registry-17.01.jar:build-vpp-native/vpp-api/java/jvpp-core-17.01.jar io.fd.vpp.jvpp.core.test.[test name] - -Available tests: -CallbackApiTest - Similar to ControlPingTest, invokes more complex calls (e.g. interface dump) using low level JVpp APIs -CallbackJVppFacadeNotificationTest - Tests interface notifications using Callback based JVpp facade -CallbackJVppFacadeTest - Execution of more complex calls using Callback based JVpp facade -CallbackNotificationApiTest - Tests interface notifications using low level JVpp APIs -ControlPingTest - Simple test executing a single control ping using low level JVpp APIs -CreateSubInterfaceTest - Tests sub-interface creation -FutureApiNotificationTest - Tests interface notifications using Future based JVpp facade -FutureApiTest - Execution of more complex calls using Future based JVpp facade -L2AclTest - Tests L2 ACL creation -LispAdjacencyTest - Tests lisp adjacency creation and read (custom vpe.api type support showcase) |