NMS-19644: Expose SnmpInterfaceDao and ResourceDao in GraphML infopanel context#8400
NMS-19644: Expose SnmpInterfaceDao and ResourceDao in GraphML infopanel context#8400dino2gnt wants to merge 8 commits intofoundation-2024from
Conversation
…in/resources/OSGI-INF/blueprint/blueprint.xml
|
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
|
Accidentally polluted this with a cherry-pick from |
| if (abstractVertex.getNodeID() != null) { | ||
| final OnmsNode node = this.nodeDao.get(abstractVertex.getNodeID()); | ||
| if (node != null) { | ||
| context.put("node", node); |
There was a problem hiding this comment.
Looks like we already have node object in context from which we can derive snmp interfaces.
There was a problem hiding this comment.
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.
cgorantla
left a comment
There was a problem hiding this comment.
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.
|
the ResourceDao is okay, though, yeah? |
even that has I think writing wrapper might be the best way to do this. I can help you here. |
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
ResourceDaoto quickly build aresourceIdto 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