Add missing license headers
[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 label { type uint32; config "false"; } /* optional */
20             leaf mac_address {type string;} /* optional */
21         }
22     }
23
24     grouping vpn-route-list{
25         leaf-list route-entry-id{
26             type uint32;
27         }
28     }
29
30     augment "/l3vpn:vpn-interfaces/l3vpn:vpn-interface" {
31         ext:augment-identifier "adjacencies";
32         uses adjacency-list;
33     }
34
35     augment "/l3vpn:vpn-interfaces/l3vpn:vpn-interface" {
36         ext:augment-identifier "opState";
37         leaf stateUp {type boolean; config false;}
38     }
39
40     /* Operational DS containers for reverse lookups*/
41     container prefix-to-interface {
42         config false;
43         list vpn-ids {
44            key vpn-id;
45            leaf vpn-id {type uint32;}
46            list prefixes {
47               key ip_address;
48               leaf ip_address {type string;}
49               leaf dpnId {
50                  type uint64;
51               }
52               leaf vpn-interface-name {
53                   type string;
54               }
55            }
56         }
57     }
58
59     container vpn-to-extraroute {
60         config false;
61         list vpn {
62            key vrf-id;
63            leaf vrf-id {
64               description
65                  "The vrf-id command configures a route distinguisher (RD)
66                   for the IPv4 or IPv6 address family of a VPN instance or
67                   vpn instance name for internal vpn case.";
68               type string;
69            }
70            list extraroute {
71               key prefix;
72               leaf prefix {type string;}
73               leaf-list nexthop-ip-list {
74                   type string;
75               }
76            }
77         }
78     }
79
80     /* Data models to adhere to restart requirements */
81     container vpn-instance-to-vpn-id {
82        list vpn-instance {
83           key vpn-instance-name;
84           leaf vpn-instance-name {
85              type string;
86           }
87           leaf vpn-id {
88              type uint32;
89           }
90           leaf vrf-id {
91               description
92                  "The vrf-id command configures a route distinguisher (RD)
93                   for the IPv4 or IPv6 address family of a VPN instance or
94                   vpn instance name for internal vpn case.";
95               type string;
96           }
97        }
98     }
99
100     container vpn-id-to-vpn-instance {
101            list vpn-ids {
102               key vpn-id;
103               leaf vpn-id {
104                  type uint32;
105               }
106               leaf vpn-instance-name {
107                  type string;
108               }
109               leaf vrf-id {
110                   description
111                      "The vrf-id command configures a route distinguisher (RD)
112                       for the IPv4 or IPv6 address family of a VPN instance or
113                       vpn instance name for internal vpn case.";
114                   type string;
115               }
116               leaf external-vpn {
117                   type boolean;
118                   description "The VPN is external?";
119               }
120            }
121     }
122
123     container vpn-to-pseudo-port-tag-data {
124         description "Makes a correspondence between VRFs and their corresponding VpnPseudoPort";
125         list vpn-to-pseudo-port-tag {
126             key vrf-id;
127             leaf vrf-id {
128                 type string;
129             }
130             leaf lport-tag {
131                 description "Vpn Pseudo Logical Port Tag";
132                 type uint32;
133             }
134         }
135     }
136
137     container vpn-instance-op-data {
138         config false;
139         list vpn-instance-op-data-entry {
140            key vrf-id;
141            leaf vpn-id { type uint32;}
142            leaf vrf-id {
143               description
144                  "The vrf-id command configures a route distinguisher (RD)
145                   for the IPv4 or IPv6 address family of a VPN instance or
146                   vpn instance name for internal vpn case.";
147               type string;
148            }
149
150            leaf vpn-instance-name {
151                description "Typical the VPN Uuid";
152                type string;
153            }
154
155            leaf vpn-interface-count { type uint32; }
156            uses vpn-route-list;
157            list vpn-to-dpn-list {
158                key dpnId;
159                leaf dpnId {
160                   type uint64;
161                }
162                list vpn-interfaces {
163                   key interface-name;
164                   leaf interface-name {
165                       type string;
166                   }
167                }
168                list ip-addresses {
169                    key ip-address;
170                    leaf ip-address { type string; }
171                }
172            }
173         }
174     }
175
176
177     typedef task-state {
178          type enumeration {
179            enum na {
180              value "0";
181              description
182               "Task not applicable";
183            }
184            enum pending {
185              value "1";
186              description
187               "Task is in pending state";
188            }
189            enum done {
190              value "2";
191              description
192               "Task has been completed";
193            }
194          }
195          description
196           "This value the status of any task.
197            The possible values are NA, PENDING or DONE.
198            ";
199            }
200
201
202     container subnet-op-data {
203         config false;
204         list subnet-op-data-entry {
205             key subnet-id;
206             leaf subnet-id {
207                 type    yang:uuid;
208                 description "UUID representing the subnet ";
209             }
210             leaf nh-dpnId {
211                 type uint64;
212                 description "DpnId for the DPN used as nexthop for this subnet";
213             }
214             leaf vpn-name {
215                 type string;
216                 description "VPN Instance name";
217             }
218             leaf vrf-id {
219                 type string;
220             }
221             leaf subnet-cidr {
222                 type string;
223                 description "Subnet in cidr notation";
224             }
225             leaf route-adv-state {
226                 type task-state;
227                 description "The status of the subnet route advertisement. Route advertisement could be in a NA, PENDING or DONE state.";
228             }
229             leaf elan-tag{
230                 type uint32;
231             }
232             list subnet-to-dpn {
233                 key dpnId;
234                 leaf dpnId {
235                     type uint64;
236                 }
237                 list vpn-interfaces {
238                     key interface-name;
239                     leaf interface-name {
240                         type string;
241                     }
242                 }
243             }
244
245         }
246     }
247
248     container port-op-data {
249         config false;
250         list port-op-data-entry {
251             key port-id;
252             leaf port-id {
253                 type  string;
254                 description "UUID in string format representing the port ";
255             }
256             leaf subnet-id {
257                 type  yang:uuid;
258                 description "Back reference to obtain the subnet for a port ";
259             }
260             leaf dpnId {
261                 type uint64;
262             }
263         }
264     }
265
266
267     grouping dpn-in-vpn-event {
268         leaf dpn-id { type uint64; }
269         leaf vpn-name { type string; }
270         leaf rd { type string; }
271     }
272
273     notification add-dpn-event {
274         container add-event-data {
275            uses dpn-in-vpn-event;
276         }
277     }
278
279     notification remove-dpn-event {
280         container remove-event-data {
281            uses dpn-in-vpn-event;
282         }
283     }
284
285     /*
286      * Configured Transport Type for l3vpn service.
287      */
288     container conf-transport-type-l3vpn {
289         leaf transport-type {
290             mandatory "true";
291             type identityref {
292                 base odlif:tunnel-type-base;
293             }
294             description
295                 "L3VPN service will use this config to setup
296                 the transport type for tunnels between DPNs.";
297         }
298     }
299
300     /* container to maintain mapping between neutron router and DPN(s) on which vpn-interfaces for router are present */
301     container neutron-router-dpns {
302         config false;
303         list router-dpn-list {
304             key router-id;
305             leaf router-id { type string;}
306             list dpn-vpninterfaces-list {
307                 key dpn-id;
308                 leaf dpn-id { type uint64;}
309                 list router-interfaces {
310                     key interface;
311                     leaf interface { type string; }
312                 }
313             }
314         }
315     }
316
317
318     container router-interfaces {
319         list router-interface {
320             key interface-name;
321             leaf interface-name { type string; }
322             leaf router-name { type string; }
323         }
324     }
325 }