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