<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:16:51 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>[NETCONF-1174] Leaf-list creation fails on min-element violation</title>
                <link>https://jira.opendaylight.org/browse/NETCONF-1174</link>
                <project id="10142" key="NETCONF">netconf</project>
                    <description>&lt;p&gt;Leaf-list resource creation fails due to min-element condition violation, even when the number of leaf-list elements is correct.&lt;/p&gt;

&lt;p&gt;Steps to reproduce:&lt;br/&gt;
1) Add &quot;test-container-childs&quot; model to netconf-testtool&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
module test-container-childs {
&#160; &#160; namespace &lt;span class=&quot;code-quote&quot;&gt;&quot;http:&lt;span class=&quot;code-comment&quot;&gt;//example.com/test/container/child&quot;&lt;/span&gt;;
&lt;/span&gt;&#160; &#160; prefix &lt;span class=&quot;code-quote&quot;&gt;&quot;tcc&quot;&lt;/span&gt;;
&#160; &#160; revision 2023-09-28;
&#160; &#160;&#160;
&#160; &#160; container root-leaf-list-container {
&#160; &#160; &#160; &#160; container nested-leaf-list-container {
&#160; &#160; &#160; &#160; &#160; &#160; leaf-list leaf-list-with-min-elements {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; min-elements 1;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; max-elements 3;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; type string;
&#160; &#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; } &#160; &#160;
&#160; &#160; }
} &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;2) Send a request to populate &quot;leaf-list-with-min-elements&quot;&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
POST URI: 
rests/data/network-topology:network-topology/topology=topology-netconf/node=36001-sim-device/yang-ext:mount/test-container-childs:root-leaf-list-container/nested-leaf-list-container

