Add geoLocation to ietf-networks:node
[oam.git] / code / network-generator / network_generation / model / yang / ietf-network-topology.yang
1 module ietf-network-topology {
2   yang-version 1.1;
3   namespace "urn:ietf:params:xml:ns:yang:ietf-network-topology";
4   prefix nt;
5
6   import ietf-inet-types {
7     prefix inet;
8     reference
9       "RFC 6991: Common YANG Data Types";
10   }
11   import ietf-network {
12     prefix nw;
13     reference
14       "RFC 8345: A YANG Data Model for Network Topologies";
15   }
16
17   organization
18     "IETF I2RS (Interface to the Routing System) Working Group";
19
20   contact
21     "WG Web:    <https://datatracker.ietf.org/wg/i2rs/>
22      WG List:   <mailto:i2rs@ietf.org>
23
24      Editor:    Alexander Clemm
25                 <mailto:ludwig@clemm.org>
26
27      Editor:    Jan Medved
28                 <mailto:jmedved@cisco.com>
29
30      Editor:    Robert Varga
31                 <mailto:robert.varga@pantheon.tech>
32
33      Editor:    Nitin Bahadur
34                 <mailto:nitin_bahadur@yahoo.com>
35
36      Editor:    Hariharan Ananthakrishnan
37                 <mailto:hari@packetdesign.com>
38
39      Editor:    Xufeng Liu
40                 <mailto:xufeng.liu.ietf@gmail.com>";
41
42   description
43     "This module defines a common base model for a network topology,
44      augmenting the base network data model with links to connect
45      nodes, as well as termination points to terminate links
46      on nodes.
47
48      Copyright (c) 2018 IETF Trust and the persons identified as
49      authors of the code.  All rights reserved.
50
51      Redistribution and use in source and binary forms, with or
52      without modification, is permitted pursuant to, and subject
53      to the license terms contained in, the Simplified BSD License
54      set forth in Section 4.c of the IETF Trust's Legal Provisions
55      Relating to IETF Documents
56      (https://trustee.ietf.org/license-info).
57
58      This version of this YANG module is part of RFC 8345;
59      see the RFC itself for full legal notices.";
60
61   revision 2018-02-26 {
62     description
63       "Initial revision.";
64     reference
65       "RFC 8345: A YANG Data Model for Network Topologies";
66   }
67
68   typedef link-id {
69     type inet:uri;
70     description
71       "An identifier for a link in a topology.  The precise
72        structure of the link-id will be up to the implementation.
73        The identifier SHOULD be chosen such that the same link in a
74        real network topology will always be identified through the
75        same identifier, even if the data model is instantiated in
76        separate datastores.  An implementation MAY choose to capture
77        semantics in the identifier -- for example, to indicate the
78        type of link and/or the type of topology of which the link is
79        a part.";
80   }
81
82   typedef tp-id {
83     type inet:uri;
84     description
85       "An identifier for termination points on a node.  The precise
86        structure of the tp-id will be up to the implementation.
87        The identifier SHOULD be chosen such that the same termination
88        point in a real network topology will always be identified
89        through the same identifier, even if the data model is
90        instantiated in separate datastores.  An implementation MAY
91        choose to capture semantics in the identifier -- for example,
92        to indicate the type of termination point and/or the type of
93        node that contains the termination point.";
94   }
95
96   grouping link-ref {
97     description
98       "This grouping can be used to reference a link in a specific
99        network.  Although it is not used in this module, it is
100        defined here for the convenience of augmenting modules.";
101     leaf link-ref {
102       type leafref {
103         path "/nw:networks/nw:network[nw:network-id=current()/../"+
104           "network-ref]/nt:link/nt:link-id";
105         require-instance false;
106       }
107       description
108         "A type for an absolute reference to 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     uses nw:network-ref;
113   }
114
115   grouping tp-ref {
116     description
117       "This grouping can be used to reference a termination point
118        in a specific node.  Although it is not used in this module,
119        it is defined here for the convenience of augmenting
120        modules.";
121     leaf tp-ref {
122       type leafref {
123         path "/nw:networks/nw:network[nw:network-id=current()/../"+
124           "network-ref]/nw:node[nw:node-id=current()/../"+
125           "node-ref]/nt:termination-point/nt:tp-id";
126         require-instance false;
127       }
128       description
129         "A type for an absolute reference to a termination point.
130          (This type should not be used for relative references.
131          In such a case, a relative path should be used instead.)";
132     }
133     uses nw:node-ref;
134   }
135
136   augment "/nw:networks/nw:network" {
137     description
138       "Add links to the network data model.";
139     list link {
140       key "link-id";
141       description
142         "A network link connects a local (source) node and
143          a remote (destination) node via a set of the respective
144          node's termination points.  It is possible to have several
145          links between the same source and destination nodes.
146          Likewise, a link could potentially be re-homed between
147          termination points.  Therefore, in order to ensure that we
148          would always know to distinguish between links, every link
149          is identified by a dedicated link identifier.  Note that a
150          link models a point-to-point link, not a multipoint link.";
151       leaf link-id {
152         type link-id;
153         description
154           "The identifier of a link in the topology.
155            A link is specific to a topology to which it belongs.";
156       }
157       container source {
158         description
159           "This container holds the logical source of a particular
160            link.";
161         leaf source-node {
162           type leafref {
163             path "../../../nw:node/nw:node-id";
164             require-instance false;
165           }
166           description
167             "Source node identifier.  Must be in the same topology.";
168         }
169         leaf source-tp {
170           type leafref {
171             path "../../../nw:node[nw:node-id=current()/../"+
172               "source-node]/termination-point/tp-id";
173             require-instance false;
174           }
175           description
176             "This termination point is located within the source node
177              and terminates the link.";
178         }
179       }
180
181       container destination {
182         description
183           "This container holds the logical destination of a
184            particular link.";
185         leaf dest-node {
186           type leafref {
187             path "../../../nw:node/nw:node-id";
188           require-instance false;
189           }
190           description
191             "Destination node identifier.  Must be in the same
192              network.";
193         }
194         leaf dest-tp {
195           type leafref {
196             path "../../../nw:node[nw:node-id=current()/../"+
197               "dest-node]/termination-point/tp-id";
198             require-instance false;
199           }
200           description
201             "This termination point is located within the
202              destination node and terminates the link.";
203         }
204       }
205       list supporting-link {
206         key "network-ref link-ref";
207         description
208           "Identifies the link or links on which this link depends.";
209         leaf network-ref {
210           type leafref {
211             path "../../../nw:supporting-network/nw:network-ref";
212           require-instance false;
213           }
214           description
215             "This leaf identifies in which underlay topology
216              the supporting link is present.";
217         }
218
219         leaf link-ref {
220           type leafref {
221             path "/nw:networks/nw:network[nw:network-id=current()/"+
222               "../network-ref]/link/link-id";
223             require-instance false;
224           }
225           description
226             "This leaf identifies a link that is a part
227              of this link's underlay.  Reference loops in which
228              a link identifies itself as its underlay, either
229              directly or transitively, are not allowed.";
230         }
231       }
232     }
233   }
234   augment "/nw:networks/nw:network/nw:node" {
235     description
236       "Augments termination points that terminate links.
237        Termination points can ultimately be mapped to interfaces.";
238     list termination-point {
239       key "tp-id";
240       description
241         "A termination point can terminate a link.
242          Depending on the type of topology, a termination point
243          could, for example, refer to a port or an interface.";
244       leaf tp-id {
245         type tp-id;
246         description
247           "Termination point identifier.";
248       }
249       list supporting-termination-point {
250         key "network-ref node-ref tp-ref";
251         description
252           "This list identifies any termination points on which a
253            given termination point depends or onto which it maps.
254            Those termination points will themselves be contained
255            in a supporting node.  This dependency information can be
256            inferred from the dependencies between links.  Therefore,
257            this item is not separately configurable.  Hence, no
258            corresponding constraint needs to be articulated.
259            The corresponding information is simply provided by the
260            implementing system.";
261
262         leaf network-ref {
263           type leafref {
264             path "../../../nw:supporting-node/nw:network-ref";
265           require-instance false;
266           }
267           description
268             "This leaf identifies in which topology the
269              supporting termination point is present.";
270         }
271         leaf node-ref {
272           type leafref {
273             path "../../../nw:supporting-node/nw:node-ref";
274           require-instance false;
275           }
276           description
277             "This leaf identifies in which node the supporting
278              termination point is present.";
279         }
280         leaf tp-ref {
281           type leafref {
282             path "/nw:networks/nw:network[nw:network-id=current()/"+
283               "../network-ref]/nw:node[nw:node-id=current()/../"+
284               "node-ref]/termination-point/tp-id";
285             require-instance false;
286           }
287           description
288             "Reference to the underlay node (the underlay node must
289              be in a different topology).";
290         }
291       }
292     }
293   }
294 }