Search in sources :

Example 1 with NetconfClientSessionPreferences

use of org.opendaylight.netconf.api.NetconfClientSessionPreferences in project netconf by opendaylight.

the class NetconfClientSessionNegotiatorTest method createNetconfClientSessionNegotiator.

private NetconfClientSessionNegotiator createNetconfClientSessionNegotiator(final Promise<NetconfClientSession> promise, final NetconfMessage startExi) {
    ChannelProgressivePromise progressivePromise = mock(ChannelProgressivePromise.class);
    NetconfClientSessionPreferences preferences = new NetconfClientSessionPreferences(helloMessage, startExi);
    doReturn(progressivePromise).when(promise).setFailure(any(Throwable.class));
    long timeout = 10L;
    NetconfClientSessionListener sessionListener = mock(NetconfClientSessionListener.class);
    Timer timer = new HashedWheelTimer();
    return new NetconfClientSessionNegotiator(preferences, promise, channel, timer, sessionListener, timeout);
}
Also used : NetconfClientSessionPreferences(org.opendaylight.netconf.api.NetconfClientSessionPreferences) HashedWheelTimer(io.netty.util.HashedWheelTimer) Timer(io.netty.util.Timer) HashedWheelTimer(io.netty.util.HashedWheelTimer) ChannelProgressivePromise(io.netty.channel.ChannelProgressivePromise)

Example 2 with NetconfClientSessionPreferences

use of org.opendaylight.netconf.api.NetconfClientSessionPreferences in project netconf by opendaylight.

the class NetconfClientSessionNegotiatorFactory method getSessionNegotiator.

@Override
public NetconfClientSessionNegotiator getSessionNegotiator(final NetconfSessionListenerFactory<NetconfClientSessionListener> sessionListenerFactory, final Channel channel, final Promise<NetconfClientSession> promise) {
    NetconfMessage startExiMessage = NetconfStartExiMessage.create(options, START_EXI_MESSAGE_ID);
    NetconfHelloMessage helloMessage = NetconfHelloMessage.createClientHello(clientCapabilities, additionalHeader);
    NetconfClientSessionPreferences proposal = new NetconfClientSessionPreferences(helloMessage, startExiMessage);
    return new NetconfClientSessionNegotiator(proposal, promise, channel, timer, sessionListenerFactory.getSessionListener(), connectionTimeoutMillis);
}
Also used : NetconfClientSessionPreferences(org.opendaylight.netconf.api.NetconfClientSessionPreferences) NetconfMessage(org.opendaylight.netconf.api.NetconfMessage) NetconfHelloMessage(org.opendaylight.netconf.api.messages.NetconfHelloMessage)

Aggregations

NetconfClientSessionPreferences (org.opendaylight.netconf.api.NetconfClientSessionPreferences)2 ChannelProgressivePromise (io.netty.channel.ChannelProgressivePromise)1 HashedWheelTimer (io.netty.util.HashedWheelTimer)1 Timer (io.netty.util.Timer)1 NetconfMessage (org.opendaylight.netconf.api.NetconfMessage)1 NetconfHelloMessage (org.opendaylight.netconf.api.messages.NetconfHelloMessage)1