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