10e430837eb88f3834952cb6abe614f44ca7b2a3
[transportpce.git] / ordmodels / device / src / main / yang / org-openroadm-syslog@2019-11-29.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      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
58     "RFC 5424: The Syslog Protocol";
59
60   revision 2019-11-29 {
61     description
62       "Version 6.1.0";
63   }
64   revision 2018-11-30 {
65     description
66       "Version 4.1.0";
67   }
68   revision 2017-12-15 {
69     description
70       "Version 2.2";
71   }
72   revision 2017-09-29 {
73     description
74       "Version 2.1";
75   }
76   revision 2017-07-28 {
77     description
78       "Version 2.0.1 - added revision-date to imports";
79   }
80   revision 2016-10-14 {
81     description
82       "Version 1.2";
83   }
84
85   feature selector-sevop-config {
86     description
87       "This feature represents the ability to select messages
88        using the additional operators equal to, or not equal to
89        when comparing the Syslog message severity.";
90   }
91
92   feature selector-match-config {
93     description
94       "This feature represents the ability to select messages based
95        on a Posix 1003.2 regular expression pattern match.";
96   }
97
98   identity syslog-facility {
99     description
100       "The base identity to represent syslog facilities";
101   }
102
103   typedef severity {
104     type enumeration {
105       enum emergency {
106         value 0;
107         description
108           "Emergency Level Msg";
109       }
110       enum alert {
111         value 1;
112         description
113           "Alert Level Msg";
114       }
115       enum critical {
116         value 2;
117         description
118           "Critical Level Msg";
119       }
120       enum error {
121         value 3;
122         description
123           "Error Level Msg";
124       }
125       enum warning {
126         value 4;
127         description
128           "Warning Level Msg";
129       }
130       enum notice {
131         value 5;
132         description
133           "Notification Level Msg";
134       }
135       enum info {
136         value 6;
137         description
138           "Informational Level Msg";
139       }
140       enum debug {
141         value 7;
142         description
143           "Debugging Level Msg";
144       }
145       enum all {
146         value 8;
147         description
148           "This enum describes the case where all severities
149            are selected.";
150       }
151       enum none {
152         value 9;
153         description
154           "This enum describes the case where no severities
155            are selected.";
156       }
157     }
158     description
159       "The definitions for Syslog message severity as per RFC 5424.
160        Extended the RFC definition with enums for all and none";
161   }
162
163   grouping syslog-severity {
164     description
165       "This grouping defines the Syslog severity which is used to
166        select log messages.";
167     leaf severity {
168       type severity;
169       mandatory true;
170       description
171         "This leaf specifies the Syslog message severity. When
172          severity is specified, the default severity comparison
173          is all messages of the specified severity and greater are
174          selected. 'all' is a special case which means all severities
175          are selected. 'none' is a special case which means that
176          no selection should occur or disable this filter.";
177     }
178     leaf severity-operator {
179       when "../severity != 'all' and
180                        ../severity != 'none'" {
181           description
182             "The severity-operator is not applicable for severity 'all' or
183              severity 'none'";
184       }
185       if-feature "selector-sevop-config";
186       type enumeration {
187         enum equals-or-higher {
188           description
189             "This enum specifies all messages of the specified
190              severity and higher are logged according to the
191              given log-action";
192         }
193         enum equals {
194           description
195             "This enum specifies all messages that are for
196              the specified severity are logged according to the
197              given log-action";
198         }
199         enum not-equals {
200           description
201             "This enum specifies all messages that are not for
202              the specified severity are logged according to the
203              given log-action";
204         }
205       }
206       default "equals-or-higher";
207       description
208         "This leaf describes the option to specify how the
209          severity comparison is performed.";
210     }
211   }
212
213   grouping syslog-selector {
214     description
215       "This grouping defines a Syslog selector which is used to
216        select log messages for the log-action (buffer, file,
217        etc). Choose one of the following:
218          no-log-facility
219          log-facility [<facility> <severity>...]";
220     container log-selector {
221       description
222         "This container describes the log selector parameters
223          for Syslog.";
224       choice selector-facility {
225         mandatory true;
226         description
227           "This choice describes the option to specify no
228            facilities, or a specific facility which can be
229            all for all facilities.";
230         case no-log-facility {
231           description
232             "This case specifies no facilities will match when
233              comparing the Syslog message facility. This is a
234              method that can be used to effectively disable a
235              particular log-action (buffer, file, etc).";
236           leaf no-facilities {
237             type empty;
238             description
239               "This leaf specifies that no facilities are selected
240                for this log-action.";
241           }
242         }
243         case log-facility {
244           description
245             "This case specifies one or more specified facilities
246              will match when comparing the Syslog message facility.";
247           list log-facility {
248             key "facility";
249             description
250               "This list describes a collection of Syslog
251                facilities and severities.";
252             leaf facility {
253               type union {
254                 type identityref {
255                   base syslog-facility;
256                 }
257                 type enumeration {
258                   enum all {
259                     description
260                       "This enum describes the case where all
261                        facilities are requested.";
262                   }
263                 }
264               }
265               description
266                 "The leaf uniquely identifies a Syslog facility.";
267             }
268             uses syslog-severity;
269           }
270         }
271       }
272     }
273   }
274
275   container syslog {
276     description
277       "This container describes the configuration parameters for
278        Syslog.";
279     leaf local-syslog-filename {
280       type string;
281       config false;
282       mandatory true;
283       description
284         "The syslog file name. It should be a fully qualified name
285          so that the user can get the file using transfer RPC.";
286     }
287     container log-actions {
288       description
289         "This container describes the log-action parameters
290          for Syslog.";
291       container remote {
292         description
293           "This container describes the configuration parameters for
294            remote logging.";
295         list destination {
296           key "name";
297           description
298             "This list describes a collection of remote logging
299              destinations.";
300           leaf name {
301             type string;
302             description
303               "An arbitrary name for the endpoint to connect to.";
304           }
305           choice transport {
306             mandatory true;
307             description
308               "This choice describes the transport option.";
309             case tcp {
310               container tcp {
311                 description
312                   "This container describes the TCP transport
313                    options.";
314                 reference
315                   "RFC 6587: Transmission of Syslog Messages over TCP";
316                 leaf address {
317                   type inet:host;
318                   description
319                     "The leaf uniquely specifies the address of
320                      the remote host. One of the following must
321                      be specified: an ipv4 address, an ipv6
322                      address, or a host name.";
323                 }
324                 leaf port {
325                   type inet:port-number;
326                   default "514";
327                   description
328                     "This leaf specifies the port number used to
329                      deliver messages to the remote server.";
330                 }
331               }
332             }
333             case udp {
334               container udp {
335                 description
336                   "This container describes the UDP transport
337                    options.";
338                 reference
339                   "RFC 5426: Transmission of Syslog Messages over UDP";
340                 leaf address {
341                   type inet:host;
342                   description
343                     "The leaf uniquely specifies the address of
344                      the remote host. One of the following must be
345                      specified: an ipv4 address, an ipv6 address,
346                      or a host name.";
347                 }
348                 leaf port {
349                   type inet:port-number;
350                   default "514";
351                   description
352                     "This leaf specifies the port number used to
353                      deliver messages to the remote server.";
354                 }
355               }
356             }
357           }
358           uses syslog-selector;
359         }
360       }
361     }
362   }
363 }