Bug 2803 - Update SR
[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 2013-10-05; }
7     import pcep-message { prefix msg; revision-date 2013-10-07; }
8     import odl-pcep-ietf-stateful07 { prefix stateful; revision-date 2013-12-22; }
9     import odl-pcep-ietf-initiated00 { prefix crabbe; revision-date 2013-11-26; }
10     import ietf-inet-types { prefix inet; revision-date 2010-09-24; }
11     import network-topology { prefix nt; revision-date 2013-10-21; }
12     import network-topology-pcep { prefix pn; revision-date 2013-10-24; }
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         draft-ietf-pce-segment-routing-01.
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 "2015-01-12" {
29         description
30             "Upgrade from draft-sivabalan-pce-segment-routing-02.";
31         reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-01";
32     }
33
34     grouping sr-pce-capability-tlv {
35         description "SR-PCE-CAPABILITY TLV";
36         reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-01#section-5.1.1";
37
38         container sr-pce-capability {
39             uses pcep:tlv;
40             leaf msd {
41                 description "Maximum SID Depth";
42                 type uint8;
43                 default 0;
44             }
45         }
46     }
47
48     augment "/msg:open/msg:open-message/msg:open/msg:tlvs" {
49         reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-01#section-5.1";
50         uses sr-pce-capability-tlv;
51     }
52
53     augment "/msg:pcerr/msg:pcerr-message/msg:error-type/msg:session-case/msg:session/msg:open/msg:tlvs" {
54         reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-01#section-5.1";
55         uses sr-pce-capability-tlv;
56     }
57
58     typedef sid-type {
59         reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-01#section-5.3.1";
60         type enumeration {
61             enum ipv4-node-id {
62                 value 1;
63             }
64             enum ipv6-node-id {
65                 value 2;
66             }
67             enum ipv4-adjacency {
68                 value 3;
69             }
70             enum ipv6-adjacency {
71                 value 4;
72             }
73             enum unnumbered {
74                 value 5;
75             }
76         }
77     }
78
79     grouping sr-subobject {
80         description "Common grouping for both SR-ERO and SR-RRO subobjects as they share the same content representation.";
81         leaf c-flag {
82             type boolean;
83             default false;
84         }
85         leaf m-flag {
86             type boolean;
87             default false;
88         }
89         leaf sid-type {
90             type sid-type;
91         }
92         leaf sid {
93             description "Segment Identifier";
94             type uint32;
95         }
96         choice nai {
97             reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-01#section-5.3.2";
98             description "Node or Adjacency Identifier";
99             case ip-node-id {
100                 when "../sid-type = 'ipv4-node-id' or ../sid-type = 'ipv6-node-id'";
101                 description "IP Node ID";
102                 leaf ip-address {
103                     type inet:ip-address;
104                     mandatory true;
105                 }
106             }
107             case ip-adjacency {
108                 when "../sid-type = 'ipv4-adjacency' or ../sid-type = 'ipv6-adjacency'";
109                 description "IP Adjacency";
110                 leaf local-ip-address {
111                     type inet:ip-address;
112                     mandatory true;
113                 }
114                 leaf remote-ip-address {
115                     type inet:ip-address;
116                     mandatory true;
117                 }
118             }
119             case unnumbered-adjacency {
120                 when "../sid-type = 'unnumbered'";
121                 description "Unnumbered Adjacency with IPv4 NodeIDs";
122                 leaf local-node-id {
123                     type uint32;
124                     mandatory true;
125                 }
126                 leaf local-interface-id {
127                     type uint32;
128                     mandatory true;
129                 }
130                 leaf remote-node-id {
131                     type uint32;
132                     mandatory true;
133                 }
134                 leaf remote-interface-id {
135                     type uint32;
136                     mandatory true;
137                 }
138             }
139         }
140     }
141
142     // kept both groupings in case draft changes and they won't be equal
143     grouping sr-ero-subobject {
144         reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-01#section-5.3.1";
145         uses sr-subobject;
146     }
147
148     grouping sr-rro-subobject {
149         reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-01#section-5.4";
150         uses sr-subobject;
151     }
152
153     //ERO augmentations
154     augment "/msg:pcrep/msg:pcrep-message/msg:replies/msg:result/msg:success-case/msg:success/msg:paths/msg:ero/msg:subobject/msg:subobject-type" {
155         case sr-ero-type {
156             uses sr-ero-subobject;
157         }
158     }
159
160     //stateful07
161     augment "/crabbe:pcinitiate/crabbe:pcinitiate-message/crabbe:requests/crabbe:ero/crabbe:subobject/crabbe:subobject-type" {
162         case sr-ero-type {
163             uses sr-ero-subobject;
164         }
165     }
166
167     augment "/stateful:pcrpt/stateful:pcrpt-message/stateful:reports/stateful:path/stateful:ero/stateful:subobject/stateful:subobject-type" {
168         case sr-ero-type {
169             uses sr-ero-subobject;
170         }
171     }
172
173     augment "/stateful:pcupd/stateful:pcupd-message/stateful:updates/stateful:path/stateful:ero/stateful:subobject/stateful:subobject-type" {
174         case sr-ero-type {
175             uses sr-ero-subobject;
176         }
177     }
178
179     //nt-pcep
180     augment "/pn:add-lsp/pn:input/pn:arguments/pn:ero/pn:subobject/pn:subobject-type" {
181         case sr-ero-type {
182             uses sr-ero-subobject;
183         }
184     }
185
186     augment "/pn:update-lsp/pn:input/pn:arguments/pn:ero/pn:subobject/pn:subobject-type" {
187         case sr-ero-type {
188             uses sr-ero-subobject;
189         }
190     }
191
192     augment "/nt:network-topology/nt:topology/nt:node/pn:path-computation-client/pn:reported-lsp/pn:path/pn:ero/pn:subobject/pn:subobject-type" {
193         case sr-ero-type {
194             uses sr-ero-subobject;
195         }
196     }
197
198     //RRO augmentations
199     augment "/msg:pcreq/msg:pcreq-message/msg:requests/msg:segment-computation/msg:p2p/msg:reported-route/msg:rro/msg:subobject/msg:subobject-type" {
200         case sr-rro-type {
201             uses sr-rro-subobject;
202         }
203     }
204
205     augment "/msg:pcreq/msg:pcreq-message/msg:requests/msg:segment-computation/msg:p2p/msg:rro/msg:subobject/msg:subobject-type" {
206         case sr-rro-type {
207             uses sr-rro-subobject;
208         }
209     }
210
211     augment "/msg:pcrep/msg:pcrep-message/msg:replies/msg:result/msg:failure-case/msg:rro/msg:subobject/msg:subobject-type" {
212         case sr-rro-type {
213             uses sr-rro-subobject;
214         }
215     }
216
217     augment "/msg:pcrep/msg:pcrep-message/msg:replies/msg:result/msg:success-case/msg:success/msg:paths/msg:rro/msg:subobject/msg:subobject-type" {
218         case sr-rro-type {
219             uses sr-rro-subobject;
220         }
221     }
222
223     //stateful07
224     augment "/crabbe:pcinitiate/crabbe:pcinitiate-message/crabbe:requests/crabbe:rro/crabbe:subobject/crabbe:subobject-type" {
225         case sr-rro-type {
226             uses sr-rro-subobject;
227         }
228     }
229
230     augment "/stateful:pcrpt/stateful:pcrpt-message/stateful:reports/stateful:path/stateful:rro/stateful:subobject/stateful:subobject-type" {
231         case sr-rro-type {
232             uses sr-rro-subobject;
233         }
234     }
235
236     augment "/stateful:pcupd/stateful:pcupd-message/stateful:updates/stateful:path/stateful:rro/stateful:subobject/stateful:subobject-type" {
237         case sr-rro-type {
238             uses sr-rro-subobject;
239         }
240     }
241
242     //nt-pcep
243     augment "/pn:add-lsp/pn:input/pn:arguments/pn:rro/pn:subobject/pn:subobject-type" {
244         case sr-rro-type {
245             uses sr-rro-subobject;
246         }
247     }
248
249     augment "/pn:update-lsp/pn:input/pn:arguments/pn:rro/pn:subobject/pn:subobject-type" {
250         case sr-rro-type {
251             uses sr-rro-subobject;
252         }
253     }
254
255     augment "/nt:network-topology/nt:topology/nt:node/pn:path-computation-client/pn:reported-lsp/pn:path/pn:rro/pn:subobject/pn:subobject-type" {
256         case sr-rro-type {
257             uses sr-rro-subobject;
258         }
259     }
260 }