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