Interface DeviceProvider

    • Method Detail

      • 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 identifier
        newRole - 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 identifier
        portNumber - port number
        enable - true if port is to be enabled, false to disable
      • 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