- @Override
- public synchronized Document onNetconfMessage(Document message,
- NetconfSession session) throws NetconfDocumentedException {
- NetconfOperationExecution netconfOperationExecution = getNetconfOperationWithHighestPriority(
- message, session);
- logger.debug("Forwarding netconf message {} to {}", XmlUtil.toString(message),
- netconfOperationExecution.operationWithHighestPriority);
-
- final LinkedList<NetconfOperationFilterChain> chain = new LinkedList<>();
- chain.push(netconfOperationExecution);
-
- for (Iterator<NetconfOperationFilter> it = allSortedFilters.descendingIterator(); it.hasNext();) {
- final NetconfOperationFilter filter = it.next();
- final NetconfOperationFilterChain prevItem = chain.getFirst();
- NetconfOperationFilterChain currentItem = new NetconfOperationFilterChain() {
- @Override
- public Document execute(Document message, NetconfOperationRouter operationRouter)
- throws NetconfDocumentedException {
- logger.trace("Entering {}", filter);
- return filter.doFilter(message, operationRouter, prevItem);
- }
- };
- chain.push(currentItem);
+ private static DocumentedException handleUnexpectedEx(final String s, final Exception e) throws DocumentedException {
+ LOG.error("{}", s, e);
+ return new DocumentedException("Unexpected error",
+ DocumentedException.ErrorType.application,
+ DocumentedException.ErrorTag.operation_failed,
+ DocumentedException.ErrorSeverity.error,
+ Collections.singletonMap(DocumentedException.ErrorSeverity.error.toString(), e.toString()));
+ }
+
+ private Document executeOperationWithHighestPriority(final Document message,
+ final NetconfOperationExecution netconfOperationExecution)
+ throws DocumentedException {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Forwarding netconf message {} to {}", XmlUtil.toString(message), netconfOperationExecution.netconfOperation);