7cbbcb356c21b723afcb75b488d92eccf47bbaf6
[bgpcep.git] / bgp / parser-api / src / main / yang / bgp-multiprotocol.yang
1 module bgp-multiprotocol {
2     yang-version 1;
3     namespace "urn:opendaylight:params:xml:ns:yang:bgp-multiprotocol";
4     prefix "bgp-mp";
5
6     import bgp-message { prefix bgp-msg; revision-date 2018-03-29; }
7     import bgp-types { prefix bgp-t; revision-date 2018-03-29; }
8     import yang-ext { prefix ext; revision-date 2013-07-09; }
9     import odl-uint24 { prefix uint24; }
10
11     organization "Cisco Systems, Inc.";
12     contact "Dana Kutenicsova <dkutenic@cisco.com>";
13
14     description
15         "This module contains the base data model of a BGP message.
16         It rolls up the definitions contained in RFC4271
17         and draft-ietf-idr-ls-distribution-03.
18
19         Copyright (c)2013 Cisco Systems, Inc. All rights reserved.
20
21         This program and the accompanying materials are made available
22         under the terms of the Eclipse Public License v1.0 which
23         accompanies this distribution, and is available at
24         http://www.eclipse.org/legal/epl-v10.html";
25
26     revision "2018-03-29" {
27         description "Add RFC6514 Extended communities under bgp type.";
28     }
29
30     revision "2017-12-07" {
31         description "Add support for add-path in base BGP NLRI.";
32     }
33
34     revision "2013-09-19" {
35         description
36             "Split off basic types";
37     }
38
39     revision "2013-09-18" {
40         description
41             "Initial revision.";
42         reference "RFC4760";
43     }
44
45     typedef send-receive {
46         type enumeration {
47             enum receive { value 1; }
48             enum send { value 2; }
49             enum both { value 3; }
50         }
51     }
52
53     grouping bgp-table-type {
54         leaf afi {
55             type identityref {
56                 base bgp-t:address-family;
57             }
58         }
59         leaf safi {
60             type identityref {
61                 base bgp-t:subsequent-address-family;
62             }
63         }
64     }
65
66     grouping bgp-add-path-table-type {
67         uses bgp-table-type;
68         leaf send-receive {
69             type send-receive;
70         }
71     }
72
73     grouping destination {
74         choice destination-type {
75             // to be augmented
76         }
77     }
78
79     grouping mp-capabilities {
80         container multiprotocol-capability {
81             reference "http://tools.ietf.org/html/rfc4760#section-8";
82             uses bgp-table-type;
83         }
84         container graceful-restart-capability {
85             presence "indicates a graceful restart capability";
86
87             reference "http://tools.ietf.org/html/rfc4724#section-3";
88
89             leaf restart-flags {
90                 type bits {
91                     bit restart-state {
92                         position 0;
93                         }
94                     }
95                 mandatory true;
96             }
97
98             leaf restart-time {
99                 type uint16 {
100                     range 0..4095;
101                 }
102                 units seconds;
103                 default 0;
104             }
105
106             list tables {
107                 uses bgp-table-type;
108                 key "afi safi";
109
110                 leaf afi-flags {
111                     type bits {
112                         bit forwarding-state {
113                             position 0;
114                         }
115                     }
116                     mandatory true;
117                 }
118             }
119         }
120         container ll-graceful-restart-capability {
121             reference "https://tools.ietf.org/html/draft-uttaro-idr-bgp-persistence-04";
122
123             list tables {
124                 uses bgp-table-type;
125                 key "afi safi";
126
127                 leaf afi-flags {
128                     type bits {
129                         bit forwarding-state {
130                             position 0;
131                         }
132                     }
133                     mandatory true;
134                 }
135                 leaf long-lived-stale-time {
136                     type uint24:uint24;
137                     units seconds;
138                     default 0;
139                 }
140             }
141         }
142         container add-path-capability {
143             reference "http://tools.ietf.org/html/draft-ietf-idr-add-paths-13#section-4";
144             list address-families {
145                 uses bgp-add-path-table-type;
146             }
147         }
148         container route-refresh-capability {
149             presence "Route refresh capability";
150             reference "http://tools.ietf.org/html/rfc2918";
151         }
152     }
153
154     augment "/bgp-msg:open/bgp-msg:bgp-parameters/bgp-msg:optional-capabilities/bgp-msg:c-parameters" {
155         uses mp-capabilities;
156     }
157
158     augment "/bgp-msg:update/bgp-msg:attributes" {
159         ext:augment-identifier attributes-1;
160         container mp-reach-nlri {
161             reference "http://tools.ietf.org/html/rfc4760#section-3";
162
163             uses bgp-table-type;
164             uses bgp-t:next-hop;
165
166             container advertized-routes {
167                 uses destination;
168             }
169         }
170     }
171
172     augment "/bgp-msg:update/bgp-msg:attributes" {
173         ext:augment-identifier attributes-2;
174         container mp-unreach-nlri {
175             reference "http://tools.ietf.org/html/rfc4760#section-4";
176
177             uses bgp-table-type;
178
179             container withdrawn-routes {
180                 uses destination;
181             }
182         }
183     }
184
185     notification route-refresh {
186         description "ROUTE-REFRESH message";
187         reference "https://tools.ietf.org/html/rfc2918#section-3";
188         uses bgp-table-type;
189     }
190 }