a61cdafa86d1be0259b040d36c9e88c2523047f0
[bgpcep.git] / pcep / ietf-stateful07 / src / main / yang / odl-pcep-ietf-stateful07.yang
1 module odl-pcep-ietf-stateful07 {
2     yang-version 1;
3     namespace "urn:opendaylight:params:xml:ns:yang:pcep:ietf:stateful";
4     prefix "stateful";
5
6     import ietf-inet-types { prefix inet; revision-date 2010-09-24; }
7     import network-topology { prefix nt; revision-date 2013-10-21; }
8     import network-topology-pcep { prefix topo; revision-date 2013-10-24; }
9     import pcep-types { prefix pcep; revision-date 2013-10-05; }
10     import pcep-message { prefix msg; revision-date 2013-10-07; }
11     import rsvp { prefix rsvp; revision-date 2015-08-20; }
12     import topology-tunnel { prefix tt; revision-date 2013-08-19; }
13     import topology-tunnel-pcep { prefix tun; revision-date 2013-08-20; }
14     import topology-tunnel-pcep-programming { prefix ttpp; revision-date 2013-10-30; }
15     import yang-ext { prefix ext; revision-date 2013-07-09; }
16
17     organization "Cisco Systems, Inc.";
18     contact "Robert Varga <rovarga@cisco.com>";
19
20     description
21         "This module contains the data model of PCEP extensions defined
22         in draft-ietf-pce-stateful-pce.
23
24         Copyright (c)2013 Cisco Systems, Inc. All rights reserved.
25
26         This program and the accompanying materials are made available
27         under the terms of the Eclipse Public License v1.0 which
28         accompanies this distribution, and is available at
29         http://www.eclipse.org/legal/epl-v10.html";
30
31     revision "2013-12-22" {
32         description
33             "Initial revision.";
34         reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07";
35     }
36
37     typedef operational-status {
38         type enumeration {
39             enum down {
40                 value 0;
41             }
42             enum up {
43                 value 1;
44             }
45             enum active {
46                 value 2;
47             }
48             enum going-down {
49                 value 3;
50             }
51             enum going-up {
52                 value 4;
53             }
54         }
55     }
56
57     typedef plsp-id {
58         type uint32 {
59             range 0..1048576;
60         }
61     }
62
63     typedef srp-id-number {
64         type uint32 {
65             range 0..4294967294;
66         }
67     }
68
69     typedef symbolic-path-name {
70         type binary {
71             length 1..65535;
72         }
73     }
74
75     grouping path-binding-tlv {
76         reference "https://tools.ietf.org/html/draft-sivabalan-pce-binding-label-sid-00#section-3";
77         container path-binding {
78             uses pcep:tlv;
79             leaf binding-type {
80                 type uint8;
81             }
82             leaf binding-value {
83                 type binary {
84                     length 0..255;
85                 }
86             }
87         }
88     }
89
90     grouping lsp-identifiers-tlv {
91         description "LSP Identifiers TLV";
92         reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-7.3.1";
93         container lsp-identifiers {
94             uses pcep:tlv;
95             leaf lsp-id {
96                 type rsvp:lsp-id;
97             }
98
99             leaf tunnel-id {
100                 type rsvp:tunnel-id;
101             }
102
103             choice address-family {
104                 case ipv4-case {
105                     container ipv4 {
106                         leaf ipv4-tunnel-sender-address {
107                             type inet:ipv4-address;
108                             mandatory true;
109                         }
110                         leaf ipv4-extended-tunnel-id {
111                             type rsvp:ipv4-extended-tunnel-id;
112                             mandatory true;
113                         }
114                         leaf ipv4-tunnel-endpoint-address {
115                             type inet:ipv4-address;
116                             mandatory true;
117                         }
118                     }
119                 }
120                 case ipv6-case {
121                     container ipv6 {
122                         leaf ipv6-tunnel-sender-address {
123                             type inet:ipv6-address;
124                             mandatory true;
125                         }
126                         leaf ipv6-extended-tunnel-id {
127                             type rsvp:ipv6-extended-tunnel-id;
128                             mandatory true;
129                         }
130                         leaf ipv6-tunnel-endpoint-address {
131                             type inet:ipv6-address;
132                             mandatory true;
133                         }
134                     }
135                 }
136             }
137         }
138     }
139
140     grouping lsp-error-code-tlv {
141         description "LSP Error Code TLV";
142         reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-7.3.3";
143         container lsp-error-code {
144             uses pcep:tlv;
145             leaf error-code {
146                 type uint32;
147             }
148         }
149     }
150
151     grouping rsvp-error-spec-tlv {
152         description "RSVP Error Spec TLV";
153         reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-7.3.4";
154         container rsvp-error-spec {
155             uses pcep:tlv;
156             choice error-type {
157                 case rsvp-case {
158                     container rsvp-error {
159                         uses rsvp:error-spec;
160                     }
161                 }
162                 case user-case {
163                     container user-error {
164                         uses rsvp:user-error-spec;
165                     }
166                 }
167             }
168         }
169     }
170
171     grouping stateful-capability-tlv {
172         description "Stateful PCE Capability TLV";
173         reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-7.1.1";
174
175         container stateful {
176             uses pcep:tlv;
177
178             leaf lsp-update-capability {
179                 type boolean;
180                 default false;
181             }
182         }
183     }
184
185     grouping symbolic-path-name-tlv {
186         description "Symbolic Path Name TLV";
187         reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-7.3.2";
188         container symbolic-path-name {
189             uses pcep:tlv;
190             leaf path-name {
191                 type symbolic-path-name;
192             }
193         }
194     }
195
196     grouping lsp-object {
197         description "LSP Object";
198         reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-7.3";
199
200         container lsp {
201             uses pcep:object;
202             container "tlvs" {
203                 uses lsp-error-code-tlv;
204
205                 uses lsp-identifiers-tlv;
206
207                 uses rsvp-error-spec-tlv;
208
209                 uses symbolic-path-name-tlv;
210
211                 uses pcep:vs-tlv;
212
213                 uses pcep:vendor-information-tlvs;
214
215                 uses path-binding-tlv;
216             }
217
218             leaf plsp-id {
219                 type plsp-id;
220             }
221
222             leaf delegate {
223                 type boolean;
224                 default false;
225             }
226
227             leaf sync {
228                 type boolean;
229                 default false;
230             }
231
232             leaf remove {
233                 type boolean;
234                 default false;
235             }
236
237             leaf administrative {
238                 type boolean;
239                 default false;
240             }
241
242             leaf operational {
243                 type operational-status;
244             }
245         }
246     }
247
248     grouping srp-object {
249         description "SRP Object";
250         reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-7.2";
251
252         container srp {
253             uses pcep:object;
254
255             container "tlvs" {
256                 uses symbolic-path-name-tlv;
257
258                 uses pcep:vendor-information-tlvs;
259
260                 uses pcep:path-setup-type-tlv;
261             }
262
263             leaf operation-id {
264                 type srp-id-number;
265                 mandatory true;
266             }
267         }
268     }
269
270     grouping pcupd-message {
271         uses pcep:message;
272
273         container pcupd-message {
274             description "State Update Request Message";
275             reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-6.2";
276
277             uses pcep:message-header;
278
279             list updates {
280                 uses srp-object;
281
282                 uses lsp-object;
283
284                 container path {
285                     uses pcep:path-definition;
286                 }
287             }
288         }
289     }
290
291     grouping pcrpt-message {
292         uses pcep:message;
293
294         container pcrpt-message {
295             description "State Report Message";
296             reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-6.1";
297
298             uses pcep:message-header;
299
300             list reports {
301                 uses srp-object;
302
303                 uses lsp-object;
304
305                 container path {
306                     uses pcep:path-definition;
307                 }
308             }
309         }
310     }
311
312     notification pcupd {
313         uses pcupd-message;
314     }
315
316     notification pcrpt {
317         uses pcrpt-message;
318     }
319
320     augment "/msg:open/msg:open-message/msg:open/msg:tlvs" {
321         uses stateful-capability-tlv;
322         ext:augment-identifier tlvs-1;
323     }
324
325     augment "/msg:pcrep/msg:pcrep-message/msg:replies/msg:result/msg:failure-case/msg:lspa/msg:tlvs" {
326         uses symbolic-path-name-tlv;
327         ext:augment-identifier tlvs-4;
328     }
329
330     augment "/msg:pcerr/msg:pcerr-message/msg:error-type" {
331         reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-6.3";
332         case stateful-case {
333             container stateful {
334                 list srps {
335                     uses srp-object;
336                 }
337             }
338         }
339     }
340
341     augment "/msg:pcreq/msg:pcreq-message/msg:requests/msg:segment-computation/msg:p2p/msg:lspa/msg:tlvs" {
342         uses symbolic-path-name-tlv;
343         ext:augment-identifier tlvs-2;
344     }
345
346     augment "/msg:pcerr/msg:pcerr-message/msg:error-type/msg:session-case/msg:session/msg:open/msg:tlvs" {
347         uses stateful-capability-tlv;
348         ext:augment-identifier tlvs-3;
349     }
350
351     augment "/nt:network-topology/nt:topology/nt:node/topo:path-computation-client/topo:reported-lsp/topo:path" {
352         uses lsp-object;
353         uses pcep:path-setup-type-tlv;
354     }
355
356     augment "/nt:network-topology/nt:topology/nt:node/topo:path-computation-client/topo:stateful-tlv" {
357         uses stateful-capability-tlv;
358     }
359
360     augment "/topo:ensure-lsp-operational/topo:input/topo:arguments" {
361         ext:augment-identifier arguments-1;
362         leaf operational {
363             type operational-status;
364         }
365     }
366
367     augment "/topo:add-lsp/topo:input/topo:arguments" {
368         ext:augment-identifier arguments-2;
369         uses lsp-object;
370         uses pcep:path-setup-type-tlv;
371     }
372
373     augment "/topo:update-lsp/topo:input/topo:arguments" {
374         ext:augment-identifier arguments-3;
375         uses lsp-object;
376         uses pcep:path-setup-type-tlv;
377     }
378
379     typedef administrative-status {
380         type enumeration {
381             enum active;
382             enum inactive;
383         }
384         reference "https://tools.ietf.org/html/draft-ietf-pce-stateful-pce-07#section-7.3";
385     }
386
387     grouping cfg-attributes {
388         leaf administrative-status {
389             type administrative-status;
390         }
391     }
392
393     grouping oper-attributes {
394         leaf operational-status {
395             type operational-status;
396             config false;
397         }
398     }
399
400     augment "/nt:network-topology/nt:topology/nt:link" {
401         when "../../tunnel-types/pcep-tunnel";
402
403         uses cfg-attributes;
404         uses oper-attributes;
405     }
406
407     augment "/nt:network-topology/nt:topology/tt:paths" {
408         when "../../tunnel-types/pcep-tunnel";
409
410         uses cfg-attributes;
411         uses oper-attributes;
412     }
413
414     augment "/ttpp:pcep-create-p2p-tunnel/ttpp:input" {
415         uses cfg-attributes;
416     }
417
418     augment "/ttpp:pcep-update-tunnel/ttpp:input" {
419         uses cfg-attributes;
420     }
421 }
422