<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 19:54:56 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>[CONTROLLER-1202] netconf client can not parse RPC message begin with blank characters.</title>
                <link>https://jira.opendaylight.org/browse/CONTROLLER-1202</link>
                <project id="10113" key="CONTROLLER">controller</project>
                    <description>&lt;p&gt;I have a netconf server which sent the RPC-reply begins and ends with new line character 0x0a as following message. sax exception will be thrown. I try to trim the message in the NetconfXMLToMessageDecoder.decode(), the exception disappears. &lt;/p&gt;

&lt;p&gt;0a 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31 2e 30 22 20 65 6e 63 6f 64 69 6e 67 3d 22 55 54 46 2d 38 22 3f 3e&lt;br/&gt;
...... &lt;br/&gt;
3c 2f 72 70 63 2d 72 65 70 6c 79 3e 0a&lt;/p&gt;

&lt;p&gt;Caused by: org.xml.sax.SAXParseException: The processing instruction target matching &quot;&lt;span class=&quot;error&quot;&gt;&amp;#91;xX&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;mM&amp;#93;&lt;/span&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;lL&amp;#93;&lt;/span&gt;&quot; is not allowed.&lt;br/&gt;
        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)&lt;span class=&quot;error&quot;&gt;&amp;#91;:&amp;#93;&lt;/span&gt;&lt;br/&gt;
        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)&lt;span class=&quot;error&quot;&gt;&amp;#91;:&amp;#93;&lt;/span&gt;&lt;br/&gt;
        at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)&lt;span class=&quot;error&quot;&gt;&amp;#91;:2.4.0&amp;#93;&lt;/span&gt;&lt;br/&gt;
        at org.opendaylight.controller.netconf.util.xml.XmlUtil.readXmlToDocument(XmlUtil.java:99)&lt;span class=&quot;error&quot;&gt;&amp;#91;191:org.opendaylight.controller.netconf-util:0.2.7.Helium-SR2&amp;#93;&lt;/span&gt;&lt;br/&gt;
        at org.opendaylight.controller.netconf.nettyutil.handler.NetconfXMLToMessageDecoder.decode(NetconfXMLToMessageDecoder.java:29)&lt;span class=&quot;error&quot;&gt;&amp;#91;199:org.opendaylight.controller.netconf-netty-util:0.2.7.Helium-SR2&amp;#93;&lt;/span&gt;&lt;br/&gt;
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:249)&lt;span class=&quot;error&quot;&gt;&amp;#91;203:io.netty.codec:4.0.23.Final&amp;#93;&lt;/span&gt;&lt;br/&gt;
        ... 15 more&lt;/p&gt;</description>
                <environment>&lt;p&gt;Operating System: All&lt;br/&gt;
Platform: All&lt;/p&gt;</environment>
        <key id="25756">CONTROLLER-1202</key>
            <summary>netconf client can not parse RPC message begin with blank characters.</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="10000">Done</resolution>
                                        <assignee username="gwenael.lambrouin@b-com.com">Gwenael Lambrouin</assignee>
                                    <reporter username="bo.l.li@ericsson.com">Bo Li</reporter>
                        <labels>
                    </labels>
                <created>Fri, 13 Mar 2015 09:48:28 +0000</created>
                <updated>Tue, 9 Jun 2015 10:12:34 +0000</updated>
                            <resolved>Tue, 9 Jun 2015 10:12:34 +0000</resolved>
                                    <version>Helium</version>
                                                    <component>netconf</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="50250" author="gwenael.lambrouin@b-com.com" created="Fri, 20 Mar 2015 17:08:26 +0000"  >&lt;p&gt;I proposed a patch to fix this problem here:&lt;br/&gt;
&lt;a href=&quot;https://git.opendaylight.org/gerrit/16927&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/16927&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="50251" author="mmarsale@cisco.com" created="Mon, 23 Mar 2015 08:48:18 +0000"  >&lt;p&gt;Please take bugs if you work on them (so we can keep track of the bugs). I assigned it to you for you this time.&lt;/p&gt;

&lt;p&gt;Also if you provide a fix and push into gerrit, set me as a reviewer just so I can see it in gerrit web UI.&lt;/p&gt;

&lt;p&gt;Thanks and Thanks for the patches&lt;/p&gt;</comment>
                            <comment id="50252" author="mmarsale@cisco.com" created="Mon, 23 Mar 2015 12:56:35 +0000"  >&lt;p&gt;As mentioned in gerrit, such XML is invalid and its expectad to fail during parsing. Have you tried finding a fix on the side of remote devices so that the devices do not return invalid XML ?&lt;/p&gt;</comment>
                            <comment id="50253" author="bo.l.li@ericsson.com" created="Tue, 24 Mar 2015 01:28:33 +0000"  >&lt;p&gt;I have test the netconf server with Netopeer,Mg-soft,Seguesoft netconf client. Both of them can communicate correctly.&lt;/p&gt;

