summaryrefslogtreecommitdiffstats
path: root/vpp-api/java/jvpp-core
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-12-28 18:38:59 +0100
committerDamjan Marion <damarion@cisco.com>2017-01-01 18:11:43 +0100
commitcb034b9b374927c7552e36dcbc306d8456b2a0cb (patch)
tree9ff64f9792560630c8cf8faa2f74fc20671c30f1 /vpp-api/java/jvpp-core
parentfdc62abdc113ea63dc867375bd49ef3043dcd290 (diff)
Move java,lua api and remaining plugins to src/
Change-Id: I1c3b87e886603678368428ae56a6bd3327cbc90d Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vpp-api/java/jvpp-core')
-rw-r--r--vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java96
-rw-r--r--vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeNotificationTest.java87
-rw-r--r--vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java103
-rw-r--r--vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackNotificationApiTest.java94
-rw-r--r--vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/ControlPingTest.java68
-rw-r--r--vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java120
-rw-r--r--vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiNotificationTest.java55
-rw-r--r--vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java123
-rw-r--r--vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/L2AclTest.java195
-rw-r--r--vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/LispAdjacencyTest.java124
-rw-r--r--vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/NotificationUtils.java53
-rw-r--r--vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/Readme.txt17
-rw-r--r--vpp-api/java/jvpp-core/jvpp_core.c117
13 files changed, 0 insertions, 1252 deletions
diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java
deleted file mode 100644
index 986993b854f..00000000000
--- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackApiTest.java
+++ /dev/null
@@ -1,96 +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.core.JVppCoreImpl;
-import io.fd.vpp.jvpp.core.callback.GetNodeIndexCallback;
-import io.fd.vpp.jvpp.core.callback.ShowVersionCallback;
-import io.fd.vpp.jvpp.core.callback.SwInterfaceCallback;
-import io.fd.vpp.jvpp.core.dto.GetNodeIndex;
-import io.fd.vpp.jvpp.core.dto.GetNodeIndexReply;
-import io.fd.vpp.jvpp.core.dto.ShowVersion;
-import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
-
-public class CallbackApiTest {
-
- 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");
- final JVpp jvpp = new JVppCoreImpl()) {
- registry.register(jvpp, new TestCallback());
-
- System.out.println("Sending ShowVersion request...");
- final int result = jvpp.send(new ShowVersion());
- System.out.printf("ShowVersion send result = %d%n", result);
-
- System.out.println("Sending GetNodeIndex request...");
- GetNodeIndex getNodeIndexRequest = new GetNodeIndex();
- getNodeIndexRequest.nodeName = "non-existing-node".getBytes();
- jvpp.send(getNodeIndexRequest);
-
- System.out.println("Sending SwInterfaceDump request...");
- SwInterfaceDump swInterfaceDumpRequest = new SwInterfaceDump();
- swInterfaceDumpRequest.nameFilterValid = 0;
- swInterfaceDumpRequest.nameFilter = "".getBytes();
- jvpp.send(swInterfaceDumpRequest);
-
- Thread.sleep(1000);
- System.out.println("Disconnecting...");
- }
- Thread.sleep(1000);
- }
-
- static class TestCallback implements GetNodeIndexCallback, ShowVersionCallback, SwInterfaceCallback {
-
- @Override
- public void onGetNodeIndexReply(final GetNodeIndexReply msg) {
- System.out.printf("Received GetNodeIndexReply: %s%n", msg);
- }
-
- @Override
- 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));
- }
-
- @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,
- msg.linkUpDown, msg.linkSpeed, (int) msg.linkMtu);
- }
-
- @Override
- public void onError(VppCallbackException ex) {
- System.out.printf("Received onError exception: call=%s, context=%d, retval=%d%n", ex.getMethodName(),
- ex.getCtxId(), ex.getErrorCode());
- }
- }
-}
diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeNotificationTest.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeNotificationTest.java
deleted file mode 100644
index d84cb034ef1..00000000000
--- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeNotificationTest.java
+++ /dev/null
@@ -1,87 +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.JVppRegistry;
-import io.fd.vpp.jvpp.JVppRegistryImpl;
-import io.fd.vpp.jvpp.VppCallbackException;
-import io.fd.vpp.jvpp.core.JVppCore;
-import io.fd.vpp.jvpp.core.JVppCoreImpl;
-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 {
-
- private static void testCallbackFacade() throws Exception {
- System.out.println("Testing CallbackJVppFacade for notifications");
-
- try (final JVppRegistry registry = new JVppRegistryImpl("CallbackFacadeTest");
- final JVppCore jvpp = new JVppCoreImpl()) {
- final CallbackJVppCoreFacade jvppCallbackFacade = new CallbackJVppCoreFacade(registry, jvpp);
- System.out.println("Successfully connected to VPP");
-
- final AutoCloseable notificationListenerReg =
- jvppCallbackFacade.getNotificationRegistry().registerSwInterfaceSetFlagsNotificationCallback(
- NotificationUtils::printNotification
- );
-
- jvppCallbackFacade.wantInterfaceEvents(NotificationUtils.getEnableInterfaceNotificationsReq(),
- new WantInterfaceEventsCallback() {
- @Override
- public void onWantInterfaceEventsReply(final WantInterfaceEventsReply reply) {
- System.out.println("Interface events started");
- }
-
- @Override
- public void onError(final VppCallbackException ex) {
- System.out.printf("Received onError exception: call=%s, context=%d, retval=%d%n",
- ex.getMethodName(), ex.getCtxId(), ex.getErrorCode());
- }
- });
-
- System.out.println("Changing interface configuration");
- NotificationUtils.getChangeInterfaceState().send(jvpp);
-
- Thread.sleep(1000);
-
- jvppCallbackFacade.wantInterfaceEvents(NotificationUtils.getDisableInterfaceNotificationsReq(),
- new WantInterfaceEventsCallback() {
- @Override
- public void onWantInterfaceEventsReply(final WantInterfaceEventsReply reply) {
- System.out.println("Interface events stopped");
- }
-
- @Override
- public void onError(final VppCallbackException ex) {
- System.out.printf("Received onError exception: call=%s, context=%d, retval=%d%n",
- ex.getMethodName(), ex.getCtxId(), ex.getErrorCode());
- }
- });
-
- notificationListenerReg.close();
-
- Thread.sleep(2000);
- System.out.println("Disconnecting...");
- }
- Thread.sleep(1000);
- }
-
- public static void main(String[] args) throws Exception {
- testCallbackFacade();
- }
-}
diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java
deleted file mode 100644
index 9f7cb8deadc..00000000000
--- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackJVppFacadeTest.java
+++ /dev/null
@@ -1,103 +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.JVppRegistry;
-import io.fd.vpp.jvpp.JVppRegistryImpl;
-import io.fd.vpp.jvpp.VppCallbackException;
-import io.fd.vpp.jvpp.core.JVppCoreImpl;
-import io.fd.vpp.jvpp.core.callback.GetNodeIndexCallback;
-import io.fd.vpp.jvpp.core.callback.ShowVersionCallback;
-import io.fd.vpp.jvpp.core.callfacade.CallbackJVppCoreFacade;
-import io.fd.vpp.jvpp.core.dto.GetNodeIndex;
-import io.fd.vpp.jvpp.core.dto.GetNodeIndexReply;
-import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
-
-/**
- * CallbackJVppFacade together with CallbackJVppFacadeCallback allow for setting different callback for each request.
- * This is more convenient than the approach shown in CallbackApiTest.
- */
-public class CallbackJVppFacadeTest {
-
- private static ShowVersionCallback showVersionCallback1 = new ShowVersionCallback() {
- @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));
- }
-
- @Override
- public void onError(VppCallbackException ex) {
- System.out.printf("Received onError exception in showVersionCallback1: call=%s, reply=%d, context=%d%n",
- ex.getMethodName(), ex.getErrorCode(), ex.getCtxId());
- }
- };
-
- private static ShowVersionCallback showVersionCallback2 = new ShowVersionCallback() {
- @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));
- }
-
- @Override
- public void onError(VppCallbackException ex) {
- System.out.printf("Received onError exception in showVersionCallback2: call=%s, reply=%d, context=%d%n",
- ex.getMethodName(), ex.getErrorCode(), ex.getCtxId());
- }
-
- };
-
- private static GetNodeIndexCallback getNodeIndexCallback = new GetNodeIndexCallback() {
- @Override
- public void onGetNodeIndexReply(final GetNodeIndexReply msg) {
- System.out.printf("Received GetNodeIndexReply: %s%n", msg);
- }
-
- @Override
- public void onError(VppCallbackException ex) {
- System.out.printf("Received onError exception in getNodeIndexCallback: call=%s, reply=%d, context=%d%n",
- ex.getMethodName(), ex.getErrorCode(), ex.getCtxId());
- }
- };
-
- private static void testCallbackFacade() throws Exception {
- System.out.println("Testing CallbackJVppFacade");
-
- try (final JVppRegistry registry = new JVppRegistryImpl("CallbackFacadeTest");
- final CallbackJVppCoreFacade callbackFacade = new CallbackJVppCoreFacade(registry, new JVppCoreImpl())) {
- System.out.println("Successfully connected to VPP");
-
- callbackFacade.showVersion(showVersionCallback1);
- callbackFacade.showVersion(showVersionCallback2);
-
- GetNodeIndex getNodeIndexRequest = new GetNodeIndex();
- getNodeIndexRequest.nodeName = "dummyNode".getBytes();
- callbackFacade.getNodeIndex(getNodeIndexRequest, getNodeIndexCallback);
-
- Thread.sleep(2000);
- System.out.println("Disconnecting...");
- }
- Thread.sleep(1000);
- }
-
- public static void main(String[] args) throws Exception {
- testCallbackFacade();
- }
-}
diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackNotificationApiTest.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackNotificationApiTest.java
deleted file mode 100644
index a9f71f11b00..00000000000
--- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CallbackNotificationApiTest.java
+++ /dev/null
@@ -1,94 +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 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 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.core.JVppCoreImpl;
-import io.fd.vpp.jvpp.core.callback.SwInterfaceSetFlagsCallback;
-import io.fd.vpp.jvpp.core.callback.SwInterfaceSetFlagsNotificationCallback;
-import io.fd.vpp.jvpp.core.callback.WantInterfaceEventsCallback;
-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 {
-
- private static void testCallbackApi() throws Exception {
- System.out.println("Testing Java callback API for notifications");
- try (final JVppRegistry registry = new JVppRegistryImpl("CallbackNotificationTest");
- final JVpp jvpp = new JVppCoreImpl()) {
- registry.register(jvpp, new TestCallback());
- System.out.println("Successfully connected to VPP");
-
- getEnableInterfaceNotificationsReq().send(jvpp);
- System.out.println("Interface notifications started");
- // TODO test ifc dump which also triggers interface flags send
-
- System.out.println("Changing interface configuration");
- getChangeInterfaceState().send(jvpp);
-
- // Notifications are received
- Thread.sleep(500);
-
- getDisableInterfaceNotificationsReq().send(jvpp);
- System.out.println("Interface events stopped");
-
- Thread.sleep(2000);
- System.out.println("Disconnecting...");
- }
- Thread.sleep(1000);
- }
-
- public static void main(String[] args) throws Exception {
- testCallbackApi();
- }
-
- private static class TestCallback implements SwInterfaceSetFlagsNotificationCallback,
- WantInterfaceEventsCallback, SwInterfaceSetFlagsCallback {
-
- @Override
- public void onSwInterfaceSetFlagsNotification(
- final SwInterfaceSetFlagsNotification msg) {
- printNotification(msg);
- }
-
- @Override
- public void onWantInterfaceEventsReply(final WantInterfaceEventsReply wantInterfaceEventsReply) {
- System.out.println("Interface notification stream updated");
- }
-
- @Override
- public void onSwInterfaceSetFlagsReply(final SwInterfaceSetFlagsReply swInterfaceSetFlagsReply) {
- System.out.println("Interface flags set successfully");
- }
-
- @Override
- public void onError(VppCallbackException ex) {
- System.out.printf("Received onError exception in getNodeIndexCallback: call=%s, reply=%d, context=%d%n",
- ex.getMethodName(), ex.getErrorCode(), ex.getCtxId());
-
- }
- }
-}
diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/ControlPingTest.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/ControlPingTest.java
deleted file mode 100644
index e97f4e3ac9a..00000000000
--- a/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/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java
deleted file mode 100644
index a96258f4302..00000000000
--- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/CreateSubInterfaceTest.java
+++ /dev/null
@@ -1,120 +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 static java.util.Objects.requireNonNull;
-
-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.dto.CreateSubif;
-import io.fd.vpp.jvpp.core.dto.CreateSubifReply;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCoreFacade;
-
-/**
- * <p>Tests sub-interface creation.<br> Equivalent to:<br>
- *
- * <pre>{@code
- * vppctl create sub GigabitEthernet0/9/0 1 dot1q 100 inner-dot1q any
- * }
- * </pre>
- *
- * To verify invoke:<br>
- * <pre>{@code
- * vpp_api_test json
- * vat# sw_interface_dump
- * }
- */
-public class CreateSubInterfaceTest {
-
- private static SwInterfaceDump createSwInterfaceDumpRequest(final String ifaceName) {
- SwInterfaceDump request = new SwInterfaceDump();
- request.nameFilter = ifaceName.getBytes();
- request.nameFilterValid = 1;
- return request;
- }
-
- private static void requireSingleIface(final SwInterfaceDetailsReplyDump response, final String ifaceName) {
- if (response.swInterfaceDetails.size() != 1) {
- throw new IllegalStateException(
- String.format("Expected one interface matching filter %s but was %d", ifaceName,
- response.swInterfaceDetails.size()));
- }
- }
-
- private static CreateSubif createSubifRequest(final int 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.outerVlanId = 100;
- request.innerVlanId = 0;
- return request;
- }
-
- private static void print(CreateSubifReply reply) {
- System.out.printf("CreateSubifReply: %s%n", reply);
- }
-
- private static void testCreateSubInterface() throws Exception {
- System.out.println("Testing sub-interface creation using Java callback API");
- try (final JVppRegistry registry = new JVppRegistryImpl("CreateSubInterface");
- 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 SwInterfaceDetailsReplyDump swInterfaceDetails =
- jvppFacade.swInterfaceDump(createSwInterfaceDumpRequest(ifaceName)).toCompletableFuture().get();
-
- requireNonNull(swInterfaceDetails, "swInterfaceDump returned null");
- requireNonNull(swInterfaceDetails.swInterfaceDetails, "swInterfaceDetails is null");
- requireSingleIface(swInterfaceDetails, ifaceName);
-
- final int swIfIndex = swInterfaceDetails.swInterfaceDetails.get(0).swIfIndex;
- final int subId = 1;
-
- final CreateSubifReply createSubifReply =
- jvppFacade.createSubif(createSubifRequest(swIfIndex, subId)).toCompletableFuture().get();
- print(createSubifReply);
-
- final String subIfaceName = "GigabitEthernet0/8/0." + subId;
- final SwInterfaceDetailsReplyDump subIface =
- jvppFacade.swInterfaceDump(createSwInterfaceDumpRequest(subIfaceName)).toCompletableFuture().get();
- requireNonNull(swInterfaceDetails, "swInterfaceDump returned null");
- requireNonNull(subIface.swInterfaceDetails, "swInterfaceDump returned null");
- requireSingleIface(swInterfaceDetails, ifaceName);
-
- System.out.println("Disconnecting...");
- }
- Thread.sleep(1000);
- }
-
- public static void main(String[] args) throws Exception {
- testCreateSubInterface();
- }
-}
diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiNotificationTest.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiNotificationTest.java
deleted file mode 100644
index 9efeae19f8b..00000000000
--- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiNotificationTest.java
+++ /dev/null
@@ -1,55 +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 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 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 {
-
- private static void testFutureApi() throws Exception {
- System.out.println("Testing Java future API for notifications");
- try (final JVppRegistry registry = new JVppRegistryImpl("FutureApiNotificationTest");
- final FutureJVppCoreFacade jvppFacade = new FutureJVppCoreFacade(registry, new JVppCoreImpl());
- final AutoCloseable notificationListenerReg =
- jvppFacade.getNotificationRegistry()
- .registerSwInterfaceSetFlagsNotificationCallback(NotificationUtils::printNotification)) {
- System.out.println("Successfully connected to VPP");
- jvppFacade.wantInterfaceEvents(getEnableInterfaceNotificationsReq()).toCompletableFuture().get();
- System.out.println("Interface events started");
-
- System.out.println("Changing interface configuration");
- jvppFacade.swInterfaceSetFlags(getChangeInterfaceState()).toCompletableFuture().get();
-
- Thread.sleep(1000);
-
- jvppFacade.wantInterfaceEvents(getDisableInterfaceNotificationsReq()).toCompletableFuture().get();
- System.out.println("Interface events stopped");
- System.out.println("Disconnecting...");
- }
- }
-
- public static void main(String[] args) throws Exception {
- testFutureApi();
- }
-}
diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java
deleted file mode 100644
index f478bab442f..00000000000
--- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/FutureApiTest.java
+++ /dev/null
@@ -1,123 +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.JVppRegistry;
-import io.fd.vpp.jvpp.JVppRegistryImpl;
-import io.fd.vpp.jvpp.core.JVppCoreImpl;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainDump;
-import io.fd.vpp.jvpp.core.dto.GetNodeIndex;
-import io.fd.vpp.jvpp.core.dto.GetNodeIndexReply;
-import io.fd.vpp.jvpp.core.dto.ShowVersion;
-import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-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.util.Objects;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Future;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-public class FutureApiTest {
-
- private static final Logger LOG = Logger.getLogger(FutureApiTest.class.getName());
-
- private static void testShowVersion(final FutureJVppCoreFacade jvpp) throws Exception {
- LOG.info("Sending ShowVersion request...");
- final Future<ShowVersionReply> replyFuture = jvpp.showVersion(new ShowVersion()).toCompletableFuture();
- final ShowVersionReply reply = replyFuture.get();
- 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)));
- }
-
- private static void testEmptyBridgeDomainDump(final FutureJVppCoreFacade jvpp) throws Exception {
- LOG.info("Sending ShowVersion request...");
- final BridgeDomainDump request = new BridgeDomainDump();
- request.bdId = -1; // dump call
-
- final CompletableFuture<BridgeDomainDetailsReplyDump>
- replyFuture = jvpp.bridgeDomainDump(request).toCompletableFuture();
- final BridgeDomainDetailsReplyDump reply = replyFuture.get();
-
- if (reply == null || reply.bridgeDomainDetails == null) {
- LOG.severe("Received null response for empty dump: " + reply);
- } else {
- LOG.info(
- String.format(
- "Received empty bridge-domain dump reply with list of bridge-domains: %s, %s",
- reply.bridgeDomainDetails, reply.bridgeDomainSwIfDetails));
- }
- }
-
- private static void testGetNodeIndex(final FutureJVppCoreFacade jvpp) {
- LOG.info("Sending GetNodeIndex request...");
- final GetNodeIndex request = new GetNodeIndex();
- request.nodeName = "non-existing-node".getBytes();
- final Future<GetNodeIndexReply> replyFuture = jvpp.getNodeIndex(request).toCompletableFuture();
- try {
- final GetNodeIndexReply reply = replyFuture.get();
- LOG.info(
- String.format(
- "Received GetNodeIndexReply: context=%d, nodeIndex=%d%n", reply.context, reply.nodeIndex));
- } catch (Exception e) {
- LOG.log(Level.SEVERE, "GetNodeIndex request failed", e);
- }
- }
-
- 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();
-
- 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",
- new String(details.interfaceName), details.l2AddressLength, details.adminUpDown,
- details.linkUpDown, details.linkSpeed, (int) details.linkMtu));
- }
- }
-
- private static void testFutureApi() throws Exception {
- LOG.info("Testing Java future API");
- try (final JVppRegistry registry = new JVppRegistryImpl("FutureApiTest");
- final FutureJVppCoreFacade jvppFacade = new FutureJVppCoreFacade(registry, new JVppCoreImpl())) {
- LOG.info("Successfully connected to VPP");
-
- testEmptyBridgeDomainDump(jvppFacade);
- testShowVersion(jvppFacade);
- testGetNodeIndex(jvppFacade);
- testSwInterfaceDump(jvppFacade);
-
- LOG.info("Disconnecting...");
- }
- }
-
- public static void main(String[] args) throws Exception {
- testFutureApi();
- }
-}
diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/L2AclTest.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/L2AclTest.java
deleted file mode 100644
index 6b3fa993f4d..00000000000
--- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/L2AclTest.java
+++ /dev/null
@@ -1,195 +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.JVppRegistry;
-import io.fd.vpp.jvpp.JVppRegistryImpl;
-import io.fd.vpp.jvpp.core.JVppCoreImpl;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSessionReply;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
-import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTableReply;
-import io.fd.vpp.jvpp.core.dto.ClassifySessionDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.ClassifySessionDump;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableByInterface;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableByInterfaceReply;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableIds;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableIdsReply;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableInfo;
-import io.fd.vpp.jvpp.core.dto.ClassifyTableInfoReply;
-import io.fd.vpp.jvpp.core.dto.InputAclSetInterface;
-import io.fd.vpp.jvpp.core.dto.InputAclSetInterfaceReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCoreFacade;
-import javax.xml.bind.DatatypeConverter;
-
-/**
- * <p>Tests L2 ACL creation and read.<br> Equivalent to the following vppctl commands:<br>
- *
- * <pre>{@code
- * vppctl classify table mask l2 src
- * vppctl classify session acl-hit-next deny opaque-index 0 table-index 0 match l2 src 01:02:03:04:05:06
- * vppctl set int input acl intfc local0 l2-table 0
- * vppctl sh class table verbose
- * }
- * </pre>
- */
-public class L2AclTest {
-
- private static final int LOCAL0_IFACE_ID = 0;
-
- private static ClassifyAddDelTable createClassifyTable() {
- ClassifyAddDelTable request = new ClassifyAddDelTable();
- request.isAdd = 1;
- request.tableIndex = ~0; // default
- request.nbuckets = 2;
- request.memorySize = 2 << 20;
- request.nextTableIndex = ~0; // default
- request.missNextIndex = ~0; // default
- request.skipNVectors = 0;
- request.matchNVectors = 1;
- request.mask =
- new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
- (byte) 0xff, (byte) 0xff, 0x00, 0x00, 0x00, 0x00};
- return request;
- }
-
- private static ClassifyTableInfo createClassifyTableInfoRequest(final int tableId) {
- ClassifyTableInfo request = new ClassifyTableInfo();
- request.tableId = tableId;
- return request;
- }
-
- private static ClassifyAddDelSession createClassifySession(final int tableIndex) {
- ClassifyAddDelSession request = new ClassifyAddDelSession();
- request.isAdd = 1;
- request.tableIndex = tableIndex;
- request.hitNextIndex = 0; // deny
- request.opaqueIndex = 0;
- request.advance = 0; // default
- // match 01:02:03:04:05:06 mac address
- request.match =
- new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
- (byte) 0x05, (byte) 0x06, 0x00, 0x00, 0x00, 0x00};
- return request;
- }
-
- private static ClassifySessionDump createClassifySessionDumpRequest(final int newTableIndex) {
- ClassifySessionDump request = new ClassifySessionDump();
- request.tableId = newTableIndex;
- return request;
- }
-
- private static InputAclSetInterface aclSetInterface() {
- InputAclSetInterface request = new InputAclSetInterface();
- request.isAdd = 1;
- request.swIfIndex = LOCAL0_IFACE_ID;
- request.ip4TableIndex = ~0; // skip
- request.ip6TableIndex = ~0; // skip
- request.l2TableIndex = 0;
- return request;
- }
-
- private static ClassifyTableByInterface createClassifyTableByInterfaceRequest() {
- ClassifyTableByInterface request = new ClassifyTableByInterface();
- request.swIfIndex = LOCAL0_IFACE_ID;
- return request;
- }
-
- private static void print(ClassifyAddDelTableReply reply) {
- System.out.printf("ClassifyAddDelTableReply: %s%n", reply);
- }
-
- private static void print(ClassifyTableIdsReply reply) {
- System.out.printf("ClassifyTableIdsReply: %s%n", reply);
- }
-
- private static void print(final ClassifyTableInfoReply reply) {
- System.out.println(reply);
- if (reply != null) {
- System.out.println("Mask hex: " + DatatypeConverter.printHexBinary(reply.mask));
- }
- }
-
- private static void print(ClassifyAddDelSessionReply reply) {
- System.out.printf("ClassifyAddDelSessionReply: context=%s%n", reply);
- }
-
- private static void print(final ClassifySessionDetailsReplyDump reply) {
- System.out.println(reply);
- reply.classifySessionDetails.forEach(detail -> {
- System.out.println(detail);
- System.out.println("Match hex: " + DatatypeConverter.printHexBinary(detail.match));
- });
- }
-
- private static void print(final InputAclSetInterfaceReply reply) {
- System.out.printf("InputAclSetInterfaceReply: context=%s%n", reply);
- }
-
- private static void print(final ClassifyTableByInterfaceReply reply) {
- System.out.printf("ClassifyAddDelTableReply: %s%n", reply);
- }
-
- private static void testL2Acl() throws Exception {
- System.out.println("Testing L2 ACLs using Java callback API");
- try (final JVppRegistry registry = new JVppRegistryImpl("L2AclTest");
- final FutureJVppCoreFacade jvppFacade = new FutureJVppCoreFacade(registry, new JVppCoreImpl())) {
-
- System.out.println("Successfully connected to VPP");
- Thread.sleep(1000);
-
- final ClassifyAddDelTableReply classifyAddDelTableReply =
- jvppFacade.classifyAddDelTable(createClassifyTable()).toCompletableFuture().get();
- print(classifyAddDelTableReply);
-
- final ClassifyTableIdsReply classifyTableIdsReply =
- jvppFacade.classifyTableIds(new ClassifyTableIds()).toCompletableFuture().get();
- print(classifyTableIdsReply);
-
- final ClassifyTableInfoReply classifyTableInfoReply =
- jvppFacade.classifyTableInfo(createClassifyTableInfoRequest(classifyAddDelTableReply.newTableIndex))
- .toCompletableFuture().get();
- print(classifyTableInfoReply);
-
- final ClassifyAddDelSessionReply classifyAddDelSessionReply =
- jvppFacade.classifyAddDelSession(createClassifySession(classifyAddDelTableReply.newTableIndex))
- .toCompletableFuture().get();
- print(classifyAddDelSessionReply);
-
- final ClassifySessionDetailsReplyDump classifySessionDetailsReplyDump =
- jvppFacade.classifySessionDump(createClassifySessionDumpRequest(classifyAddDelTableReply.newTableIndex))
- .toCompletableFuture().get();
- print(classifySessionDetailsReplyDump);
-
- final InputAclSetInterfaceReply inputAclSetInterfaceReply =
- jvppFacade.inputAclSetInterface(aclSetInterface()).toCompletableFuture().get();
- print(inputAclSetInterfaceReply);
-
- final ClassifyTableByInterfaceReply classifyTableByInterfaceReply =
- jvppFacade.classifyTableByInterface(createClassifyTableByInterfaceRequest()).toCompletableFuture()
- .get();
- print(classifyTableByInterfaceReply);
-
- System.out.println("Disconnecting...");
- }
- Thread.sleep(1000);
- }
-
- public static void main(String[] args) throws Exception {
- testL2Acl();
- }
-}
diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/LispAdjacencyTest.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/LispAdjacencyTest.java
deleted file mode 100644
index d7f5039b152..00000000000
--- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/LispAdjacencyTest.java
+++ /dev/null
@@ -1,124 +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.JVppRegistry;
-import io.fd.vpp.jvpp.JVppRegistryImpl;
-import io.fd.vpp.jvpp.core.JVppCoreImpl;
-import io.fd.vpp.jvpp.core.dto.LispAddDelAdjacency;
-import io.fd.vpp.jvpp.core.dto.LispAddDelLocalEid;
-import io.fd.vpp.jvpp.core.dto.LispAddDelLocatorSet;
-import io.fd.vpp.jvpp.core.dto.LispAddDelRemoteMapping;
-import io.fd.vpp.jvpp.core.dto.LispAdjacenciesGet;
-import io.fd.vpp.jvpp.core.dto.LispAdjacenciesGetReply;
-import io.fd.vpp.jvpp.core.dto.LispEnableDisable;
-import io.fd.vpp.jvpp.core.future.FutureJVppCoreFacade;
-import java.nio.charset.StandardCharsets;
-import java.util.concurrent.ExecutionException;
-import java.util.logging.Logger;
-
-/**
- * Tests lisp adjacency creation and read (custom vpe.api type support showcase).
- */
-public class LispAdjacencyTest {
-
- private static final Logger LOG = Logger.getLogger(LispAdjacencyTest.class.getName());
-
- private static void enableLisp(final FutureJVppCoreFacade jvpp) throws ExecutionException, InterruptedException {
- final LispEnableDisable request = new LispEnableDisable();
- request.isEn = 1;
- jvpp.lispEnableDisable(request).toCompletableFuture().get();
- LOG.info("Lisp enabled successfully");
- }
-
- private static void addLocatorSet(final FutureJVppCoreFacade jvpp) throws ExecutionException, InterruptedException {
- final LispAddDelLocatorSet request = new LispAddDelLocatorSet();
- request.isAdd = 1;
- request.locatorSetName = "ls1".getBytes(StandardCharsets.UTF_8);
- jvpp.lispAddDelLocatorSet(request).toCompletableFuture().get();
- LOG.info("Locator set created successfully:" + request.toString());
- }
-
- private static void addLocalEid(final FutureJVppCoreFacade jvpp) throws ExecutionException, InterruptedException {
- final LispAddDelLocalEid request = new LispAddDelLocalEid();
- request.isAdd = 1;
- request.locatorSetName = "ls1".getBytes(StandardCharsets.UTF_8);
- request.eid = new byte[] {1, 2, 1, 10};
- request.eidType = 0; // ip4
- request.vni = 0;
- request.prefixLen = 32;
- jvpp.lispAddDelLocalEid(request).toCompletableFuture().get();
- LOG.info("Local EID created successfully:" + request.toString());
- }
-
- private static void addRemoteMapping(final FutureJVppCoreFacade jvpp)
- throws ExecutionException, InterruptedException {
- final LispAddDelRemoteMapping request = new LispAddDelRemoteMapping();
- request.isAdd = 1;
- request.vni = 0;
- request.eid = new byte[] {1, 2, 1, 20};
- request.eidLen = 32;
- request.rlocNum = 1;
- request.rlocs = new byte[] {1, 1, 1, 1, 2, 1, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- jvpp.lispAddDelRemoteMapping(request).toCompletableFuture().get();
- LOG.info("Remote mapping created successfully:" + request.toString());
- }
-
- private static void addAdjacency(final FutureJVppCoreFacade jvpp) throws ExecutionException, InterruptedException {
- final LispAddDelAdjacency request = new LispAddDelAdjacency();
- request.isAdd = 1;
- request.leid = new byte[] {1, 2, 1, 10};
- request.leidLen = 32;
- request.reid = new byte[] {1, 2, 1, 20};
- request.reidLen = 32;
- request.eidType = 0; // ip4
- request.vni = 0;
- jvpp.lispAddDelAdjacency(request).toCompletableFuture().get();
- LOG.info("Lisp adjacency created successfully:" + request.toString());
- }
-
- private static void showAdjacencies(final FutureJVppCoreFacade jvpp)
- throws ExecutionException, InterruptedException {
- final LispAdjacenciesGetReply reply =
- jvpp.lispAdjacenciesGet(new LispAdjacenciesGet()).toCompletableFuture().get();
- LOG.info("Lisp adjacency received successfully:" + reply.toString());
- }
-
- private static void testAdjacency(final FutureJVppCoreFacade jvpp) throws Exception {
- enableLisp(jvpp);
- addLocatorSet(jvpp);
- addLocalEid(jvpp);
- addRemoteMapping(jvpp);
- addAdjacency(jvpp);
- showAdjacencies(jvpp);
- }
-
- private static void testFutureApi() throws Exception {
- LOG.info("Create lisp adjacency test");
- try (final JVppRegistry registry = new JVppRegistryImpl("LispAdjacencyTest");
- final FutureJVppCoreFacade jvppFacade = new FutureJVppCoreFacade(registry, new JVppCoreImpl())) {
- LOG.info("Successfully connected to VPP");
-
- testAdjacency(jvppFacade);
- LOG.info("Disconnecting...");
- }
- }
-
- public static void main(String[] args) throws Exception {
- testFutureApi();
- }
-}
diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/NotificationUtils.java b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/NotificationUtils.java
deleted file mode 100644
index f82946c3a5f..00000000000
--- a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/NotificationUtils.java
+++ /dev/null
@@ -1,53 +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 java.io.PrintStream;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlags;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsNotification;
-import io.fd.vpp.jvpp.core.dto.WantInterfaceEvents;
-
-final class NotificationUtils {
-
- private NotificationUtils() {}
-
- static PrintStream printNotification(final SwInterfaceSetFlagsNotification msg) {
- return System.out.printf("Received interface notification: ifc: %s%n", msg);
- }
-
- static SwInterfaceSetFlags getChangeInterfaceState() {
- final SwInterfaceSetFlags swInterfaceSetFlags = new SwInterfaceSetFlags();
- swInterfaceSetFlags.swIfIndex = 0;
- swInterfaceSetFlags.adminUpDown = 1;
- swInterfaceSetFlags.deleted = 0;
- return swInterfaceSetFlags;
- }
-
- static WantInterfaceEvents getEnableInterfaceNotificationsReq() {
- WantInterfaceEvents wantInterfaceEvents = new WantInterfaceEvents();
- wantInterfaceEvents.pid = 1;
- wantInterfaceEvents.enableDisable = 1;
- return wantInterfaceEvents;
- }
-
- static WantInterfaceEvents getDisableInterfaceNotificationsReq() {
- WantInterfaceEvents wantInterfaceEvents = new WantInterfaceEvents();
- wantInterfaceEvents.pid = 1;
- wantInterfaceEvents.enableDisable = 0;
- return wantInterfaceEvents;
- }
-}
diff --git a/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/Readme.txt b/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/test/Readme.txt
deleted file mode 100644
index 1344dc9ebdb..00000000000
--- a/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)
diff --git a/vpp-api/java/jvpp-core/jvpp_core.c b/vpp-api/java/jvpp-core/jvpp_core.c
deleted file mode 100644
index ef4cb8e3e7e..00000000000
--- a/vpp-api/java/jvpp-core/jvpp_core.c
+++ /dev/null
@@ -1,117 +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.
- */
-
-#include <vnet/vnet.h>
-
-#include <vpp/api/vpe_msg_enum.h>
-#define vl_typedefs /* define message structures */
-#include <vpp/api/vpe_all_api_h.h>
-#undef vl_typedefs
-
-#define vl_endianfun
-#include <vpp/api/vpe_all_api_h.h>
-#undef vl_endianfun
-
-#define vl_print(handle, ...)
-#define vl_printfun
-#include <vpp/api/vpe_all_api_h.h>
-#undef vl_printfun
-
-#include <vnet/api_errno.h>
-#include <vlibapi/api.h>
-#include <vlibmemory/api.h>
-#include <jni.h>
-
-#include <jvpp-common/jvpp_common.h>
-
-// TODO: generate jvpp_plugin_name.c files (or at least reuse plugin's main structure)
-typedef struct {
- /* Base message index for the jvpp-core plugin */
- u16 msg_id_base;
-
- /* Pointer to shared memory queue */
- unix_shared_memory_queue_t * vl_input_queue;
-
- /* VPP api client index */
- u32 my_client_index;
-
- /* Callback object and class references enabling asynchronous Java calls */
- jobject callbackObject;
- jclass callbackClass;
-
-} core_main_t;
-
-core_main_t core_main __attribute__((aligned (64)));
-
-#include "io_fd_vpp_jvpp_core_JVppCoreImpl.h"
-#include "jvpp_core_gen.h"
-
-JNIEXPORT void JNICALL Java_io_fd_vpp_jvpp_core_JVppCoreImpl_init0
-(JNIEnv * env, jclass clazz, jobject callback, jlong queue_address, jint my_client_index) {
- core_main_t * plugin_main = &core_main;
- plugin_main->my_client_index = my_client_index;
- plugin_main->vl_input_queue = (unix_shared_memory_queue_t *)queue_address;
-
- plugin_main->callbackObject = (*env)->NewGlobalRef(env, callback);
- plugin_main->callbackClass = (jclass)(*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, callback));
-
- #define _(N,n) \
- vl_msg_api_set_handlers(VL_API_##N, #n, \
- vl_api_##n##_t_handler, \
- vl_noop_handler, \
- vl_noop_handler, \
- vl_noop_handler, \
- sizeof(vl_api_##n##_t), 1);
- foreach_api_reply_handler;
- #undef _
-}
-
-JNIEXPORT void JNICALL Java_io_fd_vpp_jvpp_core_JVppCoreImpl_close0
-(JNIEnv *env, jclass clazz) {
- core_main_t * plugin_main = &core_main;
-
- // cleanup:
- (*env)->DeleteGlobalRef(env, plugin_main->callbackClass);
- (*env)->DeleteGlobalRef(env, plugin_main->callbackObject);
-
- plugin_main->callbackClass = NULL;
- plugin_main->callbackObject = NULL;
-}
-
-jint JNI_OnLoad(JavaVM *vm, void *reserved) {
- JNIEnv* env;
-
- if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_8) != JNI_OK) {
- return JNI_EVERSION;
- }
-
- if (cache_class_references(env) != 0) {
- clib_warning ("Failed to cache class references\n");
- return JNI_ERR;
- }
-
- return JNI_VERSION_1_8;
-}
-
-void JNI_OnUnload(JavaVM *vm, void *reserved) {
- JNIEnv* env;
- if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_8) != JNI_OK) {
- return;
- }
- delete_class_references(env);
-}
-
-
-