Search in sources :

Example 1 with LinkHighlight

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

the class TrafficLink method highlightForStats.

private LinkHighlight highlightForStats(StatsType type) {
    ValueLabel vl = null;
    Mod m = null;
    // based on the type of stats, need to determine the label and "color"...
    switch(type) {
        case FLOW_STATS:
            vl = formatBytes(bytes);
            // default to "secondary highlighting" of link
            break;
        case PORT_STATS:
            vl = formatClippedBitRate(rate);
            // set color based on bits per second...
            if (vl.magnitude() == Magnitude.ONE || vl.magnitude() == Magnitude.KILO) {
                m = PORT_TRAFFIC_GREEN;
            } else if (vl.magnitude() == Magnitude.MEGA) {
                m = PORT_TRAFFIC_YELLOW;
            } else if (vl.magnitude() == Magnitude.GIGA) {
                m = vl.clipped() ? PORT_TRAFFIC_RED : PORT_TRAFFIC_ORANGE;
            }
            break;
        case PORT_PACKET_STATS:
            vl = formatPacketRate(rate);
            // set color based on bits per second...
            if (rate < 10) {
                m = PORT_TRAFFIC_GREEN;
            } else if (rate < 1000) {
                m = PORT_TRAFFIC_YELLOW;
            } else if (rate < 100000) {
                m = PORT_TRAFFIC_ORANGE;
            } else {
                m = PORT_TRAFFIC_RED;
            }
            break;
        default:
            break;
    }
    LinkHighlight hlite = new LinkHighlight(linkId(), SECONDARY_HIGHLIGHT);
    if (vl != null) {
        hlite.setLabel(vl.toString());
    }
    if (m != null) {
        hlite.addMod(m);
    }
    return addCustomMods(hlite);
}
Also used : Mod(org.onosproject.ui.topo.Mod) ValueLabel(org.onosproject.ui.topo.TopoUtils.ValueLabel) LinkHighlight(org.onosproject.ui.topo.LinkHighlight)

Example 2 with LinkHighlight

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

the class TrafficLink method highlightForFlowCount.

private LinkHighlight highlightForFlowCount() {
    Flavor flavor = flows > 0 ? PRIMARY_HIGHLIGHT : SECONDARY_HIGHLIGHT;
    LinkHighlight hlite = new LinkHighlight(linkId(), flavor).setLabel(formatFlows(flows));
    return addCustomMods(hlite);
}
Also used : LinkHighlight(org.onosproject.ui.topo.LinkHighlight) Flavor(org.onosproject.ui.topo.LinkHighlight.Flavor)

Example 3 with LinkHighlight

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

the class OpenstackLink method highlight.

@Override
public LinkHighlight highlight(Enum<?> type) {
    RequestType requestType = (RequestType) type;
    Mod m = null;
    switch(requestType) {
        case HOST_SELECTED:
            m = PORT_TRAFFIC_GREEN;
            break;
        case DEVICE_SELECTED:
            m = PORT_TRAFFIC_ORANGE;
            break;
        default:
            break;
    }
    LinkHighlight hlite = new LinkHighlight(linkId(), SECONDARY_HIGHLIGHT);
    if (m != null) {
        hlite.addMod(m);
    }
    return hlite;
}
Also used : Mod(org.onosproject.ui.topo.Mod) LinkHighlight(org.onosproject.ui.topo.LinkHighlight)

Aggregations

LinkHighlight (org.onosproject.ui.topo.LinkHighlight)3 Mod (org.onosproject.ui.topo.Mod)2 Flavor (org.onosproject.ui.topo.LinkHighlight.Flavor)1 ValueLabel (org.onosproject.ui.topo.TopoUtils.ValueLabel)1