YANGTOOLS-706: Split out yang-parser-rfc7950
[yangtools.git] / yang / yang-parser-rfc7950 / src / test / resources / ietf / 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 2010-09-24; }
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             key "node-ref";
169             leaf node-ref {
170                 type node-ref;
171             }
172         }
173     }
174
175     grouping link-attributes {
176         // This is a grouping, not defined inline with the link definition itself,
177         // so it can be included in a notification, if needed
178         leaf link-id {
179             type link-id;
180             description
181                 "The identifier of a link in the topology.
182                 A link is specific to a topology to which it belongs.";
183         }
184         container source {
185             leaf source-node {
186                 mandatory true;
187                 type node-ref;
188                 description
189                     "Source node identifier, must be in same topology.";
190             }
191             leaf source-tp {
192                 type tp-ref;
193                 description
194                     "Termination point within source node that terminates the link.";
195
196             }
197         }
198         container destination {
199             leaf dest-node {
200                 mandatory true;
201                 type node-ref;
202                 description
203                     "Destination node identifier, must be in same topology.";
204             }
205             leaf dest-tp {
206                 type tp-ref;
207                 description
208                     "Termination point within destination node that terminates the link.";
209             }
210         }
211         list supporting-link {
212             key "link-ref";
213             leaf link-ref {
214                 type link-ref;
215             }
216         }
217     }
218
219
220     container network-topology {
221         list topology {
222             description "
223                 This is the model of an abstract topology.
224                 A topology contains nodes and links.
225                 Each topology MUST be identified by
226                 unique topology-id for reason that a network could contain many
227                 topologies.
228             ";
229             key "topology-id";
230             leaf topology-id {
231                 type topology-id;
232                 description "
233                     It is presumed that a datastore will contain many topologies. To
234                     distinguish between topologies it is vital to have UNIQUE
235                     topology identifiers.
236                 ";
237             }
238             leaf server-provided {
239                 type boolean;
240                 config false;
241                 description "
242                     Indicates whether the topology is configurable by clients,
243                     or whether it is provided by the server.  This leaf is
244
245                     populated by the server implementing the model.
246                     It is set to false for topologies that are created by a client;
247                     it is set to true otherwise.  If it is set to true, any
248                     attempt to edit the topology MUST be rejected.
249                 ";
250             }
251             container topology-types {
252                 description
253                     "This container is used to identify the type, or types
254                     (as a topology can support several types simultaneously),
255                     of the topology.
256                     Topology types are the subject of several integrity constraints
257                     that an implementing server can validate in order to
258                     maintain integrity of the datastore.
259                     Topology types are indicated through separate data nodes;
260                     the set of topology types is expected to increase over time.
261                     To add support for a new topology, an augmenting module
262                     needs to augment this container with a new empty optional
263                     container to indicate the new topology type.
264                     The use of a container allows to indicate a subcategorization
265                     of topology types.
266                     The container SHALL NOT be augmented with any data nodes
267                     that serve a purpose other than identifying a particular
268                     topology type.
269                 ";
270             }
271             list underlay-topology {
272                 key "topology-ref";
273                 leaf topology-ref {
274                     type topology-ref;
275                 }
276                 // a list, not a leaf-list, to allow for potential augmentation
277                 // with properties specific to the underlay topology,
278                 // such as statistics, preferences, or cost.
279                 description
280                     "Identifies the topology, or topologies, that this topology
281                     is dependent on.";
282             }
283
284             list node {
285                 description "The list of network nodes defined for the topology.";
286                 key "node-id";
287                 uses node-attributes;
288                 must "boolean(../underlay-topology[*]/node[./supporting-nodes/node-ref])";
289                     // This constraint is meant to ensure that a referenced node is in fact
290                     // a node in an underlay topology.
291                 list termination-point {
292                     description
293
294                         "A termination point can terminate a link.
295                         Depending on the type of topology, a termination point could,
296                         for example, refer to a port or an interface.";
297                     key "tp-id";
298                     uses tp-attributes;
299                 }
300             }
301
302             list link {
303                 description "
304                     A Network Link connects a by Local (Source) node and
305                     a Remote (Destination) Network Nodes via a set of the
306                     nodes' termination points.
307                     As it is possible to have several links between the same
308                     source and destination nodes, and as a link could potentially
309                     be re-homed between termination points, to ensure that we
310                     would always know to distinguish between links, every link
311                     is identified by a dedicated link identifier.
312                     Note that a link models a point-to-point link, not a multipoint
313                     link.
314                     Layering dependencies on links in underlay topologies are
315                     not represented as the layering information of nodes and of
316                     termination points is sufficient.
317                 ";
318                 key "link-id";
319                 uses link-attributes;
320                 must "boolean(../underlay-topology/link[./supporting-link])";
321                     // Constraint: any supporting link must be part of an underlay topology
322                 must "boolean(../node[./source/source-node])";
323                     // Constraint: A link must have as source a node of the same topology
324                 must "boolean(../node[./destination/dest-node])";
325                     // Constraint: A link must have as source a destination of the same topology
326                 must "boolean(../node/termination-point[./source/source-tp])";
327                     // Constraint: The source termination point must be contained in the source node
328                 must "boolean(../node/termination-point[./destination/dest-tp])";
329                     // Constraint: The destination termination point must be contained
330                     // in the destination node
331             }
332         }
333     }
334 }