ConfD User Community

Importing a container from a module


#1

I am writing a YANG module where I want to include a container from another module i.e. I want to define a NEW container in the module that I am writing that references a container from another module. Example of failed attempt:

    module newmodule {
    yang-version 1.1;
   namespace "urn:myorg:params:xml:ns:yang:newmodule";
   prefix newmodule;

   import ietf-access-control-list {
       prefix "acl";
   }

  container newprofile {
     container acl:access-lists;
  }
}

When I used yangtool to generate java, I found just a stub for acl:access-lists.

Is this the correct way to do this?


#2

I don’t think you can “reuse” containers in such a way. You should use grouping and uses.