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