Skip to content

NMS-20365: Plugin Management page - #8897

Open
joseanesONMS wants to merge 9 commits into
developfrom
jira/NMS-20365-plugin-management-smoke
Open

joseanesONMS wants to merge 9 commits into
developfrom
jira/NMS-20365-plugin-management-smoke

Conversation

@joseanesONMS

Copy link
Copy Markdown
Contributor

Adds a Plugin Management page under Administration that loads a plugin KAR through the UI or the REST API, checks it first, and unloads it again, replacing the copy-to-deploy and edit-featuresBoot.d procedure.

The container is reached through the bundle context Karaf already hands the webapp, so nothing new is exposed and the checks compare the plugin against the running server rather than against assumptions.

  • Checks before anything is written: archive structure, entries confined to repository/ and META-INF/, features file, bundles, package import ranges against the container's exports, Java requirement, duplicate name; a failure refuses the load, a warning must be acknowledged.
  • Load stages the KAR into deploy/ and writes the featuresBoot.d boot file; Karaf starts it within seconds unless the manifest opts out, in which case the page flags the restart and shows how to do it.
  • Unload removes the KAR and every boot-file line waiting for it, so the extender cannot hang at the next start.
  • Every action is written with user, address, checksum and outcome to plugin-management.log, shown on the page; the endpoints are admin-only in the security rules and in every handler.
  • The v2 REST server now accepts multipart attachments up to 512 MB; CXF's default cap of 50 MB refused real plugins with an empty 413.
  • Verified on a local instance with a valid test KAR (staged, started on restart, unloaded) and the ALEC 3.0.3 KAR, which is refused with 22 import-range failures against Integration API 2.0.1.

External References

Uploads a plugin KAR, checks it before anything is written (archive
structure, entries confined to repository/ and META-INF/, features file,
bundles, package imports against what the container exports, Java
requirement, duplicate name), stages it into deploy/ with a featuresBoot.d
boot file, lists the plugins known to the page and those found in deploy/,
and unloads one by removing both files. A restart is still needed for the
extender to read the boot file, so the page says so and shows how.

The container is reached through the bundle context Karaf already hands the
webapp, with the feature and KAR services looked up by name since their
packages are not exported to the webapp class space. Every action is
written with user, address, checksum and outcome to plugin-management.log.
Admin only, in the security rules and in every handler.
Karaf installs a staged KAR's features within seconds unless its manifest
says Karaf-Feature-Start: false, so only those, and unloads, now flag a
restart; a plugin whose features did not start after a boot is shown as
failed instead of staged forever. Optional package imports no longer fail
the compatibility check, the size limit is enforced before the upload is
read, unload also removes any boot-file line waiting for the KAR so the
extender cannot hang at startup, the boot file and registry are written
before the KAR moves so a partial failure leaves nothing unrecorded, and
audit lines strip control characters. Only exact .kar names count, as in
Karaf, and a name must start with a letter or digit since the extender
skips dot files.
CXF refuses multipart attachments above 50 MB by default with an empty 413,
below the service's own 512 MB check.
Core features that merely depend on the integration API were listed as
plugins. A feature now counts only when its repository is not one of the
boot repositories from org.apache.karaf.features.cfg and not an OpenNMS
Karaf artifact, and the response says which repository each came from.
@github-actions github-actions Bot added the docs label Sep 25, 2026
@github-actions
github-actions Bot requested a review from indigo423 September 25, 2026 14:34
The inspector no longer treats Maven metadata or empty XML files inside the
KAR as feature repositories, which refused a locally built plugin that was
otherwise compatible; only files named as features files or rooted in
<features> count, and a broken XML that is not one is a warning. The help
moves from an expanding panel to the Info button and dialog used on the
other admin pages. The activity log is a parsed table with search, plugin,
action and outcome filters, a line count up to the log endpoint's limit,
failed entries marked, and a download of the whole file. Statuses read
Loaded, Load pending restart, Unload pending restart, Unloaded, Failed to
start and Not managed here, and the banner counts loads and unloads.
The primary way to load a plugin is now its official repository: a shipped
catalog names the OpenNMS plugins and their GitHub repositories, the server
reads the releases, and on request downloads the chosen KAR itself and runs
the same checks as for an upload before the usual load. Downloads are https
only and limited to GitHub's hosts unless an allowlist property says
otherwise, every redirect is re-validated, sizes are bounded and hashed
while streaming. Release lists are cached for fifteen minutes and an
optional token property lifts GitHub's anonymous limit. Every network
failure reaches the page as a short message that says what to check and
that a file upload still works.

The temporary area now cleans itself: a scheduled sweep every fifteen
minutes drops uploads and downloads older than an hour that are not
deployed, strays at once, and keeps the area under two gigabytes with
in-flight transfers reserved, refusing a transfer that would not fit.
The file tab stays as the second way to load, the table shows each
plugin's source, and the audit log records fetches with their URL.
httpclient's transparent gunzip fails on GitHub's gzip plus chunked release
lists with a malformed-chunk error; identity encoding avoids it and GitHub
then sends a Content-Length.
Loading wrote every top-level feature of a KAR to the boot file, which for
ALEC meant starting its standalone, distributed and Sentinel modes at once.
The check now suggests the features to start, from the catalog for known
plugins or from the KAR when it has one obvious candidate, the page lets
the user tick them, and the boot file lists exactly those. A KAR that
declares no features fails its check with a note that it is probably a
build stub. Plugins loaded by hand appear with the features named in any
boot file that waits for them, or the KAR's own, and their live state,
marked as loaded by hand; managed rows follow their boot file too, so an
edited file is reflected instead of reported as a failure.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant