c08339c28b3409c48d56592e816e275faf3bbb40
[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-00.
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-00";
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-00#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-00#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-00#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-00#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         leaf sid-type {
81             type sid-type;
82         }
83
84         leaf sid {
85             description "Segment Identifier";
86             type uint32;
87         }
88
89         choice nai {
90             reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-00#section-5.3.2";
91             description "Node or Adjacency Identifier";
92             case ip-node-id {
93                 when "../sid-type = 'ipv4-node-id' or ../sid-type = 'ipv6-node-id'";
94                 description "IP Node ID";
95                 leaf ip-address {
96                     type inet:ip-address;
97                     mandatory true;
98                 }
99             }
100             case ip-adjacency {
101                 when "../sid-type = 'ipv4-adjacency' or ../sid-type = 'ipv6-adjacency'";
102                 description "IP Adjacency";
103                 leaf local-ip-address {
104                     type inet:ip-address;
105                     mandatory true;
106                 }
107                 leaf remote-ip-address {
108                     type inet:ip-address;
109                     mandatory true;
110                 }
111             }
112             case unnumbered-adjacency {
113                 when "../sid-type = 'unnumbered'";
114                 description "Unnumbered Adjacency with IPv4 NodeIDs";
115                 leaf local-node-id {
116                     type uint32;
117                     mandatory true;
118                 }
119                 leaf local-interface-id {
120                     type uint32;
121                     mandatory true;
122                 }
123                 leaf remote-node-id {
124                     type uint32;
125                     mandatory true;
126                 }
127                 leaf remote-interface-id {
128                     type uint32;
129                     mandatory true;
130                 }
131             }
132         }
133     }
134
135     grouping sr-ero-subobject {
136         reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-00#section-5.3.1";
137         leaf c-flags {
138             type boolean;
139             default false;
140         }
141         leaf m-flag {
142             type boolean;
143             default false;
144         }
145         uses sr-subobject;
146     }
147
148     grouping sr-rro-subobject {
149         reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-00#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 }