Fix fields processing error for duplicate node names 92/105092/8
authorSangwook Ha <sangwook.ha@verizon.com>
Tue, 28 Mar 2023 07:05:55 +0000 (00:05 -0700)
committerRobert Varga <nite@hq.sk>
Wed, 19 Apr 2023 12:19:24 +0000 (12:19 +0000)
commit8c5bcfc76987e678469d5a4a95ae882bad6fe91a
treeff45ca3b8cdd3809a1f329dbf9f7c145254a6231
parent0ba2e3054e2d7b5a381be5f8fb77ead0d59f0f22
Fix fields processing error for duplicate node names

NetconfFieldsTranslator saves LinkedPathElement identified by the target
node identifier, hence does not allow keeping track of data nodes with
the same name failing to generate correct paths if such nodes are
included in the fields parameter.

Address the issue by replacing the list of sets to keep track of the
data nodes specified in the fields parameter with a tree of
LinkedPathElement objects keeping track of its parent path element.
This allows generation of all unique paths defined in the fields
parameter and also simplifies the processing.

But this change in the data structure is incompatible with
AbstractFieldsTranslator, and NetconfFieldsTranslator does not inherit
the abstract class.

JIRA: NETCONF-985
Change-Id: I762714f8a25231c1394d75b47e269167b37660f8
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/NetconfFieldsTranslator.java
restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/AbstractFieldsTranslatorTest.java
restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/NetconfFieldsTranslatorTest.java
restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/WriterFieldsTranslatorTest.java
restconf/restconf-nb/src/test/resources/same-qname-nodes/foo.yang [new file with mode: 0644]