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