2 * Copyright (c) 2015 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 import java.net.InetAddress;
17 import org.openvpp.vppjapi.*;
21 native int controlPing();
22 native void test (byte[] array, byte[] array2);
24 public static void main (String[] args) throws Exception {
25 vppConn api = new vppConn ();
26 String ipv6 = "db01::feed";
27 String ipv4 = "192.168.1.1";
28 InetAddress addr6 = InetAddress.getByName(ipv6);
29 InetAddress addr4 = InetAddress.getByName(ipv4);
30 byte[] ip4bytes = addr4.getAddress();
31 byte[] ip6bytes = addr6.getAddress();
34 api.test(ip4bytes,ip6bytes);
36 rv = api.clientConnect ("JavaTest");
38 System.out.printf ("Connected OK...");
41 System.out.printf ("clientConnect returned %d\n", rv);
44 rv = api.controlPing();
45 System.out.printf ("data plane pid is %d\n", rv);
49 api.clientDisconnect();
50 System.out.printf ("Done...\n");