Search in sources :

Example 1 with HostHighlight

use of org.onosproject.ui.topo.HostHighlight in project onos by opennetworkinglab.

the class PathPainterTopovMessageHandler method addHostBadge.

private Highlights addHostBadge(Highlights h, String elemId, String type) {
    HostHighlight hh = new HostHighlight(elemId);
    hh.setBadge(createBadge(type));
    h.add(hh);
    return h;
}
Also used : HostHighlight(org.onosproject.ui.topo.HostHighlight)

Example 2 with HostHighlight

use of org.onosproject.ui.topo.HostHighlight in project onos by opennetworkinglab.

the class OpenstackNetworkingUiMessageHandler method hostHighlightsInSameNetwork.

private Set<HostHighlight> hostHighlightsInSameNetwork(HostId hostId) {
    Set<HostHighlight> hostHighlights = Sets.newHashSet();
    Streams.stream(hostService.getHosts()).filter(host -> isHostInSameNetwork(host, networkId(hostId))).forEach(host -> {
        HostHighlight hostHighlight = new HostHighlight(host.id().toString());
        hostHighlight.setBadge(createBadge(getVni(host)));
        hostHighlights.add(hostHighlight);
    });
    return hostHighlights;
}
Also used : DefaultEdgeLink.createEdgeLink(org.onosproject.net.DefaultEdgeLink.createEdgeLink) InstancePort(org.onosproject.openstacknetworking.api.InstancePort) DeviceService(org.onosproject.net.device.DeviceService) LoggerFactory(org.slf4j.LoggerFactory) Tools.groupedThreads(org.onlab.util.Tools.groupedThreads) Highlights(org.onosproject.ui.topo.Highlights) ServiceDirectory(org.onlab.osgi.ServiceDirectory) ByteArrayInputStream(java.io.ByteArrayInputStream) VLAN(org.onosproject.openstacknetworking.api.OpenstackNetwork.Type.VLAN) Type(org.onosproject.openstacknetworking.api.OpenstackNetwork.Type) NodeBadge(org.onosproject.ui.topo.NodeBadge) GRE(org.onosproject.openstacknetworking.api.OpenstackNetwork.Type.GRE) OpenstackNodeService(org.onosproject.openstacknode.api.OpenstackNodeService) ImmutableSet(com.google.common.collect.ImmutableSet) Device(org.onosproject.net.Device) PathService(org.onosproject.net.topology.PathService) Collection(java.util.Collection) Set(java.util.Set) ClientChannelEvent(org.apache.sshd.client.channel.ClientChannelEvent) Executors.newSingleThreadExecutor(java.util.concurrent.Executors.newSingleThreadExecutor) Streams(com.google.common.collect.Streams) Sets(com.google.common.collect.Sets) OpenstackSshAuth(org.onosproject.openstacknode.api.OpenstackSshAuth) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) List(java.util.List) ClientChannel(org.apache.sshd.client.channel.ClientChannel) Optional(java.util.Optional) Path(org.onosproject.net.Path) DeviceId(org.onosproject.net.DeviceId) Status(org.onosproject.ui.topo.NodeBadge.Status) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Host(org.onosproject.net.Host) OpenstackNode(org.onosproject.openstacknode.api.OpenstackNode) HostService(org.onosproject.net.host.HostService) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) UiConnection(org.onosproject.ui.UiConnection) TopoJson(org.onosproject.ui.topo.TopoJson) OpenFuture(org.apache.sshd.client.future.OpenFuture) Strings(com.google.common.base.Strings) OpenstackNetworkService(org.onosproject.openstacknetworking.api.OpenstackNetworkService) Lists(com.google.common.collect.Lists) HostHighlight(org.onosproject.ui.topo.HostHighlight) HostId(org.onosproject.net.HostId) ExecutorService(java.util.concurrent.ExecutorService) IpAddress(org.onlab.packet.IpAddress) RequestHandler(org.onosproject.ui.RequestHandler) OutputStream(java.io.OutputStream) Charsets(com.google.common.base.Charsets) ClientSession(org.apache.sshd.client.session.ClientSession) DEFAULT_GATEWAY_MAC_STR(org.onosproject.openstacknetworking.api.Constants.DEFAULT_GATEWAY_MAC_STR) Logger(org.slf4j.Logger) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) GENEVE(org.onosproject.openstacknetworking.api.OpenstackNetwork.Type.GENEVE) Element(org.onosproject.net.Element) TimeUnit(java.util.concurrent.TimeUnit) SshClient(org.apache.sshd.client.SshClient) NoCloseInputStream(org.apache.sshd.common.util.io.NoCloseInputStream) JsonUtils(org.onosproject.ui.JsonUtils) UiMessageHandler(org.onosproject.ui.UiMessageHandler) VXLAN(org.onosproject.openstacknetworking.api.OpenstackNetwork.Type.VXLAN) InstancePortService(org.onosproject.openstacknetworking.api.InstancePortService) InputStream(java.io.InputStream) HostHighlight(org.onosproject.ui.topo.HostHighlight)

