<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:56:03 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-1401] NormalizedNodeStreamWriterStack fails to initialize on choice nodes</title>
                <link>https://jira.opendaylight.org/browse/YANGTOOLS-1401</link>
                <project id="10188" key="YANGTOOLS">yangtools</project>
                    <description>&lt;p&gt;NormalizedNodeStreamWriterStack fails to initialize on&lt;/p&gt;

&lt;p&gt;choice nodes because ChoiceEffectiveStatementImpl is not an instance of DataContainerNode.&lt;/p&gt;

&lt;p&gt;This happens when trying to create Nested writers in both JSONNormalizedNodeStreamWriter and XMLNormalizedNodeStreamWriter.&lt;/p&gt;

&lt;p&gt;This is the node I was trying to create Nested writer for:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;AbsoluteSchemaPath{path=[(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)network-topology, (urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)topology, (urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)node, (urn:opendaylight:netconf-node-topology?revision=2015-01-14)credentials, (urn:opendaylight:netconf-node-topology?revision=2015-01-14)username]}AbsoluteSchemaPath{path=[(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)network-topology, (urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)topology, (urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)node, (urn:opendaylight:netconf-node-topology?revision=2015-01-14)credentials, (urn:opendaylight:netconf-node-topology?revision=2015-01-14)username]}&#160;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The provided SchemaPath for that node looks as following:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;AbsoluteSchemaPath{path=[(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)network-topology, (urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)topology, (urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)node, (urn:opendaylight:netconf-node-topology?revision=2015-01-14)credentials]}&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Now I believe while serializing choice nodes, we should be able to initialize on the parent&#160;&lt;/p&gt;

&lt;p&gt;of that choice node, ie credentials in this case.&lt;/p&gt;

&lt;p&gt;If&#160; we should supply even one level higher, ie node in this case, this would require users to map the SchemaPath nodes against tree to just validate this one case and adjust the path accordingly.&lt;/p&gt;

&lt;p&gt;Then I consider this behavior as inconsistent.&lt;/p&gt;

&lt;p&gt;&#160;I would expect this code snippet to work for choice nodes as well:&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;final&lt;/span&gt; SchemaPath path = SchemaPath.create(nodePath.stream()
                .filter(p -&amp;gt; !(p &lt;span class=&quot;code-keyword&quot;&gt;instanceof&lt;/span&gt; YangInstanceIdentifier.NodeIdentifierWithPredicates))
                .filter(p -&amp;gt; !(p &lt;span class=&quot;code-keyword&quot;&gt;instanceof&lt;/span&gt; YangInstanceIdentifier.AugmentationIdentifier))
                .map(YangInstanceIdentifier.PathArgument::getNodeType).collect(Collectors.toList()), &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
        &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; NormalizedNodeStreamWriter nestedWriter =
                JSONNormalizedNodeStreamWriter
                        .createNestedWriter(codecSupplier.getShared(context), path.getParent(), &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;, jsonWriter);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;Correct me if I am using this wrong.&lt;/p&gt;</description>
                <environment></environment>
        <key id="35247">YANGTOOLS-1401</key>
            <summary>NormalizedNodeStreamWriterStack fails to initialize on choice nodes</summary>
                <type id="10104" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.opendaylight.org/images/icons/priorities/critical.svg">High</priority>
                        <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="10001">Won&apos;t Do</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="ppuskar">Peter Pu&#353;k&#225;r</reporter>
                        <labels>
                    </labels>
                <created>Mon, 21 Feb 2022 11:29:15 +0000</created>
                <updated>Mon, 21 Feb 2022 19:26:03 +0000</updated>
                            <resolved>Mon, 21 Feb 2022 16:31:34 +0000</resolved>
                                    <version>7.0.14</version>
                                                    <component>data-util</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="70550" author="rovarga" created="Mon, 21 Feb 2022 12:21:23 +0000"  >&lt;p&gt;Choice node is not part of the data tree, hence you cannot arrive at it through legal data tree lookup, hence it is not a DataContainerNode, hence it cannot be a root of data-based operations.&lt;/p&gt;

