Uploaded image for project: 'mdsal'
  1. mdsal
  2. MDSAL-214

Instance identifier can't be used in union

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Done
    • None
    • None
    • None
    • None
    • Operating System: All
      Platform: All

    • 7425

    Description

      Following YANG is not compilable by yangtools:

      module demo {
      namespace "urn:opendaylight:demo";
      prefix "demo";
      revision "2016-12-22";

      typedef some-type {
      type union

      { type instance-identifier; type string; }

      }
      }

      Yangtools generated source code requires union members to have method "String getValue()", which is not case of built-in type InstanceIdentifier.
      This results in compilation error:

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project test-model: Compilation failure
      [ERROR] demo/target/generated-sources/mdsal-binding/org/opendaylight/yang/gen/v1/urn/opendaylight/demo/rev161222/SomeType.java:[63,45] cannot find symbol
      [ERROR] symbol: method getValue()
      [ERROR] location: variable _instanceIdentifier of type org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?>

      This is generated code (SomeType.java):

      60 public char[] getValue() {
      61 if (_value == null) {
      62 if (_instanceIdentifier != null)

      { 63 _value = _instanceIdentifier.getValue().toString().toCharArray(); 64 }

      else
      65 if (_string != null)

      { 66 _value = _string.toCharArray(); 67 }

      68 }
      69 return _value == null ? null : _value.clone();
      70 }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vrpolak Vratko Polak
            rkosegi@brocade.com Richard Kosegi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: