Fix Revision confusion 26/80226/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 7 Feb 2019 19:07:27 +0000 (20:07 +0100)
committerJakub Morvay <jakub.morvay@gmail.com>
Fri, 8 Feb 2019 07:11:20 +0000 (07:11 +0000)
yag-library-version is a YANG string, hence the leaf needs to be
set appropriately.

JIRA: NETCONF-606
Change-Id: Iae705bf924de943871b49a8d3b39f7b7b4a55906
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit c3338ee3c2a3250ec98a4a6a0f4fcf3322e0dec2)

restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/services/simple/impl/RestconfImpl.java
restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/services/simple/impl/RestconfImplTest.java

index da89d99bcfd227666b1387888963513b9707e810..e3db40ba725c62d726dfe600d688cb361c1cf783 100644 (file)
@@ -49,8 +49,8 @@ public class RestconfImpl implements RestconfService {
                 QName.create(RestconfModule.IETF_RESTCONF_QNAME, RestconfModule.LIB_VER_LEAF_SCHEMA_NODE));
         final InstanceIdentifierContext<? extends SchemaNode> iid =
                 new InstanceIdentifierContext<>(yangIId, schemaNode, null, context);
-        final NormalizedNode<?, ?> data =
-                Builders.leafBuilder((LeafSchemaNode) schemaNode).withValue(IetfYangLibrary.REVISION).build();
+        final NormalizedNode<?, ?> data = Builders.leafBuilder((LeafSchemaNode) schemaNode)
+                .withValue(IetfYangLibrary.REVISION.toString()).build();
         return new NormalizedNodeContext(iid, data);
     }
 
index bec5c7be12ec25c6f6295a294aa13807a21ade40..01aa0f409e15c317ba15b34c9eb7ac727b69f43a 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.restconf.nb.rfc8040.services.simple.impl;
 
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+
 import org.junit.Test;
 import org.opendaylight.restconf.common.context.NormalizedNodeContext;
 import org.opendaylight.restconf.nb.rfc8040.Rfc8040.IetfYangLibrary;
@@ -28,6 +29,6 @@ public class RestconfImplTest {
         final RestconfImpl restconfImpl = new RestconfImpl(schemaContextHandler);
         final NormalizedNodeContext libraryVersion = restconfImpl.getLibraryVersion();
         final LeafNode<?> value = (LeafNode<?>) libraryVersion.getData();
-        Assert.assertEquals(IetfYangLibrary.REVISION, value.getValue());
+        assertEquals(IetfYangLibrary.REVISION.toString(), value.getValue());
     }
 }