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