import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
import org.opendaylight.controller.netconf.api.NetconfMessage;
import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
import org.opendaylight.controller.netconf.api.NetconfMessage;
import org.opendaylight.controller.netconf.api.NetconfTerminationReason;
import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationRouterImpl;
import org.opendaylight.controller.netconf.api.NetconfTerminationReason;
import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationRouterImpl;
import org.opendaylight.controller.netconf.util.messages.SendErrorExceptionUtil;
import org.opendaylight.controller.netconf.util.xml.XmlElement;
import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
import org.opendaylight.controller.netconf.util.xml.XmlUtil;
import org.opendaylight.controller.netconf.util.messages.SendErrorExceptionUtil;
import org.opendaylight.controller.netconf.util.xml.XmlElement;
import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
import org.opendaylight.controller.netconf.util.xml.XmlUtil;
-public class NetconfServerSessionListener implements
- SessionListener<NetconfMessage, NetconfServerSession, NetconfTerminationReason> {
-
- static final Logger logger = LoggerFactory.getLogger(NetconfServerSessionListener.class);
+public class NetconfServerSessionListener implements NetconfSessionListener<NetconfServerSession> {
- private NetconfOperationRouterImpl operationRouter;
+ static final Logger logger = LoggerFactory.getLogger(NetconfServerSessionListener.class);
+ private final SessionMonitoringService monitoringService;
+ private final NetconfOperationRouterImpl operationRouter;
}
@Override
public void onSessionDown(NetconfServerSession netconfNetconfServerSession, Exception e) {
logger.debug("Session {} down, reason: {}", netconfNetconfServerSession, e.getMessage());
}
@Override
public void onSessionDown(NetconfServerSession netconfNetconfServerSession, Exception e) {
logger.debug("Session {} down, reason: {}", netconfNetconfServerSession, e.getMessage());
NetconfTerminationReason netconfTerminationReason) {
logger.debug("Session {} terminated, reason: {}", netconfNetconfServerSession,
netconfTerminationReason.getErrorMessage());
NetconfTerminationReason netconfTerminationReason) {
logger.debug("Session {} terminated, reason: {}", netconfNetconfServerSession,
netconfTerminationReason.getErrorMessage());
throw new RuntimeException("Unable to process incoming message " + netconfMessage, e);
} catch (NetconfDocumentedException e) {
throw new RuntimeException("Unable to process incoming message " + netconfMessage, e);
} catch (NetconfDocumentedException e) {
final Document incommingDocument = netconfMessage.getDocument();
final Node rootNode = incommingDocument.getDocumentElement();
final Document incommingDocument = netconfMessage.getDocument();
final Node rootNode = incommingDocument.getDocumentElement();
final Document responseDocument = XmlUtil.newDocument();
Document rpcReply = operationRouter.onNetconfMessage(
incommingDocument, session);
final Document responseDocument = XmlUtil.newDocument();
Document rpcReply = operationRouter.onNetconfMessage(
incommingDocument, session);
responseDocument.appendChild(responseDocument.importNode(rpcReply.getDocumentElement(), true));
return new NetconfMessage(responseDocument);
} else {
responseDocument.appendChild(responseDocument.importNode(rpcReply.getDocumentElement(), true));
return new NetconfMessage(responseDocument);
} else {