jvpp: unify notification handling 53/9753/1
authorMarek Gradzki <mgradzki@cisco.com>
Thu, 7 Dec 2017 16:17:35 +0000 (17:17 +0100)
committerMarek Gradzki <mgradzki@cisco.com>
Thu, 7 Dec 2017 16:17:39 +0000 (17:17 +0100)
Since introduction of dedicated SW Interface Event,
there is no need for special handling of messages
that can be both requests and events.

Change-Id: I76575e32c6d5b19e9a1ca953e5841d8ac3de4de7
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
src/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py
src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py
src/vpp-api/java/jvpp/gen/jvppgen/util.py

index 5f2cdc2..8126912 100644 (file)
@@ -80,7 +80,7 @@ def generate_dtos(func_list, base_package, plugin_package, plugin_name, dto_pack
         base_type = ""
 
         # Generate request/reply or dump/dumpReply even if structure can be used as notification
-        if not util.is_just_notification(func["name"]):
+        if not util.is_notification(func["name"]):
             if util.is_reply(camel_case_dto_name):
                 description = "reply DTO"
                 request_dto_name = util.remove_reply_suffix(camel_case_dto_name)
@@ -107,9 +107,8 @@ def generate_dtos(func_list, base_package, plugin_package, plugin_name, dto_pack
 
             write_dto_file(base_package, plugin_package, base_type, camel_case_dto_name, description, dto_package,
                            dto_path, fields, func, inputfile, methods)
-
-        # for structures that are also used as notifications, generate dedicated notification DTO
-        if util.is_notification(func["name"]):
+        else:
+            # for structures that are also used as notifications, generate dedicated notification DTO
             description = "notification DTO"
             dto_path = os.path.join(dto_package, camel_case_dto_name + ".java")
             methods = generate_dto_base_methods(camel_case_dto_name, func)
index e67b6ec..a02f04d 100644 (file)
@@ -145,7 +145,7 @@ def generate_jni_impl(func_list, plugin_name, inputfile):
         f_name = f['name']
         camel_case_function_name = util.underscore_to_camelcase(f_name)
         if is_manually_generated(f_name) or util.is_reply(camel_case_function_name) \
-                or util.is_just_notification(f_name):
+                or util.is_notification(f_name):
             continue
 
         arguments = ''
index 6c2ffbc..ce34f85 100644 (file)
@@ -148,16 +148,12 @@ jni_field_accessors =  {'u8': 'ByteField',
                         'f64[]': 'ObjectField'
                         }
 
-# FIXME no convention in the naming of events (notifications) in vpe.api
-notifications_message_suffixes = ("event", "counters")
 
 def is_notification(name):
-    """ Returns true if the structure is a notification regardless of its no other use """
-    return is_just_notification(name)
+    """ Returns true if the structure is a notification """
+    # FIXME no convention in the naming of events (notifications) in vpe.api
+    notifications_message_suffixes = ("event", "counters")
 
-
-def is_just_notification(name):
-    """ Returns true if the structure is just a notification and has no other use """
     return name.lower().endswith(notifications_message_suffixes)
 
 
@@ -182,16 +178,5 @@ def api_message_to_javadoc(api_message):
     return " * " + str.replace("\n", "\n * ")
 
 
-notification_dto_suffix = "Notification"
-
-
-def add_notification_suffix(camel_case_dto_name):
-    camel_case_dto_name += notification_dto_suffix
-    return camel_case_dto_name
-
-
 def is_array(java_type_as_string):
     return java_type_as_string.endswith("[]")
-
-def is_want(name):
-    return name.startswith("want_")
\ No newline at end of file