Search in sources :

Example 16 with AbstractVertex

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;
}
Also used : AbstractVertex(org.opennms.features.topology.api.topo.AbstractVertex)

Example 17 with AbstractVertex

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;
}
Also used : FormLayout(com.vaadin.ui.FormLayout) AbstractVertex(org.opennms.features.topology.api.topo.AbstractVertex)

Example 18 with AbstractVertex

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;
}
Also used : AbstractVertex(org.opennms.features.topology.api.topo.AbstractVertex)

Example 19 with AbstractVertex

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());
    });
}
Also used : AbstractVertex(org.opennms.features.topology.api.topo.AbstractVertex) IpInterfaceDao(org.opennms.netmgt.dao.api.IpInterfaceDao) Arrays(java.util.Arrays) NodeDao(org.opennms.netmgt.dao.api.NodeDao) OnmsIpInterface(org.opennms.netmgt.model.OnmsIpInterface) Logger(org.slf4j.Logger) URLDecoder(java.net.URLDecoder) DefaultVertexHopCriteria(org.opennms.features.topology.api.support.VertexHopGraphProvider.DefaultVertexHopCriteria) AbstractTopologyProvider(org.opennms.features.topology.api.topo.AbstractTopologyProvider) LoggerFactory(org.slf4j.LoggerFactory) AbstractVertex(org.opennms.features.topology.api.topo.AbstractVertex) Function(java.util.function.Function) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) Sets(com.google.common.collect.Sets) Objects(java.util.Objects) List(java.util.List) Lists(com.google.common.collect.Lists) Map(java.util.Map) Defaults(org.opennms.features.topology.api.topo.Defaults) SelectionChangedListener(org.opennms.features.topology.api.browsers.SelectionChangedListener) VertexRef(org.opennms.features.topology.api.topo.VertexRef) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ContentType(org.opennms.features.topology.api.browsers.ContentType) OnmsNode(org.opennms.netmgt.model.OnmsNode) OnmsIpInterface(org.opennms.netmgt.model.OnmsIpInterface)

Example 20 with AbstractVertex

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;
}
Also used : AbstractVertex(org.opennms.features.topology.api.topo.AbstractVertex)

Aggregations

AbstractVertex (org.opennms.features.topology.api.topo.AbstractVertex)20 VertexRef (org.opennms.features.topology.api.topo.VertexRef)9 List (java.util.List)7 Map (java.util.Map)6 Objects (java.util.Objects)6 Function (java.util.function.Function)6 Collectors (java.util.stream.Collectors)6 Collection (java.util.Collection)4 Criteria (org.opennms.features.topology.api.topo.Criteria)4 OnmsNode (org.opennms.netmgt.model.OnmsNode)4 Lists (com.google.common.collect.Lists)3 Maps (com.google.common.collect.Maps)3 ArrayList (java.util.ArrayList)3 Set (java.util.Set)3 Test (org.junit.Test)3 Status (org.opennms.features.topology.api.topo.Status)3 StatusProvider (org.opennms.features.topology.api.topo.StatusProvider)3 Vertex (org.opennms.features.topology.api.topo.Vertex)3 VertexProvider (org.opennms.features.topology.api.topo.VertexProvider)3 AlarmSummary (org.opennms.netmgt.model.alarm.AlarmSummary)3