c8394181f049aa0736aef3f60927ecfe67b92519
[bgpcep.git] / bgp / parser-api / src / main / yang / bgp-multiprotocol.yang
1 module bgp-multiprotocol {
2     yang-version 1;
3     namespace "urn:opendaylight:params:xml:ns:yang:bgp-multiprotocol";
4     prefix "bgp-mp";
5
6     import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
7     import bgp-message { prefix bgp-msg; revision-date 2013-09-19; }
8     import bgp-types { prefix bgp-t; revision-date 2013-09-19; }
9     import yang-ext { prefix ext; revision-date 2013-07-09; }
10
11     organization "Cisco Systems, Inc.";
12     contact "Dana Kutenicsova <dkutenic@cisco.com>";
13
14     description
15         "This module contains the base data model of a BGP message.
16         It rolls up the definitions contained in RFC4271
17         and draft-ietf-idr-ls-distribution-03.
18
19         Copyright (c)2013 Cisco Systems, Inc. All rights reserved.
20
21         This program and the accompanying materials are made available
22         under the terms of the Eclipse Public License v1.0 which
23         accompanies this distribution, and is available at
24         http://www.eclipse.org/legal/epl-v10.html";
25
26     revision "2013-09-19" {
27         description
28             "Split off basic types";
29     }
30
31     revision "2013-09-18" {
32         description
33             "Initial revision.";
34         reference "RFC4760";
35     }
36
37     typedef send-receive {
38         type enumeration {
39             enum receive { value 1; }
40             enum send { value 2; }
41             enum both { value 3; }
42         }
43     }
44
45     grouping bgp-table-type {
46         leaf afi {
47             type identityref {
48                 base bgp-t:address-family;
49             }
50         }
51         leaf safi {
52             type identityref {
53                 base bgp-t:subsequent-address-family;
54             }
55         }
56     }
57
58     grouping bgp-add-path-table-type {
59         uses bgp-table-type;
60         leaf send-receive {
61             type send-receive;
62         }
63     }
64
65     grouping destination {
66         choice destination-type {
67             // to be augmented
68         }
69     }
70
71     grouping mp-capabilities {
72         container multiprotocol-capability {
73             reference "http://tools.ietf.org/html/rfc4760#section-8";
74             uses bgp-table-type;
75         }
76         container graceful-restart-capability {
77             presence "indicates a graceful restart capability";
78
79             reference "http://tools.ietf.org/html/rfc4724#section-3";
80
81             leaf restart-flags {
82                 type bits {
83                     bit restart-state {
84                         position 0;
85                         }
86                     }
87                 mandatory true;
88             }
89
90             leaf restart-time {
91                 type uint16 {
92                     range 0..4095;
93                 }
94                 units seconds;
95                 mandatory true;
96             }
97
98             list tables {
99                 uses bgp-table-type;
100                 key "afi safi";
101
102                 leaf afi-flags {
103                     type bits {
104                         bit forwarding-state {
105                             position 0;
106                         }
107                     }
108                     mandatory true;
109                 }
110             }
111         }
112         container add-path-capability {
113             reference "http://tools.ietf.org/html/draft-ietf-idr-add-paths-13#section-4";
114             list address-families {
115                 uses bgp-add-path-table-type;
116             }
117         }
118         container route-refresh-capability {
119             presence "Route refresh capability";
120             reference "http://tools.ietf.org/html/rfc2918";
121         }
122     }
123
124     augment "/bgp-msg:open/bgp-msg:bgp-parameters/bgp-msg:optional-capabilities/bgp-msg:c-parameters" {
125         uses mp-capabilities;
126     }
127
128     augment "/bgp-msg:update/bgp-msg:attributes" {
129         ext:augment-identifier attributes-1;
130         container mp-reach-nlri {
131             reference "http://tools.ietf.org/html/rfc4760#section-3";
132
133             uses bgp-table-type;
134             uses bgp-t:next-hop;
135
136             container advertized-routes {
137                 uses destination;
138             }
139         }
140     }
141
142     augment "/bgp-msg:update/bgp-msg:attributes" {
143         ext:augment-identifier attributes-2;
144         container mp-unreach-nlri {
145             reference "http://tools.ietf.org/html/rfc4760#section-4";
146
147             uses bgp-table-type;
148
149             container withdrawn-routes {
150                 uses destination;
151             }
152         }
153     }
154
155     notification route-refresh {
156         description "ROUTE-REFRESH message";
157         reference "https://tools.ietf.org/html/rfc2918#section-3";
158         uses bgp-table-type;
159     }
160 }