BUG-372 Add reconnecting to netconf-connector for unexpected session drop
[controller.git] / opendaylight / md-sal / sal-netconf-connector / src / main / java / org / opendaylight / controller / sal / connect / netconf / NetconfMapping.java
index a6e6b3dfdf456d92711da924522d22de0aeea788..f76ec28624e158a3cfa5ad8050c13647b82e2163 100644 (file)
@@ -99,7 +99,11 @@ public class NetconfMapping {
 
         for (org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument component : Lists
                 .reverse(identifier.getPath())) {
-            previous = toNode(component, previous);
+            if (component instanceof NodeIdentifierWithPredicates) {
+                previous = toNode((NodeIdentifierWithPredicates)component, previous);
+            } else {
+                previous = toNode(component, previous);
+            }
         }
         return filter("subtree", previous);
     }
@@ -135,7 +139,7 @@ public class NetconfMapping {
             SchemaContext schemaContext = ctx.get();
             Set<NotificationDefinition> notifications = schemaContext.getNotifications();
             Document document = message.getDocument();
-            return XmlDocumentUtils.notificationToDomNodes(document, Optional.fromNullable(notifications));
+            return XmlDocumentUtils.notificationToDomNodes(document, Optional.fromNullable(notifications), ctx.get());
         }
         return null;
     }
@@ -192,13 +196,7 @@ public class NetconfMapping {
                 rawRpc = it.toInstance();
                 // sys(xmlData)
             } else {
-                RpcDefinition rpcSchema = Iterables.find(context.get().getOperations(), new Predicate<RpcDefinition>() {
-                    @Override
-                    public boolean apply(final RpcDefinition input) {
-                        return rpc == input.getQName();
-                    }
-                });
-                rawRpc = (CompositeNode) toCompositeNode(message.getDocument());
+                rawRpc = (CompositeNode) toCompositeNode(message, context);
             }
         else {
             rawRpc = (CompositeNode) toCompositeNode(message.getDocument());