Bug-2064: Implementation of RFC5492 Error handling.
[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
9     organization "Cisco Systems, Inc.";
10     contact "Dana Kutenicsova <dkutenic@cisco.com>";
11
12     description
13         "This module contains the base data model of a BGP message.
14         It rolls up the definitions contained in RFC4271 and RFC4893.
15
16         Copyright (c)2013 Cisco Systems, Inc. All rights reserved.
17
18         This program and the accompanying materials are made available
19         under the terms of the Eclipse Public License v1.0 which
20         accompanies this distribution, and is available at
21         http://www.eclipse.org/legal/epl-v10.html";
22
23     revision "2013-09-19" {
24         description
25             "Split off basic types";
26     }
27
28     revision "2013-09-18" {
29         description
30             "Initial revision.";
31         reference "RFC4271, RFC4893";
32     }
33
34     typedef protocol-version {
35         type uint8 {
36             range 1..7;
37         }
38     }
39
40     grouping originator-id {
41         leaf originator {
42             type inet:ipv4-address;
43         }
44     }
45
46     grouping cluster-id {
47         leaf-list cluster {
48             type bgp-t:cluster-identifier;
49         }
50     }
51
52     notification open {
53         description "Open Message";
54         reference "http://tools.ietf.org/html/rfc4271#section-4.2";
55         leaf version {
56             type protocol-version;
57             default 4;
58         }
59         leaf my-as-number {
60             type uint16;
61             default 23456;
62         }
63         leaf hold-timer {
64             type uint16;
65             mandatory true;
66         }
67         leaf bgp-identifier {
68             type inet:ipv4-address;
69             mandatory true;
70         }
71         list bgp-parameters {
72             list optional-capabilities {
73                 reference "http://tools.ietf.org/html/rfc5492#section-4";
74                 choice c-parameters {
75                     case as4-bytes-case {
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
88     grouping path-attributes {
89         reference "http://tools.ietf.org/html/rfc4271#section-5";
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     }
136
137     notification update {
138         description "Update Message";
139         reference "http://tools.ietf.org/html/rfc4271#section-4.3";
140         container path-attributes {
141             reference "http://tools.ietf.org/html/rfc4271#section-5";
142             uses path-attributes;
143         }
144         container withdrawn-routes {
145             leaf-list withdrawn-routes {
146                 type inet:ipv4-prefix;
147             }
148         }
149         container nlri {
150             leaf-list nlri {
151                 type inet:ipv4-prefix;
152             }
153         }
154     }
155
156     notification keepalive {
157         description "Keepalive Message";
158         reference "http://tools.ietf.org/html/rfc4271#section-4.4";
159     }
160
161     notification notify {
162         description "Notification Message";
163         reference "http://tools.ietf.org/html/rfc4271#section-4.5";
164
165         leaf error-code {
166             type uint8;
167             mandatory true;
168         }
169         leaf error-subcode {
170             type uint8;
171             mandatory true;
172         }
173         leaf data {
174             type binary;
175         }
176     }
177 }