BUG-4322: Leafref should not have a default value 53/28253/2
authorRobert Varga <nite@hq.sk>
Sat, 10 Oct 2015 18:05:18 +0000 (20:05 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 13 Oct 2015 08:18:31 +0000 (08:18 +0000)
RFC6020 does not mention anything about the default value for leaf
references.

Change-Id: I0edcfe286aa6ac6fd93bb5f0074a51aeb18627d8
Signed-off-by: Robert Varga <nite@hq.sk>
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Leafref.java
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/LeafrefTest.java

index a51b513d9e8a708c1d12b83c681923c7392411c0..eab8b22ba81e2469f1f09695343056aa479e1796 100644 (file)
@@ -59,7 +59,7 @@ public final class Leafref implements LeafrefTypeDefinition {
 
     @Override
     public Object getDefaultValue() {
-        return this;
+        return null;
     }
 
     @Override
index f1ea79a28fb931c130784d41f45a41497e93b20c..2bf56314de42c9c835e67a32c846ee46bdf3934b 100644 (file)
@@ -35,7 +35,7 @@ public class LeafrefTest {
         assertNotNull("Object 'leafref' shouldn't be null.", leafref);
         assertNull("Base type of 'leafref' should be null.", leafref.getBaseType());
         assertTrue("Units of 'leafref' should be empty.", leafref.getUnits().isEmpty());
-        assertEquals("Default value of 'leafref' is 'leafref' itself.", leafref, leafref.getDefaultValue());
+        assertNull("Leafref does not have a default value", leafref.getDefaultValue());
         assertEquals("QName of 'leafref' is value '(urn:ietf:params:xml:ns:yang:1)leafref'.",
                 BaseTypes.constructQName("leafref"), leafref.getQName());
         assertEquals("SchemaPath of 'leafref' is '/Cont1/List1'.", schemaPath, leafref.getPath());