Skip to content

Schema Mount: top-level rpc of a mounted module is rejected inside a NETCONF <action> ("Unexpected RPC element") #2622

Open

Description

@pekseow

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:

  1. 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 .
  2. In the mounted context, the mounted module's top-level rpc is still a schema node with nodetype == LYS_RPC.
  3. 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.

0001-path-fallback-to-ext-lookup.patch
JIRA-mount_data_require_parent_context-summary.md

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions