Bug 6786: L3VPN is not honoring VTEP add or delete in operational cloud
[netvirt.git] / vpnservice / vpnmanager / vpnmanager-api / src / main / yang / odl-l3vpn.yang
1 module odl-l3vpn {
2     namespace "urn:opendaylight:netvirt: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"; revision-date "2013-07-15"; }
8     import odl-interface { prefix odlif; revision-date "2016-04-06"; }
9
10     revision "2013-09-11" {
11         description "L3 VPN Service module";
12     }
13
14     grouping adjacency-list{
15         list adjacency{
16             key "ip_address";
17             leaf-list next-hop-ip-list { type string; }
18             leaf ip_address {type string;}
19             leaf primary-adjacency {
20                 type boolean;
21                 default false;
22                 description 
23                     "Value of True indicates this is a primary adjacency";
24             }
25             leaf label { type uint32; config "false"; } /* optional */
26             leaf mac_address {type string;} /* optional */
27         }
28     }
29
30     grouping vpn-route-list{
31         leaf-list route-entry-id{
32             type uint32;
33         }
34     }
35
36     augment "/l3vpn:vpn-interfaces/l3vpn:vpn-interface" {
37         ext:augment-identifier "adjacencies";
38         uses adjacency-list;
39     }
40
41     augment "/l3vpn:vpn-interfaces/l3vpn:vpn-interface" {
42         ext:augment-identifier "opState";
43         leaf stateUp {type boolean; config false;}
44     }
45
46     /* Operational DS containers for reverse lookups*/
47     container prefix-to-interface {
48         config false;
49         list vpn-ids {
50            key vpn-id;
51            leaf vpn-id {type uint32;}
52            list prefixes {
53               key ip_address;
54               leaf ip_address {type string;}
55               leaf dpnId {
56                  type uint64;
57               }
58               leaf vpn-interface-name {
59                   type string;
60               }
61            }
62         }
63     }
64
65     container vpn-to-extraroute {
66         config false;
67         list vpn {
68            key vrf-id;
69            leaf vrf-id {
70               description
71                  "The vrf-id command configures a route distinguisher (RD)
72                   for the IPv4 or IPv6 address family of a VPN instance or
73                   vpn instance name for internal vpn case.";
74               type string;
75            }
76            list extraroute {
77               key prefix;
78               leaf prefix {type string;}
79               leaf-list nexthop-ip-list {
80                   type string;
81               }
82            }
83         }
84     }
85
86     /* Data models to adhere to restart requirements */
87     container vpn-instance-to-vpn-id {
88        list vpn-instance {
89           key vpn-instance-name;
90           leaf vpn-instance-name {
91              type string;
92           }
93           leaf vpn-id {
94              type uint32;
95           }
96           leaf vrf-id {
97               description
98                  "The vrf-id command configures a route distinguisher (RD)
99                   for the IPv4 or IPv6 address family of a VPN instance or
100                   vpn instance name for internal vpn case.";
101               type string;
102           }
103        }
104     }
105
106     container vpn-id-to-vpn-instance {
107            list vpn-ids {
108               key vpn-id;
109               leaf vpn-id {
110                  type uint32;
111               }
112               leaf vpn-instance-name {
113                  type string;
114               }
115               leaf vrf-id {
116                   description
117                      "The vrf-id command configures a route distinguisher (RD)
118                       for the IPv4 or IPv6 address family of a VPN instance or
119                       vpn instance name for internal vpn case.";
120                   type string;
121               }
122               leaf external-vpn {
123                   type boolean;
124                   description "The VPN is external?";
125               }
126            }
127     }
128
129     container vpn-instance-op-data {
130         config false;
131         list vpn-instance-op-data-entry {
132            key vrf-id;
133            leaf vpn-id { type uint32;}
134            leaf vrf-id {
135               description
136                  "The vrf-id command configures a route distinguisher (RD)
137                   for the IPv4 or IPv6 address family of a VPN instance or
138                   vpn instance name for internal vpn case.";
139               type string;
140            }
141
142            leaf vpn-instance-name {
143                description "Typical the VPN Uuid";
144                type string;
145            }
146
147            leaf vpn-interface-count { type uint32; }
148            uses vpn-route-list;
149            list vpn-to-dpn-list {
150                key dpnId;
151                leaf dpnId {
152                   type uint64;
153                }
154                list vpn-interfaces {
155                   key interface-name;
156                   leaf interface-name {
157                       type string;
158                   }
159                }
160                list ip-addresses {
161                    key ip-address;
162                    leaf ip-address { type string; }
163                }
164                leaf dpn-state {
165                         description
166                         "This flag indicates the state of the DPN.
167                         Active state indicates atleast one vpn interface present on that DPN for the vpn.
168                         Inactive state indicates no vpn interface present on that DPN for this vpn.";
169
170                     type enumeration {
171                          enum active {
172                             value "0";
173                             description
174                                 "Active state";
175                              }
176                              enum inactive {
177                                  value "1";
178                                  description
179                                  "Inactive state";
180                              }
181                         }
182                         default "active";
183                    }
184            }
185            container vpnTargets {
186               description
187                 "The vpn-target command configures the export or import VPN target
188                  extended community attribute for the VPN instance IPv4/IPv6 address
189                  family.
190                  Format is ASN:nn or IP-address:nn.";
191
192               list vpnTarget {
193                  key "vrfRTValue";
194                  max-elements "unbounded";
195                  min-elements "0";
196                  description
197                     "L3vpn vpntarget configure class";
198
199                  leaf vrfRTValue {
200                     description
201                        "Vpn-target: adds VPN target extended community attribute to the
202                         export or import VPN target extended community list. The
203                         vpn-target can be expressed in either of the following formats:
204                         (1)16-bit AS number:32-bit user-defined number
205                            For example, 1:3. The AS number ranges from 0 to 65535. The
206                            user-defined number ranges from 0 to 4294967295. The AS number
207                            and the user-defined number cannot be 0s at the same time.
208                            That is, a VPN target cannot be 0:0.
209                         (2)32-bit IP address:16-bit user-defined number
210                            For example, 192.168.122.15:1. The IP address ranges from
211                            0.0.0.0 to 255.255.255.255. The user-defined number ranges from
212                            0 to 65535.
213                         (3)32-bit IP address:16-bit user-defined number
214                            For example, 192.168.122.15:1. An IP address ranges from
215                            0.0.0.0 to 255.255.255.255. A user-defined number ranges from 0
216                            to 65535.";
217                     type string {
218                        length "3..21";
219                     }
220                  }
221
222                  leaf vrfRTType {
223                     description
224                        "Specifies the vpn target type, export-extcommunity:
225                         specifies the extended community attributes carried in routing
226                         information to be sent. import-extcommunity: receives routing
227                         information carrying specified extended community attributes.";
228
229                     type enumeration {
230                        enum export_extcommunity {
231                           value "0";
232                           description "export-extcommunity:";
233                        }
234                        enum import_extcommunity {
235                           value "1";
236                           description "import-extcommunity:";
237                        }
238                        enum both {
239                           value "2";
240                           description "export-extcommunity & import-extcommunity:";
241                        }
242                     }
243                  }
244               }
245            }
246         }
247     }
248
249
250     typedef task-state {
251          type enumeration {
252            enum na {
253              value "0";
254              description
255               "Task not applicable";
256            }
257            enum pending {
258              value "1";
259              description
260               "Task is in pending state";
261            }
262            enum done {
263              value "2";
264              description
265               "Task has been completed";
266            }
267          }
268          description
269           "This value the status of any task.
270            The possible values are NA, PENDING or DONE.
271            ";
272            }
273
274
275     container subnet-op-data {
276         config false;
277         list subnet-op-data-entry {
278             key subnet-id;
279             leaf subnet-id {
280                 type    yang:uuid;
281                 description "UUID representing the subnet ";
282             }
283             leaf nh-dpnId {
284                 type uint64;
285                 description "DpnId for the DPN used as nexthop for this subnet";
286             }
287             leaf vpn-name {
288                 type string;
289                 description "VPN Instance name";
290             }
291             leaf vrf-id {
292                 type string;
293             }
294             leaf subnet-cidr {
295                 type string;
296                 description "Subnet in cidr notation";
297             }
298             leaf route-adv-state {
299                 type task-state;
300                 description "The status of the subnet route advertisement. Route advertisement could be in a NA, PENDING or DONE state.";
301             }
302             leaf elan-tag{
303                 type uint32;
304             }
305             list subnet-to-dpn {
306                 key dpnId;
307                 leaf dpnId {
308                     type uint64;
309                 }
310                 list vpn-interfaces {
311                     key interface-name;
312                     leaf interface-name {
313                         type string;
314                     }
315                 }
316             }
317
318         }
319     }
320
321     container port-op-data {
322         config false;
323         list port-op-data-entry {
324             key port-id;
325             leaf port-id {
326                 type  string;
327                 description "UUID in string format representing the port ";
328             }
329             leaf subnet-id {
330                 type  yang:uuid;
331                 description "Back reference to obtain the subnet for a port ";
332             }
333             leaf dpnId {
334                 type uint64;
335             }
336         }
337     }
338
339
340     grouping dpn-in-vpn-event {
341         leaf dpn-id { type uint64; }
342         leaf vpn-name { type string; }
343         leaf rd { type string; }
344     }
345
346     notification add-dpn-event {
347         container add-event-data {
348            uses dpn-in-vpn-event;
349         }
350     }
351
352     notification remove-dpn-event {
353         container remove-event-data {
354            uses dpn-in-vpn-event;
355         }
356     }
357
358     /*
359      * Configured Transport Type for l3vpn service.
360      */
361     container conf-transport-type-l3vpn {
362         leaf transport-type {
363             mandatory "true";
364             type identityref {
365                 base odlif:tunnel-type-base;
366             }
367             description
368                 "L3VPN service will use this config to setup
369                 the transport type for tunnels between DPNs.";
370         }
371     }
372
373     /* container to maintain mapping between neutron router and DPN(s) on which vpn-interfaces for router are present */
374     container neutron-router-dpns {
375         config false;
376         list router-dpn-list {
377             key router-id;
378             leaf router-id { type string;}
379             list dpn-vpninterfaces-list {
380                 key dpn-id;
381                 leaf dpn-id { type uint64;}
382                 list router-interfaces {
383                     key interface;
384                     leaf interface { type string; }
385                 }
386             }
387         }
388     }
389
390     /* container to maintain mapping between DPN(s) and the routers */
391     container dpn-routers {
392         config false;
393         list dpn-routers-list {
394             key dpn-id;
395             leaf dpn-id { type uint64;}
396             list routers-list {
397                 key router;
398                 leaf router { type string;}
399             }
400         }
401     }
402
403     container router-interfaces {
404         list router-interface {
405             key interface-name;
406             leaf interface-name { type string; }
407             leaf router-name { type string; }
408         }
409     }
410
411     container dpn-to-vtep-map {
412         config false;
413         list dpn-to-vtep {
414             key dpnId;
415             leaf dpnId { type uint64;}
416             leaf vtepip { type string; }
417         }
418     }
419 }