Bug-2064: Implementation of RFC5492 Error handling.
[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 2010-09-24; }
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
10     organization "Cisco Systems, Inc.";
11     contact "Dana Kutenicsova <dkutenic@cisco.com>";
12
13     description
14         "This module contains the base data model of a BGP message.
15         It rolls up the definitions contained in RFC4271
16         and draft-ietf-idr-ls-distribution-03.
17
18         Copyright (c)2013 Cisco Systems, Inc. All rights reserved.
19
20         This program and the accompanying materials are made available
21         under the terms of the Eclipse Public License v1.0 which
22         accompanies this distribution, and is available at
23         http://www.eclipse.org/legal/epl-v10.html";
24
25     revision "2013-09-19" {
26         description
27             "Split off basic types";
28     }
29
30     revision "2013-09-18" {
31         description
32             "Initial revision.";
33         reference "RFC4760";
34     }
35
36     grouping bgp-table-type {
37         leaf afi {
38             type identityref {
39                 base bgp-t:address-family;
40             }
41         }
42         leaf safi {
43             type identityref {
44                 base bgp-t:subsequent-address-family;
45             }
46         }
47     }
48
49     grouping destination {
50         choice destination-type {
51             case destination-ipv4-case {
52                 container destination-ipv4 {
53                     when "../../afi = ipv4";
54                     leaf-list ipv4-prefixes {
55                         type inet:ipv4-prefix;
56                     }
57                 }
58             }
59             case destination-ipv6-case {
60                 container destination-ipv6 {
61                     when "../../afi = ipv6";
62                     leaf-list ipv6-prefixes {
63                         type inet:ipv6-prefix;
64                     }
65                 }
66             }
67         }
68     }
69
70     augment "/bgp-msg:open/bgp-msg:bgp-parameters/bgp-msg:optional-capabilities/bgp-msg:c-parameters" {
71         case multiprotocol-case {
72             container multiprotocol-capability {
73                 reference "http://tools.ietf.org/html/rfc4760#section-8";
74                 uses bgp-table-type;
75             }
76         }
77         case graceful-restart-case {
78             container graceful-restart-capability {
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         }
113     }
114
115     augment "/bgp-msg:update/bgp-msg:path-attributes" {
116         container mp-reach-nlri {
117             reference "http://tools.ietf.org/html/rfc4760#section-3";
118
119             uses bgp-table-type;
120             uses bgp-t:next-hop;
121
122             container advertized-routes {
123                 uses destination;
124             }
125         }
126     }
127
128     augment "/bgp-msg:update/bgp-msg:path-attributes" {
129         container mp-unreach-nlri {
130             reference "http://tools.ietf.org/html/rfc4760#section-4";
131
132             uses bgp-table-type;
133
134             container withdrawn-routes {
135                 uses destination;
136             }
137         }
138     }
139 }