2 * Copyright (c) 2016 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package io.fd.vpp.jvpp.ioamtrace.test;
20 import io.fd.vpp.jvpp.Assertions;
21 import io.fd.vpp.jvpp.JVppRegistry;
22 import io.fd.vpp.jvpp.JVppRegistryImpl;
23 import io.fd.vpp.jvpp.ioamtrace.JVppIoamtraceImpl;
24 import io.fd.vpp.jvpp.ioamtrace.dto.TraceProfileShowConfig;
25 import io.fd.vpp.jvpp.ioamtrace.dto.TraceProfileShowConfigReply;
26 import io.fd.vpp.jvpp.ioamtrace.future.FutureJVppIoamtraceFacade;
28 import java.util.concurrent.Future;
29 import java.util.logging.Logger;
31 public class FutureApiTest {
33 private static final Logger LOG = Logger.getLogger(io.fd.vpp.jvpp.ioamtrace.test.FutureApiTest.class.getName());
35 public static void main(String[] args) throws Exception {
36 testCallbackApi(args);
39 private static void testCallbackApi(String[] args) throws Exception {
40 LOG.info("Testing Java callback API for ioamtrace plugin");
41 try (final JVppRegistry registry = new JVppRegistryImpl("FutureApiTest", args[0]);
42 final FutureJVppIoamtraceFacade jvpp = new FutureJVppIoamtraceFacade(registry, new JVppIoamtraceImpl())) {
43 LOG.info("Successfully connected to VPP");
45 testTraceProfileShowConfig(jvpp);
47 LOG.info("Disconnecting...");
51 private static void testTraceProfileShowConfig(FutureJVppIoamtraceFacade jvpp) throws Exception {
52 LOG.info("Sending TraceProfileShowConfig request...");
53 final TraceProfileShowConfig request = new TraceProfileShowConfig();
55 final Future<TraceProfileShowConfigReply> replyFuture = jvpp.traceProfileShowConfig(request).toCompletableFuture();
56 final TraceProfileShowConfigReply reply = replyFuture.get();
58 Assertions.assertNotNull(reply);