e262d8799b352991f354fed49baffa377f3cd494
[transportpce.git] / ordmodels / network / src / main / yang / ietf-network-topology@2015-06-08.yang
1 module ietf-network-topology {\r
2   yang-version 1;\r
3   namespace "urn:ietf:params:xml:ns:yang:ietf-network-topology";\r
4   prefix lnk;\r
5 \r
6   import ietf-inet-types {\r
7     prefix inet;\r
8   }\r
9   import ietf-network {\r
10     prefix nd;\r
11   }\r
12 \r
13   organization "TBD";\r
14   contact\r
15     "WILL-BE-DEFINED-LATER";\r
16   description\r
17     "This module defines a common base model for network topology, \r
18      augmenting the base network model with links to connect nodes, \r
19      as well as termination points to terminate links on nodes.";\r
20 \r
21   revision 2015-06-08 {\r
22     description\r
23       "Initial revision.";\r
24     reference "draft-ietf-i2rs-yang-network-topo-01";\r
25   }\r
26 \r
27   typedef link-id {\r
28     type inet:uri;\r
29     description\r
30       "An identifier for a link in a topology.\r
31        The identifier may be opaque.\r
32        The identifier SHOULD be chosen such that the same link in a\r
33        real network topology will always be identified through the\r
34        same identifier, even if the model is instantiated in \r
35            separate datastores. An implementation MAY choose to capture\r
36        semantics in the identifier, for example to indicate the type\r
37        of link and/or the type of topology that the link is a part \r
38        of.";\r
39   }\r
40 \r
41   typedef tp-id {\r
42     type inet:uri;\r
43     description\r
44       "An identifier for termination points on a node.\r
45        The identifier may be opaque.\r
46        The identifier SHOULD be chosen such that the same TP in a\r
47        real network topology will always be identified through the\r
48        same identifier, even if the model is instantiated in\r
49        separate datastores. An implementation MAY choose to capture\r
50        semantics in the identifier, for example to indicate the type\r
51        of TP and/or the type of node and topology that the TP is a \r
52        part of.";\r
53   }\r
54 \r
55   grouping link-ref {\r
56     description\r
57       "References a link in a specific network.";\r
58     leaf link-ref {\r
59       type leafref {\r
60         path "/nd:network[nd:network-id=current()/../"+\r
61           "nd:network-ref]/link/link-id";\r
62       }\r
63       description\r
64         "A type for an absolute reference a link instance.\r
65          (This type should not be used for relative references.\r
66          In such a case, a relative path should be used instead.)";\r
67     }\r
68     uses nd:network-ref;\r
69   }\r
70 \r
71   grouping tp-ref {\r
72     description\r
73       "References a termination point in a specific node.";\r
74     leaf tp-ref {\r
75       type leafref {\r
76         path "/nd:network[nd:network-id=current()/../"+\r
77           "nd:network-ref]/nd:node[nd:node-id=current()/../"+\r
78           "nd:node-ref]/termination-point/tp-id";\r
79       }\r
80       description\r
81         "A type for an absolute reference to a termination point.\r
82          (This type should not be used for relative references.\r
83          In such a case, a relative path should be used instead.)";\r
84     }\r
85     uses nd:node-ref;\r
86   }\r
87 \r
88   augment "/nd:network" {\r
89     description \r
90       "Add links to the network model.";\r
91     list link {\r
92       key "link-id";\r
93       description\r
94         "A Network Link connects a by Local (Source) node and\r
95          a Remote (Destination) Network Nodes via a set of the\r
96          nodes' termination points.\r
97          As it is possible to have several links between the same\r
98          source and destination nodes, and as a link could\r
99          potentially be re-homed between termination points, to\r
100          ensure that we would always know to distinguish between\r
101          links, every link is identified by a dedicated link\r
102          identifier.\r
103          Note that a link models a point-to-point link, not a\r
104          multipoint link.\r
105          Layering dependencies on links in underlay topologies are\r
106          not represented as the layering information of nodes and of\r
107          termination points is sufficient.";\r
108       container source {\r
109         description\r
110           "This container holds the logical source of a particular\r
111            link.";\r
112         leaf source-node {\r
113           type leafref {\r
114             path "../../../nd:node/nd:node-id";\r
115           }\r
116           mandatory true;\r
117           description\r
118             "Source node identifier, must be in same topology.";\r
119         }\r
120         leaf source-tp {\r
121           type leafref {\r
122             path "../../../nd:node[nd:node-id=current()/../"+\r
123               "source-node]/termination-point/tp-id";\r
124           }\r
125           description\r
126             "Termination point within source node that terminates\r
127              the link.";\r
128         }\r
129       }\r
130       container destination {\r
131         description\r
132           "This container holds the logical destination of a\r
133            particular link.";\r
134         leaf dest-node {\r
135           type leafref {\r
136             path "../../../nd:node/nd:node-id";\r
137           }\r
138           mandatory true;\r
139           description\r
140             "Destination node identifier, must be in the same\r
141              network.";\r
142         }\r
143         leaf dest-tp {\r
144           type leafref {\r
145             path "../../../nd:node[nd:node-id=current()/../"+\r
146               "dest-node]/termination-point/tp-id";\r
147           }\r
148           description\r
149             "Termination point within destination node that\r
150              terminates the link.";\r
151         }\r
152       }\r
153       leaf link-id {\r
154         type link-id;\r
155         description\r
156           "The identifier of a link in the topology.\r
157            A link is specific to a topology to which it belongs.";\r
158       }\r
159       list supporting-link {\r
160         key "network-ref link-ref";\r
161         description\r
162           "Identifies the link, or links, that this link\r
163            is dependent on.";\r
164         leaf network-ref {\r
165           type leafref {\r
166             path "../../../nd:supporting-network/nd:network-ref";\r
167           }\r
168           description\r
169             "This leaf identifies in which underlay topology\r
170              supporting link is present.";\r
171         }\r
172         leaf link-ref {\r
173           type leafref {\r
174             path "/nd:network[nd:network-id=current()/.."+\r
175               "/network-ref]/link/link-id";\r
176           }\r
177           description\r
178             "This leaf identifies a link which is a part\r
179              of this link's underlay. Reference loops, in which\r
180              a link identifies itself as its underlay, either\r
181              directly or transitively, are not allowed.";\r
182         }\r
183       }\r
184     }\r
185   }\r
186   augment "/nd:network/nd:node" {\r
187     description\r
188       "Augment termination points which terminate links.  \r
189        Termination points can ultimately be mapped to interfaces.";\r
190     list termination-point {\r
191       key "tp-id";\r
192       description\r
193         "A termination point can terminate a link.\r
194          Depending on the type of topology, a termination point\r
195          could, for example, refer to a port or an interface.";\r
196       leaf tp-id {\r
197         type tp-id;\r
198         description\r
199           "Termination point identifier.";\r
200       }\r
201       list supporting-termination-point {\r
202         key "network-ref node-ref tp-ref";\r
203         description\r
204           "The leaf list identifies any termination points that\r
205            the termination point is dependent on, or maps onto.\r
206            Those termination points will themselves be contained\r
207            in a supporting node.\r
208            This dependency information can be inferred from\r
209            the dependencies between links.  For this reason,\r
210            this item is not separately configurable.  Hence no\r
211            corresponding constraint needs to be articulated.\r
212            The corresponding information is simply provided by the\r
213            implementing system.";\r
214         leaf network-ref {\r
215           type leafref {\r
216             path "../../../nd:supporting-node/nd:network-ref";\r
217           }\r
218           description\r
219             "This leaf identifies in which topology the\r
220              supporting termination point is present.";\r
221         }\r
222         leaf node-ref {\r
223           type leafref {\r
224             path "../../../nd:supporting-node/nd:node-ref";\r
225           }\r
226           description\r
227             "This leaf identifies in which node the supporting\r
228              termination point is present.";\r
229         }\r
230         leaf tp-ref {\r
231           type leafref {\r
232             path "/nd:network[nd:network-id=current()/../"+\r
233               "network-ref]/nd:node[nd:node-id=current()/../"+\r
234               "node-ref]/termination-point/tp-id";\r
235           }\r
236           description\r
237             "Reference to the underlay node, must be in a\r
238              different topology";\r
239         }\r
240       }\r
241     }\r
242   }\r
243 }\r