Bump versions by 0.1.0 for next dev cycle
[vpnservice.git] / vpnmanager / vpnmanager-api / src / main / yang / odl-l3vpn.yang
1 module odl-l3vpn {
2     namespace "urn:opendaylight:l3vpn";
3     prefix odl-l3vpn;
4
5     import yang-ext {prefix ext; revision-date "2013-07-09";}
6     import l3vpn { prefix l3vpn; revision-date "2014-08-15"; }
7     import ietf-yang-types { prefix "yang"; }
8
9     revision "2013-09-11" {
10         description "L3 VPN Service module";
11     }
12
13     grouping adjacency-list{
14         list adjacency{
15             key "ip_address";
16             leaf nextHopIp { type string; }
17             leaf ip_address {type string;}
18             leaf label { type uint32; config "false"; } /* optional */
19             leaf mac_address {type string;} /* optional */
20         }
21     }
22
23     grouping vpn-route-list{
24         leaf-list route-entry-id{
25             type uint32;
26         }
27     }
28
29     augment "/l3vpn:vpn-interfaces/l3vpn:vpn-interface" {
30         ext:augment-identifier "adjacencies";
31         uses adjacency-list;
32     }
33
34     augment "/l3vpn:vpn-interfaces/l3vpn:vpn-interface" {
35         ext:augment-identifier "opState";
36         leaf stateUp {type boolean; config false;}
37     }
38
39     /* Operational DS containers for reverse lookups*/
40     container prefix-to-interface {
41         config false;
42         list vpn-ids {
43            key vpn-id;
44            leaf vpn-id {type uint32;}
45            list prefixes {
46               key ip_address;
47               leaf ip_address {type string;}
48               leaf dpnId {
49                  type uint64;
50               }
51               leaf vpn-interface-name {
52                   type string;
53               }
54            }
55         }
56     }
57
58     container vpn-to-extraroute {
59         config false;
60         list vpn {
61            key vrf-id;
62            leaf vrf-id {
63               description
64                  "The vrf-id command configures a route distinguisher (RD)
65                   for the IPv4 or IPv6 address family of a VPN instance or
66                   vpn instance name for internal vpn case.";
67               type string;
68            }
69            list extraroute {
70               key prefix;
71               leaf prefix {type string;}
72                       leaf nexthop-ip {
73                           type string;
74                       }
75            }
76         }
77     }
78
79     /* Data models to adhere to restart requirements */
80     container vpn-instance-to-vpn-id {
81        list vpn-instance {
82           key vpn-instance-name;
83           leaf vpn-instance-name {
84              type string;
85           }
86           leaf vpn-id {
87              type uint32;
88           }
89           leaf vrf-id {
90               description
91                  "The vrf-id command configures a route distinguisher (RD)
92                   for the IPv4 or IPv6 address family of a VPN instance or
93                   vpn instance name for internal vpn case.";
94               type string;
95           }
96        }
97     }
98
99     container vpn-instance-op-data {
100         config false;
101         list vpn-instance-op-data-entry {
102            key vrf-id;
103            leaf vpn-id { type uint32;}
104            leaf vrf-id {
105               description
106                  "The vrf-id command configures a route distinguisher (RD)
107                   for the IPv4 or IPv6 address family of a VPN instance or
108                   vpn instance name for internal vpn case.";
109               type string;
110            }
111
112            leaf vpn-interface-count { type uint32; }
113            uses vpn-route-list;
114            list vpn-to-dpn-list {
115                key dpnId;
116                leaf dpnId {
117                   type uint64;
118                }
119                list vpn-interfaces {
120                   key interface-name;
121                   leaf interface-name {
122                       type string;
123                   }
124                }
125                list ip-addresses {
126                   key ip-address;
127                   leaf ip-address {
128                       type string;
129                   }
130                }
131            }
132         }
133     }
134
135     typedef task-state {
136          type enumeration {
137            enum na {
138              value "0";
139              description
140               "Task not applicable";
141            }
142            enum pending {
143              value "1";
144              description
145               "Task is in pending state";
146            }
147            enum done {
148              value "2";
149              description
150               "Task has been completed";
151            }
152          }
153          description
154           "This value the status of any task.
155            The possible values are NA, PENDING or DONE.
156            ";
157     }
158
159
160     container subnet-op-data {
161         list subnet-op-data-entry {
162             key subnet-id;
163             leaf subnet-id {
164                 type    yang:uuid;
165                 description "UUID representing the subnet ";
166             }
167             leaf nh-dpnId {
168                 type uint64;
169                 description "DpnId for the DPN used as nexthop for this subnet";
170             }
171             leaf vpn-name {
172                 type string;
173                 description "VPN Instance name";
174             }
175             leaf vrf-id {
176                 type string;
177             }
178             leaf subnet-cidr {
179                 type string;
180                 description "Subnet in cidr notation";
181             }
182             leaf route-adv-state {
183                 type task-state;
184                 description "The status of the subnet route advertisement. Route advertisement could be in a NA, PENDING or DONE state.";
185             }
186             leaf elan-tag{
187                 type uint32;
188             }
189             list subnet-to-dpn {
190                 key dpnId;
191                 leaf dpnId {
192                     type uint64;
193                 }
194                 list vpn-interfaces {
195                     key interface-name;
196                     leaf interface-name {
197                         type string;
198                     }
199                 }
200             }
201
202         }
203     }
204
205     container port-op-data {
206         list port-op-data-entry {
207             key port-id;
208             leaf port-id {
209                 type  string;
210                 description "UUID in string format representing the port ";
211             }
212             leaf subnet-id {
213                 type  yang:uuid;
214                 description "Back reference to obtain the subnet for a port ";
215             }
216             leaf dpnId {
217                 type uint64;
218             }
219         }
220     }
221
222     container rd-to-elan-op{
223         list rd-to-elan-op-entry{
224             key "rd subnet-ip";
225             leaf rd {
226                 type string;
227             }
228             leaf subnet-ip {
229                 type string;
230             }
231             leaf next-hop-ip {
232                 type string;
233             }
234             leaf vpn-name {
235                 type string;
236             }
237             leaf elan-tag{
238                 type uint32;
239             }
240         }
241     }
242
243     grouping dpn-in-vpn-event {
244             leaf dpn-id { type uint64; }
245             leaf vpn-name { type string; }
246             leaf rd { type string; }
247         }
248
249         notification add-dpn-event {
250             container add-event-data {
251                uses dpn-in-vpn-event;
252             }
253         }
254
255         notification remove-dpn-event {
256             container remove-event-data {
257                uses dpn-in-vpn-event;
258             }
259         }
260
261
262       /* container to maintain mapping between neutron router and DPN(s) on which vpn-interfaces for router are present */
263     container neutron-router-dpns {
264         list router-dpn-list {
265             key router-id;
266             leaf router-id { type string;}
267             list dpn-vpninterfaces-list {
268                 key dpn-id;
269                 leaf dpn-id { type uint64;}
270                 list router-interfaces { 
271                     key interface;
272                     leaf interface { type string; }
273                 }
274             }
275         }
276     }
277
278
279     container router-interfaces {
280         list router-interface {
281             key interface-name;
282             leaf interface-name { type string; }
283             leaf router-name { type string; }
284         }
285     }
286
287 }