Merge "Fix junit dependencies in poms. Reuse existing from parent, add missing ones."
[bgpcep.git] / bgp / linkstate / src / main / yang / bgp-linkstate.yang
1 module bgp-linkstate {
2         yang-version 1;
3         namespace "urn:opendaylight:params:xml:ns:yang:bgp-linkstate";
4         prefix "bgp-ls";
5
6         import  ietf-inet-types {
7                 prefix inet;
8                 revision-date 2010-09-24;
9         }
10         import bgp-message { prefix bgp-msg; }
11         import bgp-multiprotocol { prefix bgp-mp; }
12         import bgp-rib { prefix bgp-rib; }
13         import bgp-types { prefix bgp-t; }
14         import nps-concepts { prefix nps-c;}
15         import rsvp { prefix rsvp; revision-date 2013-08-20; }
16
17         organization "Cisco Systems, Inc.";
18         contact "Dana Kutenicsova <dkutenic@cisco.com>";
19
20         description
21                 "This module contains the base data model of a BGP message.
22                 It rolls up the definitions contained in RFC4271
23                 and draft-ietf-idr-ls-distribution-03.
24
25                 Copyright (c)2013 Cisco Systems, Inc. All rights reserved.
26
27                 This program and the accompanying materials are made available
28                 under the terms of the Eclipse Public License v1.0 which
29                 accompanies this distribution, and is available at
30                 http://www.eclipse.org/legal/epl-v10.html";
31
32         revision "2013-09-18" {
33                 description
34                         "Initial revision.";
35                 reference "draft-ietf-idr-ls-distribution-03";
36         }
37
38         identity linkstate-address-family {
39                 reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2";
40
41                 base bgp-t:address-family;
42         }
43
44         identity linkstate-subsequent-address-family {
45                 reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2";
46
47                 base bgp-t:subsequent-address-family;
48         }
49
50         typedef nlri-type {
51                 reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2";
52                 type enumeration {
53                         enum node {
54                                 value 1;
55                         }
56                         enum link {
57                                 value 2;
58                         }
59                         enum ipv4-prefix {
60                                 value 3;
61                         }
62                         enum ipv6-prefix {
63                                 value 4;
64                         }
65                 }
66         }
67
68         typedef protocol-id {
69                 reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2";
70                 type enumeration {
71                         enum unknown {
72                                 value 0;
73                         }
74                         enum isis-level1 {
75                                 value 1;
76                         }
77                         enum isis-level2 {
78                                 value 2;
79                         }
80                         enum ospf {
81                                 value 3;
82                         }
83                         enum direct {
84                                 value 4;
85                         }
86                         enum static {
87                                 value 5;
88                         }
89                 }
90         }
91
92         typedef ospf-route-type {
93                 reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.3.1";
94                 type enumeration {
95                         enum intra-area {
96                                 value 1;
97                         }
98                         enum inter-area {
99                                 value 2;
100                         }
101                         enum external1 {
102                                 value 3;
103                         }
104                         enum external2 {
105                                 value 4;
106                         }
107                         enum nssa1 {
108                                 value 5;
109                         }
110                         enum nssa2 {
111                                 value 6;
112                         }
113                 }
114         }
115
116         typedef route-distinguisher {
117                 type uint64;
118         }
119
120         typedef identifier {
121                 type uint64;
122         }
123
124         typedef domain-identifier {
125                 reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
126                 type binary {
127                         length "4";
128                 }
129         }
130
131         typedef area-identifier {
132                 reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
133                 type binary {
134                         length "4";
135                 }
136         }
137
138         typedef ipv4-interface-identifier {
139                 reference "http://tools.ietf.org/html/rfc5305#section-3.2";
140                 type inet:ipv4-address;
141         }
142
143         typedef ipv6-interface-identifier {
144                 reference "http://tools.ietf.org/html/rfc6119#section-4.2";
145                 type inet:ipv6-address;
146         }
147
148         typedef ospf-interface-identifier {
149                 reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
150                 type binary {
151                         length "4";
152                 }
153         }
154
155         typedef topology-identifier {
156                 reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.5";
157                 type uint16 {
158                         range "0..4095";
159                 }
160         }
161
162
163         grouping isis-router-identifier {
164                 reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
165                 leaf iso-system-id {
166                         type nps-c:iso-system-identifier;
167                         mandatory true;
168                 }
169         }
170
171         grouping isis-lan-identifier {
172                 reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
173                 container is-is-router-identifier {
174                         uses isis-router-identifier;
175                 }
176                 leaf psn {
177                         type uint8 {
178                                 range "1..255";
179                         }
180                         mandatory true;
181                 }
182         }
183
184         grouping ospf-router-identifier {
185                 reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
186                 leaf ospf-router-id {
187                         type binary {
188                                 length "4";
189                         }
190                         mandatory true;
191                 }
192         }
193
194         grouping ospf-v2-lan-identifier {
195                 reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
196                 uses ospf-router-identifier;
197                 leaf ipv4-address {
198                         type ipv4-interface-identifier;
199                         mandatory true;
200                 }
201         }
202
203         grouping ospf-v3-lan-identifier {
204                 reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2.1.4";
205                 uses ospf-router-identifier;
206                 leaf lan-interface {
207                         type ospf-interface-identifier;
208                         mandatory true;
209                 }
210         }
211
212         grouping node-identifier {
213                 leaf as-number {
214                         type inet:as-number;
215                 }
216                 leaf area-id {
217                         type area-identifier;
218                 }
219                 leaf domain-id {
220                         type domain-identifier;
221                 }
222                 choice c-router-identifier {
223                         case c-isis-node {
224                                 container isis-node {
225                                         uses isis-router-identifier;
226                                 }
227                         }
228
229                         case c-isis-pseudonode {
230                                 container isis-pseudonode {
231                                         uses isis-lan-identifier;
232                                 }
233                         }
234
235                         case c-ospf-node {
236                                 container ospf-node {
237                                         uses ospf-router-identifier;
238                                 }
239                         }
240
241                         case c-ospf-pseudonode {
242                                 container ospf-pseudonode {
243                                         uses ospf-v3-lan-identifier;
244                                 }
245                         }
246                 }
247         }
248
249         grouping link-identifiers {
250                 reference "http://tools.ietf.org/html/rfc5307";
251                 leaf link-local-identifier {
252                         type binary {
253                                 length "4";
254                         }
255                 }
256                 leaf link-remote-identifier {
257                         type binary {
258                                 length "4";
259                         }
260                 }
261         }
262
263         grouping linkstate-destination {
264                 list c-linkstate-destination {
265                         leaf nlri-type {
266                                 type nlri-type;
267                         }
268                         leaf distinguisher {
269                                 type route-distinguisher;
270                         }
271                         leaf protocol-id {
272                                 type protocol-id;
273                         }
274                         leaf identifier {
275                                 type identifier;
276                         }
277                         container local-node-descriptors {
278                                 uses node-identifier;
279                         }
280                         container remote-node-descriptors {
281                                 when "../nlri-type = link";
282                                 uses node-identifier;
283                         }
284                         container link-descriptors {
285                                 when "../nlri-type = link";
286                                 uses link-identifiers;
287                                 leaf ipv4-interface-address {
288                                         type ipv4-interface-identifier;
289                                 }
290                                 leaf ipv6-interface-address {
291                                         type ipv6-interface-identifier;
292                                 }
293                                 leaf ipv4-neighbor-address {
294                                         type ipv4-interface-identifier;
295                                 }
296                                 leaf ipv6-neighbor-address {
297                                         type ipv6-interface-identifier;
298                                 }
299                                 leaf multi-topology-id {
300                                         type topology-identifier;
301                                 }
302                         }
303                         container prefix-descriptors {
304                                 when "../nlri-type = 'ipv4-prefix' or ../nlri-type = 'ipv6-prefix'";
305                                 leaf multi-topology-id {
306                                         type topology-identifier;
307                                 }
308                                 leaf ospf-route-type {
309                                         when "../protocol-id = 'ospf'";
310                                         type ospf-route-type;
311                                 }
312                                 leaf ip-reachability-information {
313                                         type inet:ip-prefix;
314                                 }
315                         }
316                 }
317         }
318
319         augment "/bgp-msg:update/bgp-msg:path-attributes/bgp-mp:mp-reach-nlri/bgp-mp:advertized-routes/bgp-mp:destination-type" {
320                 case destination-linkstate {
321                         uses linkstate-destination;
322                 }
323         }
324
325         augment "/bgp-msg:update/bgp-msg:path-attributes/bgp-mp:mp-unreach-nlri/bgp-mp:withdrawn-routes/bgp-mp:destination-type" {
326                 case destination-linkstate {
327                         uses linkstate-destination;
328                 }
329         }
330
331         typedef node-flag-bits {
332                 reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.3.1.1";
333                 type bits {
334                         bit overload {
335                                 position 0;
336                         }
337                         bit attached {
338                                 position 1;
339                         }
340                         bit external {
341                                 position 2;
342                         }
343                         bit abr {
344                                 position 3;
345                         }
346                 }
347         }
348
349         typedef isis-area-identifier {
350                 reference "https://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.3.1.2";
351                 type binary {
352                         length "20";
353                 }
354         }
355
356         typedef ipv4-router-identifier {
357                 reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.3.1.4";
358                 type inet:ipv4-address;
359         }
360
361         typedef ipv6-router-identifier {
362                 reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.3.1.4";
363                 type inet:ipv6-address;
364         }
365
366         grouping node-state {
367                 reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.3.1";
368                 leaf-list topology-identifier {
369                         type topology-identifier;
370                 }
371                 leaf node-flags {
372                         type node-flag-bits;
373                 }
374                 leaf-list isis-area-id {
375                         type isis-area-identifier;
376                 }
377                 leaf dynamic-hostname {
378                         type string;
379                 }
380                 leaf ipv4-router-id {
381                         type ipv4-router-identifier;
382                 }
383                 leaf ipv6-router-id {
384                         type ipv6-router-identifier;
385                 }
386         }
387
388         typedef link-protection-type {
389                 reference "http://tools.ietf.org/html/rfc5307#section-1.2";
390                 type enumeration {
391                         enum extra-traffix {
392                                 value 1;
393                         }
394                         enum unprotected {
395                                 value 2;
396                         }
397                         enum shared {
398                                 value 4;
399                         }
400                         enum dedicated-1to1 {
401                                 value 8;
402                         }
403                         enum dedicated-1plus1 {
404                                 value 16;
405                         }
406                         enum enhanced {
407                                 value 32;
408                         }
409                 }
410         }
411
412         // linkstate
413         typedef mpls-protocol-mask {
414                 reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.3.2.2";
415                 type bits {
416                         bit ldp {
417                                 position 0;
418                         }
419                         bit rsvpte {
420                                 position 1;
421                         }
422                 }
423         }
424
425         typedef administrative-group {
426                 type uint32;
427         }
428
429         grouping unreserved-bandwidth {
430                 leaf priority {
431                         type uint8 {
432                                 range "0..7";
433                         }
434                 }
435                 leaf bandwidth {
436                         type nps-c:bandwidth;
437                 }
438         }
439
440         grouping link-state {
441                 reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.3.2";
442                 leaf local-ipv4-router-id {
443                         type ipv4-router-identifier;
444                 }
445                 leaf local-ipv6-router-id {
446                         type ipv6-router-identifier;
447                 }
448                 leaf remote-ipv4-router-id {
449                         type ipv4-router-identifier;
450                 }
451                 leaf remote-ipv6-router-id {
452                         type ipv6-router-identifier;
453                 }
454                 leaf mpls-protocol {
455                         type mpls-protocol-mask;
456                 }
457                 leaf te-metric {
458                         type nps-c:te-metric;
459                 }
460                 leaf metric {
461                         type nps-c:metric;
462                 }
463                 leaf-list shared-risk-link-groups {
464                         type rsvp:srlg-id;
465                 }
466                 leaf link-name {
467                         type string;
468                 }
469                 leaf max-link-bandwidth {
470                         type nps-c:bandwidth;
471                 }
472                 leaf max-reservable-bandwidth {
473                         type nps-c:bandwidth;
474                 }
475                 list unreserved-bandwidth {
476                         key "priority";
477                         uses unreserved-bandwidth;
478                 }
479                 leaf link-protection {
480                         type link-protection-type;
481                 }
482                 leaf admin-group {
483                         type administrative-group;
484                 }
485         }
486
487         typedef route-tag {
488                 reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.3.3.2";
489                 type binary {
490                         length "4";
491                 }
492         }
493
494         typedef extended-route-tag {
495                 reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.3.3.3";
496                 type binary {
497                         length "8";
498                 }
499         }
500
501         grouping igp-bits {
502                 reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.3.3.1";
503                 leaf up-down {
504                         type bits {
505                                 bit up-down {
506                                         position 0;
507                                 }
508                         }
509                 }
510         }
511
512         grouping prefix-state {
513                 container igp-bits {
514                         uses igp-bits;
515                 }
516                 leaf-list route-tags {
517                         type route-tag;
518                 }
519                 leaf-list extended-tags {
520                         type extended-route-tag;
521                 }
522                 leaf prefix-metric {
523                         type nps-c:igp-metric;
524                 }
525                 leaf ospf-forwarding-address {
526                         type inet:ipv4-address;
527                 }
528         }
529
530         augment "/bgp-msg:update/bgp-msg:path-attributes" {
531                 container linkstate-path-attribute {
532                         choice link-state-attribute {
533                                 case node-attributes {
534                                         when "../../nlri-type = node";
535                                         uses node-state;
536                                 }
537                                 case link-attributes {
538                                         when "../../nlri-type = link";
539                                         uses link-state;
540                                 }
541                                 case prefix-attributes {
542                                         when "../nlri-type = 'ipv4-prefix' or ../nlri-type = 'ipv6-prefix'";
543                                         uses prefix-state;
544                                 }
545                         }
546                 }
547         }
548
549         augment "/bgp-rib:loc-rib/bgp-rib:tables/bgp-rib:routes" {
550                 case linkstate-routes {
551                         container linkstate-routes {
552                                 leaf distinguisher {
553                                         type bgp-ls:route-distinguisher;
554                                 }
555                                 leaf protocol-id {
556                                         type bgp-ls:protocol-id;
557                                 }
558                                 leaf identifier {
559                                         type bgp-ls:identifier;
560                                 }
561
562                                 choice object-type {
563                                         case node {
564                                                 container node-descriptors {
565                                                         uses bgp-ls:node-identifier;
566                                                 }
567                                         }
568                                         case link {
569                                                 container local-node-descriptors {
570                                                         uses bgp-ls:node-identifier;
571                                                 }
572                                                 container remote-node-descriptors {
573                                                         uses bgp-ls:node-identifier;
574                                                 }
575                                                 container link-descriptors {
576                                                         uses bgp-ls:link-identifiers;
577                                                         leaf ipv4-interface-address {
578                                                                 type bgp-ls:ipv4-interface-identifier;
579                                                         }
580                                                         leaf ipv6-interface-address {
581                                                                 type bgp-ls:ipv6-interface-identifier;
582                                                         }
583                                                         leaf ipv4-neighbor-address {
584                                                                 type bgp-ls:ipv4-interface-identifier;
585                                                         }
586                                                         leaf ipv6-neighbor-address {
587                                                                 type bgp-ls:ipv6-interface-identifier;
588                                                         }
589                                                         leaf multi-topology-id {
590                                                                 type bgp-ls:topology-identifier;
591                                                         }
592                                                 }
593                                         }
594                                         case prefix {
595                                                 leaf multi-topology-id {
596                                                         type bgp-ls:topology-identifier;
597                                                 }
598                                                 leaf ospf-route-type {
599                                                         when "../../protocol-id = 'ospf'";
600                                                         type bgp-ls:ospf-route-type;
601                                                 }
602                                                 leaf ip-reachability-information {
603                                                         type inet:ip-prefix;
604                                                 }
605                                         }
606                                 }
607
608                                 uses bgp-rib:route;
609                         }
610                 }
611         }
612 }