Add support for RFC8819 "module-tag" extension
[yangtools.git] / parser / rfc8819-parser-support / src / test / resources / ietf-module-tags.yang
1 module ietf-module-tags {
2      yang-version 1.1;
3      namespace "urn:ietf:params:xml:ns:yang:ietf-module-tags";
4      prefix tags;
5
6      import ietf-yang-types {
7        prefix yang;
8      }
9
10      organization
11        "IETF NetMod Working Group (NetMod)";
12      contact
13        "WG Web:  <https://datatracker.ietf.org/wg/netmod/>
14         WG List: <mailto:netmod@ietf.org>
15
16         Author: Christian Hopps
17                 <mailto:chopps@chopps.org>
18
19         Author: Lou Berger
20                 <mailto:lberger@labn.net>
21
22         Author: Dean Bogdanovic
23                 <mailto:ivandean@gmail.com>";
24
25      description
26        "This module describes a mechanism associating tags with YANG
27         modules.  Tags may be IANA assigned or privately defined.
28
29         Copyright (c) 2021 IETF Trust and the persons identified as
30         authors of the code.  All rights reserved.
31
32         Redistribution and use in source and binary forms, with or
33         without modification, is permitted pursuant to, and subject to
34         the license terms contained in, the Simplified BSD License set
35         forth in Section 4.c of the IETF Trust's Legal Provisions
36         Relating to IETF Documents
37         (https://trustee.ietf.org/license-info).
38
39         This version of this YANG module is part of RFC 8819
40         (https://www.rfc-editor.org/info/rfc8819); see the RFC itself
41         for full legal notices.
42
43         The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL
44         NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED',
45         'MAY', and 'OPTIONAL' in this document are to be interpreted as
46         described in BCP 14 (RFC 2119) (RFC 8174) when, and only when,
47         they appear in all capitals, as shown here.";
48
49      revision 2021-01-04 {
50        description
51          "Initial revision.";
52        reference
53          "RFC 8819: YANG Module Tags";
54      }
55
56      typedef tag {
57        type string {
58          length "1..max";
59          pattern '[\S ]+';
60        }
61        description
62          "A tag is a type of 'string' value that does not include
63           carriage return, newline, or tab characters.  It SHOULD begin
64           with a registered prefix; however, tags without a registered
65           prefix SHOULD NOT be treated as invalid.";
66      }
67
68      extension module-tag {
69        argument tag;
70        description
71          "The argument 'tag' is of type 'tag'.  This extension statement
72           is used by module authors to indicate the tags that SHOULD be
73           added automatically by the system.  As such, the origin of the
74           value for the predefined tags should be set to 'system'
75           [RFC8342].";
76      }
77
78      container module-tags {
79        description
80          "Contains the list of modules and their associated tags.";
81        list module {
82          key "name";
83          description
84            "A list of modules and their associated tags.";
85          leaf name {
86            type yang:yang-identifier;
87            mandatory true;
88            description
89              "The YANG module name.";
90          }
91          leaf-list tag {
92            type tag;
93            description
94              "Tags associated with the module.  See the IANA 'YANG
95               Module Tag Prefixes' registry for reserved prefixes and
96               the IANA 'IETF YANG Module Tags' registry for IETF tags.
97
98               The 'operational' state [RFC8342] view of this list is
99               constructed using the following steps:
100
101               1) System tags (i.e., tags of 'system' origin) are added.
102               2) User-configured tags (i.e., tags of 'intended' origin)
103               are added.
104               3) Any tag that is equal to a masked-tag is removed.";
105          }
106          leaf-list masked-tag {
107            type tag;
108            description
109              "The list of tags that should not be associated with this
110               module.  The user can remove (mask) tags from the
111               operational state datastore [RFC8342] by adding them to
112               this list.  It is not an error to add tags to this list
113               that are not associated with the module, but they have no
114               operational effect.";
115          }
116        }
117      }
118    }