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