Adjust test suite parser update to conform with API changes
[yangtools.git] / yang / yang-parser-rfc7950 / src / test / resources / ietf / network-topology@2013-07-12.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"; }
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-07-12 {
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     typedef link-id {
49         type inet:uri;
50         description
51             "An identifier for a link in a topology.  
52             The identifier may be opaque.  
53             The identifier SHOULD be chosen such that the same link in a 
54             real network topology will always be identified through the 
55             same identifier, even if the model is instantiated in separate 
56             datastores. An implementation MAY choose to capture semantics 
57             in the identifier, for example to indicate the type of link 
58             and/or the type of topology that the link is a part of.";  
59     }
60
61     typedef tp-id {
62         type inet:uri;
63         description 
64             "An identifier for termination points on a node. 
65             The identifier may be opaque.  
66             The identifier SHOULD be chosen such that the same TP in a 
67             real network topology will always be identified through the 
68             same identifier, even if the model is instantiated in separate 
69             datastores. An implementation MAY choose to capture semantics 
70             in the identifier, for example to indicate the type of TP 
71             and/or the type of node and topology that the TP is a part of.";  
72     }
73
74     typedef tp-ref {
75         type leafref {
76             path "/network-topology/topology/node/termination-point/tp-id";
77         }
78         description 
79             "A type for an absolute reference to a termination point.
80             (This type should not be used for relative references.
81             In such a case, a relative path should be used instead.)";
82     }
83     typedef topology-ref {
84         type leafref {
85             path "/network-topology/topology/topology-id";
86         }
87         description 
88             "A type for an absolute reference a topology instance.";
89     }
90     
91     typedef node-ref {
92         type leafref {
93             path "/network-topology/topology/node/node-id";
94         }
95         description 
96             "A type for an absolute reference to a node instance.
97             (This type should not be used for relative references.
98             In such a case, a relative path should be used instead.)";
99     }
100
101     typedef link-ref {
102         type leafref {
103             path "/network-topology/topology/link/link-id";
104         }
105         description 
106             "A type for an absolute reference a link instance.
107             (This type should not be used for relative references.
108             In such a case, a relative path should be used instead.)";
109     }
110
111     grouping tp-attributes {
112         description 
113             "The data objects needed to define a termination point.
114             (This only includes a single leaf at this point, used
115             to identify the termination point.)  
116             Provided in a grouping so that in addition to the datastore,
117             the data can also be included in notifications.";
118         leaf tp-id {
119             type tp-id;
120         }
121         leaf-list tp-ref {
122             type tp-ref;
123             config false;
124             description 
125                 "The leaf list identifies any termination points that the 
126                 termination point is dependent on, or maps onto.  
127                 Those termination points will themselves be contained 
128                 in a supporting node.  
129                 This dependency information can be inferred from 
130                 the dependencies between links.  For this reason, 
131                 this item is not separately configurable.  Hence no
132                 corresponding constraint needs to be articulated.  
133                 The corresponding information is simply provided by the
134                 implementing system.";
135         }
136     } 
137     
138     grouping node-attributes {
139         description
140             "The data objects needed to define a node.
141             The objects are provided in a grouping so that in addition to
142             the datastore, the data can also be included in notifications
143             as needed.";
144         leaf node-id {
145             type node-id;
146             description 
147                 "The identifier of a node in the topology.  
148                 A node is specific to a topology to which it belongs.";   
149         }
150         list supporting-node {
151             description 
152                 "This list defines vertical layering information for nodes. 
153                 It allows to capture for any given node, which node (or nodes)
154                 in the corresponding underlay topology it maps onto.  
155                 A node can map to zero, one, or more nodes below it;
156                 accordingly there can be zero, one, or more elements in the list.
157                 If there are specific layering requirements, for example
158                 specific to a particular type of topology that only allows
159                 for certain layering relationships, the choice
160                 below can be augmented with additional cases.
161                 A list has been chosen rather than a leaf-list in order 
162                 to provide room for augmentations, e.g. for 
163                 statistics or priorization information associated with 
164                 supporting nodes.";
165             key "node-ref";
166             leaf node-ref {
167                 type node-ref;
168             }
169         }
170     }
171             
172     grouping link-attributes {
173         // This is a grouping, not defined inline with the link definition itself,
174         // so it can be included in a notification, if needed
175         leaf link-id {
176             type link-id;
177             description
178                 "The identifier of a link in the topology.  
179                 A link is specific to a topology to which it belongs.";   
180         }
181         container source { 
182             leaf source-node {
183                 mandatory true;
184                 type node-ref; 
185                 description 
186                     "Source node identifier, must be in same topology.";
187             }
188             leaf source-tp {
189                 type tp-ref; 
190                 description 
191                     "Termination point within source node that terminates the link.";           
192             }
193         }
194         container destination { 
195             leaf dest-node {
196                 mandatory true;
197                 type node-ref; 
198                 description 
199                     "Destination node identifier, must be in same topology.";
200             }
201             leaf dest-tp {
202                 type tp-ref;
203                 description 
204                     "Termination point within destination node that terminates the link.";
205             }
206         }
207         list supporting-link {
208             key "link-ref";
209             leaf link-ref {
210                 type link-ref;
211             }
212         }
213     }
214     
215
216     container network-topology {
217         list topology {
218             description "
219                 This is the model of an abstract topology.
220                 A topology contins nodes and links.  
221                 Each topology MUST be identified by
222                 unique topology-id for reason that a network could contain many
223                 topologies.
224             ";
225             key "topology-id";
226             leaf topology-id {
227                 type topology-id; 
228                 description "
229                     It is presumed that a datastore will contain many topologies. To
230                     distinguish between topologies it is vital to have UNIQUE
231                     topology identifiers.
232                 ";
233             }
234             container topology-types {
235                 description 
236                     "This container is used to identify the type, or types 
237                     (as a topology can support several types simultaneously), 
238                     of the topology.  
239                     Topology types are the subject of several integrity constraints 
240                     that an implementing server can validate in order to 
241                     maintain integrity of the datastore.  
242                     Topology types are indicated through separate data nodes; 
243                     the set of topology types is expected to increase over time.
244                     To add support for a new topology, an augmenting module
245                     needs to augment this container with a new empty optional 
246                     container to indicate the new topology type.  
247                     The use of a container allows to indicate a subcategorization
248                     of topology types.  
249                     The container SHALL NOT be augmented with any data nodes 
250                     that serve a purpose other than identifying a particular 
251                     topology type.  
252                 ";
253             }   
254             list underlay-topology {
255                 key "topology-ref";
256                 leaf topology-ref {
257                     type topology-ref;
258                 }  
259                 // a list, not a leaf-list, to allow for potential augmentation 
260                 // with properties specific to the underlay topology, 
261                 // such as statistics, preferences, or cost.  
262                 description 
263                     "Identifies the topology, or topologies, that this topology
264                     is dependent on.";
265             }
266             
267             list node {
268                 description "The list of network nodes defined for the topology.";
269                 key "node-id";
270                 uses node-attributes;
271                 must "boolean(../underlay-topology[*]/node[./supporting-nodes/node-ref])";
272                     // This constraint is meant to ensure that a referenced node is in fact 
273                     // a node in an underlay topology.  
274                 list termination-point {
275                     description
276                         "A termination point can terminate a link.  
277                         Depending on the type of topology, a termination point could, 
278                         for example, refer to a port or an interface."; 
279                     key "tp-id";
280                     uses tp-attributes;
281                 }
282             }
283             
284             list link {
285                 description "
286                     A Network Link connects a by Local (Source) node and
287                     a Remote (Destination) Network Nodes via a set of the 
288                     nodes' termination points. 
289                     As it is possible to have several links between the same
290                     source and destination nodes, and as a link could potentially
291                     be re-homed between termination points, to ensure that we 
292                     would always know to distinguish between links, every link 
293                     is identified by a dedicated link identifier.  
294                     Note that a link models a point-to-point link, not a multipoint
295                     link.  
296                     Layering dependencies on links in underlay topologies are
297                     not represented as the layering information of nodes and of 
298                     termination points is sufficient.  
299                 ";
300                 key "link-id";
301                 uses link-attributes;
302                 must "boolean(../underlay-topology/link[./supporting-link])";
303                     // Constraint: any supporting link must be part of an underlay topology
304                 must "boolean(../node[./source/source-node])";
305                     // Constraint: A link must have as source a node of the same topology
306                 must "boolean(../node[./destination/dest-node])";
307                     // Constraint: A link must have as source a destination of the same topology
308                 must "boolean(../node/termination-point[./source/source-tp])";
309                     // Constraint: The source termination point must be contained in the source node
310                 must "boolean(../node/termination-point[./destination/dest-tp])";
311                     // Constraint: The destination termination point must be contained 
312                     // in the destination node
313             }
314         }
315     }
316 }