Refactor folder structure.
[sim/o1-interface.git] / ntsimulator / yang / o-ran / ru-fh / ietf-netconf-acm.yang
1 module ietf-netconf-acm {
2
3   namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-acm";
4
5   prefix nacm;
6
7   import ietf-yang-types {
8     prefix yang;
9   }
10
11   organization
12     "IETF NETCONF (Network Configuration) Working Group";
13
14   contact
15     "WG Web:   <https://datatracker.ietf.org/wg/netconf/>
16      WG List:  <mailto:netconf@ietf.org>
17      Author:   Andy Bierman
18                <mailto:andy@yumaworks.com>
19      Author:   Martin Bjorklund
20                <mailto:mbj@tail-f.com>";
21
22   description
23     "Network Configuration Access Control Model.
24      Copyright (c) 2012 - 2018 IETF Trust and the persons
25      identified as authors of the code.  All rights reserved.
26      Redistribution and use in source and binary forms, with or
27      without modification, is permitted pursuant to, and subject
28      to the license terms contained in, the Simplified BSD
29      License set forth in Section 4.c of the IETF Trust's
30      Legal Provisions Relating to IETF Documents
31      (https://trustee.ietf.org/license-info).
32      This version of this YANG module is part of RFC 8341; see
33      the RFC itself for full legal notices.";
34
35   revision "2018-02-14" {
36     description
37       "Added support for YANG 1.1 actions and notifications tied to
38        data nodes.  Clarified how NACM extensions can be used by
39        other data models.";
40     reference
41       "RFC 8341: Network Configuration Access Control Model";
42   }
43
44   revision "2012-02-22" {
45     description
46       "Initial version.";
47     reference
48       "RFC 6536: Network Configuration Protocol (NETCONF)
49                  Access Control Model";
50   }
51
52   /*
53    * Extension statements
54    */
55
56   extension default-deny-write {
57     description
58       "Used to indicate that the data model node
59        represents a sensitive security system parameter.
60        If present, the NETCONF server will only allow the designated
61        'recovery session' to have write access to the node.  An
62        explicit access control rule is required for all other users.
63        If the NACM module is used, then it must be enabled (i.e.,
64        /nacm/enable-nacm object equals 'true'), or this extension
65        is ignored.
66        The 'default-deny-write' extension MAY appear within a data
67        definition statement.  It is ignored otherwise.";
68   }
69
70   extension default-deny-all {
71     description
72       "Used to indicate that the data model node
73        controls a very sensitive security system parameter.
74        If present, the NETCONF server will only allow the designated
75        'recovery session' to have read, write, or execute access to
76        the node.  An explicit access control rule is required for all
77        other users.
78        If the NACM module is used, then it must be enabled (i.e.,
79        /nacm/enable-nacm object equals 'true'), or this extension
80        is ignored.
81        The 'default-deny-all' extension MAY appear within a data
82        definition statement, 'rpc' statement, or 'notification'
83        statement.  It is ignored otherwise.";
84   }
85
86   /*
87    * Derived types
88    */
89
90   typedef user-name-type {
91     type string {
92       length "1..max";
93     }
94     description
95       "General-purpose username string.";
96   }
97
98   typedef matchall-string-type {
99     type string {
100       pattern '\*';
101     }
102     description
103       "The string containing a single asterisk '*' is used
104        to conceptually represent all possible values
105        for the particular leaf using this data type.";
106   }
107
108   typedef access-operations-type {
109     type bits {
110       bit create {
111         description
112           "Any protocol operation that creates a
113            new data node.";
114       }
115       bit read {
116         description
117           "Any protocol operation or notification that
118            returns the value of a data node.";
119       }
120       bit update {
121         description
122           "Any protocol operation that alters an existing
123            data node.";
124       }
125       bit delete {
126         description
127           "Any protocol operation that removes a data node.";
128       }
129       bit exec {
130         description
131           "Execution access to the specified protocol operation.";
132       }
133     }
134     description
135       "Access operation.";
136   }
137
138   typedef group-name-type {
139     type string {
140       length "1..max";
141       pattern '[^\*].*';
142     }
143     description
144       "Name of administrative group to which
145        users can be assigned.";
146   }
147
148   typedef action-type {
149     type enumeration {
150       enum permit {
151         description
152           "Requested action is permitted.";
153       }
154       enum deny {
155         description
156           "Requested action is denied.";
157       }
158     }
159     description
160       "Action taken by the server when a particular
161        rule matches.";
162   }
163
164   typedef node-instance-identifier {
165     type yang:xpath1.0;
166     description
167       "Path expression used to represent a special
168        data node, action, or notification instance-identifier
169        string.
170        A node-instance-identifier value is an
171        unrestricted YANG instance-identifier expression.
172        All the same rules as an instance-identifier apply,
173        except that predicates for keys are optional.  If a key
174        predicate is missing, then the node-instance-identifier
175        represents all possible server instances for that key.
176        This XML Path Language (XPath) expression is evaluated in the
177        following context:
178           o  The set of namespace declarations are those in scope on
179              the leaf element where this type is used.
180           o  The set of variable bindings contains one variable,
181              'USER', which contains the name of the user of the
182              current session.
183           o  The function library is the core function library, but
184              note that due to the syntax restrictions of an
185              instance-identifier, no functions are allowed.
186           o  The context node is the root node in the data tree.
187        The accessible tree includes actions and notifications tied
188        to data nodes.";
189   }
190
191   /*
192    * Data definition statements
193    */
194
195   container nacm {
196     nacm:default-deny-all;
197
198     description
199       "Parameters for NETCONF access control model.";
200
201     leaf enable-nacm {
202       type boolean;
203       default "true";
204       description
205         "Enables or disables all NETCONF access control
206          enforcement.  If 'true', then enforcement
207          is enabled.  If 'false', then enforcement
208          is disabled.";
209     }
210
211     leaf read-default {
212       type action-type;
213       default "permit";
214       description
215         "Controls whether read access is granted if
216          no appropriate rule is found for a
217          particular read request.";
218     }
219
220     leaf write-default {
221       type action-type;
222       default "deny";
223       description
224         "Controls whether create, update, or delete access
225          is granted if no appropriate rule is found for a
226          particular write request.";
227     }
228
229     leaf exec-default {
230       type action-type;
231       default "permit";
232       description
233         "Controls whether exec access is granted if no appropriate
234          rule is found for a particular protocol operation request.";
235     }
236
237     leaf enable-external-groups {
238       type boolean;
239       default "true";
240       description
241         "Controls whether the server uses the groups reported by the
242          NETCONF transport layer when it assigns the user to a set of
243          NACM groups.  If this leaf has the value 'false', any group
244          names reported by the transport layer are ignored by the
245          server.";
246     }
247
248     leaf denied-operations {
249       type yang:zero-based-counter32;
250       config false;
251       mandatory true;
252       description
253         "Number of times since the server last restarted that a
254          protocol operation request was denied.";
255     }
256
257     leaf denied-data-writes {
258       type yang:zero-based-counter32;
259       config false;
260       mandatory true;
261       description
262         "Number of times since the server last restarted that a
263          protocol operation request to alter
264          a configuration datastore was denied.";
265     }
266
267     leaf denied-notifications {
268       type yang:zero-based-counter32;
269       config false;
270       mandatory true;
271       description
272         "Number of times since the server last restarted that
273          a notification was dropped for a subscription because
274          access to the event type was denied.";
275     }
276
277     container groups {
278       description
279         "NETCONF access control groups.";
280
281       list group {
282         key name;
283
284         description
285           "One NACM group entry.  This list will only contain
286            configured entries, not any entries learned from
287            any transport protocols.";
288
289         leaf name {
290           type group-name-type;
291           description
292             "Group name associated with this entry.";
293         }
294
295         leaf-list user-name {
296           type user-name-type;
297           description
298             "Each entry identifies the username of
299              a member of the group associated with
300              this entry.";
301         }
302       }
303     }
304
305     list rule-list {
306       key name;
307       ordered-by user;
308       description
309         "An ordered collection of access control rules.";
310
311       leaf name {
312         type string {
313           length "1..max";
314         }
315         description
316           "Arbitrary name assigned to the rule-list.";
317       }
318       leaf-list group {
319         type union {
320           type matchall-string-type;
321           type group-name-type;
322         }
323         description
324           "List of administrative groups that will be
325            assigned the associated access rights
326            defined by the 'rule' list.
327            The string '*' indicates that all groups apply to the
328            entry.";
329       }
330
331       list rule {
332         key name;
333         ordered-by user;
334         description
335           "One access control rule.
336            Rules are processed in user-defined order until a match is
337            found.  A rule matches if 'module-name', 'rule-type', and
338            'access-operations' match the request.  If a rule
339            matches, the 'action' leaf determines whether or not
340            access is granted.";
341
342         leaf name {
343           type string {
344             length "1..max";
345           }
346           description
347             "Arbitrary name assigned to the rule.";
348         }
349
350         leaf module-name {
351           type union {
352             type matchall-string-type;
353             type string;
354           }
355           default "*";
356           description
357             "Name of the module associated with this rule.
358              This leaf matches if it has the value '*' or if the
359              object being accessed is defined in the module with the
360              specified module name.";
361         }
362         choice rule-type {
363           description
364             "This choice matches if all leafs present in the rule
365              match the request.  If no leafs are present, the
366              choice matches all requests.";
367           case protocol-operation {
368             leaf rpc-name {
369               type union {
370                 type matchall-string-type;
371                 type string;
372               }
373               description
374                 "This leaf matches if it has the value '*' or if
375                  its value equals the requested protocol operation
376                  name.";
377             }
378           }
379           case notification {
380             leaf notification-name {
381               type union {
382                 type matchall-string-type;
383                 type string;
384               }
385               description
386                 "This leaf matches if it has the value '*' or if its
387                  value equals the requested notification name.";
388             }
389           }
390
391           case data-node {
392             leaf path {
393               type node-instance-identifier;
394               mandatory true;
395               description
396                 "Data node instance-identifier associated with the
397                  data node, action, or notification controlled by
398                  this rule.
399                  Configuration data or state data
400                  instance-identifiers start with a top-level
401                  data node.  A complete instance-identifier is
402                  required for this type of path value.
403                  The special value '/' refers to all possible
404                  datastore contents.";
405             }
406           }
407         }
408
409         leaf access-operations {
410           type union {
411             type matchall-string-type;
412             type access-operations-type;
413           }
414           default "*";
415           description
416             "Access operations associated with this rule.
417              This leaf matches if it has the value '*' or if the
418              bit corresponding to the requested operation is set.";
419         }
420
421         leaf action {
422           type action-type;
423           mandatory true;
424           description
425             "The access control action associated with the
426              rule.  If a rule has been determined to match a
427              particular request, then this object is used
428              to determine whether to permit or deny the
429              request.";
430         }
431
432         leaf comment {
433           type string;
434           description
435             "A textual description of the access rule.";
436         }
437       }
438     }
439   }
440 }