Example 3 with HostHighlight

use of org.onosproject.ui.topo.HostHighlight in project onos by opennetworkinglab.

the class OpenstackNetworkingUiMessageHandler method sendMouseData.

private void sendMouseData() {
    Highlights highlights = new Highlights();
    if (elementOfNote instanceof Device) {
        DeviceId deviceId = (DeviceId) elementOfNote.id();
        List<OpenstackLink> edgeLinks = edgeLinks(deviceId);
        edgeLinks.forEach(edgeLink -> highlights.add(edgeLink.highlight(OpenstackLink.RequestType.DEVICE_SELECTED)));
        hostService.getConnectedHosts(deviceId).forEach(host -> {
            HostHighlight hostHighlight = new HostHighlight(host.id().toString());
            hostHighlight.setBadge(createBadge(getVni(host)));
            highlights.add(hostHighlight);
        });
        sendHighlights(highlights);
    } else if (elementOfNote instanceof Host) {
        HostId hostId = HostId.hostId(elementOfNote.id().toString());
        if (!hostMadeFromOpenstack(hostId)) {
            return;
        }
        List<OpenstackLink> openstackLinks = linksInSameNetwork(hostId);
        openstackLinks.forEach(openstackLink -> highlights.add(openstackLink.highlight(OpenstackLink.RequestType.HOST_SELECTED)));
        hostHighlightsInSameNetwork(hostId).forEach(highlights::add);
        sendHighlights(highlights);
    }
}
Also used : DefaultEdgeLink.createEdgeLink(org.onosproject.net.DefaultEdgeLink.createEdgeLink) InstancePort(org.onosproject.openstacknetworking.api.InstancePort) DeviceService(org.onosproject.net.device.DeviceService) LoggerFactory(org.slf4j.LoggerFactory) Tools.groupedThreads(org.onlab.util.Tools.groupedThreads) Highlights(org.onosproject.ui.topo.Highlights) ServiceDirectory(org.onlab.osgi.ServiceDirectory) ByteArrayInputStream(java.io.ByteArrayInputStream) VLAN(org.onosproject.openstacknetworking.api.OpenstackNetwork.Type.VLAN) Type(org.onosproject.openstacknetworking.api.OpenstackNetwork.Type) NodeBadge(org.onosproject.ui.topo.NodeBadge) GRE(org.onosproject.openstacknetworking.api.OpenstackNetwork.Type.GRE) OpenstackNodeService(org.onosproject.openstacknode.api.OpenstackNodeService) ImmutableSet(com.google.common.collect.ImmutableSet) Device(org.onosproject.net.Device) PathService(org.onosproject.net.topology.PathService) Collection(java.util.Collection) Set(java.util.Set) ClientChannelEvent(org.apache.sshd.client.channel.ClientChannelEvent) Executors.newSingleThreadExecutor(java.util.concurrent.Executors.newSingleThreadExecutor) Streams(com.google.common.collect.Streams) Sets(com.google.common.collect.Sets) OpenstackSshAuth(org.onosproject.openstacknode.api.OpenstackSshAuth) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) List(java.util.List) ClientChannel(org.apache.sshd.client.channel.ClientChannel) Optional(java.util.Optional) Path(org.onosproject.net.Path) DeviceId(org.onosproject.net.DeviceId) Status(org.onosproject.ui.topo.NodeBadge.Status) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Host(org.onosproject.net.Host) OpenstackNode(org.onosproject.openstacknode.api.OpenstackNode) HostService(org.onosproject.net.host.HostService) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) UiConnection(org.onosproject.ui.UiConnection) TopoJson(org.onosproject.ui.topo.TopoJson) OpenFuture(org.apache.sshd.client.future.OpenFuture) Strings(com.google.common.base.Strings) OpenstackNetworkService(org.onosproject.openstacknetworking.api.OpenstackNetworkService) Lists(com.google.common.collect.Lists) HostHighlight(org.onosproject.ui.topo.HostHighlight) HostId(org.onosproject.net.HostId) ExecutorService(java.util.concurrent.ExecutorService) IpAddress(org.onlab.packet.IpAddress) RequestHandler(org.onosproject.ui.RequestHandler) OutputStream(java.io.OutputStream) Charsets(com.google.common.base.Charsets) ClientSession(org.apache.sshd.client.session.ClientSession) DEFAULT_GATEWAY_MAC_STR(org.onosproject.openstacknetworking.api.Constants.DEFAULT_GATEWAY_MAC_STR) Logger(org.slf4j.Logger) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) GENEVE(org.onosproject.openstacknetworking.api.OpenstackNetwork.Type.GENEVE) Element(org.onosproject.net.Element) TimeUnit(java.util.concurrent.TimeUnit) SshClient(org.apache.sshd.client.SshClient) NoCloseInputStream(org.apache.sshd.common.util.io.NoCloseInputStream) JsonUtils(org.onosproject.ui.JsonUtils) UiMessageHandler(org.onosproject.ui.UiMessageHandler) VXLAN(org.onosproject.openstacknetworking.api.OpenstackNetwork.Type.VXLAN) InstancePortService(org.onosproject.openstacknetworking.api.InstancePortService) InputStream(java.io.InputStream) Highlights(org.onosproject.ui.topo.Highlights) Device(org.onosproject.net.Device) DeviceId(org.onosproject.net.DeviceId) HostHighlight(org.onosproject.ui.topo.HostHighlight) Host(org.onosproject.net.Host) List(java.util.List) HostId(org.onosproject.net.HostId)

