[NETCONF-1121] Refactor RemoteDeviceHandler Created: 05/Aug/23  Updated: 07/Aug/23

Status: Confirmed
Project: netconf
Component/s: netconf-client-mdsal
Affects Version/s: None
Fix Version/s: 7.0.0

Type: Improvement Priority: Medium
Reporter: Robert Varga Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Issue split
split from NETCONF-1097 NETCONF connection status behavior ch... Resolved

 Description   

This interface is completely undocumented and has a bit unfriendly interface. The interaction of the callbacks does not enforce the lifecycle of the state introduced on RemoteDeviceHandler's onRemoteDeviceUp() and hence it is not clear when onRemoteDeviceDown() can (and should) be closed vs. when onRemoteDeviceFailed() should be called.

Fix this by refacting as follows:

public interface RemoteDeviceHandler extends AutoCloseable {
    @NonNull RemoteDeviceConnection onDeviceConnected(NetconfDeviceSchema deviceSchema, NetconfSessionPreferences sessionPreferences, RemoteDeviceServices services);

    void onDeviceFailed(@NonNull Throwable throwable);

    @Override
    void close();
}

public abstract class RemoteDeviceConnection extends AbstractRegistration {

    public abstract void onNotification(@NonNull DOMNotification domNotification);
}

This will force idem


Generated at Wed Feb 07 20:16:43 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.