Payload:
{
&#160; &#160; &lt;span class=&quot;code-quote&quot;&gt;&quot;leaf-list-with-min-elements&quot;&lt;/span&gt;: [
&#160; &#160; &#160; &lt;span class=&quot;code-quote&quot;&gt;&quot;data1&quot;&lt;/span&gt;,
&#160; &#160; &#160; &lt;span class=&quot;code-quote&quot;&gt;&quot;data2&quot;&lt;/span&gt;
&#160; &#160; ]
}&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;3) Response from device:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
{
&#160; &#160; &lt;span class=&quot;code-quote&quot;&gt;&quot;errors&quot;&lt;/span&gt;: {
&#160; &#160; &#160; &#160; &lt;span class=&quot;code-quote&quot;&gt;&quot;error&quot;&lt;/span&gt;: [
&#160; &#160; &#160; &#160; &#160; &#160; {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-quote&quot;&gt;&quot;error-tag&quot;&lt;/span&gt;: &lt;span class=&quot;code-quote&quot;&gt;&quot;operation-failed&quot;&lt;/span&gt;,
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-quote&quot;&gt;&quot;error-info&quot;&lt;/span&gt;: &lt;span class=&quot;code-quote&quot;&gt;&quot;TransactionCommitFailedException{message=Netconf transaction commit failed, errorList=[RpcError [message=Netconf transaction commit failed, severity=ERROR, errorType=APPLICATION, tag=operation-failed, applicationTag=&lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, info=&lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, cause=NetconfDocumentedException{error-type=APPLICATION, error-tag=operation-failed, error-severity=ERROR, error-info={}, message=RPC during tx failed. Transaction commit failed on TransactionCommitFailedException{message=preCommit execution failed, errorList=[RpcError [message=preCommit execution failed, severity=ERROR, errorType=APPLICATION, tag=operation-failed, applicationTag=&lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, info=&lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, cause=org.opendaylight.yangtools.yang.data.tree.impl.MinMaxElementsValidationFailedException: (http:&lt;span class=&quot;code-comment&quot;&gt;//example.com/test/container/child?revision=2023-09-28)leaf-list-with-min-elements does not have enough elements (0), needs at least 1]]} 1 Cause: preCommit execution failed }]]}&quot;&lt;/span&gt;,
&lt;/span&gt;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-quote&quot;&gt;&quot;error-message&quot;&lt;/span&gt;: &lt;span class=&quot;code-quote&quot;&gt;&quot;Transaction(POST) not committed correctly&quot;&lt;/span&gt;,
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-quote&quot;&gt;&quot;error-type&quot;&lt;/span&gt;: &lt;span class=&quot;code-quote&quot;&gt;&quot;application&quot;&lt;/span&gt;
&#160; &#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; ]
&#160; &#160; }
}&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="37426">NETCONF-1174</key>
            <summary>Leaf-list creation fails on min-element violation</summary>
                <type id="10104" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.opendaylight.org/images/icons/priorities/major.svg">Medium</priority>
                        <status id="1" iconUrl="https://jira.opendaylight.org/images/icons/statuses/open.png" description="The issue is open and ready for the assignee to start work on it.">Open</status>
                    <statusCategory id="2" key="new" colorName="blue-gray"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="ivanhrasko">Ivan Hrasko</assignee>
                                    <reporter username="PeterSuna">Peter Suna</reporter>
                        <labels>
                            <label>pt</label>
                    </labels>
                <created>Mon, 2 Oct 2023 18:15:46 +0000</created>
                <updated>Thu, 5 Oct 2023 10:22:51 +0000</updated>
                                            <version>7.0.0</version>
                                                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="72633" author="petersuna" created="Tue, 3 Oct 2023 15:47:04 +0000"  >&lt;p&gt;The request for MapNode and LeafSetNode is split into separate RPCs, which are sent one by one to the device. &lt;br/&gt;
&lt;a href=&quot;https://github.com/opendaylight/netconf/blob/7ddbcbbe9fcc2c1c2e9693807457ba339d813f19/restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/transactions/NetconfRestconfTransaction.java#L102&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/opendaylight/netconf/blob/7ddbcbbe9fcc2c1c2e9693807457ba339d813f19/restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/transactions/NetconfRestconfTransaction.java#L102&lt;/a&gt;&lt;br/&gt;
The first request is responsible for creating an empty resource and afterward, separate RPCs are sent for each leaf-node child to device.&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
&#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; child : ((NormalizedNodeContainer&amp;lt;?&amp;gt;) data).body()) {
&#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;var&lt;/span&gt; childPath = path.node(child.name());
&#160; &#160; &#160; &#160; enqueueOperation(() -&amp;gt; netconfService.create(CONFIGURATION, childPath, child, Optional.empty()));
&#160; &#160; }&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Device receive RPC for creating resource for first child:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
&amp;lt;rpc xmlns=&lt;span class=&quot;code-quote&quot;&gt;&quot;urn:ietf:params:xml:ns:netconf:base:1.0&quot;&lt;/span&gt; message-id=&lt;span class=&quot;code-quote&quot;&gt;&quot;m-23&quot;&lt;/span&gt;&amp;gt;
&#160; &#160; &amp;lt;edit-config&amp;gt;
&#160; &#160; &#160; &#160; &amp;lt;target&amp;gt;
&#160; &#160; &#160; &#160; &#160; &#160; &amp;lt;candidate/&amp;gt;
&#160; &#160; &#160; &#160; &amp;lt;/target&amp;gt;
&#160; &#160; &#160; &#160; &amp;lt;config&amp;gt;
&#160; &#160; &#160; &#160; &#160; &#160; &amp;lt;root-leaf-list-container xmlns=&lt;span class=&quot;code-quote&quot;&gt;&quot;http:&lt;span class=&quot;code-comment&quot;&gt;//example.com/test/container/child&quot;&lt;/span&gt;&amp;gt;
&lt;/span&gt;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &amp;lt;nested-leaf-list-container&amp;gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &amp;lt;leaf-list-with-min-elements xmlns:op=&lt;span class=&quot;code-quote&quot;&gt;&quot;urn:ietf:params:xml:ns:netconf:base:1.0&quot;&lt;/span&gt; op:operation=&lt;span class=&quot;code-quote&quot;&gt;&quot;create&quot;&lt;/span&gt;&amp;gt;data2&amp;lt;/leaf-list-with-min-elements&amp;gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &amp;lt;/nested-leaf-list-container&amp;gt;
&#160; &#160; &#160; &#160; &#160; &#160; &amp;lt;/root-leaf-list-container&amp;gt;
&#160; &#160; &#160; &#160; &amp;lt;/config&amp;gt;
&#160; &#160; &amp;lt;/edit-config&amp;gt;
&amp;lt;/rpc&amp;gt;
 &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;this RPC will fails due to check if data already exist on YangInstanceIdentifier path:&lt;br/&gt;
&quot;/(&lt;a href=&quot;http://example.com/test/container/child?revision=2023-09-28)root-leaf-list-container/nested-leaf-list-container/leaf-list-with-min-elements/leaf-list-with-min-elements[data2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://example.com/test/container/child?revision=2023-09-28)root-leaf-list-container/nested-leaf-list-container/leaf-list-with-min-elements/leaf-list-with-min-elements[data2&lt;/a&gt;]&quot;&lt;/p&gt;


&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (rwtx.exists(LogicalDatastoreType.CONFIGURATION, path).get()) { &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;-&amp;gt;&#160;&lt;br/&gt;
&lt;a href=&quot;https://github.com/opendaylight/netconf/blob/7ddbcbbe9fcc2c1c2e9693807457ba339d813f19/plugins/netconf-server-mdsal/src/main/java/org/opendaylight/netconf/server/mdsal/operations/EditConfig.java#L98&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/opendaylight/netconf/blob/7ddbcbbe9fcc2c1c2e9693807457ba339d813f19/plugins/netconf-server-mdsal/src/main/java/org/opendaylight/netconf/server/mdsal/operations/EditConfig.java#L98&lt;/a&gt;&lt;br/&gt;
This line attempts to invoke validation for` MinMaxElementsValidation#enforceOnData` on the `leaf-list-with-min-elements`, which currently fails at this point. It should only be called after the `commit` RPC is sent.&lt;/p&gt;





&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="72635" author="ivanhrasko" created="Thu, 5 Oct 2023 07:57:29 +0000"  >&lt;p&gt;The error can be that, in fact, with POST we are creating &lt;b&gt;nested-leaf-list-container&lt;/b&gt; resource. It can be its created &quot;empty&quot; or what by default regardless of payload. Can you try with PUT? &lt;a href=&quot;https://jira.opendaylight.org/secure/ViewProfile.jspa?name=PeterSuna&quot; class=&quot;user-hover&quot; rel=&quot;PeterSuna&quot;&gt;PeterSuna&lt;/a&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="72636" author="ivanhrasko" created="Thu, 5 Oct 2023 08:13:15 +0000"  >&lt;p&gt;The error condition probably happens because the logic tries to ensure all parents exist, so first node created is empty &lt;b&gt;root-leaf-list-container&lt;/b&gt; which fails to validate:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;please try to make POST directly to root element&lt;/li&gt;
	&lt;li&gt;use PUT&lt;/li&gt;
	&lt;li&gt;see if we can modify the logic in a way that when we create parent structure parent are not created empty, but instead, with desired content&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="72637" author="petersuna" created="Thu, 5 Oct 2023 10:22:51 +0000"  >&lt;p&gt;PUT creates a &apos;REPLACE&apos; operation that does not include a check to verify if the data exists.&lt;br/&gt;
&lt;a href=&quot;https://github.com/opendaylight/netconf/blob/7ddbcbbe9fcc2c1c2e9693807457ba339d813f19/plugins/netconf-server-mdsal/src/main/java/org/opendaylight/netconf/server/mdsal/operations/EditConfig.java#L98&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/opendaylight/netconf/blob/7ddbcbbe9fcc2c1c2e9693807457ba339d813f19/plugins/netconf-server-mdsal/src/main/java/org/opendaylight/netconf/server/mdsal/operations/EditConfig.java#L98&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Creating empty &quot;&lt;b&gt;nested-leaf-list-container&quot;&lt;/b&gt; container with RPC is also successful because validation check is made after &quot;commit&quot; RPC.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="19214" name="karaf.log" size="376820" author="PeterSuna" created="Mon, 2 Oct 2023 18:17:04 +0000"/>
                            <attachment id="19215" name="testtool.log" size="66100" author="PeterSuna" created="Mon, 2 Oct 2023 18:17:50 +0000"/>
                    </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_10000" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i046nb:</customfieldvalue>

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