Package org.onosproject.net.utils
Class ForwardingDeviceService
- java.lang.Object
-
- org.onosproject.net.utils.ForwardingDeviceService
-
- All Implemented Interfaces:
ListenerService<DeviceEvent,DeviceListener>
,DeviceService
@Beta public abstract class ForwardingDeviceService extends java.lang.Object implements DeviceService
A DeviceService which forwards all its method calls to another DeviceService.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ForwardingDeviceService(DeviceService delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(DeviceListener listener)
Adds the specified listener.protected DeviceService
delegate()
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.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.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.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.void
removeListener(DeviceListener listener)
Removes the specified listener.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.onosproject.net.device.DeviceService
getDeltaStatisticsForPort, getPort, getStatisticsForPort
-
-
-
-
Constructor Detail
-
ForwardingDeviceService
protected ForwardingDeviceService(DeviceService delegate)
-
-
Method Detail
-
delegate
protected final DeviceService delegate()
-
addListener
public void addListener(DeviceListener listener)
Description copied from interface:ListenerService
Adds the specified listener.- Specified by:
addListener
in interfaceListenerService<DeviceEvent,DeviceListener>
- Parameters:
listener
- listener to be added
-
removeListener
public void removeListener(DeviceListener listener)
Description copied from interface:ListenerService
Removes the specified listener.- Specified by:
removeListener
in interfaceListenerService<DeviceEvent,DeviceListener>
- Parameters:
listener
- listener to be removed
-
getDeviceCount
public int getDeviceCount()
Description copied from interface:DeviceService
Returns the number of infrastructure devices known to the system.- Specified by:
getDeviceCount
in interfaceDeviceService
- Returns:
- number of infrastructure devices
-
getAvailableDeviceCount
public int getAvailableDeviceCount()
Description copied from interface:DeviceService
Returns the number of currently available devices known to the system.- Specified by:
getAvailableDeviceCount
in interfaceDeviceService
- Returns:
- number of available devices
-
getDevices
public java.lang.Iterable<Device> getDevices()
Description copied from interface:DeviceService
Returns a collection of the currently known infrastructure devices.- Specified by:
getDevices
in interfaceDeviceService
- Returns:
- collection of devices
-
getDevices
public java.lang.Iterable<Device> getDevices(Device.Type type)
Description copied from interface:DeviceService
Returns a collection of the currently known infrastructure devices by device type.- Specified by:
getDevices
in interfaceDeviceService
- Parameters:
type
- device type- Returns:
- collection of devices
-
getAvailableDevices
public java.lang.Iterable<Device> getAvailableDevices()
Description copied from interface:DeviceService
Returns an iterable collection of all devices currently available to the system.- Specified by:
getAvailableDevices
in interfaceDeviceService
- Returns:
- device collection
-
getAvailableDevices
public java.lang.Iterable<Device> getAvailableDevices(Device.Type type)
Description copied from interface:DeviceService
Returns an iterable collection of all devices currently available to the system by device type.- Specified by:
getAvailableDevices
in interfaceDeviceService
- Parameters:
type
- device type- Returns:
- device collection
-
getDevice
public Device getDevice(DeviceId deviceId)
Description copied from interface:DeviceService
Returns the device with the specified identifier.- Specified by:
getDevice
in interfaceDeviceService
- Parameters:
deviceId
- device identifier- Returns:
- device or null if one with the given identifier is not known
-
getRole
public MastershipRole getRole(DeviceId deviceId)
Description copied from interface:DeviceService
Returns the current mastership role for the specified device.- Specified by:
getRole
in interfaceDeviceService
- Parameters:
deviceId
- device identifier- Returns:
- designated mastership role
-
getPorts
public java.util.List<Port> getPorts(DeviceId deviceId)
Description copied from interface:DeviceService
Returns the list of ports associated with the device.- Specified by:
getPorts
in interfaceDeviceService
- Parameters:
deviceId
- device identifier- Returns:
- list of ports
-
getPortStatistics
public java.util.List<PortStatistics> getPortStatistics(DeviceId deviceId)
Description copied from interface:DeviceService
Returns the list of port statistics associated with the device.- Specified by:
getPortStatistics
in interfaceDeviceService
- Parameters:
deviceId
- device identifier- Returns:
- list of port statistics
-
getPortDeltaStatistics
public java.util.List<PortStatistics> getPortDeltaStatistics(DeviceId deviceId)
Description copied from interface:DeviceService
Returns the list of port delta statistics associated with the device.- Specified by:
getPortDeltaStatistics
in interfaceDeviceService
- Parameters:
deviceId
- device identifier- Returns:
- list of port statistics
-
getPort
public Port getPort(DeviceId deviceId, PortNumber portNumber)
Description copied from interface:DeviceService
Returns the port with the specified number and hosted by the given device.- Specified by:
getPort
in interfaceDeviceService
- Parameters:
deviceId
- device identifierportNumber
- port number- Returns:
- device port
-
isAvailable
public boolean isAvailable(DeviceId deviceId)
Description copied from interface:DeviceService
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.- Specified by:
isAvailable
in interfaceDeviceService
- Parameters:
deviceId
- device identifier- Returns:
- true if the device is available
-
localStatus
public java.lang.String localStatus(DeviceId deviceId)
Description copied from interface:DeviceService
Indicates how long ago the device connected or disconnected from this controller instance.- Specified by:
localStatus
in interfaceDeviceService
- Parameters:
deviceId
- device identifier- Returns:
- a human readable string indicating the time since the device connected-to or disconnected-from this controller instance.
-
getLastUpdatedInstant
public long getLastUpdatedInstant(DeviceId deviceId)
Description copied from interface:DeviceService
Indicates the time at which the given device connected or disconnected from this controller instance.- Specified by:
getLastUpdatedInstant
in interfaceDeviceService
- Parameters:
deviceId
- device identifier- Returns:
- time offset in miliseconds from Epoch
-
-