Package org.onosproject.net.device
Interface DeviceService
-
- All Superinterfaces:
ListenerService<DeviceEvent,DeviceListener>
- All Known Subinterfaces:
DeviceAdminService
- All Known Implementing Classes:
DeviceServiceAdapter
,ForwardingDeviceService
public interface DeviceService extends ListenerService<DeviceEvent,DeviceListener>
Service for interacting with the inventory of infrastructure devices.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default int
getAvailableDeviceCount()
Returns the number of currently available devices known to the system.java.lang.Iterable<Device>
getAvailableDevices()
Returns an iterable collection of all devices currently available to the system.java.lang.Iterable<Device>
getAvailableDevices(Device.Type type)
Returns an iterable collection of all devices currently available to the system by device type.default PortStatistics
getDeltaStatisticsForPort(DeviceId deviceId, PortNumber portNumber)
Returns the port specific port delta statistics associated with the device and port.Device
getDevice(DeviceId deviceId)
Returns the device with the specified identifier.int
getDeviceCount()
Returns the number of infrastructure devices known to the system.java.lang.Iterable<Device>
getDevices()
Returns a collection of the currently known infrastructure devices.java.lang.Iterable<Device>
getDevices(Device.Type type)
Returns a collection of the currently known infrastructure devices by device type.long
getLastUpdatedInstant(DeviceId deviceId)
Indicates the time at which the given device connected or disconnected from this controller instance.default Port
getPort(ConnectPoint cp)
Returns the port with the specified connect point.Port
getPort(DeviceId deviceId, PortNumber portNumber)
Returns the port with the specified number and hosted by the given device.java.util.List<PortStatistics>
getPortDeltaStatistics(DeviceId deviceId)
Returns the list of port delta statistics associated with the device.java.util.List<Port>
getPorts(DeviceId deviceId)
Returns the list of ports associated with the device.java.util.List<PortStatistics>
getPortStatistics(DeviceId deviceId)
Returns the list of port statistics associated with the device.MastershipRole
getRole(DeviceId deviceId)
Returns the current mastership role for the specified device.default PortStatistics
getStatisticsForPort(DeviceId deviceId, PortNumber portNumber)
Returns the port specific port statistics associated with the device and port.boolean
isAvailable(DeviceId deviceId)
Indicates whether or not the device is presently online and available.java.lang.String
localStatus(DeviceId deviceId)
Indicates how long ago the device connected or disconnected from this controller instance.-
Methods inherited from interface org.onosproject.event.ListenerService
addListener, removeListener
-
-
-
-
Method Detail
-
getDeviceCount
int getDeviceCount()
Returns the number of infrastructure devices known to the system.- Returns:
- number of infrastructure devices
-
getAvailableDeviceCount
default int getAvailableDeviceCount()
Returns the number of currently available devices known to the system.- Returns:
- number of available devices
-
getDevices
java.lang.Iterable<Device> getDevices()
Returns a collection of the currently known infrastructure devices.- Returns:
- collection of devices
-
getDevices
java.lang.Iterable<Device> getDevices(Device.Type type)
Returns a collection of the currently known infrastructure devices by device type.- Parameters:
type
- device type- Returns:
- collection of devices
-
getAvailableDevices
java.lang.Iterable<Device> getAvailableDevices()
Returns an iterable collection of all devices currently available to the system.- Returns:
- device collection
-
getAvailableDevices
java.lang.Iterable<Device> getAvailableDevices(Device.Type type)
Returns an iterable collection of all devices currently available to the system by device type.- Parameters:
type
- device type- Returns:
- device collection
-
getDevice
Device getDevice(DeviceId deviceId)
Returns the device with the specified identifier.- Parameters:
deviceId
- device identifier- Returns:
- device or null if one with the given identifier is not known
-
getRole
MastershipRole getRole(DeviceId deviceId)
Returns the current mastership role for the specified device.- Parameters:
deviceId
- device identifier- Returns:
- designated mastership role
-
getPorts
java.util.List<Port> getPorts(DeviceId deviceId)
Returns the list of ports associated with the device.- Parameters:
deviceId
- device identifier- Returns:
- list of ports
-
getPortStatistics
java.util.List<PortStatistics> getPortStatistics(DeviceId deviceId)
Returns the list of port statistics associated with the device.- Parameters:
deviceId
- device identifier- Returns:
- list of port statistics
-
getPortDeltaStatistics
java.util.List<PortStatistics> getPortDeltaStatistics(DeviceId deviceId)
Returns the list of port delta statistics associated with the device.- Parameters:
deviceId
- device identifier- Returns:
- list of port statistics
-
getStatisticsForPort
default PortStatistics getStatisticsForPort(DeviceId deviceId, PortNumber portNumber)
Returns the port specific port statistics associated with the device and port.- Parameters:
deviceId
- device identifierportNumber
- port identifier- Returns:
- port statistics of specified port
-
getDeltaStatisticsForPort
default PortStatistics getDeltaStatisticsForPort(DeviceId deviceId, PortNumber portNumber)
Returns the port specific port delta statistics associated with the device and port.- Parameters:
deviceId
- device identifierportNumber
- port identifier- Returns:
- port delta statistics of specified port
-
getPort
Port getPort(DeviceId deviceId, PortNumber portNumber)
Returns the port with the specified number and hosted by the given device.- Parameters:
deviceId
- device identifierportNumber
- port number- Returns:
- device port
-
getPort
default Port getPort(ConnectPoint cp)
Returns the port with the specified connect point.- Parameters:
cp
- connect point- Returns:
- device port
-
isAvailable
boolean isAvailable(DeviceId deviceId)
Indicates whether or not the device is presently online and available. Availability, unlike reachability, denotes whether ANY node in the cluster can discover that this device is in an operational state, this does not necessarily mean that there exists a node that can control this device.- Parameters:
deviceId
- device identifier- Returns:
- true if the device is available
-
localStatus
java.lang.String localStatus(DeviceId deviceId)
Indicates how long ago the device connected or disconnected from this controller instance.- Parameters:
deviceId
- device identifier- Returns:
- a human readable string indicating the time since the device connected-to or disconnected-from this controller instance.
-
getLastUpdatedInstant
long getLastUpdatedInstant(DeviceId deviceId)
Indicates the time at which the given device connected or disconnected from this controller instance.- Parameters:
deviceId
- device identifier- Returns:
- time offset in miliseconds from Epoch
-
-