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/callback_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/callback_gen.py')
-rw-r--r-- | src/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py index e1c31dd6661..f0462158b9e 100644 --- a/src/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py +++ b/src/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py @@ -58,14 +58,15 @@ def generate_callbacks(func_list, base_package, plugin_package, plugin_name, cal callbacks = [] for func in func_list: - 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 not util.is_reply(camel_case_name_with_suffix) and not util.is_notification(func['name']): + 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). callback_type = "JVppCallback" callbacks.append("{0}.{1}.{2}".format(plugin_package, callback_package, camel_case_name_with_suffix + callback_suffix)) callback_path = os.path.join(callback_package, camel_case_name_with_suffix + callback_suffix + ".java") |