Do not instantiate NormalizedNodes for filter 13/75513/8
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 27 Aug 2018 10:43:27 +0000 (12:43 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 27 Aug 2018 19:13:42 +0000 (21:13 +0200)
commit1c545b9883f64305983a9c0ef73acdaa97866cc7
tree5f4328ff63011ee2ac1ed95db935eb633da66e63
parentfc3a145b9dac1150a906e813231e7023fd4bd3a0
Do not instantiate NormalizedNodes for filter

Using ImmutableNodes.fromInstanceId() does not work for leaf nodes,
as we do not have a value, which violates LeafNode contract -- leading
to an IllegalStateException when a user attempts to read() a single
leaf via a transaction.

As it turns out, this is completely unnecessary, as all we are doing
is iterating through the temporary NormalizedNode and creating
NormalizedNodeStreamWriter events based on that.

This patch replicates ImmutableNodes.fromInstanceId() logic, but
simplifies it for this particular task, short-cutting NormalizedNode
creation and emitting events directly as we are iterating over
the YangInstanceIdentifier.

JIRA: NETCONF-563
Change-Id: I0781e81d812ee979deaafb9dfa811e143866f4af
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/NetconfUtil.java
netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/StreamingContext.java [new file with mode: 0644]
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfMessageTransformUtil.java
netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/schema/mapping/NetconfMessageTransformerTest.java