Package org.onosproject.cli.net
Class DevicePortStatsCommand
- java.lang.Object
-
- org.onosproject.cli.AbstractShellCommand
-
- org.onosproject.cli.net.DevicePortStatsCommand
-
- All Implemented Interfaces:
org.apache.karaf.shell.api.action.Action
,CodecContext
public class DevicePortStatsCommand extends AbstractShellCommand
Lists port statistic of all ports in the system.
-
-
Field Summary
-
Fields inherited from class org.onosproject.cli.AbstractShellCommand
log
-
-
Constructor Summary
Constructors Constructor Description DevicePortStatsCommand()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doExecute()
Body of the shell command.static String
humanReadable(long bytes)
Converts bytes to human readable string with Kilo, Mega, Giga, etc.static String
humanReadableBps(float bps)
Converts bps to human readable format.protected com.fasterxml.jackson.databind.JsonNode
jsonPortStats(DeviceService deviceService, Iterable<Device> devices)
Produces JSON array containing portstats of the specified devices.protected com.fasterxml.jackson.databind.JsonNode
jsonPortStatsDelta(DeviceService deviceService, Iterable<Device> devices)
Produces JSON array containing delta portstats of the specified devices.-
Methods inherited from class org.onosproject.cli.AbstractShellCommand
annotations, annotations, annotations, appId, codec, error, execute, get, getService, jsonForEntity, mapper, outputJson, print
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.onosproject.codec.CodecContext
decode, encode
-
-
-
-
Method Detail
-
doExecute
protected void doExecute()
Description copied from class:AbstractShellCommand
Body of the shell command.- Specified by:
doExecute
in classAbstractShellCommand
-
jsonPortStats
protected com.fasterxml.jackson.databind.JsonNode jsonPortStats(DeviceService deviceService, Iterable<Device> devices)
Produces JSON array containing portstats of the specified devices.- Parameters:
deviceService
- device servicedevices
- collection of devices- Returns:
- JSON Array
-
jsonPortStatsDelta
protected com.fasterxml.jackson.databind.JsonNode jsonPortStatsDelta(DeviceService deviceService, Iterable<Device> devices)
Produces JSON array containing delta portstats of the specified devices.- Parameters:
deviceService
- device servicedevices
- collection of devices- Returns:
- JSON Array
-
humanReadable
public static String humanReadable(long bytes)
Converts bytes to human readable string with Kilo, Mega, Giga, etc.- Parameters:
bytes
- input byte array- Returns:
- human readble string
-
humanReadableBps
public static String humanReadableBps(float bps)
Converts bps to human readable format.- Parameters:
bps
- input rate- Returns:
- human readble string
-
-