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