module ietf-yang-library-augmentedby {
  yang-version 1.1;
  namespace
    "urn:ietf:params:xml:ns:yang:ietf-yang-library-augmentedby";
  prefix yanglib-aug;

  import ietf-yang-library {
    prefix yanglib;
    reference
      "RFC 8525: YANG Library";
  }

  organization
    "IETF NETCONF (Network Configuration) Working Group";
  contact
    "WG Web:   <https://datatracker.ietf.org/wg/netconf/>
     WG List:  <mailto:netconf@ietf.org>

     Authors:   Zhuoyao Lin
               <mailto:zhuoyao.lin1@huawei-partners.com>
               Benoit Claise
               <mailto:benoit@everything-ops.net>
               Ignacio Dominguez Martinez-Casanueva
               <mailto:ignacio.dominguezmartinez@telefonica.com>";
  description
    "This module augments the ietf-yang-library defined in
     [RFC8525] to provide not only the deviation list, but also
     the augmented-by list, in order to give sufficient
     information about the YANG modules reverse dependency. It
     facilitates the process of obtaining the entire
     dependencies of YANG module.

     The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL',
     'SHALL NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED',
     'NOT RECOMMENDED', 'MAY', and 'OPTIONAL' in this document
     are to be interpreted as described in BCP 14 (RFC 2119)
     (RFC 8174) when, and only when, they appear in all
     capitals, as shown here.

     Copyright (c) 2025 IETF Trust and the persons identified as
     authors of the code.  All rights reserved.

     Redistribution and use in source and binary forms, with or
     without modification, is permitted pursuant to, and subject
     to the license terms contained in, the Revised BSD License
     set forth in Section 4.c of the IETF Trust's Legal Provisions
     Relating to IETF Documents
     (https://trustee.ietf.org/license-info).
     This version of this YANG module is part of RFC XXXX; see the
     RFC itself for full legal notices.  ";

  revision 2025-05-28 {
    description
      "Initial revision.";
    reference
      "RFC XXXX: Augmented-by Addition to the YANG Library";
  }

  grouping augmented-by {
    description
      "Augment the augmented-by leaf-list from module info with the
       module-augmented-by grouping";
    leaf-list augmented-by {
      type leafref {
        path "../../yanglib:module/yanglib:name";
      }
      description
        "Leaf-list of the augmentations used by this server to
         modify the schema tree of the module associated with
         this entry.  Note that the same module can be used for
         augmented-by for multiple modules, so the same
         entry MAY appear within multiple 'module' entries.

         This reference MUST NOT (directly or indirectly)
         refer to the module being augmented.

         Robust clients may want to make sure that they handle a
         situation where a module augments itself (directly or
         indirectly) gracefully.";
    }
  }

  augment "/yanglib:yang-library/yanglib:module-set/yanglib:module" {
    description
      "Augments the augmented-by leaf-list from module info with the
       augmented-by grouping.";
    uses augmented-by;
  }

  augment "/yanglib:modules-state/yanglib:module" {
    status deprecated;
    description
      "Augments the augmented-by leaf-list from module info with the
       augmented-by grouping.";
    uses augmented-by;
  }
}
