ConfD User Community

Same enum name in Yang notificaiton definition


#1

Hi, I have a yang model with 2 notification defined in it, but the 2 notification has a same name leaf (enumration type with different enums)

notification dev1-state-changed {
        leaf oper-state {
            type enumeration {
                enum unknown {
                    description "The resource is unable to report its operational state.";
                }
                enum disabled {
                    description "The resource is totally inoperable.";
                }
               
            }
        }
    }


notification dev2-state-changed {
        leaf oper-state {
            type enumeration {
                enum enabled {
                    description "The resource is partially or fully operable.";
                }
                enum testing {
                    description "The resource is currently being tested and cannot
                        therefore report whether or not it is operational.";
                }
               
            }
        }
    }

when I tried to compile fxs:

# /opt/confd/bin/confdc --emit-java dev.java  dev.fxs
Warning: the following symbols have been suppressed due to a
conflict with an enum or bit with the same mapped name but a different value:
.....
 'testing', 'unknown'.
Use tailf:code-name on the conflicting enums, bits, or nodes
to avoid the conflict.

what is the proper way to handle same name enum with different list values.


#2

The warning message complaining about duplicated testing, unknown is strange, as you do not have them duplicated.

I have copied your data model to file, but cannot reproduce the issue

confdc --fail-on-warnings -c -o datamodel.fxs datamodel.yang

confdc --fail-on-warnings --emit-java datamodel.java datamodel.fxs

pass OK

datamodel.yang:

module datamodel {
  namespace "http://tail-f.com/ns/example/datamodel";
  prefix datamodel;

  import tailf-common {
    prefix tailf;
  }

  notification dev1-state-changed {
    leaf oper-state {
      type enumeration {
        enum unknown {
          description "The resource is unable to report its operational state.";
        }
        enum disabled {
          description "The resource is totally inoperable.";
        }

      }
    }
  }


  notification dev2-state-changed {
    leaf oper-state {
      type enumeration {
        enum enabled {
          description "The resource is partially or fully operable.";
        }
        enum testing {
          description "The resource is currently being tested and cannot
                        therefore report whether or not it is operational.";
        }

      }
    }
  }
}

What version of ConfD do you use?


#3

Thanks for your reply, and looks I did not paste all yang content.

it happened when the 2nd oper-state has same enum items with 1st notification.

but now I used other ways , and no need to emit java now. thanks