blob: 96ba4a277a7d3f1ef3dc1b2847c886a6451ab86b [file] [log] [blame]
Robert Varga52a3a4d2016-01-31 13:39:19 +01001/*
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:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
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.
14 */
15
Ed Warnickecb9cada2015-12-08 15:45:58 -070016import java.net.InetAddress;
17import org.openvpp.vppjapi.*;
18
19public class vppApi extends vppConn {
20
21 native int controlPing();
22 native void test (byte[] array, byte[] array2);
23
24 public static void main (String[] args) throws Exception {
25 vppApi api = new vppApi ();
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();
32 int rv;
33
34 api.test(ip4bytes,ip6bytes);
35
36 rv = api.clientConnect ("JavaTest");
37 if (rv == 0)
38 System.out.printf ("Connected OK...");
39 else
40 {
41 System.out.printf ("clientConnect returned %d\n", rv);
42 System.exit (1);
43 }
44 rv = api.controlPing();
45 System.out.printf ("data plane pid is %d\n", rv);
46
47 Thread.sleep (5000);
48
49 api.clientDisconnect();
50 System.out.printf ("Done...\n");
51 }
52}