Sync Common folder
[transportpce.git] / ordmodels / device / src / main / yang / org-openroadm-syslog@2017-12-15.yang
1 module org-openroadm-syslog {
2   namespace "http://org/openroadm/syslog";
3   prefix org-openroadm-syslog;
4
5   import ietf-inet-types {
6     prefix inet;
7     revision-date 2013-07-15;
8   }
9
10   organization
11     "Open ROADM MSA";
12   contact
13     "OpenROADM.org";
14   description
15     "This module contains a collection of YANG definitions 
16      for Syslog configuration.                                               
17      
18      Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, 
19      AT&T Intellectual Property.  All other rights reserved.
20      
21      Redistribution and use in source and binary forms, with or without modification, 
22      are permitted provided that the following conditions are met:
23      
24      * Redistributions of source code must retain the above copyright notice, this 
25        list of conditions and the following disclaimer.
26      * Redistributions in binary form must reproduce the above copyright notice, 
27        this list of conditions and the following disclaimer in the documentation and/or 
28        other materials provided with the distribution.
29      * Neither the Members of the Open ROADM MSA Agreement nor the names of its 
30        contributors may be used to endorse or promote products derived from this software 
31        without specific prior written permission.
32      
33      THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA  AGREEMENT ''AS IS'' 
34      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
35      WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
36      IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA  AGREEMENT BE LIABLE FOR ANY DIRECT, 
37      INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
38      NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;  LOSS OF USE, DATA, 
39      OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
40      WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
41      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
42      POSSIBILITY OF SUCH DAMAGE.
43      
44      Also contains code components extracted from IETF Interfaces.  These code components
45      are copyrighted and licensed as follows:
46      
47      Copyright (c) 2016 IETF Trust and the persons identified as the document authors.
48      All rights reserved.
49      
50      This document is subject to BCP 78 and the IETF Trust’s Legal Provisions Relating
51      to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of
52      publication of this document. Please review these documents carefully, as they
53      describe your rights and restrictions with respect to this document. Code Components
54      extracted from this document must include Simplified BSD License text as described in
55      Section 4.e of the Trust Legal Provisions and are provided without warranty as
56      described in the Simplified BSD License.";
57   reference "RFC 5424: The Syslog Protocol";
58
59   revision 2017-12-15 {
60     description
61       "Version 2.2";
62   }
63   revision 2017-09-29 {
64     description
65       "Version 2.1";
66   }
67   revision 2017-07-28 {
68     description
69       "Version 2.0.1 - added revision-date to imports";
70   }
71   revision 2016-10-14 {
72     description
73       "Version 1.2";
74   }
75
76   feature selector-sevop-config {
77     description
78       "This feature represents the ability to select messages 
79        using the additional operators equal to, or not equal to 
80        when comparing the Syslog message severity.";
81   }
82
83   feature selector-match-config {
84     description
85       "This feature represents the ability to select messages based
86        on a Posix 1003.2 regular expression pattern match.";
87   }
88
89   identity syslog-facility {
90     description
91       "The base identity to represent syslog facilities";
92   }
93
94   typedef severity {
95     type enumeration {
96       enum "emergency" {
97         value 0;
98         description
99           "Emergency Level Msg";
100       }
101       enum "alert" {
102         value 1;
103         description
104           "Alert Level Msg";
105       }
106       enum "critical" {
107         value 2;
108         description
109           "Critical Level Msg";
110       }
111       enum "error" {
112         value 3;
113         description
114           "Error Level Msg";
115       }
116       enum "warning" {
117         value 4;
118         description
119           "Warning Level Msg";
120       }
121       enum "notice" {
122         value 5;
123         description
124           "Notification Level Msg";
125       }
126       enum "info" {
127         value 6;
128         description
129           "Informational Level Msg";
130       }
131       enum "debug" {
132         value 7;
133         description
134           "Debugging Level Msg";
135       }
136       enum "all" {
137         value 8;
138         description
139           "This enum describes the case where all severities 
140            are selected.";
141       }
142       enum "none" {
143         value 9;
144         description
145           "This enum describes the case where no severities 
146            are selected.";
147       }
148     }
149     description
150       "The definitions for Syslog message severity as per RFC 5424.
151        Extended the RFC definition with enums for all and none";
152   }
153
154   grouping syslog-severity {
155     description
156       "This grouping defines the Syslog severity which is used to 
157        select log messages.";
158     leaf severity {
159       type severity;
160       mandatory true;
161       description
162         "This leaf specifies the Syslog message severity. When 
163          severity is specified, the default severity comparison 
164          is all messages of the specified severity and greater are 
165          selected. 'all' is a special case which means all severities
166          are selected. 'none' is a special case which means that
167          no selection should occur or disable this filter.";
168     }
169     leaf severity-operator {
170       when
171         "../severity != 'all' and
172                     ../severity != 'none'" {
173         description
174           "The severity-operator is not applicable for severity 'all' or 
175            severity 'none'";
176       }
177       if-feature "selector-sevop-config";
178       type enumeration {
179         enum "equals-or-higher" {
180           description
181             "This enum specifies all messages of the specified 
182              severity and higher are logged according to the 
183              given log-action";
184         }
185         enum "equals" {
186           description
187             "This enum specifies all messages that are for 
188              the specified severity are logged according to the 
189              given log-action";
190         }
191         enum "not-equals" {
192           description
193             "This enum specifies all messages that are not for 
194              the specified severity are logged according to the 
195              given log-action";
196         }
197       }
198       default "equals-or-higher";
199       description
200         "This leaf describes the option to specify how the 
201          severity comparison is performed.";
202     }
203   }
204
205   grouping syslog-selector {
206     description
207       "This grouping defines a Syslog selector which is used to 
208        select log messages for the log-action (buffer, file, 
209        etc). Choose one of the following:
210          no-log-facility
211          log-facility [<facility> <severity>...]";
212     container log-selector {
213       description
214         "This container describes the log selector parameters 
215          for Syslog.";
216       choice selector-facility {
217         mandatory true;
218         description
219           "This choice describes the option to specify no 
220            facilities, or a specific facility which can be
221            all for all facilities.";
222         case no-log-facility {
223           description
224             "This case specifies no facilities will match when 
225              comparing the Syslog message facility. This is a 
226              method that can be used to effectively disable a 
227              particular log-action (buffer, file, etc).";
228           leaf no-facilities {
229             type empty;
230             description
231               "This leaf specifies that no facilities are selected 
232                for this log-action.";
233           }
234         }
235         case log-facility {
236           description
237             "This case specifies one or more specified facilities 
238              will match when comparing the Syslog message facility.";
239           list log-facility {
240             key "facility";
241             description
242               "This list describes a collection of Syslog 
243                facilities and severities.";
244             leaf facility {
245               type union {
246                 type identityref {
247                   base syslog-facility;
248                 }
249                 type enumeration {
250                   enum "all" {
251                     description
252                       "This enum describes the case where all 
253                        facilities are requested.";
254                   }
255                 }
256               }
257               description
258                 "The leaf uniquely identifies a Syslog facility.";
259             }
260             uses syslog-severity;
261           }
262         }
263       }
264     }
265   }
266
267   container syslog {
268     description
269       "This container describes the configuration parameters for 
270        Syslog.";
271     leaf local-syslog-filename {
272       type string;
273       config false;
274       mandatory true;
275       description
276         "The syslog file name. It should be a fully qualified name 
277          so that the user can get the file using transfer RPC.";
278     }
279     container log-actions {
280       description
281         "This container describes the log-action parameters 
282          for Syslog.";
283       container remote {
284         description
285           "This container describes the configuration parameters for 
286            remote logging.";
287         list destination {
288           key "name";
289           description
290             "This list describes a collection of remote logging 
291              destinations.";
292           leaf name {
293             type string;
294             description
295               "An arbitrary name for the endpoint to connect to.";
296           }
297           choice transport {
298             mandatory true;
299             description
300               "This choice describes the transport option.";
301             case tcp {
302               container tcp {
303                 description
304                   "This container describes the TCP transport
305                    options.";
306                 reference "RFC 6587: Transmission of Syslog Messages over TCP";
307                 leaf address {
308                   type inet:host;
309                   description
310                     "The leaf uniquely specifies the address of 
311                      the remote host. One of the following must 
312                      be specified: an ipv4 address, an ipv6 
313                      address, or a host name.";
314                 }
315                 leaf port {
316                   type inet:port-number;
317                   default "514";
318                   description
319                     "This leaf specifies the port number used to 
320                      deliver messages to the remote server.";
321                 }
322               }
323             }
324             case udp {
325               container udp {
326                 description
327                   "This container describes the UDP transport
328                    options.";
329                 reference "RFC 5426: Transmission of Syslog Messages over UDP";
330                 leaf address {
331                   type inet:host;
332                   description
333                     "The leaf uniquely specifies the address of 
334                      the remote host. One of the following must be 
335                      specified: an ipv4 address, an ipv6 address, 
336                      or a host name.";
337                 }
338                 leaf port {
339                   type inet:port-number;
340                   default "514";
341                   description
342                     "This leaf specifies the port number used to 
343                      deliver messages to the remote server.";
344                 }
345               }
346             }
347           }
348           uses syslog-selector;
349         }
350       }
351     }
352   }
353 }