moved BGP Table type from concepts to parser-api.
[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 {
7                 prefix inet;
8                 revision-date 2010-09-24;
9         }
10         import bgp-message { prefix bgp-msg; }
11         import bgp-types { prefix bgp-t; }
12
13         organization "Cisco Systems, Inc.";
14         contact "Dana Kutenicsova <dkutenic@cisco.com>";
15
16         description
17                 "This module contains the base data model of a BGP message.
18                 It rolls up the definitions contained in RFC4271
19                 and draft-ietf-idr-ls-distribution-03.
20
21                 Copyright (c)2013 Cisco Systems, Inc. All rights reserved.
22
23                 This program and the accompanying materials are made available
24                 under the terms of the Eclipse Public License v1.0 which
25                 accompanies this distribution, and is available at
26                 http://www.eclipse.org/legal/epl-v10.html";
27
28         revision "2013-09-18" {
29                 description
30                         "Initial revision.";
31                 reference "RFC4760";
32         }
33
34         grouping bgp-table-type {
35                 leaf afi {
36                         type identityref {
37                                 base bgp-t:address-family;
38                         }
39                 }
40                 leaf safi {
41                         type identityref {
42                                 base bgp-t:subsequent-address-family;
43                         }
44                 }
45         }
46
47         grouping destination {
48                 choice nlri {
49                         case ipv4 {
50                                 when "../../afi = ipv4";
51                                 leaf-list ipv4-prefixes {
52                                         type inet:ipv4-prefix;
53                                 }
54                         }
55                         case ipv6 {
56                                 when "../../afi = ipv6";
57                                 leaf-list ipv6-prefixes {
58                                         type inet:ipv6-prefix;
59                                 }
60                         }
61                 }
62         }
63
64         augment "/bgp-msg:open/bgp-msg:bgp-parameters/bgp-msg:parameters" {
65                 case multiprotocol {
66                         list capabilities {
67                                 container multiprotocol-capability {
68                                         reference "http://tools.ietf.org/html/rfc4760#section-8";
69                                         uses bgp-table-type;
70                                 }
71                         }
72                 }
73         }
74
75         augment "/bgp-msg:update/bgp-msg:path-attributes" {
76                 container mp-unreach-nlri {
77                         reference "http://tools.ietf.org/html/rfc4760#section-4";
78
79                         uses bgp-table-type;
80
81                         container withdrawn-routes {
82
83                 // FIXME: 'uses destination';
84                 choice nlri {
85                         case ipv4 {
86                                 when "../../afi = ipv4";
87                                 leaf-list ipv4-prefixes {
88                                         type inet:ipv4-prefix;
89                                 }
90                         }
91                         case ipv6 {
92                                 when "../../afi = ipv6";
93                                 leaf-list ipv6-prefixes {
94                                         type inet:ipv6-prefix;
95                                 }
96                         }
97                 }
98
99                         }
100                 }
101         }
102
103         augment "/bgp-msg:update/bgp-msg:path-attributes" {
104                 container mp-reach-nlri {
105                         reference "http://tools.ietf.org/html/rfc4760#section-3";
106
107                         uses bgp-table-type;
108                         uses bgp-t:next-hop;
109
110                         container advertized-routes {
111
112                 // FIXME: 'uses destination';
113                 choice nlri {
114                         case ipv4 {
115                                 when "../../afi = ipv4";
116                                 leaf-list ipv4-prefixes {
117                                         type inet:ipv4-prefix;
118                                 }
119                         }
120                         case ipv6 {
121                                 when "../../afi = ipv6";
122                                 leaf-list ipv6-prefixes {
123                                         type inet:ipv6-prefix;
124                                 }
125                         }
126                 }
127
128                         }
129
130                         leaf hop {
131                                 type inet:ip-address;
132                         }
133                 }
134         }
135 }
136