Bump odlparent 2.0.4 to 2.0.5
[controller.git] / opendaylight / config / config-api / src / main / yang / config@2013-04-05.yang
1 // vi: set smarttab et sw=4 tabstop=4:
2 module config {
3     yang-version 1;
4     namespace "urn:opendaylight:params:xml:ns:yang:controller:config";
5     prefix "config";
6
7
8     description
9          "This module contains the base YANG definitions for NS-OS
10          configuration subsystem. The system modeled revolves around two
11          major concepts: modules and services.";
12
13     revision "2013-04-05" {
14         description
15             "Reworked to give modules their own space.";
16     }
17
18     revision "2013-04-03" {
19         description
20             "Initial revision.";
21     }
22
23     extension java-class {
24         description
25             "YANG language extension carrying the fully-qualified name of
26              a Java class. Code generation tools use the provided reference
27              to tie a specific construct to its Java representation.";
28
29         argument "name";
30     }
31
32     extension disable-osgi-service-registration {
33         description
34             "YANG language extension that can be associated with a Service identity that
35             disables advertising the service instances to the OSGi registry.";
36     }
37
38     extension required-identity {
39         description
40             "YANG language extension which indicates that a particular
41              leafref, which points to a identityref, should additionally
42              require the target node is actually set to a descendant to
43              of a particular identity.
44
45              This is a workaround to two YANG deficiencies:
46              1) not being able to leafref instances of identityref
47              2) not being able to refine an identityref
48
49              This extension takes one argument, name, which MUST be the name
50              of an identity. Furthermore, that identity MUST be based,
51              directly or indirectly, on the identity, which is referenced by
52              the leaf reference, which is annotated with this extension.";
53
54         argument "name";
55     }
56
57     extension inner-state-bean {
58         description
59             "YANG language extension which indicates that a particular
60              list located under module's state should be treated as a list
61              of child state beans instead of just an ordinary list attribute";
62     }
63
64     extension provided-service {
65         description
66             "YANG language extension which indicates that a particular
67             module provides certain service. This extension can be placed
68             on identities that are based on module-type. Zero or more services
69             can be provided.
70             This extension takes one argument - name - which MUST be the name
71             of an identity. Furthermore, this identity MUST be based on
72             service-type.";
73
74         argument "name";
75     }
76
77     extension java-name-prefix {
78         description
79             "YANG language extension carrying java simple class name prefix
80             that will be taken into account when generating java code from
81             identities that are based on module-type.";
82             argument "java-prefix";
83     }
84
85     identity module-type {
86         description
87             "Module identity base type. All module identities must be derived
88             from this type. A module type uniquely defines a single atomic
89             component, such as an application. Each such component is assumed
90             to have its unique, stable and versioned configuration structure.";
91     }
92
93     identity service-type {
94         description
95             "Service identity base type. All service identities must be
96              derived from this type. A service type uniquely defines a single
97              atomic API contract, such as a Java interface, a set of C
98              function declarations, or similar.
99
100              If the service type has a corresponding Java interface, the name
101              of that interface should be attached to the derived identity MUST
102              include a java-class keyword, whose name argument points to that
103              interface.";
104     }
105
106     typedef service-type-ref {
107         description
108             "Internal type of references to service type identity.";
109
110         type identityref {
111             base service-type;
112         }
113     }
114
115     grouping service-ref {
116         description
117             "Type of references to a particular service instance. This type
118              can be used when defining module configuration to refer to a
119              particular service instance. Containers using this grouping
120              should not define anything else. The run-time implementation
121              is expected to inject a reference to the service as the value
122              of the container.";
123
124         leaf type {
125             description
126                 "Type of the service being referenced. Users of this grouping
127                  should refine this leaf with required-identity pointing to
128                  the actual service-type which is actually required.";
129
130             mandatory true;
131             type leafref {
132                 path "/config:services/config:service/config:type";
133             }
134         }
135
136         leaf name {
137             mandatory true;
138             type leafref {
139                 path "/config:services/config:service[config:type=current()/../type]/config:instance/config:name";
140             }
141         }
142     }
143
144     container modules {
145         description
146             "Top level container encapsulating configuration of all modules.";
147
148         list module {
149             key "type name";
150             leaf name {
151                 description "Unique module instance name";
152                 type string;
153                 mandatory true;
154             }
155
156             leaf type {
157                 type identityref {
158                     base module-type;
159                 }
160                 mandatory true;
161             }
162
163             choice configuration {
164                 mandatory true;
165                 config true;
166             }
167
168             choice state {
169                 config false;
170             }
171         }
172     }
173
174
175     container services {
176         list service {
177             key "type";
178             leaf type {
179                 type service-type-ref;
180             }
181             list instance {
182                 key "name";
183                 leaf name {
184                     type string;
185                 }
186
187                 leaf provider {
188                     mandatory true;
189                     type leafref {
190                         path "/modules/module/name";
191                     }
192                 }
193             }
194         }
195     }
196
197
198 }