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