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