Bug 5615 - Netconf connector update overwriting existing topology data
[netconf.git] / netconf / sal-netconf-connector / src / test / resources / schemas / network-topology@2013-10-21.yang
1 module network-topology  {
2     yang-version 1;
3     namespace "urn:TBD:params:xml:ns:yang:network-topology";
4     // replace with IANA namespace when assigned
5     prefix "nt";
6
7     import ietf-inet-types { prefix "inet"; revision-date 2013-07-15; }
8
9     organization "TBD";
10
11     contact "WILL-BE-DEFINED-LATER";
12
13     description
14         "This module defines a model for the topology of a network.
15         Key design decisions are as follows:
16         A topology consists of a set of nodes and links.
17         Links are point-to-point and unidirectional.
18         Bidirectional connections need to be represented through
19         two separate links.
20         Multipoint connections, broadcast domains etc can be represented
21         through a hierarchy of nodes, then connecting nodes at
22         upper layers of the hierarchy.";
23
24     revision 2013-10-21 {
25         description
26             "Initial revision.";
27     }
28
29     typedef topology-id {
30         type inet:uri;
31         description
32             "An identifier for a topology.";
33     }
34
35     typedef node-id {
36         type inet:uri;
37         description
38             "An identifier for a node in a topology.
39             The identifier may be opaque.
40             The identifier SHOULD be chosen such that the same node in a
41             real network topology will always be identified through the
42             same identifier, even if the model is instantiated in separate
43             datastores. An implementation MAY choose to capture semantics
44             in the identifier, for example to indicate the type of node
45             and/or the type of topology that the node is a part of.";
46     }
47
48
49     typedef link-id {
50         type inet:uri;
51         description
52             "An identifier for a link in a topology.
53             The identifier may be opaque.
54             The identifier SHOULD be chosen such that the same link in a
55             real network topology will always be identified through the
56             same identifier, even if the model is instantiated in separate
57             datastores. An implementation MAY choose to capture semantics
58             in the identifier, for example to indicate the type of link
59             and/or the type of topology that the link is a part of.";
60     }
61
62     typedef tp-id {
63         type inet:uri;
64         description
65             "An identifier for termination points on a node.
66             The identifier may be opaque.
67             The identifier SHOULD be chosen such that the same TP in a
68             real network topology will always be identified through the
69             same identifier, even if the model is instantiated in separate
70             datastores. An implementation MAY choose to capture semantics
71             in the identifier, for example to indicate the type of TP
72             and/or the type of node and topology that the TP is a part of.";
73     }
74
75     typedef tp-ref {
76         type leafref {
77             path "/network-topology/topology/node/termination-point/tp-id";
78         }
79         description
80             "A type for an absolute reference to a termination point.
81             (This type should not be used for relative references.
82             In such a case, a relative path should be used instead.)";
83     }
84     typedef topology-ref {
85         type leafref {
86             path "/network-topology/topology/topology-id";
87         }
88         description
89             "A type for an absolute reference a topology instance.";
90     }
91
92     typedef node-ref {
93         type leafref {
94             path "/network-topology/topology/node/node-id";
95         }
96         description
97
98             "A type for an absolute reference to a node instance.
99             (This type should not be used for relative references.
100             In such a case, a relative path should be used instead.)";
101     }
102
103     typedef link-ref {
104         type leafref {
105             path "/network-topology/topology/link/link-id";
106         }
107         description
108             "A type for an absolute reference a link instance.
109             (This type should not be used for relative references.
110             In such a case, a relative path should be used instead.)";
111     }
112
113     grouping tp-attributes {
114         description
115             "The data objects needed to define a termination point.
116             (This only includes a single leaf at this point, used
117             to identify the termination point.)
118             Provided in a grouping so that in addition to the datastore,
119             the data can also be included in notifications.";
120         leaf tp-id {
121             type tp-id;
122         }
123         leaf-list tp-ref {
124             type tp-ref;
125             config false;
126             description
127                 "The leaf list identifies any termination points that the
128                 termination point is dependent on, or maps onto.
129                 Those termination points will themselves be contained
130                 in a supporting node.
131                 This dependency information can be inferred from
132                 the dependencies between links.  For this reason,
133                 this item is not separately configurable.  Hence no
134                 corresponding constraint needs to be articulated.
135                 The corresponding information is simply provided by the
136                 implementing system.";
137         }
138     }
139
140     grouping node-attributes {
141         description
142             "The data objects needed to define a node.
143             The objects are provided in a grouping so that in addition to
144             the datastore, the data can also be included in notifications
145             as needed.";
146
147         leaf node-id {
148             type node-id;
149             description
150                 "The identifier of a node in the topology.
151                 A node is specific to a topology to which it belongs.";
152         }
153         list supporting-node {
154             description
155                 "This list defines vertical layering information for nodes.
156                 It allows to capture for any given node, which node (or nodes)
157                 in the corresponding underlay topology it maps onto.
158                 A node can map to zero, one, or more nodes below it;
159                 accordingly there can be zero, one, or more elements in the list.
160                 If there are specific layering requirements, for example
161                 specific to a particular type of topology that only allows
162                 for certain layering relationships, the choice
163                 below can be augmented with additional cases.
164                 A list has been chosen rather than a leaf-list in order
165                 to provide room for augmentations, e.g. for
166                 statistics or priorization information associated with
167                 supporting nodes.";
168             // This is not what was published in the initial draft,
169             // added topology-ref leaf and added it to the key
170             key "topology-ref node-ref";
171             leaf topology-ref {
172                 type topology-ref;
173             }
174             leaf node-ref {
175                 type node-ref;
176             }
177         }
178     }
179
180     grouping link-attributes {
181         // This is a grouping, not defined inline with the link definition itself,
182         // so it can be included in a notification, if needed
183         leaf link-id {
184             type link-id;
185             description
186                 "The identifier of a link in the topology.
187                 A link is specific to a topology to which it belongs.";
188         }
189         container source {
190             leaf source-node {
191                 mandatory true;
192                 type node-ref;
193                 description
194                     "Source node identifier, must be in same topology.";
195             }
196             leaf source-tp {
197                 type tp-ref;
198                 description
199                     "Termination point within source node that terminates the link.";
200
201             }
202         }
203         container destination {
204             leaf dest-node {
205                 mandatory true;
206                 type node-ref;
207                 description
208                     "Destination node identifier, must be in same topology.";
209             }
210             leaf dest-tp {
211                 type tp-ref;
212                 description
213                     "Termination point within destination node that terminates the link.";
214             }
215         }
216         list supporting-link {
217             key "link-ref";
218             leaf link-ref {
219                 type link-ref;
220             }
221         }
222     }
223
224
225     container network-topology {
226         list topology {
227             description "
228                 This is the model of an abstract topology.
229                 A topology contains nodes and links.
230                 Each topology MUST be identified by
231                 unique topology-id for reason that a network could contain many
232                 topologies.
233             ";
234             key "topology-id";
235             leaf topology-id {
236                 type topology-id;
237                 description "
238                     It is presumed that a datastore will contain many topologies. To
239                     distinguish between topologies it is vital to have UNIQUE
240                     topology identifiers.
241                 ";
242             }
243             leaf server-provided {
244                 type boolean;
245                 config false;
246                 description "
247                     Indicates whether the topology is configurable by clients,
248                     or whether it is provided by the server.  This leaf is
249
250                     populated by the server implementing the model.
251                     It is set to false for topologies that are created by a client;
252                     it is set to true otherwise.  If it is set to true, any
253                     attempt to edit the topology MUST be rejected.
254                 ";
255             }
256             container topology-types {
257                 description
258                     "This container is used to identify the type, or types
259                     (as a topology can support several types simultaneously),
260                     of the topology.
261                     Topology types are the subject of several integrity constraints
262                     that an implementing server can validate in order to
263                     maintain integrity of the datastore.
264                     Topology types are indicated through separate data nodes;
265                     the set of topology types is expected to increase over time.
266                     To add support for a new topology, an augmenting module
267                     needs to augment this container with a new empty optional
268                     container to indicate the new topology type.
269                     The use of a container allows to indicate a subcategorization
270                     of topology types.
271                     The container SHALL NOT be augmented with any data nodes
272                     that serve a purpose other than identifying a particular
273                     topology type.
274                 ";
275             }
276             list underlay-topology {
277                 key "topology-ref";
278                 leaf topology-ref {
279                     type topology-ref;
280                 }
281                 // a list, not a leaf-list, to allow for potential augmentation
282                 // with properties specific to the underlay topology,
283                 // such as statistics, preferences, or cost.
284                 description
285                     "Identifies the topology, or topologies, that this topology
286                     is dependent on.";
287             }
288
289             list node {
290                 description "The list of network nodes defined for the topology.";
291                 key "node-id";
292                 uses node-attributes;
293                 must "boolean(../underlay-topology[*]/node[./supporting-nodes/node-ref])";
294                     // This constraint is meant to ensure that a referenced node is in fact
295                     // a node in an underlay topology.
296                 list termination-point {
297                     description
298
299                         "A termination point can terminate a link.
300                         Depending on the type of topology, a termination point could,
301                         for example, refer to a port or an interface.";
302                     key "tp-id";
303                     uses tp-attributes;
304                 }
305             }
306
307             list link {
308                 description "
309                     A Network Link connects a by Local (Source) node and
310                     a Remote (Destination) Network Nodes via a set of the
311                     nodes' termination points.
312                     As it is possible to have several links between the same
313                     source and destination nodes, and as a link could potentially
314                     be re-homed between termination points, to ensure that we
315                     would always know to distinguish between links, every link
316                     is identified by a dedicated link identifier.
317                     Note that a link models a point-to-point link, not a multipoint
318                     link.
319                     Layering dependencies on links in underlay topologies are
320                     not represented as the layering information of nodes and of
321                     termination points is sufficient.
322                 ";
323                 key "link-id";
324                 uses link-attributes;
325                 must "boolean(../underlay-topology/link[./supporting-link])";
326                     // Constraint: any supporting link must be part of an underlay topology
327                 must "boolean(../node[./source/source-node])";
328                     // Constraint: A link must have as source a node of the same topology
329                 must "boolean(../node[./destination/dest-node])";
330                     // Constraint: A link must have as source a destination of the same topology
331                 must "boolean(../node/termination-point[./source/source-tp])";
332                     // Constraint: The source termination point must be contained in the source node
333                 must "boolean(../node/termination-point[./destination/dest-tp])";
334                     // Constraint: The destination termination point must be contained
335                     // in the destination node
336             }
337         }
338     }
339 }