add python compatibility module
[ccsdk/apps.git] / sdnr / model / yang / ietf-netconf@2011-06-01.yang
1 module ietf-netconf {
2
3   // the namespace for NETCONF XML definitions is unchanged
4   // from RFC 4741, which this document replaces
5   namespace "urn:ietf:params:xml:ns:netconf:base:1.0";
6
7   prefix nc;
8
9   import ietf-inet-types {
10     prefix inet;
11   }
12
13   import ietf-netconf-acm { prefix nacm; }
14
15   organization
16     "IETF NETCONF (Network Configuration) Working Group";
17
18   contact
19     "WG Web:   <http://tools.ietf.org/wg/netconf/>
20      WG List:  <netconf@ietf.org>
21
22      WG Chair: Bert Wijnen
23                <bertietf@bwijnen.net>
24
25      WG Chair: Mehmet Ersue
26                <mehmet.ersue@nsn.com>
27
28      Editor:   Martin Bjorklund
29                <mbj@tail-f.com>
30
31      Editor:   Juergen Schoenwaelder
32                <j.schoenwaelder@jacobs-university.de>
33
34      Editor:   Andy Bierman
35                <andy.bierman@brocade.com>";
36   description
37     "NETCONF Protocol Data Types and Protocol Operations.
38
39      Copyright (c) 2011 IETF Trust and the persons identified as
40      the document authors.  All rights reserved.
41
42      Redistribution and use in source and binary forms, with or
43      without modification, is permitted pursuant to, and subject
44      to the license terms contained in, the Simplified BSD License
45      set forth in Section 4.c of the IETF Trust's Legal Provisions
46      Relating to IETF Documents
47      (http://trustee.ietf.org/license-info).
48
49      This version of this YANG module is part of RFC 6241; see
50      the RFC itself for full legal notices.";
51
52   revision 2011-06-01 {
53     description
54       "Initial revision;
55        2013-09-29: Updated to include NACM attributes, 
56        as specified in RFC 6536: sec 3.2.5 and 3.2.8";
57     reference
58       "RFC 6241: Network Configuration Protocol";
59   }
60
61   extension get-filter-element-attributes {
62     description
63       "If this extension is present within an 'anyxml'
64        statement named 'filter', which must be conceptually
65        defined within the RPC input section for the <get>
66        and <get-config> protocol operations, then the
67        following unqualified XML attribute is supported
68        within the <filter> element, within a <get> or
69        <get-config> protocol operation:
70
71          type : optional attribute with allowed
72                 value strings 'subtree' and 'xpath'.
73                 If missing, the default value is 'subtree'.
74
75        If the 'xpath' feature is supported, then the
76        following unqualified XML attribute is
77        also supported:
78
79          select: optional attribute containing a
80                  string representing an XPath expression.
81                  The 'type' attribute must be equal to 'xpath'
82                  if this attribute is present.";
83   }
84
85   // NETCONF capabilities defined as features
86   feature writable-running {
87     description
88       "NETCONF :writable-running capability;
89        If the server advertises the :writable-running
90        capability for a session, then this feature must
91        also be enabled for that session.  Otherwise,
92        this feature must not be enabled.";
93     reference "RFC 6241, Section 8.2";
94   }
95
96   feature candidate {
97     description
98       "NETCONF :candidate capability;
99        If the server advertises the :candidate
100        capability for a session, then this feature must
101        also be enabled for that session.  Otherwise,
102        this feature must not be enabled.";
103     reference "RFC 6241, Section 8.3";
104   }
105
106   feature confirmed-commit {
107     if-feature candidate;
108     description
109       "NETCONF :confirmed-commit:1.1 capability;
110        If the server advertises the :confirmed-commit:1.1
111        capability for a session, then this feature must
112        also be enabled for that session.  Otherwise,
113        this feature must not be enabled.";
114
115     reference "RFC 6241, Section 8.4";
116   }
117
118   feature rollback-on-error {
119     description
120       "NETCONF :rollback-on-error capability;
121        If the server advertises the :rollback-on-error
122        capability for a session, then this feature must
123        also be enabled for that session.  Otherwise,
124        this feature must not be enabled.";
125     reference "RFC 6241, Section 8.5";
126   }
127
128   feature validate {
129     description
130       "NETCONF :validate:1.1 capability;
131        If the server advertises the :validate:1.1
132        capability for a session, then this feature must
133        also be enabled for that session.  Otherwise,
134        this feature must not be enabled.";
135     reference "RFC 6241, Section 8.6";
136   }
137
138   feature startup {
139     description
140       "NETCONF :startup capability;
141        If the server advertises the :startup
142        capability for a session, then this feature must
143        also be enabled for that session.  Otherwise,
144        this feature must not be enabled.";
145     reference "RFC 6241, Section 8.7";
146   }
147
148   feature url {
149     description
150       "NETCONF :url capability;
151        If the server advertises the :url
152        capability for a session, then this feature must
153        also be enabled for that session.  Otherwise,
154        this feature must not be enabled.";
155     reference "RFC 6241, Section 8.8";
156   }
157
158   feature xpath {
159     description
160       "NETCONF :xpath capability;
161        If the server advertises the :xpath
162        capability for a session, then this feature must
163        also be enabled for that session.  Otherwise,
164        this feature must not be enabled.";
165     reference "RFC 6241, Section 8.9";
166   }
167
168   // NETCONF Simple Types
169
170   typedef session-id-type {
171     type uint32 {
172       range "1..max";
173     }
174     description
175       "NETCONF Session Id";
176   }
177
178   typedef session-id-or-zero-type {
179     type uint32;
180     description
181       "NETCONF Session Id or Zero to indicate none";
182   }
183   typedef error-tag-type {
184     type enumeration {
185        enum in-use {
186          description
187            "The request requires a resource that
188             already is in use.";
189        }
190        enum invalid-value {
191          description
192            "The request specifies an unacceptable value for one
193             or more parameters.";
194        }
195        enum too-big {
196          description
197            "The request or response (that would be generated) is
198             too large for the implementation to handle.";
199        }
200        enum missing-attribute {
201          description
202            "An expected attribute is missing.";
203        }
204        enum bad-attribute {
205          description
206            "An attribute value is not correct; e.g., wrong type,
207             out of range, pattern mismatch.";
208        }
209        enum unknown-attribute {
210          description
211            "An unexpected attribute is present.";
212        }
213        enum missing-element {
214          description
215            "An expected element is missing.";
216        }
217        enum bad-element {
218          description
219            "An element value is not correct; e.g., wrong type,
220             out of range, pattern mismatch.";
221        }
222        enum unknown-element {
223          description
224            "An unexpected element is present.";
225        }
226        enum unknown-namespace {
227          description
228            "An unexpected namespace is present.";
229        }
230        enum access-denied {
231          description
232            "Access to the requested protocol operation or
233             data model is denied because authorization failed.";
234        }
235        enum lock-denied {
236          description
237            "Access to the requested lock is denied because the
238             lock is currently held by another entity.";
239        }
240        enum resource-denied {
241          description
242            "Request could not be completed because of
243             insufficient resources.";
244        }
245        enum rollback-failed {
246          description
247            "Request to roll back some configuration change (via
248             rollback-on-error or <discard-changes> operations)
249             was not completed for some reason.";
250
251        }
252        enum data-exists {
253          description
254            "Request could not be completed because the relevant
255             data model content already exists.  For example,
256             a 'create' operation was attempted on data that
257             already exists.";
258        }
259        enum data-missing {
260          description
261            "Request could not be completed because the relevant
262             data model content does not exist.  For example,
263             a 'delete' operation was attempted on
264             data that does not exist.";
265        }
266        enum operation-not-supported {
267          description
268            "Request could not be completed because the requested
269             operation is not supported by this implementation.";
270        }
271        enum operation-failed {
272          description
273            "Request could not be completed because the requested
274             operation failed for some reason not covered by
275             any other error condition.";
276        }
277        enum partial-operation {
278          description
279            "This error-tag is obsolete, and SHOULD NOT be sent
280             by servers conforming to this document.";
281        }
282        enum malformed-message {
283          description
284            "A message could not be handled because it failed to
285             be parsed correctly.  For example, the message is not
286             well-formed XML or it uses an invalid character set.";
287        }
288      }
289      description "NETCONF Error Tag";
290      reference "RFC 6241, Appendix A";
291   }
292
293   typedef error-severity-type {
294     type enumeration {
295       enum error {
296         description "Error severity";
297       }
298       enum warning {
299         description "Warning severity";
300       }
301     }
302     description "NETCONF Error Severity";
303     reference "RFC 6241, Section 4.3";
304   }
305
306   typedef edit-operation-type {
307     type enumeration {
308       enum merge {
309         description
310           "The configuration data identified by the
311            element containing this attribute is merged
312            with the configuration at the corresponding
313            level in the configuration datastore identified
314            by the target parameter.";
315       }
316       enum replace {
317         description
318           "The configuration data identified by the element
319            containing this attribute replaces any related
320            configuration in the configuration datastore
321            identified by the target parameter.  If no such
322            configuration data exists in the configuration
323            datastore, it is created.  Unlike a
324            <copy-config> operation, which replaces the
325            entire target configuration, only the configuration
326            actually present in the config parameter is affected.";
327       }
328       enum create {
329         description
330           "The configuration data identified by the element
331            containing this attribute is added to the
332            configuration if and only if the configuration
333            data does not already exist in the configuration
334            datastore.  If the configuration data exists, an
335            <rpc-error> element is returned with an
336            <error-tag> value of 'data-exists'.";
337       }
338       enum delete {
339         description
340           "The configuration data identified by the element
341            containing this attribute is deleted from the
342            configuration if and only if the configuration
343            data currently exists in the configuration
344            datastore.  If the configuration data does not
345            exist, an <rpc-error> element is returned with
346            an <error-tag> value of 'data-missing'.";
347       }
348       enum remove {
349         description
350           "The configuration data identified by the element
351            containing this attribute is deleted from the
352            configuration if the configuration
353            data currently exists in the configuration
354            datastore.  If the configuration data does not
355            exist, the 'remove' operation is silently ignored
356            by the server.";
357       }
358     }
359     default "merge";
360     description "NETCONF 'operation' attribute values";
361     reference "RFC 6241, Section 7.2";
362   }
363
364   // NETCONF Standard Protocol Operations
365
366   rpc get-config {
367     description
368       "Retrieve all or part of a specified configuration.";
369
370     reference "RFC 6241, Section 7.1";
371
372     input {
373       container source {
374         description
375           "Particular configuration to retrieve.";
376
377         choice config-source {
378           mandatory true;
379           description
380             "The configuration to retrieve.";
381           leaf candidate {
382             if-feature candidate;
383             type empty;
384             description
385               "The candidate configuration is the config source.";
386           }
387           leaf running {
388             type empty;
389             description
390               "The running configuration is the config source.";
391           }
392           leaf startup {
393             if-feature startup;
394             type empty;
395             description
396               "The startup configuration is the config source.
397                This is optional-to-implement on the server because
398                not all servers will support filtering for this
399                datastore.";
400           }
401         }
402       }
403
404       anyxml filter {
405         description
406           "Subtree or XPath filter to use.";
407         nc:get-filter-element-attributes;
408       }
409     }
410
411     output {
412       anyxml data {
413         description
414           "Copy of the source datastore subset that matched
415            the filter criteria (if any).  An empty data container
416            indicates that the request did not produce any results.";
417       }
418     }
419   }
420
421   rpc edit-config {
422     description
423       "The <edit-config> operation loads all or part of a specified
424        configuration to the specified target configuration.";
425
426     reference "RFC 6241, Section 7.2";
427
428     input {
429       container target {
430         description
431           "Particular configuration to edit.";
432
433         choice config-target {
434           mandatory true;
435           description
436             "The configuration target.";
437
438           leaf candidate {
439             if-feature candidate;
440             type empty;
441             description
442               "The candidate configuration is the config target.";
443           }
444           leaf running {
445             if-feature writable-running;
446             type empty;
447             description
448               "The running configuration is the config source.";
449           }
450         }
451       }
452
453       leaf default-operation {
454         type enumeration {
455           enum merge {
456             description
457               "The default operation is merge.";
458           }
459           enum replace {
460             description
461               "The default operation is replace.";
462           }
463           enum none {
464             description
465               "There is no default operation.";
466           }
467         }
468         default "merge";
469         description
470           "The default operation to use.";
471       }
472
473       leaf test-option {
474         if-feature validate;
475         type enumeration {
476           enum test-then-set {
477             description
478               "The server will test and then set if no errors.";
479           }
480           enum set {
481             description
482               "The server will set without a test first.";
483           }
484
485           enum test-only {
486             description
487               "The server will only test and not set, even
488                if there are no errors.";
489           }
490         }
491         default "test-then-set";
492         description
493           "The test option to use.";
494       }
495
496       leaf error-option {
497         type enumeration {
498           enum stop-on-error {
499             description
500               "The server will stop on errors.";
501           }
502           enum continue-on-error {
503             description
504               "The server may continue on errors.";
505           }
506           enum rollback-on-error {
507             description
508               "The server will roll back on errors.
509                This value can only be used if the 'rollback-on-error'
510                feature is supported.";
511           }
512         }
513         default "stop-on-error";
514         description
515           "The error option to use.";
516       }
517
518       choice edit-content {
519         mandatory true;
520         description
521           "The content for the edit operation.";
522
523         anyxml config {
524           description
525             "Inline Config content.";
526         }
527         leaf url {
528           if-feature url;
529           type inet:uri;
530           description
531             "URL-based config content.";
532         }
533       }
534     }
535   }
536
537   rpc copy-config {
538     description
539       "Create or replace an entire configuration datastore with the
540        contents of another complete configuration datastore.";
541
542     reference "RFC 6241, Section 7.3";
543
544     input {
545       container target {
546         description
547           "Particular configuration to copy to.";
548
549         choice config-target {
550           mandatory true;
551           description
552             "The configuration target of the copy operation.";
553
554           leaf candidate {
555             if-feature candidate;
556             type empty;
557             description
558               "The candidate configuration is the config target.";
559           }
560           leaf running {
561             if-feature writable-running;
562             type empty;
563             description
564               "The running configuration is the config target.
565                This is optional-to-implement on the server.";
566           }
567           leaf startup {
568             if-feature startup;
569             type empty;
570             description
571               "The startup configuration is the config target.";
572           }
573           leaf url {
574             if-feature url;
575             type inet:uri;
576             description
577               "The URL-based configuration is the config target.";
578           }
579         }
580       }
581
582       container source {
583         description
584           "Particular configuration to copy from.";
585
586         choice config-source {
587           mandatory true;
588           description
589             "The configuration source for the copy operation.";
590
591           leaf candidate {
592             if-feature candidate;
593             type empty;
594             description
595               "The candidate configuration is the config source.";
596           }
597           leaf running {
598             type empty;
599             description
600               "The running configuration is the config source.";
601           }
602           leaf startup {
603             if-feature startup;
604             type empty;
605             description
606               "The startup configuration is the config source.";
607           }
608           leaf url {
609             if-feature url;
610             type inet:uri;
611             description
612               "The URL-based configuration is the config source.";
613           }
614           anyxml config {
615             description
616               "Inline Config content: <config> element.  Represents
617                an entire configuration datastore, not
618                a subset of the running datastore.";
619           }
620         }
621       }
622     }
623   }
624
625   rpc delete-config {
626     nacm:default-deny-all;
627     description
628       "Delete a configuration datastore.";
629
630     reference "RFC 6241, Section 7.4";
631
632     input {
633       container target {
634         description
635           "Particular configuration to delete.";
636
637         choice config-target {
638           mandatory true;
639           description
640             "The configuration target to delete.";
641
642           leaf startup {
643             if-feature startup;
644             type empty;
645             description
646               "The startup configuration is the config target.";
647           }
648           leaf url {
649             if-feature url;
650             type inet:uri;
651             description
652               "The URL-based configuration is the config target.";
653           }
654         }
655       }
656     }
657   }
658
659   rpc lock {
660     description
661       "The lock operation allows the client to lock the configuration
662        system of a device.";
663
664     reference "RFC 6241, Section 7.5";
665
666     input {
667       container target {
668         description
669           "Particular configuration to lock.";
670
671         choice config-target {
672           mandatory true;
673           description
674             "The configuration target to lock.";
675
676           leaf candidate {
677             if-feature candidate;
678             type empty;
679             description
680               "The candidate configuration is the config target.";
681           }
682           leaf running {
683             type empty;
684             description
685               "The running configuration is the config target.";
686           }
687           leaf startup {
688             if-feature startup;
689             type empty;
690             description
691               "The startup configuration is the config target.";
692           }
693         }
694       }
695     }
696   }
697
698   rpc unlock {
699     description
700       "The unlock operation is used to release a configuration lock,
701        previously obtained with the 'lock' operation.";
702
703     reference "RFC 6241, Section 7.6";
704
705     input {
706       container target {
707         description
708           "Particular configuration to unlock.";
709
710         choice config-target {
711           mandatory true;
712           description
713             "The configuration target to unlock.";
714
715           leaf candidate {
716             if-feature candidate;
717             type empty;
718             description
719               "The candidate configuration is the config target.";
720           }
721           leaf running {
722             type empty;
723             description
724               "The running configuration is the config target.";
725           }
726           leaf startup {
727             if-feature startup;
728             type empty;
729             description
730               "The startup configuration is the config target.";
731           }
732         }
733       }
734     }
735   }
736
737   rpc get {
738     description
739       "Retrieve running configuration and device state information.";
740
741     reference "RFC 6241, Section 7.7";
742
743     input {
744       anyxml filter {
745         description
746           "This parameter specifies the portion of the system
747            configuration and state data to retrieve.";
748         nc:get-filter-element-attributes;
749       }
750     }
751
752     output {
753       anyxml data {
754         description
755           "Copy of the running datastore subset and/or state
756            data that matched the filter criteria (if any).
757            An empty data container indicates that the request did not
758            produce any results.";
759       }
760     }
761   }
762
763   rpc close-session {
764     description
765       "Request graceful termination of a NETCONF session.";
766
767     reference "RFC 6241, Section 7.8";
768   }
769
770   rpc kill-session {
771     nacm:default-deny-all;
772     description
773       "Force the termination of a NETCONF session.";
774
775     reference "RFC 6241, Section 7.9";
776
777     input {
778       leaf session-id {
779         type session-id-type;
780         mandatory true;
781         description
782           "Particular session to kill.";
783       }
784     }
785   }
786
787   rpc commit {
788     if-feature candidate;
789
790     description
791       "Commit the candidate configuration as the device's new
792        current configuration.";
793
794     reference "RFC 6241, Section 8.3.4.1";
795
796     input {
797       leaf confirmed {
798         if-feature confirmed-commit;
799         type empty;
800         description
801           "Requests a confirmed commit.";
802         reference "RFC 6241, Section 8.3.4.1";
803       }
804
805       leaf confirm-timeout {
806         if-feature confirmed-commit;
807         type uint32 {
808           range "1..max";
809         }
810         units "seconds";
811         default "600";   // 10 minutes
812         description
813           "The timeout interval for a confirmed commit.";
814         reference "RFC 6241, Section 8.3.4.1";
815       }
816
817       leaf persist {
818         if-feature confirmed-commit;
819         type string;
820         description
821           "This parameter is used to make a confirmed commit
822            persistent.  A persistent confirmed commit is not aborted
823            if the NETCONF session terminates.  The only way to abort
824            a persistent confirmed commit is to let the timer expire,
825            or to use the <cancel-commit> operation.
826
827            The value of this parameter is a token that must be given
828            in the 'persist-id' parameter of <commit> or
829            <cancel-commit> operations in order to confirm or cancel
830            the persistent confirmed commit.
831
832            The token should be a random string.";
833         reference "RFC 6241, Section 8.3.4.1";
834       }
835
836       leaf persist-id {
837         if-feature confirmed-commit;
838         type string;
839         description
840           "This parameter is given in order to commit a persistent
841            confirmed commit.  The value must be equal to the value
842            given in the 'persist' parameter to the <commit> operation.
843            If it does not match, the operation fails with an
844           'invalid-value' error.";
845         reference "RFC 6241, Section 8.3.4.1";
846       }
847
848     }
849   }
850
851   rpc discard-changes {
852     if-feature candidate;
853
854     description
855       "Revert the candidate configuration to the current
856        running configuration.";
857     reference "RFC 6241, Section 8.3.4.2";
858   }
859
860   rpc cancel-commit {
861     if-feature confirmed-commit;
862     description
863       "This operation is used to cancel an ongoing confirmed commit.
864        If the confirmed commit is persistent, the parameter
865        'persist-id' must be given, and it must match the value of the
866        'persist' parameter.";
867     reference "RFC 6241, Section 8.4.4.1";
868
869     input {
870       leaf persist-id {
871         type string;
872         description
873           "This parameter is given in order to cancel a persistent
874            confirmed commit.  The value must be equal to the value
875            given in the 'persist' parameter to the <commit> operation.
876            If it does not match, the operation fails with an
877           'invalid-value' error.";
878       }
879     }
880   }
881
882   rpc validate {
883     if-feature validate;
884
885     description
886       "Validates the contents of the specified configuration.";
887
888     reference "RFC 6241, Section 8.6.4.1";
889
890     input {
891       container source {
892         description
893           "Particular configuration to validate.";
894
895         choice config-source {
896           mandatory true;
897           description
898             "The configuration source to validate.";
899
900           leaf candidate {
901             if-feature candidate;
902             type empty;
903             description
904               "The candidate configuration is the config source.";
905           }
906           leaf running {
907             type empty;
908             description
909               "The running configuration is the config source.";
910           }
911           leaf startup {
912             if-feature startup;
913             type empty;
914             description
915               "The startup configuration is the config source.";
916           }
917           leaf url {
918             if-feature url;
919             type inet:uri;
920             description
921               "The URL-based configuration is the config source.";
922           }
923           anyxml config {
924             description
925               "Inline Config content: <config> element.  Represents
926                an entire configuration datastore, not
927                a subset of the running datastore.";
928           }
929         }
930       }
931     }
932   }
933
934 }