import io.netty.channel.Channel;
import io.netty.util.Timer;
import io.netty.util.concurrent.Promise;
+import org.opendaylight.controller.netconf.api.NetconfMessage;
import org.opendaylight.controller.netconf.api.NetconfSessionPreferences;
import org.opendaylight.controller.netconf.util.AbstractNetconfSessionNegotiator;
import org.opendaylight.controller.netconf.util.xml.XMLNetconfUtil;
AbstractNetconfSessionNegotiator<NetconfSessionPreferences, NetconfClientSession> {
protected NetconfClientSessionNegotiator(NetconfSessionPreferences sessionPreferences,
- Promise<NetconfClientSession> promise, Channel channel, Timer timer, SessionListener sessionListener) {
- super(sessionPreferences, promise, channel, timer, sessionListener);
+ Promise<NetconfClientSession> promise, Channel channel, Timer timer, SessionListener sessionListener,
+ long connectionTimeoutMillis) {
+ super(sessionPreferences, promise, channel, timer, sessionListener, connectionTimeoutMillis);
}
private static Collection<String> getCapabilities(Document doc) {
@Nullable
@Override
public String apply(@Nullable XmlElement input) {
- return input.getTextContent();
+ // Trim possible leading/tailing whitespace
+ return input.getTextContent().trim();
}
});
}
}
@Override
- protected NetconfClientSession getSession(SessionListener sessionListener, Channel channel, Document doc) {
- return new NetconfClientSession(sessionListener, channel, extractSessionId(doc), getCapabilities(doc));
+ protected NetconfClientSession getSession(SessionListener sessionListener, Channel channel, NetconfMessage message) {
+ return new NetconfClientSession(sessionListener, channel, extractSessionId(message.getDocument()),
+ getCapabilities(message.getDocument()));
}
}