BUG-45 : migrated ASPath 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         notification open {
40                 description "Open Message";
41                 reference "http://tools.ietf.org/html/rfc4271#section-4.2";
42                 leaf version {
43                         type protocol-version;
44                         default 4;
45                 }
46                 leaf my-as-number {
47                         type uint16;
48                         default 23456;
49                 }
50                 leaf hold-timer {
51                         type uint16;
52                         mandatory true;
53                 }
54                 leaf bgp-identifier {
55                         type inet:ipv4-address;
56                         mandatory true;
57                 }
58                 list optional-parameters {
59                         reference "http://tools.ietf.org/html/rfc3392#section-4";
60                         choice parameters {
61                                 container as4-bytes {
62                                         reference "http://tools.ietf.org/html/rfc6793";
63                                         leaf as-number {
64                                                 type inet:as-number;
65                                         }
66                                 }
67                         }
68                 }
69         }
70
71         grouping path-attributes {
72                 reference "http://tools.ietf.org/html/rfc4271#section-5";
73                 container origin {
74                         reference "http://tools.ietf.org/html/rfc4271#section-5.1.1";
75                         leaf value {
76                                 type bgp-t:bgp-origin;
77                                 mandatory true;
78                         }
79                 }
80                 container as-path {
81                         reference "http://tools.ietf.org/html/rfc4271#section-5.1.2";
82                         list segments {
83                                 uses bgp-t:as-path-segment;
84                         }
85                 }
86                 uses bgp-t:next-hop;
87                 container multi-exit-disc {
88                         reference "http://tools.ietf.org/html/rfc4271#section-5.1.4";
89                         leaf med {
90                                 type uint32;
91                         }
92                 }
93                 container local-pref {
94                         reference "http://tools.ietf.org/html/rfc4271#section-5.1.5";
95                         leaf pref {
96                                 type uint32;
97                         }
98                 }
99                 container atomic-aggregate {
100                         reference "http://tools.ietf.org/html/rfc4271#section-5.1.6";
101                         presence "Atomic Aggregate attribute is present.";
102                 }
103                 container aggregator {
104                         uses bgp-t:bgp-aggregator;
105                 }
106                 list communities {
107                         uses bgp-t:community; 
108                 }
109                 list extended-communities {
110                         uses bgp-t:extended-community;
111                 }
112                 container cluster-id {
113                         leaf cluster-id {
114                                 type bgp-t:cluster-identifier;
115                         }
116                 }
117         }
118
119         notification update {
120                 description "Update Message";
121                 reference "http://tools.ietf.org/html/rfc4271#section-4.3";
122                 container path-attributes {
123                         reference "http://tools.ietf.org/html/rfc4271#section-5";
124                         uses path-attributes;
125                 }
126                 container withdrawn-routes {
127                         leaf-list withdrawn-routes {
128                                 type inet:ipv4-prefix;
129                         }
130                 }
131                 container nlri {
132                         leaf-list nlri {
133                                 type inet:ipv4-prefix;
134                         }
135                 }
136         }
137
138         notification keepalive {
139                 description "Keepalive Message";
140                 reference "http://tools.ietf.org/html/rfc4271#section-4.4";
141         }
142
143         notification notify {
144                 description "Notification Message";
145                 reference "http://tools.ietf.org/html/rfc4271#section-4.5";
146
147                 leaf error-code {
148                         type uint8;
149                         mandatory true;
150                 }
151                 leaf error-subcode {
152                         type uint8;
153                         mandatory true;
154                 }
155                 leaf data {
156                         type binary;
157                 }
158         }
159 }