Package org.onosproject.net.device
Interface DeviceProvider
-
- All Superinterfaces:
Provider
- All Known Implementing Classes:
AbstractDeviceProvider
public interface DeviceProvider extends Provider
Abstraction of a device information provider.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
changePortState(DeviceId deviceId, PortNumber portNumber, boolean enable)
Administratively enables or disables a port.default int
gracePeriod()
Return the grace period of this provider in milliseconds.default boolean
isAvailable(DeviceId deviceId)
Checks the availability of the device from the provider perspective.boolean
isReachable(DeviceId deviceId)
Checks the reachability (connectivity) of a device from this provider.default CompletableFuture<Boolean>
probeReachability(DeviceId deviceId)
Probe the reachability of the device from the provider perspective.void
roleChanged(DeviceId deviceId, MastershipRole newRole)
Notifies the provider of a mastership role change for the specified device as decided by the core.default void
triggerDisconnect(DeviceId deviceId)
Administratively triggers 'disconnection' from the device.void
triggerProbe(DeviceId deviceId)
Triggers an asynchronous probe of the specified device, intended to determine whether the device is present or not.
-
-
-
Method Detail
-
triggerProbe
void triggerProbe(DeviceId deviceId)
Triggers an asynchronous probe of the specified device, intended to determine whether the device is present or not. An indirect result of this should be invocation ofDeviceProviderService.deviceConnected(org.onosproject.net.DeviceId, org.onosproject.net.device.DeviceDescription)
)} orDeviceProviderService.deviceDisconnected(org.onosproject.net.DeviceId)
at some later point in time.- Parameters:
deviceId
- ID of device to be probed
-
roleChanged
void roleChanged(DeviceId deviceId, MastershipRole newRole)
Notifies the provider of a mastership role change for the specified device as decided by the core.- Parameters:
deviceId
- device identifiernewRole
- newly determined mastership role
-
isReachable
boolean isReachable(DeviceId deviceId)
Checks the reachability (connectivity) of a device from this provider. Reachability, unlike availability, denotes whether THIS particular node can send messages and receive replies from the specified device.Implementations are encouraged to check for reachability by using only internal provider state, i.e., without blocking execution.
- Parameters:
deviceId
- device identifier- Returns:
- true if reachable, false otherwise
-
isAvailable
default boolean isAvailable(DeviceId deviceId)
Checks the availability of the device from the provider perspective. Availability denotes whether the device is reachable by this node and able to perform its functions as expected (e.g., forward traffic).Implementations are encouraged to check for availability by using only internal provider state, i.e., without blocking execution.
- Parameters:
deviceId
- device identifier- Returns:
- completable future eventually true if available, false otherwise
-
changePortState
void changePortState(DeviceId deviceId, PortNumber portNumber, boolean enable)
Administratively enables or disables a port.- Parameters:
deviceId
- device identifierportNumber
- port numberenable
- true if port is to be enabled, false to disable
-
triggerDisconnect
default void triggerDisconnect(DeviceId deviceId)
Administratively triggers 'disconnection' from the device. This is meant purely in logical sense and is intended to apply equally to implementations relying on connectionless control protocols. An indirect result of this should be invocation ofDeviceProviderService.deviceDisconnected(org.onosproject.net.DeviceId)
if the device was presently 'connected' andDeviceProviderService.deviceConnected(org.onosproject.net.DeviceId, org.onosproject.net.device.DeviceDescription)
at some later point in time if the device is available and continues to be permitted to reconnect or if the provider continues to discover it.- Parameters:
deviceId
- device identifier
-
probeReachability
default CompletableFuture<Boolean> probeReachability(DeviceId deviceId)
Probe the reachability of the device from the provider perspective.Implementations are encouraged to provide an async implementation. With the respect of triggerProbe, this method returns whether or not was possible to send a message to the device from this instance. Instead, isReachable asses only the capability to send a message from this node but does not imply sending a message to the device.
- Parameters:
deviceId
- device identifier- Returns:
- completable future eventually true if reachable, false otherwise
-
gracePeriod
default int gracePeriod()
Return the grace period of this provider in milliseconds. With some devices, it might be required more time to establish a working channel. This method returns a grace period that should be respected before checking the reachability with the device.- Returns:
- the grace period of the device. 0 if the device is expected to be immediately functional
-
-