Package org.onosproject.ui.topo
Class TopoUtils
- java.lang.Object
-
- org.onosproject.ui.topo.TopoUtils
-
public final class TopoUtils extends Object
Utility methods for helping out with formatting data for the Topology View in the web client.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTopoUtils.MagnitudeEnumeration of magnitudes.static classTopoUtils.ValueLabelEncapsulates a value to be used as a label.
-
Field Summary
Fields Modifier and Type Field Description static StringBITS_UNITstatic StringBYTES_UNITstatic doubleN_GIGAstatic doubleN_KILOstatic doubleN_MEGAstatic StringPACKETS_UNIT
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static LinkKeycanonicalLinkKey(Link link)Produces a canonical link key, that is, one that will match both a link and its inverse.static StringcompactLinkString(Link link)Returns a compact identity for the given link, in the form used to identify links in the Topology View on the client.static TopoUtils.ValueLabelformatBytes(long bytes)Returns a value representing a count of bytes.static TopoUtils.ValueLabelformatClippedBitRate(long bytes)Returns a value representing a count of bits per second, (clipped to a maximum of 100 Gbps).static StringformatFlows(long flows)Returns human readable flow count, to be displayed as a label.static TopoUtils.ValueLabelformatPacketRate(long packets)Returns a value representing a count of packets per second.
-
-
-
Field Detail
-
N_KILO
public static final double N_KILO
- See Also:
- Constant Field Values
-
N_MEGA
public static final double N_MEGA
- See Also:
- Constant Field Values
-
N_GIGA
public static final double N_GIGA
- See Also:
- Constant Field Values
-
BITS_UNIT
public static final String BITS_UNIT
- See Also:
- Constant Field Values
-
BYTES_UNIT
public static final String BYTES_UNIT
- See Also:
- Constant Field Values
-
PACKETS_UNIT
public static final String PACKETS_UNIT
- See Also:
- Constant Field Values
-
-
Method Detail
-
compactLinkString
public static String compactLinkString(Link link)
Returns a compact identity for the given link, in the form used to identify links in the Topology View on the client.- Parameters:
link- link- Returns:
- compact link identity
-
canonicalLinkKey
public static LinkKey canonicalLinkKey(Link link)
Produces a canonical link key, that is, one that will match both a link and its inverse.- Parameters:
link- the link- Returns:
- canonical key
-
formatBytes
public static TopoUtils.ValueLabel formatBytes(long bytes)
Returns a value representing a count of bytes.- Parameters:
bytes- number of bytes- Returns:
- value representing bytes
-
formatPacketRate
public static TopoUtils.ValueLabel formatPacketRate(long packets)
Returns a value representing a count of packets per second.- Parameters:
packets- number of packets (per second)- Returns:
- value representing packets per second
-
formatClippedBitRate
public static TopoUtils.ValueLabel formatClippedBitRate(long bytes)
Returns a value representing a count of bits per second, (clipped to a maximum of 100 Gbps). Note that the input is bytes per second.- Parameters:
bytes- bytes per second- Returns:
- value representing bits per second
-
formatFlows
public static String formatFlows(long flows)
Returns human readable flow count, to be displayed as a label.- Parameters:
flows- number of flows- Returns:
- formatted flow count
-
-