* limitations under the License.
*/
-package io.fd.vpp.jvpp.acl.test;
-
-
-import static io.fd.vpp.jvpp.acl.test.AclTestData.FIRST_RULE_ADDRESS_2_AS_ARRAY;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.FIRST_RULE_ADDRESS_AS_ARRAY;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.FIRST_RULE_DST_ICMP_TYPE_END;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.FIRST_RULE_DST_ICMP_TYPE_START;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.FIRST_RULE_MAC;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.FIRST_RULE_MAC_MASK;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.FIRST_RULE_PREFIX;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.FIRST_RULE_PREFIX_2;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.FIRST_RULE_SRC_ICMP_TYPE_END;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.FIRST_RULE_SRC_ICMP_TYPE_START;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.ICMP_PROTOCOL;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.SECOND_RULE_ADDRESS_2_AS_ARRAY;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.SECOND_RULE_ADDRESS_AS_ARRAY;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.SECOND_RULE_DST_PORT_RANGE_END;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.SECOND_RULE_DST_PORT_RANGE_START;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.SECOND_RULE_MAC;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.SECOND_RULE_MAC_MASK;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.SECOND_RULE_PREFIX;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.SECOND_RULE_PREFIX_2;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.SECOND_RULE_SRC_PORT_RANGE_END;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.SECOND_RULE_SRC_PORT_RANGE_START;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.UDP_PROTOCOL;
+package io.fd.vpp.jvpp.acl.examples;
+
+
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.FIRST_RULE_ADDRESS_2_AS_ARRAY;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.FIRST_RULE_ADDRESS_AS_ARRAY;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.FIRST_RULE_DST_ICMP_TYPE_END;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.FIRST_RULE_DST_ICMP_TYPE_START;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.FIRST_RULE_MAC;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.FIRST_RULE_MAC_MASK;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.FIRST_RULE_PREFIX;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.FIRST_RULE_PREFIX_2;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.FIRST_RULE_SRC_ICMP_TYPE_END;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.FIRST_RULE_SRC_ICMP_TYPE_START;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.ICMP_PROTOCOL;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.SECOND_RULE_ADDRESS_2_AS_ARRAY;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.SECOND_RULE_ADDRESS_AS_ARRAY;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.SECOND_RULE_DST_PORT_RANGE_END;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.SECOND_RULE_DST_PORT_RANGE_START;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.SECOND_RULE_MAC;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.SECOND_RULE_MAC_MASK;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.SECOND_RULE_PREFIX;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.SECOND_RULE_PREFIX_2;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.SECOND_RULE_SRC_PORT_RANGE_END;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.SECOND_RULE_SRC_PORT_RANGE_START;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.UDP_PROTOCOL;
import io.fd.vpp.jvpp.acl.dto.AclDetails;
import io.fd.vpp.jvpp.acl.dto.AclInterfaceListDetails;
* limitations under the License.
*/
-package io.fd.vpp.jvpp.acl.test;
+package io.fd.vpp.jvpp.acl.examples;
import io.fd.vpp.jvpp.acl.types.AclRule;
* limitations under the License.
*/
-package io.fd.vpp.jvpp.acl.test;
+package io.fd.vpp.jvpp.acl.examples;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.createAclRules;
-import static io.fd.vpp.jvpp.acl.test.AclTestData.createMacipRules;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.createAclRules;
+import static io.fd.vpp.jvpp.acl.examples.AclTestData.createMacipRules;
import io.fd.vpp.jvpp.VppInvocationException;
import io.fd.vpp.jvpp.acl.dto.AclAddReplace;
* limitations under the License.
*/
-package io.fd.vpp.jvpp.acl.test;
+package io.fd.vpp.jvpp.acl.examples;
-import static io.fd.vpp.jvpp.acl.test.AclExpectedDumpData.verifyAclDump;
-import static io.fd.vpp.jvpp.acl.test.AclExpectedDumpData.verifyAclInterfaceList;
-import static io.fd.vpp.jvpp.acl.test.AclExpectedDumpData.verifyMacIpDump;
-import static io.fd.vpp.jvpp.acl.test.AclTestRequests.sendAclAddRequest;
-import static io.fd.vpp.jvpp.acl.test.AclTestRequests.sendAclDelRequest;
-import static io.fd.vpp.jvpp.acl.test.AclTestRequests.sendAclDumpRequest;
-import static io.fd.vpp.jvpp.acl.test.AclTestRequests.sendAclInterfaceDeleteList;
-import static io.fd.vpp.jvpp.acl.test.AclTestRequests.sendAclInterfaceListDumpRequest;
-import static io.fd.vpp.jvpp.acl.test.AclTestRequests.sendAclInterfaceSetAclList;
-import static io.fd.vpp.jvpp.acl.test.AclTestRequests.sendMacIpAddRequest;
-import static io.fd.vpp.jvpp.acl.test.AclTestRequests.sendMacIpDelRequest;
-import static io.fd.vpp.jvpp.acl.test.AclTestRequests.sendMacIpDumpRequest;
+import static io.fd.vpp.jvpp.acl.examples.AclExpectedDumpData.verifyAclDump;
+import static io.fd.vpp.jvpp.acl.examples.AclExpectedDumpData.verifyAclInterfaceList;
+import static io.fd.vpp.jvpp.acl.examples.AclExpectedDumpData.verifyMacIpDump;
+import static io.fd.vpp.jvpp.acl.examples.AclTestRequests.sendAclAddRequest;
+import static io.fd.vpp.jvpp.acl.examples.AclTestRequests.sendAclDelRequest;
+import static io.fd.vpp.jvpp.acl.examples.AclTestRequests.sendAclDumpRequest;
+import static io.fd.vpp.jvpp.acl.examples.AclTestRequests.sendAclInterfaceDeleteList;
+import static io.fd.vpp.jvpp.acl.examples.AclTestRequests.sendAclInterfaceListDumpRequest;
+import static io.fd.vpp.jvpp.acl.examples.AclTestRequests.sendAclInterfaceSetAclList;
+import static io.fd.vpp.jvpp.acl.examples.AclTestRequests.sendMacIpAddRequest;
+import static io.fd.vpp.jvpp.acl.examples.AclTestRequests.sendMacIpDelRequest;
+import static io.fd.vpp.jvpp.acl.examples.AclTestRequests.sendMacIpDumpRequest;
import io.fd.vpp.jvpp.JVppRegistry;
import io.fd.vpp.jvpp.JVppRegistryImpl;
import io.fd.vpp.jvpp.acl.JVppAclImpl;
import io.fd.vpp.jvpp.acl.future.FutureJVppAclFacade;
-public class FutureApiTest {
+public class FutureApiExample {
public static void main(String[] args) throws Exception {
testCallbackApi();
--- /dev/null
+sudo java -cp build-vpp-native/vpp/vpp-api/java/jvpp-registry-17.10.jar:build-vpp-native/vpp/vpp-api/java/jvpp-acl-17.10.jar io.fd.vpp.jvpp.acl.examples.FutureApiExample
+++ /dev/null
-sudo java -cp build-vpp-native/vpp-api/java/jvpp-registry-17.01.jar:build-vpp-native/plugins/acl-plugin/jvpp-acl-1.0.jar io.fd.vpp.jvpp.acl.test.FutureApiTest
* 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;
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();
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());
* 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;
/**
* 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
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");
* 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;
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");
* 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;
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");
* limitations under the License.
*/
-package io.fd.vpp.jvpp.core.test;
+package io.fd.vpp.jvpp.core.examples;
import static java.util.Objects.requireNonNull;
* vat# sw_interface_dump
* }
*/
-public class CreateSubInterfaceTest {
+public class CreateSubInterfaceExample {
private static SwInterfaceDump createSwInterfaceDumpRequest(final String ifaceName) {
SwInterfaceDump request = new SwInterfaceDump();
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();
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");
* 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;
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...");
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");
* 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()
* 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;
* }
* </pre>
*/
-public class L2AclTest {
+public class L2AclExample {
private static final int LOCAL0_IFACE_ID = 0;
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");
* 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;
/**
* 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();
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");
* 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;
--- /dev/null
+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)
+++ /dev/null
-/*
- * 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();
- }
-}
+++ /dev/null
-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)
* limitations under the License.
*/
-package io.fd.vpp.jvpp.ioamexport.test;
+package io.fd.vpp.jvpp.ioamexport.examples;
import java.net.InetAddress;
import io.fd.vpp.jvpp.ioamexport.dto.IoamExportIp6EnableDisable;
import io.fd.vpp.jvpp.ioamexport.dto.IoamExportIp6EnableDisableReply;
-public class IoamExportApiTest {
+public class IoamExportApiExample {
public static void main(String[] args) throws Exception {
ioamExportTestApi();
private static void ioamExportTestApi() throws Exception {
System.out.println("Testing Java API for ioam export plugin");
- try (final JVppRegistry registry = new JVppRegistryImpl("ioamExportApiTest");
+ try (final JVppRegistry registry = new JVppRegistryImpl("ioamExportApiExample");
final JVpp jvpp = new JVppIoamexportImpl()) {
FutureJVppIoamexportFacade ioamexportJvpp = new FutureJVppIoamexportFacade(registry,jvpp);
System.out.println("Sending ioam export request...");
--- /dev/null
+sudo java -cp build-vpp-native/vpp/vpp-api/java/jvpp-registry-17.10.jar:build-vpp-native/vpp/vpp-api/java/jvpp-ioamexport-17.10.jar io.fd.vpp.jvpp.ioamexport.examples.IoamExportApiExample
+++ /dev/null
-sudo java -cp build-vpp_debug-native/vpp-api/java/jvpp-registry-17.01.jar:build-vpp_debug-native/plugins/ioam-plugin/jvpp-ioam-export-1.0.jar io.fd.vpp.jvpp.ioamexport.test.IoamExportApiTest
* limitations under the License.
*/
-package io.fd.vpp.jvpp.ioampot.test;
+package io.fd.vpp.jvpp.ioampot.examples;
import io.fd.vpp.jvpp.JVpp;
import io.fd.vpp.jvpp.JVppRegistry;
import io.fd.vpp.jvpp.ioampot.dto.PotProfileAddReply;
import java.nio.charset.StandardCharsets;
-public class IoamPotApiTest {
+public class IoamPotApiExample {
static class IoamPotTestCallback implements PotProfileAddCallback {
private static void ioamPotTestApi() throws Exception {
System.out.println("Testing Java API for ioam pot plugin");
- try (final JVppRegistry registry = new JVppRegistryImpl("ioamPotApiTest");
+ try (final JVppRegistry registry = new JVppRegistryImpl("ioamPotApiExample");
final JVpp jvpp = new JVppIoampotImpl()) {
registry.register(jvpp, new IoamPotTestCallback());
--- /dev/null
+sudo java -cp build-vpp-native/vpp/vpp-api/java/jvpp-registry-17.10.jar:build-vpp-native/vpp/vpp-api/java/jvpp-ioampot-17.10.jar io.fd.vpp.jvpp.ioampot.examples.IoamPotApiExample
+++ /dev/null
-sudo java -cp build-vpp_debug-native/vpp-api/java/jvpp-registry-16.12.jar:build-vpp_debug-native/plugins/ioam-plugin/jvpp-ioam-pot-1.0.jar io.fd.vpp.jvpp.ioampot.test.IoamPotApiTest
* limitations under the License.
*/
-package io.fd.vpp.jvpp.ioamtrace.test;
+package io.fd.vpp.jvpp.ioamtrace.examples;
import io.fd.vpp.jvpp.JVpp;
import io.fd.vpp.jvpp.JVppRegistry;
import io.fd.vpp.jvpp.ioamtrace.dto.TraceProfileShowConfig;
import io.fd.vpp.jvpp.ioamtrace.dto.TraceProfileShowConfigReply;
-public class IoamTraceApiTest {
+public class IoamTraceApiExample {
static class IoamTraceTestCallback implements TraceProfileAddCallback {
--- /dev/null
+sudo java -cp build-vpp-native/vpp/vpp-api/java/jvpp-registry-17.10.jar:build-vpp-native/vpp/vpp-api/java/jvpp-ioamtrace-17.10.jar io.fd.vpp.jvpp.ioamtrace.examples.IoamTraceApiExample
+++ /dev/null
-sudo java -cp build-vpp-native/vpp-api/java/jvpp-registry-17.01.jar:build-vpp-native/plugins/ioam-plugin/jvpp-ioam-trace-1.0.jar io.fd.vpp.jvpp.ioamtrace.test.IoamTraceApiTest
* limitations under the License.
*/
-package io.fd.vpp.jvpp.snat.test;
+package io.fd.vpp.jvpp.snat.examples;
import io.fd.vpp.jvpp.JVpp;
import io.fd.vpp.jvpp.JVppRegistry;
import io.fd.vpp.jvpp.snat.dto.SnatInterfaceAddDelFeature;
import io.fd.vpp.jvpp.snat.dto.SnatInterfaceAddDelFeatureReply;
-public class CallbackApiTest {
+public class CallbackApiExample {
static class TestCallback implements SnatInterfaceAddDelFeatureCallback {
--- /dev/null
+sudo java -cp build-vpp-native/vpp/vpp-api/java/jvpp-registry-17.10.jar:build-vpp-native/vpp/vpp-api/java/jvpp-snat-17.10.jar io.fd.vpp.jvpp.snat.examples.CallbackApiExample
+++ /dev/null
-sudo java -cp build-vpp-native/vpp-api/java/jvpp-registry-17.01.jar:build-vpp-native/plugins/snat-plugin/jvpp-snat-1.0.jar io.fd.vpp.jvpp.snat.test.CallbackApiTest