[CONTROLLER-116] RESTCONF: GET operation on group results in IllegalArgumentException Created: 16/Jan/14  Updated: 25/Jul/23  Resolved: 24/Jan/14

Status: Resolved
Project: controller
Component/s: mdsal
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Deepthi V V Assignee: Martin Sunal
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Windows
Platform: PC


Issue Links:
Blocks
is blocked by YANGTOOLS-75 key from ListSchemaNode has different... Resolved
is blocked by YANGTOOLS-78 Node add by uses statement has a Conf... Resolved
External issue ID: 313

 Description   

Steps:
1. Create a group on the switch.
2. Perform GET operation on the group using url:
http://localhost:8080/restconf/datastore/opendaylight-inventory:nodes/node/openflow:1/group/1

This results in following exception:
java.lang.IllegalArgumentException
com.google.common.base.Preconditions.checkArgument(Preconditions.java:76)
org.opendaylight.controller.sal.restconf.impl.ControllerContext.addKeyValue(ControllerContext.java:682)
org.opendaylight.controller.sal.restconf.impl.ControllerContext.collectPathArguments(ControllerContext.java:596)
org.opendaylight.controller.sal.restconf.impl.ControllerContext.collectPathArguments(ControllerContext.java:612)
org.opendaylight.controller.sal.restconf.impl.ControllerContext.collectPathArguments(ControllerContext.java:612)
org.opendaylight.controller.sal.restconf.impl.ControllerContext.toInstanceIdentifier(ControllerContext.java:160)
org.opendaylight.controller.sal.restconf.impl.RestconfImpl.resolveInstanceIdentifier(RestconfImpl.java:384)
org.opendaylight.controller.sal.restconf.impl.RestconfImpl.readData(RestconfImpl.java:165)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
...

Debug Results:

1. In flow-node-inventory.yang: "grouping flow-node" contains statement "uses group:groups;" where group refers to group-types.yang

2. ControllerContext.java line:595
DataSchemaNode _dataChildByName = listNode.getDataChildByName(key);
RESTCONF correctly recognizes the group-id to be in group-types namespace and hence key is identified as "urn:opendaylight:group:types:group-id".
But the listNode object reference points to ListSchemaNode -> group whose child lements' namespace is incorrectly set to "urn:opendaylight:flow:inventory" namespace. Thus _dataChildByName is set to null. This results in exception.

Please note that the issue does not occur consistently.

Build info:
My code base contains code till the commit:

commit ffecdf80dfcda1b05b18ab30690e93f77593a236
Merge: 39e9983 f5f6bbc
Author: Abhijit Kumbhare <abhijitk@us.ibm.com>
Date: Thu Jan 16 00:48:58 2014 +0000

Merge "Fixed Bug : 287 https://bugs.opendaylight.org/show_bug.cgi?id=287"



 Comments   
Comment by Ed Warnicke [ 16/Jan/14 ]

This may be fixed by

https://git.opendaylight.org/gerrit/#/c/4209/

Comment by Deepthi V V [ 17/Jan/14 ]

Ed:
This issue is related to fetching group information even without any statistics.
It is basically yang parsing issue.
ListSchemaNodeBuilder object for "list group":
keyDefinition contains group-id from "urn:opendaylight:group:types" namespace. But its childNodes map contains group-id from "urn:opendaylight:flow:inventory".

The fix may/may not have impact on code review:
https://git.opendaylight.org/gerrit/#/c/4209/

Comment by Martin Sunal [ 20/Jan/14 ]

there is a YANGTOOLS-75 which has to be resolved in yangtools.

Comment by Tony Tkacik [ 24/Jan/14 ]

Fix for YANGTOOLS-75 fixed this behaviour.
Fix for CONTROLLER-119 fixes also edit operations on that subtree.

Generated at Wed Feb 07 19:52:13 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.