&lt;p&gt;I don&apos;t think blank character before &amp;lt;?xml means a invalid xml format. it should be a noise in transport. it is too strict for this check in ODL.&lt;/p&gt;

&lt;p&gt;I think it should be fixed from both side..&lt;/p&gt;</comment>
                            <comment id="50254" author="mmarsale@cisco.com" created="Tue, 24 Mar 2015 10:47:43 +0000"  >&lt;p&gt;I believe that it is invalid XML according to the XML specification. Thats why the standard java parser fails with exception. So before merging a fix into ODL codebase, the netconf devices should be checked.&lt;/p&gt;

&lt;p&gt;I am not against making it less strict in ODL, but it should be verified in the devices.&lt;/p&gt;

&lt;p&gt;Btw. I commented on proposed fix. Could you or Gwenael take a look at those in the meantime ?&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;</comment>
                            <comment id="50255" author="gwenael.lambrouin@b-com.com" created="Fri, 27 Mar 2015 17:52:43 +0000"  >&lt;p&gt;I made some unit tests of NetconfXMLToMessageDecoder.decode(), and I observed the following behaviour:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;when the message to decode does NOT start with a XML declaration (reminder: a &quot;XML declaration&quot; looks like &quot;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&quot;: leading white spaces are accepted by the parser.&lt;/li&gt;
	&lt;li&gt;when the message to decode starts with a XML declaration: leading white spaces are rejected by the parser.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;This looks inconsistent, but in my understanding it is correct with respect to the XML 1.0 specifications (see &lt;a href=&quot;http://www.w3.org/TR/REC-xml/#sec-well-formed&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.w3.org/TR/REC-xml/#sec-well-formed&lt;/a&gt; and &lt;a href=&quot;http://www.w3.org/TR/REC-xml/#NT-prolog&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.w3.org/TR/REC-xml/#NT-prolog&lt;/a&gt;). So according to XML, I think that the ODL code is correct.&lt;/p&gt;

&lt;p&gt;I also looked at RFC 4742 (NETCONF over SSH). The examples are all nicely formatted with new lines and they include XML declarations. Unfortunately, there is no example with two consecutive messages. But in the spirit of that RFC, I think it is correct to have a new line just before an XML declaration at the beginning of a NETCONF message . This is really useful in interactive SSH sessions with a human being because it improves readability.&lt;/p&gt;

&lt;p&gt;Also, I made some tests with another network device that does not include XML declarations (a fairly recent Juniper router): the device starts its messages with a newline. This is accepted by ODL because there is not XML declaration.&lt;/p&gt;

&lt;p&gt;So I am now convinced that in the spirit of NETCONF, it is correct to accept messages coming with a leading newline and an XML declaration. So I think ODL should accept such messages.&lt;/p&gt;

&lt;p&gt;Now, I see three ways to fix the issue in ODL:&lt;br/&gt;
1. do the minimum to support the interoperability problems observed today: remove at most one line break at the beginning of the message: either LF (the case observed by Bo when he reported the bug) or CRLF (the case I observed with Cisco routers).&lt;br/&gt;
2. accept any number of XML white spaces (space, tab, CR, LF) at the beginning of the message (this is (almost) my initial proposal)&lt;br/&gt;
3. accept anything before the first &apos;&amp;lt;&apos; character at the beginning of the message (this is Maros&apos;s proposal)&lt;/p&gt;

&lt;p&gt;Solution 1 is enough today, and it looks fine in the spirit of RFC 4742. However, the problem may resurface with a device that would eg start a messge with two line breaks.&lt;/p&gt;

&lt;p&gt;Solution 3 works fine and solves the problem. However, it looks excessive to me, because it would make ODL accept messages such as &quot;slkdjf lsdkjf d&amp;lt;hello/&amp;gt;&quot;. While network device vendors do not use ODL as a reference NETCONF client to test their devices, this is not really a problem. But I think ODL should not do that.&lt;/p&gt;

&lt;p&gt;For me solution 2 provides a good balance between interop and strictness, and I still prefer this solution. But tell me what you think about it.&lt;/p&gt;

&lt;p&gt;In the meantime, I uploaded a new patchset that implements solution 3 (Maros code suggestion) and adds some unit tests:&lt;br/&gt;
&lt;a href=&quot;https://git.opendaylight.org/gerrit/16927&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/16927&lt;/a&gt;&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>2838</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=2838]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10204" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>ODL SR Target Milestone</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10377"><![CDATA[Lithium-RC2]]></customfieldvalue>

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

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