Merge "BUG-99: cleanup packages"
[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                 container cluster-id {
115                         leaf cluster-id {
116                                 type bgp-t:cluster-identifier;
117                         }
118                 }
119         }
120
121         notification update {
122                 description "Update Message";
123                 reference "http://tools.ietf.org/html/rfc4271#section-4.3";
124                 container path-attributes {
125                         reference "http://tools.ietf.org/html/rfc4271#section-5";
126                         uses path-attributes;
127                 }
128                 container withdrawn-routes {
129                         leaf-list withdrawn-routes {
130                                 type inet:ipv4-prefix;
131                         }
132                 }
133                 container nlri {
134                         leaf-list nlri {
135                                 type inet:ipv4-prefix;
136                         }
137                 }
138         }
139
140         notification keepalive {
141                 description "Keepalive Message";
142                 reference "http://tools.ietf.org/html/rfc4271#section-4.4";
143         }
144
145         notification notify {
146                 description "Notification Message";
147                 reference "http://tools.ietf.org/html/rfc4271#section-4.5";
148
149                 leaf error-code {
150                         type uint8;
151                         mandatory true;
152                 }
153                 leaf error-subcode {
154                         type uint8;
155                         mandatory true;
156                 }
157                 leaf data {
158                         type binary;
159                 }
160         }
161 }