<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:55:39 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-1264] SchemaContextUtil.resolveModuleForPrefix  does not look at submodules</title>
                <link>https://jira.opendaylight.org/browse/YANGTOOLS-1264</link>
                <project id="10188" key="YANGTOOLS">yangtools</project>
                    <description>&lt;p&gt;We have a yang file ipi-bfd with rather complex structure. It includes some yang files&lt;/p&gt;

&lt;p&gt;&#8230;&lt;/p&gt;

&lt;p&gt;include ipi-bfd-interface;&lt;/p&gt;

&lt;p&gt;&#8230;&lt;/p&gt;

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

&lt;p&gt;The included yang file ipi-bfd-interface.yang in its turn imports some other yang files and uses them:&lt;/p&gt;

&lt;p&gt;&#8230;&lt;/p&gt;

&lt;p&gt;import ipi-interface &lt;/p&gt;
{

&#160;&#160;&#160;&#160;&#160;&#160;&#160; prefix ipi-interface;

&#160;&#160;&#160; }

&lt;p&gt;&#8230;&lt;/p&gt;

&lt;p&gt;path&#160; &quot;/ipi-interface:interfaces/ipi-interface:interface/ipi-interface:name&quot;;&lt;/p&gt;

&lt;p&gt;&#8230;&lt;/p&gt;

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

&lt;p&gt;These files are located on device and processed by Restconf. We get exception&lt;/p&gt;

&lt;p&gt;java.lang.IllegalArgumentException: Failed to resolve xpath: no module found for prefix ipi-interface in module ipi-bfd&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; at com.google.common.base.Preconditions.checkArgument(Preconditions.java:441) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;?:?&amp;#93;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; at org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.stringPathPartToQName(SchemaContextUtil.java:606)&lt;/p&gt;

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

&lt;p&gt;File ipi-bfd really does not have prefix ipi-interface. It is defined in included file and is used there.&lt;/p&gt;

&lt;p&gt;It looks like SchemaContextUtil.resolveModuleForPrefix method checks only imports from the top file itself ignoring included files.&lt;/p&gt;

&lt;p&gt;I fixed this bug in my environment by patching&#160;org/opendaylight/yangtools/yang/model/util/SchemaContextUtil.java,&#160;methodresolveModuleForPrefix.&lt;/p&gt;

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

&lt;p&gt;This is the patch&lt;/p&gt;

&lt;p&gt;-&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return context.findModule(mi.getModuleName(), mi.getRevision()).orElse(null);&lt;/p&gt;

&lt;p&gt;+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Optional&amp;lt;? extends Module&amp;gt; moduleOpt = context.findModule(mi.getModuleName(), mi.getRevision());&lt;/p&gt;

&lt;p&gt;+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (moduleOpt.isPresent()) &lt;/p&gt;
{

+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return moduleOpt.get();

+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }

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

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

&lt;p&gt;+&lt;/p&gt;

&lt;p&gt;+&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (Module submodule : module.getSubmodules()) {&lt;/p&gt;

&lt;p&gt;+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Module result = resolveModuleForPrefix(context, submodule, prefix);&lt;/p&gt;

&lt;p&gt;+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (result != null) {&lt;/p&gt;

&lt;p&gt;+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return result;&lt;/p&gt;</description>
                <environment>&lt;p&gt;I work with ODL Aluminium SR2.&#160;&lt;/p&gt;</environment>
        <key id="33847">YANGTOOLS-1264</key>
            <summary>SchemaContextUtil.resolveModuleForPrefix  does not look at submodules</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="10003">Cannot Reproduce</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="yevgeny88">Yevgeny Shakhnovich</reporter>
                        <labels>
                    </labels>
                <created>Wed, 3 Mar 2021 21:15:28 +0000</created>
                <updated>Thu, 27 Oct 2022 01:04:32 +0000</updated>
                            <resolved>Thu, 27 Oct 2022 01:04:32 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="71575" author="rovarga" created="Thu, 27 Oct 2022 01:04:32 +0000"  >&lt;p&gt;SchemaInferenceStack and yang-model-export handle these correctly with help of yang-model-api exposing a few namespaces.&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|i03xe7:</customfieldvalue>

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