CESNET / libnetconf

C NETCONF library
Other
113 stars 83 forks source link

Validation issue with sequencing of leaf elements within multiple groupings #253

Open akshay-raut opened 7 years ago

akshay-raut commented 7 years ago

Hi, I have observed validation issue with the sequence of leaf elements within grouping. To keep things simple I used bellow dummy yang model to reporduce the issue.

$ cat a.yang

module a {
    namespace urn:yang:a;
    prefix a;

    grouping group_1 {
        leaf g1_config_1 {
            type uint32;
        }

        leaf g1_config_2 {
            type uint32;
        }
    }

    grouping group_2 {
        leaf g2_config_1 {
            type uint32;
        }

        leaf g2_config_2 {
            type uint32;
        }
    }

    container container_a {
        uses group_1;
        uses group_2;
    }
}

Configuration that passes validation:

<a:container_a xmlns:a="urn:yang:a">
    <a:g1_config_1>1</a:g1_config_1>
    <a:g1_config_2>2</a:g1_config_2>
    <a:g2_config_1>3</a:g2_config_1>
    <a:g2_config_2>4</a:g2_config_2>
</a:container_a>

Configuration that fails validation:

<a:container_a xmlns:a="urn:yang:a">
    <a:g1_config_1>1</a:g1_config_1>
    <a:g2_config_1>3</a:g2_config_1>
    <a:g1_config_2>2</a:g1_config_2>
    <a:g2_config_2>4</a:g2_config_2>
</a:container_a>

In the failed configuration the sequence of config leaf elements is scrambled. This is even worst when grouping has more elements. I guess the sequence should not matter for validation.

Regards AKSHAY