[NETCONF-1058] Union type has wrong type Created: 15/Jun/23  Updated: 25/Sep/23

Status: In Progress
Project: netconf
Component/s: None
Affects Version/s: None
Fix Version/s: 7.0.0

Type: Bug Priority: Medium
Reporter: Tobias Pobocik Assignee: Tobias Pobocik
Resolution: Unresolved Votes: 0
Labels: pick-next, pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File image-2023-08-23-11-35-12-700.png    

 Description   
module definition-test {
  namespace "urn:definition-test";
  prefix sample;  typedef topology-ref {
    type instance-identifier;
  }  container binary-container {
    leaf binary-data {
      type binary;
      default "SGVsbG8gdGVzdCE=";
    }
  }  container union-container {
    leaf testUnion1 {
      type union {
        type int32;
        type string;
      }
      default 5;
    }    leaf testUnion2 {
      type union {
        type string;
        type boolean;
      }
      default false;
    }    leaf testUnion3 {
      type union {
        type int32;
        type boolean;
      }
      default false;
    }    leaf testBoolean {
      type boolean;
      default true;
    }
  }  container number-container {
    leaf testInteger {
      type int32;
      default 42;
    }    leaf testUnsignedInteger {
      type uint16;
      default 100;
    }    leaf testDecimal {
      type decimal64 {
        fraction-digits 2;
      }
      default 3.14;
    }    leaf testDouble {
      type decimal64 {
        fraction-digits 11;
      }
      default 3.14159265359;
    }    leaf testInt64 {
      type int64;
      default 42;
    }    leaf testUint64 {
      type uint64;
      default 42;
    }
  }  container enum-container {
    leaf status {
      type enumeration {
        enum up {
          value 1;
        }
        enum down {
          value 2;
        }
      }
      default "up";
    }
  }  container network-container {
    leaf network-ref {
      type topology-ref;
      default "/network/nodes[node-id='node1']";
    }
  }
}
 

When using union type for string and boolean as in the model, string value is registered instead of boolean.
see:

netconf/DefinitionGenerator.java at 63cd5771fe9b2998fd8c53db92d9abe9558bbe6d · opendaylight/netconf (github.com)



 Comments   
Comment by Tobias Pobocik [ 23/Aug/23 ]

This issue has been resolved in:
https://git.opendaylight.org/gerrit/c/netconf/+/107334

Generated at Wed Feb 07 20:16:34 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.