Merge "Unify YANG->DTO generation plugin definition"
[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 {
52                                 when "../../afi = ipv4";
53                                 leaf-list ipv4-prefixes {
54                                         type inet:ipv4-prefix;
55                                 }
56                         }
57                         case destination-ipv6 {
58                                 when "../../afi = ipv6";
59                                 leaf-list ipv6-prefixes {
60                                         type inet:ipv6-prefix;
61                                 }
62                         }
63                 }
64         }
65
66         augment "/bgp-msg:open/bgp-msg:bgp-parameters/bgp-msg:c-parameters" {
67                 case c-multiprotocol {
68                         container multiprotocol-capability {
69                                 reference "http://tools.ietf.org/html/rfc4760#section-8";
70                                 uses bgp-table-type;
71                         }
72                 }
73                 case c-graceful-restart {
74                         container graceful-restart-capability {
75                                 reference "http://tools.ietf.org/html/rfc4724#section-3";
76
77                                 leaf restart-flags {
78                                         type bits {
79                                                 bit restart-state {
80                                                         position 0;
81                                                 }
82                                         }
83                                         mandatory true;
84                                 }
85
86                                 leaf restart-time {
87                                         type uint16 {
88                                                 range 0..4095;
89                                         }
90                                         units seconds;
91                                         mandatory true;
92                                 }
93
94                                 list tables {
95                                         uses bgp-table-type;
96                                         key "afi safi";
97
98                                         leaf afi-flags {
99                                                 type bits {
100                                                         bit forwarding-state {
101                                                                 position 0;
102                                                         }
103                                                 }
104                                                 mandatory true;
105                                         }
106                                 }
107                         }
108                 }
109         }
110
111         augment "/bgp-msg:update/bgp-msg:path-attributes" {
112                 container mp-unreach-nlri {
113                         reference "http://tools.ietf.org/html/rfc4760#section-4";
114
115                         uses bgp-table-type;
116
117                         container withdrawn-routes {
118                                 uses destination;
119                         }
120                 }
121         }
122
123         augment "/bgp-msg:update/bgp-msg:path-attributes" {
124                 container mp-reach-nlri {
125                         reference "http://tools.ietf.org/html/rfc4760#section-3";
126
127                         uses bgp-table-type;
128                         uses bgp-t:next-hop;
129
130                         container advertized-routes {
131                                 uses destination;
132                         }
133                 }
134         }
135 }
136