Bug-3904: BGP-LU yang model
[bgpcep.git] / bgp / labeled-unicast / src / main / yang / bgp-labeled-unicast.yang
1 module bgp-labeled-unicast {
2     yang-version 1;
3     namespace "urn:opendaylight:params:xml:ns:yang:bgp-labeled-unicast";
4     prefix "bgp-lu";
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-multiprotocol { prefix bgp-mp; revision-date 2013-09-19; }
9     import bgp-rib { prefix bgp-rib; revision-date 2013-09-25; }
10     import bgp-types { prefix bgp-t; revision-date 2013-09-19; }
11     import bmp-monitor { prefix bmp-mon; revision-date 2015-05-12; }
12
13     organization "Cisco Systems, Inc.";
14     contact "GE QU <gequ@cisco.com>";
15     contact "Mingming Chen <mingmche@cisco.com>";
16
17     description
18         "This module contains the base data model of a BGP message.
19         It rolls up the definitions contained in RFC3107.
20
21         Copyright (c)2015 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 "2015-05-25" {
29         description
30             "Initial Version.";
31     }
32
33     identity labeled-unicast-subsequent-address-family {
34         reference "https://tools.ietf.org/html/rfc3107#section-3";
35         base bgp-t:subsequent-address-family;
36     }
37
38     typedef label-value {
39         description
40             "The 20-bit Label value.";
41         type int32 {
42             range "0..1048575";
43         }
44     }
45
46     grouping label {
47         reference "https://tools.ietf.org/html/rfc3032#section-2.1";
48         description
49             "The lable stack entry.";
50         leaf label-value {
51             type label-value;
52         }
53     }
54
55     grouping labeled-unicast {
56         reference "https://tools.ietf.org/html/rfc3107#section-3";
57         list label-stack {
58             description
59                 "The Label field carries one or more labels (that corresponds to
60                  the stack of labels). Each label is encoded as 3
61                  octets, where the high-order 20 bits contain the label value,
62                  and the low order bit contains 'Bottom of Stack'.";
63             uses label;
64             ordered-by user;
65         }
66         leaf prefix {
67             type inet:ip-prefix;
68         }
69     }
70
71     grouping labeled-unicast-destination {
72         list c-labeled-unicast-destination {
73             uses labeled-unicast;
74         }
75     }
76
77     grouping labeled-unicast-routes {
78         container labeled-unicast-routes {
79             list labeled-unicast-route {
80                 leaf route-key {
81                     type binary;
82                 }
83                 key "route-key";
84                 uses labeled-unicast;
85                 uses bgp-rib:route;
86             }
87         }
88     }
89
90     augment "/bgp-msg:update/bgp-msg:attributes/bgp-mp:mp-reach-nlri/bgp-mp:advertized-routes/bgp-mp:destination-type" {
91         case destination-labeled-unicast-case {
92             container destination-labeled-unicast {
93                 uses labeled-unicast-destination;
94             }
95         }
96     }
97
98     augment "/bgp-msg:update/bgp-msg:attributes/bgp-mp:mp-unreach-nlri/bgp-mp:withdrawn-routes/bgp-mp:destination-type" {
99         case destination-labeled-unicast-case {
100             container destination-labeled-unicast {
101                 uses labeled-unicast-destination;
102             }
103         }
104     }
105
106     augment "/bgp-rib:application-rib/bgp-rib:tables/bgp-rib:routes" {
107         case labeled-unicast-routes-case {
108             uses labeled-unicast-routes;
109         }
110     }
111
112     augment "/bgp-rib:bgp-rib/bgp-rib:rib/bgp-rib:loc-rib/bgp-rib:tables/bgp-rib:routes" {
113         case labeled-unicast-routes-case {
114             uses labeled-unicast-routes;
115         }
116     }
117
118     augment "/bgp-rib:bgp-rib/bgp-rib:rib/bgp-rib:peer/bgp-rib:adj-rib-in/bgp-rib:tables/bgp-rib:routes" {
119         case labeled-unicast-routes-case {
120             uses labeled-unicast-routes;
121         }
122     }
123
124     augment "/bgp-rib:bgp-rib/bgp-rib:rib/bgp-rib:peer/bgp-rib:effective-rib-in/bgp-rib:tables/bgp-rib:routes" {
125         case labeled-unicast-routes-case {
126             uses labeled-unicast-routes;
127         }
128     }
129
130     augment "/bgp-rib:bgp-rib/bgp-rib:rib/bgp-rib:peer/bgp-rib:adj-rib-out/bgp-rib:tables/bgp-rib:routes" {
131         case labeled-unicast-routes-case {
132             uses labeled-unicast-routes;
133         }
134     }
135
136     augment "/bmp-mon:bmp-monitor/bmp-mon:monitor/bmp-mon:router/bmp-mon:peer/bmp-mon:pre-policy-rib/bmp-mon:tables/bmp-mon:routes" {
137         case labeled-unicast-routes-case {
138             uses labeled-unicast-routes;
139         }
140     }
141
142     augment "/bmp-mon:bmp-monitor/bmp-mon:monitor/bmp-mon:router/bmp-mon:peer/bmp-mon:post-policy-rib/bmp-mon:tables/bmp-mon:routes" {
143         case labeled-unicast-routes-case {
144             uses labeled-unicast-routes;
145         }
146     }
147 }