jvpp: added logs for sending and receiving event messages (VPP-982)


Change-Id: I47f9d12d934378f18c6f841b902af2a64ee7b187
Signed-off-by: Matej Perina <mperina@cisco.com>
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py
index 8761eb1..4fe7ab5 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py
@@ -140,6 +140,8 @@
     $msg_initialization
 
     // send message:
+    if (CLIB_DEBUG > 1)
+        clib_warning ("Sending ${field_name} event message");
     vl_msg_api_send_shmem (plugin_main->vl_input_queue, (u8 *)&mp);
     if ((*env)->ExceptionCheck(env)) {
         return JNI_ERR;
@@ -229,6 +231,9 @@
     jthrowable exc;
     $err_handler
 
+    if (CLIB_DEBUG > 1)
+        clib_warning ("Received ${handler_name} event message");
+
     jmethodID constructor = (*env)->GetMethodID(env, ${class_ref_name}Class, "<init>", "()V");
 
     // User does not have to provide callbacks for all VPP messages.
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py
index 9aaa4c6..3cfc633 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py
@@ -246,6 +246,9 @@
 
         $plugin_package.$callback_package.$callback callback;
         final int replyId = reply.context;
+        if (LOG.isLoggable(java.util.logging.Level.FINE)) {
+            LOG.fine(String.format("Received $callback_dto event message: %s", reply));
+        }
         synchronized(requests) {
             callback = ($plugin_package.$callback_package.$callback) requests.remove(replyId);
         }
@@ -260,6 +263,9 @@
     @Override
     @SuppressWarnings("unchecked")
     public void on$callback_dto($plugin_package.$dto_package.$callback_dto notification) {
+        if (LOG.isLoggable(java.util.logging.Level.FINE)) {
+            LOG.fine(String.format("Received $callback_dto event message: %s", notification));
+        }
         notificationCallback.on$callback_dto(notification);
     }
 """)
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py
index 07947e3..b2f8d37 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py
@@ -31,6 +31,7 @@
 
     private final java.util.Map<java.lang.Integer, java.util.concurrent.CompletableFuture<? extends $base_package.$dto_package.JVppReply<?>>> requests;
     private final $plugin_package.$notification_package.Global${plugin_name}NotificationCallback notificationCallback;
+    private static final java.util.logging.Logger LOG = java.util.logging.Logger.getLogger(FutureJVpp${plugin_name}FacadeCallback.class.getName());
 
     public FutureJVpp${plugin_name}FacadeCallback(
         final java.util.Map<java.lang.Integer, java.util.concurrent.CompletableFuture<? extends $base_package.$dto_package.JVppReply<?>>> requestMap,
@@ -94,6 +95,9 @@
     public void on$callback_dto(final $plugin_package.$dto_package.$callback_dto reply) {
         final java.util.concurrent.CompletableFuture<$base_package.$dto_package.JVppReply<?>> completableFuture;
         final int replyId = reply.context;
+        if (LOG.isLoggable(java.util.logging.Level.FINE)) {
+            LOG.fine(String.format("Received $callback_dto event message: %s", reply));
+        }
         synchronized(requests) {
             completableFuture = (java.util.concurrent.CompletableFuture<$base_package.$dto_package.JVppReply<?>>) requests.get(replyId);
         }
@@ -111,6 +115,9 @@
 jvpp_facade_callback_notification_method_template = Template("""
     @Override
     public void on$callback_dto($plugin_package.$dto_package.$callback_dto notification) {
+        if (LOG.isLoggable(java.util.logging.Level.FINE)) {
+            LOG.fine(String.format("Received $callback_dto event message: %s", notification));
+        }
         notificationCallback.on$callback_dto(notification);
     }
 """)
@@ -121,6 +128,9 @@
     public void on$callback_dto(final $plugin_package.$dto_package.$callback_dto reply) {
         final $base_package.$future_package.AbstractFutureJVppInvoker.CompletableDumpFuture<$plugin_package.$dto_package.$callback_dto_reply_dump> completableFuture;
         final int replyId = reply.context;
+        if (LOG.isLoggable(java.util.logging.Level.FINE)) {
+            LOG.fine(String.format("Received $callback_dto event message: %s", reply));
+        }
         synchronized(requests) {
             completableFuture = ($base_package.$future_package.AbstractFutureJVppInvoker.CompletableDumpFuture<$plugin_package.$dto_package.$callback_dto_reply_dump>) requests.get(replyId);
         }
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py
index 7bf9113..7af70be 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py
@@ -49,6 +49,7 @@
 import java.nio.file.attribute.PosixFilePermissions;
 import java.util.Set;
 import java.util.logging.Logger;
+import java.util.logging.Level;
 import $base_package.callback.JVppCallback;
 import $base_package.VppConnection;
 import $base_package.JVppRegistry;
@@ -139,6 +140,9 @@
 method_impl_template = Template("""    public final int $name($plugin_package.$dto_package.$request request) throws io.fd.vpp.jvpp.VppInvocationException {
         java.util.Objects.requireNonNull(request,"Null request object");
         connection.checkActive();
+        if(LOG.isLoggable(Level.FINE)) {
+            LOG.fine(String.format("Sending $name event message: %s", request));
+        }
         int result=${name}0(request);
         if(result<0){
             throw new io.fd.vpp.jvpp.VppInvocationException("${name}",result);
@@ -151,6 +155,7 @@
 no_arg_method_native_template = Template("""    private static native int ${name}0() throws io.fd.vpp.jvpp.VppInvocationException;""")
 no_arg_method_impl_template = Template("""    public final int $name() throws io.fd.vpp.jvpp.VppInvocationException {
         connection.checkActive();
+        LOG.fine("Sending $name event message");
         int result=${name}0();
         if(result<0){
             throw new io.fd.vpp.jvpp.VppInvocationException("${name}",result);
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py
index 94302d5..66de7a5 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py
@@ -62,6 +62,7 @@
     // TODO add a special NotificationCallback interface and only allow those to be registered
     private final java.util.concurrent.ConcurrentMap<Class<? extends $base_package.$dto_package.JVppNotification>, $base_package.$callback_package.JVppNotificationCallback> registeredCallbacks =
         new java.util.concurrent.ConcurrentHashMap<>();
+    private static java.util.logging.Logger LOG = java.util.logging.Logger.getLogger(${plugin_name}NotificationRegistryImpl.class.getName());
 
     $register_callback_methods
     $handler_methods
@@ -87,6 +88,9 @@
     @Override
     public void on$notification(
         final $plugin_package.$dto_package.$notification notification) {
+        if (LOG.isLoggable(java.util.logging.Level.FINE)) {
+            LOG.fine(String.format("Received $notification event message: %s", notification));
+        }
         final $base_package.$callback_package.JVppNotificationCallback jVppNotificationCallback = registeredCallbacks.get($plugin_package.$dto_package.$notification.class);
         if (null != jVppNotificationCallback) {
             (($plugin_package.$callback_package.$callback) registeredCallbacks