use of org.opennms.features.topology.api.topo.SimpleConnector in project opennms by OpenNMS.
the class SimpleGraphBuilder method edge.
public SimpleGraphBuilder edge(String id, String srcId, String tgtId) {
VertexRef srcVertex = m_graphProvider.getVertex(ns(), srcId);
if (srcVertex == null) {
srcVertex = new DefaultVertexRef(ns(), srcId);
}
VertexRef tgtVertex = m_graphProvider.getVertex(ns(), tgtId);
if (tgtVertex == null) {
tgtVertex = new DefaultVertexRef(ns(), tgtId);
}
SimpleConnector source = new SimpleConnector(ns(), srcId + "-" + id + "-connector", srcVertex);
SimpleConnector target = new SimpleConnector(ns(), tgtId + "-" + id + "-connector", tgtVertex);
m_currentEdge = new AbstractEdge(ns(), id, source, target);
source.setEdge(m_currentEdge);
target.setEdge(m_currentEdge);
m_graphProvider.addEdges(m_currentEdge);
return this;
}
use of org.opennms.features.topology.api.topo.SimpleConnector in project opennms by OpenNMS.
the class EnhancedLinkdTopologyProvider method connectVertices.
protected final LinkdEdge connectVertices(BridgeMacLink link, VertexRef sourceRef, VertexRef targetRef, String nameSpace) {
SimpleConnector source = new SimpleConnector(sourceRef.getNamespace(), sourceRef.getId() + "-" + link.getId() + "-connector", sourceRef);
SimpleConnector target = new SimpleConnector(targetRef.getNamespace(), targetRef.getId() + "-" + link.getId() + "-connector", targetRef);
LinkdEdge edge = new LinkdEdge(nameSpace, String.valueOf(link.getId()), source, target);
edge.setSourceNodeid(link.getNode().getId());
if (link.getBridgePortIfIndex() != null)
edge.setSourceEndPoint(String.valueOf(link.getBridgePortIfIndex()));
edge.setTargetEndPoint(String.valueOf(link.getMacAddress()));
addEdges(edge);
return edge;
}
use of org.opennms.features.topology.api.topo.SimpleConnector in project opennms by OpenNMS.
the class EnhancedLinkdTopologyProvider method connectVertices.
protected final LinkdEdge connectVertices(LinkDetail<?> linkdetail, String nameSpace) {
SimpleConnector source = new SimpleConnector(linkdetail.getSource().getNamespace(), linkdetail.getSource().getId() + "-" + linkdetail.getId() + "-connector", linkdetail.getSource());
SimpleConnector target = new SimpleConnector(linkdetail.getTarget().getNamespace(), linkdetail.getTarget().getId() + "-" + linkdetail.getId() + "-connector", linkdetail.getTarget());
LinkdEdge edge = new LinkdEdge(nameSpace, linkdetail.getId(), source, target);
try {
edge.setSourceNodeid(Integer.parseInt(linkdetail.getSource().getId()));
} catch (NumberFormatException e) {
}
try {
edge.setTargetNodeid(Integer.parseInt(linkdetail.getTarget().getId()));
} catch (NumberFormatException e) {
}
if (linkdetail.getSourceIfIndex() != null)
edge.setSourceEndPoint(String.valueOf(linkdetail.getSourceIfIndex()));
if (linkdetail.getTargetIfIndex() != null)
edge.setTargetEndPoint(String.valueOf(linkdetail.getTargetIfIndex()));
addEdges(edge);
return edge;
}
use of org.opennms.features.topology.api.topo.SimpleConnector in project opennms by OpenNMS.
the class SimpleEdgeBuilder method edge.
public SimpleEdgeBuilder edge(String id, String srcNs, String srcId, String tgtNs, String tgtId) {
VertexRef srcVertex = new DefaultVertexRef(srcNs, srcId);
VertexRef tgtVertex = new DefaultVertexRef(tgtNs, tgtId);
SimpleConnector source = new SimpleConnector(ns(), srcId + "-" + id + "-connector", srcVertex);
SimpleConnector target = new SimpleConnector(ns(), tgtId + "-" + id + "-connector", tgtVertex);
m_currentEdge = new AbstractEdge(ns(), id, source, target);
source.setEdge(m_currentEdge);
target.setEdge(m_currentEdge);
m_edgeProvider.add(m_currentEdge);
return this;
}
use of org.opennms.features.topology.api.topo.SimpleConnector in project opennms by OpenNMS.
the class EnhancedLinkdTopologyProvider method connectVertices.
protected final LinkdEdge connectVertices(BridgePort targetport, VertexRef sourceRef, VertexRef targetRef, String nameSpace) {
SimpleConnector source = new SimpleConnector(sourceRef.getNamespace(), sourceRef.getId() + "-" + targetRef.getId() + "-connector", sourceRef);
SimpleConnector target = new SimpleConnector(targetRef.getNamespace(), targetRef.getId() + "-" + sourceRef.getId() + "-connector", targetRef);
LinkdEdge edge = new LinkdEdge(nameSpace, targetRef.getId() + ":" + targetport.getBridgePort(), source, target);
edge.setTargetNodeid(targetport.getNode().getId());
if (targetport.getBridgePortIfIndex() != null)
edge.setTargetEndPoint(String.valueOf(targetport.getBridgePortIfIndex()));
addEdges(edge);
return edge;
}
Aggregations