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