Skip to content

Edit YANG instance using NETCONF operations #24

Description

@wisotzky

At the moment, NETCONF operations are carried but are not functional. It would be useful, to dry-run an edit-config operation that uses the nc:operation as defined.

Activity

  1. rjarry commented on Jun 1, 2021

    @rjarry
    Collaborator

    Hi,

    I am not sure libyang is suitable for this. Maybe you should have a look at sysrepo (or sysrepo-python).

  2. changed the title [-]Feature Request | Edit YANG instance using NETCONF operations[/-] [+]Edit YANG instance using NETCONF operations[/+] on Jun 1, 2021
  3. wisotzky commented on Jun 14, 2021

    @wisotzky
    Author

    Would need to explore more deeply on what's possible using libyang2. As there is a method to "merge" data instances, it would be an obvious requirement to do "replace", "remove", "create" and "replace" to modify data instances (dnode). This would be useful to implement dryrun/preview as with Ansible.

  4. rjarry commented on Jun 14, 2021

    @rjarry
    Collaborator

    In that case, maybe you are looking for lyd_diff()

    https://github.com/CESNET/libyang/blob/libyang1/src/tree_data.h#L415

  5. wisotzky commented on Jun 14, 2021

    @wisotzky
    Author

    Hi @rjarry
    I've look into lyd_diff already. To use it the way I want, the target device must support the candidate datastore (NETCONF). It would not work with RESTCONF nor gNMI...

    So the idea is, that you can retrieve the current device config, apply the change and look what would be different.

  6. rjarry commented on Jun 14, 2021

    @rjarry
    Collaborator

    This needs to be supported by libyang itself. I do not think we will implement this only in the python bindings. If you need it you can submit a pull request on libyang. Note that the python bindings are incomplete and lyd_diff is not yet supported.

  7. wisotzky commented on Jun 14, 2021

    @wisotzky
    Author

    @rjarry... Let me review what is available in libyang2 first. I guess, that editing data instances is sort of a basic requirement for an advanced YANG engine like libyang. Converting dnodes to native XML, JSON or dict to modify and converting it back to XML, JSON or dict thereafter does not sound like a good approach at all. Also editing XML, JSON or dict is sort of tricky because of the way that lists are converted - so access by key(s) requires quite some extra code.

  8. samuel-gauthier commented on Jan 24, 2024

    @samuel-gauthier
    Collaborator

    Hi @wisotzky , do you still need that? If you need NETCONF, isn't ncclient (for instance) more suited to your needs?

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions