Skip to content

Adding extensions to leafnodes using deviation #2496

Open

Description

@srikanthsubbaramu

Hi Michal,

We are trying to mark a few extensions for some parameters, we could mark this importing the extensions module in the yang file and marking the leaf nodes,
we wanted to understand if we could create module with deviation with which we could add extensions, so rather than modifying multiple yang files we could use a module with deviation to mark extensions, but we see that it fails with unknown prefix error,

here is the extensions yang file

  extension ru-it {
    description
      "Indicates the parameter is modifiable at RU init time only and hence requires a RU restart(reset).";
  }

  extension rt {
    description
      "Indicates the parameter is modifiable at run time and does not require a restart.";
  }

  extension sa {
    description
      "Indicates the parameter is applicable only for standalone deployment.";
  }

  extension nsa {
    description
      "Indicates the parameter is applicable only for non standalone deployment.";
  }

  extension sa-nsa {
    description
      "Indicates the parameter is applicable only for both standalone and non standalone deployment.";
  }

  extension spec-ref {
    description
      "Specify the specification reference if the parameter is taken from any specification.";
    argument "spec-ref";
  }

}

We are trying to use it via deviate,

module _ran-nr-nrm-gnbcucp-ext-test {
  yang-version 1.1;
  namespace "urn:3gpp:sa5:_ran-nr-nrm-gnbcucp-ext-test";
  prefix "gnbcucp-ext-test";

  import _3gpp-common-managed-element { prefix me3gpp; }
  import _3gpp-nr-nrm-gnbcucpfunction { prefix gnbcucp3gpp; }
  import _ran-nr-nrm-yang-extensions { prefix yextran; }

  deviation "/me3gpp:ManagedElement/gnbcucp3gpp:GNBCUCPFunction/gnbcucp3gpp:attributes/gnbcucp3gpp:gNBId" {
    deviate add {
      yextran:rt;
    }
  }
}

when we try to load the yang in sr_install_module , with verbose log i am seeing below

[VRB] Searching for "_3gpp-nr-nrm-gnbcucpfunction" in "/opt/sysrepo/yang".
[VRB] Loading schema from "/tmp/yangs/_3gpp-nr-nrm-gnbcucpfunction.yang" file.
[ERR] Invalid prefix "yextran" used for extension instance identifier.
[2026-03-17 09:17:14.082575] [INFO] Extension module install failed: libyang error
[2026-03-17 09:17:14.082595] [INFO] Session stopped.
[INF] Connection 1 destroyed.

we need to understand if we can add extensions via deviate,

Thanks,
Srikanth

Activity

  1. michalvasko commented on Mar 18, 2026

    @michalvasko
    Member

    Works just fine in a test I have just added, maybe you are using an old libyang version.

  2. added
    is:bugBug description.
    status:invalidIssue is not reproducible or the behavior is intended.
    and removed
    is:questionIssue is actually a question.
    on Mar 18, 2026
  3. srikanthsubbaramu commented on Mar 18, 2026

    @srikanthsubbaramu
    Author

    Hi Michal,
    we are on libyang-devel branch which is 3 weeks old from current devel branch .

    Thanks,
    Srikanth

  4. michalvasko commented on Mar 18, 2026

    @michalvasko
    Member

    Then provide all the required YANG modules including the import so that I can reproduce it.

  5. srikanthsubbaramu commented on Mar 18, 2026

    @srikanthsubbaramu
    Author

    yangs.zip
    command used for loading is
    rc = sr_install_modules(conn, schema_paths.data(), search_dir, NULL);
    const char *search_dir = "/opt/sysrepo/yang:/tmp/yangs"; ( /opt/sysrepo is sysrepodir ) /tmp/yangs is hwere above yangs are extracted, and schema_paths is array of all filenames in yang

  6. michalvasko commented on Mar 19, 2026

    @michalvasko
    Member

    Your YANG module is actually invalid but it took me too long to figure out so I have improved the logging and now it should be clearer. However, deviating extension instances was not supported so I have implemented that and it should work now as expected.

  7. added
    is:enhancementRequest for adding new feature or enahncing functionality.
    status:completedFrom the developer perspective, the issue was solved (bug fixed, question answered,...)
    and removed
    is:bugBug description.
    status:invalidIssue is not reproducible or the behavior is intended.
    on Mar 19, 2026
  8. srikanthsubbaramu commented on Mar 20, 2026

    @srikanthsubbaramu
    Author

    Hi Michal,

    Thank you for the update, can you please let me know what is actually wrong in yang module? can you please help with this information, so i could correct yang,

    Thanks,
    Srikanth

  9. michalvasko commented on Mar 20, 2026

    @michalvasko
    Member

    Exactly what the error says:

    [VRB] Loading schema from "/tmp/yangs/_3gpp-nr-nrm-gnbcucpfunction.yang" file.
    [ERR] Invalid prefix "yextran" used for extension instance identifier.
    

    The module _ran-nr-nrm-gnbcucp-ext-test is correct, the issue is in the _3gpp-nr-nrm-gnbcucpfunction module.

  10. srikanthsubbaramu commented on Mar 20, 2026

    @srikanthsubbaramu
    Author

    hi Michal,
    thanks because _3gpp-nr-nrm-gnbcucpfunction.yang does not do a import of yang extensions file, it is unable to understand yextran,

    so with fix above , will this method work or still the module in which an leaf gets deviated for extension import actual yang which contains definition/prefix

  11. michalvasko commented on Mar 20, 2026

    @michalvasko
    Member

    Just remove the extension instance from _3gpp-nr-nrm-gnbcucpfunction and you should be able to add it via deviation in _ran-nr-nrm-gnbcucp-ext-test.

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

    is:enhancementRequest for adding new feature or enahncing functionality.status:completedFrom the developer perspective, the issue was solved (bug fixed, question answered,...)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions