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