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 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());
});
}
use of org.opennms.features.topology.api.topo.AbstractVertex in project opennms by OpenNMS.
the class VmwareTopologyProvider method createEntityVertex.
private AbstractVertex createEntityVertex(String vertexId, String vertexName, String iconKey) {
if (containsVertexId(vertexId)) {
return (AbstractVertex) getVertex(TOPOLOGY_NAMESPACE_VMWARE, vertexId);
}
AbstractVertex vertex = new AbstractVertex(TOPOLOGY_NAMESPACE_VMWARE, vertexId, vertexName);
vertex.setIconKey(iconKey);
return vertex;
}
Aggregations