Example 4 with HostHighlight

use of org.onosproject.ui.topo.HostHighlight in project onos by opennetworkinglab.

the class ProtectedIntentMonitor method ensureNodePresent.

// TODO duplicate and can be brought in abstract upper class.
private void ensureNodePresent(Highlights highlights, ElementId eid) {
    String id = eid.toString();
    NodeHighlight nh = highlights.getNode(id);
    if (nh == null) {
        if (eid instanceof DeviceId) {
            nh = new DeviceHighlight(id);
            highlights.add((DeviceHighlight) nh);
        } else if (eid instanceof HostId) {
            nh = new HostHighlight(id);
            highlights.add((HostHighlight) nh);
        }
    }
}
Also used : DeviceHighlight(org.onosproject.ui.topo.DeviceHighlight) DeviceId(org.onosproject.net.DeviceId) HostHighlight(org.onosproject.ui.topo.HostHighlight) NodeHighlight(org.onosproject.ui.topo.NodeHighlight) HostId(org.onosproject.net.HostId)

Example 5 with HostHighlight

use of org.onosproject.ui.topo.HostHighlight in project onos by opennetworkinglab.

the class TrafficMonitorBase method ensureNodePresent.

protected void ensureNodePresent(Highlights highlights, ElementId eid) {
    String id = eid.toString();
    NodeHighlight nh = highlights.getNode(id);
    if (nh == null) {
        if (eid instanceof DeviceId) {
            nh = new DeviceHighlight(id);
            highlights.add((DeviceHighlight) nh);
        } else if (eid instanceof HostId) {
            nh = new HostHighlight(id);
            highlights.add((HostHighlight) nh);
        }
    }
}
Also used : DeviceHighlight(org.onosproject.ui.topo.DeviceHighlight) DeviceId(org.onosproject.net.DeviceId) HostHighlight(org.onosproject.ui.topo.HostHighlight) NodeHighlight(org.onosproject.ui.topo.NodeHighlight) HostId(org.onosproject.net.HostId)

Aggregations

HostHighlight (org.onosproject.ui.topo.HostHighlight)5 DeviceId (org.onosproject.net.DeviceId)4 HostId (org.onosproject.net.HostId)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 Charsets (com.google.common.base.Charsets)2 Strings (com.google.common.base.Strings)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 Lists (com.google.common.collect.Lists)2 Sets (com.google.common.collect.Sets)2 Streams (com.google.common.collect.Streams)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 InputStream (java.io.InputStream)2 OutputStream (java.io.OutputStream)2 Collection (java.util.Collection)2 List (java.util.List)2 Optional (java.util.Optional)2 Set (java.util.Set)2