BUG-45 : migrated Extended Communities path attribute to generated source code.
[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 {
7                 prefix inet;
8                 revision-date 2010-09-24;
9         }
10
11         import bgp-types { prefix bgp-t; }
12
13         organization "Cisco Systems, Inc.";
14         contact "Dana Kutenicsova <dkutenic@cisco.com>";
15
16         description
17                 "This module contains the base data model of a BGP message.
18                 It rolls up the definitions contained in RFC4271 and RFC4893.
19
20                 Copyright (c)2013 Cisco Systems, Inc. All rights reserved.
21
22                 This program and the accompanying materials are made available
23                 under the terms of the Eclipse Public License v1.0 which
24                 accompanies this distribution, and is available at
25                 http://www.eclipse.org/legal/epl-v10.html";
26
27         revision "2013-09-18" {
28                 description
29                         "Initial revision.";
30                 reference "RFC4271, RFC4893";
31         }
32
33         typedef protocol-version {
34                 type uint8 {
35                         range 1..7;
36                 }
37         }
38
39         grouping as-path-segment {
40                 choice segment {
41                         case a-set {
42                                 leaf-list as-set {
43                                         type inet:as-number;
44                                 }
45                         }
46                         case a-list {
47                                 list as-sequence {
48                                         container sequence {
49                                                 leaf as {
50                                                         type inet:as-number;
51                                                 }
52                                         }
53                                 }
54                         }
55                         mandatory true;
56                 }
57         }
58
59         notification open {
60                 description "Open Message";
61                 reference "http://tools.ietf.org/html/rfc4271#section-4.2";
62                 leaf version {
63                         type protocol-version;
64                         default 4;
65                 }
66                 leaf my-as-number {
67                         type uint16;
68                         default 23456;
69                 }
70                 leaf hold-timer {
71                         type uint16;
72                         mandatory true;
73                 }
74                 leaf bgp-identifier {
75                         type inet:ipv4-address;
76                         mandatory true;
77                 }
78                 list optional-parameters {
79                         reference "http://tools.ietf.org/html/rfc3392#section-4";
80                         choice parameters {
81                                 container as4-bytes {
82                                         reference "http://tools.ietf.org/html/rfc6793";
83                                         leaf as-number {
84                                                 type inet:as-number;
85                                         }
86                                 }
87                         }
88                 }
89         }
90
91         grouping path-attributes {
92                 reference "http://tools.ietf.org/html/rfc4271#section-5";
93                 container origin {
94                         reference "http://tools.ietf.org/html/rfc4271#section-5.1.1";
95                         leaf value {
96                                 type bgp-t:bgp-origin;
97                                 mandatory true;
98                         }
99                 }
100                 container as-path {
101                         reference "http://tools.ietf.org/html/rfc4271#section-5.1.2";
102                         list segments {
103                                 uses as-path-segment;
104                         }
105                 }
106                 container next-hop {
107                         reference "http://tools.ietf.org/html/rfc4271#section-5.1.3";
108                         leaf hop {
109                                 type inet:ipv4-address;
110                                 mandatory true;
111                         }
112                 }
113                 container multi-exit-disc {
114                         reference "http://tools.ietf.org/html/rfc4271#section-5.1.4";
115                         leaf med {
116                                 type uint32;
117                         }
118                 }
119                 container local-pref {
120                         reference "http://tools.ietf.org/html/rfc4271#section-5.1.5";
121                         leaf pref {
122                                 type uint32;
123                         }
124                 }
125                 container atomic-aggregate {
126                         reference "http://tools.ietf.org/html/rfc4271#section-5.1.6";
127                         presence "Atomic Aggregate attribute is present.";
128                 }
129                 container aggregator {
130                         uses bgp-t:bgp-aggregator;
131                 }
132                 list communities {
133                         uses bgp-t:community; 
134                 }
135                 list extended-communities {
136                         uses bgp-t:extended-community;
137                 }
138                 container cluster-id {
139                         leaf cluster-id {
140                                 type bgp-t:cluster-identifier;
141                         }
142                 }
143         }
144
145         notification update {
146                 description "Update Message";
147                 reference "http://tools.ietf.org/html/rfc4271#section-4.3";
148                 container path-attributes {
149                         reference "http://tools.ietf.org/html/rfc4271#section-5";
150                         uses path-attributes;
151                 }
152                 container withdrawn-routes {
153                         leaf-list withdrawn-routes {
154                                 type inet:ipv4-prefix;
155                         }
156                 }
157                 container nlri {
158                         leaf-list nlri {
159                                 type inet:ipv4-prefix;
160                         }
161                 }
162         }
163
164         notification keepalive {
165                 description "Keepalive Message";
166                 reference "http://tools.ietf.org/html/rfc4271#section-4.4";
167         }
168
169         notification notify {
170                 description "Notification Message";
171                 reference "http://tools.ietf.org/html/rfc4271#section-4.5";
172
173                 leaf error-code {
174                         type uint8;
175                         mandatory true;
176                 }
177                 leaf error-subcode {
178                         type uint8;
179                         mandatory true;
180                 }
181                 leaf data {
182                         type binary;
183                 }
184         }
185 }