Merge "DOMDataTree APIs"
[controller.git] / opendaylight / netconf / ietf-netconf-monitoring / src / main / yang / ietf-netconf-monitoring.yang
1 module ietf-netconf-monitoring {
2
3     yang-version 1;
4
5     namespace
6       "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring";
7
8     prefix ncm;
9
10     import ietf-yang-types {
11       prefix yang;
12     }
13     import ietf-inet-types {
14       prefix inet;
15     }
16
17     organization
18       "IETF NETCONF (Network Configuration) Working Group";
19
20     contact
21       "WG Web:   <http://tools.ietf.org/wg/netconf/>
22      WG List:  <mailto:netconf@ietf.org>
23
24      WG Chair: Mehmet Ersue
25                <mailto:mehmet.ersue@nsn.com>
26
27      WG Chair: Bert Wijnen
28                <mailto:bertietf@bwijnen.net>
29
30      Editor:   Mark Scott
31                <mailto:mark.scott@ericsson.com>
32
33      Editor:   Martin Bjorklund
34                <mailto:mbj@tail-f.com>";
35
36     description
37       "NETCONF Monitoring Module.
38      All elements in this module are read-only.
39
40      Copyright (c) 2010 IETF Trust and the persons identified as
41      authors of the code. All rights reserved.
42
43      Redistribution and use in source and binary forms, with or
44      without modification, is permitted pursuant to, and subject
45      to the license terms contained in, the Simplified BSD
46      License set forth in Section 4.c of the IETF Trust's
47      Legal Provisions Relating to IETF Documents
48      (http://trustee.ietf.org/license-info).
49
50      This version of this YANG module is part of RFC 6022; see
51      the RFC itself for full legal notices.";
52
53     revision "2010-10-04" {
54       description "Initial revision.";
55       reference
56         "RFC 6022: YANG Module for NETCONF Monitoring";
57
58     }
59
60
61     typedef netconf-datastore-type {
62       type enumeration {
63         enum "running" {
64           value 0;
65         }
66         enum "candidate" {
67           value 1;
68         }
69         enum "startup" {
70           value 2;
71         }
72       }
73       description
74         "Enumeration of possible NETCONF datastore types.";
75       reference
76         "RFC 4741: NETCONF Configuration Protocol";
77
78     }
79
80     identity transport {
81       description
82         "Base identity for NETCONF transport types.";
83     }
84
85     identity netconf-ssh {
86       base transport;
87       description
88         "NETCONF over Secure Shell (SSH).";
89       reference
90         "RFC 4742: Using the NETCONF Configuration Protocol
91               over Secure SHell (SSH)";
92
93     }
94
95     identity netconf-soap-over-beep {
96       base transport;
97       description
98         "NETCONF over Simple Object Access Protocol (SOAP) over
99        Blocks Extensible Exchange Protocol (BEEP).";
100       reference
101         "RFC 4743: Using NETCONF over the Simple Object
102               Access Protocol (SOAP)";
103
104     }
105
106     identity netconf-soap-over-https {
107       base transport;
108       description
109         "NETCONF over Simple Object Access Protocol (SOAP)
110       over Hypertext Transfer Protocol Secure (HTTPS).";
111       reference
112         "RFC 4743: Using NETCONF over the Simple Object
113               Access Protocol (SOAP)";
114
115     }
116
117     identity netconf-beep {
118       base transport;
119       description
120         "NETCONF over Blocks Extensible Exchange Protocol (BEEP).";
121       reference
122         "RFC 4744: Using the NETCONF Protocol over the
123               Blocks Extensible Exchange Protocol (BEEP)";
124
125     }
126
127     identity netconf-tls {
128       base transport;
129       description
130         "NETCONF over Transport Layer Security (TLS).";
131       reference
132         "RFC 5539: NETCONF over Transport Layer Security (TLS)";
133
134     }
135
136     identity schema-format {
137       description
138         "Base identity for data model schema languages.";
139     }
140
141     identity xsd {
142       base schema-format;
143       description
144         "W3C XML Schema Definition.";
145       reference
146         "W3C REC REC-xmlschema-1-20041028:
147           XML Schema Part 1: Structures";
148
149     }
150
151     identity yang {
152       base schema-format;
153       description
154         "The YANG data modeling language for NETCONF.";
155       reference
156         "RFC 6020:  YANG - A Data Modeling Language for the
157                Network Configuration Protocol (NETCONF)";
158
159     }
160
161     identity yin {
162       base schema-format;
163       description "The YIN syntax for YANG.";
164       reference
165         "RFC 6020:  YANG - A Data Modeling Language for the
166                Network Configuration Protocol (NETCONF)";
167
168     }
169
170     identity rng {
171       base schema-format;
172       description
173         "Regular Language for XML Next Generation (RELAX NG).";
174       reference
175         "ISO/IEC 19757-2:2008: RELAX NG";
176
177     }
178
179     identity rnc {
180       base schema-format;
181       description "Relax NG Compact Syntax";
182       reference
183         "ISO/IEC 19757-2:2008: RELAX NG";
184
185     }
186
187     grouping common-counters {
188       description
189         "Counters that exist both per session, and also globally,
190        accumulated from all sessions.";
191       leaf in-rpcs {
192         type yang:zero-based-counter32;
193         description
194           "Number of correct <rpc> messages received.";
195       }
196
197       leaf in-bad-rpcs {
198         type yang:zero-based-counter32;
199         description
200           "Number of messages received when an <rpc> message was expected,
201          that were not correct <rpc> messages.  This includes XML parse
202          errors and errors on the rpc layer.";
203       }
204
205       leaf out-rpc-errors {
206         type yang:zero-based-counter32;
207         description
208           "Number of <rpc-reply> messages sent that contained an
209          <rpc-error> element.";
210       }
211
212       leaf out-notifications {
213         type yang:zero-based-counter32;
214         description
215           "Number of <notification> messages sent.";
216       }
217     }  // grouping common-counters
218
219     container netconf-state {
220       config false;
221       description
222         "The netconf-state container is the root of the monitoring
223        data model.";
224       container capabilities {
225         description
226           "Contains the list of NETCONF capabilities supported by the
227          server.";
228         leaf-list capability {
229           type inet:uri;
230           description
231             "List of NETCONF capabilities supported by the server.";
232         }
233       }  // container capabilities
234
235       container datastores {
236         description
237           "Contains the list of NETCONF configuration datastores.";
238         list datastore {
239           key "name";
240           description
241             "List of NETCONF configuration datastores supported by
242            the NETCONF server and related information.";
243           leaf name {
244             type netconf-datastore-type;
245             description
246               "Name of the datastore associated with this list entry.";
247           }
248
249           container locks {
250             presence
251               "This container is present only if the datastore
252              is locked.";
253             description
254               "The NETCONF <lock> and <partial-lock> operations allow
255              a client to lock specific resources in a datastore.  The
256              NETCONF server will prevent changes to the locked
257              resources by all sessions except the one that acquired
258              the lock(s).
259
260              Monitoring information is provided for each datastore
261              entry including details such as the session that acquired
262              the lock, the type of lock (global or partial) and the
263              list of locked resources.  Multiple locks per datastore
264              are supported.";
265             grouping lock-info {
266               description
267                 "Lock related parameters, common to both global and
268                partial locks.";
269               leaf locked-by-session {
270                 type uint32;
271                 mandatory true;
272                 description
273                   "The session ID of the session that has locked
274                  this resource.  Both a global lock and a partial
275                  lock MUST contain the NETCONF session-id.
276
277                  If the lock is held by a session that is not managed
278                  by the NETCONF server (e.g., a CLI session), a session
279                  id of 0 (zero) is reported.";
280                 reference
281                   "RFC 4741: NETCONF Configuration Protocol";
282
283               }
284
285               leaf locked-time {
286                 type yang:date-and-time;
287                 mandatory true;
288                 description
289                   "The date and time of when the resource was
290                  locked.";
291               }
292             }  // grouping lock-info
293             choice lock-type {
294               description
295                 "Indicates if a global lock or a set of partial locks
296                are set.";
297               container global-lock {
298                 description
299                   "Present if the global lock is set.";
300                 uses lock-info;
301               }  // container global-lock
302               list partial-lock {
303                 key "lock-id";
304                 description
305                   "List of partial locks.";
306                 reference
307                   "RFC 5717: Partial Lock Remote Procedure Call (RPC) for
308                       NETCONF";
309
310                 leaf lock-id {
311                   type uint32;
312                   description
313                     "This is the lock id returned in the <partial-lock>
314                    response.";
315                 }
316
317                 uses lock-info;
318
319                 leaf-list select {
320                   type yang:xpath1.0;
321                   min-elements 1;
322                   description
323                     "The xpath expression that was used to request
324                    the lock.  The select expression indicates the
325                    original intended scope of the lock.";
326                 }
327
328                 leaf-list locked-node {
329                   type instance-identifier;
330                   description
331                     "The list of instance-identifiers (i.e., the
332                    locked nodes).
333
334                    The scope of the partial lock is defined by the list
335                    of locked nodes.";
336                 }
337               }  // list partial-lock
338             }  // choice lock-type
339           }  // container locks
340         }  // list datastore
341       }  // container datastores
342
343       container schemas {
344         description
345           "Contains the list of data model schemas supported by the
346          server.";
347         list schema {
348           key "identifier version format";
349           description
350             "List of data model schemas supported by the server.";
351           leaf identifier {
352             type string;
353             description
354               "Identifier to uniquely reference the schema.  The
355              identifier is used in the <get-schema> operation and may
356              be used for other purposes such as file retrieval.
357
358              For modeling languages that support or require a data
359              model name (e.g., YANG module name) the identifier MUST
360              match that name.  For YANG data models, the identifier is
361              the name of the module or submodule.  In other cases, an
362              identifier such as a filename MAY be used instead.";
363           }
364
365           leaf version {
366             type string;
367             description
368               "Version of the schema supported.  Multiple versions MAY be
369              supported simultaneously by a NETCONF server.  Each
370              version MUST be reported individually in the schema list,
371              i.e., with same identifier, possibly different location,
372              but different version.
373
374              For YANG data models, version is the value of the most
375              recent YANG 'revision' statement in the module or
376              submodule, or the empty string if no 'revision' statement
377              is present.";
378           }
379
380           leaf format {
381             type identityref {
382               base schema-format;
383             }
384             description
385               "The data modeling language the schema is written
386              in (currently xsd, yang, yin, rng, or rnc).
387              For YANG data models, 'yang' format MUST be supported and
388              'yin' format MAY also be provided.";
389           }
390
391           leaf namespace {
392             type inet:uri;
393             mandatory true;
394             description
395               "The XML namespace defined by the data model.
396
397              For YANG data models, this is the module's namespace.
398              If the list entry describes a submodule, this field
399              contains the namespace of the module to which the
400              submodule belongs.";
401           }
402
403           leaf-list location {
404             type union {
405               type enumeration {
406                 enum "NETCONF" {
407                   value 0;
408                 }
409               }
410               type inet:uri;
411             }
412             description
413               "One or more locations from which the schema can be
414              retrieved.  This list SHOULD contain at least one
415              entry per schema.
416
417              A schema entry may be located on a remote file system
418              (e.g., reference to file system for ftp retrieval) or
419              retrieved directly from a server supporting the
420              <get-schema> operation (denoted by the value 'NETCONF').";
421           }
422         }  // list schema
423       }  // container schemas
424
425       container sessions {
426         description
427           "The sessions container includes session-specific data for
428          NETCONF management sessions.  The session list MUST include
429          all currently active NETCONF sessions.";
430         list session {
431           key "session-id";
432           description
433             "All NETCONF sessions managed by the NETCONF server
434            MUST be reported in this list.";
435           leaf session-id {
436             type uint32 {
437               range "1..max";
438             }
439             description
440               "Unique identifier for the session.  This value is the
441              NETCONF session identifier, as defined in RFC 4741.";
442             reference
443               "RFC 4741: NETCONF Configuration Protocol";
444
445           }
446
447           leaf transport {
448             type identityref {
449               base transport;
450             }
451             mandatory true;
452             description
453               "Identifies the transport for each session, e.g.,
454             'netconf-ssh', 'netconf-soap', etc.";
455           }
456
457           leaf username {
458             type string;
459             mandatory true;
460             description
461               "The username is the client identity that was authenticated
462             by the NETCONF transport protocol.  The algorithm used to
463             derive the username is NETCONF transport protocol specific
464             and in addition specific to the authentication mechanism
465             used by the NETCONF transport protocol.";
466           }
467
468           leaf source-host {
469             type inet:host;
470             description
471               "Host identifier of the NETCONF client.  The value
472              returned is implementation specific (e.g., hostname,
473              IPv4 address, IPv6 address)";
474           }
475
476           leaf login-time {
477             type yang:date-and-time;
478             mandatory true;
479             description
480               "Time at the server at which the session was established.";
481           }
482
483           uses common-counters {
484             description
485               "Per-session counters.  Zero based with following reset
486              behaviour:
487                - at start of a session
488                - when max value is reached";
489           }
490         }  // list session
491       }  // container sessions
492
493       container statistics {
494         description
495           "Statistical data pertaining to the NETCONF server.";
496         leaf netconf-start-time {
497           type yang:date-and-time;
498           description
499             "Date and time at which the management subsystem was
500            started.";
501         }
502
503         leaf in-bad-hellos {
504           type yang:zero-based-counter32;
505           description
506             "Number of sessions silently dropped because an
507           invalid <hello> message was received.  This includes <hello>
508           messages with a 'session-id' attribute, bad namespace, and
509           bad capability declarations.";
510         }
511
512         leaf in-sessions {
513           type yang:zero-based-counter32;
514           description
515             "Number of sessions started.  This counter is incremented
516            when a <hello> message with a <session-id> is sent.
517
518           'in-sessions' - 'in-bad-hellos' =
519               'number of correctly started netconf sessions'";
520         }
521
522         leaf dropped-sessions {
523           type yang:zero-based-counter32;
524           description
525             "Number of sessions that were abnormally terminated, e.g.,
526            due to idle timeout or transport close.  This counter is not
527            incremented when a session is properly closed by a
528            <close-session> operation, or killed by a <kill-session>
529            operation.";
530         }
531
532         uses common-counters {
533           description
534             "Global counters, accumulated from all sessions.
535            Zero based with following reset behaviour:
536              - re-initialization of NETCONF server
537              - when max value is reached";
538         }
539       }  // container statistics
540     }  // container netconf-state
541
542     rpc get-schema {
543       description
544         "This operation is used to retrieve a schema from the
545        NETCONF server.
546
547        Positive Response:
548          The NETCONF server returns the requested schema.
549
550        Negative Response:
551          If requested schema does not exist, the <error-tag> is
552          'invalid-value'.
553
554          If more than one schema matches the requested parameters, the
555          <error-tag> is 'operation-failed', and <error-app-tag> is
556          'data-not-unique'.";
557       input {
558         leaf identifier {
559           type string;
560           mandatory true;
561           description
562             "Identifier for the schema list entry.";
563         }
564
565         leaf version {
566           type string;
567           description
568             "Version of the schema requested.  If this parameter is not
569            present, and more than one version of the schema exists on
570            the server, a 'data-not-unique' error is returned, as
571            described above.";
572         }
573
574         leaf format {
575           type identityref {
576             base schema-format;
577           }
578           description
579             "The data modeling language of the schema.  If this
580             parameter is not present, and more than one formats of
581             the schema exists on the server, a 'data-not-unique' error
582             is returned, as described above.";
583         }
584       }
585
586       output {
587         anyxml data {
588           description
589             "Contains the schema content.";
590         }
591       }
592     }  // rpc get-schema
593 } // module