summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/java/jvpp/gen/jvppgen/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/vpp-api/java/jvpp/gen/jvppgen/util.py')
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/util.py37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/util.py b/src/vpp-api/java/jvpp/gen/jvppgen/util.py
index ce34f8549d8..70ddc8ea8e7 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/util.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/util.py
@@ -35,19 +35,30 @@ def remove_folder(folder):
removedirs(folder)
-reply_suffixes = ("reply", "details")
+_REPLY_SUFFIX = "reply"
+_DETAILS_SUFFIX = "details"
+_REPLY_SUFFIXES = (_REPLY_SUFFIX, _DETAILS_SUFFIX)
def is_reply(name):
- return name.lower().endswith(reply_suffixes)
+ return name.lower().endswith(_REPLY_SUFFIXES)
-def is_details(name):
- return name.lower().endswith(reply_suffixes[1])
+def is_request(msg_name_underscore, all_messages):
+ """
+ Checks if reply message is present in all_messages.
+ :param msg_name_underscore name of vpp API message
+ :param all_messages: sequence of vpp message names
+ :returns: True if reply for the msg_name_underscore message is defined.
+ """
+ reply_msg = msg_name_underscore + "_" + _REPLY_SUFFIX
+ return reply_msg in [m['name'] for m in all_messages]
+
+
+def is_details(name):
+ return name.lower().endswith(_DETAILS_SUFFIX)
-def is_retval_field(name):
- return name == 'retval'
dump_suffix = "dump"
@@ -56,8 +67,12 @@ def is_dump(name):
return name.lower().endswith(dump_suffix)
+def is_retval_field(name):
+ return name == 'retval'
+
+
def get_reply_suffix(name):
- for reply_suffix in reply_suffixes:
+ for reply_suffix in _REPLY_SUFFIXES:
if name.lower().endswith(reply_suffix):
return reply_suffix
@@ -149,14 +164,6 @@ jni_field_accessors = {'u8': 'ByteField',
}
-def is_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")
-
- return name.lower().endswith(notifications_message_suffixes)
-
-
def remove_reply_suffix(camel_case_name_with_suffix):
return remove_suffix(camel_case_name_with_suffix, get_reply_suffix(camel_case_name_with_suffix))