summaryrefslogtreecommitdiffstats
path: root/models/ietf-yang-structure-ext@2020-06-17.yang
blob: e3452a46bbefe2ea54df6bf7253e6cecb9482093 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
module ietf-yang-structure-ext {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-yang-structure-ext";
  prefix sx;

  organization
    "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
  contact
    "WG Web:   <https://datatracker.ietf.org/wg/netmod/>
     WG List:  <mailto:netmod@ietf.org>

     Author:   Andy Bierman
               <mailto:andy@yumaworks.com>

     Author:   Martin Bjorklund
               <mailto:mbj+ietf@4668.se>

     Author:   Kent Watsen
               <mailto:kent+ietf@watsen.net>";
  description
    "This module contains conceptual YANG specifications for defining
     abstract data structures.

     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) 2020 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 Simplified BSD License set
     forth in Section 4.c of the IETF Trust's Legal Provisions
     Relating to IETF Documents
     (http://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC 8791
     (https://www.rfc-editor.org/info/rfc8791); see the RFC itself
     for full legal notices.";

  revision 2020-06-17 {
    description
      "Initial revision.";
    reference
      "RFC 8791: YANG Data Structure Extensions.";
  }

  extension structure {
    argument name {
      yin-element true;
    }
    description
      "This extension is used to specify a YANG data structure that
       represents conceptual data defined in YANG.  It is intended to
       describe hierarchical data independent of protocol context or
       specific message encoding format.  Data definition statements
       within a 'structure' extension statement specify the generic
       syntax for the specific YANG data structure, whose name is the
       argument of the 'structure' extension statement.

       Note that this extension does not define a media type.  A
       specification using this extension MUST specify the message
       encoding rules, including the content media type, if
       applicable.

       The mandatory 'name' parameter value identifies the YANG data
       structure that is being defined.

       This extension is only valid as a top-level statement, i.e.,
       given as a substatement to 'module' or 'submodule'.

       The substatements of this extension MUST follow the ABNF
       rules below, where the rules are defined in RFC 7950:

           *must-stmt
           [status-stmt]
           [description-stmt]
           [reference-stmt]
           *(typedef-stmt / grouping-stmt)
           *data-def-stmt

       A YANG data structure defined with this extension statement is
       encoded in the same way as an 'anydata' node.  This means
       that the name of the structure is encoded as a 'container',
       with the instantiated child statements encoded as child nodes
       to this node.

       The module name and namespace value for the YANG module using
       the extension statement are assigned to each of the data
       definition statements resulting from the YANG data structure.

       The XPath document element is the extension statement itself,
       such that the child nodes of the document element are
       represented by the data-def-stmt substatements within this
       extension.  This conceptual document is the context for the
       following YANG statements:

           - must-stmt
           - when-stmt
           - path-stmt
           - min-elements-stmt
           - max-elements-stmt
           - mandatory-stmt
           - unique-stmt
           - ordered-by
           - instance-identifier data type

       The following data-def-stmt substatements are constrained
       when used within a 'structure' extension statement.

          - The list-stmt is not required to have a key-stmt defined.
          - The config-stmt is ignored if present.
       ";
  }

  extension augment-structure {
    argument path {
      yin-element true;
    }
    description
      "This extension is used to specify an augmentation to a YANG
       data structure defined with the 'structure' statement.  It is
       intended to describe hierarchical data independent of protocol
       context or specific message encoding format.

       This statement has almost the same structure as the
       'augment-stmt'.  Data definition statements within this
       statement specify the semantics and generic syntax for the
       additional data to be added to the specific YANG data
       structure, identified by the 'path' argument.

       The mandatory 'path' parameter value identifies the YANG
       conceptual data node that is being augmented and is
       represented as an absolute-schema-nodeid string, where the
       first node in the absolute-schema-nodeid string identifies the
       YANG data structure to augment, and the rest of the nodes in
       the string identifies the node within the YANG structure to
       augment.

       This extension is only valid as a top-level statement, i.e.,
       given as a substatement to 'module' or 'submodule'.

       The substatements of this extension MUST follow the ABNF
       rules below, where the rules are defined in RFC 7950:

           [status-stmt]
           [description-stmt]
           [reference-stmt]
           1*(data-def-stmt / case-stmt)

       The module name and namespace value for the YANG module using
       the extension statement are assigned to instance document data
       conforming to the data definition statements within this
       extension.

       The XPath document element is the augmented extension
       statement itself, such that the child nodes of the document
       element are represented by the data-def-stmt substatements
       within the augmented 'structure' statement.

       The context node of the 'augment-structure' statement is
       derived in the same way as the 'augment' statement, as defined
       in Section 6.4.1 of [RFC7950]. This conceptual node is
       considered the context node for the following YANG statements:

           - must-stmt
           - when-stmt
           - path-stmt
           - min-elements-stmt
           - max-elements-stmt
           - mandatory-stmt
           - unique-stmt
           - ordered-by
           - instance-identifier data type

       The following data-def-stmt substatements are constrained
       when used within an 'augment-structure' extension statement.

           - The list-stmt is not required to have a key-stmt defined.
           - The config-stmt is ignored if present.

       Example:

           module foo {
               import ietf-yang-structure-ext { prefix sx; }

               sx:structure foo-data {
               container foo-con { }
               }
           }

           module bar {
               import ietf-yang-structure-ext { prefix sx; }
               import foo { prefix foo; }

               sx:augment-structure /foo:foo-data/foo:foo-con {
               leaf add-leaf1 { type int32; }
               leaf add-leaf2 { type string; }
               }
           }
       ";
  }
}