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.ioamexport.examples;
19 import java.net.InetAddress;
21 import io.fd.vpp.jvpp.JVpp;
22 import io.fd.vpp.jvpp.JVppRegistry;
23 import io.fd.vpp.jvpp.JVppRegistryImpl;
24 import io.fd.vpp.jvpp.VppCallbackException;
25 import io.fd.vpp.jvpp.ioamexport.JVppIoamexportImpl;
26 import io.fd.vpp.jvpp.ioamexport.future.FutureJVppIoamexportFacade;
27 import io.fd.vpp.jvpp.ioamexport.dto.IoamExportIp6EnableDisable;
28 import io.fd.vpp.jvpp.ioamexport.dto.IoamExportIp6EnableDisableReply;
30 public class IoamExportApiExample {
32 public static void main(String[] args) throws Exception {
36 private static void ioamExportTestApi() throws Exception {
37 System.out.println("Testing Java API for ioam export plugin");
38 try (final JVppRegistry registry = new JVppRegistryImpl("ioamExportApiExample");
39 final JVpp jvpp = new JVppIoamexportImpl()) {
40 FutureJVppIoamexportFacade ioamexportJvpp = new FutureJVppIoamexportFacade(registry,jvpp);
41 System.out.println("Sending ioam export request...");
42 IoamExportIp6EnableDisable request = new IoamExportIp6EnableDisable();
43 request.isDisable = 0;
44 InetAddress collectorAddress = InetAddress.getByName("2001:0DB8:AC10:FE01:0000:0000:0000:0000");
45 InetAddress srcAddress = InetAddress.getByName("2001:0DB8:AC10:FE01:0000:0000:0000:0001");
46 request.collectorAddress = collectorAddress.getAddress();
47 request.srcAddress = srcAddress.getAddress();
48 IoamExportIp6EnableDisableReply reply = ioamexportJvpp.ioamExportIp6EnableDisable(request).toCompletableFuture().get();
49 System.out.printf("IoamExportIp6EnableDisableReply = "+reply.toString()+"%n");
53 System.out.println("Disconnecting...");