Graph modelisation for Path Computation Algorithm
[bgpcep.git] / graph / graph-api / src / main / yang / graph.yang
1 module graph {
2     yang-version 1;
3     namespace "urn:opendaylight:params:xml:ns:yang:graph";
4     prefix "graph";
5
6     import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
7     import odl-uint24 { prefix uint24; }
8
9     organization "Orange";
10     contact "Philippe Niger <philippe.niger@orange.com>";
11
12     description
13         "This module contains the graph data model for network topology and datastore
14          used in the Path Computation Algorithms.
15
16         Copyright (c)2019 Orange. All rights reserved.
17
18         This program and the accompanying materials are made available
19         under the terms of the Eclipse Public License v1.0 which
20         accompanies this distribution, and is available at
21         http://www.eclipse.org/legal/epl-v10.html";
22
23     revision "2019-11-25" {
24         description
25              "Initial revision.";
26         reference "";
27     }
28
29     typedef delay {
30         description "Link delay is in the range 0 - 16.777215 seconds. Larger value is also encoded with Max value.";
31         units "microseconds";
32         type uint24:uint24;
33     }
34
35     typedef loss {
36         description "Link loss is in the range 0 - 50.331642% (= 2^24 - 2). Larger value is also encoded with Max value.";
37         units "0.000003%";
38         type uint24:uint24;
39     }
40
41     typedef decimal-bandwidth {
42         description "Bandwidth in decimal format for easy comparison";
43         units "bytes/second";
44         type decimal64 {
45             fraction-digits 2;
46         }
47     }
48
49     grouping edge-attributes {
50         description "Attributes associated with the Edge";
51         reference "RFC 3630 & RFC 7471, RFC 3784 & RFC8570: OSPF / IS-IS Traffic Engineering (TE) & Extended Metrics";
52
53         leaf metric {
54             description "Standard Metric from the routing protocol";
55             type uint32;
56         }
57         leaf te-metric {
58             description "Traffic Engineering Metric";
59             type uint32;
60         }
61         leaf admin-group {
62             description "Administrative group or color of the link";
63             type uint32;
64         }
65         leaf local-address {
66             type inet:ip-address;
67         }
68         leaf remote-address {
69             type inet:ip-address;
70         }
71         leaf local-identifier {
72             type uint32;
73         }
74         leaf remote-identifier {
75             type uint32;
76         }
77         leaf max-link-bandwidth {
78             description "Maximum bandwidth that can be use";
79             type decimal-bandwidth;
80         }
81         leaf max-resv-link-bandwidth {
82             description "Maximum amount of bandwidth that can be reserved";
83             type decimal-bandwidth;
84         }
85         list unreserved-bandwidth {
86             description "Unreserved bandwidth for 0-7 class type";
87             max-elements "8";
88             ordered-by user;
89             key "class-type";
90             leaf class-type {
91                 type uint8 {
92                     range "0..7";
93                 }
94             }
95             leaf bandwidth {
96                 description "Unreserved bandwidth for this class type";
97                 type decimal-bandwidth;
98             }
99         }
100         leaf delay {
101             description "Unidirectional Delay.";
102             type delay;
103         }
104         container min-max-delay {
105             description "Min/Max Unidirectional Delay";
106             leaf min-delay {
107                 type delay;
108             }
109             leaf max-delay {
110                 type delay;
111             }
112         }
113         leaf jitter {
114             description "Unidirectional Delay Variation";
115             type delay;
116         }
117         leaf loss {
118             description "Unidirectional Loss";
119             type loss;
120         }
121         leaf residual-bandwidth {
122             description "Unidirectional Residual Bandwidth";
123             type decimal-bandwidth;
124         }
125         leaf available-bandwidth {
126             description "Unidirectional Available Bandwidth";
127             type decimal-bandwidth;
128         }
129         leaf utilized-bandwidth {
130             description "Unidirectional Utilized Bandwidth";
131             type decimal-bandwidth;
132         }
133         leaf adj-sid {
134             description "Segment Routing Adjacency Identifier";
135             units "MPLS label";
136             type uint32;
137         }
138         leaf backup-adj-sid {
139             description "Segment Routing Backup Adjacency Identifier";
140             units "MPLS label";
141             type uint32;
142         }
143         leaf-list srlgs {
144             description "List of Shared Risk Link Group Attributes";
145             type uint32;
146         }
147     }
148
149     grouping edge {
150         description "Unidirectional Edge (link) representation for the network topology";
151         leaf edge-id {
152             type uint64;
153             mandatory true;
154         }
155         leaf local-vertex-id {
156             description "Vertex identifier where the Edge is attached";
157             type uint64;
158         }
159         leaf remote-vertex-id {
160             description "Vertex identifier where the Edge is going to";
161             type uint64;
162         }
163         leaf name {
164             description "Edge name";
165             type string;
166         }
167         container edge-attributes {
168             description "All attributes associated to the Edge";
169             uses edge-attributes;
170         }
171     }
172
173     grouping srgb {
174         description "Segment Routing Global Block: lower-bound + range-size";
175         leaf lower-bound {
176             description "Lower bound of label range in SRGB. Unit MPLS label";
177             type uint32;
178         }
179         leaf range-size {
180             description "Label range size in SRGB. Unit MPLS label";
181             type uint32;
182         }
183     }
184
185     grouping vertex {
186         description "Vertex (node) representation for the network topology";
187         leaf vertex-id {
188             description "Identifier of the Vertex";
189             type uint64;
190             mandatory true;
191         }
192         leaf name {
193             description "Name of the Vertex when known";
194             type string;
195         }
196         leaf router-id {
197             description "Global unique IP Trafic Engineering Router ID";
198             type inet:ip-address;
199         }
200         leaf vertex-type {
201             type enumeration {
202                 enum standard {
203                     value 0;
204                 }
205                 enum abr {
206                     value 1;
207                 }
208                 enum asbr-in {
209                     value 2;
210                 }
211                 enum asbr-out {
212                     value 3;
213                 }
214                 enum pseudo {
215                     value 4;
216                 }
217             }
218             default standard;
219         }
220         container srgb {
221             description "Segment Routing Global Block";
222             uses srgb;
223         }
224         leaf asn {
225             description "AS Number";
226             type uint32;
227         }
228     }
229
230     grouping prefix {
231         leaf prefix {
232             description "IP (v4 or v6) Prefix.";
233             type inet:ip-prefix;
234             mandatory true;
235         }
236         leaf prefix-sid {
237             description "Segment Routing prefix Identifier. Unit MPLS label";
238             type uint32;
239         }
240         leaf node-sid {
241             description "Prefix is a Node Segment Routing Identifier (Node-SID)";
242             type boolean;
243         }
244         leaf vertex-id {
245             description "Reference to the Vertex where the prefix is attached";
246             type uint64;
247         }
248     }
249
250     container graph-topology {
251         list graph {
252             description "Graph representation of the Network Topology";
253             key "name";
254             leaf name {
255                 type string;
256             }
257             leaf domain-scope {
258                 description "Network domain scope: intra or inter domain";
259                 type enumeration {
260                     enum intra-domain {
261                         value 1;
262                     }
263                     enum inter-domain {
264                         value 2;
265                     }
266                 }
267                 default intra-domain;
268             }
269             leaf asn {
270                 description "AS Number";
271                 type uint32;
272             }
273             list vertex {
274                 description "The list of Vertices defined for the Graph.";
275                 key "vertex-id";
276                 uses vertex;
277             }
278             list edge {
279                 description "The list of Edges defined for the Graph.";
280                 key "edge-id";
281                 uses edge;
282             }
283             list prefix {
284                 description "The list of prefixes for the Graph.";
285                 key "prefix";
286                 uses prefix;
287             }
288         }
289     }
290 }
291