BUG-45 : updated yang models for bgp.
[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                                 presence "MULTI_EXIT_DSC present.";
136                                 leaf med {
137                                         type uint32;
138                                 }
139                         }
140                         container local-pref {
141                                 reference "http://tools.ietf.org/html/rfc4271#section-5.1.5";
142                                 leaf pref {
143                                         type uint32;
144                                 }
145                         }
146                         container atomic-aggregate {
147                                 reference "http://tools.ietf.org/html/rfc4271#section-5.1.6";
148                                 presence "Atomic Aggregare attribute is present.";
149                         }
150                         container aggregator {
151                                 reference "http://tools.ietf.org/html/rfc4271#section-5.1.7";
152                                 leaf as {
153                                         type as-number;
154                                 }
155                                 leaf ip {
156                                         type inet:ipv4-address;
157                                 }
158                         }
159                 }
160                 container withdrawn-routes {
161                         leaf-list withdrawn-routes {
162                                 type inet:ipv4-prefix;
163                         }
164                 }
165                 container nlri {
166                         leaf-list nlri {
167                                 type inet:ipv4-prefix;
168                         }
169                 }
170         }
171
172         notification keepalive {
173                 description "Keepalive Message";
174                 reference "http://tools.ietf.org/html/rfc4271#section-4.4";
175         }
176
177         notification notify {
178                 description "Notification Message";
179                 reference "http://tools.ietf.org/html/rfc4271#section-4.5";
180
181                 leaf error-code {
182                         type uint8;
183                         mandatory true;
184                 }
185                 leaf error-subcode {
186                         type uint8;
187                         mandatory true;
188                 }
189                 leaf data {
190                         type binary;
191                 }
192         }
193 }