<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:54:21 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>OpenDaylight JIRA</title>
    <link>https://jira.opendaylight.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>8.20.10</version>
        <build-number>820010</build-number>
        <build-date>22-06-2022</build-date>
    </build-info>


<item>
            <title>[YANGTOOLS-800] The validate rules of &quot;min-elements&quot; is not consistent with the RFC6020</title>
                <link>https://jira.opendaylight.org/browse/YANGTOOLS-800</link>
                <project id="10188" key="YANGTOOLS">yangtools</project>
                    <description>&lt;p&gt;I am using yangtools boron-sr4. I think the  validate rules of &quot;min-elements&quot; is not consistent with the RFC6020.&lt;/p&gt;

&lt;p&gt;See &lt;a href=&quot;https://tools.ietf.org/html/rfc6020#page-63&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://tools.ietf.org/html/rfc6020#page-63&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;7.7.3.  The min-elements Statement&lt;/p&gt;


&lt;p&gt;If &quot;min-elements&quot; exists in the leaf-list or list, and the leaf-list&apos;s or list&apos;s closest ancestor node is neither a non-presence container nor a case node. The &quot;min-elements&quot; constraint is enforced if the ancestor node exists.&lt;/p&gt;

&lt;p&gt;But in fact the yang-data-impl&apos;s rule is like this:&lt;/p&gt;

&lt;p&gt;if (constraints.isMandatory() || (minElements != null &amp;amp;&amp;amp; minElements &amp;gt; 0)) {&lt;br/&gt;
                        final YangInstanceIdentifier childId = id.node(NodeIdentifier.create(child.getQName()));&lt;br/&gt;
                        LOG.debug(&quot;Adding mandatory child {}&quot;, childId);&lt;br/&gt;
                        builder.add(childId.toOptimized());&lt;br/&gt;
                    } }&lt;br/&gt;
    }&lt;br/&gt;
It means that if &quot;min-elements&quot; is exist, the list or leaf-list node must exist.&lt;/p&gt;

&lt;p&gt;Consider a yang module like this:&lt;br/&gt;
list  layer-protocol {&lt;br/&gt;
	container eth-cep-pac {&lt;br/&gt;
		list vlan-spec &lt;/p&gt;
{
			key &apos;vlan-id&apos;;
			uses TypeDefinition:zte-vlan-spec;
			min-elements 1;
		}
&lt;p&gt;		leaf mac-adress-learning-range &lt;/p&gt;
{
			type uint64;
		}&lt;br/&gt;
	}&lt;br/&gt;
	container eth-nep-pac {&lt;br/&gt;
		leaf total-potential-eth-capacity {			type uint64;		}
&lt;p&gt;		leaf available-eth-capacity &lt;/p&gt;
{
			type uint64;
		}
&lt;p&gt;	}&lt;br/&gt;
}&lt;br/&gt;
If I put &quot;layer-protocol&quot; without &quot;eth-cep-pac&quot; into configuration datastore&#65292; IllegalArgumentException occurred &quot; missing mandatory descendant /eth-cep-pac/vlan-spec&quot;&lt;/p&gt;</description>
                <environment>&lt;p&gt;Operating System: All&lt;br/&gt;
Platform: All&lt;/p&gt;</environment>
        <key id="23220">YANGTOOLS-800</key>
            <summary>The validate rules of &quot;min-elements&quot; is not consistent with the RFC6020</summary>
                <type id="10104" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10303&amp;avatarType=issuetype">Bug</type>
                                                <status id="5" iconUrl="https://jira.opendaylight.org/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="green"/>
                                    <resolution id="10003">Cannot Reproduce</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="angelanzhe@gmail.com">anzhe</reporter>
                        <labels>
                    </labels>
                <created>Tue, 25 Jul 2017 10:36:13 +0000</created>
                <updated>Sun, 10 Apr 2022 18:36:00 +0000</updated>
                            <resolved>Tue, 1 Aug 2017 11:46:06 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="44499" author="pkajsa" created="Mon, 31 Jul 2017 10:53:36 +0000"  >&lt;p&gt;My understanding is as follows:&lt;/p&gt;

&lt;p&gt;Rfc6020 &lt;a href=&quot;https://tools.ietf.org/html/rfc6020#section-7.7.3&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://tools.ietf.org/html/rfc6020#section-7.7.3&lt;/a&gt; says:&lt;br/&gt;
   &quot;The behavior of the constraint depends on the type of the leaf-list&apos;s&lt;br/&gt;
   or list&apos;s closest ancestor node in the schema tree that is not a non-&lt;br/&gt;
   presence container (see Section 7.5.1):&lt;br/&gt;
   o  If this ancestor is a case node, the constraint is enforced if any&lt;br/&gt;
      other node from the case exists.&lt;/p&gt;

&lt;p&gt;   o  Otherwise, it is enforced if the ancestor node exists.&quot;&lt;/p&gt;

&lt;p&gt;So the &quot;vlan-spec&quot; list&apos;s closest ancestor node in the schema tree that is not a non-presence container is the list &quot;layer-protocol&quot;, because container &quot;eth-cep-pac&quot; is non-presence container and therefore the second point from the Rfc6020 is applied i.e. &quot;Otherwise, it is enforced if the ancestor node exists.&quot;&lt;/p&gt;

&lt;p&gt;Therefore if an entry of list &quot;layer-protocol&quot; exists, at least one entry of list &quot;vlan-spec&quot; should also exists, because the container &quot;eth-cep-pac&quot; is non-presence container.&lt;/p&gt;</comment>
                            <comment id="44500" author="rovarga" created="Tue, 1 Aug 2017 11:46:06 +0000"  >&lt;p&gt;I do believe Peter&apos;s analysis is in fact correct. If the intent is to have the constraint enforced only if eth-cep-pac is present, then eth-cep-pac needs to be a presence container.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                            <customfield id="customfield_11400" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10208" key="com.atlassian.jira.plugin.system.customfieldtypes:textfield">
                        <customfieldname>External issue ID</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>8887</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10201" key="com.atlassian.jira.plugin.system.customfieldtypes:url">
                        <customfieldname>External issue URL</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[https://bugs.opendaylight.org/show_bug.cgi?id=8887]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10000" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i029gn:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                </customfields>
    </item>
</channel>
</rss>