Package org.onosproject.ui.topo
Class TopoUtils
- java.lang.Object
-
- org.onosproject.ui.topo.TopoUtils
-
public final class TopoUtils extends java.lang.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 class
TopoUtils.Magnitude
Enumeration of magnitudes.static class
TopoUtils.ValueLabel
Encapsulates a value to be used as a label.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BITS_UNIT
static java.lang.String
BYTES_UNIT
static double
N_GIGA
static double
N_KILO
static double
N_MEGA
static java.lang.String
PACKETS_UNIT
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static LinkKey
canonicalLinkKey(Link link)
Produces a canonical link key, that is, one that will match both a link and its inverse.static java.lang.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.static TopoUtils.ValueLabel
formatBytes(long bytes)
Returns a value representing a count of bytes.static TopoUtils.ValueLabel
formatClippedBitRate(long bytes)
Returns a value representing a count of bits per second, (clipped to a maximum of 100 Gbps).static java.lang.String
formatFlows(long flows)
Returns human readable flow count, to be displayed as a label.static TopoUtils.ValueLabel
formatPacketRate(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 java.lang.String BITS_UNIT
- See Also:
- Constant Field Values
-
BYTES_UNIT
public static final java.lang.String BYTES_UNIT
- See Also:
- Constant Field Values
-
PACKETS_UNIT
public static final java.lang.String PACKETS_UNIT
- See Also:
- Constant Field Values
-
-
Method Detail
-
compactLinkString
public static java.lang.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 java.lang.String formatFlows(long flows)
Returns human readable flow count, to be displayed as a label.- Parameters:
flows
- number of flows- Returns:
- formatted flow count
-
-