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