Clean up ShortestPathFirst
[bgpcep.git] / pcep / segment-routing / src / main / yang / odl-pcep-segment-routing.yang
1 module odl-pcep-segment-routing {
2     yang-version 1;
3     namespace "urn:opendaylight:params:xml:ns:yang:pcep:segment:routing";
4     prefix "pcep-sr";
5
6     import pcep-types { prefix pcep; revision-date 2018-11-09; }
7     import pcep-message { prefix msg; revision-date 2018-11-09; }
8     import odl-pcep-ietf-stateful { prefix stateful; revision-date 2020-07-20; }
9     import odl-pcep-ietf-initiated { prefix initiated; revision-date 2020-07-20; }
10     import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
11     import network-topology { prefix nt; revision-date 2013-10-21; }
12     import network-topology-pcep { prefix pn; revision-date 2022-07-30; }
13
14     organization "Cisco Systems, Inc.";
15     contact "Milos Fabian <milfabia@cisco.com>";
16
17     description
18         "This module contains the data model of PCEP Extensions for Segment Routing,
19         as defined in RFC 8664.
20
21         Copyright (c)2015 Cisco Systems, Inc. All rights reserved.
22
23         This program and the accompanying materials are made available
24         under the terms of the Eclipse Public License v1.0 which
25         accompanies this distribution, and is available at
26         http://www.eclipse.org/legal/epl-v10.html";
27
28     revision "2020-07-20" {
29         description "Update to RFC 8664";
30         reference "RFC8664: https://tools.ietf.org/html/rfc8664";
31     }
32
33     revision "2018-11-09" {
34         description
35             "P2MP extension.";
36         reference "RFC8306";
37     }
38
39     revision 2017-10-25 {
40         description "Update network-topology-pcep revision";
41     }
42
43     revision "2015-01-12" {
44         description
45             "Upgrade from draft-sivabalan-pce-segment-routing-02.";
46         reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-01";
47     }
48
49     grouping sr-pce-capability-tlv {
50         description "SR-PCE-CAPABILITY TLV";
51         reference "http://tools.ietf.org/html/rfc8664#section-4.1.2";
52
53         container sr-pce-capability {
54             uses pcep:tlv;
55             leaf n-flag {
56                 description "N flag used by a PCC to indicate that it is capable of resolving a NAI to a SID";
57                 type boolean;
58                 default false;
59             }
60             leaf x-flag {
61                 description " X flag used by a PCC to indicate that it does not impose any limit to the MSD";
62                 type boolean;
63                 default false;
64             }
65             leaf msd {
66                 description "Maximum SID Depth";
67                 type uint8;
68                 default 0;
69             }
70         }
71     }
72
73     augment "/msg:open/msg:open-message/msg:open/msg:tlvs" {
74         reference "http://tools.ietf.org/html/rfc4664#section-4.1";
75         uses sr-pce-capability-tlv;
76     }
77
78     augment "/msg:pcerr/msg:pcerr-message/msg:error-type/msg:session-case/msg:session/msg:open/msg:tlvs" {
79         reference "http://tools.ietf.org/html/rfc8664#section-5.1";
80         uses sr-pce-capability-tlv;
81     }
82
83     typedef nai-type {
84         reference "http://tools.ietf.org/html/rfc8664#section-4.3.1";
85         type enumeration {
86             enum ipv4-node-id {
87                 value 1;
88             }
89             enum ipv6-node-id {
90                 value 2;
91             }
92             enum ipv4-adjacency {
93                 value 3;
94             }
95             enum ipv6-adjacency {
96                 value 4;
97             }
98             enum unnumbered {
99                 value 5;
100             }
101             enum ipv6-local {
102                 value 6;
103             }
104         }
105     }
106
107     grouping sr-subobject {
108         description "Common grouping for both SR-ERO and SR-RRO subobjects as they share the same content representation.";
109         leaf nai-type {
110             description "Node or Adjacency Identifier Type (NT)";
111             type nai-type;
112         }
113         leaf m-flag {
114             description "If this bit is set to 1, the SID value represents an MPLS label stack entry";
115             type boolean;
116             default false;
117         }
118         leaf c-flag {
119             description "TC, S & TTL fields in the MPLS label are specified by the PCE if M & C are set to 1";
120             type boolean;
121             default false;
122         }
123         /* S-Flag is represented by the presence of the SID TLV: isSflag() is equivalent to getSid() != null */
124         leaf sid {
125             description "Segment Identifier";
126             type uint32;
127         }
128         /* F-Flag is represented by the presence of the NAI TLV: isFflag() is equivalent to getNai() != null */
129         choice nai {
130             reference "http://tools.ietf.org/html/rfc8664#section-4.3.2";
131             description "Node or Adjacency Identifier";
132             case ip-node-id {
133                 when "../nai-type = 'ipv4-node-id' or ../nai-type = 'ipv6-node-id'";
134                 description "IP Node ID";
135                 leaf ip-address {
136                     type inet:ip-address-no-zone;
137                     mandatory true;
138                 }
139             }
140             case ip-adjacency {
141                 when "../nai-type = 'ipv4-adjacency' or ../nai-type = 'ipv6-adjacency'";
142                 description "IP Adjacency";
143                 leaf local-ip-address {
144                     type inet:ip-address-no-zone;
145                     mandatory true;
146                 }
147                 leaf remote-ip-address {
148                     type inet:ip-address-no-zone;
149                     mandatory true;
150                 }
151             }
152             case unnumbered-adjacency {
153                 when "../nai-type = 'unnumbered'";
154                 description "Unnumbered Adjacency with IPv4 NodeIDs";
155                 leaf local-node-id {
156                     type uint32;
157                     mandatory true;
158                 }
159                 leaf local-interface-id {
160                     type uint32;
161                     mandatory true;
162                 }
163                 leaf remote-node-id {
164                     type uint32;
165                     mandatory true;
166                 }
167                 leaf remote-interface-id {
168                     type uint32;
169                     mandatory true;
170                 }
171             }
172             case ipv6-local {
173                 when "../nai-type = 'ipv6-local'";
174                 description "IPv6 adjacency with link-local IPv6 addresses";
175                 leaf local-ipv6-address {
176                     type inet:ipv6-address-no-zone;
177                     mandatory true;
178                 }
179                 leaf local-id {
180                     type uint32;
181                     mandatory true;
182                 }
183                 leaf remote-ipv6-address {
184                     type inet:ipv6-address-no-zone;
185                     mandatory true;
186                 }
187                 leaf remote-id {
188                     type uint32;
189                     mandatory true;
190                 }
191             }
192         }
193     }
194
195     // kept both groupings in case draft changes and they won't be equal
196     grouping sr-ero-subobject {
197         reference "http://tools.ietf.org/html/rfc8664#section-4.3";
198         /* L(oose)-flag is already present within the ERO subObject */
199         uses sr-subobject;
200     }
201
202     grouping sr-rro-subobject {
203         reference "http://tools.ietf.org/html/rfc8664#section-4.4";
204         uses sr-subobject;
205     }
206
207     //ERO augmentations
208     augment "/msg:pcrep/msg:pcrep-message/msg:replies/msg:result/msg:success-case/msg:success/msg:paths/msg:ero/msg:subobject/msg:subobject-type" {
209         case sr-ero-type {
210             uses sr-ero-subobject;
211         }
212     }
213
214     //stateful
215     augment "/initiated:pcinitiate/initiated:pcinitiate-message/initiated:requests/initiated:ero/initiated:subobject/initiated:subobject-type" {
216         case sr-ero-type {
217             uses sr-ero-subobject;
218         }
219     }
220
221     augment "/stateful:pcrpt/stateful:pcrpt-message/stateful:reports/stateful:path/stateful:ero/stateful:subobject/stateful:subobject-type" {
222         case sr-ero-type {
223             uses sr-ero-subobject;
224         }
225     }
226
227     augment "/stateful:pcupd/stateful:pcupd-message/stateful:updates/stateful:path/stateful:ero/stateful:subobject/stateful:subobject-type" {
228         case sr-ero-type {
229             uses sr-ero-subobject;
230         }
231     }
232
233     //nt-pcep
234     augment "/pn:add-lsp/pn:input/pn:arguments/pn:ero/pn:subobject/pn:subobject-type" {
235         case sr-ero-type {
236             uses sr-ero-subobject;
237         }
238     }
239
240     augment "/pn:update-lsp/pn:input/pn:arguments/pn:ero/pn:subobject/pn:subobject-type" {
241         case sr-ero-type {
242             uses sr-ero-subobject;
243         }
244     }
245
246     augment "/nt:network-topology/nt:topology/nt:node/pn:path-computation-client/pn:reported-lsp/pn:path/pn:ero/pn:subobject/pn:subobject-type" {
247         case sr-ero-type {
248             uses sr-ero-subobject;
249         }
250     }
251
252     //RRO augmentations
253     augment "/msg:pcreq/msg:pcreq-message/msg:requests/msg:segment-computation/msg:p2p/msg:reported-route/msg:rro/msg:subobject/msg:subobject-type" {
254         case sr-rro-type {
255             uses sr-rro-subobject;
256         }
257     }
258
259     augment "/msg:pcreq/msg:pcreq-message/msg:requests/msg:segment-computation/msg:p2p/msg:rro/msg:subobject/msg:subobject-type" {
260         case sr-rro-type {
261             uses sr-rro-subobject;
262         }
263     }
264
265     augment "/msg:pcrep/msg:pcrep-message/msg:replies/msg:result/msg:failure-case/msg:rro/msg:subobject/msg:subobject-type" {
266         case sr-rro-type {
267             uses sr-rro-subobject;
268         }
269     }
270
271     augment "/msg:pcrep/msg:pcrep-message/msg:replies/msg:result/msg:success-case/msg:success/msg:paths/msg:rro/msg:subobject/msg:subobject-type" {
272         case sr-rro-type {
273             uses sr-rro-subobject;
274         }
275     }
276
277     //stateful
278     augment "/initiated:pcinitiate/initiated:pcinitiate-message/initiated:requests/initiated:rro/initiated:subobject/initiated:subobject-type" {
279         case sr-rro-type {
280             uses sr-rro-subobject;
281         }
282     }
283
284     augment "/stateful:pcrpt/stateful:pcrpt-message/stateful:reports/stateful:path/stateful:rro/stateful:subobject/stateful:subobject-type" {
285         case sr-rro-type {
286             uses sr-rro-subobject;
287         }
288     }
289
290     augment "/stateful:pcupd/stateful:pcupd-message/stateful:updates/stateful:path/stateful:rro/stateful:subobject/stateful:subobject-type" {
291         case sr-rro-type {
292             uses sr-rro-subobject;
293         }
294     }
295
296     //nt-pcep
297     augment "/pn:add-lsp/pn:input/pn:arguments/pn:rro/pn:subobject/pn:subobject-type" {
298         case sr-rro-type {
299             uses sr-rro-subobject;
300         }
301     }
302
303     augment "/pn:update-lsp/pn:input/pn:arguments/pn:rro/pn:subobject/pn:subobject-type" {
304         case sr-rro-type {
305             uses sr-rro-subobject;
306         }
307     }
308
309     augment "/nt:network-topology/nt:topology/nt:node/pn:path-computation-client/pn:reported-lsp/pn:path/pn:rro/pn:subobject/pn:subobject-type" {
310         case sr-rro-type {
311             uses sr-rro-subobject;
312         }
313     }
314 }