<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:15:09 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-486] Patch request on a Netconf Mounted device throwing ClassCastException from YANG tools</title>
                <link>https://jira.opendaylight.org/browse/NETCONF-486</link>
                <project id="10142" key="NETCONF">netconf</project>
                    <description>&lt;p&gt;We are seeing a  issue with the HTTP PATCH  request on a particular model on the NETCONF mounted resource. PATCH request works fine on certain models hosted inside ODL. But this issue is related to a model on a NETCONF mounted device.&lt;/p&gt;

&lt;p&gt;Here are the steps we did. We made sure PUT call works.&lt;/p&gt;

&lt;p&gt;Request Type : PUT&lt;/p&gt;

&lt;p&gt;URL :  http://&lt;tt&gt;controller&lt;/tt&gt;:&lt;tt&gt;port&lt;/tt&gt;/restconf/config/network-topology:network-topology/topology/topology-netconf/node/&lt;tt&gt;node&lt;/tt&gt;/yang-ext:mount/exa-base:config/profile/dhcp-v4-server-profile/&lt;tt&gt;dhcp-profile-name&lt;/tt&gt;/&lt;/p&gt;

&lt;p&gt;Payload :  &lt;/p&gt;

&lt;p&gt;{&lt;br/&gt;
    &quot;dhcp-v4-server-profile&quot;: &lt;br/&gt;
            {&lt;br/&gt;
                &quot;name&quot;: &quot;&lt;tt&gt;dhcp-profile-name&lt;/tt&gt;&quot;,&lt;br/&gt;
                &quot;pool&quot;: [&lt;br/&gt;
                    &quot;&lt;tt&gt;dhcp-pool-name&lt;/tt&gt;&quot;&lt;br/&gt;
                ]&lt;br/&gt;
            }&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;PUT call works. &lt;/p&gt;

&lt;p&gt;We wanted to use the PATCH request to manipulate the leaf-list. In the above request &quot;pool&quot; is a leaf-list.&lt;/p&gt;

&lt;p&gt;We tried this PATCH request&lt;/p&gt;

&lt;p&gt;Request Type : PATCH&lt;/p&gt;

&lt;p&gt;URL :  http://&lt;tt&gt;controller&lt;/tt&gt;:&lt;tt&gt;port&lt;/tt&gt;/restconf/config/network-topology:network-topology/topology/topology-netconf/node/&lt;tt&gt;node&lt;/tt&gt;/yang-ext:mount/exa-base:config/profile/dhcp-v4-server-profile/&lt;tt&gt;dhcp-profile-name&lt;/tt&gt;/&lt;/p&gt;

&lt;p&gt;Payload :&lt;/p&gt;

&lt;p&gt;{&lt;br/&gt;
  &quot;ietf-restconf:yang-patch&quot; :&lt;br/&gt;
  {&lt;br/&gt;
    &quot;patch-id&quot; : &quot;0&quot;,&lt;br/&gt;
    &quot;edit&quot; :&lt;br/&gt;
    [&lt;br/&gt;
      {&lt;br/&gt;
        &quot;edit-id&quot; : &quot;edit1&quot;,&lt;br/&gt;
        &quot;operation&quot; : &quot;merge&quot;,&lt;br/&gt;
        &quot;target&quot; : &quot;&quot;,&lt;br/&gt;
        &quot;value&quot; :&lt;br/&gt;
        {&lt;br/&gt;
          &quot;dhcp-v4-server-profile&quot;:&lt;/p&gt;
           {
              &quot;name&quot;: &quot;profile1&quot;,
              &quot;pool&quot;: [
                  &quot;pool1&quot;
              ]
           }


&lt;p&gt;        }&lt;br/&gt;
      }&lt;br/&gt;
     ]&lt;br/&gt;
  }&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;The request itself returns success in restconf and we obtain this output.&lt;/p&gt;

&lt;p&gt;{&lt;br/&gt;
    &quot;ietf-yang-patch:yang-patch-status&quot;: &lt;/p&gt;
{
        &quot;patch-id&quot;: &quot;0&quot;,
        &quot;ok&quot;: [
            null
        ]
    }
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;However we don&apos;t see the desired result and we see the ClassCastException by YANG tools in the karaf.log.&lt;/p&gt;


&lt;p&gt;17-11-13 03:03:16,519 | ERROR | ult-dispatcher-3 | OneForOneStrategy                | 180 - com.typesafe.akka.slf4j - 2.4.18 | org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder$ImmutableMapNode cannot be cast to org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode&lt;br/&gt;
java.lang.ClassCastException: org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder$ImmutableMapNode cannot be cast to org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode&lt;br/&gt;
	at org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder.withValue(ImmutableMapNodeBuilder.java:81)&lt;span class=&quot;error&quot;&gt;&amp;#91;102:org.opendaylight.yangtools.yang-data-impl:1.1.1.Carbon&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder.withValue(ImmutableMapNodeBuilder.java:28)&lt;span class=&quot;error&quot;&gt;&amp;#91;102:org.opendaylight.yangtools.yang-data-impl:1.1.1.Carbon&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.yangtools.yang.data.impl.schema.InstanceIdToCompositeNodes.create(InstanceIdToCompositeNodes.java:104)&lt;span class=&quot;error&quot;&gt;&amp;#91;102:org.opendaylight.yangtools.yang-data-impl:1.1.1.Carbon&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.yangtools.yang.data.impl.schema.InstanceIdToCompositeNodes.create(InstanceIdToCompositeNodes.java:101)&lt;span class=&quot;error&quot;&gt;&amp;#91;102:org.opendaylight.yangtools.yang-data-impl:1.1.1.Carbon&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.yangtools.yang.data.impl.schema.InstanceIdToCompositeNodes.create(InstanceIdToCompositeNodes.java:101)&lt;span class=&quot;error&quot;&gt;&amp;#91;102:org.opendaylight.yangtools.yang-data-impl:1.1.1.Carbon&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.yangtools.yang.data.impl.schema.InstanceIdToCompositeNodes.create(InstanceIdToCompositeNodes.java:101)&lt;span class=&quot;error&quot;&gt;&amp;#91;102:org.opendaylight.yangtools.yang-data-impl:1.1.1.Carbon&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.yangtools.yang.data.impl.schema.InstanceIdToCompositeNodes.create(InstanceIdToCompositeNodes.java:101)&lt;span class=&quot;error&quot;&gt;&amp;#91;102:org.opendaylight.yangtools.yang-data-impl:1.1.1.Carbon&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.fromInstanceId(ImmutableNodes.java:136)&lt;span class=&quot;error&quot;&gt;&amp;#91;102:org.opendaylight.yangtools.yang-data-impl:1.1.1.Carbon&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.createEditConfigAnyxml(NetconfMessageTransformUtil.java:294)&lt;span class=&quot;error&quot;&gt;&amp;#91;300:org.opendaylight.netconf.sal-netconf-connector:1.5.1.Carbon&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.netconf.sal.connect.netconf.util.NetconfRpcStructureTransformer.createEditConfigStructure(NetconfRpcStructureTransformer.java:39)&lt;span class=&quot;error&quot;&gt;&amp;#91;300:org.opendaylight.netconf.sal-netconf-connector:1.5.1.Carbon&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps.createEditConfigStrcture(NetconfBaseOps.java:261)&lt;span class=&quot;error&quot;&gt;&amp;#91;300:org.opendaylight.netconf.sal-netconf-connector:1.5.1.Carbon&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.netconf.sal.connect.netconf.sal.tx.AbstractWriteTx.merge(AbstractWriteTx.java:117)&lt;span class=&quot;error&quot;&gt;&amp;#91;300:org.opendaylight.netconf.sal-netconf-connector:1.5.1.Carbon&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.netconf.sal.connect.netconf.sal.tx.ReadWriteTx.merge(ReadWriteTx.java:47)&lt;span class=&quot;error&quot;&gt;&amp;#91;300:org.opendaylight.netconf.sal-netconf-connector:1.5.1.Carbon&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.netconf.topology.singleton.impl.actors.WriteAdapter.handle(WriteAdapter.java:60)&lt;span class=&quot;error&quot;&gt;&amp;#91;303:org.opendaylight.netconf.topology-singleton:1.2.1.Carbon&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.netconf.topology.singleton.impl.actors.ReadWriteTransactionActor.onReceive(ReadWriteTransactionActor.java:56)&lt;span class=&quot;error&quot;&gt;&amp;#91;303:org.opendaylight.netconf.topology-singleton:1.2.1.Carbon&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at akka.actor.UntypedActor$$anonfun$receive$1.applyOrElse(UntypedActor.scala:165)&lt;span class=&quot;error&quot;&gt;&amp;#91;179:com.typesafe.akka.actor:2.4.18&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at akka.actor.Actor$class.aroundReceive(Actor.scala:502)&lt;span class=&quot;error&quot;&gt;&amp;#91;179:com.typesafe.akka.actor:2.4.18&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at akka.actor.UntypedActor.aroundReceive(UntypedActor.scala:95)&lt;span class=&quot;error&quot;&gt;&amp;#91;179:com.typesafe.akka.actor:2.4.18&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)&lt;span class=&quot;error&quot;&gt;&amp;#91;179:com.typesafe.akka.actor:2.4.18&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at akka.actor.ActorCell.invoke(ActorCell.scala:495)&lt;span class=&quot;error&quot;&gt;&amp;#91;179:com.typesafe.akka.actor:2.4.18&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)&lt;span class=&quot;error&quot;&gt;&amp;#91;179:com.typesafe.akka.actor:2.4.18&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at akka.dispatch.Mailbox.run(Mailbox.scala:224)&lt;span class=&quot;error&quot;&gt;&amp;#91;179:com.typesafe.akka.actor:2.4.18&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at akka.dispatch.Mailbox.exec(Mailbox.scala:234)&lt;span class=&quot;error&quot;&gt;&amp;#91;179:com.typesafe.akka.actor:2.4.18&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)&lt;span class=&quot;error&quot;&gt;&amp;#91;175:org.scala-lang.scala-library:2.11.11.v20170413-090219-8a413ba7cc&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)&lt;span class=&quot;error&quot;&gt;&amp;#91;175:org.scala-lang.scala-library:2.11.11.v20170413-090219-8a413ba7cc&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)&lt;span class=&quot;error&quot;&gt;&amp;#91;175:org.scala-lang.scala-library:2.11.11.v20170413-090219-8a413ba7cc&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)&lt;span class=&quot;error&quot;&gt;&amp;#91;175:org.scala-lang.scala-library:2.11.11.v20170413-090219-8a413ba7cc&amp;#93;&lt;/span&gt;&lt;/p&gt;


&lt;p&gt;We tried with &quot;merge&quot;, &quot;create&quot; and &quot;replace&quot; as the PATCH operations and saw the same error.&lt;/p&gt;

&lt;p&gt;However the &quot;remove&quot; PATCH operation on the same call works and it removes the entry.&lt;/p&gt;

&lt;p&gt;Request Type : PATCH&lt;/p&gt;

&lt;p&gt;URL :  http://&lt;tt&gt;controller&lt;/tt&gt;:&lt;tt&gt;port&lt;/tt&gt;/restconf/config/network-topology:network-topology/topology/topology-netconf/node/&lt;tt&gt;node&lt;/tt&gt;/yang-ext:mount/exa-base:config/profile/dhcp-v4-server-profile/&lt;tt&gt;dhcp-profile-name&lt;/tt&gt;/&lt;/p&gt;

&lt;p&gt;Payload :&lt;/p&gt;

&lt;p&gt;{&lt;br/&gt;
  &quot;ietf-restconf:yang-patch&quot; :&lt;br/&gt;
  {&lt;br/&gt;
    &quot;patch-id&quot; : &quot;0&quot;,&lt;br/&gt;
    &quot;edit&quot; :&lt;br/&gt;
    [&lt;/p&gt;
      {
        &quot;edit-id&quot; : &quot;edit1&quot;,
        &quot;operation&quot; : &quot;remove&quot;,
        &quot;target&quot; : &quot;&quot;
 
      }
&lt;p&gt;     ]&lt;br/&gt;
  }&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;This call successfully removes the entity.&lt;/p&gt;

&lt;p&gt;SO I think the issue is is parsing the payload in the create/merge operations on mounted resources for the PATCH command in this scenario.&lt;/p&gt;</description>
                <environment>&lt;p&gt;Tested on Carbon stable, Oxygen and Nitrogen. All exhibit the similar behavior and call fails.   The stack trace attached is for Carbon SR1. &lt;/p&gt;</environment>
        <key id="28802">NETCONF-486</key>
            <summary>Patch request on a Netconf Mounted device throwing ClassCastException from YANG tools</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="10000">Done</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="bvaradar">Balaji Varadaraju</reporter>
                        <labels>
                    </labels>
                <created>Fri, 17 Nov 2017 18:19:06 +0000</created>
                <updated>Mon, 28 May 2018 02:29:50 +0000</updated>
                            <resolved>Mon, 28 May 2018 02:29:50 +0000</resolved>
                                                                    <component>netconf</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="60091" author="rovarga" created="Mon, 20 Nov 2017 12:57:02 +0000"  >&lt;p&gt;at org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.fromInstanceId(ImmutableNodes.java:136)&lt;span class=&quot;error&quot;&gt;&amp;#91;102:org.opendaylight.yangtools.yang-data-impl:1.1.1.Carbon&amp;#93;&lt;/span&gt;&lt;br/&gt;
at org.opendaylight.netconf.sal.connect.netconf.util.NetconfMessageTransformUtil.createEditConfigAnyxml(NetconfMessageTransformUtil.java:294)&lt;span class=&quot;error&quot;&gt;&amp;#91;300:org.opendaylight.netconf.sal-netconf-connector:1.5.1.Carbon&amp;#93;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;This is a mismatch of arguments coming from netconf: it should be a collection of individual entries, not the map node itself.&lt;/p&gt;</comment>
                            <comment id="60283" author="bvaradar" created="Wed, 29 Nov 2017 23:43:35 +0000"  >&lt;p&gt;Thanks Robert. Can someone in NETCONF please further triage this?&lt;/p&gt;</comment>
                            <comment id="61014" author="bvaradar" created="Fri, 9 Feb 2018 21:16:53 +0000"  >&lt;p&gt;We confirmed the call works for XML payloads and only has issues with JSON payloads. So either this is in netcong which parses the edit part of the patch request or in YANGTOOLS that does the conversion between JSON to normalized object.&lt;/p&gt;</comment>
                            <comment id="61131" author="agosain" created="Tue, 20 Feb 2018 22:00:11 +0000"  >&lt;p&gt;Following patch has been upstreamed to fix the issue &lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/68436/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/68436/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Restconf&#160;patch request to leaf lists&#160;contained in&#160;augmented nodes&#160;with JSON format payload, were not able to properly be formed into an edit-config structure to be sent to the device. More context of the problem at this&#160;&lt;a href=&quot;https://lists.opendaylight.org/pipermail/yangtools-dev/2018-February/002157.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://lists.opendaylight.org/pipermail/yangtools-dev/2018-February/002157.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Following ClassCastException exception was thrown when this payload was sent. Whereas the same payload in xml format result in a successful patch operation. The ImmutableMapNodeBuilder expects the normalizedNode to contain a list of MapEntryNode instead of MapEntryNode. This was happening because in case of JSON, the normalized node was being constructed with an additional layer of AugmentationNode whereas xml payload was not.&#160;&lt;/p&gt;

&lt;p&gt;java.lang.ClassCastException: org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder$ImmutableMapNode cannot be cast to org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode at org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder.withValue(ImmutableMapNodeBuilder.java:81)&lt;span class=&quot;error&quot;&gt;&amp;#91;94:org.opendaylight.yangtools.yang-data-impl:1.1.1.Carbon&amp;#93;&lt;/span&gt; at org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder.withValue(ImmutableMapNodeBuilder.java:28)&lt;span class=&quot;error&quot;&gt;&amp;#91;94:org.opendaylight.yangtools.yang-data-impl:1.1.1.Carbon&amp;#93;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&#160;&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_10000" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i037x3:</customfieldvalue>

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