<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:10:46 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>[MDSAL-730] Clean up InstanceIdentifier semantics</title>
                <link>https://jira.opendaylight.org/browse/MDSAL-730</link>
                <project id="10137" key="MDSAL">mdsal</project>
                    <description>&lt;p&gt;With &lt;a href=&quot;https://jira.opendaylight.org/browse/MDSAL-696&quot; title=&quot;Do not use DerivableSchemaNode&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MDSAL-696&quot;&gt;&lt;del&gt;MDSAL-696&lt;/del&gt;&lt;/a&gt;, BGPCEP is not quite happy and reports this:&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;org.opendaylight.mdsal.binding.dom.codec.api.IncorrectNestingException: interface org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update is not a valid data tree child of SchemaRootCodecContext [interface org.opendaylight.yangtools.yang.binding.DataRoot]
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at org.opendaylight.mdsal.binding.dom.codec.api.IncorrectNestingException.create(IncorrectNestingException.java:26)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at org.opendaylight.mdsal.binding.dom.codec.impl.SchemaRootCodecContext.createDataTreeChildContext(SchemaRootCodecContext.java:280)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at org.opendaylight.mdsal.binding.dom.codec.impl.SchemaRootCodecContext$1.load(SchemaRootCodecContext.java:70)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at org.opendaylight.mdsal.binding.dom.codec.impl.SchemaRootCodecContext$1.load(SchemaRootCodecContext.java:67)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3533)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2282)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2159)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2049)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at com.google.common.cache.LocalCache.get(LocalCache.java:3966)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3989)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4950)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4956)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at org.opendaylight.mdsal.binding.dom.codec.impl.SchemaRootCodecContext.getOrRethrow(SchemaRootCodecContext.java:394)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at org.opendaylight.mdsal.binding.dom.codec.impl.SchemaRootCodecContext.streamChild(SchemaRootCodecContext.java:231)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at org.opendaylight.mdsal.binding.dom.codec.impl.DataContainerCodecContext.bindingPathArgumentChild(DataContainerCodecContext.java:113)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at org.opendaylight.mdsal.binding.dom.codec.impl.SchemaRootCodecContext.bindingPathArgumentChild(SchemaRootCodecContext.java:376)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at org.opendaylight.mdsal.binding.dom.codec.impl.BindingCodecContext.getCodecContextNode(BindingCodecContext.java:241)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at org.opendaylight.mdsal.binding.dom.codec.impl.BindingCodecContext.newWriterAndIdentifier(BindingCodecContext.java:203)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at org.opendaylight.mdsal.binding.dom.codec.impl.BindingCodecContext.toNormalizedNode(BindingCodecContext.java:522)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at org.opendaylight.mdsal.binding.dom.codec.spi.ForwardingBindingDOMCodecServices.toNormalizedNode(ForwardingBindingDOMCodecServices.java:66)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest.createNlriWithDrawnRoute(AbstractRIBSupportTest.java:125)
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at org.opendaylight.protocol.bgp.inet.IPv4RIBSupportTest.testDeleteRoutes(IPv4RIBSupportTest.java:85)

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;As the error indicates, for some reason we are attempting to access a Notification as a data context &#8211; which is definitely not right. We are most likely missing a recognition that we need to access a class through Notification code path.&lt;/p&gt;

&lt;p&gt;The core problem is that InstanceIdentifier harks back to initial design where a DataObject was enough to identify an item. This capability was then relaxed to allow reuse of InstanceIdentifier to identify even RpcInput/RpcOutput/Notification and Groupings in the context of mdsal-binding-dom-codec. This is obviously wrong, as noted in &lt;a href=&quot;https://jira.opendaylight.org/browse/MDSAL-724&quot; title=&quot;Reject invalid InstanceIdentifiers&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MDSAL-724&quot;&gt;&lt;del&gt;MDSAL-724&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Tie up the loose ends in InstanceIdentifier definition to require properly-rooted hierarchy, thus rejecting attempts to address invalid items.&lt;/p&gt;

&lt;p&gt;There are two different solutions. For simple cases, like&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 foo {
  namespace foo;
  prefix foo;

  container foo;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;the following continues to work&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;
InstanceIdentifier&amp;lt;Foo&amp;gt; id = InstanceIdentifier.create(Foo.class);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;For more complex cases involving grouping and choices, such as:&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;module foo {
  namespace foo;
  prefix foo;

  choice foo {
    container bar;
  }

  grouping grp {
    container baz;
  }

  uses grp;
}&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The solution is to go through a specifically-crafted InstanceIdentifierBuilder. The choice/case interface is already covered with pre-existing methods, but for the case of used groupings, the root needs to be specified like this:&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;
InstanceIdentifier&amp;lt;Bar&amp;gt; id = InstanceIdentifier.builderOfInherited(FooData.class, Bar.class).build();
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Here FooData identifies the module in which the grouping is instantiated and Bar identifies the container as it would normally do.&lt;/p&gt;</description>
                <environment></environment>
        <key id="35333">MDSAL-730</key>
            <summary>Clean up InstanceIdentifier semantics</summary>
                <type id="10100" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10310&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="1" iconUrl="https://jira.opendaylight.org/images/icons/priorities/blocker.svg">Highest</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="rovarga">Robert Varga</assignee>
                                    <reporter username="rovarga">Robert Varga</reporter>
                        <labels>
                    </labels>
                <created>Thu, 10 Mar 2022 18:20:46 +0000</created>
                <updated>Sat, 12 Mar 2022 18:24:14 +0000</updated>
                            <resolved>Sat, 12 Mar 2022 18:24:14 +0000</resolved>
                                                    <fixVersion>9.0.0</fixVersion>
                                    <component>Binding runtime</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="70632" author="rovarga" created="Thu, 10 Mar 2022 23:46:08 +0000"  >&lt;p&gt;The problem boils down to a Notification data being identified as an InstanceIdentifier, beginning here:&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;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; &amp;lt;T &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; DataObject&amp;gt; @NonNull InstanceIdentifier&amp;lt;T&amp;gt; create(&lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;Class&lt;/span&gt;&amp;lt;@NonNull T&amp;gt; type) {
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; (InstanceIdentifier&amp;lt;T&amp;gt;) create(ImmutableList.of(Item.of(type)));
    }

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This is quite wrong as Update is not a valid InstanceIdentifier (in the data tree sense, as YangInstanceIdentifier) and we using that to address nodes with:&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;InstanceIdentifier{targetType=interface org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.reach.MpReachNlri, path=[org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesReach, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.reach.MpReachNlri]}&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This should not be allowed and we need a separate construct to address Notifications and other constructs, which are addressable through DataObjects, but are not data tree items.&lt;/p&gt;

&lt;p&gt;Otherwise this identifier could very well be used to query the datastore &#8211; and obviously would fail miserably.&lt;/p&gt;

&lt;p&gt;We need to introduce a more general concept and specialize it for data that is identified at a particular DataObject, be it a subclass of Notification, RpcInput or RpcOutput, with explicit handling for it.&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|i041rj:</customfieldvalue>

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