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