use of org.opennms.features.topology.api.topo.AbstractVertex in project opennms by OpenNMS.
the class SimpleGraphBuilder method vertex.
public SimpleGraphBuilder vertex(String id) {
m_currentVertex = new AbstractVertex(ns(), id);
m_graphProvider.addVertices(m_currentVertex);
return this;
}
use of org.opennms.features.topology.api.topo.AbstractVertex in project opennms by OpenNMS.
the class DefaultVertexInfoPanelItemProvider method createComponent.
private Component createComponent(VertexRef ref) {
FormLayout formLayout = new FormLayout();
formLayout.setSpacing(false);
formLayout.setMargin(false);
formLayout.addComponent(createLabel("Name", ref.getLabel()));
formLayout.addComponent(createLabel("ID", String.format("%s:%s", ref.getNamespace(), ref.getId())));
if (ref instanceof AbstractVertex) {
AbstractVertex vertex = (AbstractVertex) ref;
formLayout.addComponent(createLabel("Icon Key", vertex.getIconKey()));
if (vertex.getIpAddress() != null) {
formLayout.addComponent(createLabel("IP Address", vertex.getIpAddress()));
}
}
return formLayout;
}
use of org.opennms.features.topology.api.topo.AbstractVertex in project opennms by OpenNMS.
the class LinkdEdgeStatusProviderTest method setUp.
@Before
public void setUp() {
m_node1 = new OnmsNode();
m_node1.setId(1);
m_node2 = new OnmsNode();
m_node2.setId(2);
m_node3 = new OnmsNode();
m_node3.setId(3);
m_node4 = new OnmsNode();
m_node4.setId(4);
m_node5 = new OnmsNode();
m_node5.setId(5);
m_nodeDehli = new OnmsNode();
m_nodeDehli.setId(10);
m_nodeChennai = new OnmsNode();
m_nodeChennai.setId(14);
m_edges = new ArrayList<LinkdEdge>();
Vertex sourceCloud = new AbstractVertex("nodes", "1", "source");
// Cloud is identified by the designated bridge and designated port
Vertex cloud = new AbstractVertex("nodes", "1:48", "cloud");
Vertex targetCloud1 = new AbstractVertex("nodes", "2", "target1");
Vertex targetCloud2 = new AbstractVertex("nodes", "3", "target2");
Vertex source = new AbstractVertex("nodes", "4", "source");
Vertex target = new AbstractVertex("nodes", "5", "target");
Vertex dehli = new AbstractVertex("nodes", "10", "dehli");
Vertex chennai = new AbstractVertex("nodes", "14", "chennai");
// identification of link is done with targets id..that is port or mac
BridgePort bpnode1port48 = new BridgePort();
bpnode1port48.setNode(m_node1);
bpnode1port48.setBridgePort(48);
bpnode1port48.setBridgePortIfIndex(48);
m_edges.add(connectVertices(bpnode1port48, cloud, sourceCloud, BRIDGE_EDGE_NAMESPACE));
BridgePort bpnode2port24 = new BridgePort();
bpnode2port24.setNode(m_node2);
bpnode2port24.setBridgePort(24);
bpnode2port24.setBridgePortIfIndex(24);
m_edges.add(connectVertices(bpnode2port24, cloud, targetCloud1, BRIDGE_EDGE_NAMESPACE));
m_edges.add(connectCloudMacVertices("a8d0e5a0a467", cloud, targetCloud2, BRIDGE_EDGE_NAMESPACE));
// isis link
IsIsLink link1 = createIsIsLink(m_node4, 599, 599, 1, 1, "001f12accbf1", "000110255062");
link1.setId(104);
IsIsLink link2 = createIsIsLink(m_node5, 578, 578, 1, 1, "0021590e47c1", "000110088500");
link2.setId(105);
m_edges.add(connectVertices(new IsIsLinkDetail(Math.min(link1.getId(), link2.getId()) + "|" + Math.max(link1.getId(), link2.getId()), source, link1.getId(), link1.getIsisCircIfIndex(), target, link2.getId(), link2.getIsisCircIfIndex()), ISIS_EDGE_NAMESPACE));
// lldp link
LldpLink link3 = new LldpLink(m_node4, 12, 1, "node4PortId", "node4PortDescr", LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, "node4ChassisId", "node4SysName", LldpChassisIdSubType.LLDP_CHASSISID_SUBTYPE_LOCAL, "node4PortId", LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, "node2PortDescr");
link3.setId(204);
LldpLink link4 = new LldpLink(m_node5, 21, 2, "node5PortId", "node5PortDescr", LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, "node5ChassisId", "node5SysName", LldpChassisIdSubType.LLDP_CHASSISID_SUBTYPE_LOCAL, "node5PortId", LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, "node1PortDescr");
link4.setId(205);
m_edges.add(connectVertices(new LldpLinkDetail(Math.min(link3.getId(), link4.getId()) + "|" + Math.max(link3.getId(), link4.getId()), source, link3, target, link4), LLDP_EDGE_NAMESPACE));
//ospf link
OspfLink link5 = createOspfLink(m_node4, "192.168.100.246", "255.255.255.252", 0, 10101, "192.168.100.249", "192.168.100.245", 0);
link5.setId(404);
OspfLink link6 = createOspfLink(m_node5, "192.168.100.245", "255.255.255.252", 0, 10100, "192.168.100.250", "192.168.100.246", 0);
link6.setId(405);
m_edges.add(connectVertices(new OspfLinkDetail(Math.min(link5.getId(), link6.getId()) + "|" + Math.max(link5.getId(), link6.getId()), source, link5, target, link6), OSPF_EDGE_NAMESPACE));
//cdp link
LinkdEdge edgeG = new LinkdEdge(EnhancedLinkdTopologyProvider.CDP_EDGE_NAMESPACE, "504|505", source, target);
edgeG.setSourceNodeid(m_node4.getId());
edgeG.setTargetNodeid(m_node5.getId());
edgeG.setSourceEndPoint("101");
edgeG.setTargetEndPoint("100");
m_edges.add(edgeG);
// another ospf link
LinkdEdge edgeChennaiTodehli = new LinkdEdge(EnhancedLinkdTopologyProvider.OSPF_EDGE_NAMESPACE, "310|314", dehli, chennai);
edgeChennaiTodehli.setSourceNodeid(m_nodeDehli.getId());
edgeChennaiTodehli.setTargetNodeid(m_nodeChennai.getId());
edgeChennaiTodehli.setSourceEndPoint("13");
edgeChennaiTodehli.setTargetEndPoint("13");
m_edges.add(edgeChennaiTodehli);
m_alarmDao = EasyMock.createMock(AlarmDao.class);
m_edgeProvider = EasyMock.createMock(EdgeProvider.class);
m_statusProvider = new LinkdEdgeStatusProvider();
m_statusProvider.setAlarmDao(m_alarmDao);
}
use of org.opennms.features.topology.api.topo.AbstractVertex in project opennms by OpenNMS.
the class VmwareTopologyProvider method createHostSystemVertex.
private AbstractVertex createHostSystemVertex(String vertexId, String vertexName, String primaryInterface, int id, String powerState) {
AbstractVertex vertex;
if ("poweredOn".equals(powerState)) {
vertex = createEntityVertex(vertexId, vertexName, Icons.HOSTSYSTEM_ON);
} else if ("poweredOff".equals(powerState)) {
vertex = createEntityVertex(vertexId, vertexName, Icons.HOSTSYSTEM_OFF);
} else if ("standBy".equals(powerState)) {
vertex = createEntityVertex(vertexId, vertexName, Icons.HOSTSYSTEM_STANDBY);
} else {
vertex = createEntityVertex(vertexId, vertexName, Icons.HOSTSYSTEM_UNKNOWN);
}
vertex.setIpAddress(primaryInterface);
vertex.setNodeID(id);
return vertex;
}
use of org.opennms.features.topology.api.topo.AbstractVertex in project opennms by OpenNMS.
the class VmwareTopologyProvider method addHostSystem.
private void addHostSystem(OnmsNode hostSystem) {
String vmwareManagementServer = hostSystem.getAssetRecord().getVmwareManagementServer().trim();
String vmwareManagedObjectId = hostSystem.getAssetRecord().getVmwareManagedObjectId().trim();
String vmwareState = hostSystem.getAssetRecord().getVmwareState().trim();
String primaryInterface = "unknown";
OnmsIpInterface ipInterface = m_ipInterfaceDao.findPrimaryInterfaceByNodeId(hostSystem.getId());
if (ipInterface != null) {
primaryInterface = ipInterface.getIpHostName();
}
AbstractVertex hostSystemVertex = createHostSystemVertex(vmwareManagementServer + "/" + vmwareManagedObjectId, hostSystem.getLabel(), primaryInterface, hostSystem.getId(), vmwareState);
addVertices(hostSystemVertex);
Map<String, ParsedEntity> parsedEntities = parseNodeAssets(hostSystem);
String datacenterName = parsedEntities.values().stream().filter(e -> "datacenter".equals(e.getEntityType())).findFirst().map(e -> parsedEntities.get(e.getEntityId()).getEntityName() + " (" + vmwareManagementServer + ")").orElse("Datacenter (" + vmwareManagementServer + ")");
AbstractVertex datacenterVertex = createDatacenterVertex(vmwareManagementServer, datacenterName);
addVertices(datacenterVertex);
if (!hostSystemVertex.equals(datacenterVertex)) {
connectVertices(hostSystemVertex, datacenterVertex);
}
parsedEntities.values().stream().filter(e -> "network".equals(e.getEntityType())).forEach(e -> {
AbstractVertex networkVertex = createNetworkVertex(vmwareManagementServer + "/" + e.getEntityId(), parsedEntities.get(e.getEntityId()).getEntityName());
addVertices(networkVertex);
connectVertices(vmwareManagementServer + "/" + vmwareManagedObjectId + "->" + e.getEntityId(), hostSystemVertex, networkVertex, getNamespace());
});
parsedEntities.values().stream().filter(e -> "datastore".equals(e.getEntityType())).forEach(e -> {
AbstractVertex datastoreVertex = createDatastoreVertex(vmwareManagementServer + "/" + e.getEntityId(), parsedEntities.get(e.getEntityId()).getEntityName());
addVertices(datastoreVertex);
connectVertices(vmwareManagementServer + "/" + vmwareManagedObjectId + "->" + e.getEntityId(), hostSystemVertex, datastoreVertex, getNamespace());
});
}
Aggregations