Fix xpath building for data nodes addressing YANG augmentation
[cps.git] / cps-service / src / test / resources / ietf / ietf-network-topology-state@2018-02-26.yang
1 module ietf-network-topology-state {
2   yang-version 1.1;
3   namespace "urn:ietf:params:xml:ns:yang:ietf-network-topology-state";
4   prefix nt-s;
5
6   import ietf-network-state {
7     prefix nw-s;
8     reference
9       "RFC 8345: A YANG Data Model for Network Topologies";
10   }
11   import ietf-network-topology {
12     prefix nt;
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 data model for network
44      topology state, representing topology that either (1) is learned
45      or (2) results from applying topology that has been configured
46      per the 'ietf-network-topology' data model, mirroring the
47      corresponding data nodes in this data model.  It augments the
48      base network state data model with links to connect nodes, as
49      well as termination points to terminate links on nodes.
50
51      The data model mirrors 'ietf-network-topology' but contains only
52      read-only state data.  The data model is not needed when the
53      underlying implementation infrastructure supports the Network
54      Management Datastore Architecture (NMDA).
55
56      Copyright (c) 2018 IETF Trust and the persons identified as
57      authors of the code.  All rights reserved.
58
59      Redistribution and use in source and binary forms, with or
60      without modification, is permitted pursuant to, and subject
61      to the license terms contained in, the Simplified BSD License
62      set forth in Section 4.c of the IETF Trust's Legal Provisions
63      Relating to IETF Documents
64      (https://trustee.ietf.org/license-info).
65
66      This version of this YANG module is part of RFC 8345;
67      see the RFC itself for full legal notices.";
68
69   revision 2018-02-26 {
70     description
71       "Initial revision.";
72     reference
73       "RFC 8345: A YANG Data Model for Network Topologies";
74   }
75
76   grouping link-ref {
77     description
78       "References a link in a specific network.  Although this
79        grouping is not used in this module, it is defined here for
80        the convenience of augmenting modules.";
81     leaf link-ref {
82       type leafref {
83         path "/nw-s:networks/nw-s:network[nw-s:network-id=current()"+
84           "/../network-ref]/nt-s:link/nt-s:link-id";
85         require-instance false;
86       }
87       description
88         "A type for an absolute reference to a link instance.
89          (This type should not be used for relative references.
90          In such a case, a relative path should be used instead.)";
91     }
92     uses nw-s:network-ref;
93   }
94
95   grouping tp-ref {
96     description
97       "References a termination point in a specific node.  Although
98        this grouping is not used in this module, it is defined here
99        for the convenience of augmenting modules.";
100     leaf tp-ref {
101       type leafref {
102         path "/nw-s:networks/nw-s:network[nw-s:network-id=current()"+
103           "/../network-ref]/nw-s:node[nw-s:node-id=current()/../"+
104           "node-ref]/nt-s:termination-point/nt-s:tp-id";
105         require-instance false;
106       }
107       description
108         "A type for an absolute reference to a termination point.
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-s:node-ref;
113   }
114
115   augment "/nw-s:networks/nw-s:network" {
116     description
117       "Add links to the network data model.";
118     list link {
119       key "link-id";
120       description
121         "A network link connects a local (source) node and
122          a remote (destination) node via a set of the respective
123          node's termination points.  It is possible to have several
124          links between the same source and destination nodes.
125          Likewise, a link could potentially be re-homed between
126          termination points.  Therefore, in order to ensure that we
127          would always know to distinguish between links, every link
128          is identified by a dedicated link identifier.  Note that a
129          link models a point-to-point link, not a multipoint link.";
130       container source {
131         description
132           "This container holds the logical source of a particular
133            link.";
134         leaf source-node {
135           type leafref {
136             path "../../../nw-s:node/nw-s:node-id";
137             require-instance false;
138           }
139           description
140             "Source node identifier.  Must be in the same topology.";
141         }
142         leaf source-tp {
143           type leafref {
144             path "../../../nw-s:node[nw-s:node-id=current()/../"+
145               "source-node]/termination-point/tp-id";
146             require-instance false;
147           }
148           description
149             "This termination point is located within the source node
150              and terminates the link.";
151         }
152       }
153       container destination {
154         description
155           "This container holds the logical destination of a
156            particular link.";
157         leaf dest-node {
158           type leafref {
159             path "../../../nw-s:node/nw-s:node-id";
160           require-instance false;
161           }
162           description
163             "Destination node identifier.  Must be in the same
164              network.";
165         }
166
167         leaf dest-tp {
168           type leafref {
169             path "../../../nw-s:node[nw-s:node-id=current()/../"+
170               "dest-node]/termination-point/tp-id";
171             require-instance false;
172           }
173           description
174             "This termination point is located within the
175              destination node and terminates the link.";
176         }
177       }
178       leaf link-id {
179         type nt: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       list supporting-link {
185         key "network-ref link-ref";
186         description
187           "Identifies the link or links on which this link depends.";
188         leaf network-ref {
189           type leafref {
190             path "../../../nw-s:supporting-network/nw-s:network-ref";
191           require-instance false;
192           }
193           description
194             "This leaf identifies in which underlay topology
195              the supporting link is present.";
196         }
197         leaf link-ref {
198           type leafref {
199             path "/nw-s:networks/nw-s:network[nw-s:network-id="+
200               "current()/../network-ref]/link/link-id";
201             require-instance false;
202           }
203           description
204             "This leaf identifies a link that is a part
205              of this link's underlay.  Reference loops in which
206              a link identifies itself as its underlay, either
207              directly or transitively, are not allowed.";
208         }
209       }
210     }
211   }
212
213   augment "/nw-s:networks/nw-s:network/nw-s:node" {
214     description
215       "Augments termination points that terminate links.
216        Termination points can ultimately be mapped to interfaces.";
217     list termination-point {
218       key "tp-id";
219       description
220         "A termination point can terminate a link.
221          Depending on the type of topology, a termination point
222          could, for example, refer to a port or an interface.";
223       leaf tp-id {
224         type nt:tp-id;
225         description
226           "Termination point identifier.";
227       }
228       list supporting-termination-point {
229         key "network-ref node-ref tp-ref";
230         description
231           "This list identifies any termination points on which a
232            given termination point depends or onto which it maps.
233            Those termination points will themselves be contained
234            in a supporting node.  This dependency information can be
235            inferred from the dependencies between links.  Therefore,
236            this item is not separately configurable.  Hence, no
237            corresponding constraint needs to be articulated.
238            The corresponding information is simply provided by the
239            implementing system.";
240         leaf network-ref {
241           type leafref {
242             path "../../../nw-s:supporting-node/nw-s:network-ref";
243           require-instance false;
244           }
245           description
246             "This leaf identifies in which topology the
247              supporting termination point is present.";
248         }
249         leaf node-ref {
250           type leafref {
251             path "../../../nw-s:supporting-node/nw-s:node-ref";
252           require-instance false;
253           }
254           description
255             "This leaf identifies in which node the supporting
256              termination point is present.";
257         }
258
259         leaf tp-ref {
260           type leafref {
261             path "/nw-s:networks/nw-s:network[nw-s:network-id="+
262               "current()/../network-ref]/nw-s:node[nw-s:node-id="+
263               "current()/../node-ref]/termination-point/tp-id";
264             require-instance false;
265           }
266           description
267             "Reference to the underlay node (the underlay node must
268              be in a different topology).";
269         }
270       }
271     }
272   }
273 }