<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 19:57:07 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-2068] Processing routed RPC - buy-car RPC</title>
                <link>https://jira.opendaylight.org/browse/CONTROLLER-2068</link>
                <project id="10113" key="CONTROLLER">controller</project>
                    <description>&lt;p&gt;This relates to &lt;a href=&quot;https://jira.opendaylight.org/browse/CONTROLLER-2065&quot; title=&quot;Cannot invoke buy-car RPC&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CONTROLLER-2065&quot;&gt;CONTROLLER-2065&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The process of modeling, implementing and using &lt;b&gt;routed RPCs&lt;/b&gt; is documented &lt;a href=&quot;https://docs.opendaylight.org/projects/controller/en/latest/dev-guide.html#md-sal-rpc-routing&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;.&lt;br/&gt;
From that, it is clear that there needs to be context reference in the input of a routed RPC. The context reference is an &lt;em&gt;instance identifier&lt;/em&gt; referencing context instance in which the RPC should be executed.&lt;/p&gt;

&lt;p&gt;The buy-car RPC declaration declares that its context-reference is &lt;b&gt;person-context&lt;/b&gt; from module &lt;em&gt;people@2014-08-18&lt;/em&gt;:&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-json&quot;&gt;
rpc buy-car {
    description
      &lt;span class=&quot;code-quote&quot;&gt;&quot;buy a &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; car&quot;&lt;/span&gt;;
    input {
      leaf person {
        ext:context-reference &lt;span class=&quot;code-quote&quot;&gt;&quot;person:person-context&quot;&lt;/span&gt;;
        type person:person-ref;
        description &lt;span class=&quot;code-quote&quot;&gt;&quot;A reference to a particular person.&quot;&lt;/span&gt;;
      }

      leaf car-id {
        type car:car-id;
        description &lt;span class=&quot;code-quote&quot;&gt;&quot;identifier of car.&quot;&lt;/span&gt;;
      }
      leaf person-id {
        type person:person-id;
        description &lt;span class=&quot;code-quote&quot;&gt;&quot;identifier of person.&quot;&lt;/span&gt;;
      }
    }
  }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;So, when calling this RPC the body of the request could look 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-json&quot;&gt;
{
    &lt;span class=&quot;code-quote&quot;&gt;&quot;input&quot;&lt;/span&gt;: {
        &lt;span class=&quot;code-quote&quot;&gt;&quot;person&quot;&lt;/span&gt;: &lt;span class=&quot;code-quote&quot;&gt;&quot;/people:people/people:person[id=\&quot;&lt;/span&gt;0\&lt;span class=&quot;code-quote&quot;&gt;&quot;]&quot;&lt;/span&gt;,
        &lt;span class=&quot;code-quote&quot;&gt;&quot;car-id&quot;&lt;/span&gt;: &lt;span class=&quot;code-quote&quot;&gt;&quot;0&quot;&lt;/span&gt;,
        &lt;span class=&quot;code-quote&quot;&gt;&quot;person-id&quot;&lt;/span&gt;: &lt;span class=&quot;code-quote&quot;&gt;&quot;0&quot;&lt;/span&gt;
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This is executed successfully with return status &lt;em&gt;204 No Content&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;As stated in the previously mentioned &lt;a href=&quot;https://docs.opendaylight.org/projects/controller/en/latest/dev-guide.html#md-sal-rpc-routing&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;documentation on routed RPCs&lt;/a&gt;, there should be an implementation of an RPC for a particular &lt;b&gt;context instance&lt;/b&gt;. It also states, that &quot;If user invokes RPC with a &lt;b&gt;context instance&lt;/b&gt; that has no registered implementation, the RPC invocation will fail with the exception DOMRpcImplementationNotAvailableException.&quot;&lt;br/&gt;
That would mean, that if an implementation of a &lt;em&gt;buy-car&lt;/em&gt; RPC for the given context (in this case for an instance of a person with id 0) was not registered, the RPC should fail. The truth is, that it was NOT registered (implementation of &lt;em&gt;buy-car&lt;/em&gt; RPC for a particular context is registered when new person instance is added via &lt;em&gt;add-person&lt;/em&gt; RPC &lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;&lt;font color=&quot;#990f02&quot;&gt;Note: &lt;em&gt;add-person&lt;/em&gt; RPC is not registered, the registration needs to be added in the code (probably in the PersonProvider.java)&lt;/font&gt;&amp;#93;&lt;/span&gt;), but it doesn&apos;t fail.&lt;/p&gt;

&lt;p&gt;This is rooted in the processing of a*routed RPC*, thus lets see how it works.&lt;br/&gt;
This is no longer in controller, it is taken care of by &lt;b&gt;mdsal&lt;/b&gt;&apos;s &lt;b&gt;DOMRpcRouter&lt;/b&gt;.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;If a routed RPC is being invoked, the &lt;b&gt;DOMRpcRouter&lt;/b&gt; checks if the body contains an instance identifier of the &lt;b&gt;context reference&lt;/b&gt; declared in the yang model&lt;/li&gt;
	&lt;li&gt;if it DOES NOT, it checks whether there are any mapping of &lt;em&gt;null&lt;/em&gt; identifier to any implementation and if not, the RPC fails (if yes, the found implementation is executed)&lt;/li&gt;
	&lt;li&gt;if it DOES, it looks for a specific implementation of the RPC (specific == implementation of the RPC for the given context)
	&lt;ul&gt;
		&lt;li&gt;the specific implementation is executed, if it exists&lt;/li&gt;
		&lt;li&gt;if it does not exist, it checks if there is any implementation for a &quot;wild card&quot; (as described in the comment &quot;Find a DOMRpcImplementation for a wild card. Usually remote-rpc-connector would register an implementation this way&quot;) ...
&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;final&lt;/span&gt; List&amp;lt;DOMRpcImplementation&amp;gt; mayBeRemoteImpls = entry.getImplementations(YangInstanceIdentifier.empty());&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;... which in case of &lt;em&gt;buy-car&lt;/em&gt; gives us something that looks like a global implementation of the &lt;em&gt;buy-car&lt;/em&gt; RPC (this &quot;global&quot; implementation is registered, when &lt;b&gt;PeopleProvider&lt;/b&gt; service is activated)&lt;/p&gt;&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Summary of peculiarities:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;The &lt;em&gt;buy-car&lt;/em&gt; RPC does not fail, when the implementation for the given context is missing.&lt;/li&gt;
	&lt;li&gt;The &lt;em&gt;buy-car&lt;/em&gt; RPC does fail, when no context reference is given in the input example in the related issue&lt;/li&gt;
	&lt;li&gt;The input of the &lt;em&gt;buy-car&lt;/em&gt; contains
	&lt;ul&gt;
		&lt;li&gt;reference to a particular person by specifying their &lt;b&gt;id&lt;/b&gt;&lt;/li&gt;
		&lt;li&gt;car-id&lt;/li&gt;
		&lt;li&gt;person-id&lt;br/&gt;
but the &lt;b&gt;person-id&lt;/b&gt; and the &lt;b&gt;id&lt;/b&gt; (extracted from the given person reference) are not connected in any way&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;The error message, received when the input is missing the &lt;b&gt;context reference&lt;/b&gt; is vague (example in related issue). Sure, the implementation for the not given context is missing, but the error message makes it seem, like there is no implementation of the &lt;em&gt;buy-car&lt;/em&gt; RPC whatsoever. Wouldn&apos;t it be better to inform the user about the missing context reference? (mdsal)&lt;/li&gt;
&lt;/ol&gt;
</description>
                <environment></environment>
        <key id="36620">CONTROLLER-2068</key>
            <summary>Processing routed RPC - buy-car RPC</summary>
                <type id="10101" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10318&amp;avatarType=issuetype">Task</type>
                                            <priority id="3" iconUrl="https://jira.opendaylight.org/images/icons/priorities/major.svg">Medium</priority>
                        <status id="1" iconUrl="https://jira.opendaylight.org/images/icons/statuses/open.png" description="The issue is open and ready for the assignee to start work on it.">Open</status>
                    <statusCategory id="2" key="new" colorName="blue-gray"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="rovarga">Robert Varga</assignee>
                                    <reporter username="simon0pt">&#352;imon Uku&#353;</reporter>
                        <labels>
                            <label>pt</label>
                    </labels>
                <created>Fri, 20 Jan 2023 16:46:49 +0000</created>
                <updated>Fri, 20 Jan 2023 16:56:28 +0000</updated>
                                                                                <due></due>
                            <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                    <issuelinks>
                            <issuelinktype id="10003">
                    <name>Relates</name>
                                                                <inwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="36440">CONTROLLER-2065</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|i0441b:</customfieldvalue>

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