261c8145c62dd07b7965b29ba11f42dace65385f
[bgpcep.git] / bgp / extensions / mvpn / src / main / yang / pmsi-tunnel.yang
1 // vi: set smarttab et sw=4 tabstop=4:
2 module pmsi-tunnel {
3     yang-version 1;
4     namespace "urn:opendaylight:params:xml:ns:yang:pmsi-tunnel";
5     prefix "pmsi-tunnel";
6
7     import bgp-types { prefix bgp-t; revision-date 2018-03-29; }
8     import bgp-message { prefix bgp-msg; revision-date 2018-03-29; }
9     import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
10     import network-concepts { prefix netc; revision-date 2013-11-25; }
11     import ietf-yang-types { prefix yang; }
12     import bgp-rib { prefix bgp-rib; revision-date 2018-03-29; }
13     import yang-ext { prefix ext; revision-date 2013-07-09; }
14
15     organization "AT&T Services, Inc.";
16
17     contact "Bruce Brandon <bb2697@att.com>";
18
19     description
20         "This module contains the data model of a BGP attribute called the
21         P-Multicast Service Interface Tunnel (PMSI Tunnel), defined
22         in RFC6514, Section 5.
23
24         Copyright (c)2016 AT&T Services, 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 "2018-03-29" {
32         description "Add RFC6514 Extended communities under bgp type.";
33     }
34
35     revision "2016-08-12" {
36         description "Initial revision";
37         reference "https://tools.ietf.org/html/rfc6514#section-5";
38     }
39
40     typedef pmsi-tunnel-type {
41         type enumeration {
42             enum rsvp-te-p2mp-lsp {
43                 value 1;
44             }
45             enum mldp-p2mp-lsp {
46                 value 2;
47             }
48             enum pim-ssm-tree {
49                 value 3;
50             }
51             enum pim-sm-tree {
52                 value 4;
53             }
54             enum bidir-pim-tree {
55                 value 5;
56             }
57             enum ingress-replication {
58                 value 6;
59             }
60             enum mldp-mp2mp-lsp {
61                 value 7;
62             }
63         }
64     }
65
66     grouping opaque {
67         leaf opaque-type {
68             mandatory true;
69             type uint8;
70         }
71         leaf opaque-extended-type {
72             type uint16;
73         }
74         leaf opaque {
75             mandatory true;
76             type yang:hex-string;
77         }
78     }
79
80     grouping p-address-p-multicast-group {
81         leaf p-address {
82             mandatory true;
83             type inet:ip-address;
84         }
85         leaf p-multicast-group {
86             mandatory true;
87             type inet:ip-address;
88         }
89     }
90
91     grouping pmsi-tunnel {
92         container pmsi-tunnel {
93             presence "PMSI Attribute";
94             description "P-Multicast Service Interface Tunnel (PMSI Tunnel) attribute";
95             reference "https://tools.ietf.org/html/rfc6514#section-5";
96
97             leaf leaf-information-required {
98                 type boolean;
99                 mandatory true;
100             }
101             leaf mpls-label {
102                 type netc:mpls-label;
103             }
104             choice tunnel-identifier {
105                 case rsvp-te-p2mp-lsp {
106                     container rsvp-te-p2mp-lsp {
107                         reference "https://tools.ietf.org/html/rfc4875#section-19.1.1";
108                         leaf p2mp-id {
109                             mandatory true;
110                             type uint32;
111                         }
112                         leaf tunnel-id {
113                             mandatory true;
114                             type uint16;
115                         }
116                         leaf extended-tunnel-id {
117                             mandatory true;
118                             type inet:ip-address;
119                         }
120                     }
121                 }
122                 case mldp-p2mp-lsp {
123                     container mldp-p2mp-lsp {
124                         reference "https://tools.ietf.org/html/rfc6388#section-2.2";
125                         leaf address-family {
126                             mandatory true;
127                             type identityref {
128                                 base bgp-t:address-family;
129                             }
130                         }
131                         leaf root-node-address {
132                             mandatory true;
133                             type inet:ip-address;
134                         }
135                         list opaque-value {
136                             uses opaque;
137                         }
138                     }
139                 }
140                 case pim-ssm-tree {
141                     container pim-ssm-tree {
142                         reference "https://tools.ietf.org/html/rfc6514#section-5";
143                         uses p-address-p-multicast-group;
144                     }
145                 }
146                 case pim-sm-tree {
147                     container pim-sm-tree {
148                         reference "https://tools.ietf.org/html/rfc6514#section-5";
149                         uses p-address-p-multicast-group;
150                     }
151                 }
152                 case bidir-pim-tree {
153                     container bidir-pim-tree {
154                         reference "https://tools.ietf.org/html/rfc6514#section-5";
155                         uses p-address-p-multicast-group;
156                     }
157                 }
158                 case ingress-replication {
159                     container ingress-replication {
160                         leaf receiving-endpoint-address {
161                             type inet:ip-address;
162                         }
163                     }
164                 }
165                 case mldp-mp2mp-lsp {
166                     container mldp-mp2mp-lsp {
167                         uses opaque;
168                     }
169                 }
170             }
171         }
172     }
173
174     augment "/bgp-msg:update/bgp-msg:attributes" {
175         uses pmsi-tunnel;
176     }
177
178     grouping bgp-rib-route {
179         uses bgp-rib:route {
180             augment "attributes" {
181                 ext:augment-identifier pmsi-tunnel-augmentation;
182                 uses pmsi-tunnel;
183             }
184         }
185     }
186 }
187