Skip to content

NMS-19644: Expose SnmpInterfaceDao and ResourceDao in GraphML infopanel context#8400

Closed
dino2gnt wants to merge 8 commits intofoundation-2024from
dcy/infopanelsnmpinterfacedao
Closed

NMS-19644: Expose SnmpInterfaceDao and ResourceDao in GraphML infopanel context#8400
dino2gnt wants to merge 8 commits intofoundation-2024from
dcy/infopanelsnmpinterfacedao

Conversation

@dino2gnt
Copy link
Copy Markdown
Contributor

@dino2gnt dino2gnt commented Mar 27, 2026

Expose an SnmpInterfaceDao and a ResourceDao in the graphml infopanel context. This allows the user to enumerate SnmpInterfaces, for example to locate a specific interface using properties from the graphml topo, or leverage the ResourceDao to quickly build a resourceId to pass to the measurements helper, or dynamically determine if a specific resource or attribute exists.

I think this will be helpful, and I'd rather have it and not need it than need it and not have it.

External References

@dino2gnt dino2gnt changed the title NMS-19644: Expose an SnmpInterfaceDao in GraphML infopanel context NMS-19644: Expose SnmpInterfaceDao and ResourceDao in GraphML infopanel context Mar 28, 2026
@dino2gnt
Copy link
Copy Markdown
Contributor Author

ResourceDao taking a OnmsNode is super inconvenient :/

…eatures/topology-map/org.opennms.features.topology.app/src/main/java/org/opennms/features/topology/app/internal/info/GenericInfoPanelItemProvider.java
@dino2gnt
Copy link
Copy Markdown
Contributor Author

dino2gnt commented Apr 1, 2026

Accidentally polluted this with a cherry-pick from develop that is required to build RPMs in my environment, which I have now reverted.

Copy link
Copy Markdown
Contributor

@garcia-sr garcia-sr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Very awesome.

synqotik
synqotik previously approved these changes Apr 1, 2026
Copy link
Copy Markdown
Contributor

@synqotik synqotik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Contributor

@cgorantla cgorantla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dino2gnt Check if we can avoid adding nodeDao and snmpInterfaceDao here.

Also better to add objects instead of Daos for this context.

if (abstractVertex.getNodeID() != null) {
final OnmsNode node = this.nodeDao.get(abstractVertex.getNodeID());
if (node != null) {
context.put("node", node);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we already have node object in context from which we can derive snmp interfaces.

Copy link
Copy Markdown
Contributor Author

@dino2gnt dino2gnt Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The node is only populated if the graphml topology defines a nodeID property, or foreignID and foreignSource on the vertex. In the particular case I'm working with, most of the topology is describing edges (i.e. links between vertexes), not actual vertexes, so there are properties defined that describe both ends of the link with the expectation that clicking on the link will show metrics from both the "local" and "remote" side of the "edge". That's a long way of saying node is never populated in this use case and even if it were, it would only get us half the data the customer wants.

The problem I'm ultimately trying to solve is that I have, in the context of the edge, a foreignsource (known), and a "local" and "remote" foreignid (in the topo) I can leverage fetch the node, and either full or partial "local" and "remote" device interface names from the topo from which to derive a resourceid I can then use to fetch metrics for these layer 1 interfaces. There is also an snmp interface for the layer 3 network interface that has the actual traffic octets metrics. I'm trying to get sufficient tools in the jinjava infopanel context that I can dynamically determine the involved measurements resourceid and metric attributes for the layer 1 interfaces, and the layer 3 interface, without resorting to string mangling and concatenation (because it feels wrong).

I think putting prefetched object instead of the Dao would require knowing beforehand what I need to fetch, and I don't - which is my core problem.

Copy link
Copy Markdown
Contributor

@cgorantla cgorantla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exposing these daos will lead to template injection issues. There is no easy way to restrict this to read only from jinjava.

Other way is to write a wrapper and expose read only method and what's needed.

@dino2gnt
Copy link
Copy Markdown
Contributor Author

dino2gnt commented Apr 1, 2026

the ResourceDao is okay, though, yeah?

@cgorantla
Copy link
Copy Markdown
Contributor

the ResourceDao is okay, though, yeah?

even that has ResourceDao.deleteResourceById().
Even for something like drools rules, we only allow specific methods through AlarmService.

I think writing wrapper might be the best way to do this. I can help you here.

@synqotik synqotik self-requested a review April 2, 2026 00:06
@synqotik synqotik dismissed their stale review April 2, 2026 00:07

Looks like there are some issues.

@dino2gnt dino2gnt closed this Apr 2, 2026
@dino2gnt dino2gnt deleted the dcy/infopanelsnmpinterfacedao branch April 2, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants