Clean up ShortestPathFirst
[bgpcep.git] / bgp / parser-api / src / main / yang / bgp-message.yang
1 module bgp-message {
2     yang-version 1;
3     namespace "urn:opendaylight:params:xml:ns:yang:bgp-message";
4     prefix "bgp-msg";
5
6     import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
7     import bgp-types { prefix bgp-t; revision-date 2020-01-20; }
8     import network-concepts { prefix netc; revision-date 2013-11-25; }
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 and RFC4893.
16
17         Copyright (c)2013 Cisco Systems, Inc. All rights reserved.
18
19         This program and the accompanying materials are made available
20         under the terms of the Eclipse Public License v1.0 which
21         accompanies this distribution, and is available at
22         http://www.eclipse.org/legal/epl-v10.html";
23
24     revision 2020-01-20 {
25         description "Update to use -no-zone-adresses";
26     }
27
28     revision "2018-03-29" {
29         description "Add RFC6514 Extended communities under bgp type.";
30     }
31
32     revision "2017-12-07" {
33         description "Add support for add-path in base BGP NLRI.";
34     }
35
36     revision "2013-09-19" {
37         description
38             "Split off basic types";
39     }
40
41     revision "2013-09-18" {
42         description
43             "Initial revision.";
44         reference "RFC4271, RFC4893";
45     }
46
47     typedef protocol-version {
48         type uint8 {
49             range 1..7;
50         }
51     }
52
53     typedef path-id {
54         type uint32;
55         default 0;
56         description
57             "Identifier of a single path. The identifier does not
58              carry any semantic meaning beyond uniquely identifying
59              a path. Default 0 value is reserved for non supported add-path key representation.";
60     }
61
62     grouping path-id-grouping {
63         leaf path-id {
64             type path-id;
65         }
66     }
67
68     grouping originator-id {
69         leaf originator {
70             type inet:ipv4-address-no-zone;
71         }
72     }
73
74     grouping cluster-id {
75         leaf-list cluster {
76             type bgp-t:cluster-identifier;
77             ordered-by user;
78         }
79     }
80
81     grouping ipv4-prefix-and-path-id {
82         leaf prefix {
83             type inet:ipv4-prefix;
84         }
85         uses path-id-grouping;
86     }
87
88     notification open {
89         uses open-message;
90     }
91
92     grouping open-message {
93         description "Open Message";
94         reference "http://tools.ietf.org/html/rfc4271#section-4.2";
95         leaf version {
96             type protocol-version;
97             default 4;
98         }
99         leaf my-as-number {
100             type uint16;
101             default 23456;
102         }
103         leaf hold-timer {
104             type uint16;
105             mandatory true;
106         }
107         leaf bgp-identifier {
108             type inet:ipv4-address-no-zone;
109             mandatory true;
110         }
111         list bgp-parameters {
112             list optional-capabilities {
113                 reference "http://tools.ietf.org/html/rfc5492#section-4";
114                 container c-parameters {
115                     container as4-bytes-capability {
116                         reference "http://tools.ietf.org/html/rfc6793";
117                         leaf as-number {
118                             type inet:as-number;
119                         }
120                     }
121                     container bgp-extended-message-capability {
122                         reference "https://www.ietf.org/archive/id/draft-ietf-idr-bgp-extended-messages-11.txt";
123                         presence "Indicates peer is able to send/receive 64K messages";
124                     }
125                 }
126             }
127         }
128     }
129
130     grouping path-attributes {
131         reference "http://tools.ietf.org/html/rfc4271#section-5";
132         container attributes {
133             container origin {
134                 reference "http://tools.ietf.org/html/rfc4271#section-5.1.1";
135                 leaf value {
136                     type bgp-t:bgp-origin;
137                     mandatory true;
138                 }
139             }
140             container as-path {
141                 reference "http://tools.ietf.org/html/rfc4271#section-5.1.2";
142                 list segments {
143                     uses bgp-t:as-path-segment;
144                 }
145             }
146             uses bgp-t:next-hop;
147             container multi-exit-disc {
148                 reference "http://tools.ietf.org/html/rfc4271#section-5.1.4";
149                 leaf med {
150                     type uint32;
151                 }
152             }
153             container local-pref {
154                 reference "http://tools.ietf.org/html/rfc4271#section-5.1.5";
155                 leaf pref {
156                     type uint32;
157                 }
158             }
159             container atomic-aggregate {
160                 reference "http://tools.ietf.org/html/rfc4271#section-5.1.6";
161                 presence "Atomic Aggregate attribute is present.";
162             }
163             container aggregator {
164                 uses bgp-t:bgp-aggregator;
165             }
166             list communities {
167                 uses bgp-t:community;
168             }
169             list extended-communities {
170                 uses bgp-t:extended-community;
171             }
172             container originator-id {
173                 uses originator-id;
174             }
175             container cluster-id {
176                 uses cluster-id;
177             }
178             container aigp {
179                 container aigp-tlv {
180                     leaf metric {
181                         type netc:accumulated-igp-metric;
182                     }
183                 }
184             }
185             list unrecognized-attributes {
186                 key type;
187                 leaf partial {
188                     type boolean;
189                     mandatory true;
190                 }
191                 leaf transitive {
192                     type boolean;
193                     mandatory true;
194                 }
195                 leaf type {
196                     type uint8;
197                     mandatory true;
198                 }
199                 leaf value {
200                     type binary {
201                         length 0..65535;
202                     }
203                     mandatory true;
204                 }
205             }
206             container bgp-prefix-sid {
207                 list bgp-prefix-sid-tlvs {
208                     choice bgp-prefix-sid-tlv {
209                         reference "https://tools.ietf.org/html/draft-ietf-idr-bgp-prefix-sid-02";
210                         // to be augmented
211                     }
212                 }
213             }
214         }
215     }
216
217     notification update {
218         uses update-message;
219     }
220
221     grouping update-message {
222         description "Update Message";
223         reference "http://tools.ietf.org/html/rfc4271#section-4.3";
224         uses path-attributes;
225         list withdrawn-routes {
226             uses ipv4-prefix-and-path-id;
227         }
228         list nlri {
229             uses ipv4-prefix-and-path-id;
230         }
231     }
232
233     notification keepalive {
234         description "Keepalive Message";
235         reference "http://tools.ietf.org/html/rfc4271#section-4.4";
236     }
237
238     notification notify {
239         uses notify-message;
240     }
241
242     grouping notify-message {
243         description "Notification Message";
244         reference "http://tools.ietf.org/html/rfc4271#section-4.5";
245
246         leaf error-code {
247             type uint8;
248             mandatory true;
249         }
250         leaf error-subcode {
251             type uint8;
252             mandatory true;
253         }
254         leaf data {
255             type binary;
256         }
257     }
258 }