Search in sources :

Example 1 with NetconfSessionPreferences

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

the class Netconf539Test method setUp.

@Before
public void setUp() throws Exception {
    channel = new EmbeddedChannel();
    channel.pipeline().addLast(AbstractChannelInitializer.NETCONF_MESSAGE_ENCODER, new ChannelInboundHandlerAdapter());
    channel.pipeline().addLast(AbstractChannelInitializer.NETCONF_MESSAGE_DECODER, new NetconfXMLToHelloMessageDecoder());
    channel.pipeline().addLast(NETCONF_MESSAGE_FRAME_ENCODER, FramingMechanismHandlerFactory.createHandler(FramingMechanism.EOM));
    channel.pipeline().addLast(NETCONF_MESSAGE_AGGREGATOR, new NetconfEOMAggregator());
    final NetconfHelloMessage serverHello = NetconfHelloMessage.createClientHello(Collections.singleton(XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_BASE_1_1), Optional.empty());
    negotiator = new TestSessionNegotiator(new NetconfSessionPreferences(serverHello), promise, channel, new HashedWheelTimer(), listener, 100L);
}
Also used : NetconfXMLToHelloMessageDecoder(org.opendaylight.netconf.nettyutil.handler.NetconfXMLToHelloMessageDecoder) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) NetconfHelloMessage(org.opendaylight.netconf.api.messages.NetconfHelloMessage) HashedWheelTimer(io.netty.util.HashedWheelTimer) NetconfSessionPreferences(org.opendaylight.netconf.api.NetconfSessionPreferences) NetconfEOMAggregator(org.opendaylight.netconf.nettyutil.handler.NetconfEOMAggregator) ChannelInboundHandlerAdapter(io.netty.channel.ChannelInboundHandlerAdapter) Before(org.junit.Before)

Example 2 with NetconfSessionPreferences

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

the class AbstractNetconfSessionNegotiatorTest method setUp.

@Before
public void setUp() {
    channel = new EmbeddedChannel();
    xmlToHello = new NetconfXMLToHelloMessageDecoder();
    channel.pipeline().addLast(AbstractChannelInitializer.NETCONF_MESSAGE_ENCODER, new ChannelInboundHandlerAdapter());
    channel.pipeline().addLast(AbstractChannelInitializer.NETCONF_MESSAGE_DECODER, xmlToHello);
    channel.pipeline().addLast(NETCONF_MESSAGE_FRAME_ENCODER, FramingMechanismHandlerFactory.createHandler(FramingMechanism.EOM));
    channel.pipeline().addLast(NETCONF_MESSAGE_AGGREGATOR, new NetconfEOMAggregator());
    hello = NetconfHelloMessage.createClientHello(Set.of(), Optional.empty());
    helloBase11 = NetconfHelloMessage.createClientHello(Set.of(XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_BASE_1_1), Optional.empty());
    prefs = new NetconfSessionPreferences(helloBase11);
    doReturn(promise).when(promise).setFailure(any());
    negotiator = new TestSessionNegotiator(prefs, promise, channel, timer, listener, 100L);
}
Also used : NetconfXMLToHelloMessageDecoder(org.opendaylight.netconf.nettyutil.handler.NetconfXMLToHelloMessageDecoder) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) NetconfSessionPreferences(org.opendaylight.netconf.api.NetconfSessionPreferences) NetconfEOMAggregator(org.opendaylight.netconf.nettyutil.handler.NetconfEOMAggregator) ChannelInboundHandlerAdapter(io.netty.channel.ChannelInboundHandlerAdapter) Before(org.junit.Before)

Aggregations

ChannelInboundHandlerAdapter (io.netty.channel.ChannelInboundHandlerAdapter)2 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)2 Before (org.junit.Before)2 NetconfSessionPreferences (org.opendaylight.netconf.api.NetconfSessionPreferences)2 NetconfEOMAggregator (org.opendaylight.netconf.nettyutil.handler.NetconfEOMAggregator)2 NetconfXMLToHelloMessageDecoder (org.opendaylight.netconf.nettyutil.handler.NetconfXMLToHelloMessageDecoder)2 HashedWheelTimer (io.netty.util.HashedWheelTimer)1 NetconfHelloMessage (org.opendaylight.netconf.api.messages.NetconfHelloMessage)1