BUG-4827: BGP Add Yang model design for Advertisement of Multiple Paths
[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                 }
96             }
97         }
98     }
99
100     grouping path-attributes {
101         reference "http://tools.ietf.org/html/rfc4271#section-5";
102         container attributes {
103             container origin {
104                 reference "http://tools.ietf.org/html/rfc4271#section-5.1.1";
105                 leaf value {
106                     type bgp-t:bgp-origin;
107                     mandatory true;
108                 }
109             }
110             container as-path {
111                 reference "http://tools.ietf.org/html/rfc4271#section-5.1.2";
112                 list segments {
113                     uses bgp-t:as-path-segment;
114                 }
115             }
116             uses bgp-t:next-hop;
117             container multi-exit-disc {
118                 reference "http://tools.ietf.org/html/rfc4271#section-5.1.4";
119                 leaf med {
120                     type uint32;
121                 }
122             }
123             container local-pref {
124                 reference "http://tools.ietf.org/html/rfc4271#section-5.1.5";
125                 leaf pref {
126                     type uint32;
127                 }
128             }
129             container atomic-aggregate {
130                 reference "http://tools.ietf.org/html/rfc4271#section-5.1.6";
131                 presence "Atomic Aggregate attribute is present.";
132             }
133             container aggregator {
134                 uses bgp-t:bgp-aggregator;
135             }
136             list communities {
137                 uses bgp-t:community;
138             }
139             list extended-communities {
140                 uses bgp-t:extended-community;
141             }
142             container originator-id {
143                 uses originator-id;
144             }
145             container cluster-id {
146                 uses cluster-id;
147             }
148             container aigp {
149                 container aigp-tlv {
150                     leaf metric {
151                         type netc:accumulated-igp-metric;
152                     }
153                 }
154             }
155             list unrecognized-attributes {
156                 key type;
157                 leaf partial {
158                     type boolean;
159                     mandatory true;
160                 }
161                 leaf transitive {
162                     type boolean;
163                     mandatory true;
164                 }
165                 leaf type {
166                     type uint8;
167                     mandatory true;
168                 }
169                 leaf value {
170                     type binary {
171                         length 0..65535;
172                     }
173                     mandatory true;
174                 }
175             }
176         }
177     }
178
179     notification update {
180         uses update-message;
181     }
182
183     grouping update-message {
184         description "Update Message";
185         reference "http://tools.ietf.org/html/rfc4271#section-4.3";
186         uses path-attributes;
187         container withdrawn-routes {
188             leaf-list withdrawn-routes {
189                 type inet:ipv4-prefix;
190             }
191         }
192         container nlri {
193             leaf-list nlri {
194                 type inet:ipv4-prefix;
195             }
196         }
197     }
198
199     notification keepalive {
200         description "Keepalive Message";
201         reference "http://tools.ietf.org/html/rfc4271#section-4.4";
202     }
203
204     notification notify {
205         uses notify-message;
206     }
207
208     grouping notify-message {
209         description "Notification Message";
210         reference "http://tools.ietf.org/html/rfc4271#section-4.5";
211
212         leaf error-code {
213             type uint8;
214             mandatory true;
215         }
216         leaf error-subcode {
217             type uint8;
218             mandatory true;
219         }
220         leaf data {
221             type binary;
222         }
223     }
224 }