Uploaded image for project: 'netconf'
  1. netconf
  2. NETCONF-1058

Union type has wrong type

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Medium Medium
    • 7.0.0, 6.0.5
    • None
    • None

      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)

            tobias.pobocik Tobias Pobocik
            tobias.pobocik Tobias Pobocik
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: