Fix xpath building for data nodes addressing YANG augmentation
[cps.git] / cps-service / src / test / resources / ietf / ietf-network@2018-02-26.yang
1 module ietf-network {
2   yang-version 1.1;
3   namespace "urn:ietf:params:xml:ns:yang:ietf-network";
4   prefix nw;
5
6   import ietf-inet-types {
7     prefix inet;
8     reference
9       "RFC 6991: Common YANG Data Types";
10   }
11
12   organization
13     "IETF I2RS (Interface to the Routing System) Working Group";
14
15   contact
16     "WG Web:    <https://datatracker.ietf.org/wg/i2rs/>
17      WG List:   <mailto:i2rs@ietf.org>
18
19      Editor:    Alexander Clemm
20                 <mailto:ludwig@clemm.org>
21
22      Editor:    Jan Medved
23                 <mailto:jmedved@cisco.com>
24
25      Editor:    Robert Varga
26                 <mailto:robert.varga@pantheon.tech>
27
28      Editor:    Nitin Bahadur
29                 <mailto:nitin_bahadur@yahoo.com>
30
31      Editor:    Hariharan Ananthakrishnan
32                 <mailto:hari@packetdesign.com>
33
34      Editor:    Xufeng Liu
35                 <mailto:xufeng.liu.ietf@gmail.com>";
36   description
37     "This module defines a common base data model for a collection
38      of nodes in a network.  Node definitions are further used
39      in network topologies and inventories.
40
41      Copyright (c) 2018 IETF Trust and the persons identified as
42      authors of the code.  All rights reserved.
43
44      Redistribution and use in source and binary forms, with or
45      without modification, is permitted pursuant to, and subject
46      to the license terms contained in, the Simplified BSD License
47      set forth in Section 4.c of the IETF Trust's Legal Provisions
48      Relating to IETF Documents
49      (https://trustee.ietf.org/license-info).
50
51      This version of this YANG module is part of RFC 8345;
52      see the RFC itself for full legal notices.";
53
54   revision 2018-02-26 {
55     description
56       "Initial revision.";
57     reference
58       "RFC 8345: A YANG Data Model for Network Topologies";
59   }
60
61   typedef node-id {
62     type inet:uri;
63     description
64       "Identifier for a node.  The precise structure of the node-id
65        will be up to the implementation.  For example, some
66        implementations MAY pick a URI that includes the network-id
67        as part of the path.  The identifier SHOULD be chosen
68        such that the same node in a real network topology will
69        always be identified through the same identifier, even if
70        the data model is instantiated in separate datastores.  An
71        implementation MAY choose to capture semantics in the
72        identifier -- for example, to indicate the type of node.";
73   }
74
75   typedef network-id {
76     type inet:uri;
77     description
78       "Identifier for a network.  The precise structure of the
79        network-id will be up to the implementation.  The identifier
80        SHOULD be chosen such that the same network will always be
81        identified through the same identifier, even if the data model
82        is instantiated in separate datastores.  An implementation MAY
83        choose to capture semantics in the identifier -- for example,
84        to indicate the type of network.";
85   }
86
87   grouping network-ref {
88     description
89       "Contains the information necessary to reference a network --
90        for example, an underlay network.";
91     leaf network-ref {
92       type leafref {
93         path "/nw:networks/nw:network/nw:network-id";
94       require-instance false;
95       }
96       description
97         "Used to reference a network -- for example, an underlay
98          network.";
99     }
100   }
101
102   grouping node-ref {
103     description
104       "Contains the information necessary to reference a node.";
105     leaf node-ref {
106       type leafref {
107         path "/nw:networks/nw:network[nw:network-id=current()/../"+
108           "network-ref]/nw:node/nw:node-id";
109         require-instance false;
110       }
111       description
112         "Used to reference a node.
113          Nodes are identified relative to the network that
114          contains them.";
115     }
116     uses network-ref;
117   }
118
119   container networks {
120     description
121       "Serves as a top-level container for a list of networks.";
122     list network {
123       key "network-id";
124       description
125         "Describes a network.
126          A network typically contains an inventory of nodes,
127          topological information (augmented through the
128          network-topology data model), and layering information.";
129       leaf network-id {
130         type network-id;
131         description
132           "Identifies a network.";
133       }
134       container network-types {
135         description
136           "Serves as an augmentation target.
137            The network type is indicated through corresponding
138            presence containers augmented into this container.";
139       }
140       list supporting-network {
141         key "network-ref";
142         description
143           "An underlay network, used to represent layered network
144            topologies.";
145         leaf network-ref {
146           type leafref {
147             path "/nw:networks/nw:network/nw:network-id";
148           require-instance false;
149           }
150           description
151             "References the underlay network.";
152         }
153       }
154
155       list node {
156         key "node-id";
157         description
158           "The inventory of nodes of this network.";
159         leaf node-id {
160           type node-id;
161           description
162             "Uniquely identifies a node within the containing
163              network.";
164         }
165         list supporting-node {
166           key "network-ref node-ref";
167           description
168             "Represents another node that is in an underlay network
169              and that supports this node.  Used to represent layering
170              structure.";
171           leaf network-ref {
172             type leafref {
173               path "../../../nw:supporting-network/nw:network-ref";
174             require-instance false;
175             }
176             description
177               "References the underlay network of which the
178                underlay node is a part.";
179           }
180           leaf node-ref {
181             type leafref {
182               path "/nw:networks/nw:network/nw:node/nw:node-id";
183             require-instance false;
184             }
185             description
186               "References the underlay node itself.";
187           }
188         }
189       }
190     }
191   }
192 }