diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2017-12-07 15:40:11 +0100 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2017-12-09 13:23:15 +0000 |
commit | 6e73f7f6055a9ba1c4e604060934a0aa5e555f57 (patch) | |
tree | 84ad8d53635552c1a158d48d783b794f34e1d762 /src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py | |
parent | c42fc05bfbb26fd11fe92ac9d11587660a817ac1 (diff) |
jvpp: do not hardcode event sufixes (VPP-940)
JVpp maps request messages with replies
for Java API user convenience, e.g.:
- do not polute send APIs with messages other than requests/dumps,
- allow callback registration only for replies/details and events.
Since there are no conventions for event message naming
(https://wiki.fd.io/view/VPP/API_Concepts#API_Conventions),
jvpp should not limit events to messages
that end with 'event' or 'counters' suffix.
Instead jvpp should treat all messages
except for requests/dumps as potential events.
Such behaviour was introduced on Java API level by
https://gerrit.fd.io/r/#/c/8377/
in order support reusing
details messages as events (e.g. BFD events).
This patch goes one step forward by
relaxing rules at jvpp generation level.
Change-Id: I2a35e9eb2a288b2cf02d36ca95e6cb13e76e19e3
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py')
-rw-r--r-- | src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py | 11 |
1 files changed, 6 insertions, 5 deletions
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 6da58c2e12c..72a32469460 100644 --- a/src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py +++ b/src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py @@ -135,13 +135,15 @@ def generate_notification_registry(func_list, base_package, plugin_package, plug register_callback_methods_impl = [] handler_methods = [] for func in func_list: - - if not util.is_reply(func['name']) and not util.is_notification(func['name']): - continue - camel_case_name_with_suffix = util.underscore_to_camelcase_upper(func['name']) + if util.is_control_ping(camel_case_name_with_suffix): + # Skip control ping managed by jvpp registry. continue + if util.is_dump(func['name']) or util.is_request(func['name'], func_list): + continue + + # Generate callbacks for all messages except for dumps and requests (handled by vpp, not client). notification_dto = camel_case_name_with_suffix callback_ifc = camel_case_name_with_suffix + callback_gen.callback_suffix fully_qualified_callback_ifc = "{0}.{1}.{2}".format(plugin_package, callback_package, callback_ifc) @@ -164,7 +166,6 @@ def generate_notification_registry(func_list, base_package, plugin_package, plug notification_reply=camel_case_name_with_suffix, callback=callback_ifc)) - callback_file = open(os.path.join(notification_package, "%sEventRegistry.java" % plugin_name), 'w') callback_file.write(notification_registry_template.substitute(inputfile=inputfile, register_callback_methods="\n ".join(register_callback_methods), |