- public SessionNegotiator getSessionNegotiator(SessionListenerFactory sessionListenerFactory, Channel channel,
- Promise promise) {
- // Hello message needs to be recreated every time
- NetconfSessionPreferences proposal = new NetconfSessionPreferences(loadHelloMessageTemplate());
+ public SessionNegotiator<NetconfClientSession> getSessionNegotiator(SessionListenerFactory<NetconfClientSessionListener> sessionListenerFactory,
+ Channel channel,
+ Promise<NetconfClientSession> promise) {
+
+ NetconfMessage startExiMessage = NetconfStartExiMessage.create(options, START_EXI_MESSAGE_ID);
+ NetconfHelloMessage helloMessage = null;
+ try {
+ helloMessage = NetconfHelloMessage.createClientHello(CLIENT_CAPABILITIES, additionalHeader);
+ } catch (NetconfDocumentedException e) {
+ logger.error("Unable to create client hello message with capabilities {} and additional handler {}",CLIENT_CAPABILITIES,additionalHeader);
+ throw new IllegalStateException(e);
+ }
+
+ NetconfClientSessionPreferences proposal = new NetconfClientSessionPreferences(helloMessage,startExiMessage);