Ask Your Question

Could "Choices" be used in YANG of opendaylight?

asked 2016-05-11 20:05:17 -0700

Veinthrough gravatar image

when I read the YANG specification document: YANG specification

I found this:

    4.2.7. Choices
    YANG allows the data model to segregate incompatible nodes into
    distinct choices using the "choice" and "case" statements. The
    "choice" statement contains a set of "case" statements that define
    sets of schema nodes that cannot appear together. Each "case" may
    contain multiple nodes, but each node may appear in only one "case"
    under a "choice".
    When an element from one case is created, all elements from all other
    cases are implicitly deleted. The device handles the enforcement of
    the constraint, preventing incompatibilities from existing in the
    The choice and case nodes appear only in the schema tree, not in the
    data tree or NETCONF messages. The additional levels of hierarchy
    are not needed beyond the conceptual schema.

    YANG Example:
        container food {
            choice snack {
                case sports-arena {
                    leaf pretzel {
                        type empty;
                    leaf beer {
                        type empty;
                case late-night {
                    leaf chocolate {
                        type enumeration {
                            enum dark;
                            enum milk;
                            enum first-available;

    NETCONF XML Example:
    The "choice" statement is covered in Section 7.9.

What I want to ask is whether "Choices" could be used in YANG of opendaylight and how to use it. Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2016-05-11 20:16:03 -0700

Veinthrough gravatar image

OK, I found it by myself. In Topology-correlation.yang of project topoprocessing.

edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-05-11 20:05:17 -0700

Seen: 81 times

Last updated: May 11 '16