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