Merge "Fixed for bug : 1171 - issue while creating subnet"
[controller.git] / opendaylight / md-sal / model / model-inventory / src / main / yang / opendaylight-inventory.yang
1 module opendaylight-inventory {
2     namespace "urn:opendaylight:inventory";
3     prefix inv;
4
5     import yang-ext {prefix ext; revision-date "2013-07-09";}
6     import ietf-inet-types {prefix inet; revision-date "2010-09-24";}
7
8
9     revision "2013-08-19" {
10         description "Initial revision of Inventory model";
11     }
12
13
14     typedef support-type {
15         type enumeration {
16             enum native;
17             enum emulated;
18             enum not-supported;
19         }
20     }
21
22     typedef node-id {
23         type inet:uri;
24         description "Identifier for a particular node. For example:
25
26                         myprotocol:<unique_node_id>
27
28                         myprotocol:12
29
30                     It is a good practice to always lead with a scoping identifier.
31                     In the example above the scoping was 'myprotocol'. In your app you
32                     could use 'myapp' etc.";
33     }
34
35     typedef node-connector-id {
36         type inet:uri;
37         description "Identifier for a particular node-connector. For example:
38
39                         myprotocol:<unique_node_connector_id>
40                         myprotocol:3
41
42                     It is a good practice to always lead with a scoping identifier.
43                     In the example above the scoping was 'myprotocol'. In your app you
44                     could use 'myapp' etc.";
45
46     }
47
48     //YANG does not have a statement which limits the scope of an instance-identifier to a particular subtree,
49     //which is why we are using a type capture and not an instance-identifier to define a node-ref and a node-connector-ref.
50     typedef node-ref {
51         type instance-identifier;
52         description "A reference that points to an opendaylight-light:nodes/node in the data tree.";
53     }
54
55     typedef node-connector-ref {
56         type instance-identifier;
57         description "A reference that points to an opendaylight-list:nodes/node/{node-id}/node-connector in the data tree.";
58     }
59
60     identity node-context {
61         description "A node-context is a classifier for node elements which allows an RPC to provide a service on behalf of a particular element in the data tree.";
62     }
63
64     identity node-connector-context {
65         description "A node-connector-context is a classifier for node-connector elements which allows an RPC to provide a service on behalf of a particular element in the data tree.";
66     }
67
68     //We are defining a base identity here because there are limitations with yang enums. Yang doesn't allow you to extend enumeratations.
69     //Therefore by defining a base identity we allow other yang files to extend this identity to define additional "enumerations". By
70     //using node-type as their base they are able to pass their object to fields that accept "node-types" while uniquely describing their
71     //type of node, such as "router-node" or "switch-node" etc.
72     //See https://wiki.opendaylight.org/view/YANG_Tools:YANG_to_Java_Mapping#Identity for more information.
73     identity node-type {
74         description "A base identity definition which represents a generic node type and can be extended in other yang files.";
75     }
76
77     identity node-connector-type {
78         description "A base identity definition which represents a generic node connector type and can be extended in other yang files.";
79     }
80
81     grouping node {
82
83         description "Describes the contents of a generic node -
84                      essentially an ID and a list of node-connectors.
85                      Acts as an augmentation point where other yang files
86                       can add additional information.";
87
88         leaf id {
89             type node-id;
90             description "The unique identifier for the node.";
91         }
92
93         list "node-connector" {
94             key "id";
95
96             description "A list of node connectors that belong this node.";
97             ext:context-instance "node-connector-context";
98
99             uses node-connector;
100         }
101     }
102
103     grouping node-connector {
104
105         description "Describes a generic node connector which consists of an ID.
106                      Acts as an augmentation point where other yang files can
107                       add additional information.";
108
109         leaf id {
110             type node-connector-id;
111             description "The unique identifier for the node-connector.";
112         }
113     }
114
115     grouping node-context-ref {
116         description
117         "A helper grouping which contains a reference to a node classified with a node-context. This allows RPCs in other yang files to refine their input to a particular node instance.";
118
119         leaf node {
120             ext:context-reference "node-context";
121             type node-ref;
122             description "A reference to a particular node.";
123         }
124     }
125
126     /** Base structure **/
127     container nodes {
128
129         description "The root container of all nodes.";
130
131         list node {
132             key "id";
133             ext:context-instance "node-context";
134             description "A list of nodes (as defined by the 'grouping node').";
135             uses node; //this refers to the 'grouping node' defined above.
136         }
137     }
138
139     //The following notifications should really be replaced by direct writes to the data tree with data change listeners listening to those changes.
140     //Notifications should be reserved for one time events which do not require persistence to the data tree.
141     notification node-updated {
142
143         status deprecated;
144
145         description "A notification sent by someone who realized there was a modification to a node, but did not modify the data tree.
146                     Describes that something on the node has been updated (including addition of a new node), but is for
147                     whatever reason is not modifying the data tree.
148
149                     Deprecated: If a process determines that a node was updated, then that
150                     logic should update the node using the DataBroker directly. Listeners interested
151                     update changes should register a data change listener for notifications on removals.";
152
153         leaf node-ref {
154             ext:context-reference "node-context";
155             description "A reference to the node which changed.";
156
157             type node-ref;
158         }
159         uses node;
160     }
161
162     notification node-connector-updated {
163
164         status deprecated;
165
166         description "A notification sent by someone who realized there was a modification to a node-connector, but did not modify the data tree.
167                     Describes that something on the node-connector has been updated (including addition of a new node-connector), but is for
168                     whatever reason is not modifying the data tree.
169
170                     Deprecated: If a process determines that a node-connector was updated, then that
171                     logic should update the node-connector using the DataBroker directly. Listeners interested
172                     update changes should register a data change listener for notifications on removals.";
173
174         leaf node-connector-ref {
175             ext:context-reference "node-connector-context";
176             type node-connector-ref;
177             description "A reference to the node-connector which changed.";
178         }
179         uses node-connector;
180     }
181
182     notification node-removed {
183
184         status deprecated;
185
186         description "A notification sent by someone who realized there was a node was removed, but did not modify the data tree.
187                     Describes that a node has been removed but is for
188                     whatever reason is not modifying the data tree.
189
190                     Deprecated: If a process determines that a node was removed, then that
191                     logic should remove the node from the DataBroker directly. Listeners interested
192                     in changes should register a data change listener for notifications on removals.";
193
194         leaf node-ref {
195             description "A reference to the node that was removed.";
196             ext:context-reference "node-context";
197             type node-ref;
198         }
199     }
200
201     notification node-connector-removed {
202
203         status deprecated;
204
205         description "A notification sent by someone who realized there was a node-connector was removed, but did not modify the data tree.
206                     Describes that a node-connector has been removed but is for
207                     whatever reason is not modifying the data tree.
208
209                     Deprecated: If a process determines that a node-connector was removed, then that
210                     logic should remove the node-connector from the DataBroker directly. Listeners interested
211                     in changes should register a data change listener for notifications on removals.";
212
213         leaf node-connector-ref {
214             description "A reference to the node-connector that was removed.";
215             ext:context-reference "node-connector-context";
216             type node-connector-ref;
217         }
218     }
219 }