You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Schema Mount: top-level rpc of a mounted module is rejected inside a NETCONF <action> ("Unexpected RPC element") #2622
Summary:
RFC 8528 Section 5 says that for an RPC defined in a mounted module, "clients can invoke this operation as if it were defined as an action for the corresponding mount point" (RFC 7950 Section 7.15). A client therefore sends the mounted RPC inside a NETCONF element, nested under the mount point in the parent data tree.
libyang rejects this with Unexpected RPC element "".
Root cause:
lydxml_env_netconf_rpc() (src/parser_xml.c:1341-1353) parses the envelope and sets int_opts = LYD_INTOPT_NO_SIBLINGS | LYD_INTOPT_ACTION. LYD_INTOPT_RPC is set only when there is no .
In the mounted context, the mounted module's top-level rpc is still a schema node with nodetype == LYS_RPC.
lyd_parser_check_schema() (src/parser_common.c:155-162) accepts a LYS_RPC node only when int_opts contains LYD_INTOPT_RPC or LYD_INTOPT_REPLY. Under LYD_INTOPT_ACTION it jumps to error_node_inval and logs Unexpected RPC element "". (src/parser_common.c:195).
The check assumes the node type alone selects the envelope: LYS_RPC for , LYS_ACTION for . RFC 8528 breaks this assumption, because a top-level RPC of a mounted module is nested in the parent data tree and is invoked as an action.
src/plugins_exts/schema_mount.c has no RPC/action handling, and before this report tests/utests/extensions/test_schema_mount.c had no RPC, action or notification case.
Affected version: libyang 6.4.13
Please see attached JIRA-schema-mount-rpc-as action-summary.md for potential fix and 0001-test-mounted-rpc-as-action-reproducer.patch to add unit test to reproduce the issue.
Activity