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