Fix netconf operation serialization in nc 57/16257/3
authorMaros Marsalek <mmarsale@cisco.com>
Tue, 10 Mar 2015 12:29:27 +0000 (13:29 +0100)
committerMaros Marsalek <mmarsale@cisco.com>
Tue, 10 Mar 2015 14:15:27 +0000 (15:15 +0100)
For delete operation, the netconf operation attribute was not added to the
normalizedNode structure.

Change-Id: Idbe65ff3a6eee6fa24d96c68f8ce59da03f4c91d
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/InstanceIdToNodes.java

index baa36d8..30a7efa 100644 (file)
@@ -167,8 +167,10 @@ public abstract class InstanceIdToNodes<T extends PathArgument> implements Ident
 
                 final YangInstanceIdentifier childId = YangInstanceIdentifier.create(Iterables.skip(id.getPathArguments(), 1));
                 builder.addChild(childOp.create(childId, lastChild, operation));
-            } else if(lastChild.isPresent()) {
-                builder.withValue(Lists.newArrayList((Collection<?>) lastChild.get().getValue()));
+            } else {
+                if(lastChild.isPresent()) {
+                    builder.withValue(Lists.newArrayList((Collection<?>) lastChild.get().getValue()));
+                }
                 if(operation.isPresent()) {
                     Preconditions.checkArgument(builder instanceof AttributesBuilder<?>);
                     addModifyOpIfPresent(operation, ((AttributesBuilder<?>) builder));
@@ -449,6 +451,7 @@ public abstract class InstanceIdToNodes<T extends PathArgument> implements Ident
 
             final NormalizedNodeAttrBuilder<NodeIdentifier, DOMSource, AnyXmlNode> builder =
                     Builders.anyXmlBuilder().withNodeIdentifier(getIdentifier());
+            addModifyOpIfPresent(operation, builder);
             return builder.build();
         }
 

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.