<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:15: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>[NETCONF-568] NetconfMessageTransformer action/rpc empty reply</title>
                <link>https://jira.opendaylight.org/browse/NETCONF-568</link>
                <project id="10142" key="NETCONF">netconf</project>
                    <description>&lt;p&gt;&#160;If the action has output which has not mandatory fields and none of them is present, the NetconfMessageTransformer reports error.&lt;/p&gt;

&lt;p&gt;I found this problem to be present also for both the RPCs and actions.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;Let&apos;s say we have two RPCs. One with output defined, but with non mandatory field and the second without output:&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;
rpc rpc-with-output {
   output {
      leaf not-mandatory-message {
         type string;
      }
   }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&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;
rpc rpc-without-output {
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Regarding the Yang 1.1 RFC &lt;a href=&quot;https://tools.ietf.org/html/rfc7950#section-7.14.4&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://tools.ietf.org/html/rfc7950#section-7.14.4&lt;/a&gt; there should be a possibility to return only &quot;ok&quot; message, when no output parameters are returned:&lt;br/&gt;
 If the RPC operation invocation succeeded and no output parameters are returned, the &amp;lt;rpc-reply&amp;gt; contains a single &amp;lt;ok/&amp;gt; element defined in &lt;span class=&quot;error&quot;&gt;&amp;#91;RFC6241&amp;#93;&lt;/span&gt;. If output parameters are returned, they are encoded as child elements to the &amp;lt;rpc-reply&amp;gt; element defined in &lt;span class=&quot;error&quot;&gt;&amp;#91;RFC6241&amp;#93;&lt;/span&gt;, in the same order as they are defined within the &quot;output&quot; statement.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;So for both should be fine to get response:&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-reply xmlns=&lt;span class=&quot;code-quote&quot;&gt;&quot;urn:ietf:params:xml:ns:netconf:base:1.0&quot;&lt;/span&gt;&amp;gt;
   &amp;lt;ok/&amp;gt;
&amp;lt;/rpc-reply&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;But for the RPC with output defined &quot;rpc-with-output&quot; the NetconfMessageTransformer fails with error.&lt;/p&gt;</description>
                <environment></environment>
        <key id="30755">NETCONF-568</key>
            <summary>NetconfMessageTransformer action/rpc empty reply</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="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="10000">Done</resolution>
                                        <assignee username="Sanjana_Babu">Sanjana Babu</assignee>
                                    <reporter username="apuchyova">Anna Benc&#250;rov&#225;</reporter>
                        <labels>
                    </labels>
                <created>Tue, 18 Sep 2018 12:31:47 +0000</created>
                <updated>Tue, 3 Mar 2020 19:11:13 +0000</updated>
                            <resolved>Tue, 3 Mar 2020 19:11:13 +0000</resolved>
                                    <version>Fluorine</version>
                                    <fixVersion>Magnesium</fixVersion>
                    <fixVersion>Aluminium</fixVersion>
                    <fixVersion>Sodium SR3</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="65127" author="jmorvay" created="Mon, 1 Oct 2018 17:57:54 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.opendaylight.org/secure/ViewProfile.jspa?name=apuchyova&quot; class=&quot;user-hover&quot; rel=&quot;apuchyova&quot;&gt;apuchyova&lt;/a&gt; although the description is really kind of self-explanatory it would be better to actually see the the error.&lt;/p&gt;

&lt;p&gt;Also it seems like you played around with action support in netconf SB, so I believe you have some models and data connected to this issue. It would be really cool if you can attach them here so the reproduction will be easier.&lt;/p&gt;</comment>
                            <comment id="67628" author="rovarga" created="Wed, 8 Jan 2020 21:57:06 +0000"  >&lt;p&gt;Based on the proposed unit test:&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;[ERROR] Tests run: 27, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.387 s &amp;lt;&amp;lt;&amp;lt; FAILURE! - in org.opendaylight.netconf.sal.connect.netconf.schema.mapping.NetconfMessageTransformerTest
[ERROR] testRpcEmptyBodyWithOutputDefinedSchemaResult(org.opendaylight.netconf.sal.connect.netconf.schema.mapping.NetconfMessageTransformerTest)  Time elapsed: 0.011 s  &amp;lt;&amp;lt;&amp;lt; ERROR!
java.lang.IllegalArgumentException: Failed to parse RPC response [rpc-reply: null]
	at org.opendaylight.netconf.sal.connect.netconf.schema.mapping.NetconfMessageTransformer.parseResult(NetconfMessageTransformer.java:329)
	at org.opendaylight.netconf.sal.connect.netconf.schema.mapping.NetconfMessageTransformer.toRpcResult(NetconfMessageTransformer.java:294)
	at org.opendaylight.netconf.sal.connect.netconf.schema.mapping.NetconfMessageTransformerTest.testRpcEmptyBodyWithOutputDefinedSchemaResult(NetconfMessageTransformerTest.java:240)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[...]
Caused by: javax.xml.stream.XMLStreamException: Schema for node with name ok and namespace urn:ietf:params:xml:ns:netconf:base:1.0 does not exist at AbsoluteSchemaPath{path=[(urn:example:rpcs-actions-outputs)rpc-with-output, (urn:example:rpcs-actions-outputs)output]}
	at org.opendaylight.yangtools.yang.data.codec.xml.XmlParserStream.read(XmlParserStream.java:522)
	at org.opendaylight.yangtools.yang.data.codec.xml.XmlParserStream.parse(XmlParserStream.java:270)
	at org.opendaylight.yangtools.yang.data.codec.xml.XmlParserStream.traverse(XmlParserStream.java:297)
	at org.opendaylight.netconf.sal.connect.netconf.schema.mapping.NetconfMessageTransformer.parseResult(NetconfMessageTransformer.java:326)
	... 30 more&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="67629" author="rovarga" created="Wed, 8 Jan 2020 22:16:07 +0000"  >&lt;p&gt;Which means XML parser was asked to parse &amp;lt;/ok&amp;gt; as a child, which means we are parsing a NETCONF concept in Yangtools &#8211; which is wrong.&lt;/p&gt;

&lt;p&gt;From the parser perspective, we an option of injecting proper parsing here, given that we have mechanics for dealing with RFC8258 mounts. From yang-data-codec-xml perspective whether it is a mount point node or NETCONF XML node are completely indiscernible: both are something that occurs under a DataNodeContainer and it has a QName.&lt;/p&gt;

&lt;p&gt;Hence the correct fix is make pretend that&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 netconf-internal {
   &lt;span class=&quot;code-comment&quot;&gt;// Conflicts with ietf-netconf
&lt;/span&gt;   namespace &lt;span class=&quot;code-quote&quot;&gt;&quot;urn:ietf:params:xml:ns:netconf:base:1.0&quot;&lt;/span&gt;

   container ok {
       presence &lt;span class=&quot;code-quote&quot;&gt;&quot;Indicates a no-response explicit acknowledgement&quot;&lt;/span&gt;;
   }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;is implicitly schema-mounted into the &amp;lt;rpc-reply&amp;gt; SchemaNode.&lt;/p&gt;

&lt;p&gt;So the mechanics goes:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;NETCONF passes down an appropriate MountPointContext&lt;/li&gt;
	&lt;li&gt;yang-data-codec-xml executes lookup to a fictious mount point&lt;/li&gt;
	&lt;li&gt;NETCONF turns that fiction into an empty ContainerNode matching the output statement&lt;/li&gt;
	&lt;li&gt;yang-data-codec-xml results in that ContainerNode being wrapped in a MountPointNode pointing to the fictious mount point&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="67630" author="rovarga" created="Wed, 8 Jan 2020 22:22:55 +0000"  >&lt;p&gt;... or this actually is a bug &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.opendaylight.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; Sorry about the above.&lt;/p&gt;

&lt;p&gt;&amp;lt;rpc-reply&amp;gt; contains either &amp;lt;data&amp;gt; or &amp;lt;ok&amp;gt;, hence that part should be handled by NETCONF, not by yang-data-codec-xml &#8211; unless I am missing something.&lt;/p&gt;</comment>
                            <comment id="67696" author="sanjana_babu" created="Mon, 27 Jan 2020 10:41:47 +0000"  >&lt;p&gt;NetconfMessageTransformer.java throws error when it is trying to parse the &amp;lt;ok/&amp;gt; as a child in schema node. This is because when the rpc has output parameters&#160;i.e, child nodes, xmlparser tries to parse them. So, I&apos;m planning the fix is if dont send the &amp;lt;ok/&amp;gt; of the &amp;lt;rpc-reply&amp;gt; to xmlparser, it wont parse the &amp;lt;ok/&amp;gt; as a child node.&#160;Xmlparser will try to find the output parameters else it treat the non mandatory nodes as&#160;transient nodes. I have validated this fix and it works fine.&lt;br/&gt;
Please provide your input on this to proceed further.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10002">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="32104">NETCONF-644</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <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_10000" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i03itz:</customfieldvalue>

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