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