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