cc1c9181369bb86706ea55a721d38f83ef6a614f
[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     import yang-ext { prefix ext; revision-date 2013-07-09; }
10
11     organization "Cisco Systems, Inc.";
12     contact "Dana Kutenicsova <dkutenic@cisco.com>";
13
14     description
15         "This module contains the base data model of a BGP message.
16         It rolls up the definitions contained in RFC4271
17         and draft-ietf-idr-ls-distribution-03.
18
19         Copyright (c)2013 Cisco Systems, Inc. All rights reserved.
20
21         This program and the accompanying materials are made available
22         under the terms of the Eclipse Public License v1.0 which
23         accompanies this distribution, and is available at
24         http://www.eclipse.org/legal/epl-v10.html";
25
26     revision "2013-09-19" {
27         description
28             "Split off basic types";
29     }
30
31     revision "2013-09-18" {
32         description
33             "Initial revision.";
34         reference "RFC4760";
35     }
36
37     grouping bgp-table-type {
38         leaf afi {
39             type identityref {
40                 base bgp-t:address-family;
41             }
42         }
43         leaf safi {
44             type identityref {
45                 base bgp-t:subsequent-address-family;
46             }
47         }
48     }
49
50     grouping destination {
51         choice destination-type {
52             // to be augmented
53         }
54     }
55
56     augment "/bgp-msg:open/bgp-msg:bgp-parameters/bgp-msg:optional-capabilities/bgp-msg:c-parameters" {
57         container multiprotocol-capability {
58             reference "http://tools.ietf.org/html/rfc4760#section-8";
59             uses bgp-table-type;
60         }
61         container graceful-restart-capability {
62             reference "http://tools.ietf.org/html/rfc4724#section-3";
63
64             leaf restart-flags {
65                 type bits {
66                     bit restart-state {
67                         position 0;
68                         }
69                     }
70                 mandatory true;
71             }
72
73             leaf restart-time {
74                 type uint16 {
75                     range 0..4095;
76                 }
77                 units seconds;
78                 mandatory true;
79             }
80
81             list tables {
82                 uses bgp-table-type;
83                 key "afi safi";
84
85                 leaf afi-flags {
86                     type bits {
87                         bit forwarding-state {
88                             position 0;
89                         }
90                     }
91                     mandatory true;
92                 }
93             }
94         }
95     }
96
97     augment "/bgp-msg:update/bgp-msg:attributes" {
98         ext:augment-identifier attributes-1;
99         container mp-reach-nlri {
100             reference "http://tools.ietf.org/html/rfc4760#section-3";
101
102             uses bgp-table-type;
103             uses bgp-t:next-hop;
104
105             container advertized-routes {
106                 uses destination;
107             }
108         }
109     }
110
111     augment "/bgp-msg:update/bgp-msg:attributes" {
112         ext:augment-identifier attributes-2;
113         container mp-unreach-nlri {
114             reference "http://tools.ietf.org/html/rfc4760#section-4";
115
116             uses bgp-table-type;
117
118             container withdrawn-routes {
119                 uses destination;
120             }
121         }
122     }
123 }