Skip to content

Create data tree with augment #11

@lukasmacko

Description

@lukasmacko

Hi,
I am trying to create a data tree for a module which is augmented by another one. I've tried to use lyd_new_leaf but it doesn't work. What is the correct way to create data tree with augment?

root = lyd_new_leaf(NULL, module, "size", "8");

node =  lyd_new(NULL, module, "item");
lyd_new_leaf(node, module, "name", value);

lyd_insert_after(root, node);

module = ly_ctx_get_module(ctx, "info-module", NULL);
if(NULL == module){
      puts("info module not found");
}   
struct lyd_node *augment = lyd_new_leaf(node, module, "info", "asdfafa"); /* RETURNS NULL*/

used YANG modules:

module small-module {
  namespace "urn:ietf:params:xml:ns:yang:small-module";
  prefix sm;

  organization "organization";
  description
    "example yang module";
  contact
    "contact@example.com";

  container item{
    leaf name {
      type string;
    }
  }

  leaf size {
    type int8;
  }
}
module info-module {
  namespace "urn:ietf:params:xml:ns:yang:info";
  prefix ie;
  import small-module {
    prefix sm;
  }

  organization "organization";
  description
    "example yang module";
  contact
    "contact@example.com";

  augment "/sm:item" {
    leaf info {
      type string;
    }
  }
}

thanks
Lukas

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