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