&lt;p&gt;If it could be, what would its XML element name be?&lt;/p&gt;</comment>
                            <comment id="70551" author="JIRAUSER14307" created="Mon, 21 Feb 2022 13:04:15 +0000"  >&lt;p&gt;Okay so in that case, if it is invalid lookup I assume data tree should be empty then &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.opendaylight.org/images/icons/emoticons/help_16.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;, which is not the case as you can see here.&lt;br/&gt;
I would assume then that we should be hitting the else statement while initializing here (is this correct?). My point is to avoid mapping&lt;/p&gt;

&lt;p&gt;PathArguments just to check if we are on choice node and hence adjusting the starting node since neither PathArguments or SchemaNodes carry information on the type of node they represent.&#160;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://jira.opendaylight.org/secure/attachment/17358/17358_image-2022-02-21-14-01-26-332.png&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;/p&gt;</comment>
                            <comment id="70552" author="rovarga" created="Mon, 21 Feb 2022 13:32:36 +0000"  >&lt;p&gt;Translation between YangInstanceIdentifier (i.e. yang-data-api addressing) and SchemaNodeIdentifier (and legacy SchemaPath) (i.e. yang-model-api addressing) always requires schema-informedness.&lt;/p&gt;

&lt;p&gt;Now you have taken the former, filtered some stuff out, ignored the the last item and told SchemaInferenceStack to take that and interpret it as an instantiated SchemaPath ... and that involves, as naming might suggest, walking the &lt;b&gt;schema tree&lt;/b&gt;.&lt;/p&gt;

&lt;p&gt;So now: we have a variable called &apos;dataTree&apos; because we fully expect it to point to a &lt;b&gt;data tree&lt;/b&gt; node and we are checking whether that is really the case &#8211; and it is not, hence it is not a valid argument, hence we throw IAE.&lt;/p&gt;</comment>
                            <comment id="70553" author="JIRAUSER14307" created="Mon, 21 Feb 2022 13:50:21 +0000"  >&lt;p&gt;That&apos;s what I suspected the problem is, the transition between&#160;&lt;b&gt;data tree&lt;/b&gt;&#160;and&#160;&lt;b&gt;schema tree&lt;/b&gt;.&lt;/p&gt;

&lt;p&gt;In that case, maybe we should expose some&#160;methods in JSONNormalizedNodeStreamWriter and XMLNormalizedNodeStreamWriter API that would directly allow us to provide path in&#160;&lt;b&gt;data tree&lt;/b&gt;&#160;and initialize the Nested writers in&#160;&lt;b&gt;data tree&lt;/b&gt;&#160;directly, correct?&lt;/p&gt;

&lt;p&gt;Since what we have now only allows us to provide&#160;SchemaPath as an argument and every other thing is in the end converted to SchemaPath as well (Absolute, EffectiveStatementInference).&lt;/p&gt;</comment>
                            <comment id="70554" author="rovarga" created="Mon, 21 Feb 2022 16:30:05 +0000"  >&lt;p&gt;I believe you are mistaken: both SchemaNodeIdentifier and EffectiveStatementInference are interpreted verbatim, without going through SchemaPath.&lt;/p&gt;

&lt;p&gt;The two trees have a well-defined relationship (see RFC7950) and we provide all the tools necessary, so I really do not see a bug here.&lt;/p&gt;</comment>
                            <comment id="70555" author="rovarga" created="Mon, 21 Feb 2022 16:31:34 +0000"  >&lt;p&gt;This is an issue of the caller, who needs to properly point the root at a data tree node.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10300">
                    <name>Issue split</name>
                                            <outwardlinks description="split to">
                                        <issuelink>
            <issuekey id="35251">YANGTOOLS-1402</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="17358" name="image-2022-02-21-14-01-26-332.png" size="382216" author="ppuskar" created="Mon, 21 Feb 2022 13:01:28 +0000"/>
                            <attachment id="17355" name="netconf-node-topology@2015-01-14.yang" size="11497" author="ppuskar" created="Mon, 21 Feb 2022 11:34:16 +0000"/>
                            <attachment id="17356" name="network-topology@2013-10-21.yang" size="14322" author="ppuskar" created="Mon, 21 Feb 2022 11:35:09 +0000"/>
                            <attachment id="17357" name="stacktrace.txt" size="12692" author="ppuskar" created="Mon, 21 Feb 2022 11:42:41 +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|i041lr:</customfieldvalue>

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