OpenApi: Rework tests to parameterized
[netconf.git] / restconf / restconf-nb / src / test / resources / modules / restconf-module-testing / ietf-yang-library@2019-01-04.yang
1 module ietf-yang-library {
2   yang-version 1.1;
3   namespace "urn:ietf:params:xml:ns:yang:ietf-yang-library";
4   prefix yanglib;
5
6   import ietf-yang-types {
7     prefix yang;
8     reference
9       "RFC 6991: Common YANG Data Types";
10   }
11   import ietf-inet-types {
12     prefix inet;
13     reference
14       "RFC 6991: Common YANG Data Types";
15   }
16   import ietf-datastores {
17     prefix ds;
18     reference
19       "RFC 8342: Network Management Datastore Architecture
20                  (NMDA)";
21   }
22
23   organization
24     "IETF NETCONF (Network Configuration) Working Group";
25   contact
26     "WG Web:   <https://datatracker.ietf.org/wg/netconf/>
27      WG List:  <mailto:netconf@ietf.org>
28
29      Author:   Andy Bierman
30                <mailto:andy@yumaworks.com>
31
32      Author:   Martin Bjorklund
33                <mailto:mbj@tail-f.com>
34
35      Author:   Juergen Schoenwaelder
36                <mailto:j.schoenwaelder@jacobs-university.de>
37
38      Author:   Kent Watsen
39                <mailto:kent+ietf@watsen.net>
40
41      Author:   Robert Wilton
42                <mailto:rwilton@cisco.com>";
43   description
44     "This module provides information about the YANG modules,
45      datastores, and datastore schemas used by a network
46      management server.
47      The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL
48      NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED',
49      'MAY', and 'OPTIONAL' in this document are to be interpreted as
50      described in BCP 14 (RFC 2119) (RFC 8174) when, and only when,
51      they appear in all capitals, as shown here.
52
53      Copyright (c) 2019 IETF Trust and the persons identified as
54      authors of the code.  All rights reserved.
55
56      Redistribution and use in source and binary forms, with or
57      without modification, is permitted pursuant to, and subject
58      to the license terms contained in, the Simplified BSD License
59      set forth in Section 4.c of the IETF Trust's Legal Provisions
60      Relating to IETF Documents
61      (https://trustee.ietf.org/license-info).
62
63      This version of this YANG module is part of RFC 8525; see
64      the RFC itself for full legal notices.";
65
66   revision 2019-01-04 {
67     description
68       "Added support for multiple datastores according to the
69        Network Management Datastore Architecture (NMDA).";
70     reference
71       "RFC 8525: YANG Library";
72   }
73   revision 2016-04-09 {
74     description
75       "Initial revision.";
76     reference
77       "RFC 7895: YANG Module Library";
78   }
79
80   /*
81    * Typedefs
82    */
83
84   typedef revision-identifier {
85     type string {
86       pattern '\d{4}-\d{2}-\d{2}';
87     }
88     description
89       "Represents a specific date in YYYY-MM-DD format.";
90   }
91
92   /*
93    * Groupings
94    */
95   grouping module-identification-leafs {
96     description
97       "Parameters for identifying YANG modules and submodules.";
98     leaf name {
99       type yang:yang-identifier;
100       mandatory true;
101       description
102         "The YANG module or submodule name.";
103     }
104     leaf revision {
105       type revision-identifier;
106       description
107         "The YANG module or submodule revision date.  If no revision
108          statement is present in the YANG module or submodule, this
109          leaf is not instantiated.";
110     }
111   }
112
113   grouping location-leaf-list {
114     description
115       "Common leaf-list parameter for the locations of modules and
116        submodules.";
117     leaf-list location {
118       type inet:uri;
119       description
120         "Contains a URL that represents the YANG schema
121          resource for this module or submodule.
122
123          This leaf will only be present if there is a URL
124          available for retrieval of the schema for this entry.";
125     }
126   }
127
128   grouping module-implementation-parameters {
129     description
130       "Parameters for describing the implementation of a module.";
131     leaf-list feature {
132       type yang:yang-identifier;
133       description
134         "List of all YANG feature names from this module that are
135          supported by the server, regardless whether they are defined
136          in the module or any included submodule.";
137     }
138     leaf-list deviation {
139       type leafref {
140         path "../../module/name";
141       }
142
143       description
144         "List of all YANG deviation modules used by this server to
145          modify the conformance of the module associated with this
146          entry.  Note that the same module can be used for deviations
147          for multiple modules, so the same entry MAY appear within
148          multiple 'module' entries.
149
150          This reference MUST NOT (directly or indirectly)
151          refer to the module being deviated.
152
153          Robust clients may want to make sure that they handle a
154          situation where a module deviates itself (directly or
155          indirectly) gracefully.";
156     }
157   }
158
159   grouping module-set-parameters {
160     description
161       "A set of parameters that describe a module set.";
162     leaf name {
163       type string;
164       description
165         "An arbitrary name of the module set.";
166     }
167     list module {
168       key "name";
169       description
170         "An entry in this list represents a module implemented by the
171          server, as per Section 5.6.5 of RFC 7950, with a particular
172          set of supported features and deviations.";
173       reference
174         "RFC 7950: The YANG 1.1 Data Modeling Language";
175       uses module-identification-leafs;
176       leaf namespace {
177         type inet:uri;
178         mandatory true;
179         description
180           "The XML namespace identifier for this module.";
181       }
182       uses location-leaf-list;
183       list submodule {
184         key "name";
185         description
186           "Each entry represents one submodule within the
187            parent module.";
188         uses module-identification-leafs;
189         uses location-leaf-list;
190       }
191       uses module-implementation-parameters;
192     }
193     list import-only-module {
194       key "name revision";
195       description
196         "An entry in this list indicates that the server imports
197          reusable definitions from the specified revision of the
198          module but does not implement any protocol-accessible
199          objects from this revision.
200
201          Multiple entries for the same module name MAY exist.  This
202          can occur if multiple modules import the same module but
203          specify different revision dates in the import statements.";
204       leaf name {
205         type yang:yang-identifier;
206         description
207           "The YANG module name.";
208       }
209       leaf revision {
210         type union {
211           type revision-identifier;
212           type string {
213             length "0";
214           }
215         }
216         description
217           "The YANG module revision date.
218            A zero-length string is used if no revision statement
219            is present in the YANG module.";
220       }
221       leaf namespace {
222         type inet:uri;
223         mandatory true;
224         description
225           "The XML namespace identifier for this module.";
226       }
227       uses location-leaf-list;
228       list submodule {
229         key "name";
230         description
231           "Each entry represents one submodule within the
232            parent module.";
233         uses module-identification-leafs;
234         uses location-leaf-list;
235       }
236     }
237   }
238
239   grouping yang-library-parameters {
240     description
241       "The YANG library data structure is represented as a grouping
242        so it can be reused in configuration or another monitoring
243        data structure.";
244     list module-set {
245       key "name";
246       description
247         "A set of modules that may be used by one or more schemas.
248
249          A module set does not have to be referentially complete,
250          i.e., it may define modules that contain import statements
251          for other modules not included in the module set.";
252       uses module-set-parameters;
253     }
254     list schema {
255       key "name";
256       description
257         "A datastore schema that may be used by one or more
258          datastores.
259
260          The schema must be valid and referentially complete, i.e.,
261          it must contain modules to satisfy all used import
262          statements for all modules specified in the schema.";
263       leaf name {
264         type string;
265         description
266           "An arbitrary name of the schema.";
267       }
268       leaf-list module-set {
269         type leafref {
270           path "../../module-set/name";
271         }
272         description
273           "A set of module-sets that are included in this schema.
274            If a non-import-only module appears in multiple module
275            sets, then the module revision and the associated features
276            and deviations must be identical.";
277       }
278     }
279     list datastore {
280       key "name";
281       description
282         "A datastore supported by this server.
283
284          Each datastore indicates which schema it supports.
285
286          The server MUST instantiate one entry in this list per
287          specific datastore it supports.
288          Each datastore entry with the same datastore schema SHOULD
289          reference the same schema.";
290       leaf name {
291         type ds:datastore-ref;
292         description
293           "The identity of the datastore.";
294       }
295       leaf schema {
296         type leafref {
297           path "../../schema/name";
298         }
299         mandatory true;
300         description
301           "A reference to the schema supported by this datastore.
302            All non-import-only modules of the schema are implemented
303            with their associated features and deviations.";
304       }
305     }
306   }
307
308   /*
309    * Top-level container
310    */
311
312   container yang-library {
313     config false;
314     description
315       "Container holding the entire YANG library of this server.";
316     uses yang-library-parameters;
317     leaf content-id {
318       type string;
319       mandatory true;
320       description
321         "A server-generated identifier of the contents of the
322          '/yang-library' tree.  The server MUST change the value of
323          this leaf if the information represented by the
324          '/yang-library' tree, except '/yang-library/content-id', has
325          changed.";
326     }
327   }
328
329   /*
330    * Notifications
331    */
332
333   notification yang-library-update {
334     description
335       "Generated when any YANG library information on the
336        server has changed.";
337     leaf content-id {
338       type leafref {
339         path "/yanglib:yang-library/yanglib:content-id";
340       }
341       mandatory true;
342       description
343         "Contains the YANG library content identifier for the updated
344          YANG library at the time the notification is generated.";
345     }
346   }
347
348   /*
349    * Legacy groupings
350    */
351
352   grouping module-list {
353     status deprecated;
354     description
355       "The module data structure is represented as a grouping
356        so it can be reused in configuration or another monitoring
357        data structure.";
358
359     grouping common-leafs {
360       status deprecated;
361       description
362         "Common parameters for YANG modules and submodules.";
363       leaf name {
364         type yang:yang-identifier;
365         status deprecated;
366         description
367           "The YANG module or submodule name.";
368       }
369       leaf revision {
370         type union {
371           type revision-identifier;
372           type string {
373             length "0";
374           }
375         }
376         status deprecated;
377         description
378           "The YANG module or submodule revision date.
379            A zero-length string is used if no revision statement
380            is present in the YANG module or submodule.";
381       }
382     }
383
384     grouping schema-leaf {
385       status deprecated;
386       description
387         "Common schema leaf parameter for modules and submodules.";
388       leaf schema {
389         type inet:uri;
390         description
391           "Contains a URL that represents the YANG schema
392            resource for this module or submodule.
393
394            This leaf will only be present if there is a URL
395            available for retrieval of the schema for this entry.";
396       }
397     }
398     list module {
399       key "name revision";
400       status deprecated;
401       description
402         "Each entry represents one revision of one module
403          currently supported by the server.";
404       uses common-leafs {
405         status deprecated;
406       }
407       uses schema-leaf {
408         status deprecated;
409       }
410       leaf namespace {
411         type inet:uri;
412         mandatory true;
413         status deprecated;
414         description
415           "The XML namespace identifier for this module.";
416       }
417       leaf-list feature {
418         type yang:yang-identifier;
419         status deprecated;
420         description
421           "List of YANG feature names from this module that are
422            supported by the server, regardless of whether they are
423            defined in the module or any included submodule.";
424       }
425       list deviation {
426         key "name revision";
427         status deprecated;
428
429         description
430           "List of YANG deviation module names and revisions
431            used by this server to modify the conformance of
432            the module associated with this entry.  Note that
433            the same module can be used for deviations for
434            multiple modules, so the same entry MAY appear
435            within multiple 'module' entries.
436
437            The deviation module MUST be present in the 'module'
438            list, with the same name and revision values.
439            The 'conformance-type' value will be 'implement' for
440            the deviation module.";
441         uses common-leafs {
442           status deprecated;
443         }
444       }
445       leaf conformance-type {
446         type enumeration {
447           enum implement {
448             description
449               "Indicates that the server implements one or more
450                protocol-accessible objects defined in the YANG module
451                identified in this entry.  This includes deviation
452                statements defined in the module.
453
454                For YANG version 1.1 modules, there is at most one
455                'module' entry with conformance type 'implement' for a
456                particular module name, since YANG 1.1 requires that
457                at most one revision of a module is implemented.
458
459                For YANG version 1 modules, there SHOULD NOT be more
460                than one 'module' entry for a particular module
461                name.";
462           }
463           enum import {
464             description
465               "Indicates that the server imports reusable definitions
466                from the specified revision of the module but does
467                not implement any protocol-accessible objects from
468                this revision.
469
470                Multiple 'module' entries for the same module name MAY
471                exist.  This can occur if multiple modules import the
472                same module but specify different revision dates in
473                the import statements.";
474           }
475         }
476         mandatory true;
477         status deprecated;
478         description
479           "Indicates the type of conformance the server is claiming
480            for the YANG module identified by this entry.";
481       }
482       list submodule {
483         key "name revision";
484         status deprecated;
485         description
486           "Each entry represents one submodule within the
487            parent module.";
488         uses common-leafs {
489           status deprecated;
490         }
491         uses schema-leaf {
492           status deprecated;
493         }
494       }
495     }
496   }
497
498   /*
499    * Legacy operational state data nodes
500    */
501
502   container modules-state {
503     config false;
504     status deprecated;
505     description
506       "Contains YANG module monitoring information.";
507     leaf module-set-id {
508       type string;
509       mandatory true;
510       status deprecated;
511       description
512         "Contains a server-specific identifier representing
513          the current set of modules and submodules.  The
514          server MUST change the value of this leaf if the
515          information represented by the 'module' list instances
516          has changed.";
517     }
518     uses module-list {
519       status deprecated;
520     }
521   }
522
523   /*
524    * Legacy notifications
525    */
526
527   notification yang-library-change {
528     status deprecated;
529     description
530       "Generated when the set of modules and submodules supported
531        by the server has changed.";
532     leaf module-set-id {
533       type leafref {
534         path "/yanglib:modules-state/yanglib:module-set-id";
535       }
536       mandatory true;
537       status deprecated;
538       description
539         "Contains the module-set-id value representing the
540          set of modules and submodules supported at the server
541          at the time the notification is generated.";
542     }
543   }
544 }